File indexing completed on 2025-01-18 09:58:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 #pragma once
0047
0048 #include "G4ITReactionTable.hh"
0049 #include "G4MolecularConfiguration.hh"
0050 #include "G4ReferenceCast.hh"
0051 #include "G4VDNAMolecularGeometry.hh"
0052 #include <vector>
0053 #include <map>
0054 #include <functional>
0055 #include <memory>
0056
0057 class G4VDNAReactionModel;
0058 class G4DNAMolecularReactionTable;
0059 class G4ReactionTableMessenger;
0060
0061
0062
0063
0064
0065 class G4DNAMolecularReactionData
0066 {
0067 public:
0068
0069
0070 G4DNAMolecularReactionData(G4double reactionRate,
0071 const G4MolecularConfiguration* reactive1,
0072 const G4MolecularConfiguration* reactive2);
0073
0074 G4DNAMolecularReactionData(G4double reactionRate,
0075 const G4String& reactive1,
0076 const G4String& reactive2);
0077 ~G4DNAMolecularReactionData();
0078
0079 using Reactant = const G4MolecularConfiguration;
0080 using ReactantPair = std::pair<Reactant*, Reactant*>;
0081 using ReactionProducts = std::vector<Reactant*>;
0082
0083 int GetReactionID() const;
0084 void SetReactionID(int ID);
0085
0086 ReactantPair GetReactants();
0087
0088 Reactant* GetReactant1() const;
0089 Reactant* GetReactant2() const;
0090
0091 void SetObservedReactionRateConstant(G4double rate);
0092 G4double GetObservedReactionRateConstant() const;
0093 G4double GetActivationRateConstant() const;
0094 G4double GetDiffusionRateConstant() const;
0095
0096 void SetReactionRadius(G4double radius);
0097 G4double GetReactionRadius() const;
0098
0099 void SetEffectiveReactionRadius(G4double radius);
0100 G4double GetEffectiveReactionRadius() const;
0101 G4double GetOnsagerRadius() const;
0102
0103 void SetProbability(G4double prob);
0104 G4double GetProbability() const;
0105
0106 void SetReactionType(G4int type);
0107 G4int GetReactionType() const;
0108
0109 void SetReactant1(Reactant* reactive);
0110 void SetReactant2(Reactant* reactive);
0111
0112 void SetReactants(Reactant* reactive1,
0113 Reactant* reactive2);
0114
0115 void AddProduct(Reactant* molecule);
0116
0117 void SetReactant1(const G4String& reactive);
0118 void SetReactant2(const G4String& reactive);
0119 void SetReactants(const G4String& reactive1, const G4String& reactive2);
0120 void AddProduct(const G4String& molecule);
0121
0122 G4int GetNbProducts() const;
0123 Reactant* GetProduct(G4int i) const;
0124
0125 const ReactionProducts* GetProducts() const;
0126 void RemoveProducts();
0127
0128
0129
0130 using RateParam = std::function<double (double)>;
0131
0132 static double PolynomialParam(double temp_K, std::vector<double> P);
0133 static double ArrehniusParam(double temp_K, std::vector<double> P);
0134 static double ScaledParameterization(double temp_K,
0135 double temp_init,
0136 double rateCste_init);
0137
0138 void SetPolynomialParameterization(const std::vector<double>& P);
0139
0140 void SetArrehniusParameterization(double A0, double E_R);
0141 void SetScaledParameterization(double temperature_K,
0142 double rateCste);
0143
0144 void ScaleForNewTemperature(double temp_K);
0145
0146 void ComputeEffectiveRadius();
0147
0148 protected:
0149 G4DNAMolecularReactionData();
0150 Reactant* fpReactant1;
0151 Reactant* fpReactant2;
0152
0153 G4double fObservedReactionRate;
0154 G4double fActivationRate;
0155 G4double fDiffusionRate;
0156
0157 G4double fOnsagerRadius;
0158
0159 G4double fReactionRadius;
0160 G4double fEffectiveReactionRadius;
0161
0162 G4double fProbability;
0163 G4int fType;
0164
0165 ReactionProducts fProducts;
0166 RateParam fRateParam;
0167 int fReactionID;
0168 };
0169
0170
0171
0172
0173
0174 class G4DNAMolecularReactionTable : public G4ITReactionTable
0175 {
0176 protected:
0177 G4DNAMolecularReactionTable();
0178 static G4DNAMolecularReactionTable* fpInstance;
0179
0180 public:
0181 static G4DNAMolecularReactionTable* GetReactionTable();
0182 static G4DNAMolecularReactionTable* Instance();
0183 static void DeleteInstance();
0184 ~G4DNAMolecularReactionTable() override;
0185
0186 using Reactant = const G4MolecularConfiguration;
0187 using Data = const G4DNAMolecularReactionData;
0188 using ReactantList = std::vector<Reactant*>;
0189 using DataList = std::vector<Data*>;
0190 using SpecificDataList = std::map<Reactant*, Data*>;
0191
0192 using ReactionDataMap = std::map<Reactant*, SpecificDataList>;
0193 using ReactivesMV = std::map<Reactant*, ReactantList>;
0194 using ReactionDataMV = std::map<Reactant*, DataList>;
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205 void SetReaction(G4double observedReactionRate,
0206 Reactant* reactive1,
0207 Reactant* reactive2);
0208
0209 void SetReaction(G4DNAMolecularReactionData*);
0210
0211 void SetGeometry(G4VDNAMolecularGeometry* geometry){fGeometry = geometry;};
0212 G4VDNAMolecularGeometry* GetGeometry() const;
0213
0214 Data* GetReactionData(Reactant*, Reactant*) const;
0215
0216 Data* GetReactionData(const G4String&, const G4String&) const;
0217
0218 Data* GetReaction(int reactionID) const;
0219
0220 size_t GetNReactions() const;
0221
0222
0223
0224
0225
0226 const ReactantList* CanReactWith(Reactant*) const;
0227
0228 const SpecificDataList* GetReativesNData(const G4MolecularConfiguration*) const;
0229
0230 const DataList* GetReactionData(const G4MolecularConfiguration*) const;
0231
0232 const ReactionDataMap& GetAllReactionData();
0233
0234 DataList GetVectorOfReactionData();
0235
0236 void ScaleReactionRateForNewTemperature(double temp_K);
0237
0238
0239 void PrintTable(G4VDNAReactionModel* = nullptr);
0240
0241 void Reset();
0242
0243 protected:
0244 G4bool fVerbose{false};
0245
0246 G4VDNAMolecularGeometry* fGeometry{nullptr};
0247 ReactionDataMap fReactionData;
0248 ReactivesMV fReactantsMV;
0249 ReactionDataMV fReactionDataMV;
0250 std::vector<std::unique_ptr<Data>> fVectorOfReactionData;
0251 std::unique_ptr<G4ReactionTableMessenger> fpMessenger;
0252 };