Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

C++ compatibility #3

Merged
merged 2 commits into from
Mar 3, 2023
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 Na12 Analysis/mechanisms/ProbAMPANMDA_EMS.mod
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,13 @@ VERBATIM
#include<stdio.h>
#include<math.h>

#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

Expand Down Expand Up @@ -308,7 +313,7 @@ VERBATIM
: each instance. However, the corresponding hoc Random
: distribution MUST be set to Random.negexp(1)
*/
value = nrn_random_pick(_p_rng);
value = nrn_random_pick(RANDCAST _p_rng);
//printf("random stream for this simulation = %lf\n",value);
return value;
}else{
Expand All @@ -317,7 +322,7 @@ ENDVERBATIM
: independent of nhost or which host this instance is on
: is desired, since each instance on this cpu draws from
: the same stream
value = scop_random(1)
value = scop_random()
VERBATIM
}
ENDVERBATIM
Expand Down
9 changes: 7 additions & 2 deletions Na12 Analysis/mechanisms/ProbGABAAB_EMS.mod
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,13 @@ VERBATIM
#include<stdio.h>
#include<math.h>

#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

Expand Down Expand Up @@ -307,7 +312,7 @@ VERBATIM
: each instance. However, the corresponding hoc Random
: distribution MUST be set to Random.uniform(1)
*/
value = nrn_random_pick(_p_rng);
value = nrn_random_pick(RANDCAST _p_rng);
//printf("random stream for this simulation = %lf\n",value);
return value;
}else{
Expand All @@ -316,7 +321,7 @@ ENDVERBATIM
: independent of nhost or which host this instance is on
: is desired, since each instance on this cpu draws from
: the same stream
urand = scop_random(1)
urand = scop_random()
VERBATIM
}
ENDVERBATIM
Expand Down
6 changes: 4 additions & 2 deletions Na12 Analysis/mechanisms/branching.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ ENDCOMMENT
NEURON { SUFFIX nothing }

VERBATIM

#ifndef _NrnThread
#define _NrnThread NrnThread
#endif
ENDVERBATIM
PROCEDURE init_files(){
VERBATIM {
Expand Down Expand Up @@ -235,4 +237,4 @@ fprintf(fm,"%d %1.15f %1.15f %1.15f %1.15f\n", ii, NODEB(nd), NODEA(nd), NODED(n
fclose (fm);
}
ENDVERBATIM
}
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ Model in ./Ri Increase/25% Ri Increase Figures.ipynb corresponds to Figure S3C.

Compile in mechanisms folder by running shell command `nrnivmodl` (Mac)/`mknrndll` (Windows) and copy x86_64 folder (Mac)/nrnmech.dll (Windows) to model folder.

For additional information, please contact [email protected] or [email protected]
For additional information, please contact [email protected] or [email protected]

## Changelog
2023-02-28: updated for C++ compatibility (NEURON 9+)