.mod files in subfolder under Windows

The basics of how to develop, test, and use models.
Post Reply
henrychen1986
Posts: 15
Joined: Wed Nov 25, 2009 7:07 pm

.mod files in subfolder under Windows

Post by henrychen1986 » Mon Mar 15, 2010 1:38 pm

Hi,

Thanks for previous help!

I am using NEURON under Ubuntu, I always separate .mod files in a subfolder. But I cannot make it work the same in Windows for connecting .mod files in subfolder. Is there any solution for this problem?

Thanks in advance!

Best,
-Henry

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

Re: .mod files in subfolder under Windows

Post by ted » Tue Mar 16, 2010 12:10 am

Yeah. Don't do it. The workaround will be OS-specific--a custom command line that tells NEURON where to find the compiled mechanisms. Makes things harder for you and your collaborators, an added complication for not much payoff. What problem are you trying to solve by separating the mod files from the hoc files?

henrychen1986
Posts: 15
Joined: Wed Nov 25, 2009 7:07 pm

Re: .mod files in subfolder under Windows

Post by henrychen1986 » Thu Mar 18, 2010 8:26 pm

Thanks for reply, Ted!

I put all .mod files in a subfolder called "mechanisms" in Ubuntu, because I have 20 .mod files. Then I use the command

Code: Select all

nrnivmodl mechanisms
to compile the .mod files. It works fine in Ubuntu.

But when I copy those files to Windows, I dont know how to compile the .mod in subfolder. When I use nrnmkdll, it just compile those .mod files into the subfolder, I cannot link to those mechanisms in main folder.

Thanks in advance!

-Henry

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

Re: .mod files in subfolder under Windows

Post by ted » Fri Mar 19, 2010 2:01 pm

henrychen1986 wrote:I put all .mod files in a subfolder called "mechanisms" in Ubuntu, because I have 20 .mod files. Then I use the command

Code: Select all

nrnivmodl mechanisms
to compile the .mod files. It works fine in Ubuntu.
Yes, and you get this directory structure:

Code: Select all

hocdir
  moddir
    i686_directory_which_contains_the_compiled_mechanisms
So how do you tell your hoc files where to look for the compiled mechanisms?
nrniv filename.hoc
in hocdir isn't going to do the job.
when I copy those files to Windows, I dont know how to compile the .mod in subfolder. When I use nrnmkdll, it just compile those .mod files into the subfolder, I cannot link to those mechanisms in main folder.
From which I infer that you create a symbolic link inside hocdir that points to the i686 directory. You're right, that isn't very portable--can't do it in MSWin.

You could simply move the nrnmech.dll file from moddir to hocdir, but you'll have to do that every time you recompile the mod files.

You could leave nrnmech.dll in moddir, and insert a hoc statement in your main program that changes the working directory to moddir (this should make NEURON load nrnmech.dll from the new working directory), then change back to hocdir.

You could launch all programs from a DOS box whose working directory is hocdir (for several years MS has been calling it a Command Line Interface Window or some other obscure jargon, but DOS box is easier to write) but include an option on the command line that forces loading of the nrnmech.dll from the moddir--the complete command would look something like this
full_mswin_path_to_neuron.exe -dll full_mswin_path_to_nrnmech.dll your_main_hoc_file.hoc
c:\nrnxx\bin\neuron.exe -dll c:\nrnxx\demo\release\nrnmech.dll
This could be made less painful by creating an MSWin "shell script" (".bat file" they used to be called, but now of course there's a new term) that contains the complete command.

The only approach that is truly portable across platforms, without requiring any effort, is to leave the mod files in the same directory as the hoc files, and compile them there.

Post Reply