001: #!/usr/bin/perl -w
002: #!/usr/bin/perl -d:ptkdb -w
003: #
004: 
005: use strict;
006: 
007: 
008: $| = 1;
009: 
010: 
011: BEGIN
012: {
013:     #! make check
014: 
015:     push @INC, '../perl';
016: 
017:     #! make distcheck
018: 
019:     push @INC, '../../perl';
020: 
021:     #! normal run
022: 
023:     push @INC, './perl';
024: 
025:     #! after install
026: 
027:     push @INC, '/usr/local/glue/swig/perl';
028: }
029: 
030: 
031: use Heccer;
032: 
033: use SSP;
034: 
035: 
036: $SIG{__DIE__}
037:     = sub {
038:         use Carp;
039: 
040:         confess @_;
041:     };
042: 
043: sub main
044: {
045:     # model specification array
046: 
047:     my $modelname = $0;
048: 
049:     $modelname =~ s/.*\///;
050: 
051:     $modelname =~ s/-/_/g;
052: 
053:     # instantiate a scheduler
054: 
055:     my $scheduler
056:         = SSP->new(
057:                    {
058:                     apply => {
059:                               simulation => [
060:                                              {
061:                                               arguments => [ 1000, { verbose => 2, }, ],
062:                                               method => 'steps',
063:                                              },
064:                                              {
065:                                               arguments => [ 0.1, ],
066:                                               method => 'advance',
067:                                              },
068:                                             ],
069:                              },
070:                     models => [
071:                                {
072: #                               modelname => 'a single compartment',
073:                                 solverclass => "heccer",
074:                                },
075:                               ],
076:                     name => $modelname,
077:                     services => {
078:                                  heccer_intermediary => {
079:                                                          initializers => [
080:                                                                           {
081:                                                                            method => 'load',
082:                                                                            arguments => [
083:                                                                                          {
084:                                                                                           comp2mech => [ 3, -1],
085:                                                                                           compartments => [
086:                                                                                                            {
087:                                                                                                             dCm => 5.755329373e-12,
088:                                                                                                             dEm => -0.08,
089:                                                                                                             dInitVm => -0.068,
090:                                                                                                             dInject => 0,
091:                                                                                                             dRa => 772813.4375,
092:                                                                                                             dRm => 8.548598272e9,
093:                                                                                                            },
094:                                                                                                           ],
095:                                                                                           iCompartments => 1,
096:                                                                                           math_components => [
097:                                                                                                               Heccer::ChannelActivationConcentration->new
098:                                                                                                               (
099:                                                                                                                {
100:                                                                                                                 dReversalPotential => 85,
101:                                                                                                                 dMaximalConductance => 2.80747571e-07,
102:                                                                                                                 activation => {
103:                                                                                                                                iPower => 1,
104:                                                                                                                                gate_concept => {
105:                                                                                                                                                 dInitActivation => 0.063531859768213905,
106:                                                                                                                                                 parameters => {
107:                                                                                                                                                                A => {
108:                                                                                                                                                                      dHHScale => 7.5e3,
109:                                                                                                                                                                      dHHMult => 0.0,
110:                                                                                                                                                                      iHHFactorFlag => -1.0,
111:                                                                                                                                                                      dHHAdd => 0.0,
112:                                                                                                                                                                      dHHOffsetE => 0.0,
113:                                                                                                                                                                      dHHTau => 1e12,
114:                                                                                                                                                                     },
115:                                                                                                                                                                B => {
116:                                                                                                                                                                      dHHScale => 0.11e3,
117:                                                                                                                                                                      dHHMult => 0.0,
118:                                                                                                                                                                      iHHFactorFlag => -1.0,
119:                                                                                                                                                                      dHHAdd => 0.0,
120:                                                                                                                                                                      dHHOffsetE => -0.035,
121:                                                                                                                                                                      dHHTau => 14.9e-3,
122:                                                                                                                                                                     },
123:                                                                                                                                                               },
124:                                                                                                                                                },
125:                                                                                                                               },
126:                                                                                                                 powered_activator => {
127:                                                                                                                                       iPower => 2,
128:                                                                                                                                       concentration_activator => {
129:                                                                                                                                                                   dInitActivation => 0.0099009900989999993,
130:                                                                                                                                                                   iActivator => 1,
131:                                                                                                                                                                   parameters => {
132:                                                                                                                                                                                  dBasalLevel => 4.0e-3,
133:                                                                                                                                                                                  dTau => 0.010,
134:                                                                                                                                                                                 },
135:                                                                                                                                                                  },
136:                                                                                                                                      },
137:                                                                                                                },
138:                                                                                                               ),
139:                                                                                                               Heccer::ExponentialDecay->new
140:                                                                                                               (
141:                                                                                                                {
142:                                                                                                                 dInitValue => 4e-5,
143:                                                                                                                 dBeta => 7.579027046e+10,
144:                                                                                                                 dSteadyState => 4e-05,
145:                                                                                                                 dTau => 0.00010,
146:                                                                                                                 piExternal => [
147:                                                                                                                                2,
148:                                                                                                                               ],
149:                                                                                                                },
150:                                                                                                               ),
151:                                                                                                               Heccer::ChannelActivationInactivation->new
152:                                                                                                               (
153:                                                                                                                {
154:                                                                                                                 dReversalPotential => 0.14702148735523224,
155:                                                                                                                 dMaximalConductance => 1.7546722963501793e-09,
156:                                                                                                                 iPool => 1,
157:                                                                                                                 activation => {
158:                                                                                                                                iPower => 1,
159:                                                                                                                                gate_concept => {
160:                                                                                                                                                 dInitActivation => 0.03891870645,
161:                                                                                                                                                 parameters => {
162:                                                                                                                                                                A => {
163:                                                                                                                                                                      dHHScale => 2.6e3,
164:                                                                                                                                                                      dHHMult => 0.0,
165:                                                                                                                                                                      iHHFactorFlag => -1.0,
166:                                                                                                                                                                      dHHAdd => 1.0,
167:                                                                                                                                                                      dHHOffsetE => 0.021,
168:                                                                                                                                                                      dHHTau => -8e-3,
169:                                                                                                                                                                     },
170:                                                                                                                                                                B => {
171:                                                                                                                                                                      dHHScale => 0.18e3,
172:                                                                                                                                                                      dHHMult => 0.0,
173:                                                                                                                                                                      iHHFactorFlag => -1.0,
174:                                                                                                                                                                      dHHAdd => 1.0,
175:                                                                                                                                                                      dHHOffsetE => 0.04,
176:                                                                                                                                                                      dHHTau => 4e-3,
177:                                                                                                                                                                     },
178:                                                                                                                                                               },
179:                                                                                                                                                },
180:                                                                                                                               },
181:                                                                                                                 inactivation => {
182:                                                                                                                                  iPower => 1,
183:                                                                                                                                  gate_concept => {
184:                                                                                                                                                   dInitActivation => 0.08260212813,
185:                                                                                                                                                   parameters => {
186:                                                                                                                                                                  A => {
187:                                                                                                                                                                        dHHScale => 0.0025e3,
188:                                                                                                                                                                        dHHMult => 0.0,
189:                                                                                                                                                                        iHHFactorFlag => -1.0,
190:                                                                                                                                                                        dHHAdd => 1.0,
191:                                                                                                                                                                        dHHOffsetE => 0.04,
192:                                                                                                                                                                        dHHTau => 8e-3,
193:                                                                                                                                                                       },
194:                                                                                                                                                                  B => {
195:                                                                                                                                                                        dHHScale => 0.19e3,
196:                                                                                                                                                                        dHHMult => 0.0,
197:                                                                                                                                                                        iHHFactorFlag => -1.0,
198:                                                                                                                                                                        dHHAdd => 1.0,
199:                                                                                                                                                                        dHHOffsetE => 0.05,
200:                                                                                                                                                                        dHHTau => -10.0e-3,
201:                                                                                                                                                                       },
202:                                                                                                                                                                 },
203:                                                                                                                                                  },
204:                                                                                                                                 },
205:                                                                                                                },
206:                                                                                                               ),
207:                                                                                                              ],
208: #                                                                                         pcName => 'a single compartment',
209:                                                                                          },
210:                                                                                         ],
211:                                                                           },
212:                                                                          ],
213:                                                          module_name => 'Heccer',
214:                                                          package => 'Heccer::Intermediary::Compiler',
215:                                                         },
216:                                 },
217:                     solverclasses => {
218:                                       heccer => {
219:                                                  constructor_settings => {
220:                                                                           configuration => {
221:                                                                                             reporting => {
222:                                                                                                           granularity => 100,
223:                                                                                                           tested_things => (
224:                                                                                                                             $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_MATRIX
225:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_MATRIX_DIAGONALS
226:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_OPERATIONS
227:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_MECHANISM_DATA
228:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_MECHANISM_OPERATIONS
229:                                                                                                                             | $SwiggableHeccer::HECCER_DUMP_VM_SUMMARY
230:                                                                                                                            ),
231:                                                                                                          },
232:                                                                                            },
233:                                                                           dStep => (1e-6),
234:                                                                          },
235:                                                  module_name => 'Heccer',
236:                                                  service_name => 'heccer_intermediary',
237:                                                 },
238:                                      },
239:                    },
240:                   );
241: 
242:     use YAML;
243: 
244:     use IO::File;
245: 
246:     my $configuration = IO::File->new(">./yaml/heccer/$modelname.yml");
247: 
248:     if (defined $configuration)
249:     {
250:         print $configuration Dump($scheduler);
251: 
252:         $configuration->close();
253:     }
254: 
255:     my $scheduler_yaml;
256: 
257:     {
258:         local $/;
259: 
260:         if (-e "./yaml/$modelname.yml")
261:         {
262:             $scheduler_yaml = Load(`cat ./yaml/$modelname.yml`);
263:         }
264:     }
265: 
266:     # run the schedule
267: 
268:     $scheduler->run();
269: }
270: 
271: 
272: main();
273: 
274: 
275: exit 0;
276: 
277: 
278: