46 #include <Xyce_config.h>
65 #include <N_ERH_ErrorMgr.h>
69 #include <N_LAS_Vector.h>
70 #include <N_LAS_Matrix.h>
71 #include <N_UTL_FeatureTest.h>
72 #include <N_UTL_Math.h>
85 .setDescription(
"Intracellular resistivity");
91 .setDescription(
"Segment radius");
97 .setDescription(
"Cable length");
104 .setDescription(
"Number of segments");
113 .setDescription(
"Membrane capacitance");
119 .setDescription(
"Membrane conductance");
125 .setDescription(
"Resting potential");
131 .setDescription(
"Potassium resting potential");
137 .setDescription(
"Potassium base conductance");
143 .setDescription(
"Sodium resting potential");
149 .setDescription(
"Sodium base conductance");
155 .setDescription(
"a-current rest potential");
161 .setDescription(
"a-current base conductance");
167 .setDescription(
"Calcium rest potential");
173 .setDescription(
"Calcium base conductance");
179 .setDescription(
"Potassium-calcium rest potential");
185 .setDescription(
"Potassium-calcium base conductance");
191 .setDescription(
"initial intra-cellular calcium concentration");
197 .setDescription(
"calcium current to concentration multiplier");
203 .setDescription(
"calcium removal time constant");
209 .setDescription(
"Intracellular resistivity");
216 .setDescription(
"Segment radius");
223 .setDescription(
"Cable length");
230 .setDescription(
"Current for user-defined current equation");
236 .setDescription(
"Neuron6::Model to use for ion channels");
242 .setDescription(
"Number of segments");
248 .setDescription(
"Contribution to membrane current");
254 .setDescription(
"Independant variables for ion channel equations");
260 .setDescription(
"Independant variables: F equations");
266 .setDescription(
"Independant variables: Q equations");
272 .setDescription(
"Functions for membrane Neuron6::Model");
278 .setDescription(
"Parameters for membrane Neuron6::Model");
297 :
DeviceInstance(IB, configuration.getInstanceParameters(), factory_block),
309 numIntVarsPerSegment(0),
310 numStateVarsPerSegment(0),
319 APosEquPosNodeOffset(0),
320 APosEquNextNodeOffset(0),
321 ANegEquNegNodeOffset(0),
322 ANegEquLastNodeOffset(0)
402 for(
int i=0; i<
nSeg; i++ )
408 jacStamp[offset].resize( numIntVarsPerSegment + 2 );
429 nextMap[i] = numIntVarsPerSegment+1;
434 else if( i==(nSeg-1) )
449 nextMap[i] = numIntVarsPerSegment+1;
639 double d_lambda = 0.1;
651 nSeg = int((
length/(d_lambda*lambda_f)+0.9)/2)*2 + 1;
683 bool bsuccess =
true;
696 const std::vector<int> & extLIDVecRef)
701 if (DEBUG_DEVICE && isActive(Diag::DEVICE_PARAMETERS))
703 Xyce::dout() << std::endl << section_divider << std::endl;
704 Xyce::dout() <<
" Instance::registerLIDs" << std::endl;
705 Xyce::dout() <<
" name = " <<
getName() << std::endl;
790 for (
int i = 0; i <
nSeg ; i++)
792 std::ostringstream segNumber;
795 if( numIntVarsPerSegment > 1 )
835 for(
int i=0, j=0; i<
nSeg; i++, j+=2)
873 int numRows = jacLIDVec.size();
875 for(
int i=0; i< numRows; i++ )
877 int numCol = jacLIDVec[i].size();
879 for(
int j=0; j< numCol; j++ )
928 for(
int i=0, j=2; i<
nSeg; i++, j+=10 )
1010 bool bsuccess =
true;
1024 bool bsuccess =
true;
1039 bool bsuccess =
true;
1061 bool bsuccess =
true;
1069 for(
int i=0; i<
nSeg ; i++)
1113 double vIn = (*solVectorPtr)[
li_Pos];
1114 double vOut = (*solVectorPtr)[
li_Neg];
1120 for(
int i=0; i<
nSeg ; i++)
1126 if (i == (nSeg - 1))
1152 (*daeFVecPtr)[li_internalVars[i*
numIntVarsPerSegment]] += - gPrev * (vPrev - vSeg) - gNext * (vNext - vSeg);
1172 bool bsuccess =
true;
1177 for(
int i=0; i<
nSeg ; i++)
1217 bool bsuccess =
true;
1228 for(
int i=0; i<
nSeg ; i++)
1234 double gPrev =
gSeg;
1235 double gNext =
gSeg;
1267 bool bsuccess =
true;
1299 :
DeviceModel(MB, configuration.getModelParameters(), factory_block),
1324 ionChannelModelGiven(false),
1339 CaGammaGiven(false),
1341 hodgenHuxleyOn_(false),
1342 ConnorStevensOn_(false),
1344 potassiumOn_(false),
1347 membraneIndpVarsGiven(false),
1348 membraneIndpFEqusGiven(false),
1349 membraneIndpQEqusGiven(false)
1415 std::vector<Instance*>::iterator iter;
1419 for (iter=first; iter!=last; ++iter)
1451 std::vector<Instance*>::iterator iter;
1455 for (iter=first; iter!=last; ++iter)
1457 (*iter)->processParams();
1472 std::vector<Instance*>::const_iterator iter;
1480 os <<
"Number of Neuron instances: " << isize << std::endl;
1481 os <<
" name=\t\tmodelName\tParameters" << std::endl;
1482 for (i=0, iter=first; iter!=last; ++iter, ++i)
1484 os <<
" " << i <<
": " << (*iter)->getName() <<
"\t";
1509 for (std::vector<Instance *>::const_iterator it = instanceContainer.begin(); it != instanceContainer.end(); ++it)
1523 .registerDevice(
"neuron", 6)
1524 .registerModelType(
"neuron", 6);
const InstanceName & getName() const
std::vector< double > segF_dM
std::map< int, int > nextMap
virtual std::ostream & printOutInstances(std::ostream &os) const
std::vector< int > SegVEqnNOffset
std::vector< double > segQ_dV
std::vector< double > dCaF_dH
std::vector< double > segF_dVn
const std::vector< std::vector< int > > & jacobianStamp() const
bool updateDependentParameters()
std::vector< double > segF_dVp
std::vector< double > dHQ_dH
std::vector< int > li_nPro
std::vector< double > segCEquFvalue
const SolverState & solverState_
std::vector< double > segMEquQvalue
Descriptor & addPar(const char *parName, T default_value, T U::*varPtr)
Adds the parameter description to the parameter map.
std::vector< double > dmF_dm
std::vector< double > daQ_da
std::vector< int > li_internalVars
std::vector< int > SegVEqnHOffset
std::vector< double > dbF_dV
std::vector< int > MEquVNodeOffset
std::vector< std::string > membraneIndpFEqus
RCP< MembraneModel > membraneModel_
static void loadModelParameters(ParametricData< Model > &model_parameters)
bool updatePrimaryState()
Linear::Vector * nextSolVectorPtr
std::vector< double > dcF_dCa
std::vector< double > segF_db
std::vector< int > CEquCNodeOffset
std::vector< int > MEquMNodeOffset
bool updateTemperature(const double &temp_tmp)
int ANegEquLastNodeOffset
Linear::Vector * daeQVectorPtr
std::vector< double > daF_dV
Pure virtual class to augment a linear system.
void addInternalNode(Util::SymbolTable &symbol_table, int index, const InstanceName &instance_name, const std::string &lead_name)
bool processParams()
processParams
std::vector< double > segF_dm
bool membraneCurrentEqusGiven
std::vector< double > dbQ_db
std::vector< double > dcF_dV
std::vector< std::string > membraneCurrentEqus
int APosEquNextNodeOffset
std::vector< int > li_hPro
std::vector< int > CaEquH_NodeOffset
std::vector< int > M_EquVNodeOffset
std::vector< double > segHEquQvalue
std::map< int, int > segMap
virtual void registerJacLIDs(const JacobianStamp &jacLIDVec)
std::vector< double > dmQ_dm
std::vector< double > segCEquQvalue
std::vector< double > dnF_dn
std::vector< double > dCaF_dV
std::vector< double > segHEquFvalue
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
bool membraneIndpQEqusGiven
std::vector< std::string > membraneFunctions
std::vector< int > HEquHNodeOffset
std::vector< double > segF_dc
std::vector< int > H_EquVNodeOffset
std::vector< int > li_MPro
std::vector< int > li_aPro
std::vector< double > dCaQ_dCa
std::vector< double > segNEquQvalue
std::vector< int > CaEquCaNodeOffset
std::vector< double > segF_dH
bool ionChannelModelGiven
std::vector< double > segCaEquQvalue
std::vector< Param > params
Parameters from the line.
std::vector< int > li_mPro
void setParams(const std::vector< Param > ¶ms)
const std::string & getName() const
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
std::vector< int > HEquVNodeOffset
std::vector< int > CaEquM_NodeOffset
std::vector< double > segBEquQvalue
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
std::vector< int > li_CaPro
std::vector< double > segAEquFvalue
std::vector< double > segM_EquFvalue
std::vector< int > BEquBNodeOffset
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
std::vector< double > segMEquFvalue
std::vector< std::string > membraneParameters
std::vector< double > dbF_db
std::vector< double > dnF_dV
std::vector< double > potassiumCurrent
std::vector< double > segCaEquFvalue
std::vector< int > SegVEqnVpreOffset
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
std::vector< Instance * > instanceContainer
const DeviceOptions & deviceOptions_
void varTypes(std::vector< char > &varTypeVec)
std::vector< int > li_bPro
std::vector< double > dhQ_dh
std::map< int, int > prevMap
std::vector< double > segQvalue
std::vector< double > dMF_dV
static Config< T > & addConfiguration()
Adds the device to the Xyce device configuration.
std::vector< double > segF_dh
std::vector< int > AEquVNodeOffset
std::vector< double > segF_dn
Linear::Matrix * dFdxMatrixPtr
std::vector< int > CEquVNodeOffset
std::vector< int > li_NaCurrentState
bool membraneParametersGiven
The Device class is an interface for device implementations.
std::vector< std::vector< int > > jacStamp
std::vector< int > SegVEqnVsegOffset
std::string ionChannelModel
std::vector< double > segM_EquQvalue
std::vector< double > dhF_dh
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
std::vector< int > SegVEqnMOffset
bool membraneFunctionsGiven
std::vector< double > dhF_dV
Class Configuration contains device configuration data.
void registerStateLIDs(const std::vector< int > &staLIDVecRef)
std::vector< double > dMQ_dM
std::vector< int > H_EquH_NodeOffset
std::vector< std::vector< int > > jacobianOffsets
std::vector< double > segF_da
std::vector< double > segAEquQvalue
bool membraneIndpVarsGiven
std::vector< double > dcQ_dc
std::vector< double > dCaF_dM
std::vector< int > CEquCaNodeOffset
const SolverState & getSolverState() const
std::vector< double > dmF_dV
std::vector< int > li_HPro
std::vector< int > CaEquVNodeOffset
std::vector< double > dHF_dV
std::vector< int > SegVEqnVnexOffset
std::vector< int > NEquVNodeOffset
std::vector< double > dcF_dc
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
std::vector< double > segH_EquQvalue
std::vector< double > segH_EquFvalue
std::vector< int > li_KCurrentState
std::vector< int > BEquVNodeOffset
Linear::Vector * daeFVectorPtr
std::vector< double > dCaF_dCa
std::vector< double > segNEquFvalue
std::vector< double > dMF_dM
std::vector< double > segF_dV
std::vector< int > M_EquM_NodeOffset
std::vector< std::string > membraneIndpVars
std::vector< double > segFvalue
std::vector< double > daF_da
bool updateSecondaryState()
std::vector< std::string > membraneIndpQEqus
Instance(const Configuration &configuration, const InstanceBlock &IB, Model &Miter, const FactoryBlock &factory_block)
bool processInstanceParams()
processInstanceParams
std::vector< double > dnQ_dn
const ExternData & extData
bool updateIntermediateVars()
std::vector< int > li_Vol
std::vector< int > AEquANodeOffset
ModelBlock represents a .MODEL line from the netlist.
Parameter may be specified as a solution dependent expression from netlist.
std::vector< double > sodiumCurrent
std::vector< int > li_cPro
Manages parameter binding for class C.
InstanceBlock represent a device instance line from the netlist.
std::vector< Param > params
std::vector< double > segBEquFvalue
Linear::Matrix * dQdxMatrixPtr
int numStateVarsPerSegment
bool membraneIndpFEqusGiven
void setModParams(const std::vector< Param > ¶ms)
std::vector< double > dHF_dH
std::vector< int > NEquNNodeOffset