NEURON
eion.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 /* /local/src/master/nrn/src/nrnoc/eion.cpp,v 1.10 1998/02/26 16:42:50 hines Exp */
3 
4 #include <stdlib.h>
5 #include "section.h"
6 #include "neuron.h"
7 #include "membfunc.h"
8 #include "parse.hpp"
9 #include "membdef.h"
10 #include "nrniv_mf.h"
11 #include "nrnunits_modern.h"
12 
13 #undef hoc_retpushx
14 
15 extern double chkarg(int, double low, double high);
16 
17 extern Section* nrn_noerr_access();
18 
19 extern void hoc_register_prop_size(int, int, int);
20 
21 #define nparm 5
22 static const char* mechanism[] = {/*just a template*/
23  "0",
24  "na_ion",
25  "ena",
26  "nao",
27  "nai",
28  0,
29  "ina",
30  "dina_dv_",
31  0,
32  0};
33 static DoubScal scdoub[] = {/* just a template*/
34  "ci0_na_ion",
35  0,
36  "co0_na_ion",
37  0,
38  0,
39  0};
40 
41 static void ion_alloc(Prop*);
42 
43 static void ion_cur(NrnThread*, Memb_list*, int);
44 
45 static void ion_init(NrnThread*, Memb_list*, int);
46 
47 extern "C" double nrn_nernst(double, double, double), nrn_ghk(double, double, double, double);
48 
49 static int na_ion, k_ion, ca_ion; /* will get type for these special ions */
50 
51 int nrn_is_ion(int type) {
52  return (memb_func[type].alloc == ion_alloc);
53 }
54 
56 static double** ion_global_map;
57 #define global_conci(type) ion_global_map[type][0]
58 #define global_conco(type) ion_global_map[type][1]
59 #define global_charge(type) ion_global_map[type][2]
60 
61 double nrn_ion_charge(Symbol* sym) {
62  return global_charge(sym->subtype);
63 }
64 
65 void ion_register(void) {
66  /* hoc level registration of ion name. Return -1 if name already
67  in use and not an ion; and the mechanism subtype otherwise.
68  */
69  char* name;
70  char* buf;
71  Symbol* s;
72  Symlist* sav;
73  int fail;
74  fail = 0;
75  sav = hoc_symlist;
77  name = gargstr(1);
78  buf = static_cast<char*>(emalloc(strlen(name) + 10));
79  sprintf(buf, "%s_ion", name);
80  s = hoc_lookup(buf);
81  if (s && s->type == MECHANISM && memb_func[s->subtype].alloc == ion_alloc) {
82  hoc_symlist = sav;
83  free(buf);
84  if (*getarg(2) != global_charge(s->subtype)) {
85  hoc_execerr_ext("%s already defined with charge %g, cannot redefine with charge %g",
86  s->name,
88  *getarg(2));
89  }
90  hoc_retpushx((double) s->subtype);
91  return;
92  }
93  if (s) {
94  fail = 1;
95  }
96  sprintf(buf, "e%s", name);
97  if (hoc_lookup(buf)) {
98  fail = 1;
99  }
100  sprintf(buf, "%si", name);
101  if (hoc_lookup(buf)) {
102  fail = 1;
103  }
104  sprintf(buf, "%so", name);
105  if (hoc_lookup(buf)) {
106  fail = 1;
107  }
108  sprintf(buf, "i%s", name);
109  if (hoc_lookup(buf)) {
110  fail = 1;
111  }
112  sprintf(buf, "di%s_dv_", name);
113  if (hoc_lookup(buf)) {
114  fail = 1;
115  }
116  if (fail) {
117  hoc_symlist = sav;
118  free(buf);
119  hoc_retpushx(-1.);
120  return;
121  }
122  double charge = *getarg(2);
124  if (strcmp(name, "ca") == 0 && charge != 2.0) {
125  // In the very rare edge case that ca is not yet defined
126  // define with charge 2.0
127  ion_reg(name, 2.0);
128  // and emit a recoverable error as above to avoid an exit in ion_reg
129  free(buf);
130  hoc_execerr_ext("ca_ion already defined with charge 2, cannot redefine with charge %g\n",
131  charge);
132  }
133  ion_reg(name, charge);
134  hoc_symlist = sav;
135  sprintf(buf, "%s_ion", name);
136  s = hoc_lookup(buf);
137  hoc_retpushx((double) s->subtype);
138  free(buf);
139 }
140 
141 void ion_charge(void) {
142  Symbol* s;
143  s = hoc_lookup(gargstr(1));
144  if (!s || s->type != MECHANISM || memb_func[s->subtype].alloc != ion_alloc) {
145  hoc_execerror(gargstr(1), "is not an ion mechanism");
146  }
148 }
149 
150 extern "C" {
151 void register_mech(const char**, Pvmp, Pvmi, Pvmi, Pvmi, Pvmi, int, int);
152 
153 
154 void ion_reg(const char* name, double valence) {
155  int i, mechtype;
156  Symbol* s;
157  char* buf[7];
158  double val;
159 #define VAL_SENTINAL -10000.
160 
161  {
162  int n = 2 * strlen(name) + 10; /*name used twice in initialization name */
163  for (i = 0; i < 7; ++i) {
164  buf[i] = static_cast<char*>(emalloc(n));
165  }
166  }
167  Sprintf(buf[0], "%s_ion", name);
168  Sprintf(buf[1], "e%s", name);
169  Sprintf(buf[2], "%si", name);
170  Sprintf(buf[3], "%so", name);
171  Sprintf(buf[5], "i%s", name);
172  Sprintf(buf[6], "di%s_dv_", name);
173  for (i = 0; i < 7; i++) {
174  mechanism[i + 1] = buf[i];
175  }
176  mechanism[5] = (char*) 0; /* buf[4] not used above */
177  s = hoc_lookup(buf[0]);
178  if (!s || s->type != MECHANISM || memb_func[s->subtype].alloc != ion_alloc) {
179  register_mech(mechanism, ion_alloc, ion_cur, nullptr, nullptr, ion_init, -1, 1);
180  hoc_symbol_limits(hoc_lookup(buf[2]), 1e-12, 1e9);
181  hoc_symbol_limits(hoc_lookup(buf[3]), 1e-12, 1e9);
182  hoc_symbol_units(hoc_lookup(buf[1]), "mV");
183  hoc_symbol_units(hoc_lookup(buf[2]), "mM");
184  hoc_symbol_units(hoc_lookup(buf[3]), "mM");
185  hoc_symbol_units(hoc_lookup(buf[5]), "mA/cm2");
186  hoc_symbol_units(hoc_lookup(buf[6]), "S/cm2");
187  s = hoc_lookup(buf[0]);
188  mechtype = nrn_get_mechtype(mechanism[1]);
189  hoc_register_prop_size(mechtype, nparm, 1);
190  hoc_register_dparam_semantics(mechtype, 0, "iontype");
191  nrn_writes_conc(mechtype, 1);
192  if (ion_global_map_size <= s->subtype) {
193  ion_global_map_size = s->subtype + 1;
195  sizeof(double*) * ion_global_map_size);
196  }
197  ion_global_map[s->subtype] = (double*) emalloc(3 * sizeof(double));
198  Sprintf(buf[0], "%si0_%s", name, s->name);
199  scdoub[0].name = buf[0];
201  Sprintf(buf[1], "%so0_%s", name, s->name);
202  scdoub[1].name = buf[1];
203  scdoub[1].pdoub = ion_global_map[s->subtype] + 1;
207  if (strcmp("na", name) == 0) {
208  na_ion = s->subtype;
211  global_charge(s->subtype) = 1.;
212  } else if (strcmp("k", name) == 0) {
213  k_ion = s->subtype;
216  global_charge(s->subtype) = 1.;
217  } else if (strcmp("ca", name) == 0) {
218  ca_ion = s->subtype;
221  global_charge(s->subtype) = 2.;
222  } else {
226  }
227  for (i = 0; i < 3; ++i) { /* used to be nrnocCONST */
228  s->u.ppsym[i]->subtype = _AMBIGUOUS;
229  }
230  }
231  val = global_charge(s->subtype);
232  if (valence != VAL_SENTINAL && val != VAL_SENTINAL && valence != val) {
233  fprintf(stderr,
234  "%s ion charge defined differently in\n\
235 two USEION statements (%g and %g)\n",
236  s->name,
237  valence,
238  global_charge(s->subtype));
239  nrn_exit(1);
240  } else if (valence == VAL_SENTINAL && val == VAL_SENTINAL) {
241  /* Not defined now but could be defined by
242  a subsequent ion_reg from another model.
243  The list of ion mechanisms will be checked
244  after all mod files have been dealt with to verify
245  that they all have a defined valence.
246  */
247  } else if (valence != VAL_SENTINAL) {
248  global_charge(s->subtype) = valence;
249  }
250  for (i = 0; i < 7; ++i) {
251  free(buf[i]);
252  }
253 }
254 } // extern "C"
255 
257  int i;
258  for (i = 3; i < n_memb_func; ++i)
259  if (nrn_is_ion(i)) {
260  if (global_charge(i) == VAL_SENTINAL) {
261  Symbol* s = memb_func[i].sym;
262  Fprintf(stderr,
263  "%s USEION CHARGE (or VALENCE) must be defined in\n\
264 at least one model using this ion\n",
265  s->name);
266  nrn_exit(1);
267  }
268  }
269 }
270 
271 #define FARADAY _faraday_[_nrnunit_use_legacy_]
272 static double _faraday_[2] = {_faraday_codata2018, 96485.309};
273 #define gasconstant _gasconstant_[_nrnunit_use_legacy_]
274 static double _gasconstant_[2] = {_gasconstant_codata2018, 8.3134};
275 
276 #define ktf (1000. * gasconstant * (celsius + 273.15) / FARADAY)
277 double nrn_nernst(double ci, double co, double z) {
278  /*printf("nrn_nernst %g %g %g\n", ci, co, z);*/
279  if (z == 0) {
280  return 0.;
281  }
282  if (ci <= 0.) {
283  return 1e6;
284  } else if (co <= 0.) {
285  return -1e6;
286  } else {
287  return ktf / z * log(co / ci);
288  }
289 }
290 
291 extern "C" void nrn_wrote_conc(Symbol* sym, double* pe, int it) {
292  if (it & 040) {
293  pe[0] = nrn_nernst(pe[1], pe[2], nrn_ion_charge(sym));
294  }
295 }
296 
297 void nernst(void) {
298  double val = 0.0;
299 
300  if (hoc_is_str_arg(1)) {
301  Symbol* s = hoc_lookup(gargstr(1));
302  if (s && ion_global_map[s->u.rng.type]) {
303  Section* sec = chk_access();
304  Symbol* ion = memb_func[s->u.rng.type].sym;
305  double z = global_charge(s->u.rng.type);
306  double *ci, *co, *e, x;
307  if (ifarg(2)) {
308  x = chkarg(2, 0., 1.);
309  } else {
310  x = .5;
311  }
312  ci = nrn_rangepointer(sec, ion->u.ppsym[1], x);
313  co = nrn_rangepointer(sec, ion->u.ppsym[2], x);
314  e = nrn_rangepointer(sec, ion->u.ppsym[0], x);
315  switch (s->u.rng.index) {
316  case 0:
317  val = nrn_nernst(*ci, *co, z);
318  hoc_retpushx(val);
319  return;
320  case 1:
321  val = *co * exp(-z / ktf * *e);
322  hoc_retpushx(val);
323  return;
324  case 2:
325  val = *ci * exp(z / ktf * *e);
326  hoc_retpushx(val);
327  return;
328  }
329  }
330  hoc_execerror(gargstr(1), " not a reversal potential or concentration");
331  } else {
332  val = nrn_nernst(*getarg(1), *getarg(2), *getarg(3));
333  /*printf("nernst=%g\n", val);*/
334  }
335  hoc_retpushx(val);
336  return;
337 }
338 
339 static double efun(double x) {
340  if (fabs(x) < 1e-4) {
341  return 1. - x / 2.;
342  } else {
343  return x / (exp(x) - 1);
344  }
345 }
346 
347 extern "C" double nrn_ghk(double v, double ci, double co, double z) {
348  double eco, eci, temp;
349  temp = z * v / ktf;
350  eco = co * efun(temp);
351  eci = ci * efun(-temp);
352  return (.001) * z * FARADAY * (eci - eco);
353 }
354 
355 void ghk(void) {
356  double val = nrn_ghk(*getarg(1), *getarg(2), *getarg(3), *getarg(4));
357  hoc_retpushx(val);
358 }
359 
360 #if VECTORIZE
361 #define erev pd[i][0] /* From Eion */
362 #define conci pd[i][1]
363 #define conco pd[i][2]
364 #define cur pd[i][3]
365 #define dcurdv pd[i][4]
366 
367 /*
368  handle erev, conci, conc0 "in the right way" according to ion_style
369  default. See nrn/lib/help/nrnoc.help.
370 ion_style("name_ion", [c_style, e_style, einit, eadvance, cinit])
371 
372  ica is assigned
373  eca is parameter but if conc exists then eca is assigned
374  if conc is nrnocCONST then eca calculated on finitialize
375  if conc is STATE then eca calculated on fadvance and conc finitialize
376  with global nai0, nao0
377 
378  nernst(ci, co, charge) and ghk(v, ci, co, charge) available to hoc
379  and models.
380 */
381 
382 #define iontype ppd[i][0].i /* how _AMBIGUOUS is to be handled */
383 /*the bitmap is
384 03 concentration unused, nrnocCONST, DEP, STATE
385 04 initialize concentrations
386 030 reversal potential unused, nrnocCONST, DEP, STATE
387 040 initialize reversal potential
388 0100 calc reversal during fadvance
389 0200 ci being written by a model
390 0400 co being written by a model
391 */
392 
393 #define charge global_charge(type)
394 #define conci0 global_conci(type)
395 #define conco0 global_conco(type)
396 
397 extern "C" double nrn_nernst_coef(int type) {
398  /* for computing jacobian element dconc'/dconc */
399  return ktf / charge;
400 }
401 
402 /*
403 It is generally an error for two models to WRITE the same concentration
404 */
405 extern "C" void nrn_check_conc_write(Prop* p_ok, Prop* pion, int i) {
406  static long *chk_conc_, *ion_bit_, size_;
407  Prop* p;
408  int flag, j, k;
409  if (i == 1) {
410  flag = 0200;
411  } else {
412  flag = 0400;
413  }
414  /* an embarassing hack */
415  /* up to 32 possible ions */
416  /* continuously compute a bitmap that allows determination
417  of which models WRITE which ion concentrations */
418  if (n_memb_func > size_) {
419  if (!chk_conc_) {
420  chk_conc_ = (long*) ecalloc(2 * n_memb_func, sizeof(long));
421  ion_bit_ = (long*) ecalloc(n_memb_func, sizeof(long));
422  } else {
423  chk_conc_ = (long*) erealloc(chk_conc_, 2 * n_memb_func * sizeof(long));
424  ion_bit_ = (long*) erealloc(ion_bit_, n_memb_func * sizeof(long));
425  for (j = size_; j < n_memb_func; ++j) {
426  chk_conc_[2 * j] = 0;
427  chk_conc_[2 * j + 1] = 0;
428  ion_bit_[j] = 0;
429  }
430  }
431  size_ = n_memb_func;
432  }
433  for (k = 0, j = 0; j < n_memb_func; ++j) {
434  if (nrn_is_ion(j)) {
435  ion_bit_[j] = (1 << k);
436  ++k;
437  assert(k < sizeof(long) * 8);
438  }
439  }
440 
441  chk_conc_[2 * p_ok->type + i] |= ion_bit_[pion->type];
442  if (pion->dparam[0].i & flag) {
443  /* now comes the hard part. Is the possibility in fact actual.*/
444  for (p = pion->next; p; p = p->next) {
445  if (p == p_ok) {
446  continue;
447  }
448  if (chk_conc_[2 * p->type + i] & ion_bit_[pion->type]) {
449  char buf[300];
450  sprintf(buf,
451  "%.*s%c is being written at the same location by %s and %s",
452  (int) strlen(memb_func[pion->type].sym->name) - 4,
453  memb_func[pion->type].sym->name,
454  ((i == 1) ? 'i' : 'o'),
455  memb_func[p_ok->type].sym->name,
456  memb_func[p->type].sym->name);
457  hoc_warning(buf, (char*) 0);
458  }
459  }
460  }
461  pion->dparam[0].i |= flag;
462 }
463 
464 void ion_style(void) {
465  Symbol* s;
466  int istyle, i, oldstyle;
467  Section* sec;
468  Prop* p;
469 
470  s = hoc_lookup(gargstr(1));
471  if (!s || s->type != MECHANISM || !nrn_is_ion(s->subtype)) {
472  hoc_execerror(gargstr(1), " is not an ion");
473  }
474 
475  sec = chk_access();
476  p = nrn_mechanism(s->subtype, sec->pnode[0]);
477  oldstyle = -1;
478  if (p) {
479  oldstyle = p->dparam[0].i;
480  }
481 
482  if (ifarg(2)) {
483  istyle = (int) chkarg(2, 0., 3.); /* c_style */
484  istyle += 010 * (int) chkarg(3, 0., 3.); /* e_style */
485  istyle += 040 * (int) chkarg(4, 0., 1.); /* einit */
486  istyle += 0100 * (int) chkarg(5, 0., 1.); /* eadvance */
487  istyle += 04 * (int) chkarg(6, 0., 1.); /* cinit*/
488 
489 #if 0 /* global effect */
490  {
491  int count;
492  Datum** ppd;
493  v_setup_vectors();
494  count = memb_list[s->subtype].nodecount;
495  ppd = memb_list[s->subtype].pdata;
496  for (i=0; i < count; ++i) {
497  iontype = (iontype&(0200+0400)) + istyle;
498  }
499  }
500 #else /* currently accessed section */
501  {
502  for (i = 0; i < sec->nnode; ++i) {
503  p = nrn_mechanism(s->subtype, sec->pnode[i]);
504  if (p) {
505  p->dparam[0].i &= (0200 + 0400);
506  p->dparam[0].i += istyle;
507  }
508  }
509  }
510 #endif
511  }
512  hoc_retpushx((double) oldstyle);
513 }
514 
515 int nrn_vartype(Symbol* sym) {
516  int i;
517  i = sym->subtype;
518  if (i == _AMBIGUOUS) {
519  Section* sec;
520  Prop* p;
521  sec = nrn_noerr_access();
522  if (!sec) {
523  return nrnocCONST;
524  }
525  p = nrn_mechanism(sym->u.rng.type, sec->pnode[0]);
526  if (p) {
527  int it = p->dparam[0].i;
528  if (sym->u.rng.index == 0) { /* erev */
529  i = (it & 030) >> 3; /* unused, nrnocCONST, DEP, or STATE */
530  } else { /* concentration */
531  i = (it & 03);
532  }
533  }
534  }
535  return i;
536 }
537 
538 /* the ion mechanism it flag defines how _AMBIGUOUS is to be interpreted */
539 extern "C" void nrn_promote(Prop* p, int conc, int rev) {
540  int oldconc, oldrev;
541  int* it = &p->dparam[0].i;
542  oldconc = (*it & 03);
543  oldrev = (*it & 030) >> 3;
544  /* precedence */
545  if (oldconc < conc) {
546  oldconc = conc;
547  }
548  if (oldrev < rev) {
549  oldrev = rev;
550  }
551  /* promote type */
552  if (oldconc > 0 && oldrev < 2) {
553  oldrev = 2;
554  }
555  *it &= ~0177; /* clear the bitmap */
556  *it += oldconc + 010 * oldrev;
557  if (oldconc == 3) { /* if state then cinit */
558  *it += 4;
559  if (oldrev == 2) { /* if not state (WRITE) then eadvance */
560  *it += 0100;
561  }
562  }
563  if (oldconc > 0 && oldrev == 2) { /*einit*/
564  *it += 040;
565  }
566 }
567 
568 /* Must be called prior to any channels which update the currents */
569 static void ion_cur(NrnThread* nt, Memb_list* ml, int type) {
570  int count = ml->nodecount;
571  Node** vnode = ml->nodelist;
572  double** pd = ml->data;
573  Datum** ppd = ml->pdata;
574  int i;
575 /*printf("ion_cur %s\n", memb_func[type].sym->name);*/
576 #if _CRAY
577 #pragma _CRI ivdep
578 #endif
579  for (i = 0; i < count; ++i) {
580  dcurdv = 0.;
581  cur = 0.;
582  if (iontype & 0100) {
584  }
585  };
586 }
587 
588 /* Must be called prior to other models which possibly also initialize
589  concentrations based on their own states
590 */
591 static void ion_init(NrnThread* nt, Memb_list* ml, int type) {
592  int count = ml->nodecount;
593  Node** vnode = ml->nodelist;
594  double** pd = ml->data;
595  Datum** ppd = ml->pdata;
596  int i;
597 /*printf("ion_init %s\n", memb_func[type].sym->name);*/
598 #if _CRAY
599 #pragma _CRI ivdep
600 #endif
601  for (i = 0; i < count; ++i) {
602  if (iontype & 04) {
603  conci = conci0;
604  conco = conco0;
605  }
606  }
607 #if _CRAY
608 #pragma _CRI ivdep
609 #endif
610  for (i = 0; i < count; ++i) {
611  if (iontype & 040) {
613  }
614  }
615 }
616 
617 static void ion_alloc(Prop* p) {
618  double* pd[1];
619  int i = 0;
620 
621  pd[0] = nrn_prop_data_alloc(p->type, nparm, p);
622  p->param_size = nparm;
623 
624  cur = 0.;
625  dcurdv = 0.;
626  if (p->type == na_ion) {
627  erev = DEF_ena;
628  conci = DEF_nai;
629  conco = DEF_nao;
630  } else if (p->type == k_ion) {
631  erev = DEF_ek;
632  conci = DEF_ki;
633  conco = DEF_ko;
634  } else if (p->type == ca_ion) {
635  erev = DEF_eca;
636  conci = DEF_cai;
637  conco = DEF_cao;
638  } else {
639  erev = DEF_eion;
640  conci = DEF_ioni;
641  conco = DEF_iono;
642  }
643  p->param = pd[0];
644 
645  p->dparam = nrn_prop_datum_alloc(p->type, 1, p);
646  p->dparam->i = 0;
647 }
648 
650  extern int secondorder;
651  NrnThreadMembList* tml;
652  Memb_list* ml;
653  int j, i, i2;
654 #define c 3
655 #define dc 4
656  if (secondorder == 2) {
657  for (tml = nt->tml; tml; tml = tml->next)
658  if (memb_func[tml->index].alloc == ion_alloc) {
659  ml = tml->ml;
660  i2 = ml->nodecount;
661  for (i = 0; i < i2; ++i) {
662  ml->data[i][c] += ml->data[i][dc] * (NODERHS(ml->nodelist[i]));
663  }
664  }
665  }
666 }
667 
668 #endif
Prop * nrn_mechanism(int type, Node *nd)
Definition: cabcode.cpp:1079
int nrn_get_mechtype(const char *mechname)
Definition: cabcode.cpp:2000
double * nrn_rangepointer(Section *sec, Symbol *s, double d)
Definition: cabcode.cpp:1335
Section * chk_access(void)
Definition: cabcode.cpp:444
Memb_func * memb_func
Definition: init.cpp:123
short type
Definition: cabvars.h:9
int secondorder
Definition: init.cpp:96
Datum * nrn_prop_datum_alloc(int type, int count, Prop *p)
Definition: cxprop.cpp:289
double * nrn_prop_data_alloc(int type, int count, Prop *p)
Definition: cxprop.cpp:277
sprintf(buf, " if (secondorder) {\n" " int _i;\n" " for (_i = 0; _i < %d; ++_i) {\n" " _p[_slist%d[_i]] += dt*_p[_dlist%d[_i]];\n" " }}\n", numeqn, listnum, listnum)
static void ion_cur(NrnThread *, Memb_list *, int)
Definition: eion.cpp:569
static double ** ion_global_map
Definition: eion.cpp:56
double nrn_ghk(double, double, double, double)
Definition: eion.cpp:347
#define dc
void ghk(void)
Definition: eion.cpp:355
#define iontype
Definition: eion.cpp:382
double chkarg(int, double low, double high)
Definition: code2.cpp:638
void register_mech(const char **, Pvmp, Pvmi, Pvmi, Pvmi, Pvmi, int, int)
Definition: init.cpp:674
double nrn_ion_charge(Symbol *sym)
Definition: eion.cpp:61
#define dcurdv
Definition: eion.cpp:365
void nrn_verify_ion_charge_defined()
Definition: eion.cpp:256
#define conco
Definition: eion.cpp:363
void nernst(void)
Definition: eion.cpp:297
void second_order_cur(NrnThread *nt)
Definition: eion.cpp:649
#define global_conco(type)
Definition: eion.cpp:58
static int na_ion
Definition: eion.cpp:49
Section * nrn_noerr_access()
Definition: cabcode.cpp:472
static DoubScal scdoub[]
Definition: eion.cpp:33
void ion_charge(void)
Definition: eion.cpp:141
static double efun(double x)
Definition: eion.cpp:339
#define VAL_SENTINAL
void nrn_promote(Prop *p, int conc, int rev)
Definition: eion.cpp:539
static int k_ion
Definition: eion.cpp:49
#define ktf
Definition: eion.cpp:276
static int ion_global_map_size
Definition: eion.cpp:55
int nrn_is_ion(int type)
Definition: eion.cpp:51
void nrn_wrote_conc(Symbol *sym, double *pe, int it)
Definition: eion.cpp:291
double nrn_nernst(double, double, double)
Definition: eion.cpp:277
#define cur
Definition: eion.cpp:364
#define erev
Definition: eion.cpp:361
#define conci0
Definition: eion.cpp:394
#define global_charge(type)
Definition: eion.cpp:59
void hoc_register_prop_size(int, int, int)
Definition: init.cpp:704
static double _gasconstant_[2]
Definition: eion.cpp:274
static void ion_init(NrnThread *, Memb_list *, int)
Definition: eion.cpp:591
void ion_style(void)
Definition: eion.cpp:464
#define conci
Definition: eion.cpp:362
#define nparm
Definition: eion.cpp:21
void ion_register(void)
Definition: eion.cpp:65
static int ca_ion
Definition: eion.cpp:49
#define c
#define FARADAY
Definition: eion.cpp:271
static void ion_alloc(Prop *)
Definition: eion.cpp:617
int nrn_vartype(Symbol *sym)
Definition: eion.cpp:515
void nrn_check_conc_write(Prop *p_ok, Prop *pion, int i)
Definition: eion.cpp:405
static double _faraday_[2]
Definition: eion.cpp:272
double nrn_nernst_coef(int type)
Definition: eion.cpp:397
static const char * mechanism[]
Definition: eion.cpp:22
void ion_reg(const char *name, double valence)
Definition: eion.cpp:154
#define charge
Definition: eion.cpp:393
#define conco0
Definition: eion.cpp:395
#define global_conci(type)
Definition: eion.cpp:57
void hoc_execerror(const char *, const char *)
Definition: hoc.cpp:754
void nrn_exit(int)
Definition: hoc.cpp:219
char buf[512]
Definition: init.cpp:13
void hoc_execerr_ext(const char *fmt,...)
printf style specification of hoc_execerror message.
Definition: fileio.cpp:931
int hoc_is_str_arg(int narg)
Definition: code.cpp:752
void hoc_register_var(DoubScal *scdoub, DoubVec *vdoub, VoidFunc *fn)
Definition: hocusr.cpp:109
void hoc_warning(const char *, const char *)
void hoc_retpushx(double x)
Definition: hocusr.cpp:154
void hoc_symbol_limits(Symbol *sym, float low, float high)
Definition: code2.cpp:100
Symbol * hoc_lookup(const char *)
#define assert(ex)
Definition: hocassrt.h:32
void * erealloc(void *ptr, size_t n)
Definition: symbol.cpp:263
void * ecalloc(size_t n, size_t size)
Definition: symbol.cpp:215
#define getarg
Definition: hocdec.h:15
#define gargstr
Definition: hocdec.h:14
Symlist * hoc_top_level_symlist
Definition: code2.cpp:690
Symlist * hoc_built_in_symlist
Definition: ivocmac.cpp:76
Symlist * hoc_symlist
int ifarg(int)
Definition: code.cpp:1581
char * hoc_symbol_units(Symbol *, const char *)
Definition: code2.cpp:126
#define v
Definition: md1redef.h:4
#define sec
Definition: md1redef.h:13
#define i
Definition: md1redef.h:12
#define DEF_nai
Definition: membdef.h:35
#define DEF_eion
Definition: membdef.h:53
#define DEF_eca
Definition: membdef.h:48
#define DEF_ek
Definition: membdef.h:42
#define DEF_nao
Definition: membdef.h:36
#define DEF_ioni
Definition: membdef.h:51
#define DEF_iono
Definition: membdef.h:52
#define DEF_ko
Definition: membdef.h:41
#define DEF_cao
Definition: membdef.h:46
#define DEF_cai
Definition: membdef.h:45
#define DEF_ki
Definition: membdef.h:40
#define DEF_ena
Definition: membdef.h:37
void(* Pvmp)(Prop *)
Definition: membfunc.h:19
void(* Pvmi)(struct NrnThread *, Memb_list *, int)
Definition: membfunc.h:18
#define _AMBIGUOUS
Definition: membfunc.h:100
#define nrnocCONST
Definition: membfunc.h:69
#define Sprintf
Definition: model.h:233
#define Fprintf
Definition: model.h:234
exp
Definition: extdef.h:5
log
Definition: extdef.h:4
fabs
Definition: extdef.h:3
char * name
Definition: init.cpp:16
long subtype
Definition: init.cpp:215
char * emalloc(unsigned n)
Definition: list.cpp:166
#define fprintf
Definition: mwprefix.h:30
void v_setup_vectors()
Definition: treeset.cpp:1631
int const size_t const size_t n
Definition: nrngsl.h:11
size_t p
size_t j
void nrn_writes_conc(int type, int unused)
Definition: init.cpp:689
void hoc_register_dparam_semantics(int type, int ix, const char *name)
Definition: init.cpp:715
Memb_list * memb_list
Definition: init.cpp:124
int n_memb_func
Definition: init.cpp:440
static philox4x32_key_t k
Definition: nrnran123.cpp:11
#define _gasconstant_codata2018
#define _faraday_codata2018
#define e
Definition: passive0.cpp:22
#define NODERHS(n)
Definition: section.h:105
double * pdoub
Definition: hocdec.h:256
const char * name
Definition: hocdec.h:255
Pvmp alloc
Definition: membfunc.h:32
Symbol * sym
Definition: membfunc.h:38
int nodecount
Definition: nrnoc_ml.h:18
Node ** nodelist
Definition: nrnoc_ml.h:5
double ** data
Definition: nrnoc_ml.h:14
Datum ** pdata
Definition: nrnoc_ml.h:15
Definition: section.h:133
Represent main neuron object computed by single thread.
Definition: multicore.h:58
NrnThreadMembList * tml
Definition: multicore.h:62
struct NrnThreadMembList * next
Definition: multicore.h:34
Memb_list * ml
Definition: multicore.h:35
Definition: section.h:214
Datum * dparam
Definition: section.h:220
short type
Definition: section.h:216
struct Prop * next
Definition: section.h:215
Definition: model.h:57
HocStruct Symbol ** ppsym
Definition: hocdec.h:150
short type
Definition: model.h:58
struct Symbol::@37::@38 rng
long subtype
Definition: model.h:59
union Symbol::@18 u
char * name
Definition: model.h:72
Definition: hocdec.h:84
Definition: hocdec.h:177
int i
Definition: hocdec.h:180