void fire() { if( theLastTime < 0.0 ) { return; } Real aCurrentTime( getStepper()->getCurrentTime() ); Real aNextTime( theLastTime + Interval ); if( aNextTime >= Duration ) { theLastTime = -1; P0.setValue( 1e-20 * getSuperSystem()->getSizeN_A() ); return; } Real aTimeDifference( aCurrentTime - theLastTime ); Real aDecay( aTimeDifference * DecayFactor / Interval ); P0.setValue( Impulse * getSuperSystem()->getSizeN_A() / ( aDecay + 1 ) ); if( aTimeDifference >= Interval ) { theLastTime += Interval; } }
Variable* createVariable(String anID) { String anEntityType("Variable"); SystemPath aSystemPath(getSuperSystem()->getSystemPath()); aSystemPath.push_back(getSuperSystem()->getID()); FullID aFullID(anEntityType, aSystemPath, anID); Variable* aVariable(reinterpret_cast<Variable*>( getModel()->createEntity("Variable", aFullID))); aVariable->setValue(0); return aVariable; }
virtual void fire() { Real _SizeN_A = getSuperSystem()->getSizeN_A(); Real VGPA_maxr = VGPA_maxf->getValue() * KGPA_GLYb * KGPA_iG1P / KGPA_iGLYf / KGPA_Pi / KGPA_eq; Real GPA_a= VGPA_maxf->getValue() * (GLY->getMolarConc()*1000.0 * Pi->getMolarConc()*1000.0 / KGPA_iGLYf / KGPA_Pi ) - VGPA_maxr * (GLY->getMolarConc()*1000.0 * G1P->getMolarConc()*1000.0 / KGPA_GLYb / KGPA_iG1P); Real GPA_b= 1.0 + GLY->getMolarConc()*1000.0 / KGPA_iGLYf + Pi->getMolarConc()*1000.0 / KGPA_iPi + GLY->getMolarConc()*1000.0 / KGPA_iGLYb + G1P->getMolarConc()*1000.0 / KGPA_iG1P + GLY->getMolarConc()*1000.0 * Pi->getMolarConc()*1000.0 / (KGPA_GLYf * KGPA_iPi) + GLY->getMolarConc()*1000.0 * G1P->getMolarConc()*1000.0 /(KGPA_GLYb * KGPA_iG1P) ; Real V_GPA = GPA_a / GPA_b; Real VGPB_maxr = VGPB_maxf->getValue() * KGPB_iGLYb * KGPB_G1P / KGPB_iGLYf / KGPB_Pi / KGPB_eq; Real GPB_a = (pow(AMP->getMolarConc()*1000.0, nH_GPB)/ KGPB_AMP) * (VGPB_maxf->getValue() * (GLY->getMolarConc()*1000.0 * Pi->getMolarConc()*1000.0 /(KGPB_iGLYf * KGPB_Pi)) - VGPB_maxr * (GLY->getMolarConc()*1000.0 * G1P->getMolarConc()*1000.0/(KGPB_iGLYb * KGPB_G1P))); Real GPB_b = (1.0 + pow(AMP->getMolarConc()*1000.0, nH_GPB)/ KGPB_AMP) * ( 1.0 + GLY->getMolarConc()*1000.0 / KGPB_iGLYf + Pi->getMolarConc()*1000.0 / KGPB_iPi + GLY->getMolarConc()*1000.0 / KGPB_iGLYb + G1P->getMolarConc()*1000.0 / KGPB_iG1P + GLY->getMolarConc()*1000.0 * Pi->getMolarConc()*1000.0 / (KGPB_iGLYf * KGPB_Pi) + GLY->getMolarConc()*1000.0 * G1P->getMolarConc()*1000.0 /(KGPB_iGLYb * KGPB_G1P) ); Real V_GPB = GPB_a / GPB_b; setFlux( GX->getValue() * _SizeN_A * ( V_GPA * frac_a->getValue() + V_GPB * frac_b->getValue()) / 60000.0 / 1000.0); // setFlux( V_GPA * frac_a->getValue() + V_GPB * frac_b->getValue()); // setFlux(GPB_a / GPB_b ); // setFlux(GPA_a / GPA_b ); //V_GPA.setValue(GPA_a / GPA_b / unit); // ducky // T->setValue( Tt->getValue() - TCa->getValue() - TCaCB->getValue() - TCB->getValue() ); }
virtual void fire() { Real hkrd = ( 1 + ( S1.getMolarConc() / KiMgATP ) + ( (S0.getMolarConc() * 7 / 3) / KiGlc ) + ( ( S1.getMolarConc() * (S0.getMolarConc() * 7 / 3) ) / ( KiGlc * KmMgATP ) ) + ( P1.getMolarConc() / KiMgADP ) + ( P0.getMolarConc() / KiGlc6P ) + ( ( P1.getMolarConc() * P0.getMolarConc() ) / ( KiGlc6P * KmMgADP ) ) + ( ( E1.getMolarConc() * (S0.getMolarConc() * 7 / 3) ) / ( KdiB23PG * KiGlc ) ) + ( ( E2.getMolarConc() * (S0.getMolarConc() * 7 / 3) ) / ( KdiGlc16P2 * KiGlc ) ) + ( ( P0.getMolarConc() * (S0.getMolarConc() * 7 / 3) ) / ( KdiGlc6P * KiGlc ) ) + ( ( E3.getMolarConc() * (S0.getMolarConc() * 7 / 3) ) / ( KdiGSH * KiGlc ) ) ); // fix me: * voli? Real GG = E3.getMolarConc()/E4.getMolarConc(); Real velocity = (GG/(K_GSSG + GG)) * ( HK / hkrd * ( ( theKcatf * (S0.getMolarConc() * 7 / 3) * S1.getMolarConc() ) / ( KiGlc * KmMgATP ) - ( theKcatr * P0.getMolarConc() * P1.getMolarConc() ) / ( KiGlc6P * KmMgADP ) ) ); //velocity = velocity * getSuperSystem()->getSize() * N_A * ( 20.0 / 7.0 ); velocity = velocity * getSuperSystem()->getSize() * N_A; setFlux( velocity ); }
unsigned int MicrotubuleProcess::getLatticeResizeCoord(unsigned int aStartCoord) { theComp = theSpatiocyteStepper->system2Comp(getSuperSystem()); theVacantSpecies->resetFixedAdjoins(); theVacantSpecies->setMoleculeRadius(DimerPitch*VoxelDiameter/2); theMinusSpecies->resetFixedAdjoins(); theMinusSpecies->setMoleculeRadius(DimerPitch*VoxelDiameter/2); thePlusSpecies->resetFixedAdjoins(); thePlusSpecies->setMoleculeRadius(DimerPitch*VoxelDiameter/2); tempID = theSpecies.size(); C = theComp->centerPoint; C.x += OriginX*theComp->lengthX/2; C.y += OriginY*theComp->lengthY/2; C.z += OriginZ*theComp->lengthZ/2; for(unsigned int i(0); i != theKinesinSpecies.size(); ++i) { theKinesinSpecies[i]->setIsOffLattice(); theKinesinSpecies[i]->setDimension(1); theKinesinSpecies[i]->setVacantSpecies(theVacantSpecies); theKinesinSpecies[i]->setMoleculeRadius(DimerPitch*VoxelDiameter/2); } offLatticeRadius = DimerPitch/2; latticeRadius = 0.5; theDimerSize = (unsigned int)rint(Length/DimerPitch); startCoord = aStartCoord; endCoord = startCoord+Protofilaments*theDimerSize; return endCoord-startCoord; }
virtual void fire() { Real _SizeN_A = getSuperSystem()->getSizeN_A(); Real delta1 = (1.0 + F6P->getMolarConc()*1000.0 / KPFK_F6P) * (1.0 + ATP->getMolarConc()*1000.0 / KPFK_ATP)+ ADP->getMolarConc()*1000.0 / KPFK_ADP + FBP->getMolarConc()*1000.0 / KPFK_FBP * (1.0 + ADP->getMolarConc()*1000.0 / KPFK_ADP); Real delta2 = (1.0 + F6P->getMolarConc()*1000.0 / KPFK_F6P2) * (1.0 + ATP->getMolarConc()*1000.0 / KPFK_ATP2)+ ADP->getMolarConc()*1000.0 / KPFK_ADP2 + FBP->getMolarConc()*1000.0 / KPFK_FBP2 * (1.0 + ADP->getMolarConc()*1000.0 / KPFK_ADP2); Real alpha = KPFK_F6P * KPFK_ATP / KPFK_F6P2 / KPFK_ATP2; Real L = Lo_PFK * pow(((1.0+ATP->getMolarConc()*1000.0/KPFK_iATP) / (1.0 + d_PFK * ATP->getMolarConc()*1000.0/KPFK_iATP)) * ((1.0 + e_PFK * AMP->getMolarConc()*1000.0/KPFK_aAMP) / (1.0 + AMP->getMolarConc()*1000.0/KPFK_aAMP)), 4); Real VPFK_maxr = VPFK_maxf->getValue() * KPFK_ADP * KPFK_FBP / KPFK_ATP / KPFK_F6P / KPFK_eq; Real PFK_a = (1.0 + alpha * L * pow(delta2/delta1, 3))*(VPFK_maxf->getValue() * ATP->getMolarConc()*1000.0 * F6P->getMolarConc()*1000.0 /(KPFK_ATP * KPFK_F6P) - VPFK_maxr * ADP->getMolarConc()*1000.0 * FBP->getMolarConc()*1000.0 /(KPFK_ADP * KPFK_FBP)); Real PFK_b = delta1 * (1.0 + L * pow(delta2/delta1, 4)); setFlux( GX->getValue() * _SizeN_A * PFK_a / PFK_b / 60000.0 /1000.0); // setFlux(PFK_a / PFK_b ); //V_PFK.setValue(PFK_a / PFK_b / unit); // ducky // T->setValue( Tt->getValue() - TCa->getValue() - TCaCB->getValue() - TCB->getValue() ); }
System* System::getSystem( String const& anID ) const { if ( anID[0] == '.' ) { const String::size_type anIDSize( anID.size() ); if ( anIDSize == 1 ) // == "." { return const_cast<System*>( this ); } else if ( anID[1] == '.' && anIDSize == 2 ) // == ".." { if ( isRootSystem() ) { THROW_EXCEPTION_INSIDE( NotFound, asString() + ": the root system has no super " "systems" ); } return getSuperSystem(); } } SystemMap::const_iterator i( theSystemMap.find( anID ) ); if ( i == theSystemMap.end() ) { THROW_EXCEPTION_INSIDE( NotFound, asString() + ": System [" + anID + "] not found in this System" ); } return i->second; }
virtual void initialize() { Process::initialize(); declareUnidirectional(); theSpatiocyteStepper = dynamic_cast<SpatiocyteStepper*>(getSuperSystem()->getStepper()); }
virtual void fire() { Real L = ( pow( pow( 10, -1 * E0.getValue() ) / Ka, n ) * pow( 1 + E1.getMolarConc() / KTATP, 4 ) * pow( 1 + E2.getMolarConc() / KTMg, 4 ) * pow( 1 + E3.getMolarConc() / KTB23PG, 4 ) ) / ( pow( 1 + ( S0.getMolarConc() / KmFru6P ) + ( P0.getMolarConc() / KmFru16P2 ), 4 ) * pow( 1 + E4.getMolarConc() / KRAMP, 4 ) * pow( 1 + E5.getMolarConc() / KRPhos, 4 ) * pow( 1 + E6.getMolarConc() / KRGlc16P2, 4 ) ); Real pfkrd = 1 + ( S0.getMolarConc() / KmFru6P ) + ( S1.getMolarConc() / KmMgATP ) + ( ( S0.getMolarConc() * S1.getMolarConc() ) / ( KmFru6P * KmMgATP ) ) + ( P0.getMolarConc() / KmFru16P2 ) + ( P1.getMolarConc() / KmMgADP ) + ( ( P0.getMolarConc() * P1.getMolarConc() ) / ( KmFru16P2 * KmMgADP ) ); Real velocity = ( C0.getMolarConc() / ( ( 1 + L ) * pfkrd ) ) * ( ( kcatf * S0.getMolarConc() * S1.getMolarConc() ) / ( KmFru6P * KmMgATP ) - //note: use book model. ( kcatf * P0.getMolarConc() * P1.getMolarConc() ) / ( KmFru16P2 * KmMgADP ) ); velocity = velocity * getSuperSystem()->getSize() * N_A * E7.getValue()/1000; Real GG = E8.getMolarConc()/E9.getMolarConc(); velocity *= GG/(K_GSSG + GG); setFlux( velocity ); }
virtual void fire() { Real velocity = k8* S0.getMolarConc() - k9 * P0.getMolarConc(); velocity = velocity * getSuperSystem()->getSize() * N_A; setFlux( velocity ); }
virtual void fire() { Real velocity = theK1 * S0.getMolarConc() * S1.getMolarConc() - k2 * P0.getMolarConc(); velocity = velocity * getSuperSystem()->getSize() * N_A; velocity = velocity * E1.getValue() / 1000; setFlux( velocity ); }
virtual void fire() { Real velocity = Kma * S0.getMolarConc() - Kmd * P0.getMolarConc(); velocity = velocity * getSuperSystem()->getSize() * N_A; velocity = velocity * E0.getValue() / 1000; setFlux( velocity ); }
virtual void fire() { Real velocity = k * S0.getMolarConc(); velocity = velocity * getSuperSystem()->getSize() * N_A; if(velocity < 0) { velocity = 0; } setFlux( velocity ); }
virtual void fire() { Real pgmrd = 1 + ( S0.getMolarConc() / KmP3GA ) + ( P0.getMolarConc() / KmP2GA ); Real velocity = ( PGM / pgmrd ) * ( ( ( kcatf * S0.getMolarConc() ) / KmP3GA ) - ( ( kcatr * P0.getMolarConc() ) / KmP2GA ) ); velocity = velocity * getSuperSystem()->getSize() * N_A; setFlux( velocity ); }
virtual void fire() { Real _SizeN_A = getSuperSystem()->getSizeN_A(); Real VPGLM_maxr = VPGLM_maxf->getValue() * KPGLM_G6P / KPGLM_G1P / KPGLM_eq; Real PGLM_a = VPGLM_maxf->getValue() * G1P->getMolarConc()*1000.0 / KPGLM_G1P - VPGLM_maxr * G6P->getMolarConc()*1000.0 / KPGLM_G6P; Real PGLM_b = 1.0 + G1P->getMolarConc()*1000.0 / KPGLM_G1P + G6P->getMolarConc()*1000.0 / KPGLM_G6P; setFlux( GX->getValue() * _SizeN_A * PGLM_a / PGLM_b / 60000.0 /1000.0); // setFlux(PGLM_a / PGLM_b ); //V_PGLM.setValue(PGLM_a / PGLM_b / unit); // T->setValue( Tt->getValue() - TCa->getValue() - TCaCB->getValue() - TCB->getValue() ); }
virtual void fire() { double currTime(getStepper()->getCurrentTime()); //std::cout << theVariableReferenceVector[0].getVariable()->getID() << std::endl; if(currTime > 1000) { double currValue(theVariableReferenceVector[0].getValue()); double diffValue(currValue-prevValue); if(diffValue*diffValue >= theVariableReferenceVector[0].getCoefficient()* theVariableReferenceVector[0].getCoefficient() && currValue != prevValue) { double interval(currTime-prevTime); totalInterval += interval; ++intervalCnt; std::cout << currTime << " " << getID() << " averageInterval:" << totalInterval/intervalCnt << std::endl; prevTime = currTime; prevValue = currValue; } } else { prevTime = currTime; } Real velocity( k * N_A ); velocity *= getSuperSystem()->getSize(); for( VariableReferenceVector::const_iterator s( theVariableReferenceVector.begin() ); s != theZeroVariableReferenceIterator; ++s ) { VariableReference const& aVariableReference( *s ); Integer aCoefficient( aVariableReference.getCoefficient() ); do { ++aCoefficient; velocity *= aVariableReference.getVariable()->getMolarConc(); } while( aCoefficient != 0 ); } setFlux(velocity); }
SystemPath Entity::getSystemPath() const { System* aSystem( getSuperSystem() ); if ( !aSystem ) { THROW_EXCEPTION( IllegalOperation, "no system is associated" ); } if ( aSystem == this ) { return SystemPath(); } SystemPath aSystemPath( aSystem->getSystemPath() ); aSystemPath.push_back( aSystem->getID() ); return aSystemPath; }
virtual void fire() { Real _SizeN_A = getSuperSystem()->getSizeN_A(); // Real VPGI_maxf = VPGI_maxr * KPGI_G6P * KPGI_eq / KPGI_F6P; Real VPGI_maxf = VPGI_maxr->getValue() * KPGI_G6P * KPGI_eq / KPGI_F6P; // Real PGI_a = VPGI_maxf * G6P->getValue() / KPGI_G6P - VPGI_maxr * F6P->getValue() / KPGI_F6P; Real PGI_a = VPGI_maxf * G6P->getMolarConc()*1000.0 / KPGI_G6P - VPGI_maxr->getValue() * F6P->getMolarConc()*1000.0 / KPGI_F6P; Real PGI_b = 1.0 + G6P->getMolarConc()*1000.0 / KPGI_G6P + F6P->getMolarConc()*1000.0 / KPGI_F6P; setFlux( GX->getValue() * _SizeN_A * PGI_a / PGI_b / 60000.0 / 1000.0); // setFlux(PGI_a / PGI_b ); //V_PGI.setValue(PGI_a / PGI_b / unit); // T->setValue( Tt->getValue() - TCa->getValue() - TCaCB->getValue() - TCB->getValue() ); }
virtual void fire() { Real _SizeN_A = getSuperSystem()->getSizeN_A(); Real VGAPDH_maxr = VGAPDH_maxf->getValue() * KGAPDH_13BPG * KGAPDH_NADH / KGAPDH_GAP / KGAPDH_NAD / KGAPDH_Pi / KGAPDH_eq; Real GAPDH_a = VGAPDH_maxf->getValue() * GAP->getMolarConc()*1000.0 * NAD->getMolarConc()*1000.0 * Pi->getMolarConc()*1000.0 / (KGAPDH_GAP * KGAPDH_NAD * KGAPDH_Pi) - VGAPDH_maxr * BPG13->getMolarConc()*1000.0 * NADH->getMolarConc()*1000.0 / (KGAPDH_13BPG * KGAPDH_NADH); Real GAPDH_b = 1.0 + GAP->getMolarConc()*1000.0 / KGAPDH_GAP + NAD->getMolarConc()*1000.0 / KGAPDH_NAD + Pi->getMolarConc()*1000.0 / KGAPDH_Pi + GAP->getMolarConc()*1000.0 * NAD->getMolarConc()*1000.0 / (KGAPDH_GAP * KGAPDH_NAD) + GAP->getMolarConc()*1000.0 * NAD->getMolarConc()*1000.0 * Pi->getMolarConc()*1000.0 / (KGAPDH_GAP * KGAPDH_NAD * KGAPDH_Pi) + BPG13->getMolarConc()*1000.0 / KGAPDH_13BPG + NADH->getMolarConc()*1000.0 / KGAPDH_NADH + BPG13->getMolarConc()*1000.0 * NADH->getMolarConc()*1000.0/(KGAPDH_13BPG * KGAPDH_NADH); setFlux( GX->getValue() * _SizeN_A * GAPDH_a / GAPDH_b / 60000.0 /1000.0); // setFlux(GAPDH_a / GAPDH_b ); //V_GAPDH.setValue(GAPDH_a / GAPDH_b / unit); // ducky // T->setValue( Tt->getValue() - TCa->getValue() - TCaCB->getValue() - TCB->getValue() ); }
void GillespieProcess::fire() { Real velocity( getk() * N_A ); velocity *= getSuperSystem()->getSize(); for( VariableReferenceVector::const_iterator s( theVariableReferenceVector.begin() ); s != theZeroVariableReferenceIterator; ++s ) { VariableReference aVariableReference( *s ); Integer aCoefficient( aVariableReference.getCoefficient() ); do { ++aCoefficient; velocity *= aVariableReference.getVariable()->getMolarConc(); } while( aCoefficient != 0 ); } setActivity( velocity ); }
virtual void fire() { Real velocity( k * N_A ); velocity *= getSuperSystem()->getSize(); for( VariableReferenceVector::const_iterator s( theVariableReferenceVector.begin() ); s != theZeroVariableReferenceIterator; ++s ) { VariableReference aVariableReference( *s ); Integer aCoefficient( aVariableReference.getCoefficient() ); do { ++aCoefficient; velocity *= aVariableReference.getMolarConc(); } while( aCoefficient != 0 ); } setFlux(velocity); }
virtual void fire() { Real _SizeN_A = getSuperSystem()->getSizeN_A(); Real VCK_maxf = VCK_maxr->getValue() / KCK_iATP / KCK_Cr / KCK_eq * KCK_iADP * KCK_PCr; // Real VCK_maxf = VCK_maxr->getValue() * KCK_iATP * KCK_Cr * KCK_eq / KCK_iADP / KCK_PCr; ducky 140414 Real CK_a = VCK_maxr->getValue() * ATP->getMolarConc()*1000.0 * Cr->getMolarConc()*1000.0 / (KCK_iATP * KCK_Cr) - VCK_maxf * ADP->getMolarConc()*1000.0 * PCr->getMolarConc()*1000.0 / (KCK_iADP * KCK_PCr); Real CK_b = 1.0 + ADP->getMolarConc()*1000.0 / KCK_iADP + PCr->getMolarConc()*1000.0 / KCK_iPCr + ADP->getMolarConc()*1000.0 * PCr->getMolarConc()*1000.0 / (KCK_iADP * KCK_PCr) + ATP->getMolarConc()*1000.0 / KCK_iATP + Cr->getMolarConc()*1000.0 / KCK_Cr + ATP->getMolarConc()*1000.0 * Cr->getMolarConc()*1000.0 / (KCK_iATP * KCK_Cr); setFlux(GX->getValue() * _SizeN_A * CK_a / CK_b / 60000.0 /1000.0); // Real V_CK = 16.05 * PCr->getMolarConc()*1000.0 * ADP->getMolarConc()*1000.0 - 9.67e-6 * ATP->getMolarConc()*1000.0 * Cr->getMolarConc()*1000.0; // setFlux(V_CK * _SizeN_A / 60000.0 / 1000.0); // setFlux(CK_a / CK_b ); //V_CK.setValue(CK_a / CK_b / unit); // ducky // T->setValue( Tt->getValue() - TCa->getValue() - TCaCB->getValue() - TCB->getValue() ); }
virtual void initializeThird() { theComp = theSpatiocyteStepper->system2Comp(getSuperSystem()); theStepInterval = 1; }
/** Check if this is a root System. @return true if this is a Root System, false otherwise. */ bool isRootSystem() const { return ( getSuperSystem() == this ); }
Variable* createVariable(String anID) { return createVariable(anID, getSuperSystem()); }
virtual void fire(){ Real deoxyHbcomp = S0.getVariable()->getMolarConc(); Real oxyHbcomp = P0.getVariable()->getMolarConc(); Real pHi = E0.getVariable()->getValue(); Real T = E1.getVariable()->getValue(); Real PO2 = E2.getVariable()->getValue(); Real PCO2 = E3.getVariable()->getValue(); Real BPG = E4.getVariable()->getMolarConc(); Real H = pow(10, -1*pHi); //H+(M) Real aO2 = (1.37 - 0.0137*(T-37)+ 0.00058*(T-37)*(T-37))*0.000001/Wpl; Real aCO2 = (3.07 - 0.057*(T-37)+ 0.002*(T-37)*(T-37))*0.00001/Wpl; Real O2 = Wrbc * aO2 * PO2;//O2 concentration(M) Real CO2 = Wrbc * aCO2 * PCO2;//CO2 concentration(M) /* Real n1 = -6.775 + 2.0372 * pHi - 0.1235 * pHi * pHi; Real n2 = -0.008765 + 0.00086 * PCO2 + 6.3 * 0.0000001 * PCO2 * PCO2; Real n3 = 0.2583 + 28.6978 * BPG - 917.69 * BPG * BPG; Real n4 = 1.6914 + 0.06186 * T + 0.00048 * T * T; Real K2d = K2/K2dd; Real K3d = K3/K3dd; Real nO2 = pow(O2,n); Real K4dn1 = K4dd * pow((57.5*0.000000001/H),n1); Real K4d = K4dn1 * pow((0.85*0.001/CO2),n2) * pow((4.65*0.001/BPG),n3) * pow((37/T),n4); Real KHbO2 = K4d * (K3d*CO2*(1+K3dd/H)+(1+H/K6dd))/(K2d*CO2*(1+K2dd/H)+(1+H/K5dd)); Real kO2 = KHbO2 * nO2; setKHbO2_c( KHbO2 ); // ducky 090616 */ //Real SHbO2 = kO2 / (1 + kO2); O2 = PO2; // ducky 090715 Real SHbO2_num = O2/k1; SHbO2_num += 3.0*pow(O2,2.0)/(k1*k2); SHbO2_num += 3.0*pow(O2,3.0)/(k1*k2*k3); SHbO2_num += pow(O2,4.0)/(k1*k2*k3*k4); Real SHbO2_deno = 1.0; SHbO2_deno += 4.0*O2/k1; SHbO2_deno += 6.0*pow(O2,2.0)/(k1*k2); SHbO2_deno += 4.0*pow(O2,3.0)/(k1*k2*k3); SHbO2_deno += pow(O2,4.0)/(k1*k2*k3*k4); Real SHbO2 = SHbO2_num / SHbO2_deno; setSHb_O2_c( SHbO2 ); // ducky 090616 // std::cout << "PO2: " << PO2 << std::endl; // std::cout << "SHbO2: " << SHbO2 << std::endl; Real Ka; Real Keq; Keq = SHbO2 / (1 - SHbO2); Ka = Keq * Kd; // std::cout << "Keq: " << Keq << std::endl; // std::cout << "Ka: " << Ka << std::endl; // std::cout << "Kd: " << Kd << std::endl; // Real velocity = deoxyHbcomp * Ka - oxyHbcomp * Kd; // velocity = velocity * getSuperSystem()->getSize() * N_A; Real oxyHb1 = E5.getVariable()->getMolarConc();//oxyHbMgATP Real oxyHb2 = E6.getVariable()->getMolarConc();//oxyHbATP Real oxyHb3 = E7.getVariable()->getMolarConc();//oxyHbADP Real oxyHb4 = E8.getVariable()->getMolarConc();//oxyHb23DPG Real oxyHb5 = E9.getVariable()->getMolarConc();//oxyHb13DPG Real oxyHb6 = E10.getVariable()->getMolarConc();//band3oxyHbMgATP Real oxyHb7 = E11.getVariable()->getMolarConc();//band3oxyHbATP Real oxyHb8 = E12.getVariable()->getMolarConc();//band3oxyHbADP Real oxyHb9 = E13.getVariable()->getMolarConc();//band3oxyHb23DPG Real oxyHb10 = E14.getVariable()->getMolarConc();//band3oxyHb13DPG Real oxyHb11 = E15.getVariable()->getMolarConc();//band3oxyHb Real oxyHb12 = E16.getVariable()->getMolarConc();//oxyHb Real toxyHb = oxyHb1 + oxyHb2 + oxyHb3 + oxyHb4 + oxyHb5 + oxyHb6 + oxyHb7 + oxyHb8 + oxyHb9 + oxyHb10 + oxyHb11 + oxyHb12; Real velocity = (0.007-toxyHb) * Ka - toxyHb * Kd; velocity = velocity * getSuperSystem()->getSize() * N_A; setFlux(velocity); }
void Process::resolveVariableReferences() { if ( !getSuperSystem() ) { THROW_EXCEPTION_INSIDE( IllegalOperation, asString() + ": process is not associated to " "any system" ); } Integer anEllipsisNumber( 0 ); for ( VariableReferenceVector::iterator i( theVariableReferenceVector.begin() ), e( theVariableReferenceVector.end() ); i != e; ++i ) { VariableReference& aVarRef( *i ); if( aVarRef.isDefaultName() ) { aVarRef.setName( VariableReference::ELLIPSIS_PREFIX + ( boost::format( "%03d" ) % anEllipsisNumber ).str() ); anEllipsisNumber++; } if ( !aVarRef.getVariable() ) { // relative search; allow relative systempath FullID const& aFullID( aVarRef.getFullID() ); if ( aFullID.isValid() ) { System* aSystem( 0 ); try { aSystem = getSuperSystem()->getSystem( aFullID.getSystemPath() ); } catch ( BadSystemPath const& ) { } if ( !aSystem ) { THROW_EXCEPTION_INSIDE( IllegalOperation, asString() + ": system path [" + aFullID.getSystemPath().asString() + "] could not be resolved" ); } aVarRef.setVariable( aSystem->getVariable( aFullID.getID() ) ); } else { THROW_EXCEPTION_INSIDE( IllegalOperation, asString() + ": variable reference #" + boost::lexical_cast<std::string>( aVarRef.getSerial() ) + " could not be resolved" ); } } else { aVarRef.setFullID( aVarRef.getVariable()->getFullID() ); } } }
void GillespieProcess::calculateOrder() { theOrder = 0; for( VariableReferenceVector::const_iterator i( theVariableReferenceVector.begin() ); i != theVariableReferenceVector.end() ; ++i ) { libecs::VariableReference const& aVariableReference( *i ); const libecs::Integer aCoefficient( aVariableReference.getCoefficient() ); // here assume aCoefficient != 0 if( aCoefficient == 0 ) { THROW_EXCEPTION_INSIDE( libecs::InitializationFailed, asString() + ": zero stoichiometry is not allowed" ); } if( aCoefficient < 0 ) { // sum the coefficient to get the order of this reaction. theOrder -= aCoefficient; } } // set theGetPropensityMethodPtr and theGetMinValueMethodPtr if( theOrder == 0 ) // no substrate { theGetPropensityMethodPtr = RealMethodProxy::createConst<&GillespieProcess::getZero>(); theGetMinValueMethodPtr = RealMethodProxy::createConst<&GillespieProcess::getZero>(); theGetPDMethodPtr = &GillespieProcess::getPD_Zero; } else if( theOrder == 1 ) // one substrate, first order. { theGetPropensityMethodPtr = RealMethodProxy::createConst<&GillespieProcess::getPropensity_FirstOrder>(); theGetMinValueMethodPtr = RealMethodProxy::createConst<&GillespieProcess::getMinValue_FirstOrder>(); theGetPDMethodPtr = &GillespieProcess::getPD_FirstOrder; } else if( theOrder == 2 ) { if( getZeroVariableReferenceOffset() == 2 ) // 2 substrates, 2nd order { theGetPropensityMethodPtr = RealMethodProxy::createConst< &GillespieProcess::getPropensity_SecondOrder_TwoSubstrates > (); theGetMinValueMethodPtr = RealMethodProxy::createConst< &GillespieProcess::getMinValue_SecondOrder_TwoSubstrates >(); theGetPDMethodPtr = &GillespieProcess::getPD_SecondOrder_TwoSubstrates; } else // one substrate, second order (coeff == -2) { theGetPropensityMethodPtr = RealMethodProxy::createConst< &GillespieProcess::getPropensity_SecondOrder_OneSubstrate>(); theGetMinValueMethodPtr = RealMethodProxy::createConst< &GillespieProcess::getMinValue_SecondOrder_OneSubstrate>(); theGetPDMethodPtr = &GillespieProcess::getPD_SecondOrder_OneSubstrate; } } else { //FIXME: generic functions should come here. theGetPropensityMethodPtr = RealMethodProxy::createConst< &GillespieProcess::getZero>(); theGetPropensityMethodPtr = RealMethodProxy::createConst< &GillespieProcess::getZero>(); theGetPDMethodPtr = &GillespieProcess::getPD_Zero; } // if ( theOrder == 1 ) { c = k; } else if ( theOrder == 2 && getZeroVariableReferenceOffset() == 1 ) { c = k * 2.0 / ( libecs::N_A * getSuperSystem()->getSize() ); } else if ( theOrder == 2 && getZeroVariableReferenceOffset() == 2 ) { c = k / ( libecs::N_A * getSuperSystem()->getSize() ); } else { THROW_EXCEPTION_INSIDE( InitializationFailed, asString() + ": only first or second order " "scheme is allowed" ); } }