What are some useful ways to debug NEURON simulator .MOD files? In other languages one can usually use print() statements to see the variable values. Is there something like a print() statement in .MOD files?
Use printf()
statements
For example, in any of the sections within a .MOD file, adding the printf()
statement below will print the variable t, i, and v
values every time that section is evaluated during the simulation:
BREAKPOINT {
SOLVE state METHOD cnexp
g = (B - A)*gmax
i = g*(v - e)
printf("time: %g, current: %g, voltage: %g \n", t, i, v)
}
Will result in something that looks like this:
time: 231.062, current: 0.000609815, voltage: -67.2939
time: 231.188, current: 0.000609059, voltage: -67.2938
time: 231.312, current: 0.000608304, voltage: -67.2937
time: 231.438, current: 0.00060755, voltage: -67.2936
time: 231.562, current: 0.000606844, voltage: -67.2924
Notes: