001: //
002: // Heccer : a compartmental solver that implements efficient Crank-Nicolson
003: // integration for neuronal models.
004: //
005: 
006: //////////////////////////////////////////////////////////////////////////////
007: //'
008: //' Heccer : testbed C implementation
009: //'
010: //' Copyright (C) 2006-2008 Hugo Cornelis
011: //'
012: //' functional ideas ..   Hugo Cornelis, hugo.cornelis@gmail.com
013: //'
014: //' coding ............   Hugo Cornelis, hugo.cornelis@gmail.com
015: //'
016: //////////////////////////////////////////////////////////////////////////////
017: 
018: 
019: #include "../../heccer/compartment.h"
020: #include "../../heccer/heccer.h"
021: 
022: 
023: #define HECCER_TEST_INTERPOL_INTERVAL_DEFAULT_ENTRIES           20
024: #define HECCER_TEST_INTERVAL_DEFAULT_START                      (-0.1)
025: #define HECCER_TEST_INTERVAL_DEFAULT_END                        (0.05)
026: #define HECCER_TEST_INTERVAL_DEFAULT_ENTRIES                    50
027: #define HECCER_TEST_STEPS 1
028: 
029: 
030: struct Compartment pcomp[] =
031: {
032:     {
033:         //m administrative overhead
034: 
035:         {
036:             //m type of structure
037: 
038:             MATH_TYPE_Compartment,
039:         },
040: 
041:         //m index of parent compartment, -1 for none
042: 
043:         -1,
044: 
045: /*     //m first mechanism */
046: 
047: /*     NULL, */
048: 
049: /*     //m number of mechanisms */
050: 
051: /*     0, */
052: 
053:         //m descriptive values, alphabetical order
054: 
055: /*     double dCm; */
056: 
057:         4.57537e-11, // unscaled 0.0164,
058: 
059: /*     double dEm; */
060: 
061:         -0.08,
062: 
063: /*     double dInitVm; */
064: 
065:         -0.068,
066: 
067: /*     double dInject;		 */
068: 
069:         0,
070: 
071: /*     double dRa; */
072: 
073:         360502, // unscaled 2.5,
074: 
075: /*     double dRm; */
076: 
077:         3.58441e+08, // unscaled 1
078:     },
079: 
080:     {
081:         //m administrative overhead
082: 
083:         {
084:             //m type of structure
085: 
086:             MATH_TYPE_Compartment,
087:         },
088: 
089:         //m index of parent compartment, -1 for none
090: 
091:         0,
092: 
093: /* 	//m first mechanism */
094: 
095: /* 	NULL, */
096: 
097: /* 	//m number of mechanisms */
098: 
099: /* 	0, */
100: 
101:         //m descriptive values, alphabetical order
102: 
103: /*     double dCm; */
104: 
105:         5.755329373e-12, // unscaled 0.0164,
106: 
107: /*     double dEm; */
108: 
109:         -0.08,
110: 
111: /*     double dInitVm; */
112: 
113:         -0.068,
114: 
115: /*     double dInject;		 */
116: 
117:         0,
118: 
119: /*     double dRa; */
120: 
121:         772813.4375, // unscaled 2.5,
122: 
123: /*     double dRm; */
124: 
125:         8.548598272e9, // unscaled 3
126:     },
127: };
128: 
129: 
130: //v a delayed rectifier potassium channel
131: 
132: struct ChannelSteadyStateSteppedTau pcsstKdr[] =
133: {
134:     {
135:         //m administrative overhead
136: 
137:         {
138:             //m type of structure
139: 
140:             MATH_TYPE_ChannelSteadyStateSteppedTau,
141:         },
142: 
143:         //m first set of descriptive values, alphabetical order
144: 
145:         //m initial reversal potential
146: 
147:         -0.085,
148: 
149:         //m get reversal potential from this intermediary, -1 for none
150: 
151:         -1,
152: 
153:         //m maximal conductance when all channels are permissive
154: 
155:         1.67392e-05,
156: 
157:         //m contributes to this concentration pool, -1 for none, boolean indicator only.
158: 
159:         -1,
160: 
161:         //m first power
162: 
163:         2,
164: 
165:         //m second power
166: 
167:         1,
168: 
169:         //m first table, -1 for initialization
170: 
171:         -1,
172: 
173:         //m second table, -1 for initialization
174: 
175:         -1,
176: 
177:         //m first initial value
178: 
179:         0.003599440607,
180: 
181:         //m second initial value
182: 
183:         0.9999799396,
184: 
185:         //m steady state definition
186: 
187:         {
188:             //m first kinetiks
189: 
190:             {
191:                 //m part a
192: 
193:                 {
194:                     //m 1: multiplier
195:         
196:                     -23.5e3,
197:         
198:                     //m 2: multiplier membrane dependence offset, 0.0 for no offset
199:         
200:                     0.012,
201:         
202:                     //m 4: nominator or denominator offset
203:         
204:                     -1.0,
205:         
206:                     //m 5: membrane offset
207:         
208:                     0.012,
209:         
210:                     //m 6: denormalized time constant
211:         
212:                     -12e-3,
213: 
214:                 },
215: 
216:                 //m part b
217: 
218:                 {
219:                     //m 1: multiplier
220: 
221:                     5e3,
222: 
223:                     //m 2: multiplier membrane dependence, 0.0 for no dependence
224: 
225:                     0.030,
226: 
227:                     //m 2: multiplier membrane dependence offset, 0.0 for no offset
228:         
229:                     0.147,
230:         
231:                 },
232:             },
233: 
234:             //m second kinetiks
235: 
236:             {
237:                 //m part a
238: 
239:                 {
240:                     //m 1: multiplier
241:         
242:                     -23.5e3,
243:         
244:                     //m 2: multiplier membrane dependence offset, 0.0 for no offset
245:         
246:                     -0.008,
247:         
248:                     //m 4: nominator or denominator offset
249:         
250:                     -1.0,
251:         
252:                     //m 5: membrane offset
253:         
254:                     -0.008,
255:         
256:                     //m 6: denormalized time constant
257:         
258:                     -12e-3,
259: 
260:                 },
261: 
262:                 //m part b
263: 
264:                 {
265:                     //m 1: multiplier
266: 
267:                     5e3,
268: 
269:                     //m 2: multiplier membrane dependence, 0.0 for no dependence
270: 
271:                     0.030,
272: 
273:                     //m 2: multiplier membrane dependence offset, 0.0 for no offset
274:         
275:                     0.127,
276:         
277:                 },
278:             },
279:         },
280: 
281:         //m time constant definition
282: 
283:         {
284:             //m part a
285: 
286:             {
287:                 //m threshold
288: 
289:                 -0.025,
290: 
291:                 //m low membrane potential target value
292: 
293:                 1.2,
294: 
295:                 //m above membrane potential target value
296: 
297:                 0.010,
298: 
299:             },
300: 
301:             //m part b
302: 
303:             {
304:                 //m 4: nominator or denominator offset
305: 
306:                 1.0,
307: 
308:                 //m 5: membrane offset
309: 
310:                 0.025,
311: 
312:                 //m 6: denormalized time constant
313: 
314:                 0.004,
315: 
316:             },
317:         },
318:     },
319: 
320:     {
321:         //m administrative overhead
322: 
323:         {
324:             //m type of structure
325: 
326:             MATH_TYPE_ChannelSteadyStateSteppedTau,
327:         },
328: 
329:         //m first set of descriptive values, alphabetical order
330: 
331:         //m initial reversal potential
332: 
333:         -0.085,
334: 
335:         //m get reversal potential from this intermediary, -1 for none
336: 
337:         -1,
338: 
339:         //m maximal conductance when all channels are permissive
340: 
341:         2.1056e-07,
342: 
343:         //m contributes to this concentration pool, -1 for none, boolean indicator only.
344: 
345:         -1,
346: 
347:         //m first power
348: 
349:         2,
350: 
351:         //m second power
352: 
353:         1,
354: 
355:         //m first table, -1 for initialization
356: 
357:         -1,
358: 
359:         //m second table, -1 for initialization
360: 
361:         -1,
362: 
363:         //m first initial value
364: 
365:         0.003599440607,
366: 
367:         //m second initial value
368: 
369:         0.9999799396,
370: 
371:         //m steady state definition
372: 
373:         {
374:             //m first kinetiks
375: 
376:             {
377:                 //m part a
378: 
379:                 {
380:                     //m 1: multiplier
381:         
382:                     -23.5e3,
383:         
384:                     //m 2: multiplier membrane dependence offset, 0.0 for no offset
385:         
386:                     0.012,
387:         
388:                     //m 4: nominator or denominator offset
389:         
390:                     -1.0,
391:         
392:                     //m 5: membrane offset
393:         
394:                     0.012,
395:         
396:                     //m 6: denormalized time constant
397:         
398:                     -12e-3,
399: 
400:                 },
401: 
402:                 //m part b
403: 
404:                 {
405:                     //m 1: multiplier
406: 
407:                     5e3,
408: 
409:                     //m 2: multiplier membrane dependence, 0.0 for no dependence
410: 
411:                     0.030,
412: 
413:                     //m 2: multiplier membrane dependence offset, 0.0 for no offset
414:         
415:                     0.147,
416:         
417:                 },
418:             },
419: 
420:             //m second kinetiks
421: 
422:             {
423:                 //m part a
424: 
425:                 {
426:                     //m 1: multiplier
427:         
428:                     -23.5e3,
429:         
430:                     //m 2: multiplier membrane dependence offset, 0.0 for no offset
431:         
432:                     -0.008,
433:         
434:                     //m 4: nominator or denominator offset
435:         
436:                     -1.0,
437:         
438:                     //m 5: membrane offset
439:         
440:                     -0.008,
441:         
442:                     //m 6: denormalized time constant
443:         
444:                     -12e-3,
445: 
446:                 },
447: 
448:                 //m part b
449: 
450:                 {
451:                     //m 1: multiplier
452: 
453:                     5e3,
454: 
455:                     //m 2: multiplier membrane dependence, 0.0 for no dependence
456: 
457:                     0.030,
458: 
459:                     //m 2: multiplier membrane dependence offset, 0.0 for no offset
460:         
461:                     0.127,
462:         
463:                 },
464:             },
465:         },
466: 
467:         //m time constant definition
468: 
469:         {
470:             //m part a
471: 
472:             {
473:                 //m threshold
474: 
475:                 -0.025,
476: 
477:                 //m low membrane potential target value
478: 
479:                 1.2,
480: 
481:                 //m above membrane potential target value
482: 
483:                 0.010,
484: 
485:             },
486: 
487:             //m part b
488: 
489:             {
490:                 //m 4: nominator or denominator offset
491: 
492:                 1.0,
493: 
494:                 //m 5: membrane offset
495: 
496:                 0.025,
497: 
498:                 //m 6: denormalized time constant
499: 
500:                 0.004,
501: 
502:             },
503:         },
504:     },
505: };
506: 
507: 
508: int piC2m[] =
509: {
510:     1,
511:     2,
512:     -1,
513: };
514: 
515: 
516: struct MathComponentArray mca =
517: {
518:     //m number of math components
519: 
520:     2,
521: 
522:     //m math component data
523: 
524:     &pcsstKdr[0].mc,
525: 
526:     //m math component index, initialize to NULL
527: 
528:     NULL,
529: 
530: };
531: 
532: 
533: struct Intermediary inter =
534: {
535:     //m compartment array
536: 
537:     2,
538: 
539:     pcomp,
540: 
541:     //m all other mathematical components
542: 
543:     &mca,
544: 
545:     //m compartment 2 first mechanism number
546: 
547:     piC2m,
548: };
549: 
550: 
551: #include "main.c"
552: 
553: