Page 1 of 1

NMODL file in different folder

Posted: Thu Aug 23, 2018 7:14 am
by Dradeliomecus
Hi,

Is it possible to put all the NMODL files in a folder and tell hoc to go find the compiled nrnmech.dll in this folder?

And if it's possible, is it also possible to put them in 2 differents folders (like a folder "channels" and a folder "synapses") and tell hoc to look in these 2 folders?

Thanks.

Re: NMODL file in different folder

Posted: Thu Aug 23, 2018 11:24 am
by ted
Yes, but it's rarely useful. How are you ever going to share your code with anyone else? "Oh, that'll never happen." Right.

KISS--if a model needs a particular set of mechanisms, put the necessary mod files in the same directory as the other files that the model uses. If you can't live with that, put the mod files into a subdirectory of the one that contains the other files that the model needs. Then execute
nrnivmodl subdirname.

Re: NMODL file in different folder

Posted: Mon Aug 27, 2018 5:49 am
by Dradeliomecus
It's just that I have channels being used in different cells, and I'd like my folder architecture to be just one file (main hoc file) and subdirectories with "channels", "synapses", "cells"..., that way it'll be more understandable if I share my code and it'll be cleaner :)

How do you run nrnivmodl subdirname? That looks like what I'm looking for.

Thanks.

Re: NMODL file in different folder

Posted: Mon Aug 27, 2018 11:03 am
by ted
Every elaborate strategy is perfectly natural and intuitive to its inventor, but appears to be idiosyncratic and obscure to everyone else.

Apropos of which, it seemed to me that
nrnivmodl subdirname
was about as obvious as the nose on anyone's face, but apparently not. Let me try again.

If the working directory contains a subdirectory foo, and foo contains NMODL files,
nrnivmodl foo
will compile the NMODL files in foo.

Re: NMODL file in different folder

Posted: Thu Aug 30, 2018 4:33 am
by Dradeliomecus
Ok thanks.
So I guess my problem was actually that 'nrnivmodl' isn't recognized as a command, and what I want to do doesn't work with mknrndll.hoc.

I'll look into it, thank you for your help!
EDIT: It doesn't work on Windows: viewtopic.php?t=1909

Re: NMODL file in different folder

Posted: Fri Nov 15, 2019 11:16 am
by RobinDS
I'm distributing models as part of a python package. During a post-install script I'd like to compile all of the mod files that are in a subfolder of the package, and I'd like NEURON to be able to find the resulting .dll from any folder on that machine. Right now it only seems to look in the current working directory where python is running. How can I change this?

Re: NMODL file in different folder

Posted: Sun Nov 17, 2019 2:59 pm
by ted
RobinDS wrote: Fri Nov 15, 2019 11:16 am I'm distributing models as part of a python package. During a post-install script I'd like to compile all of the mod files that are in a subfolder of the package, and I'd like NEURON to be able to find the resulting .dll from any folder on that machine. Right now it only seems to look in the current working directory where python is running. How can I change this?
nrn_load_dll() with an appropriate path argument. Read about it https://www.neuron.yale.edu/neuron/stat ... n_load_dll

Re: NMODL file in different folder

Posted: Wed Nov 20, 2019 3:35 pm
by RobinDS
On Linux it generates a folder x86_64 and a file called a.out. How would I go about loading that?

The documentation mentions that nrn_load_dll works for Linux, but I don't see a dll file?

Re: NMODL file in different folder

Posted: Thu Nov 21, 2019 11:06 am
by ted
RobinDS wrote: Wed Nov 20, 2019 3:35 pmOn Linux it generates a folder x86_64
. . .
The documentation mentions that nrn_load_dll works for Linux, but I don't see a dll file?
The file you want to load is x86_64/.libs/libnrnmech.so

You realize that, by doing this, you are writing code that will not work under MSWin or MacOS. And unless you use relative paths, it won't work on anybody else's Linux box either. Becomes a problem for collaborating with others, not to mention accumulating citations of whatever you publish. Of course, you can prevent OS-related problems by testing for OS and then using OS-specific paths, but then it's up to you to make sure that the tests and paths work. Diverts time and effort from productive activities.

Re: NMODL file in different folder

Posted: Thu Nov 21, 2019 11:30 am
by RobinDS
These are software deployment basics, but thanks for the heads up. libnrnmech.so inside of the hidden .libs folder does the trick