file:/local_home/local_home/hugo/neurospaces_project/heccer/source/c/snapshots/0/tests/code/vclamp-sodium.c (Mon Jun 16 00:03:52 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 <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 (6e-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.028,
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: //v a simple fast sodium channel
88:
89: struct ChannelActInact caiNaF =
90: {
91: //m administrative overhead
92:
93: {
94: //m type of structure
95:
96: MATH_TYPE_ChannelActInact,
97: },
98:
99: //m first set of descriptive values, alphabetical order
100:
101: //m initial reversal potential
102:
103: 0.045,
104:
105: //m get reversal potential from this intermediary, -1 for none
106:
107: -1,
108:
109: //m maximal conductance when all channels are permissive
110:
111: 0.0002092393115,
112:
113: //m contributes to this concentration pool, -1 for none, boolean indicator only.
114:
115: -1,
116:
117: //m activation description
118:
119: {
120: //m power, for a standard heccer, something between 1 and 4 or so.
121:
122: 3,
123:
124: //m gate definition
125:
126: {
127: //m initial value, commonly forward over backward steady states
128:
129: 0.0078406449371415214,
130:
131: //m corresponding index in tables, set to -1 for initialization.
132:
133: -1,
134:
135: {
136: //m forward kinetiks, commonly denoted with alpha or non-perm to perm rate
137:
138: {
139: //m multiplier
140:
141: 35.0e3,
142:
143: //m multiplier membrane dependence, 0.0 for no dependence
144:
145: 0.0,
146:
147: //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
148:
149: 0.0,
150:
151: //m choose between nominator or denominator, 1 means nominator, -1
152: //m means denominator
153:
154: -1.0,
155:
156: //m nominator or denominator offset
157:
158: 0.0,
159:
160: //m membrane offset
161:
162: 5.0e-3,
163:
164: //m denormalized time constant
165:
166: -10.0e-3,
167: },
168:
169: //m backward kinetiks, commonly denoted with beta or perm to non-perm rate
170:
171: {
172: //m multiplier
173:
174: 7.0e3,
175:
176: //m multiplier membrane dependence, 0.0 for no dependence
177:
178: 0.0,
179:
180: //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
181:
182: 0.0,
183:
184: //m choose between nominator or denominator, 1 means nominator, -1
185: //m means denominator
186:
187: -1.0,
188:
189: //m nominator or denominator offset
190:
191: 0.0,
192:
193: //m membrane offset
194:
195: 65.0e-3,
196:
197: //m denormalized time constant
198:
199: 20.0e-3,
200: },
201: },
202: },
203: },
204:
205: //m inactivation description
206:
207: {
208: //m power, for a standard heccer, something between 1 and 4 or so.
209:
210: 1,
211:
212: //m gate definition
213:
214: {
215: //m initial value, commonly forward over backward steady states
216:
217: 0.26397776926502026,
218:
219: //m corresponding index in tables, set to -1 for initialization.
220:
221: -1,
222:
223: {
224: //m forward kinetiks, commonly denoted with alpha or non-perm to perm rate
225:
226: {
227: //m multiplier
228:
229: 0.225e3,
230:
231: //m multiplier membrane dependence, 0.0 for no dependence
232:
233: 0.0,
234:
235: //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
236:
237: 0.0,
238:
239: //m choose between nominator or denominator, 1 means nominator, -1
240: //m means denominator
241:
242: -1.0,
243:
244: //m nominator or denominator offset
245:
246: 1.0,
247:
248: //m membrane offset
249:
250: 80.0e-3,
251:
252: //m denormalized time constant
253:
254: 10.0e-3,
255: },
256:
257: //m backward kinetiks, commonly denoted with beta or perm to non-perm rate
258:
259: {
260: //m multiplier
261:
262: 7.5e3,
263:
264: //m multiplier membrane dependence, 0.0 for no dependence
265:
266: 0.0,
267:
268: //m 2b: multiplier membrane dependence offset, 0.0 for no dependence
269:
270: 0.0,
271:
272: //m choose between nominator or denominator, 1 means nominator, -1
273: //m means denominator
274:
275: -1.0,
276:
277: //m nominator or denominator offset
278:
279: 0.0,
280:
281: //m membrane offset
282:
283: -3.0e-3,
284:
285: //m denormalized time constant
286:
287: -18.0e-3,
288: },
289: },
290: },
291: },
292: };
293:
294:
295: int piC2m[] =
296: {
297: 1,
298: -1,
299: };
300:
301:
302: struct MathComponentArray mca =
303: {
304: //m number of math components
305:
306: 1,
307:
308: //m math component data
309:
310: &caiNaF.mc,
311:
312: //m math component index, initialize to NULL
313:
314: NULL,
315:
316: };
317:
318:
319: struct Intermediary inter =
320: {
321: //m compartment array
322:
323: 1,
324:
325: &compSoma,
326:
327: //m all other mathematical components
328:
329: &mca,
330:
331: //m compartment 2 first mechanism number
332:
333: piC2m,
334: };
335:
336:
337: int main(int argc, char *argv[])
338: {
339: //- allocate a voltage clamp object
340:
341: pvc = VClampNew("vc object");
342:
343: //- set fields
344:
345: double dInject = 0.0;
346:
347: //! setfield ^ gain 0.50 tau_i 0.02 tau_d 0.005 saturation 999.0
348:
349: double dR = 1;
350: double dC = 0.03;
351: double dCommand_init = 0.0;
352:
353: double dGain = 0.50e-13;
354: double dTau_i = 0.02;
355: double dTau_d = 0.005;
356: double dSaturation = 999.0;
357:
358: VClampSetFields(pvc, dInject, dC, dR, dCommand_init, dGain, dTau_i, dTau_d, dSaturation);
359:
360: //d connect the voltage clamp object with the compartment of interest
361:
362: #define HECCER_TEST_INITIATE \
363: double *pdVm = HeccerAddressCompartmentVariable(pheccer, 0, "Vm"); \
364: double *pdInject = HeccerAddressCompartmentVariable(pheccer, 0, "inject"); \
365: VClampAddVariable(pvc, pdVm, pdInject)
366:
367: //d schedule the voltage clamper
368:
369: #define HECCER_TEST_SCHEDULE VClampSingleStep(pvc, (dSimulationTime - HECCER_TEST_TIME_GRANULARITY))
370:
371: //- do the simulation
372:
373: simulate(argc, argv);
374: }
375:
376:
377: #define main(argc,argv) simulate(argc,argv)
378:
379: //t this prototype can give warning and perhaps errors.
380:
381: int main(int argc, char *argv[]);
382:
383:
384: #include "main.c"
385:
386:
387:
Generated by Xrefactory version 2.0.14 on Thu Jul 24 22:41:20 2008