Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

MOD-C-2-CPP: Compatibility fixed for NEURON 9.0, 8.2 and 8.1 #1

Merged
merged 2 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Gfluct_new_exc.mod
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,13 @@ PROCEDURE oup() { : use Scop function normrand(mean, std_dev)


VERBATIM
#ifndef NRN_VERSION_GTEQ_8_2_0
double nrn_random_pick(void* r);
void* nrn_random_arg(int argpos);
#define RANDCAST
#else
#define RANDCAST (Rand*)
#endif
ENDVERBATIM

FUNCTION randGen() {
Expand All @@ -208,7 +213,7 @@ VERBATIM
: each instance. However, the corresponding hoc Random
: distribution MUST be set to Random.normal(0,1)
*/
_lrandGen = nrn_random_pick(_p_randObjPtr);
_lrandGen = nrn_random_pick(RANDCAST _p_randObjPtr);
}else{
hoc_execerror("Random object ref not set correctly for randObjPtr"," only via hoc Random");
}
Expand All @@ -224,4 +229,4 @@ VERBATIM
*pv4 = (void*)0;
}
ENDVERBATIM
}
}
9 changes: 7 additions & 2 deletions Gfluct_new_inh.mod
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,13 @@ PROCEDURE oup() { : use Scop function normrand(mean, std_dev)


VERBATIM
#ifndef NRN_VERSION_GTEQ_8_2_0
double nrn_random_pick(void* r);
void* nrn_random_arg(int argpos);
#define RANDCAST
#else
#define RANDCAST (Rand*)
#endif
ENDVERBATIM

FUNCTION randGen() {
Expand All @@ -208,7 +213,7 @@ VERBATIM
: each instance. However, the corresponding hoc Random
: distribution MUST be set to Random.normal(0,1)
*/
_lrandGen = nrn_random_pick(_p_randObjPtr);
_lrandGen = nrn_random_pick(RANDCAST _p_randObjPtr);
}else{
hoc_execerror("Random object ref not set correctly for randObjPtr"," only via hoc Random");
}
Expand All @@ -224,4 +229,4 @@ VERBATIM
*pv4 = (void*)0;
}
ENDVERBATIM
}
}
10 changes: 7 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ with spatial gradients.
This model has been developed using the NEURON simulator (Hines and
Carnavale, 2008).

Summary of files:
Summary of files:

DATA INPUT FILES:
spikesmatrix_op: Stores spikes for each external connection (row); it needs to be used together with spikes_ind file
Expand All @@ -29,7 +29,7 @@ GAPid: Indexes only used for gap junction transfer. Indexes here has
sim_length: Simulation time length.
location.txt: Stores 3D coordinates (um) for each cell
oritation.txt: Stores dendrite orientations for each cell
elec_coords.txt: List electrode coordinates (um) to calculate LFPs. If interesting in multiple electrode recording, need to generate multiple electrode coordinates to write into this file.
elec_coords.txt: List electrode coordinates (um) to calculate LFPs. If interesting in multiple electrode recording, need to generate multiple electrode coordinates to write into this file.
NM.txt: This file indicates whether the cell has any neuromodulator receptors present. It can be of three types, DA, NE and DANE. (has not been used in this study).
NEURON FILES:
- BL_main.hoc: Main file to run the simulations
Expand All @@ -38,7 +38,7 @@ NEURON FILES:
- function_ConnectInternal_gj_simplify: Establish gap coupling between FSIs with adjustable coupling strength parameters.
- function_ConnectInternal_simplify_online_op.hoc: Establish internal connections with adjustable synapse weight parameters.
- function_ConnectTwoCells.hoc: Procedure used to connect two internal neurons.
- function_calcconduc: Function used to calculate conductances for being used to calculate LFPs.
- function_calcconduc: Function used to calculate conductances for being used to calculate LFPs.

OUTPUT FILES:

Expand All @@ -50,3 +50,7 @@ BEFORE YOU RUN:
Make sure to compile the mod files and also make an empty folder named
LFPs in the directory. NEURON will save the calculated LFP files into
this directory.

Changelog
--------
2022-05: Updated MOD files to contain valid C++ and be compatible with the upcoming versions 8.2 and 9.0 of NEURON.
22 changes: 10 additions & 12 deletions vecevent.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,22 @@ NET_RECEIVE (w) {
}

VERBATIM
#ifndef NRN_VERSION_GTEQ_8_2_0
extern double* vector_vec();
extern int vector_capacity();
extern void* vector_arg();
//extern void hoc_obj_ref(void*);
//extern void hoc_obj_unref(void*);
//extern void** vector_pobj(void*);
#endif
ENDVERBATIM

DESTRUCTOR {
VERBATIM {
void** vv;
void* vtmp;
IvocVect* vtmp;
IvocVect** vv;
if (ifarg(1)) {
vtmp = vector_arg(1);
vtmp = (IvocVect*) vector_arg(1);
hoc_obj_ref(*vector_pobj(vtmp));
}
vv = (void**)(&space);
vv = (IvocVect**)(&space);
if (*vv) {
hoc_obj_unref(*vector_pobj(*vv));
}
Expand All @@ -56,10 +55,10 @@ ENDVERBATIM

PROCEDURE element() {
VERBATIM
{ void* vv; int i, size; double* px;
{ int i, size; double* px;
i = (int)index;
if (i >= 0) {
vv = *((void**)(&space));
IvocVect* vv = *((IvocVect**)(&space));
if (vv) {
size = vector_capacity(vv);
px = vector_vec(vv);
Expand All @@ -79,9 +78,8 @@ ENDVERBATIM

PROCEDURE play() {
VERBATIM
void** vv;
vv = (void**)(&space);
*vv = (void*)0;
IvocVect** vv = (IvocVect**)(&space);
*vv = (IvocVect*)0;
if (ifarg(1)) {
*vv = vector_arg(1);
hoc_obj_ref(*vector_pobj(*vv));
Expand Down