current balance violation?

Anything that doesn't fit elsewhere.
Post Reply
exp
Posts: 5
Joined: Tue Jan 17, 2006 5:47 am

current balance violation?

Post by exp »

Hello,

I'm slightly confused that in the following simple model ...

create soma
access soma
nseg=1
L=10
diam=10/PI
insert pas
objectvar stim
stim = new IClamp(0.5)
stim.del=1
stim.dur=2
stim.amp=0.1

... when plotting
soma.i_cap( 0.5 ) + soma.i_pas(0.5) - stim.i
I don't get zero but something in the order of picoamps. - I noticed this in a simulation with more conductances, where the deviation was in the order of 10s of picoamps.

Can anyone think of a reason for this?

Thanks and best wishes,
Christian.
ted
Site Admin
Posts: 6305
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

This error, which does not affect the computation of voltages or STATEs, is proportional to
dt, and vanishes when adaptive integration (CVODE) is used. It affects currents and
conductances computed in the BREAKPOINT block, and results from the sequence of
calculations that are performed in fixed time step integration. A complete explanation is
presented in chapter 7 of The NEURON Book (pp.165-171), but the basic idea is that,
when fixed time step integration is used, currents (and conductances) are computed at
told + dt/2, and these are used to compute voltages and STATEs at told + dt. If NEURON
called fcurrent() at the end of fadvance(), the currents and conductances would be
recomputed at tnew + dt, and the discrepancy would disappear. The cost would be slower
simulation execution, and the accuracy of voltages and STATEs would not increase.
Also, for most purposes (e.g. plotting individual currents) there would be no noticeable
effect on reported currents and conductances.

There are situations in which it is useful to examine small differences between currents.
In such cases, either use smaller dt, or make the error vanish by
1. adding FUNCTIONs to your channel mechanisms that use the present values of t,
v, and STATEs to return consistent first-order values for currents
OR
2. switch to adaptive integration
Post Reply