Use of crank.c file

Particularly useful chunks of hoc and/or NMODL code. May be pedestrian or stunningly brilliant, may make you gasp or bring tears to your eyes, but always makes you think "I wish I had written that; I'm sure going to steal it."
Post Reply
jackfolla
Posts: 48
Joined: Wed Jul 07, 2010 7:42 am

Use of crank.c file

Post by jackfolla » Fri Apr 27, 2012 4:28 am

Dear all,
I would like to know the size of the tridiagonal matrix and other information from Crank-Nicolson solver (file crank.c in "src/scopmath").

I know that in general it is possible to specify in a mod file the method to use in order to solve a system of equations:

i.e. for using euler method, it is possible specify in a mod file:

BREAKPOINT {
SOLVE state METHOD euler
}

I tried to use cnexp, thinking that CNexp stands for Crank-Nicolson Exponential method, but in this way the crank.c file it is not used.
I know that it is need to set the variable "secondorder" =2, but also setting this value, the method it is not invoked.

Can anyone give me information about it?
If it is possible to post a practical example in a .hoc file that uses the Crank-Nicolson solver?

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

Re: Use of crank.c file

Post by ted » Fri Apr 27, 2012 11:51 am

If you want to learn about using NMODL to add new features to NEURON, read either chaper 9 of The NEURON Book or this article:
Hines, M.L. and Carnevale, N.T.
Expanding NEURON's repertoire of mechanisms with NMODL.
Neural Computation 12:995-1007, 2000
which is available from a link at http://www.neuron.yale.edu/neuron/nrnpubs
jackfolla wrote:I would like to know the size of the tridiagonal matrix
Depends on the particular model that one has set up with hoc and/or Python statements. You don't need this information in order to build or use models, or to add new mechanisms with NMODL.
I know that in general it is possible to specify in a mod file the method to use
Discussed in this post
Integration methods for SOLVE statements
http://www.neuron.yale.edu/phpBB/viewto ... f=28&t=592
in the Hot tips area
http://www.neuron.yale.edu/phpBB/viewforum.php?f=28
of the NEURON Forum
for using euler method
Never use euler. Never.
I tried to use cnexp, thinking that CNexp stands for Crank-Nicolson Exponential method, but in this way the crank.c file it is not used.
I know that it is need to set the variable "secondorder" =2, but also setting this value, the method it is not invoked.
The METHOD specification in any NMODL file pertains only to the state variables in the equations that are generated from the statements in that NMODL file. secondorder and the CVode class are used to control how all other states are integrated.

jackfolla
Posts: 48
Joined: Wed Jul 07, 2010 7:42 am

Re: Use of crank.c file

Post by jackfolla » Thu May 03, 2012 9:21 am

Dear Ted,
thanks for your reply.

I'm interested to know how the Crank-Nicolson method (implemented in src/scopmath/crank.c) works in a NEURON model.

Can someone post me a model that certainly uses crank-nicolson (crank.c)?

Thanks.

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

Re: Use of crank.c file

Post by ted » Thu May 03, 2012 12:25 pm

Suggest you search ModelDB for instances of "secondorder"

Post Reply