59 fObservedReactionRate(0.),
60 fEffectiveReactionRadius(0.),
80 if (reactant1 == reactant2)
184 double inv_temp = 1. / temp_K;
187 P[0] + P[1] * inv_temp + P[2] * pow(inv_temp, 2)
188 + P[3] * pow(inv_temp, 3) + P[4] * pow(inv_temp, 4))
194 return P[0]*exp(P[1]/temp_K)*
200 double rateCste_init)
204 return Df*rateCste_init/D0;
237 if (fInstance)
delete fInstance;
268 for(it2 = it1->second.begin(); it2 != it1->second.end(); it2++)
273 G4MolecularConfiguration* reactant1 =
275 G4MolecularConfiguration* reactant2 =
302 if (reactant1 != reactant2)
319 reactionRate, reactant1, reactant2);
337 ReactivesMV::iterator itReactives;
339 map<G4MolecularConfiguration*, map<G4MolecularConfiguration*, G4bool> > alreadyPrint;
341 G4cout <<
"Number of chemical species involved in reactions = " 355 const vector<G4MolecularConfiguration*>* reactivesVector =
CanReactWith(moleculeA);
361 for (
G4int iReact = 0; iReact < nbReactants; iReact++)
371 if (!alreadyPrint[moleculeA][moleculeB])
373 outputReaction[
n] = moleculeA->
GetName() +
" + " + moleculeB->GetName();
381 for (
G4int j = 1; j < nbProducts; j++)
388 outputReaction[
n] +=
" -> No product";
399 if (pReactionModel) interactionRange =
402 if (interactionRange != -1)
412 alreadyPrint[moleculeB][moleculeA] =
TRUE;
424 G4int maxlengthOutputReaction = -1;
425 G4int maxlengthOutputReactionRate = -1;
427 for (
G4int i = 0; i <
n; i++)
429 if (maxlengthOutputReaction < (
G4int) outputReaction[i].length())
431 maxlengthOutputReaction = outputReaction[i].length();
433 if (maxlengthOutputReactionRate < (
G4int) outputReactionRate[i].length())
435 maxlengthOutputReactionRate = outputReactionRate[i].length();
439 maxlengthOutputReaction += 2;
440 maxlengthOutputReactionRate += 2;
442 if (maxlengthOutputReaction < 10) maxlengthOutputReaction = 10;
443 if (maxlengthOutputReactionRate < 30) maxlengthOutputReactionRate = 30;
447 if (pReactionModel) title =
new G4String[3];
450 title[0] =
"Reaction";
451 title[1] =
"Reaction Rate [dm3/(mol*s)]";
453 if (pReactionModel) title[2] =
454 "Interaction Range for chosen reaction model [nm]";
456 G4cout << setfill(
' ') << setw(maxlengthOutputReaction) <<
left << title[0]
457 << setw(maxlengthOutputReactionRate) <<
left << title[1];
459 if (pReactionModel)
G4cout << setw(2) <<
left << title[2];
464 if (pReactionModel)
G4cout.width(
465 maxlengthOutputReaction + 2 + maxlengthOutputReactionRate + 2
466 + (
G4int) title[2].length());
467 else G4cout.width(maxlengthOutputReaction + 2 + maxlengthOutputReactionRate);
471 for (
G4int i = 0; i <
n; i++)
473 G4cout << setw(maxlengthOutputReaction) <<
left << outputReaction[i]
474 << setw(maxlengthOutputReactionRate) <<
left 475 << outputReactionRate[i];
477 if (pReactionModel)
G4cout << setw(2) <<
left << outputRange[i];
482 if (pReactionModel)
G4cout.width(
483 maxlengthOutputReaction + 2 + maxlengthOutputReactionRate + 2
484 + (
G4int) title[2].length());
486 maxlengthOutputReaction + 2 + maxlengthOutputReactionRate);
492 delete[] outputReaction;
493 delete[] outputReactionRate;
494 delete[] outputRange;
506 G4String errMsg =
"No reaction table was implemented";
507 G4Exception(
"G4MolecularInteractionTable::GetReactionData",
"",
512 ReactionDataMap::const_iterator it1 =
fReactionData.find(reactant1);
517 "No reaction table was implemented for this molecule Definition : " + reactant1
521 G4Exception(
"G4MolecularInteractionTable::GetReactionData",
"",
528 it1->second.find(reactant2);
530 if (it2 == it1->second.end())
533 G4String errMsg =
"No reaction table was implemented for this molecule : " 534 + reactant2 -> GetName();
538 return (it2->second);
543 const std::vector<G4MolecularConfiguration*>*
548 G4String errMsg =
"No reaction table was implemented";
549 G4Exception(
"G4MolecularInteractionTable::CanReactWith",
"",
554 ReactivesMV::const_iterator itReactivesMap =
fReactantsMV.find(aMolecule);
561 G4String errMsg =
"No reaction table was implemented for this molecule : " 564 G4cout <<
"--- G4MolecularInteractionTable::GetReactionData ---" <<
G4endl;
574 G4cout<<
" G4MolecularInteractionTable::CanReactWith :"<<
G4endl;
576 G4cout<<
" the number of reactants is : " << itReactivesMap->second.size()<<
G4endl;
578 std::vector<G4MolecularConfiguration*>::const_iterator itProductsVector =
579 itReactivesMap->second.begin();
581 for(; itProductsVector != itReactivesMap->second.end(); itProductsVector++)
586 return &(itReactivesMap->second);
593 const std::map<G4MolecularConfiguration*, const G4DNAMolecularReactionData*>*
598 G4String errMsg =
"No reaction table was implemented";
599 G4Exception(
"G4MolecularInteractionTable::CanInteractWith",
"",
604 ReactionDataMap::const_iterator itReactivesMap =
fReactionData.find(molecule);
618 G4cout<<
" G4MolecularInteractionTable::CanReactWith :"<<
G4endl;
620 G4cout<<
" the number of reactants is : " << itReactivesMap->second.size()<<
G4endl;
624 itReactivesMap->second.begin();
626 for(; itProductsVector != itReactivesMap->second.end(); itProductsVector++)
631 return &(itReactivesMap->second);
639 const std::vector<const G4DNAMolecularReactionData*>*
644 G4String errMsg =
"No reaction table was implemented";
645 G4Exception(
"G4MolecularInteractionTable::CanInteractWith",
"",
654 G4String errMsg =
"No reaction table was implemented for this molecule Definition : " 655 + molecule -> GetName();
660 return &(it->second);
683 fRateParam = std::bind(PolynomialParam, std::placeholders::_1, P);
691 std::vector<double>
P = {A0, E_R};
696 fRateParam = std::bind(ArrehniusParam, std::placeholders::_1, P);
704 fRateParam = std::bind(ScaledParameterization,
705 std::placeholders::_1,
716 for(
size_t i = 0 ; i < end ; ++i)
719 ScaleForNewTemperature(temp_K);
729 SetObservedReactionRateConstant(fRateParam(temp_K));
static void DeleteInstance()
virtual ~G4DNAMolecularReactionTable()
static G4DNAMolecularReactionTable * Instance()
const G4String & GetName() const
static double PolynomialParam(double temp_K, std::vector< double > P)
static const double nanometer
void ScaleReactionRateForNewTemperature(double temp_K)
G4ReactionTableMessenger * fpMessenger
G4MolecularConfiguration * GetProduct(G4int i) const
void ScaleForNewTemperature(double temp_K)
static G4String ConvertToString(G4bool boolVal)
ReactionDataMV fReactionDataMV
G4MolecularConfiguration * GetReactant2() const
void SetReactant1(G4MolecularConfiguration *reactive)
~G4DNAMolecularReactionData()
static G4DNAMolecularReactionTable * GetReactionTable()
void SetReaction(G4double observedReactionRate, G4MolecularConfiguration *reactive1, G4MolecularConfiguration *reactive2)
G4GLOB_DLL std::ostream G4cout
void SetReactionTable(const G4DNAMolecularReactionTable *)
virtual G4double GetReactionRadius(G4MolecularConfiguration *, G4MolecularConfiguration *)=0
static double DiffCoeffWater(double temperature_K)
static G4MoleculeTable * Instance()
void SetArrehniusParameterization(double A0, double E_R)
void PrintTable(G4VDNAReactionModel *=0)
G4MolecularConfiguration * fReactant1
G4double GetObservedReactionRateConstant() const
void AddProduct(G4MolecularConfiguration *molecule)
G4MolecularConfiguration * GetReactant1() const
static double ArrehniusParam(double temp_K, std::vector< double > P)
static G4DNAMolecularReactionTable * fInstance
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static double ScaledParameterization(double temp_K, double temp_init, double rateCste_init)
G4DNAMolecularReactionData()
G4int GetNbProducts() const
const G4DNAMolecularReactionData * GetReactionData(G4MolecularConfiguration *, G4MolecularConfiguration *) const
void SetReactants(G4MolecularConfiguration *reactive1, G4MolecularConfiguration *reactive2)
std::vector< G4MolecularConfiguration * > * fProducts
void SetReactant2(G4MolecularConfiguration *reactive)
G4double GetDiffusionCoefficient() const
G4DNAMolecularReactionTable()
static G4MoleculeTable * GetMoleculeTable()
void SetPolynomialParameterization(const std::vector< double > &P)
void SetScaledParameterization(double temperature_K, double rateCste)
G4MolecularConfiguration * fReactant2
const std::map< G4MolecularConfiguration *, const G4DNAMolecularReactionData * > * GetReativesNData(G4MolecularConfiguration *) const
G4double fObservedReactionRate
const G4DNAMolecularReactionTable * GetReactionTable()
ReactionDataMap fReactionData
std::vector< const G4DNAMolecularReactionData * > fVectorOfReactionData
const G4DNAMolecularReactionData * GetReaction(int reactionID) const
virtual void InitialiseToPrint(G4MolecularConfiguration *)=0
const std::vector< G4MolecularConfiguration * > * CanReactWith(G4MolecularConfiguration *) const
G4double fEffectiveReactionRadius
G4MolecularConfiguration * GetConfiguration(const G4String &, bool mustExist=true)