Using VecStim() with CVode on

When Python is the interpreter, what is a good
design for the interface to the basic NEURON

Moderator: hines

Post Reply
Posts: 7
Joined: Thu Nov 24, 2016 5:13 pm

Using VecStim() with CVode on

Post by MarkoF » Tue Dec 04, 2018 6:20 am


I have a model with multiple excitatory and inhibitory synapses that I feed previously constructed spike trains via VecStim() mechanism. Now in order to speed up the simulation I am thinking of using the variable time step by activating CVode. What I am concerned about is, how are the incoming spikes being integrated if their arrival time doesn't match the current time step?

With the caveat that I don't know the inner workings of CVode, I'm wondering if a situation can occur when I have two spikes arriving at a synapse, one at e.g. 24.2ms of simulation time, the other at 24.8ms, and that they get bundled together and perceived as arriving at the same time due to an increase of simulation time step? Because that is something that I would like to avoid.

In essence, is it better to use a fixed integration time grid when working with VecStim objects?

Posts: 211
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: Using VecStim() with CVode on

Post by ramcdougal » Tue Dec 04, 2018 7:05 am

Adaptive integration chooses timesteps to constrain error.

In particular, unlike fixed step integration, it will adapt its timesteps to handle events at the time received and not shift them or group them.

Posts: 7
Joined: Thu Nov 24, 2016 5:13 pm

Re: Using VecStim() with CVode on

Post by MarkoF » Tue Dec 04, 2018 7:07 am

Oh, but that's perfect then! I can activate CVode and get faster simulations without loss in integration precision. Thank you very much for your answer!

Site Admin
Posts: 5741
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Re: Using VecStim() with CVode on

Post by ted » Tue Dec 04, 2018 10:59 am

In principle, adaptive integration should work well for a model that involves only one biophysical model cell--as long as all mechanisms are compatible with CVODE.

But always remember that accuracy is the principal reason to use adaptive integration, not speed. While it is true that adaptive integration may execute faster than fixed time step integration, it may also execute slower--sometimes much slower--than fixed time step execution. A case in point: network models in which spiking activity is often so asynchronous that there is never an interval over which large time steps can be taken. Switching to local variable time step integration generally doesn't help much. This is why medium to large scale network models generally use fixed time step integration.

Three comments about events and integration methods:
1. Fixed time step integration doesn't shift events. It simply handles events only at times that are integer multiples of dt.
2. Nor does adaptive integration shift events. It handles them at the exact times that they are delivered.
3. If a presynaptic neuron is a biophysical model cell and adaptive integration is used, for improved accuracy you may want to specify second order detection of presynaptic spike time--read about the CVode class's condition_order() method ... ion_order

Post Reply