Page 1 of 1

what does run() do?

Posted: Sun Jul 15, 2007 3:18 pm
by JZ
What exactly happens when you call "run()"?
Does it automatically call "finitialize()?" Because it seems to be behaving like it is doing that...

my code looks like this:

Code: Select all

fin = FInitializeHandler ("func()")

proc func () {
    print "test"
    }

finitialize()
run()
I get an output that looks like:

test
test

rather than the single "test" that I would have expected...

Posted: Mon Jul 16, 2007 9:52 am
by ted
Good diagnosis. run() is discussed on pages 163-164 of The NEURON Book.
Alternatively, you can analyze stdrun.hoc in nrn/share/nrn/lib/hoc/ (c:\nrnxx\lib\hoc
under MSWin).

In NEURON 6.0, the standard run system's definition of run() is

Code: Select all

proc run() {
        running_ = 1
        stdinit()
        continuerun(tstop)
}
stdinit() is defined as

Code: Select all

proc stdinit() {
        cvode_simgraph()
        realtime = 0
        setdt()
        init()
        initPlot()
}
and the definition of init(), complete with comments, is

Code: Select all

proc init() {
        finitialize(v_init)
        // fcurrent() // no longer necessary. finitialize now
        // initializes all conductances and currents as well as states.
        // Extra initialization should normally go here.
        // If you change any states or parameters after an finitialize
        // then you should complete the initialization with
    /*
        if (cvode.active()) {
                cvode.re_init()
        }else{
                fcurrent()
        }
        frecord_init()
    */
}