Calling procedure from mod.file using terminal prompt

Anything that doesn't fit elsewhere.
Post Reply
arp93
Posts: 3
Joined: Tue Feb 07, 2012 9:05 pm

Calling procedure from mod.file using terminal prompt

Post by arp93 » Tue Feb 07, 2012 11:01 pm

Hey Everyone!

Thanks for taking the time to try and help me out. I am new to NEURON and so this question is probably really simple to answer.
I have recently added a procedure to a mod file which I placed below

PROCEDURE block_pna(A) {
LOCAL block_fraction
block_fraction = A
gnabar = block_fraction * 2.0e-5
: gnabar = $1 * 2.0e-5
}

The mod file is inserted into a hoc file and I want to be able to call the procedure from the mod file using the terminal prompt. However, every time I try I get error messages. I am fairly certain I need to follow a format like

soma.mod.file name. procedure_name(value)

but I have been hitting dead ends. Again I am sure this is a very easy fix, and so I appreciate anything you can offer in way of advice or example.

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

Re: Calling procedure from mod.file using terminal prompt

Post by ted » Wed Feb 08, 2012 11:09 am

arp93 wrote:every time I try I get error messages
Insufficient information to answer your question. Please provide the contents of the mechanism's NEURON block. Also provide an example of exactly how you are trying to call the procedure from hoc, including the actual error message. Use the mouse cursor to select and copy, from NEURON's terminal, what you entered at the oc> prompt and what hoc said in reply, and paste it into your next post in this discussion thread.

arp93
Posts: 3
Joined: Tue Feb 07, 2012 9:05 pm

Re: Calling procedure from mod.file using terminal prompt

Post by arp93 » Wed Feb 08, 2012 11:36 am

Thanks here is a copy of the NEURON Block and error messages

Code: Select all

NEURON { 
	SUFFIX GrC_pNa 
	USEION na READ ena WRITE ina 
	RANGE gnabar, ina, g, alpha_m, beta_m
	RANGE Aalpha_m, Kalpha_m, V0alpha_m
	RANGE Abeta_m, Kbeta_m, V0beta_m
	RANGE V0_minf, B_minf
	RANGE m_inf, tau_m
}


And here a copy of the error messages I get when I try to call the procedure (my format may be incorrect, but that is why I posted the question unfortunately)

Code: Select all

oc>block_pna(.5)
nrniv: block_pna undefined function
 near line 24
 block_pna(.5)
              ^
block_pna(0.5        )

oc>proc block_pna(.5)
nrniv: syntax error
 near line 26
 proc block_pna(.5)
                 ^
oc>soma.pNa.block_pna(.5)
nrniv: pNa not a section variable
 near line 27
 soma.pNa.block_pna(.5)
        ^
Once again the procedure I am trying to call is

Code: Select all

PROCEDURE block_pna(A) {
LOCAL block_fraction
block_fraction = A
gnabar = block_fraction * 2.0e-5
: gnabar = $1 * 2.0e-5
}
Thank you again!

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

Re: Calling procedure from mod.file using terminal prompt

Post by ted » Wed Feb 08, 2012 12:22 pm

According to the NEURON block, this is a density mechanism with SUFFIX GrC_pNa. So every name in this mechanism that is visible to hoc will include the suffix _GrC_pNa. This means that PROCEDURE block_pna will be known to hoc as block_pna_GrC_pNa.

The NMODL code for this procedure is

Code: Select all

PROCEDURE block_pna(A) {
LOCAL block_fraction
block_fraction = A
gnabar = block_fraction * 2.0e-5
: gnabar = $1 * 2.0e-5
}
which reveals that the procedure references a range variable--gnabar. This means it is necessary to use setdata to specify the mechanism instance before calling the procedure from hoc (see p. 126 in The NEURON Book, and also the documentation of setdata in the Programmer's Reference)

Code: Select all

soma setdata_GrC_pNa(0.5) // specify mechanism instance
block_pna_GrC_pNa(0.3) // changes soma.gnabar_GrC_pNa(0.5) to 0.3*2.0e-5
Let me know if that takes care of it--which means "be sure to check that this does indeed work as expected" (in case I mistyped something).

arp93
Posts: 3
Joined: Tue Feb 07, 2012 9:05 pm

Re: Calling procedure from mod.file using terminal prompt

Post by arp93 » Wed Feb 08, 2012 2:12 pm

Thank you! Your advice and suggestions worked perfectly!

Post Reply