Ode_rk45 solving for only one time point

Dear all,
I am trying to solve an ODE at one time point T1 in future hence I feed a single value of solution time to the integrator by:
real T1 = times[i];
however I got data type error:

Semantic error in ‘string’, line 48, column 9 to column 51:
Ill-typed arguments supplied to function ‘ode_rk45’. Expected arguments:
(real, vector) => vector, vector, real, real[]
Instead supplied arguments of incompatible type:
(real, vector, vector) => vector, vector, real, real, vector

Then I tried to define an array of length 1 for solution time by this command:
array[1] real T1 = times[i];
but I failed to assign a real value to this array:

Semantic error in ‘string’, line 47, column 4 to column 32:
Ill-typed arguments supplied to assignment operator =: lhs has type real[] and rhs has type real

Here is my stan code:

functions{
    vector PK3cmt(real t, vector states, vector theta){
    real ka = theta[1];
    real CL = theta[2];
    real Vc = theta[3]; 
    real Q = theta[4]; 
    real Vp = theta[5]; 
    real gut = states[1];
    real cent = states[2]; 
    real peri = states[3];
    vector[3] dif; 
    dif[1] = - ka * gut;
    dif[2] = -ka*gut - ((CL / Vc) + (Q / Vc))*cent + (Q * peri) / Vp; 
    dif[3] = (Q*cent)/ Vc - (Q*peri)/Vp; 
    return dif; 
    }
}
data{
    int N; 
    //vector<lower = 0>[N] time; 
    array[N] real times; 
    int evid[N]; 
    int cmt[N]; 
    vector<lower = 0>[N] amt; 
    int nObs; 
    int iObs[nObs]; 
    vector<lower=0>[N] cObs; 
}
transformed data {
  int nTheta = 5;
  int nCmt = 3;
}
parameters{
  vector[nTheta] theta; //{ka, CL, Vc, Q, Vp}
  real<lower = 0> sigma;
}
transformed parameters{
  vector[nCmt] U; 
  U[1] = 0; 
  U[2] = 0; 
  U[3] = 0; 
  array[N] vector[3] traj;
  for(i in 1:N){
    if (evid[i] == 1) U[cmt[i]] += amt[i];
    else {
    //real T1 = times[i];   // doesn't work
    array[1] real T1 = times[i];  // also doesn't work 
     U = ode_rk45(PK3cmt, U, times[i-1], T1, theta);
    traj[i] = U;
    }
  }
 vector<lower=0>[N] concentrationHat = traj[][2] ./theta[3];
}
model{
  theta[2] ~ lognormal(log(10), 0.25); 
  theta[4] ~ lognormal(log(15), 0.5);
  theta[3] ~ lognormal(log(35), 0.25);
  theta[5] ~ lognormal(log(105), 0.5);
  theta[1] ~ lognormal(log(2.5), 1);
  sigma ~ normal(0, 1);
  cObs ~ lognormal(log(concentrationHat[iObs]), sigma);
}

Any help is apprecaited.
Hassan

This would need to be array[1] real T1 = {times[i]};

There seem to be more errors after fixing this, but they seem more related to the structure of your model so it’s less clear to me what solution to recommend

Thanks a lot, it fixed my problem. :)