mod file compile problem

NMODL and the Channel Builder.
Post Reply
wangpele
Posts: 2
Joined: Sat Jul 30, 2011 5:31 am

mod file compile problem

Post by wangpele »

Hi,

I am new to Neuron. Currently I am following Chapter11 to build a small network. First, I wrote the mod file named invlfire:

Code: Select all

NEURON {
	ARTIFICIAL_CELL IntervalFire
	RANGE tau, m, invl
}
PARAMETER {
	tau = 5 (ms) <1e-9,1e9>
	invl = 10 (ms) <1e-9,1e9>
}
ASSIGNED {
	m minf
	t0(ms)
}
INITIAL {
	minf = 1/(1 - exp(-invl/tau)) : so natural spike interval is invl
	m = 0
	t0 = t
	net_send(firetime(), 1)
}
NET_RECEIVE (w) {
	m = M()
	t0 = t
	if (flag == 0) {
		m = m + w
		if (m > 1) {
			m = 0
			net_event(t)
		}
		net_move(t+firetime())
	} else {
	net_event(t)
	m = 0
	net_send(firetime(), 1)
	}
}
FUNCTION firetime()(ms) { : m < 1 and minf > 1
	firetime = tau*log((minf-m)/(minf - 1))
}
FUNCTION M() {
	M = minf + (m - minf)*exp(-(t - t0)/tau)
}
Then I tried to compile the mod file following the instructions at http://www.neuron.yale.edu/neuron/stati ... mswin.html. (I am using Neuron 7.1 on WinXP) and the result is:
gcc -DDLL_EXPORT -DPIC -I/cygdrive/c/nrn71/src/scopmath -I/cygdrive/c/nrn71/src/nrnoc -I/cygdrive/c/nrn71/src/oc -I/cygdrive/c/nrn71/lib -I/cygdrive/c/nrn71/gccinc -I/cygdrive/c/nrn71/gcc3inc -L/cygdrive/c/nrn71/gcclib -c mod_func.c
nocmodl IntervalFire
Translating IntervalFire.mod into IntervalFire.c
Thread Safe
gcc -DDLL_EXPORT -DPIC -I/cygdrive/c/nrn71/src/scopmath -I/cygdrive/c/nrn71/src/nrnoc -I/cygdrive/c/nrn71/src/oc -I/cygdrive/c/nrn71/lib -I/cygdrive/c/nrn71/gccinc -I/cygdrive/c/nrn71/gcc3inc -L/cygdrive/c/nrn71/gcclib -c IntervalFire.c
rm IntervalFire.c
gcc -I/cygdrive/c/nrn71/lib -I/cygdrive/c/nrn71/gccinc -I/cygdrive/c/nrn71/gcc3inc -L/cygdrive/c/nrn71/gcclib -shared -o nrnmech.dll mod_func.o IntervalFire.o \
-L/cygdrive/c/nrn71/bin -lnrniv
Info: resolving _nrn_point_prop_ by linking to __imp__nrn_point_prop_ (auto-import)
ld: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.Info: resolving _pnt_receive by linking to __imp__pnt_receive (auto-import)
Info: resolving _pnt_receive_size by linking to __imp__pnt_receive_size (auto-import)
rebase -b 0x64000000 -v nrnmech.dll
nrnmech.dll: new base = 64000000, new size = 10000

nrnmech.dll was built successfully.
Press Return key to exit
After that, I launch nrngui but I did not see "Additional mechanisms from files invlfire.mod" appeared at the end of Nueron's startup message. Does this mean the mod file was not compiled successfully?
Then I uninstall Neuron 7.1 and install Neuron 7.2 alpha version. When compiling the same mod file, it said:
gcc -DDLL_EXPORT -DPIC -I/cygdrive/C/nrn72/src/scopmath -I/cygdrive/C/nrn72/src/nrnoc -I/cygdrive/C/nrn72/src/oc -I/cygdrive/C/nrn72/lib -I/cygdrive/C/nrn72/gccinc -I/cygdrive/C/nrn72/gcc3inc -L/cygdrive/C/nrn72/gcclib -c mod_func.c
nocmodl IntervalFire
Translating IntervalFire.mod into IntervalFire.c
Thread Safe
gcc -DDLL_EXPORT -DPIC -I/cygdrive/C/nrn72/src/scopmath -I/cygdrive/C/nrn72/src/nrnoc -I/cygdrive/C/nrn72/src/oc -I/cygdrive/C/nrn72/lib -I/cygdrive/C/nrn72/gccinc -I/cygdrive/C/nrn72/gcc3inc -L/cygdrive/C/nrn72/gcclib -c IntervalFire.c
gcc -I/cygdrive/C/nrn72/lib -I/cygdrive/C/nrn72/gccinc -I/cygdrive/C/nrn72/gcc3inc -L/cygdrive/C/nrn72/gcclib -shared -o nrnmech.dll mod_func.o IntervalFire.o \
-L/cygdrive/C/nrn72/bin -lnrniv
rebase -b 0x64000000 -v nrnmech.dll
nrnmech.dll: new base = 64000000, new size = 10000

nrnmech.dll was built successfully.
Press Return key to exit
Then I launch nrngui but still I did not see "Additional mechanisms from files invlfire.mod" appeared at the end of Nueron's startup message.

I noticed that in the compile instruction website, it said "If all goes well (and it will, for this particular set of mod files), eventually the last message will appear, and the console window will go away on its own. " So I am guessing that something wrong with my mod file compile. I tried this on clean WinXP system running on VMWare, and it is the same result. So could you please give me some advice, thank you very much!

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

Re: mod file compile problem

Post by ted »

I noticed that in the compile instruction website
You're referring to this page
http://www.neuron.yale.edu/neuron/stati ... mswin.html
it said "If all goes well (and it will, for this particular set of mod files), eventually the last message will appear, and the console window will go away on its own."
That was correct 3 years ago, but not now. I'll revise the page to read something like this:
"eventually the console window will go away on its own, or you'll see a message like
'nrnmech.dll was built successfully.
Press Return key to exit'"
So I am guessing that something wrong with my mod file compile.
No, it's probably ok. My bet is that NEURON started with the current working directory being a different place than the directory where your new nrnmech.dll file is located. This would happen if you start NEURON by double clicking on the nrngui icon in the NEURON program group, or on a copy of that icon that you put on your desktop. If you want NEURON to load the mechanisms from your new nrnmech.dll file, you can either
(1) change the working directory to the one that contains the nrnmech.dll file
or
(2) start NEURON by double clicking on a hoc file that is in the same directory as the nrnmech.dll file.

To change the working directory, you can click on
NEURON Main Menu / File / working dir
and then use the directory browser to go to the directory that you want. This may require a lot of mouse clicks, but once you get there, NEURON will "remember" that location. The next time you start NEURON, you will be able to go straight to that directory by clicking on
NEURON Main Menu / File / recent dir
and then selecting the directory from a list.

I like to avoid all that mousing around. I do it by creating a file called init.hoc that contains just this one line:
load_file("nrngui.hoc")
and putting it in the same directory as my new nrnmech.dll. Then I can start NEURON by double clicking on that hoc file, and presto! NEURON automatically makes that directory its working directory.
wangpele
Posts: 2
Joined: Sat Jul 30, 2011 5:31 am

Re: mod file compile problem

Post by wangpele »

Hi Ted,

Problem solved. Thank you so much!

Best,
Pele
Post Reply