Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ReactionTableMessenger Class Reference

#include <G4ReactionTableMessenger.hh>

Inheritance diagram for G4ReactionTableMessenger:
Collaboration diagram for G4ReactionTableMessenger:

Public Member Functions

 G4ReactionTableMessenger (G4DNAMolecularReactionTable *)
 
virtual ~G4ReactionTableMessenger ()
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Protected Attributes

G4DNAMolecularReactionTablefpTable
 
G4UIcmdWithAStringfpAddReaction
 
G4UIcmdWithAStringfpNewDiffContReaction
 
G4UIcmdWithoutParameterfpPrintTable
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 

Detailed Description

Definition at line 42 of file G4ReactionTableMessenger.hh.

Constructor & Destructor Documentation

G4ReactionTableMessenger::G4ReactionTableMessenger ( G4DNAMolecularReactionTable table)

Definition at line 43 of file G4ReactionTableMessenger.cc.

43  :
45 {
46  fpTable = table;
47 
48  fpNewDiffContReaction = new G4UIcmdWithAString("/chem/reaction/new", this);
49  fpAddReaction = new G4UIcmdWithAString("/chem/reaction/add", this);
50 // fpNewPartDiffContReactionByRadius =
51 // new G4UIcmdWithAString("/chem/reaction/newPartDiffByRadius", this);
52 //
53 // fpNewPartDiffContReactionByReactionRate =
54 // new G4UIcmdWithAString("/chem/reaction/newPartDiffByRate", this);
55 
56  fpPrintTable = new G4UIcmdWithoutParameter("/chem/reaction/print", this);
57 }
G4DNAMolecularReactionTable * fpTable
G4UIcmdWithAString * fpAddReaction
G4UIcmdWithoutParameter * fpPrintTable
G4UIcmdWithAString * fpNewDiffContReaction
G4ReactionTableMessenger::~G4ReactionTableMessenger ( )
virtual

Definition at line 61 of file G4ReactionTableMessenger.cc.

62 {
64  if(fpAddReaction) delete fpAddReaction;
65  if(fpPrintTable) delete fpPrintTable;
66 }
G4UIcmdWithAString * fpAddReaction
G4UIcmdWithoutParameter * fpPrintTable
G4UIcmdWithAString * fpNewDiffContReaction

Member Function Documentation

void G4ReactionTableMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 70 of file G4ReactionTableMessenger.cc.

72 {
73 
74  if(command == fpNewDiffContReaction)
75  {
76  std::istringstream iss(newValue);
77 
78  G4String species1;
79  iss >> species1;
80 
81  G4String species2;
82  iss >> species2;
83 
84  double reactionRate;
85  iss >> reactionRate;
86 
87 // G4String reactionRateUnit;
88 // iss >> reactionRateUnit;
89 
90  double dimensionedReactionRate = reactionRate * (1e-3 * m3 / (mole * s));
91 // G4UIcmdWithADoubleAndUnit::ConvertToDimensionedDouble((reactionRate
92 // + G4String(" ") + reactionRateUnit).c_str());
93 
94  G4DNAMolecularReactionData* reactionData =
95  new G4DNAMolecularReactionData(dimensionedReactionRate,
96  species1,
97  species2);
98 
99 // G4String productionRate;
100 // iss >> productionRate;
101 //
102 // if(productionRate != "" && productionRate != "X")
103 // {
104 // double prodRateReal = G4UIcommand::ConvertToDouble(productionRate);
105 //
106 // if(prodRateReal == 0 || isnan(prodRateReal))
107 // {
108 // G4Exception("G4ReactionTableMessenger",
109 // "WRONG_PRODUCTION_RATE",
110 // FatalException, "");
111 // }
112 //
113 // double dimensionedProductionRate = prodRateReal
114 // * (1e-3 * m3 / (mole * s));
115 // reactionData->SetProductionRate(dimensionedProductionRate);
116 // }
117 
118  while(iss.eof() == false)
119  {
120  G4String product;
121  iss >> product;
122 
123  if(product != "")
124  {
125  reactionData->AddProduct(product);
126  }
127  else
128  {
129  break;
130  }
131  };
132 
133  fpTable->SetReaction(reactionData);
134  }
135 // else if(command == fpNewPartDiffContReactionByRadius)
136 // {
137 // std::istringstream iss(newValue);
138 //
139 // G4String species1;
140 // iss >> species1;
141 //
142 // G4String species2;
143 // iss >> species2;
144 //
145 // double reactionRate;
146 // iss >> reactionRate;
147 //
150 //
153 //
154 // double reactionRadius;
155 // iss >> reactionRadius;
156 //
159 //
160 // double dimensionedReactionRate = reactionRate * (1e-3 * m3 / (mole * s));
161 //
165 //
166 // double dimensionedReactionRadius = reactionRadius * nm;
169 //
170 // G4DNAMolecularReactionData* reactionData =
171 // new G4DNAMolecularReactionData(dimensionedReactionRate,
172 // species1,
173 // species2);
174 // reactionData->SetPartiallyDiffusionControlledReaction(dimensionedReactionRate,
175 // dimensionedReactionRadius);
176 //
177 // while(iss.eof() == false)
178 // {
179 // G4String product;
180 // iss >> product;
181 //
182 // if(product != "")
183 // {
184 // reactionData->AddProduct(product);
185 // }
186 // else
187 // {
188 // break;
189 // }
190 // }
191 //
192 // fpTable->SetReaction(reactionData);
193 // }
194 // else if(command == fpNewPartDiffContReactionByReactionRate)
195 // {
196 // std::istringstream iss(newValue);
197 //
198 // G4String species1;
199 // iss >> species1;
200 //
201 // G4String species2;
202 // iss >> species2;
203 //
204 // double reactionRate;
205 // iss >> reactionRate;
206 //
207 // // G4String reactionRateUnit;
208 // // iss >> reactionRateUnit;
209 //
210 // // G4String reactionRateUnit;
211 // // iss >> reactionRateUnit;
212 //
213 // double activationRate;
214 // iss >> activationRate;
215 //
216 // // G4String reactionRadiusUnit;
217 // // iss >> reactionRadiusUnit;
218 //
219 // double dimensionedReactionRate = reactionRate * (1e-3 * m3 / (mole * s));
220 //
221 // double dimensionedActivationRate = activationRate
222 // * (1e-3 * m3 / (mole * s));
223 //
224 // G4DNAMolecularReactionData* reactionData =
225 // new G4DNAMolecularReactionData(dimensionedReactionRate,
226 // species1,
227 // species2);
228 // reactionData->
229 // SetPartiallyDiffusionControlledReactionByActivation(dimensionedReactionRate,
230 // dimensionedActivationRate);
231 //
232 // while(iss.eof() == false)
233 // {
234 // G4String product;
235 // iss >> product;
236 //
237 // if(product != "")
238 // {
239 // reactionData->AddProduct(product);
240 // }
241 // else
242 // {
243 // break;
244 // }
245 // }
246 //
247 // fpTable->SetReaction(reactionData);
248 // }
249  else if(command == fpPrintTable)
250  {
251  fpTable->PrintTable();
252  }
253  else if(command == fpAddReaction)
254  {
255  std::istringstream iss(newValue);
256 
257  //--------------------------------------------------------------------------
258  // Reactants definition
259 
260  G4String species1;
261  iss >> species1;
262 
263  G4String marker;
264  iss >> marker; // peut etre +, ->, |
265 
266  G4String species2;
267 
268  if(marker == "+")
269  {
270  iss >> species2;
271  iss >> marker; // peut etre ->, |
272  }
273 
274  //--------------------------------------------------------------------------
275 
276  G4DNAMolecularReactionData* reactionData =
278  species1,
279  species2);
280  //fpTable->SetReaction(reactionData);
281 
282  //--------------------------------------------------------------------------
283  // Add products
284  if(marker == "->")
285  {
286  iss >> marker; // doit etre = species name
287 
288  while(marker!="|"
289  //&& marker!=""
290  && iss.eof() == false
291  )
292  {
293  G4cout << marker << G4endl;
294  if(marker == "+")
295  {
296  iss >> marker; // doit etre species name
297  continue;
298  }
299  reactionData->AddProduct(marker);
300  iss >> marker; // peut etre species name, +, |
301  };
302  }
303 
304 // G4cout << "out of 1st loop" << G4endl;
305 
306  //--------------------------------------------------------------------------
307  // Add reaction rate method
308  G4String rateconst_method;
309  iss >> rateconst_method;
310  if(rateconst_method == "Fix")
311  {
312  iss >> marker; // must be |
313  double reactionRate;
314  iss >> reactionRate;
315 
316  double dimensionedReactionRate = reactionRate * (1e-3 * m3 / (mole * s));
317  reactionData->SetObservedReactionRateConstant(dimensionedReactionRate);
318 
319 // G4String productionRate;
320 // iss >> productionRate;
321 //
322 // if(productionRate != "" && productionRate != "X")
323 // {
324 // double prodRateReal = G4UIcommand::ConvertToDouble(productionRate);
325 //
326 // if(prodRateReal == 0 || isnan(prodRateReal))
327 // {
328 // G4Exception("G4ReactionTableMessenger",
329 // "WRONG_PRODUCTION_RATE",
330 // FatalException,
331 // "");
332 // }
333 //
334 // double dimensionedProductionRate = prodRateReal
335 // * (1e-3 * m3 / (mole * s));
336 // reactionData->SetProductionRate(dimensionedProductionRate);
337 // }
338  }
339  else if(rateconst_method == "Arr")
340  {
341  iss >> marker; // must be |
342  double A0 = 0;
343  double E_R = 0;
344 
345  iss >> A0;
346  iss >> E_R;
347  reactionData->SetArrehniusParameterization(A0, E_R);
348  }
349  else if(rateconst_method == "Pol")
350  {
351  iss >> marker; // must be |
352  std::vector<double> P = {0, 0, 0, 0, 0};
353 
354  size_t i = 0;
355  while(i < 4) // could be changed to 5 only if marker is used as delimiter
356  {
357  double tmp;
358  iss >> tmp;
359  P[i] = tmp;
360 // G4cout << newValue << G4endl;
361 // G4cout << tmp << G4endl;
362 // G4cout << P[i] << G4endl;
363  ++i;
364  };
365  reactionData->SetPolynomialParameterization(P);
366  }
367  else if(rateconst_method == "Scale")
368  {
369  iss >> marker; // must be |
370  double temp_K;
371  iss >> temp_K;
372  double reactionRateCste;
373  iss >> reactionRateCste;
374  double dimensionedReactionRate = reactionRateCste * (1e-3 * m3 / (mole * s));
375  reactionData->SetObservedReactionRateConstant(dimensionedReactionRate);
376  reactionData->SetScaledParameterization(temp_K, dimensionedReactionRate);
377  }
378 
379 // if(iss.eof() == false)
380 // {
381 // iss >> marker;
382 //
383 // if(marker == "|")
384 // {
385 // G4String productionRate ;
386 // iss >> productionRate;
387 //
389 //
390 // double dimProductionRate = G4UIcommand::ConvertToDouble(productionRate)* (1e-3 * m3 / (mole * s));
391 //
392 // G4cout << " DIM PROD RATE = " << reactionData->GetReactant1()->GetName()
393 // << " + " << reactionData->GetReactant2()->GetName() << " = " << dimProductionRate << G4endl;
394 //
395 // reactionData->SetProductionRate(dimProductionRate);
396 // }
397 // }
398  fpTable->SetReaction(reactionData);
399 // G4cout << "Reaction " << species1 << " + " << species2 << " added" << G4endl;
400  }
401 }
G4DNAMolecularReactionTable * fpTable
static constexpr double m3
Definition: G4SIunits.hh:131
static double P[]
void SetReaction(G4double observedReactionRate, G4MolecularConfiguration *reactive1, G4MolecularConfiguration *reactive2)
const XML_Char * s
Definition: expat.h:262
G4GLOB_DLL std::ostream G4cout
void SetArrehniusParameterization(double A0, double E_R)
void PrintTable(G4VDNAReactionModel *=0)
void AddProduct(G4MolecularConfiguration *molecule)
G4UIcmdWithAString * fpAddReaction
G4UIcmdWithoutParameter * fpPrintTable
void SetObservedReactionRateConstant(G4double rate)
G4UIcmdWithAString * fpNewDiffContReaction
void SetPolynomialParameterization(const std::vector< double > &P)
void SetScaledParameterization(double temperature_K, double rateCste)
#define G4endl
Definition: G4ios.hh:61
static constexpr double mole
Definition: G4SIunits.hh:286

Here is the call graph for this function:

Member Data Documentation

G4UIcmdWithAString* G4ReactionTableMessenger::fpAddReaction
protected

Definition at line 51 of file G4ReactionTableMessenger.hh.

G4UIcmdWithAString* G4ReactionTableMessenger::fpNewDiffContReaction
protected

Definition at line 52 of file G4ReactionTableMessenger.hh.

G4UIcmdWithoutParameter* G4ReactionTableMessenger::fpPrintTable
protected

Definition at line 55 of file G4ReactionTableMessenger.hh.

G4DNAMolecularReactionTable* G4ReactionTableMessenger::fpTable
protected

Definition at line 50 of file G4ReactionTableMessenger.hh.


The documentation for this class was generated from the following files: