From 20f19fd05f2ab5e00f12fb538fbdfd7a0b7b1a3c Mon Sep 17 00:00:00 2001 From: Pramod S Kumbhar Date: Tue, 17 May 2022 16:04:21 +0200 Subject: [PATCH 1/2] MOD-C-2-CPP: Compatibility fixed for NEURON 9.0, 8.2 and 8.1 --- Gfluct_new_exc.mod | 9 +++++++-- Gfluct_new_inh.mod | 9 +++++++-- readme.txt | 11 ++++++++--- vecevent.mod | 22 ++++++++++------------ 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/Gfluct_new_exc.mod b/Gfluct_new_exc.mod index cec8d8c..bec7936 100644 --- a/Gfluct_new_exc.mod +++ b/Gfluct_new_exc.mod @@ -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() { @@ -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"); } @@ -224,4 +229,4 @@ VERBATIM *pv4 = (void*)0; } ENDVERBATIM -} \ No newline at end of file +} diff --git a/Gfluct_new_inh.mod b/Gfluct_new_inh.mod index a79aad7..92240dc 100644 --- a/Gfluct_new_inh.mod +++ b/Gfluct_new_inh.mod @@ -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() { @@ -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"); } @@ -224,4 +229,4 @@ VERBATIM *pv4 = (void*)0; } ENDVERBATIM -} \ No newline at end of file +} diff --git a/readme.txt b/readme.txt index 1e0ca89..3d4b1e7 100644 --- a/readme.txt +++ b/readme.txt @@ -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 @@ -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 @@ -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: @@ -50,3 +50,8 @@ 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. + +--- + +Version update on 2022-05-17 to support compatibility with upcoming NEURON 9.0 + diff --git a/vecevent.mod b/vecevent.mod index 3e6c637..ef4faf7 100644 --- a/vecevent.mod +++ b/vecevent.mod @@ -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)); } @@ -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); @@ -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)); From 47f8b7a6cf813dfdaeeafa9d65003ef1fc30d22e Mon Sep 17 00:00:00 2001 From: Olli Lupton Date: Fri, 20 May 2022 18:44:34 +0200 Subject: [PATCH 2/2] Cleanup for merge. --- readme.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/readme.txt b/readme.txt index 3d4b1e7..8bc44b8 100644 --- a/readme.txt +++ b/readme.txt @@ -51,7 +51,6 @@ 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. ---- - -Version update on 2022-05-17 to support compatibility with upcoming NEURON 9.0 - +Changelog +-------- +2022-05: Updated MOD files to contain valid C++ and be compatible with the upcoming versions 8.2 and 9.0 of NEURON.