74 : fpReactant1(pReactant1)
75 , fpReactant2(pReactant2)
76 , fObservedReactionRate(reactionRate)
81 , fEffectiveReactionRadius(0.)
120 sumDiffCoeff =
fpReactant1->GetDiffusionCoefficient();
125 sumDiffCoeff =
fpReactant1->GetDiffusionCoefficient()
282 sumDiffCoeff =
fpReactant1->GetDiffusionCoefficient() +
327 double inv_temp = 1. / temp_K;
330 P[0] + P[1] * inv_temp + P[2] * pow(inv_temp, 2)
331 + P[3] * pow(inv_temp, 3) + P[4] * pow(inv_temp, 4))
332 * (1e-3 * CLHEP::m3 / (CLHEP::mole * CLHEP::s));
337 return P[0] *
G4Exp(P[1] / temp_K)*
338 (1e-3 * CLHEP::m3 / (CLHEP::mole * CLHEP::s));
343 double rateCste_init)
347 return Df * rateCste_init / D0;
404 if (pReactant1 != pReactant2)
433 if ((pReactionModel !=
nullptr) && ((pReactionModel->
GetReactionTable()) ==
nullptr))
438 ReactivesMV::iterator itReactives;
440 std::map<Reactant*, std::map<Reactant*, G4bool>> alreadyPrint;
442 G4cout <<
"Number of chemical species involved in reactions = "
447 auto outputReaction =
new G4String[nbPrintable];
448 auto outputReactionRate =
new G4String[nbPrintable];
449 auto outputRange =
new G4String[nbPrintable];
455 auto moleculeA = (
Reactant*)itReactives->first;
456 const vector<Reactant*>* reactivesVector =
CanReactWith(moleculeA);
462 for (
G4int iReact = 0; iReact < nbReactants; iReact++)
464 auto moleculeB = (
Reactant*)(*reactivesVector)[iReact];
470 if (!alreadyPrint[moleculeA][moleculeB])
472 outputReaction[n] = moleculeA->GetName() +
" + " + moleculeB->GetName();
480 for (
G4int j = 1; j < nbProducts; j++)
487 outputReaction[n] +=
" -> No product";
498 if (pReactionModel !=
nullptr) interactionRange =
501 if (interactionRange != -1)
504 interactionRange / nanometer);
511 alreadyPrint[moleculeB][moleculeA] =
TRUE;
523 G4int maxlengthOutputReaction = -1;
524 G4int maxlengthOutputReactionRate = -1;
526 for (
G4int i = 0; i < n; ++i)
528 if (maxlengthOutputReaction < (
G4int)outputReaction[i].length())
530 maxlengthOutputReaction = (
G4int)outputReaction[i].length();
532 if (maxlengthOutputReactionRate < (
G4int)outputReactionRate[i].length())
534 maxlengthOutputReactionRate = (
G4int)outputReactionRate[i].length();
538 maxlengthOutputReaction += 2;
539 maxlengthOutputReactionRate += 2;
541 if (maxlengthOutputReaction < 10) maxlengthOutputReaction = 10;
542 if (maxlengthOutputReactionRate < 30) maxlengthOutputReactionRate = 30;
546 if (pReactionModel !=
nullptr) title =
new G4String[3];
549 title[0] =
"Reaction";
550 title[1] =
"Reaction Rate [dm3/(mol*s)]";
552 if (pReactionModel !=
nullptr) title[2] =
553 "Interaction Range for chosen reaction model [nm]";
555 G4cout << setfill(
' ') << setw(maxlengthOutputReaction) << left << title[0]
556 << setw(maxlengthOutputReactionRate) << left << title[1];
558 if (pReactionModel !=
nullptr)
G4cout << setw(2) << left << title[2];
563 if (pReactionModel !=
nullptr)
G4cout.width(
564 maxlengthOutputReaction + 2 + maxlengthOutputReactionRate + 2
565 + (
G4int)title[2].length());
566 else G4cout.width(maxlengthOutputReaction + 2 + maxlengthOutputReactionRate);
570 for (
G4int i = 0; i < n; i++)
572 G4cout << setw(maxlengthOutputReaction) << left << outputReaction[i]
573 << setw(maxlengthOutputReactionRate) << left
574 << outputReactionRate[i];
576 if (pReactionModel !=
nullptr)
G4cout << setw(2) << left << outputRange[i];
581 if (pReactionModel !=
nullptr)
G4cout.width(
582 maxlengthOutputReaction + 2 + maxlengthOutputReactionRate + 2
583 + (
G4int)title[2].length());
585 maxlengthOutputReaction + 2 + maxlengthOutputReactionRate);
591 delete[] outputReaction;
592 delete[] outputReactionRate;
593 delete[] outputRange;
610 G4String errMsg =
"No reaction table was implemented";
611 G4Exception(
"G4MolecularInteractionTable::GetReactionData",
"",
621 errMsg <<
"No reaction table was implemented for this molecule Definition : "
629 auto it2 = it1->second.find(pReactant2);
631 if (it2 == it1->second.end())
638 return (it2->second);
652 dataList.emplace_back(pData.get());
665 G4String errMsg =
"No reaction table was implemented";
666 G4Exception(
"G4MolecularInteractionTable::CanReactWith",
"",
678 G4String errMsg =
"No reaction table was implemented for this molecule : "
681 G4cout <<
"--- G4MolecularInteractionTable::GetReactionData ---" <<
G4endl;
690 G4cout <<
" G4MolecularInteractionTable::CanReactWith :" <<
G4endl;
692 G4cout <<
" the number of reactants is : " << itReactivesMap->second.size() <<
G4endl;
694 auto itProductsVector = itReactivesMap->second.cbegin();
696 for (; itProductsVector != itReactivesMap->second.end(); itProductsVector++)
701 return &(itReactivesMap->second);
711 G4String errMsg =
"No reaction table was implemented";
712 G4Exception(
"G4MolecularInteractionTable::CanInteractWith",
"",
725 G4cout <<
" G4MolecularInteractionTable::CanReactWith :" <<
G4endl;
727 G4cout <<
" the number of reactants is : " << itReactivesMap->second.size() <<
G4endl;
729 auto itProductsVector = itReactivesMap->second.begin();
731 for (; itProductsVector != itReactivesMap->second.end(); itProductsVector++)
736 return &(itReactivesMap->second);
746 G4String errMsg =
"No reaction table was implemented";
747 G4Exception(
"G4MolecularInteractionTable::CanInteractWith",
"",
756 errMsg <<
"No reaction table was implemented for this molecule Definition : "
764 return &(it->second);
790 std::vector<double> P = { A0, E_R };
800 std::placeholders::_1,
832 if (pData->GetReactionID() == reactionID)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4GLOB_DLL std::ostream G4cout
G4double fEffectiveReactionRadius
Reactant * GetProduct(G4int i) const
void SetProbability(G4double prob)
G4double GetActivationRateConstant() const
G4double GetProbability() const
void SetReactionType(G4int type)
void SetReactionRadius(G4double radius)
G4int GetReactionType() const
Reactant * GetReactant1() const
G4double GetDiffusionRateConstant() const
void SetPolynomialParameterization(const std::vector< double > &P)
void ComputeEffectiveRadius()
void SetReactionID(int ID)
std::pair< Reactant *, Reactant * > ReactantPair
void ScaleForNewTemperature(double temp_K)
static double ArrehniusParam(double temp_K, std::vector< double > P)
void SetEffectiveReactionRadius(G4double radius)
G4double GetEffectiveReactionRadius() const
G4double GetOnsagerRadius() const
int GetReactionID() const
void SetArrehniusParameterization(double A0, double E_R)
std::vector< Reactant * > ReactionProducts
void SetReactants(Reactant *reactive1, Reactant *reactive2)
ReactantPair GetReactants()
const ReactionProducts * GetProducts() const
const G4MolecularConfiguration Reactant
Reactant * GetReactant2() const
void SetReactant2(Reactant *reactive)
void SetObservedReactionRateConstant(G4double rate)
G4double fObservedReactionRate
static double PolynomialParam(double temp_K, std::vector< double > P)
void AddProduct(Reactant *molecule)
void SetScaledParameterization(double temperature_K, double rateCste)
static double ScaledParameterization(double temp_K, double temp_init, double rateCste_init)
G4double GetObservedReactionRateConstant() const
G4double GetReactionRadius() const
G4DNAMolecularReactionData()
void SetReactant1(Reactant *reactive)
~G4DNAMolecularReactionData()
G4int GetNbProducts() const
ReactionProducts fProducts
std::map< Reactant *, Data * > SpecificDataList
static G4DNAMolecularReactionTable * GetReactionTable()
std::vector< Reactant * > ReactantList
DataList GetVectorOfReactionData()
Data * GetReactionData(Reactant *, Reactant *) const
static G4DNAMolecularReactionTable * Instance()
const G4MolecularConfiguration Reactant
const ReactantList * CanReactWith(Reactant *) const
std::map< Reactant *, SpecificDataList > ReactionDataMap
Data * GetReaction(int reactionID) const
const SpecificDataList * GetReativesNData(const G4MolecularConfiguration *) const
G4VDNAMolecularGeometry * GetGeometry() const
static void DeleteInstance()
std::unique_ptr< G4ReactionTableMessenger > fpMessenger
~G4DNAMolecularReactionTable() override
size_t GetNReactions() const
std::vector< std::unique_ptr< Data > > fVectorOfReactionData
const ReactionDataMap & GetAllReactionData()
static G4DNAMolecularReactionTable * fpInstance
void SetReaction(G4double observedReactionRate, Reactant *reactive1, Reactant *reactive2)
ReactionDataMap fReactionData
void PrintTable(G4VDNAReactionModel *=nullptr)
const G4DNAMolecularReactionData Data
void ScaleReactionRateForNewTemperature(double temp_K)
G4DNAMolecularReactionTable()
ReactionDataMV fReactionDataMV
std::vector< Data * > DataList
G4VDNAMolecularGeometry * fGeometry
const G4String & GetName() const
static double DiffCoeffWater(double temperature_K)
static G4MoleculeTable * GetMoleculeTable()
G4MolecularConfiguration * GetConfiguration(const G4String &, bool mustExist=true)
static G4MoleculeTable * Instance()
static G4String ConvertToString(G4bool boolVal)
virtual void InitialiseToPrint(const G4MolecularConfiguration *)=0
const G4DNAMolecularReactionTable * GetReactionTable()
void SetReactionTable(const G4DNAMolecularReactionTable *)
virtual G4double GetReactionRadius(const G4MolecularConfiguration *, const G4MolecularConfiguration *)=0