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 <stdlib.h> 20: 21: #include "../../heccer/addressing.h" 22: #include "../../heccer/heccer.h" 23: #include "../../heccer/vclamp.h" 24: 25: 26: #include "main.h" 27: 28: 29: #define HECCER_TEST_REPORTING_GRANULARITY 100 30: #define HECCER_TEST_STEPS 1000 31: #define HECCER_TEST_TESTED_THINGS ( HECCER_DUMP_VM_COMPARTMENT_MATRIX \ 32: | HECCER_DUMP_VM_MECHANISM_OPERATIONS \ 33: ) 34: #define HECCER_TEST_TIME_STEP (3e-6) 35: 36: 37: struct Compartment compSoma = 38: { 39: //m administrative overhead 40: 41: { 42: //m type of structure 43: 44: MATH_TYPE_Compartment, 45: }, 46: 47: //m index of parent compartment, -1 for none 48: 49: -1, 50: 51: /* //m first mechanism */ 52: 53: /* NULL, */ 54: 55: /* //m number of mechanisms */ 56: 57: /* 0, */ 58: 59: //m descriptive values, alphabetical order 60: 61: /* double dCm; */ 62: 63: 4.57537e-11, // unscaled 0.0164, 64: 65: /* double dEm; */ 66: 67: -0.08, 68: 69: /* double dInitVm; */ 70: 71: -0.068, 72: 73: /* double dInject; */ 74: 75: 0, 76: 77: /* double dRa; */ 78: 79: 360502, // unscaled 2.5, 80: 81: /* double dRm; */ 82: 83: 3.58441e+08, // unscaled 1 84: }; 85: 86: 87: int piC2m[] = 88: { 89: 0, 90: -1, 91: }; 92: 93: 94: struct Intermediary inter = 95: { 96: //m compartment array 97: 98: 1, 99: 100: &compSoma, 101: 102: //m all other mathematical components 103: 104: NULL, 105: 106: //m compartment 2 first mechanism number 107: 108: piC2m, 109: }; 110: 111: 112: int main(int argc, char *argv[]) 113: { 114: //- allocate a voltage clamp object 115: 116: pvc = VClampNew("vc object"); 117: 118: //- set fields 119: 120: double dInject = 0.000003; 121: 122: //! setfield ^ gain 0.50 tau_i 0.02 tau_d 0.005 saturation 999.0 123: 124: double dR = 1; 125: double dC = 0.00003; 126: double dCommand_init = 0.0; 127: 128: double dGain = 0.50; 129: double dTau_i = 0.000003; 130: double dTau_d = 0.000003 / 4; 131: double dSaturation = 999.0; 132: 133: VClampSetFields(pvc, dInject, dC, dR, dCommand_init, dGain, dTau_i, dTau_d, dSaturation); 134: 135: //d connect the voltage clamp object with the compartment of interest 136: 137: #define HECCER_TEST_INITIATE \ 138: double *pdVm = HeccerAddressCompartmentVariable(pheccer, 0, "Vm"); \ 139: double *pdInject = HeccerAddressCompartmentVariable(pheccer, 0, "inject"); \ 140: VClampAddVariable(pvc, pdVm, pdInject) 141: 142: //d schedule the voltage clamper 143: 144: #define HECCER_TEST_SCHEDULE VClampSingleStep(pvc, (dSimulationTime - HECCER_TEST_TIME_GRANULARITY)) 145: 146: //- do the simulation 147: 148: simulate(argc, argv); 149: } 150: 151: 152: #define main(argc,argv) simulate(argc,argv) 153: 154: //t this prototype can give warning and perhaps errors. 155: 156: int main(int argc, char *argv[]); 157: 158: 159: #include "main.c" 160: 161: 162: