file:/local_home/local_home/hugo/neurospaces_project/heccer/source/c/snapshots/0/tests/code/addressing-purk-test-axon.c        (Thu Jul 3 16:53:14 2008 )        HOME


   1: //
   2: // Heccer : a compartmental solver that implements efficient Crank-Nicolson
   3: // integration for neuronal models.
   4: //
   5: 
   6: //////////////////////////////////////////////////////////////////////////////
   7: //'
   8: //' Heccer : testbed C implementation
   9: //'
  10: //' Copyright (C) 2006-2008 Hugo Cornelis
  11: //'
  12: //' functional ideas .. Hugo Cornelis, hugo.cornelis@gmail.com
  13: //'
  14: //' coding ............ Hugo Cornelis, hugo.cornelis@gmail.com
  15: //'
  16: //////////////////////////////////////////////////////////////////////////////
  17: 
  18: 
  19: #include <malloc.h>
  20: #include <stdlib.h>
  21: 
  22: #include "../../heccer/addressing.h"
  23: #include "../../heccer/compartment.h"
  24: #include "../../heccer/heccer.h"
  25: 
  26: 
  27: #include "main.h"
  28: 
  29: 
  30: #define HECCER_TEST_REPORTING_GRANULARITY 100
  31: #define HECCER_TEST_STEPS 0
  32: /* #define HECCER_TEST_TESTED_THINGS (0) */
  33: #define HECCER_TEST_TESTED_THINGS ( HECCER_DUMP_VM_COMPARTMENT_MATRIX \
  34:                                     | HECCER_DUMP_VM_COMPARTMENT_DATA \
  35:                                     | HECCER_DUMP_VM_COMPARTMENT_OPERATIONS \
  36:                                     | HECCER_DUMP_VM_CHANNEL_POOL_FLUXES \
  37:                                     | HECCER_DUMP_VM_MECHANISM_DATA \
  38:                                     | HECCER_DUMP_VM_MECHANISM_OPERATIONS \
  39:                                     | HECCER_DUMP_VM_SUMMARY \
  40:         )
  41: /* #define HECCER_TEST_TIME_STEP (2e-5) */
  42: 
  43: 
  44: struct Compartment compSoma =
  45: {
  46:     //m administrative overhead
  47: 
  48:     {
  49:         //m type of structure
  50: 
  51:         MATH_TYPE_Compartment,
  52: 
  53: #ifdef HECCER_SOURCE_NEUROSPACES
  54: 
  55:         //m identification
  56: 
  57:         ADDRESSING_NEUROSPACES_2_HECCER(1000),
  58: 
  59: #endif
  60: 
  61:     },
  62: 
  63:     //m index of parent compartment, -1 for none
  64: 
  65:     -1,
  66: 
  67: /*     //m first mechanism */
  68: 
  69: /*     NULL, */
  70: 
  71: /*     //m number of mechanisms */
  72: 
  73: /*     0, */
  74: 
  75:     //m descriptive values, alphabetical order
  76: 
  77: /*     double dCm; */
  78: 
  79:     4.57537e-11, // unscaled 0.0164,
  80: 
  81: /*     double dEm; */
  82: 
  83:     -0.08,
  84: 
  85: /*     double dInitVm; */
  86: 
  87:     -0.068,
  88: 
  89: /*     double dInject;           */
  90: 
  91:     0,
  92: 
  93: /*     double dRa; */
  94: 
  95:     360502, // unscaled 2.5,
  96: 
  97: /*     double dRm; */
  98: 
  99:     3.58441e+08, // unscaled 1
 100: };
 101: 
 102: 
 103: struct ChannelActInact caiCaT =
 104: {
 105:     //m administrative overhead
 106: 
 107:     {
 108:         //m type of structure
 109: 
 110:         MATH_TYPE_ChannelActInact,
 111: 
 112: #ifdef HECCER_SOURCE_NEUROSPACES
 113: 
 114:         //m identification
 115: 
 116:         ADDRESSING_NEUROSPACES_2_HECCER(2000),
 117: 
 118: #endif
 119: 
 120:     },
 121: 
 122:     //m first set of descriptive values, alphabetical order
 123: 
 124:     //m initial reversal potential
 125: 
 126:     0.1375262439,
 127: 
 128:     //m get reversal potential from this intermediary, -1 for none
 129: 
 130:     -1,
 131: 
 132:     //m maximal conductance when all channels are permissive
 133: 
 134:     1.394928884e-08,
 135: 
 136:     //m contributes to this concentration pool, -1 for none, boolean indicator only.
 137: 
 138:     -1,
 139: 
 140:     //m activation description
 141: 
 142:     {
 143:         //m power, for a standard heccer, something between 1 and 4 or so.
 144: 
 145:         1,
 146: 
 147:         //m gate definition
 148: 
 149:         {
 150:             //m initial value, commonly forward over backward steady states
 151: 
 152:             0.039478155609280696,
 153: 
 154:             //m corresponding index in tables, set to -1 for initialization.
 155: 
 156:             -1,
 157: 
 158:             {
 159:                 //m forward kinetiks, commonly denoted with alpha or non-perm to perm rate
 160: 
 161:                 {
 162:                     //m multiplier
 163: 
 164:                     2.6e3,
 165: 
 166:                     //m multiplier membrane dependence, 0.0 for no dependence
 167: 
 168:                     0.0,
 169: 
 170:                     //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
 171: 
 172:                     0.0,
 173: 
 174:                     //m choose between nominator or denominator, 1 means nominator, -1
 175:                     //m means denominator
 176: 
 177:                     -1.0,
 178: 
 179:                     //m nominator or denominator offset
 180: 
 181:                     1.0,
 182: 
 183:                     //m membrane offset
 184: 
 185:                     0.021,
 186: 
 187:                     //m denormalized time constant
 188: 
 189:                     -8e-3,
 190:                 },
 191: 
 192:                 //m backward kinetiks, commonly denoted with beta or perm to non-perm rate
 193: 
 194:                 {
 195:                     //m multiplier
 196: 
 197:                     0.18e3,
 198: 
 199:                     //m multiplier membrane dependence, 0.0 for no dependence
 200: 
 201:                     0.0,
 202: 
 203:                     //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
 204: 
 205:                     0.0,
 206: 
 207:                     //m choose between nominator or denominator, 1 means nominator, -1
 208:                     //m means denominator
 209: 
 210:                     -1.0,
 211: 
 212:                     //m nominator or denominator offset
 213: 
 214:                     1.0,
 215: 
 216:                     //m membrane offset
 217: 
 218:                     0.04,
 219: 
 220:                     //m denormalized time constant
 221: 
 222:                     4e-3,
 223:                 },
 224:             },
 225:         },
 226:     },
 227: 
 228:     //m inactivation description
 229: 
 230:     {
 231:         //m power, for a standard heccer, something between 1 and 4 or so.
 232: 
 233:         1,
 234: 
 235:         //m gate definition
 236: 
 237:         {
 238:             //m initial value, commonly forward over backward steady states
 239: 
 240:             0.08211379989188651,
 241: 
 242:             //m corresponding index in tables, set to -1 for initialization.
 243: 
 244:             -1,
 245: 
 246:             {
 247:                 //m forward kinetiks, commonly denoted with alpha or non-perm to perm rate
 248: 
 249:                 {
 250:                     //m multiplier
 251: 
 252:                     0.0025e3,
 253: 
 254:                     //m multiplier membrane dependence, 0.0 for no dependence
 255: 
 256:                     0.0,
 257: 
 258:                     //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
 259: 
 260:                     0.0,
 261: 
 262:                     //m choose between nominator or denominator, 1 means nominator, -1
 263:                     //m means denominator
 264: 
 265:                     -1.0,
 266: 
 267:                     //m nominator or denominator offset
 268: 
 269:                     1.0,
 270: 
 271:                     //m membrane offset
 272: 
 273:                     0.04,
 274: 
 275:                     //m denormalized time constant
 276: 
 277:                     8e-3,
 278:                 },
 279: 
 280:                 //m backward kinetiks, commonly denoted with beta or perm to non-perm rate
 281: 
 282:                 {
 283:                     //m multiplier
 284: 
 285:                     0.19e3,
 286: 
 287:                     //m multiplier membrane dependence, 0.0 for no dependence
 288: 
 289:                     0.0,
 290: 
 291:                     //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
 292: 
 293:                     0.0,
 294: 
 295:                     //m choose between nominator or denominator, 1 means nominator, -1
 296:                     //m means denominator
 297: 
 298:                     -1.0,
 299: 
 300:                     //m nominator or denominator offset
 301: 
 302:                     1.0,
 303: 
 304:                     //m membrane offset
 305: 
 306:                     0.05,
 307: 
 308:                     //m denormalized time constant
 309: 
 310:                     -10.0e-3,
 311:                 },
 312:             },
 313:         },
 314:     },
 315: };
 316: 
 317: 
 318: //v a delayed rectifier potassium channel
 319: 
 320: struct ChannelSteadyStateSteppedTau csstKdr =
 321: {
 322:     //m administrative overhead
 323: 
 324:     {
 325:         //m type of structure
 326: 
 327:         MATH_TYPE_ChannelSteadyStateSteppedTau,
 328: 
 329: #ifdef HECCER_SOURCE_NEUROSPACES
 330: 
 331:         //m identification
 332: 
 333:         ADDRESSING_NEUROSPACES_2_HECCER(3000),
 334: 
 335: #endif
 336: 
 337:     },
 338: 
 339:     //m first set of descriptive values, alphabetical order
 340: 
 341:     //m initial reversal potential
 342: 
 343:     -0.085,
 344: 
 345:     //m get reversal potential from this intermediary, -1 for none
 346: 
 347:     -1,
 348: 
 349:     //m maximal conductance when all channels are permissive
 350: 
 351:     1.67392e-05,
 352: 
 353:     //m contributes to this concentration pool, -1 for none, boolean indicator only.
 354: 
 355:     -1,
 356: 
 357:     //m first power
 358: 
 359:     2,
 360: 
 361:     //m second power
 362: 
 363:     1,
 364: 
 365:     //m first table, -1 for initialization
 366: 
 367:     -1,
 368: 
 369:     //m second table, -1 for initialization
 370: 
 371:     -1,
 372: 
 373:     //m first initial value
 374: 
 375:     0.003599440607,
 376: 
 377:     //m second initial value
 378: 
 379:     0.9999799396,
 380: 
 381:     //m steady state definition
 382: 
 383:     {
 384:         //m first kinetiks
 385: 
 386:         {
 387:             //m part a
 388: 
 389:             {
 390:                 //m 1: multiplier
 391:         
 392:                 -23.5e3,
 393:         
 394:                 //m 2: multiplier membrane dependence offset, 0.0 for no offset
 395:         
 396:                 0.012,
 397:         
 398:                 //m 4: nominator or denominator offset
 399:         
 400:                 -1.0,
 401:         
 402:                 //m 5: membrane offset
 403:         
 404:                 0.012,
 405:         
 406:                 //m 6: denormalized time constant
 407:         
 408:                 -12e-3,
 409: 
 410:             },
 411: 
 412:             //m part b
 413: 
 414:             {
 415:                 //m 1: multiplier
 416: 
 417:                 5e3,
 418: 
 419:                 //m 2: multiplier membrane dependence, 0.0 for no dependence
 420: 
 421:                 0.030,
 422: 
 423:                 //m 2: multiplier membrane dependence offset, 0.0 for no offset
 424:         
 425:                 0.147,
 426:         
 427:             },
 428:         },
 429: 
 430:         //m second kinetiks
 431: 
 432:         {
 433:             //m part a
 434: 
 435:             {
 436:                 //m 1: multiplier
 437:         
 438:                 -23.5e3,
 439:         
 440:                 //m 2: multiplier membrane dependence offset, 0.0 for no offset
 441:         
 442:                 -0.008,
 443: 
 444:                 //m 4: nominator or denominator offset
 445:         
 446:                 -1.0,
 447:         
 448:                 //m 5: membrane offset
 449:         
 450:                 -0.008,
 451:         
 452:                 //m 6: denormalized time constant
 453:         
 454:                 -12e-3,
 455: 
 456:             },
 457: 
 458:             //m part b
 459: 
 460:             {
 461:                 //m 1: multiplier
 462: 
 463:                 5e3,
 464: 
 465:                 //m 2: multiplier membrane dependence, 0.0 for no dependence
 466: 
 467:                 0.030,
 468: 
 469:                 //m 2: multiplier membrane dependence offset, 0.0 for no offset
 470:         
 471:                 0.127,
 472:         
 473:             },
 474:         },
 475:     },
 476: 
 477:     //m time constant definition
 478: 
 479:     {
 480:         //m part a
 481: 
 482:         {
 483:             //m threshold
 484: 
 485:             -0.025,
 486: 
 487:             //m low membrane potential target value
 488: 
 489:             1.2,
 490: 
 491:             //m above membrane potential target value
 492: 
 493:             0.010,
 494: 
 495:         },
 496: 
 497:         //m part b
 498: 
 499:         {
 500:             //m 4: nominator or denominator offset
 501: 
 502:             1.0,
 503: 
 504:             //m 5: membrane offset
 505: 
 506:             0.025,
 507: 
 508:             //m 6: denormalized time constant
 509: 
 510:             0.004,
 511: 
 512:         },
 513:     },
 514: };
 515: 
 516: 
 517: //v a persistent sodium channel
 518: 
 519: struct ChannelAct caNaP =
 520: {
 521:     //m administrative overhead
 522: 
 523:     {
 524:         //m type of structure
 525: 
 526:         MATH_TYPE_ChannelAct,
 527: 
 528: #ifdef HECCER_SOURCE_NEUROSPACES
 529: 
 530:         //m identification
 531: 
 532:         ADDRESSING_NEUROSPACES_2_HECCER(4000),
 533: 
 534: #endif
 535: 
 536:     },
 537: 
 538:     //m first set of descriptive values, alphabetical order
 539: 
 540:     //m initial reversal potential
 541: 
 542:     0.045,
 543: 
 544:     //m get reversal potential from this intermediary, -1 for none
 545: 
 546:     -1,
 547: 
 548:     //m maximal conductance when all channels are permissive
 549: 
 550:     2.789857767e-08,
 551: 
 552:     //m contributes to this concentration pool, -1 for none, boolean indicator only.
 553: 
 554:     -1,
 555: 
 556:     //m activation description
 557: 
 558:     {
 559:         //m power, for a standard heccer, something between 1 and 4 or so.
 560: 
 561:         3,
 562: 
 563:         //m gate definition
 564: 
 565:         {
 566:             //m initial value, commonly forward over backward steady states
 567: 
 568:             0.7612305421,
 569: 
 570:             //m corresponding index in tables, set to -1 for initialization.
 571: 
 572:             -1,
 573: 
 574:             {
 575:                 //m forward kinetiks, commonly denoted with alpha or non-perm to perm rate
 576: 
 577:                 {
 578:                     //m multiplier
 579: 
 580:                     200.0e3,
 581: 
 582:                     //m multiplier membrane dependence, 0.0 for no dependence
 583: 
 584:                     0.0,
 585: 
 586:                     //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
 587: 
 588:                     0.0,
 589: 
 590:                     //m choose between nominator or denominator, 1 means nominator, -1
 591:                     //m means denominator
 592: 
 593:                     -1.0,
 594: 
 595:                     //m nominator or denominator offset
 596: 
 597:                     1.0,
 598: 
 599:                     //m membrane offset
 600: 
 601:                     -0.018,
 602: 
 603:                     //m denormalized time constant
 604: 
 605:                     -16.0e-3,
 606:                 },
 607: 
 608:                 //m backward kinetiks, commonly denoted with beta or perm to non-perm rate
 609: 
 610:                 {
 611:                     //m multiplier
 612: 
 613:                     25.0e3,
 614: 
 615:                     //m multiplier membrane dependence, 0.0 for no dependence
 616: 
 617:                     0.0,
 618: 
 619:                     //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
 620: 
 621:                     0.0,
 622: 
 623:                     //m choose between nominator or denominator, 1 means nominator, -1
 624:                     //m means denominator
 625: 
 626:                     -1.0,
 627: 
 628:                     //m nominator or denominator offset
 629: 
 630:                     1.0,
 631: 
 632:                     //m membrane offset
 633: 
 634:                     0.058,
 635: 
 636:                     //m denormalized time constant
 637: 
 638:                     8.0e-3,
 639:                 },
 640:             },
 641:         },
 642:     },
 643: 
 644: };
 645: 
 646: 
 647: //v a simple fast sodium channel
 648: 
 649: struct ChannelActInact caiNaF =
 650: {
 651:     //m administrative overhead
 652: 
 653:     {
 654:         //m type of structure
 655: 
 656:         MATH_TYPE_ChannelActInact,
 657: 
 658: #ifdef HECCER_SOURCE_NEUROSPACES
 659: 
 660:         //m identification
 661: 
 662:         ADDRESSING_NEUROSPACES_2_HECCER(5000),
 663: 
 664: #endif
 665: 
 666:     },
 667: 
 668:     //m first set of descriptive values, alphabetical order
 669: 
 670:     //m initial reversal potential
 671: 
 672:     0.045,
 673: 
 674:     //m get reversal potential from this intermediary, -1 for none
 675: 
 676:     -1,
 677: 
 678:     //m maximal conductance when all channels are permissive
 679: 
 680:     0.0002092393115,
 681: 
 682:     //m contributes to this concentration pool, -1 for none, boolean indicator only.
 683: 
 684:     -1,
 685: 
 686:     //m activation description
 687: 
 688:     {
 689:         //m power, for a standard heccer, something between 1 and 4 or so.
 690: 
 691:         3,
 692: 
 693:         //m gate definition
 694: 
 695:         {
 696:             //m initial value, commonly forward over backward steady states
 697: 
 698:             0.0078406449371415214,
 699: 
 700:             //m corresponding index in tables, set to -1 for initialization.
 701: 
 702:             -1,
 703: 
 704:             {
 705:                 //m forward kinetiks, commonly denoted with alpha or non-perm to perm rate
 706: 
 707:                 {
 708:                     //m multiplier
 709: 
 710:                     35.0e3,
 711: 
 712:                     //m multiplier membrane dependence, 0.0 for no dependence
 713: 
 714:                     0.0,
 715: 
 716:                     //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
 717: 
 718:                     0.0,
 719: 
 720:                     //m choose between nominator or denominator, 1 means nominator, -1
 721:                     //m means denominator
 722: 
 723:                     -1.0,
 724: 
 725:                     //m nominator or denominator offset
 726: 
 727:                     0.0,
 728: 
 729:                     //m membrane offset
 730: 
 731:                     5.0e-3,
 732: 
 733:                     //m denormalized time constant
 734: 
 735:                     -10.0e-3,
 736:                 },
 737: 
 738:                 //m backward kinetiks, commonly denoted with beta or perm to non-perm rate
 739: 
 740:                 {
 741:                     //m multiplier
 742: 
 743:                     7.0e3,
 744: 
 745:                     //m multiplier membrane dependence, 0.0 for no dependence
 746: 
 747:                     0.0,
 748: 
 749:                     //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
 750: 
 751:                     0.0,
 752: 
 753:                     //m choose between nominator or denominator, 1 means nominator, -1
 754:                     //m means denominator
 755: 
 756:                     -1.0,
 757: 
 758:                     //m nominator or denominator offset
 759: 
 760:                     0.0,
 761: 
 762:                     //m membrane offset
 763: 
 764:                     65.0e-3,
 765: 
 766:                     //m denormalized time constant
 767: 
 768:                     20.0e-3,
 769:                 },
 770:             },
 771:         },
 772:     },
 773: 
 774:     //m inactivation description
 775: 
 776:     {
 777:         //m power, for a standard heccer, something between 1 and 4 or so.
 778: 
 779:         1,
 780: 
 781:         //m gate definition
 782: 
 783:         {
 784:             //m initial value, commonly forward over backward steady states
 785: 
 786:             0.26397776926502026,
 787: 
 788:             //m corresponding index in tables, set to -1 for initialization.
 789: 
 790:             -1,
 791: 
 792:             {
 793:                 //m forward kinetiks, commonly denoted with alpha or non-perm to perm rate
 794: 
 795:                 {
 796:                     //m multiplier
 797: 
 798:                     0.225e3,
 799: 
 800:                     //m multiplier membrane dependence, 0.0 for no dependence
 801: 
 802:                     0.0,
 803: 
 804:                     //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
 805: 
 806:                     0.0,
 807: 
 808:                     //m choose between nominator or denominator, 1 means nominator, -1
 809:                     //m means denominator
 810: 
 811:                     -1.0,
 812: 
 813:                     //m nominator or denominator offset
 814: 
 815:                     1.0,
 816: 
 817:                     //m membrane offset
 818: 
 819:                     80.0e-3,
 820: 
 821:                     //m denormalized time constant
 822: 
 823:                     10.0e-3,
 824:                 },
 825: 
 826:                 //m backward kinetiks, commonly denoted with beta or perm to non-perm rate
 827: 
 828:                 {
 829:                     //m multiplier
 830: 
 831:                     7.5e3,
 832: 
 833:                     //m multiplier membrane dependence, 0.0 for no dependence
 834: 
 835:                     0.0,
 836: 
 837:                     //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
 838: 
 839:                     0.0,
 840: 
 841:                     //m choose between nominator or denominator, 1 means nominator, -1
 842:                     //m means denominator
 843: 
 844:                     -1.0,
 845: 
 846:                     //m nominator or denominator offset
 847: 
 848:                     0.0,
 849: 
 850:                     //m membrane offset
 851: 
 852:                     -3.0e-3,
 853: 
 854:                     //m denormalized time constant
 855: 
 856:                     -18.0e-3,
 857:                 },
 858:             },
 859:         },
 860:     },
 861: };
 862: 
 863: 
 864: int piC2m[] =
 865: {
 866:     4,
 867:     -1,
 868: };
 869: 
 870: 
 871: struct MathComponentArray mca =
 872: {
 873:     //m number of math components
 874: 
 875:     4,
 876: 
 877:     //m math component data
 878: 
 879:     NULL,
 880: 
 881:     //m math component index, initialize to NULL
 882: 
 883:     NULL,
 884: 
 885: };
 886: 
 887: 
 888: struct Intermediary inter =
 889: {
 890:     //m compartment array
 891: 
 892:     1,
 893: 
 894:     &compSoma,
 895: 
 896:     //m all other mathematical components
 897: 
 898:     &mca,
 899: 
 900:     //m compartment 2 first mechanism number
 901: 
 902:     piC2m,
 903: 
 904: #ifdef HECCER_SOURCE_NEUROSPACES
 905: 
 906:     //m identification of the originator, mostly a cell or cell
 907:     //m population, but perhaps just a segment vector
 908: 
 909:     //m start range
 910: 
 911:     ADDRESSING_NEUROSPACES_2_HECCER(1000 - 1),
 912: 
 913:     //m end range
 914: 
 915:     ADDRESSING_NEUROSPACES_2_HECCER(9000),
 916: 
 917: #endif
 918: 
 919: };
 920: 
 921: 
 922: int main(int argc, char *argv[])
 923: {
 924:     //- determine intermediary size, and allocate
 925: 
 926:     struct MathComponentInfo *pmciCaT = MathComponentInfoLookup(caiCaT.mc.iType);
 927: 
 928:     struct MathComponentInfo *pmciKdr = MathComponentInfoLookup(csstKdr.mc.iType);
 929: 
 930:     struct MathComponentInfo *pmciNaP = MathComponentInfoLookup(caNaP.mc.iType);
 931: 
 932:     struct MathComponentInfo *pmciNaF = MathComponentInfoLookup(caiNaF.mc.iType);
 933: 
 934:     //- prepare the mechanism intermediary
 935: 
 936:     int iChars = pmciCaT->iChars + pmciKdr->iChars + pmciNaP->iChars + pmciNaF->iChars;
 937: 
 938:     void *pmc = calloc(sizeof(char), iChars);
 939: 
 940:     struct MathComponent *pmcTarget = pmc;
 941: 
 942:     pmcTarget = MathComponentCopyNext(pmcTarget, &caiCaT.mc);
 943:     pmcTarget = MathComponentCopyNext(pmcTarget, &csstKdr.mc);
 944:     pmcTarget = MathComponentCopyNext(pmcTarget, &caNaP.mc);
 945:     pmcTarget = MathComponentCopyNext(pmcTarget, &caiNaF.mc);
 946: 
 947:     //- link the intermediary
 948: 
 949:     mca.pmc = pmc;
 950: 
 951:     //- do the simulation
 952: 
 953:     simulate(argc,argv);
 954: 
 955: #ifdef HECCER_SOURCE_NEUROSPACES
 956: 
 957:     //- address variables via the external ids
 958: 
 959:     double *pdVmExternal = HeccerAddressVariable(pheccer, 1000, "Vm");
 960: 
 961:     double *pdCaTMExternal = HeccerAddressVariable(pheccer, 2000, "state_m");
 962: 
 963:     double *pdCaTHExternal = HeccerAddressVariable(pheccer, 2000, "state_h");
 964: 
 965:     double *pdKdrMExternal = HeccerAddressVariable(pheccer, 3000, "state_m");
 966: 
 967:     double *pdKdrHExternal = HeccerAddressVariable(pheccer, 3000, "state_h");
 968: 
 969:     double *pdNaPNExternal = HeccerAddressVariable(pheccer, 4000, "state_n");
 970: 
 971:     double *pdNaFMExternal = HeccerAddressVariable(pheccer, 5000, "state_m");
 972: 
 973:     double *pdNaFHExternal = HeccerAddressVariable(pheccer, 5000, "state_h");
 974: 
 975: #endif
 976: 
 977:     //- address variables via the internal indices
 978: 
 979:     double *pdVmInternal = HeccerAddressCompartmentVariable(pheccer, 0, "Vm");
 980: 
 981:     double *pdCaTMInternal = HeccerAddressMechanismVariable(pheccer, 0, "state_m");
 982: 
 983:     double *pdCaTHInternal = HeccerAddressMechanismVariable(pheccer, 0, "state_h");
 984: 
 985:     double *pdKdrMInternal = HeccerAddressMechanismVariable(pheccer, 1, "state_m");
 986: 
 987:     double *pdKdrHInternal = HeccerAddressMechanismVariable(pheccer, 1, "state_h");
 988: 
 989:     double *pdNaPNInternal = HeccerAddressMechanismVariable(pheccer, 2, "state_n");
 990: 
 991:     double *pdNaFMInternal = HeccerAddressMechanismVariable(pheccer, 3, "state_m");
 992: 
 993:     double *pdNaFHInternal = HeccerAddressMechanismVariable(pheccer, 3, "state_h");
 994: 
 995: #ifdef HECCER_SOURCE_NEUROSPACES
 996: 
 997:     if (pdVmInternal != pdVmExternal)
 998:     {
 999:         fprintf(stdout, "*** Error: (pdVmInternal != pdVmExternal)\n");
1000: 
1001:         exit(EXIT_FAILURE);
1002:     }
1003: 
1004:     if (pdCaTMInternal != pdCaTMExternal)
1005:     {
1006:         fprintf(stdout, "*** Error: (pdCaTMInternal != pdCaTMExternal)\n");
1007: 
1008:         exit(EXIT_FAILURE);
1009:     }
1010: 
1011:     if (pdCaTHInternal != pdCaTHExternal)
1012:     {
1013:         fprintf(stdout, "*** Error: (pdCaTHInternal != pdCaTHExternal)\n");
1014: 
1015:         exit(EXIT_FAILURE);
1016:     }
1017: 
1018:     if (pdKdrMInternal != pdKdrMExternal)
1019:     {
1020:         fprintf(stdout, "*** Error: (pdKdrMInternal != pdKdrMExternal)\n");
1021: 
1022:         exit(EXIT_FAILURE);
1023:     }
1024: 
1025:     if (pdKdrHInternal != pdKdrHExternal)
1026:     {
1027:         fprintf(stdout, "*** Error: (pdKdrHInternal != pdKdrHExternal)\n");
1028: 
1029:         exit(EXIT_FAILURE);
1030:     }
1031: 
1032:     if (pdNaPNInternal != pdNaPNExternal)
1033:     {
1034:         fprintf(stdout, "*** Error: (pdNaPNInternal != pdNaPNExternal)\n");
1035: 
1036:         exit(EXIT_FAILURE);
1037:     }
1038: 
1039:     if (pdNaFMInternal != pdNaFMExternal)
1040:     {
1041:         fprintf(stdout, "*** Error: (pdNaFMInternal != pdNaFMExternal)\n");
1042: 
1043:         exit(EXIT_FAILURE);
1044:     }
1045: 
1046:     if (pdNaFHInternal != pdNaFHExternal)
1047:     {
1048:         fprintf(stdout, "*** Error: (pdNaFHInternal != pdNaFHExternal)\n");
1049: 
1050:         exit(EXIT_FAILURE);
1051:     }
1052: 
1053: #endif
1054: 
1055:     fprintf(stdout, "Membrane potential is %g\n", pdVmInternal[0]);
1056: 
1057:     fprintf(stdout, "CaT state m is %g\n", pdCaTMInternal[0]);
1058: 
1059:     fprintf(stdout, "CaT state h is %g\n", pdCaTHInternal[0]);
1060: 
1061:     fprintf(stdout, "Kdr state m is %g\n", pdKdrMInternal[0]);
1062: 
1063:     fprintf(stdout, "Kdr state h is %g\n", pdKdrHInternal[0]);
1064: 
1065:     fprintf(stdout, "NaP state n is %g\n", pdNaPNInternal[0]);
1066: 
1067:     fprintf(stdout, "NaF state m is %g\n", pdNaFMInternal[0]);
1068: 
1069:     fprintf(stdout, "NaF state h is %g\n", pdNaFHInternal[0]);
1070: 
1071: 
1072:     //- set default result : ok
1073: 
1074:     int iResult = EXIT_SUCCESS;
1075: 
1076:     //- return result
1077: 
1078:     return(iResult);
1079: }
1080: 
1081: 
1082: #define main(argc,argv) simulate(argc,argv)
1083: 
1084: //t this prototype can give warning and perhaps errors.
1085: 
1086: int main(int argc, char *argv[]);
1087: 
1088: 
1089: #include "main.c"
1090: 
1091: 
1092: 








































Generated by Xrefactory version 2.0.14 on Thu Jul 24 22:41:20 2008