Page 1 of 1

Assertion failed: file init.c, line 775

Posted: Wed Sep 20, 2006 10:49 am
by davidsterratt
Hello all,

I can compile the appendend NMODL file (which is meant to simulate the development of the neuromuscular junction), but when I come to run nrngui, I get the following error:

Code: Select all

loading membrane mechanisms from /home/sterratt/projects/nmj/neuron/i686/.libs/libnrnmech.so
Additional mechanisms from files
 nmj.mod
Assertion failed: file init.c, line 775
/home/sterratt/projects/nmj/neuron/i686/special: line 12: 18349 Segmentation fault      "${NRNIV}" -dll "/home/sterratt/projects/nmj/neuron/i686/.libs/libnrnmech.so" "$@"

When I uncomment either of the two lines indicated in the file, the compiled binary works fine. I'm speculating that this has something to do with trying to allocate too much memory, but this is just a hunch.

Note that these variables aren't used for anything yet -- though they will be.

I've tested this on neuron 5.9.9, downloaded today.

Any help would be much appreciated.

David.

Code: Select all

NEURON {
    POINT_PROCESS NMJ
    RANGE A0, alpha, beta, gamma, delta, C0mean, C0std, innervation, count, Cmax, DeltaC
}

DEFINE N 20
DEFINE M 600
DEFINE NM 12000

PARAMETER {
    A0 = 60
    alpha = 45 
    beta = 0.4
    gamma = 3
    delta = 2
    C0mean = 0.01
    C0std =  0.01
}

ASSIGNED {
    innervation[N]
    count[M]
    Cmax[NM]                            : Comment either of these lines out and it will compile
    DeltaC[NM]                          : Comment either of these lines out and it will compile
}

STATE {
    A[N]
    As[NM]
    B[M]
    C[NM]
}

INITIAL {
    FROM m = 0 TO M-1 {
        B[m] = 1
    }
    FROM n=0 TO N-1 {
        A[n] = A0 
        FROM m=0 TO M-1 {
            C[n*M+m] = normrand(C0mean,C0std)
            if (C[n*M+m]<0) {
                C[n*M+m] = 0
            }
            B[m] = B[m] - C[n*M+m]
            A[n] = A[n] - C[n*M+m]
            As[n*M+m] = 0
        }
    }
}

BREAKPOINT { 
    SOLVE kin METHOD sparse
    
}    

KINETIC kin { LOCAL n,m
    FROM n=0 TO N-1 {
        FROM m=0 TO M-1 {
            ~ As[n*M+m] + B[m] <-> C[n*M+m]  (alpha * C[n*M+m], beta)
            ~ A[n]  <-> As[n*M+m]  (gamma * C[n*M+m], delta)
        }
    }
}

AFTER SOLVE { LOCAL n,m,c
    FROM n=0 TO N-1 {
        innervation[n] = 0
    }
    FROM m=0 TO M-1 {
        c = 0
        FROM n=0 TO N-1 {
            if (C[n*M+m]> 0.01) {
                c = c + 1
            }
        }
        innervation[c] = innervation[c]+1
        count[m] = c
    }
}

Posted: Wed Sep 20, 2006 4:50 pm
by ted
I'm speculating that this has something to do with trying to allocate too much memory, but this is just a hunch.
Maybe. Seemed OK after I changed N, M, and NM to 2, 3, and 6. Perhaps there is a #define
somewhere in NEURON's source code that imposes a limit, which you might be able to
change.

On an unrelated topic, modlunit complains about the units of the rate constants alpha, beta,
gamma, and delta. The complaint goes away if you give them all units of (/ms).

Posted: Wed Sep 20, 2006 7:20 pm
by hines
The problem is that the index of a range variable in the Symbol structure is declared as a short integer and the true index does not fit below the 32K limit. e.g.
the "B" variable is located at

Code: Select all

#define B (_p + 36647)
(This model requires a data array of
73868 doubles for each instance)
A quick grep for "u.rng.index" in the oc and nrnoc *.c directories convinces me that it is safe to edit nrn/src/oc/hoc.h and replace the line

Code: Select all

                       short index;    /* prop->param[index] */
with

Code: Select all

                       int index;    /* prop->param[index] */
It would be a more tedious change if you wanted more than 32K segments in a section.

Posted: Wed Sep 20, 2006 7:24 pm
by hines
Forgot to mention that the change from short to int requires recompilation of all translated mod files. And also a touch of all the nrn/src/nrnoc/*.mod files.

Posted: Wed Sep 20, 2006 8:40 pm
by hines
And also forgot to mention that a change to the hoc.h file requires a corresponding change to the hocdec.h file which can be accomplished by executing the hoc2dec.sh script in the nrn/src/oc directory. I have committed the change to the subversion repository so the problem will disappear in the next alpha version.

Thank-you

Posted: Thu Sep 21, 2006 8:25 am
by davidsterratt
Hello Mike & Ted,

Thanks for the -- as ever -- speedy fix to this problem and thanks too for the point about the units. I've been forgetting to run modlunit recently...

I've pulled the development version from the subversion repository, and it seems to be working fine so far.

All the best,

David.