dt resolution and unexpected oscillations

Using the graphical user interface to build and exercise models. Includes customizing the GUI by writing a little bit of hoc or Python
Post Reply
agow
Posts: 9
Joined: Tue Apr 04, 2017 9:33 am

dt resolution and unexpected oscillations

Post by agow »

i have been testing a single neuron generated with cellbuilder, which includes an axon initia segment so i can explore the effect of changing ion channel densities on the max amplitude of back propagating action potentials (bAPs). i was intrigued by an unexpected oscillation in bAP amplitudes while using tetanic trains between 51 - 52 Hz where successive bAP amplitudes cycled between -40 to -20 mV. however, i discovered this behavior was specific to dt = 0.001 ms time steps (implicit fixed step with sparse solver). now i am wondering how often this might occur and how to avoid the problem.

thanks
alex
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: dt resolution and unexpected oscillations

Post by ted »

I have no idea why that would occur. Suggest you try adaptive integration (CVODE) instead; if the oscillations vanish, then they were some kind of numerical artifact. Would be good to use the GUI's Variable time step tool (NEURON Main Menu / Variable step control) and make sure to use that tool's Atol Scale Tool to automatically discover and apply appropriate scale factors to the error tolerances of the model's states. Click on the Atol Scale Tool's "Hints" button to learn what it does and why it's useful.
agow
Posts: 9
Joined: Tue Apr 04, 2017 9:33 am

Re: dt resolution and unexpected oscillations

Post by agow »

thanks for your suggestions. would love to use daspk just because of the simulation time savings. unfortunately several of the ion channel mechanisms i obtained from modelDB are only compatible with the fixed time step. i cant read or script in hoc so i am unable to solve the problem. is there a conversion utility in nrn that could generate these changes? i tried using an odd time step (dt=0.0011 ms) but this is not permitted.
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: dt resolution and unexpected oscillations

Post by ted »

With fixed step methods, # of points plotted per ms controls what values can be used for dt (a whole number of time steps must pass from one plotted point to another). The hoc name for this parameter is steps_per_ms; its value can be changed by a simple assignment statement, or by changing the number in the numeric field next to the RunControl panel's "Points plotted/ms" button. Example: if the value shown is 40, then the largest allowable time step is 1/40 ms, and allowable values of dt are integer fractions of 1/40 ms, i.e. 0.025 * 1/i ms, where i = 1,2,3...
agow
Posts: 9
Joined: Tue Apr 04, 2017 9:33 am

Re: dt resolution and unexpected oscillations

Post by agow »

OK works now. i must have attempted adjusting dt in the wrong way. unfortunately i still see the oscillation using 973 points plotted / ms so the only option seems to be finding daspk compatible channels or figuring out how to convert them. any pointers here?
thanks
agow
Posts: 9
Joined: Tue Apr 04, 2017 9:33 am

Re: dt resolution and unexpected oscillations

Post by agow »

just checked with the Neuron book and daspk should work for me. i am running the extracellular mechanism to simulate myelin on the axon. just checking that the numerical method selection is operating correctly. when i open the dialog from the variable timestep window, i can select daspk but i cannot deselect implicit fixed step. when i click the refresh button, daspk auto deselects so i am not sure whether daspk is functional. when i run a simulation the value of dt in the runcontrol window remains constant. does this imply that daspk is not functioning?
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: dt resolution and unexpected oscillations

Post by ted »

agow wrote:just checking that the numerical method selection is operating correctly. when i open the dialog from the variable timestep window, i can select daspk but i cannot deselect implicit fixed step.
Don't try to outguess the variable time step tool. Exit NEURON. Start anew. After model setup is complete, click in the "Use variable dt box" so a checkmark appears, and let the tool decide for itself which integrator to use. Then click on the Atol Scale Tool button, and in the upper left corner of the window that pops up, click on "Analysis Run". After the analysis run finishes, click on the "Rescale" button to apply the scale factors.
agow
Posts: 9
Joined: Tue Apr 04, 2017 9:33 am

Re: dt resolution and unexpected oscillations

Post by agow »

i am running nrn-7.4 on a Core2 vPro machine and windows 7 enterprise.

i tested your recommended sequence with NEURONdemo and obtained the pop up window.

not so lucky loading my own myelinated neuron. Clicking the use variable dt checks the box. Clicking the Atol scale tool button is acknowledged in the terminal window with text about CVode[0] and other numerical method panels. however, the pop up window does not appear.

there was also a warning in the terminal that na12 (one of the sodium channel mechanisms) cannot be used with CVODE near line 1 {atoltool()}. i dont know if this precludes all variable timestep methods.
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: dt resolution and unexpected oscillations

Post by ted »

warning in the terminal that na12 (one of the sodium channel mechanisms) cannot be used with CVODE
Then you're stuck--you can't run simulations with adaptive integration using that mechanism in its current implementation.

Revising mod files to make them CVODE compatible requires a bit of knowledge about NMODL. If many files must be revised, the process can be tedious because one should really run tests to verify that (1) each revised mechanism delivers the same results as the original when executed with fixed time steps and (2) execution of simple tests (e.g. a series of voltage clamp experiments in a single compartment model) with adaptive integration produces results that are qualitatively very similar to those generated by the original mechanism. Occasionally one encounters a mechanism that simply becomes unstable when implemented with adaptive integration. Also, it is not infrequent to discover that unrelated errors in mechanisms that need revision to be compatible with adaptive integration.

Of course it's always possible that someone has already implemented CVODE-compatible forms of the mechanism or mechanisms that you need to revise. If the model has already been entered into ModelDB, then before revising any file you might want to start by looking at the version in ModelDB.
agow
Posts: 9
Joined: Tue Apr 04, 2017 9:33 am

Re: dt resolution and unexpected oscillations

Post by agow »

looking at the mod files, i see they are built by Zach Mainen and Alain Destexhe in the mid 90s. thanks for your help.
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: dt resolution and unexpected oscillations

Post by ted »

Then most of them are probably not compatible with adaptive integration, and updated versions of most of them probably already exist. To provide more specific advice, I will have to know exactly what code you are using.
agow
Posts: 9
Joined: Tue Apr 04, 2017 9:33 am

Re: dt resolution and unexpected oscillations

Post by agow »

Hi ted,
just looking at the scope of this project and i suspect that a search for CVODE compatible mechanisms might take as long as i have to explore the model (a week or so). Accordingly i might just take this on the chin. I increased Atol stringency on a few runs and it seems to stabilize the solutions so that oscillations degenerate to constancy. i think a broader search/convert would be a great exercise for undergrad neuroscience majors to get into to NEURON and modelDB. Wayne State is developing a neuroscience program so i will suggest this as a course for the seniors.
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: dt resolution and unexpected oscillations

Post by ted »

The mod files in the current version of
https://senselab.med.yale.edu/modeldb/s ... model=2488
have all been "fixed" so they work properly with both fixed dt and variable time step integration. If you're using older versions of these, then these should be exact "plug-in replacements".
agow
Posts: 9
Joined: Tue Apr 04, 2017 9:33 am

Re: dt resolution and unexpected oscillations

Post by agow »

Hi ted,
this is fantastic news. I looked for updates but i didnt find them. i will test them post haste. cheers and thanks again.
agow
Posts: 9
Joined: Tue Apr 04, 2017 9:33 am

Re: dt resolution and unexpected oscillations

Post by agow »

followed your lead and found the additional updated channels (na12 and na16 from foutz et al) that i have been using. sadly the new channels have different kinetics so a straight substitution is not possible. will have to leave this for now and continue with fixed dt. thanks again.
Post Reply