#include <Stoich.h>
Public Member Functions | |
Stoich () | |
~Stoich () | |
void | setOneWay (bool v) |
bool | getOneWay () const |
unsigned int | getNumVarPools () const |
Returns number of local pools that are updated by solver. | |
unsigned int | getNumBufPools () const |
Returns number of local buffered pools. | |
unsigned int | getNumAllPools () const |
unsigned int | getNumProxyPools () const |
vector< unsigned int > | getPoolIdMap () const |
void | setPath (const Eref &e, string path) |
string | getPath (const Eref &e) const |
void | setKsolve (Id v) |
assigns kinetic solver: Ksovle or GSSAsolve. | |
Id | getKsolve () const |
void | setDsolve (Id v) |
assigns diffusion solver: Dsovle or a Gillespie voxel stepper | |
Id | getDsolve () const |
void | setCompartment (Id v) |
assigns compartment occupied by Stoich. | |
Id | getCompartment () const |
unsigned int | getNumRates () const |
unsigned int | getNumCoreRates () const |
const RateTerm * | rates (unsigned int i) const |
Utility function to return a rates_ entry. | |
const vector< RateTerm * > & | getRateTerms () const |
Returns a reference to the entire rates_ vector. | |
unsigned int | getNumFuncs () const |
const FuncTerm * | funcs (unsigned int i) const |
vector< int > | getMatrixEntry () const |
vector< unsigned int > | getColIndex () const |
vector< unsigned int > | getRowStart () const |
vector< Id > | getProxyPools (Id i) const |
int | getStatus () const |
void | setElist (const Eref &e, const vector< ObjId > &elist) |
void | locateOffSolverReacs (Id myCompt, vector< Id > &elist) |
void | allocateObjMap (const vector< Id > &elist) |
void | resizeArrays () |
Using the computed array sizes, now allocate space for them. | |
void | allocateModelObject (Id id, vector< Id > &bufPools) |
Identifies and allocates objects in the Stoich. | |
void | allocateModel (const vector< Id > &elist) |
Calculate sizes of all arrays, and allocate them. | |
void | convertRatesToStochasticForm () |
void | buildXreacs (const Eref &e, Id otherStoich) |
void | filterXreacs () |
void | scaleBufsAndRates (unsigned int index, double volScale) |
Used to handle run-time size updates for spines. | |
void | comptsOnCrossReacTerms (vector< pair< Id, Id > > &xr) const |
void | setupCrossSolverReacVols () const |
void | zombifyModel (const Eref &e, const vector< Id > &elist) |
void | unZombifyModel () |
void | unZombifyPools () |
unZombifies Pools. Helper for unZombifyModel. | |
void | zombifyChemCompt (Id compt) |
unsigned int | convertIdToReacIndex (Id id) const |
unsigned int | convertIdToPoolIndex (Id id) const |
unsigned int | convertIdToFuncIndex (Id id) const |
ZeroOrder * | makeHalfReaction (double rate, const vector< Id > &reactants) |
Utility function to make a half reac and return the rate term. | |
void | installReaction (Id reacId, const vector< Id > &subs, const vector< Id > &prds) |
unsigned int | innerInstallReaction (Id reacId, const vector< Id > &subs, const vector< Id > &prds) |
void | installMMenz (Id enzId, const vector< Id > &enzMolId, const vector< Id > &subs, const vector< Id > &prds) |
void | installMMenz (MMEnzymeBase *meb, unsigned int rateIndex, const vector< Id > &subs, const vector< Id > &prds) |
void | installEnzyme (Id enzId, Id enzMolId, Id cplxId, const vector< Id > &subs, const vector< Id > &prds) |
void | installEnzyme (ZeroOrder *r1, ZeroOrder *r2, ZeroOrder *r3, Id enzId, Id enzMolId, const vector< Id > &prds) |
void | installDummyEnzyme (Id enzId, Id enzMolId) |
This is used when the enzyme lacks sub or prd. | |
void | installAndUnschedFunc (Id func, Id pool) |
void | installAndUnschedFuncRate (Id func, Id pool) |
void | installAndUnschedFuncReac (Id func, Id reac) |
unsigned int | getSpecies (unsigned int poolIndex) const |
void | setSpecies (unsigned int poolIndex, unsigned int s) |
void | setReacKf (const Eref &e, double v) const |
void | setReacKb (const Eref &e, double v) const |
void | setMMenzKm (const Eref &e, double v) const |
double | getMMenzNumKm (const Eref &e) const |
void | setMMenzKcat (const Eref &e, double v) const |
double | getMMenzKcat (const Eref &e) const |
void | setEnzK1 (const Eref &e, double v) const |
Later handle all the volumes when this conversion is done. | |
double | getEnzNumK1 (const Eref &e) const |
void | setEnzK2 (const Eref &e, double v) const |
Set rate k2 (1/sec) for enzyme. | |
double | getEnzK2 (const Eref &e) const |
Get rate k2 (1/sec) for enzyme. | |
void | setEnzK3 (const Eref &e, double v) const |
Set rate k3 (1/sec) for enzyme. | |
double | getEnzK3 (const Eref &e) const |
Get rate k3, aka kcat, for enzyme. | |
double | getR1 (const Eref &e) const |
double | getR1offset1 (const Eref &e) const |
double | getR1offset2 (const Eref &e) const |
double | getR2 (const Eref &e) const |
void | setFunctionExpr (const Eref &e, string expr) |
void | updateRatesAfterRemesh () |
void | print () const |
Utility function, prints out N_, used for debugging. | |
void | printRates () const |
Another utility function, prints out all Kf, kf, Kb, kb. | |
void | updateReacVelocities (const double *s, vector< double > &vel, unsigned int volIndex) const |
void | updateFuncs (double *s, double t) const |
Updates the function values, within s. | |
const KinSparseMatrix & | getStoichiometryMatrix () const |
Updates the rates for cross-compartment reactions. | |
const vector< Id > & | getOffSolverPools () const |
vector< Id > | getOffSolverCompts () const |
const vector< Id > & | offSolverPoolMap (Id compt) const |
Static Public Member Functions | |
static const Cinfo * | initCinfo () |
Static Public Attributes | |
static const unsigned int | PoolIsNotOnSolver |
Protected Attributes | |
bool | useOneWay_ |
string | path_ |
Id | ksolve_ |
This contains the Id of the Kinetic solver. | |
Id | dsolve_ |
This contains the Id of the Diffusion solver. Optional. | |
Id | compartment_ |
Contains Id of compartment holding reac system. Optional. | |
ZombiePoolInterface * | kinterface_ |
Pointer for ksolve. | |
ZombiePoolInterface * | dinterface_ |
Pointer for dsolve. | |
vector< unsigned int > | species_ |
vector< RateTerm * > | rates_ |
unsigned int | numVoxels_ |
Number of voxels in reac system. | |
vector< FuncTerm * > | funcs_ |
The FuncTerms handle mathematical ops on mol levels. | |
KinSparseMatrix | N_ |
N_ is the stoichiometry matrix. | |
vector< unsigned int > | objMap_ |
unsigned int | objMapStart_ |
vector< Id > | idMap_ |
vector< Id > | reacMap_ |
vector< Id > | enzMap_ |
vector< Id > | mmEnzMap_ |
vector< Id > | funcMap_ |
unsigned int | numVarPools_ |
unsigned int | numBufPools_ |
unsigned int | numFunctions_ |
unsigned int | numReac_ |
int | status_ |
vector< Id > | offSolverPools_ |
map< Id, vector< Id > > | offSolverPoolMap_ |
vector< Id > | offSolverReacs_ |
vector< pair< Id, Id > > | offSolverReacCompts_ |
vector< vector< Id > > | subComptVec_ |
vector< vector< Id > > | prdComptVec_ |
Stoich is the class that handles the stoichiometry matrix for a reaction system, and also setting up the computations for reaction rates. It has to coordinate the operation of a number of model definition classes, most importantly: Pools, Reacs and Enz(yme)s. It also coordinates the setup of a large number of numerical solution engines, or solvers: Ksolve, Gsolve, Dsolve, and SteadyState. The setup process has to follow a tight order, most of which is internally manged by the Stoich. The Stoich itself does not do any 'process' functions. It just sets up data structures for the other objects that do the crunching.
1. Compartment is set up to a cell (neuroMesh) or volume (other meshes) 2. Compartment assigned to Stoich. Here it assigns unique vols. 3. Dsolve and Ksolve assigned to Stoich using setKsolve and setDsolve. 3.1 At this point the Stoich::useOneWay_ flag is set if it is a Gsolve. 4. Call Stoich::setPath. All the rest happens internally, done by Stoich: 4.1 assign compartment to Dsolve and Ksolve. 4.2 assign numPools and compts to Dsolve and Ksolve. 4.3 During Zombification, zeroth vector< RateTerm* > is built. 4.4 afterZombification, stoich builds rateTerm vector for all vols. 4.5 Stoich assigns itself to Dsolve and Ksolve.
As seen by the user, this reduces to just 4 stages:
Stoich::Stoich | ( | ) |
Stoich::~Stoich | ( | ) |
void Stoich::allocateModel | ( | const vector< Id > & | elist | ) |
Calculate sizes of all arrays, and allocate them.
Identifies and allocates objects in the Stoich.
void Stoich::allocateObjMap | ( | const vector< Id > & | elist | ) |
Builds the objMap vector, which maps all Ids to the internal indices for pools and reacs that are used in the solver. In addition to the elist, it also scans through the offSolverPools and offSolverReacs to build the map.
Builds cross-reaction terms between current stoich and otherStoich. The function scans the voxels at which there are jucntions between different compartments, and orchestrates setup of interfaces between the Ksolves that implement the cross-reactions at these junctions.
References kinterface_, offSolverPoolMap_, and ZombiePoolInterface::setupCrossSolverReacs().
Referenced by initCinfo().
Expands out list of compartment mappings of proxy reactions to the appropriate entries on the rates_vector.
unsigned int Stoich::convertIdToFuncIndex | ( | Id | id | ) | const |
References funcMap_, objMap_, and objMapStart_.
Referenced by installAndUnschedFunc().
unsigned int Stoich::convertIdToPoolIndex | ( | Id | id | ) | const |
References idMap_, objMap_, and objMapStart_.
Referenced by Ksolve::getPoolIndex(), Gsolve::getPoolIndex(), installAndUnschedFunc(), installAndUnschedFuncRate(), and installAndUnschedFuncReac().
unsigned int Stoich::convertIdToReacIndex | ( | Id | id | ) | const |
References objMap_, objMapStart_, and rates_.
Referenced by getNumCoreRates(), getR1(), getR1offset1(), getR1offset2(), getR2(), installAndUnschedFuncRate(), installAndUnschedFuncReac(), installDummyEnzyme(), setEnzK1(), setEnzK2(), setEnzK3(), setMMenzKcat(), setMMenzKm(), setReacKb(), and setReacKf().
void Stoich::convertRatesToStochasticForm | ( | ) |
This function is used when the stoich class is employed by a Gsolver for doing stochastic calculations. Here we fix the issue of having a single substrate at more than first order. As the first molecule of the substrate is consumed, the number is depleted by one and so its forward rate is reduced. And so on. This also protects against going negative in mol number or concentration.
References RateTerm::getR1(), and rates_.
Referenced by Gsolve::rebuildGssaSystem().
void Stoich::filterXreacs | ( | ) |
References ZombiePoolInterface::filterCrossRateTerms(), kinterface_, offSolverReacCompts_, and offSolverReacs_.
Referenced by initCinfo().
const FuncTerm * Stoich::funcs | ( | unsigned int | i | ) | const |
References funcs_.
Referenced by Gsolve::fillMathDep(), and GssaVoxelPools::updateDependentMathExpn().
vector< unsigned int > Stoich::getColIndex | ( | ) | const |
References KinSparseMatrix::colIndex(), and N_.
Referenced by initCinfo().
Id Stoich::getCompartment | ( | ) | const |
References compartment_.
Referenced by initCinfo(), and SteadyState::setStoich().
Id Stoich::getDsolve | ( | ) | const |
References dsolve_.
Referenced by initCinfo().
double Stoich::getEnzK2 | ( | const Eref & | e | ) | const |
Get rate k2 (1/sec) for enzyme.
References getR1offset1(), getR2(), and useOneWay_.
Referenced by ZombieEnz::vGetK2().
double Stoich::getEnzK3 | ( | const Eref & | e | ) | const |
Get rate k3, aka kcat, for enzyme.
References getR1offset1(), getR1offset2(), and useOneWay_.
Referenced by ZombieEnz::vGetKcat().
double Stoich::getEnzNumK1 | ( | const Eref & | e | ) | const |
Id Stoich::getKsolve | ( | ) | const |
References ksolve_.
Referenced by SteadyState::classifyState(), initCinfo(), and Ksolve::print().
vector< int > Stoich::getMatrixEntry | ( | ) | const |
References KinSparseMatrix::matrixEntry(), and N_.
Referenced by initCinfo().
double Stoich::getMMenzKcat | ( | const Eref & | e | ) | const |
References getR2().
Referenced by ZombieMMenz::vGetKcat().
double Stoich::getMMenzNumKm | ( | const Eref & | e | ) | const |
unsigned int Stoich::getNumAllPools | ( | ) | const |
Returns total number of local pools. Leaves out the pools whose actual calculations happen on another solver, but are given a proxy here in order to handle cross-compartment reactions.
References numBufPools_, and numVarPools_.
Referenced by Gsolve::fillMathDep(), Ksolve::getEstimatedDt(), initCinfo(), Ksolve::setStoich(), and VoxelPools::updateRates().
unsigned int Stoich::getNumBufPools | ( | ) | const |
Returns number of local buffered pools.
References numBufPools_.
Referenced by Gsolve::fillMathDep(), and VoxelPools::updateRates().
unsigned int Stoich::getNumCoreRates | ( | ) | const |
Utility function to return # of core rates for reacs which are entirely located on current compartment, including all reactants
References convertIdToReacIndex(), offSolverReacs_, and rates_.
Referenced by VoxelPools::print(), Gsolve::rebuildGssaSystem(), VoxelPoolsBase::scaleVolsBufsRates(), SteadyState::setStoich(), VoxelPools::setVolumeAndDependencies(), GssaVoxelPools::setVolumeAndDependencies(), Ksolve::updateRateTerms(), and Gsolve::updateRateTerms().
unsigned int Stoich::getNumFuncs | ( | ) | const |
References funcs_.
Referenced by Gsolve::fillMathDep().
unsigned int Stoich::getNumProxyPools | ( | ) | const |
Returns number of proxy pools here for cross-compartment reactions
References offSolverPools_.
Referenced by Gsolve::fillMathDep(), Ksolve::getEstimatedDt(), initCinfo(), Gsolve::rebuildGssaSystem(), Ksolve::reinit(), Gsolve::reinit(), Ksolve::setStoich(), and VoxelPools::updateRates().
unsigned int Stoich::getNumRates | ( | ) | const |
Utility function to return # of rates_ entries. This includes the cross-solver reactions.
References rates_.
Referenced by GssaVoxelPools::advance(), Gsolve::fillMathDep(), Gsolve::fillMmEnzDep(), Ksolve::getEstimatedDt(), initCinfo(), Gsolve::makeReacDepsUnique(), and Gsolve::rebuildGssaSystem().
unsigned int Stoich::getNumVarPools | ( | ) | const |
Returns number of local pools that are updated by solver.
References numVarPools_.
Referenced by Gsolve::fillMathDep(), initCinfo(), Ksolve::process(), Gsolve::process(), Gsolve::rebuildGssaSystem(), GssaVoxelPools::reinit(), and VoxelPools::updateRates().
vector< Id > Stoich::getOffSolverCompts | ( | ) | const |
List all the compartments to which the current compt is coupled, by cross-compartment reactions. Self not included.
References offSolverPoolMap_.
const vector< Id > & Stoich::getOffSolverPools | ( | ) | const |
References offSolverPools_.
bool Stoich::getOneWay | ( | ) | const |
References useOneWay_.
string Stoich::getPath | ( | const Eref & | e | ) | const |
References path_.
Referenced by initCinfo().
vector< unsigned int > Stoich::getPoolIdMap | ( | ) | const |
Map to look up the index of the pool from its Id. poolIndex = poolIdMap[ Id::value() - poolOffset ] where the poolOffset is the smallest Id::value. poolOffset is passed back as the last entry of this vector. Any Ids that are not pools return EMPTY=~0.
References objMap_, and objMapStart_.
Referenced by initCinfo().
References Element::cinfo(), dummy(), Id::element(), Cinfo::isA(), and offSolverPoolMap_.
Referenced by initCinfo().
double Stoich::getR1 | ( | const Eref & | e | ) | const |
Returns the internal rate in #/voxel, for R1, for the specified Eref.
Looks up the matching rate for R1. Later we may have additional scaling terms for the specified voxel.
References convertIdToReacIndex(), Eref::id(), and rates_.
Referenced by getEnzNumK1(), getMMenzNumKm(), getR1offset1(), and getR1offset2().
double Stoich::getR1offset1 | ( | const Eref & | e | ) | const |
Returns internal rate R1 in #/voxel, for the rate term following the one directly referred to by the Eref e. Enzymes define multiple successive rate terms, so we look up the first, and then select one after it.
References convertIdToReacIndex(), getR1(), Eref::id(), and rates_.
Referenced by getEnzK2(), and getEnzK3().
double Stoich::getR1offset2 | ( | const Eref & | e | ) | const |
Returns internal rate R1 in #/voxel, for the rate term two after the one directly referred to by the Eref e. Enzymes define multiple successive rate terms, so we look up the first, and then select the second one after it.
References convertIdToReacIndex(), getR1(), Eref::id(), and rates_.
Referenced by getEnzK3().
double Stoich::getR2 | ( | const Eref & | e | ) | const |
Returns the internal rate in #/voxel, for R2, for the specified reacIndex and voxel index. In some cases R2 is undefined, and it then returns 0.
Looks up the matching rate for R2. Later we may have additional scaling terms for the specified voxel.
References convertIdToReacIndex(), Eref::id(), and rates_.
Referenced by getEnzK2(), and getMMenzKcat().
const vector< RateTerm * > & Stoich::getRateTerms | ( | ) | const |
Returns a reference to the entire rates_ vector.
References rates_.
Referenced by Gsolve::rebuildGssaSystem(), VoxelPoolsBase::scaleVolsBufsRates(), SteadyState::setStoich(), VoxelPools::setVolumeAndDependencies(), GssaVoxelPools::setVolumeAndDependencies(), Ksolve::updateRateTerms(), and Gsolve::updateRateTerms().
vector< unsigned int > Stoich::getRowStart | ( | ) | const |
References N_, and KinSparseMatrix::rowStart().
Referenced by initCinfo().
SpeciesId Stoich::getSpecies | ( | unsigned int | poolIndex | ) | const |
Returns SpeciesId of specified pool
References species_.
int Stoich::getStatus | ( | ) | const |
getStatus(): Flag to track status of Stoich object. -1: No path yet assigned. 0: Success 1: Warning: Missing reactant in Reac or Enz 2: Warning: Missing substrate in MMenz 4: Warning: Compartment not defined 8: Warning: Neither Ksolve nor Dsolve defined 16: Warning: No objects found on path
References status_.
Referenced by initCinfo().
const KinSparseMatrix & Stoich::getStoichiometryMatrix | ( | ) | const |
Updates the rates for cross-compartment reactions.
Get the rate for a single reaction specified by r, as per all the mol numbers in s. double getReacVelocity( unsigned int r, const double* s, unsigned int volIndex ) const; Returns the stoich matrix. Used by gsolve.
References N_.
Referenced by Gsolve::fillMathDep(), Gsolve::rebuildGssaSystem(), and VoxelPools::updateRates().
const Cinfo * Stoich::initCinfo | ( | ) | [static] |
References buildXreacs(), filterXreacs(), getColIndex(), getCompartment(), getDsolve(), getKsolve(), getMatrixEntry(), getNumAllPools(), getNumProxyPools(), getNumRates(), getNumVarPools(), getPath(), getPoolIdMap(), getProxyPools(), getRowStart(), getStatus(), Neutral::initCinfo(), scaleBufsAndRates(), setCompartment(), setDsolve(), setKsolve(), setPath(), and unZombifyModel().
unsigned int Stoich::innerInstallReaction | ( | Id | reacId, | |
const vector< Id > & | subs, | |||
const vector< Id > & | prds | |||
) |
This installs a FuncTerm, which evaluates a function to specify the conc of the specific pool. The pool is a BufPool.
References convertIdToFuncIndex(), convertIdToPoolIndex(), Id::element(), Cinfo::find(), Cinfo::findFinfo(), funcs_, Element::getNeighbors(), FuncTerm::setExpr(), FuncTerm::setReactantIndex(), FuncTerm::setTarget(), Element::setTick(), and Id::value().
This installs a FuncRate, which evaluates a function to specify the rate of change of conc of the specific pool. The pool is a Pool.
References convertIdToPoolIndex(), convertIdToReacIndex(), Id::element(), Cinfo::find(), Cinfo::findFinfo(), SparseMatrix< T >::get(), Element::getNeighbors(), N_, rates_, SparseMatrix< T >::set(), Element::setTick(), and Id::value().
This installs a FuncReac, which evaluates a function to specify the rate (Kf) of the specified reaction.
References convertIdToPoolIndex(), convertIdToReacIndex(), Id::element(), Cinfo::find(), Cinfo::findFinfo(), Element::getNeighbors(), rates_, FuncRate::setExpr(), FuncRate::setFuncArgIndex(), Element::setTick(), and Id::value().
This is used when the enzyme lacks sub or prd.
References convertIdToReacIndex(), rates_, status_, and useOneWay_.
void Stoich::installEnzyme | ( | ZeroOrder * | r1, | |
ZeroOrder * | r2, | |||
ZeroOrder * | r3, | |||
Id | enzId, | |||
Id | enzMolId, | |||
const vector< Id > & | prds | |||
) |
This takes the forward, backward and product formation half-reacs belonging to the specified Enzyme, and builds them into the Stoich. This is the low-level function.
void Stoich::installEnzyme | ( | Id | enzId, | |
Id | enzMolId, | |||
Id | cplxId, | |||
const vector< Id > & | subs, | |||
const vector< Id > & | prds | |||
) |
Referenced by ZombieEnz::setSolver().
void Stoich::installMMenz | ( | MMEnzymeBase * | meb, | |
unsigned int | rateIndex, | |||
const vector< Id > & | subs, | |||
const vector< Id > & | prds | |||
) |
This is the inner function to do the installation.
Referenced by ZombieReac::setSolver().
Scans through elist to find any reactions that connect to pools not located on solver. Removes these reactions from the elist and maintains Ids of the affected reactions, and their off-solver pools, in offSolverReacs_ and offSolverPools_.
Utility function to make a half reac and return the rate term.
Looks up the vector of pool Ids originating from the specified compartment, that are represented on this compartment as proxies.
References offSolverPoolMap_.
void Stoich::print | ( | ) | const |
Utility function, prints out N_, used for debugging.
References N_, and SparseMatrix< T >::print().
void Stoich::printRates | ( | ) | const |
Another utility function, prints out all Kf, kf, Kb, kb.
References reacMap_.
const RateTerm * Stoich::rates | ( | unsigned int | i | ) | const |
void Stoich::resizeArrays | ( | ) |
Using the computed array sizes, now allocate space for them.
References dinterface_, funcs_, idMap_, kinterface_, N_, numBufPools_, numFunctions_, numReac_, numVarPools_, offSolverPools_, rates_, ZombiePoolInterface::setNumPools(), SparseMatrix< T >::setSize(), and species_.
void Stoich::scaleBufsAndRates | ( | unsigned int | index, | |
double | volScale | |||
) |
Used to handle run-time size updates for spines.
References kinterface_, ZombiePoolInterface::pools(), and VoxelPoolsBase::scaleVolsBufsRates().
Referenced by initCinfo().
void Stoich::setCompartment | ( | Id | v | ) |
assigns compartment occupied by Stoich.
References Element::cinfo(), compartment_, doubleEq(), Id::element(), Cinfo::isA(), and numVoxels_.
Referenced by initCinfo().
void Stoich::setDsolve | ( | Id | v | ) |
assigns diffusion solver: Dsovle or a Gillespie voxel stepper
References Element::cinfo(), Eref::data(), dinterface_, dsolve_, Id::element(), Id::eref(), and Cinfo::isA().
Referenced by initCinfo().
Internal function which sets up the model based on the provided elist of all elements managed by this solver.
void Stoich::setEnzK1 | ( | const Eref & | e, | |
double | v | |||
) | const |
Later handle all the volumes when this conversion is done.
Sets the rate v (given in millimoloar concentration units) for the forward enzyme reaction of binding substrate to enzyme. Does this throughout the compartment in which the enzyme lives. Internally the stoich uses #/voxel units so this involves querying the volume subsystem about volumes for each voxel, and scaling accordingly.
References convertIdToReacIndex(), Cinfo::find(), Cinfo::findFinfo(), Eref::id(), kinterface_, rates_, and ZombiePoolInterface::updateRateTerms().
Referenced by updateRatesAfterRemesh(), ZombieEnz::vSetConcK1(), ZombieEnz::vSetK1(), ZombieEnz::vSetKm(), and ZombieEnz::vSetNumKm().
void Stoich::setEnzK2 | ( | const Eref & | e, | |
double | v | |||
) | const |
Set rate k2 (1/sec) for enzyme.
References convertIdToReacIndex(), Eref::id(), kinterface_, rates_, ZombiePoolInterface::updateRateTerms(), and useOneWay_.
Referenced by updateRatesAfterRemesh(), ZombieEnz::vSetK2(), and ZombieEnz::vSetRatio().
void Stoich::setEnzK3 | ( | const Eref & | e, | |
double | v | |||
) | const |
Set rate k3 (1/sec) for enzyme.
References convertIdToReacIndex(), Eref::id(), kinterface_, rates_, ZombiePoolInterface::updateRateTerms(), and useOneWay_.
Referenced by updateRatesAfterRemesh(), and ZombieEnz::vSetKcat().
void Stoich::setFunctionExpr | ( | const Eref & | e, | |
string | expr | |||
) |
void Stoich::setKsolve | ( | Id | v | ) |
assigns kinetic solver: Ksovle or GSSAsolve.
References Element::cinfo(), Eref::data(), Id::element(), Id::eref(), Cinfo::isA(), kinterface_, ksolve_, and setOneWay().
Referenced by initCinfo().
void Stoich::setMMenzKcat | ( | const Eref & | e, | |
double | v | |||
) | const |
Sets the kcat for MMenz. No conversions needed.
References convertIdToReacIndex(), Eref::id(), kinterface_, rates_, and ZombiePoolInterface::updateRateTerms().
Referenced by updateRatesAfterRemesh(), and ZombieMMenz::vSetKcat().
void Stoich::setMMenzKm | ( | const Eref & | e, | |
double | v | |||
) | const |
Sets the Km for MMenz, using appropriate volume conversion to go from the argument (in millimolar) to #/voxel. This may do the assignment among many voxels containing the enz in case there are different volumes.
References convertIdToReacIndex(), Eref::id(), kinterface_, rates_, and ZombiePoolInterface::updateRateTerms().
Referenced by updateRatesAfterRemesh(), ZombieMMenz::vSetKm(), and ZombieMMenz::vSetNumKm().
void Stoich::setOneWay | ( | bool | v | ) |
References useOneWay_.
Referenced by setKsolve().
void Stoich::setPath | ( | const Eref & | e, | |
string | path | |||
) |
Take the provided wildcard path to build the list of elements managed by this solver.
Referenced by initCinfo().
void Stoich::setReacKb | ( | const Eref & | e, | |
double | v | |||
) | const |
Sets the reverse rate v (given in millimoloar concentration units) for the specified reaction throughout the compartment in which the reaction lives. Internally the stoich uses #/voxel units so this involves querying the volume subsystem about volumes for each voxel, and scaling accordingly.
For now assume a single rate term.
References convertIdToReacIndex(), Cinfo::find(), Cinfo::findFinfo(), Eref::id(), kinterface_, rates_, ZombiePoolInterface::updateRateTerms(), and useOneWay_.
Referenced by updateRatesAfterRemesh(), ZombieReac::vSetConcKb(), and ZombieReac::vSetNumKb().
void Stoich::setReacKf | ( | const Eref & | e, | |
double | v | |||
) | const |
Sets the forward rate v (given in millimoloar concentration units) for the specified reaction throughout the compartment in which the reaction lives. Internally the stoich uses #/voxel units so this involves querying the volume subsystem about volumes for each voxel, and scaling accordingly.
Sets the forward rate v (given in millimoloar concentration units) for the specified reaction throughout the compartment in which the reaction lives. Internally the stoich uses #/voxel units so this involves querying the volume subsystem about volumes for each voxel, and scaling accordingly. For now assume a uniform voxel volume and hence just convert on 0 meshIndex.
References convertIdToReacIndex(), Cinfo::find(), Cinfo::findFinfo(), Eref::id(), kinterface_, rates_, and ZombiePoolInterface::updateRateTerms().
Referenced by updateRatesAfterRemesh(), ZombieReac::vSetConcKf(), and ZombieReac::vSetNumKf().
void Stoich::setSpecies | ( | unsigned int | poolIndex, | |
unsigned int | s | |||
) |
Assigns SpeciesId of specified pool
References species_.
void Stoich::setupCrossSolverReacVols | ( | ) | const |
Used to set up and update all cross solver reac terms and their rates, if there has been a change in volumes. Should also work if there has been a change in voxelization.
References kinterface_, prdComptVec_, ZombiePoolInterface::setupCrossSolverReacVols(), and subComptVec_.
Referenced by VoxelPools::setVolumeAndDependencies(), and GssaVoxelPools::setVolumeAndDependencies().
void Stoich::unZombifyModel | ( | ) |
Converts back to ExpEuler type basic kinetic Elements.
References Element::cinfo(), Eref::element(), enzMap_, Cinfo::find(), funcMap_, Element::getTick(), idMap_, Clock::lookupDefaultTick(), mmEnzMap_, Cinfo::name(), numBufPools_, numVarPools_, offSolverPools_, reacMap_, Element::setTick(), unZombifyPools(), CplxEnzBase::zombify(), EnzBase::zombify(), and ReacBase::zombify().
Referenced by initCinfo(), and ~Stoich().
void Stoich::unZombifyPools | ( | ) |
unZombifies Pools. Helper for unZombifyModel.
References Element::cinfo(), Cinfo::find(), idMap_, Element::isDoomed(), numBufPools_, numVarPools_, offSolverPools_, and PoolBase::zombify().
Referenced by unZombifyModel().
void Stoich::updateFuncs | ( | double * | s, | |
double | t | |||
) | const |
Updates the function values, within s.
References funcs_.
Referenced by GssaVoxelPools::advance(), VoxelPools::gslFunc(), and GssaVoxelPools::reinit().
void Stoich::updateRatesAfterRemesh | ( | ) |
This function scans all reacs and enzymes and recalculates the internal rate terms depending on the reference terms stored in the original chemical object.
updateJunctionRates: Updates the rates for cross-compartment reactions. These are located at the end of the rates_ vector, and are directly indexed by the reacTerms. void Stoich::updateJunctionRates( const double* s, const vector< unsigned int >& reacTerms, double* yprime ) { for ( vector< unsigned int >::const_iterator i = reacTerms.begin(); i != reacTerms.end(); ++i ) { assert( *i < rates_[0].size() ); yprime++ += (*rates_[0][*i])( s ); } }
References offSolverReacs_, reacMap_, setEnzK1(), setEnzK2(), setEnzK3(), setMMenzKcat(), setMMenzKm(), setReacKb(), and setReacKf().
void Stoich::updateReacVelocities | ( | const double * | s, | |
vector< double > & | vel, | |||
unsigned int | volIndex | |||
) | const |
Updates the yprime array, rate of change of each molecule The volIndex specifies which set of rates to use, since the rates are volume dependent. Moved to VoxelPools void updateRates( const double* s, double* yprime, unsigned int volIndex ) const; Computes the velocity of each reaction, vel. The volIndex specifies which set of rates to use, since the rates are volume dependent.
void Stoich::zombifyChemCompt | ( | Id | compt | ) |
Id Stoich::compartment_ [protected] |
Contains Id of compartment holding reac system. Optional.
Referenced by getCompartment(), and setCompartment().
ZombiePoolInterface* Stoich::dinterface_ [protected] |
Pointer for dsolve.
Referenced by resizeArrays(), and setDsolve().
Id Stoich::dsolve_ [protected] |
This contains the Id of the Diffusion solver. Optional.
Referenced by getDsolve(), and setDsolve().
vector< Id > Stoich::enzMap_ [protected] |
Map back from enz index to Id. Needed to unzombify
Referenced by unZombifyModel().
vector< Id > Stoich::funcMap_ [protected] |
Vector of all funcs. Needed to unzombify
Referenced by convertIdToFuncIndex(), and unZombifyModel().
vector< FuncTerm* > Stoich::funcs_ [protected] |
The FuncTerms handle mathematical ops on mol levels.
Referenced by funcs(), getNumFuncs(), installAndUnschedFunc(), resizeArrays(), updateFuncs(), and ~Stoich().
vector< Id > Stoich::idMap_ [protected] |
Map back from mol index to Id. Primarily for debugging.
Referenced by convertIdToPoolIndex(), resizeArrays(), unZombifyModel(), and unZombifyPools().
ZombiePoolInterface* Stoich::kinterface_ [protected] |
Pointer for ksolve.
Referenced by buildXreacs(), filterXreacs(), resizeArrays(), scaleBufsAndRates(), setEnzK1(), setEnzK2(), setEnzK3(), setKsolve(), setMMenzKcat(), setMMenzKm(), setReacKb(), setReacKf(), and setupCrossSolverReacVols().
Id Stoich::ksolve_ [protected] |
This contains the Id of the Kinetic solver.
Referenced by getKsolve(), and setKsolve().
vector< Id > Stoich::mmEnzMap_ [protected] |
Map back from enz index to Id. Needed to unzombify
Referenced by unZombifyModel().
KinSparseMatrix Stoich::N_ [protected] |
N_ is the stoichiometry matrix.
Referenced by getColIndex(), getMatrixEntry(), getRowStart(), getStoichiometryMatrix(), installAndUnschedFuncRate(), print(), and resizeArrays().
unsigned int Stoich::numBufPools_ [protected] |
Number of variable molecules that the solver deals with, including the proxy molecules which belong in other compartments.
unsigned int totVarPools_; Number of buffered molecules
Referenced by getNumAllPools(), getNumBufPools(), resizeArrays(), unZombifyModel(), and unZombifyPools().
unsigned int Stoich::numFunctions_ [protected] |
Number functions, currently only the ones controlling molecule numbers, like sumtotals.
Referenced by resizeArrays().
unsigned int Stoich::numReac_ [protected] |
Number of reactions in the solver model. This includes conversion reactions A + B <---> C enzyme reactions E + S <---> E.S ---> E + P and MM enzyme reactions rate = E.S.kcat / ( Km + S ) The enzyme reactions count as two reaction steps.
Referenced by resizeArrays().
unsigned int Stoich::numVarPools_ [protected] |
Number of variable molecules that the solver deals with, that are local to the solver.
Referenced by getNumAllPools(), getNumVarPools(), resizeArrays(), unZombifyModel(), and unZombifyPools().
unsigned int Stoich::numVoxels_ [protected] |
Number of voxels in reac system.
This tracks the unique volumes handled by the reac system. Maps one-to-one with the vector of vector of RateTerms. vector< double > uniqueVols_;
Referenced by setCompartment().
vector< unsigned int > Stoich::objMap_ [protected] |
Maps Ids to objects in the S_, RateTerm, and FuncTerm vectors. There will be holes in this map, but look up is very fast. The calling Id must know what it wants to find: all it gets back is an integer. The alternative is to have multiple maps, but that is slower. Assume no arrays. Each Pool/reac etc must be a unique Element. Later we'll deal with diffusion.
Referenced by convertIdToFuncIndex(), convertIdToPoolIndex(), convertIdToReacIndex(), and getPoolIdMap().
unsigned int Stoich::objMapStart_ [protected] |
Minor efficiency: We will usually have a set of objects that are nearly contiguous in the map. May as well start with the first of them.
Referenced by convertIdToFuncIndex(), convertIdToPoolIndex(), convertIdToReacIndex(), and getPoolIdMap().
map< Id, vector< Id > > Stoich::offSolverPoolMap_ [protected] |
Map of vectors of Ids of offSolver pools. Each map entry contains the vector of Ids of proxy pools coming from the specified compartment. In use, the junction will copy the pool indices over for data transfer.
Referenced by buildXreacs(), getOffSolverCompts(), getProxyPools(), and offSolverPoolMap().
vector< Id > Stoich::offSolverPools_ [protected] |
These are pools that were not in the original scope of the solver, but have to be brought in because they are reactants of one or more of the offSolverReacs.
Referenced by getNumProxyPools(), getOffSolverPools(), resizeArrays(), unZombifyModel(), and unZombifyPools().
vector< pair< Id, Id > > Stoich::offSolverReacCompts_ [protected] |
Which compartment(s) does the off solver reac connect to? Usually it is just one, in which case the second id is Id()
Referenced by filterXreacs().
vector< Id > Stoich::offSolverReacs_ [protected] |
Tracks the reactions that go off the current solver.
Referenced by filterXreacs(), getNumCoreRates(), and updateRatesAfterRemesh().
string Stoich::path_ [protected] |
Referenced by getPath().
const unsigned int Stoich::PoolIsNotOnSolver [static] |
Returns the index of the matching volume, which is also the index into the RateTerm vector. unsigned int indexOfMatchingVolume( double vol ) const;
vector< vector< Id > > Stoich::prdComptVec_ [protected] |
prdComptVec_[rateTermIndex][product#]: Identifies compts for each product for each cross-compartment RateTerm in the rates_vector.
Referenced by setupCrossSolverReacVols().
vector< RateTerm* > Stoich::rates_ [protected] |
The RateTerms handle the update operations for reaction rate v_. This is the master vector of RateTerms, and it is scaled to a volume such that the 'n' units and the conc units are identical. Duplicates of this vector are made in each voxel with a different volume. The duplicates have rates scaled as per volume. The RateTerms vector also includes reactions that have off-compartment products. These need special volume scaling involving all the interactiong compartments.
Referenced by convertIdToReacIndex(), convertRatesToStochasticForm(), getNumCoreRates(), getNumRates(), getR1(), getR1offset1(), getR1offset2(), getR2(), getRateTerms(), installAndUnschedFuncRate(), installAndUnschedFuncReac(), installDummyEnzyme(), rates(), resizeArrays(), setEnzK1(), setEnzK2(), setEnzK3(), setMMenzKcat(), setMMenzKm(), setReacKb(), setReacKf(), and ~Stoich().
vector< Id > Stoich::reacMap_ [protected] |
Map back from reac index to Id. Needed to unzombify
Referenced by printRates(), unZombifyModel(), and updateRatesAfterRemesh().
vector< unsigned int > Stoich::species_ [protected] |
Lookup from each molecule to its Species identifer This will eventually be tied into an ontology reference.
Referenced by getSpecies(), resizeArrays(), and setSpecies().
int Stoich::status_ [protected] |
Flag to track status of Stoich object. -1: No path yet assigned. 0: Success 1: Warning: Missing reactant in Reac or Enz 2: Warning: Missing substrate in MMenz 4: Warning: Compartment not defined 8: Warning: Neither Ksolve nore Dsolve defined
Referenced by getStatus(), and installDummyEnzyme().
vector< vector< Id > > Stoich::subComptVec_ [protected] |
subComptVec_[rateTermIndex][substrate#]: Identifies compts for each substrate for each cross-compartment RateTerm in the rates_vector.
Referenced by setupCrossSolverReacVols().
bool Stoich::useOneWay_ [protected] |
True if the stoich matrix is set up to handle only one-way reactions, as is needed in the case of the Gillespie algorithm.
Referenced by getEnzK2(), getEnzK3(), getOneWay(), installDummyEnzyme(), setEnzK2(), setEnzK3(), setOneWay(), and setReacKb().