Hi!
This should be easy to do. Maybe the ascii math is not so obvious, but what you need to do is to integrate log(y_n) for the nth state of the ODE instead of y_n. To do that take you current ODE system
dy_n/dt = f(y_1, ... y_n, ...)
then divide the n-th ODE rhs by y_n, so you get
1/y_n dy_n/dt = dly_n/dt = f(y_1, ... y_n, ...)/y_n
This will make your states y_n to be log-states ly_n=log(y_n). All you have to do now is to transform from the log(y_n) to y_n just before the ODE rhs in the functor which you wrote in Stan. That's it.
However, there is a catch here - calculating things on the log scale means that you cannot represent a 0. You can only represent values close to zero which is something to consider when initializing. So you will have to call 10^-5 or something like that to be zero; which number here makes sense depends on your problem specifics. Do not make this number crazy small as this will make the system terribly hard to solve (going from nothing to something is a huge jump on the log-scale).
Sebastian