Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 // Author: Mathieu Karamitros 28 29 // The code is developed in the framework of the ESA AO7146 30 // 31 // We would be very happy hearing from you, send us your feedback! :) 32 // 33 // In order for Geant4-DNA to be maintained and still open-source, 34 // article citations are crucial. 35 // If you use Geant4-DNA chemistry and you publish papers about your software, 36 // in addition to the general paper on Geant4-DNA: 37 // 38 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178 39 // 40 // we would be very happy if you could please also cite the following 41 // reference papers on chemistry: 42 // 43 // J. Comput. Phys. 274 (2014) 841-882 44 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508 45 46 #pragma once 47 48 #include "G4ITReactionTable.hh" 49 #include "G4MolecularConfiguration.hh" 50 #include "G4ReferenceCast.hh" 51 #include "G4VDNAMolecularGeometry.hh" 52 #include <vector> 53 #include <map> 54 #include <functional> 55 #include <memory> 56 57 class G4VDNAReactionModel; 58 class G4DNAMolecularReactionTable; 59 class G4ReactionTableMessenger; 60 61 /** 62 * G4DNAMolecularReactionData contains the information 63 * relative to a given reaction (eg : °OH + °OH -> H2O2) 64 */ 65 class G4DNAMolecularReactionData 66 { 67 public: 68 //---------------------------------------------------------------------------- 69 70 G4DNAMolecularReactionData(G4double reactionRate, 71 const G4MolecularConfiguration* reactive1, 72 const G4MolecularConfiguration* reactive2); 73 74 G4DNAMolecularReactionData(G4double reactionRate, 75 const G4String& reactive1, 76 const G4String& reactive2); 77 ~G4DNAMolecularReactionData(); 78 79 using Reactant = const G4MolecularConfiguration; 80 using ReactantPair = std::pair<Reactant*, Reactant*>; 81 using ReactionProducts = std::vector<Reactant*>; 82 83 int GetReactionID() const; 84 void SetReactionID(int ID); 85 86 ReactantPair GetReactants(); 87 88 Reactant* GetReactant1() const; 89 Reactant* GetReactant2() const; 90 91 void SetObservedReactionRateConstant(G4double rate); 92 G4double GetObservedReactionRateConstant() const; 93 G4double GetActivationRateConstant() const; 94 G4double GetDiffusionRateConstant() const; 95 96 void SetReactionRadius(G4double radius); 97 G4double GetReactionRadius() const; 98 99 void SetEffectiveReactionRadius(G4double radius); 100 G4double GetEffectiveReactionRadius() const; 101 G4double GetOnsagerRadius() const; 102 103 void SetProbability(G4double prob); 104 G4double GetProbability() const; 105 106 void SetReactionType(G4int type); 107 G4int GetReactionType() const; 108 109 void SetReactant1(Reactant* reactive); 110 void SetReactant2(Reactant* reactive); 111 112 void SetReactants(Reactant* reactive1, 113 Reactant* reactive2); 114 115 void AddProduct(Reactant* molecule); 116 117 void SetReactant1(const G4String& reactive); 118 void SetReactant2(const G4String& reactive); 119 void SetReactants(const G4String& reactive1, const G4String& reactive2); 120 void AddProduct(const G4String& molecule); 121 122 G4int GetNbProducts() const; 123 Reactant* GetProduct(G4int i) const; 124 125 const ReactionProducts* GetProducts() const; 126 void RemoveProducts(); 127 128 //---------------------------------------------------------------------------- 129 // Temperature scaling 130 using RateParam = std::function<double (double)>; 131 132 static double PolynomialParam(double temp_K, std::vector<double> P); 133 static double ArrehniusParam(double temp_K, std::vector<double> P); 134 static double ScaledParameterization(double temp_K, 135 double temp_init, 136 double rateCste_init); 137 138 void SetPolynomialParameterization(const std::vector<double>& P); 139 140 void SetArrehniusParameterization(double A0, double E_R); 141 void SetScaledParameterization(double temperature_K, 142 double rateCste); 143 144 void ScaleForNewTemperature(double temp_K); 145 146 void ComputeEffectiveRadius(); 147 148 protected: 149 G4DNAMolecularReactionData(); 150 Reactant* fpReactant1; 151 Reactant* fpReactant2; 152 153 G4double fObservedReactionRate; 154 G4double fActivationRate; 155 G4double fDiffusionRate; 156 157 G4double fOnsagerRadius; 158 159 G4double fReactionRadius; 160 G4double fEffectiveReactionRadius; 161 162 G4double fProbability; 163 G4int fType; 164 165 ReactionProducts fProducts; 166 RateParam fRateParam; 167 int fReactionID; 168 }; 169 170 /** 171 * G4DNAMolecularReactionTable sorts out the G4DNAMolecularReactionData 172 * for bimolecular reaction 173 */ 174 class G4DNAMolecularReactionTable : public G4ITReactionTable 175 { 176 protected: 177 G4DNAMolecularReactionTable(); 178 static G4DNAMolecularReactionTable* fpInstance; 179 180 public: 181 static G4DNAMolecularReactionTable* GetReactionTable(); 182 static G4DNAMolecularReactionTable* Instance(); 183 static void DeleteInstance(); 184 ~G4DNAMolecularReactionTable() override; 185 186 using Reactant = const G4MolecularConfiguration; 187 using Data = const G4DNAMolecularReactionData; 188 using ReactantList = std::vector<Reactant*>; 189 using DataList = std::vector<Data*>; 190 using SpecificDataList = std::map<Reactant*, Data*>; 191 192 using ReactionDataMap = std::map<Reactant*, SpecificDataList>; 193 using ReactivesMV = std::map<Reactant*, ReactantList>; 194 using ReactionDataMV = std::map<Reactant*, DataList>; 195 196 /** 197 * Define a reaction : 198 * First argument : reaction rate 199 * Second argument : reactant 1 200 * Third argument : reactant 2 201 * Fourth argument : a std::vector holding the molecular products 202 * if this last argument is NULL then it will be interpreted as 203 * a reaction giving no products 204 */ 205 void SetReaction(G4double observedReactionRate, 206 Reactant* reactive1, 207 Reactant* reactive2); 208 209 void SetReaction(G4DNAMolecularReactionData*); 210 211 void SetGeometry(G4VDNAMolecularGeometry* geometry){fGeometry = geometry;}; 212 G4VDNAMolecularGeometry* GetGeometry() const; 213 214 Data* GetReactionData(Reactant*, Reactant*) const; 215 216 Data* GetReactionData(const G4String&, const G4String&) const; 217 218 Data* GetReaction(int reactionID) const; 219 220 size_t GetNReactions() const; 221 222 //_________________________________________________________________ 223 /** 224 * Given a molecule's type, it returns with which a reaction is allowed 225 */ 226 const ReactantList* CanReactWith(Reactant*) const; 227 228 const SpecificDataList* GetReativesNData(const G4MolecularConfiguration*) const; 229 230 const DataList* GetReactionData(const G4MolecularConfiguration*) const; 231 232 const ReactionDataMap& GetAllReactionData(); 233 234 DataList GetVectorOfReactionData(); 235 236 void ScaleReactionRateForNewTemperature(double temp_K); 237 238 //_________________________________________________________________ 239 void PrintTable(G4VDNAReactionModel* = nullptr); 240 241 void Reset(); 242 243 protected: 244 G4bool fVerbose{false}; 245 246 G4VDNAMolecularGeometry* fGeometry{nullptr}; 247 ReactionDataMap fReactionData; 248 ReactivesMV fReactantsMV; 249 ReactionDataMV fReactionDataMV; 250 std::vector<std::unique_ptr<Data>> fVectorOfReactionData; 251 std::unique_ptr<G4ReactionTableMessenger> fpMessenger; 252 }; 253