    double {{class_name}}::GetIIonic(const std::vector<double>* pStateVariables)
    {
        // For state variable interpolation (SVI) we read in interpolated state variables,
        // otherwise for ionic current interpolation (ICI) we use the state variables of this model (node).
        {{vector_decl}} rY;
        bool made_new_cvode_vector = false;
        if (!pStateVariables)
        {
            rY = rGetStateVariables();
        }
        else
        {
            made_new_cvode_vector = true;
            rY = MakeNVector(*pStateVariables);
        }
        {% for state_var in state_vars %}
        {%- if state_var.in_ionic %}double {{ state_var.var }} = {{state_var.rY_lookup_no_modifier}};
        // Units: {{state_var.units}}; Initial value: {{state_var.initial_value}}
        {% endif %}{%- endfor %}{% for ionic_var in ionic_vars %}
        const double {{ionic_var.lhs}} = {{ionic_var.rhs}}; // {{ionic_var.units}}
        {%- endfor %}

        const double i_ionic = var_chaste_interface__i_ionic;
        if (made_new_cvode_vector)
        {
            DeleteVector(rY);
        }
        EXCEPT_IF_NOT(!std::isnan(i_ionic));
        return i_ionic;
    }