001: #!/usr/bin/perl -w
002: #!/usr/bin/perl -d:ptkdb -w
003: #
004: ##
005: ## Heccer : a compartmental solver that implements efficient Crank-Nicolson
006: ## integration for neuronal models.
007: ##
008: 
009: ##############################################################################
010: ##'
011: ##' Heccer : testbed C implementation
012: ##'
013: ##' Copyright (C) 2006-2007 Hugo Cornelis
014: ##'
015: ##' functional ideas ..  Hugo Cornelis, hugo.cornelis@gmail.com
016: ##'
017: ##' coding ............  Hugo Cornelis, hugo.cornelis@gmail.com
018: ##'
019: ##############################################################################
020: 
021: 
022: use strict;
023: 
024: 
025: BEGIN
026: {
027:     # during tests
028: 
029:     push @INC, '../glue/swig/perl';
030: 
031:     # during distcheck
032: 
033:     push @INC, '../../glue/swig/perl';
034: 
035:     # after installation
036: 
037:     push @INC, '/usr/local/glue/swig/perl';
038: }
039: 
040: 
041: BEGIN
042: {
043:     # for main during tests
044: 
045:     push @INC, './glue/swig/perl';
046: 
047:     # for main during distcheck
048: 
049:     push @INC, '../../tests/glue/swig/perl';
050: }
051: 
052: 
053: use Heccer;
054: 
055: 
056: # initialize compartments
057: 
058: my $compartments
059:     = [
060:        Heccer::Compartment->new
061:        (
062:         {
063:          dCm => 5.755329373e-12,
064:          dEm => -0.08,
065:          dInitVm => -0.068,
066:          dInject => 0,
067:          dRa => 772813.4375,
068:          dRm => 8.548598272e9,
069:         },
070:        ),
071:       ];
072: 
073: my $channel_cat
074:     = Heccer::ChannelActivationInactivation->new
075:       (
076:        {
077:         dReversalPotential => 0.14702148735523224,
078:         dMaximalConductance => 1.7546722963501793e-09,
079:         iPool => 1,
080:         activation => {
081:                        iPower => 1,
082:                        gate_concept => {
083:                                         dInitActivation => 0.03891870645,
084:                                         parameters => {
085:                                                        forward => {
086:                                                                    dMultiplier => 2.6e3,
087:                                                                    dMembraneDependence => 0.0,
088:                                                                    iNominator => -1.0,
089:                                                                    dDeNominatorOffset => 1.0,
090:                                                                    dMembraneOffset => 0.021,
091:                                                                    dTauDenormalizer => -8e-3,
092:                                                                   },
093:                                                        backward => {
094:                                                                     dMultiplier => 0.18e3,
095:                                                                     dMembraneDependence => 0.0,
096:                                                                     iNominator => -1.0,
097:                                                                     dDeNominatorOffset => 1.0,
098:                                                                     dMembraneOffset => 0.04,
099:                                                                     dTauDenormalizer => 4e-3,
100:                                                                    },
101:                                                       },
102:                                        },
103:                       },
104:         inactivation => {
105:                          iPower => 1,
106:                          gate_concept => {
107:                                           dInitActivation => 0.08260212813,
108:                                           parameters => {
109:                                                          forward => {
110:                                                                      dMultiplier => 0.0025e3,
111:                                                                      dMembraneDependence => 0.0,
112:                                                                      iNominator => -1.0,
113:                                                                      dDeNominatorOffset => 1.0,
114:                                                                      dMembraneOffset => 0.04,
115:                                                                      dTauDenormalizer => 8e-3,
116:                                                                     },
117:                                                          backward => {
118:                                                                       dMultiplier => 0.19e3,
119:                                                                       dMembraneDependence => 0.0,
120:                                                                       iNominator => -1.0,
121:                                                                       dDeNominatorOffset => 1.0,
122:                                                                       dMembraneOffset => 0.05,
123:                                                                       dTauDenormalizer => -10.0e-3,
124:                                                                      },
125:                                                         },
126:                                          },
127:                         },
128:        },
129:       );
130: 
131: my $pool
132:     = Heccer::ExponentialDecay->new
133:       (
134:        {
135:         dInitValue => 4e-5,
136:         dBeta => 7.579027046e+10,
137:         dSteadyState => 4e-05,
138:         dTau => 0.00010,
139:         piExternal => [
140:                        2,
141:                       ],
142:        },
143:       );
144: 
145: my $channel_kc
146:     = Heccer::ChannelActivationConcentration->new
147:       (
148:        {
149:         dReversalPotential => 85,
150:         dMaximalConductance => 2.80747571e-07,
151:         activation => {
152:                        iPower => 1,
153:                        gate_concept => {
154:                                         dInitActivation => 0.063531859768213905,
155:                                         parameters => {
156:                                                        forward => {
157:                                                                    dMultiplier => 7.5e3,
158:                                                                    dMembraneDependence => 0.0,
159:                                                                    iNominator => -1.0,
160:                                                                    dDeNominatorOffset => 0.0,
161:                                                                    dMembraneOffset => 0.0,
162:                                                                    dTauDenormalizer => 1e12,
163:                                                                   },
164:                                                        backward => {
165:                                                                     dMultiplier => 0.11e3,
166:                                                                     dMembraneDependence => 0.0,
167:                                                                     iNominator => -1.0,
168:                                                                     dDeNominatorOffset => 0.0,
169:                                                                     dMembraneOffset => -0.035,
170:                                                                     dTauDenormalizer => 14.9e-3,
171:                                                                    },
172:                                                       },
173:                                        },
174:                       },
175:         powered_activator => {
176:                               iPower => 2,
177:                               activator => {
178:                                             dInitActivation => 0.0099009900989999993,
179:                                             iActivator => 1,
180:                                             parameters => {
181:                                                            dBasalLevel => 4.0e-3,
182:                                                            dTau => 0.010,
183:                                                           },
184:                                            },
185:                              },
186:        },
187:       );
188: 
189: # initialize the math component array
190: 
191: my $math_components
192:     = [
193:        $channel_kc,
194:        $pool,
195:        $channel_cat,
196:       ];
197: 
198: # initialize intermediary
199: 
200: our $intermediary
201:     = Heccer::Intermediary->new
202:       (
203:        {
204:         comp2mech => [ 3, -1],
205:         compartments => $compartments,
206:         iCompartments => 1,
207:         math_components => $math_components,
208:        },
209:       );
210: 
211: 
212: our $config
213:     = {
214:        settings => {
215:                     reporting_granularity => 100,
216:                     steps => 1000,
217:                     tested_things => (
218:                                       $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_MATRIX
219:                                       | $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_DATA
220:                                       | $SwiggableHeccer::HECCER_DUMP_VM_COMPARTMENT_OPERATIONS
221:                                       | $SwiggableHeccer::HECCER_DUMP_VM_CHANNEL_POOL_FLUXES
222:                                       | $SwiggableHeccer::HECCER_DUMP_VM_MECHANISM_DATA
223:                                       | $SwiggableHeccer::HECCER_DUMP_VM_MECHANISM_OPERATIONS
224:                                       | $SwiggableHeccer::HECCER_DUMP_VM_SUMMARY
225:                                      ),
226:                     time_step => (1e-6),
227:                    },
228:       };
229: 
230: 
231: require 'main';
232: 
233: