Set pointer when using mod file that defines pointer

NMODL and the Channel Builder.
Post Reply
Posts: 95
Joined: Mon Apr 20, 2009 7:02 pm

Set pointer when using mod file that defines pointer

Post by neuromau » Fri Nov 20, 2015 11:40 am

This is just an FYI - my code was erroring out during a call to fcurrent() (as part of the call from finitialize() during the init procedure). It was reporting a segmentation violation and it took me awhile to realize it was due to the use of a mechanism (mod file) that defined and used a couple of pointers in its BREAKPOINT block, where I was only interested in using (and therefore only setting) one pointer. When a mechanism from a mod file is referenced in NEURON code, all pointers used (ie, on the right side of an equation) in the mod file must be set in the NEURON code. In retrospect, this is super obvious but I'm still adding an FYI post to save others a few minutes if they make this same mistake.

Code: Select all

pointerplaceholder = 0
setpointer mymech.unusedpointer, pointerplaceholder 
(I don't want to remove the pointer from the mechanism as it will certainly be used in other slight variations of the model.)

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

Re: Set pointer when using mod file that defines pointer

Post by ted » Fri Nov 20, 2015 1:27 pm

Good point (no pun intended). Been there, done that, and every time it happens I tell myself "don't do this again"--but eventually guess what happens . . .

The error message really gives no clue

Code: Select all

 Segmentation violation
 near line 1
so the problem can be quite difficult to diagnose unless you just happen to think of it, or have been using a development cycle in which you make only a few incremental changes, then run a test, then make some more changes etc..

Post Reply