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3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/dna/utils/src/G4ReactionTableMessenger.cc (Version 11.3.0) and /processes/electromagnetic/dna/utils/src/G4ReactionTableMessenger.cc (Version 10.1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 /*                                                
 27  * G4ReactionTableMessenger.cc                    
 28  *                                                
 29  *  Created on: Sep 14, 2015                      
 30  *      Author: mkaramit                          
 31  */                                               
 32                                                   
 33 #include <G4ReactionTableMessenger.hh>            
 34 #include <G4DNAMolecularReactionTable.hh>         
 35 #include <G4UIcmdWithAString.hh>                  
 36 #include <G4UIcmdWithADoubleAndUnit.hh>           
 37 #include <G4UnitsTable.hh>                        
 38 #include <G4SystemOfUnits.hh>                     
 39 #include <G4UIcmdWithoutParameter.hh>             
 40 #include <G4UIcmdWithABool.hh>                    
 41                                                   
 42 //--------------------------------------------    
 43                                                   
 44 G4ReactionTableMessenger::G4ReactionTableMesse    
 45   :                                               
 46    fpTable(table)                                 
 47   , fpActivateReactionUI(new G4UIcmdWithoutPar    
 48 {                                                 
 49   fpNewDiffContReaction = new G4UIcmdWithAStri    
 50   fpAddReaction = new G4UIcmdWithAString("/che    
 51   fpPrintTable = new G4UIcmdWithoutParameter("    
 52 }                                                 
 53                                                   
 54 //--------------------------------------------    
 55                                                   
 56 G4ReactionTableMessenger::~G4ReactionTableMess    
 57 {                                                 
 58   delete fpNewDiffContReaction;                   
 59   delete fpAddReaction;                           
 60   delete fpPrintTable;                            
 61 }                                                 
 62                                                   
 63 //--------------------------------------------    
 64 void G4ReactionTableMessenger::SetNewValue(G4U    
 65                                            G4S    
 66 {                                                 
 67   if(command == fpActivateReactionUI.get())       
 68   {                                               
 69     //assert(false);                              
 70       fpTable->Reset();//release reaction data    
 71   }                                               
 72                                                   
 73   if(command == fpNewDiffContReaction)            
 74   {                                               
 75     std::istringstream iss(newValue);             
 76                                                   
 77     G4String species1;                            
 78     iss >> species1;                              
 79                                                   
 80     G4String species2;                            
 81     iss >> species2;                              
 82                                                   
 83     double reactionRate;                          
 84     iss >> reactionRate;                          
 85                                                   
 86 //    G4String reactionRateUnit;                  
 87 //    iss >> reactionRateUnit;                    
 88                                                   
 89     double dimensionedReactionRate = reactionR    
 90 //        G4UIcmdWithADoubleAndUnit::ConvertTo    
 91 //            + G4String(" ") + reactionRateUn    
 92                                                   
 93     auto reactionData =                           
 94         new G4DNAMolecularReactionData(dimensi    
 95                                        species    
 96                                        species    
 97                                                   
 98 //    G4String productionRate;                    
 99 //    iss >> productionRate;                      
100 //                                                
101 //    if(productionRate != "" && productionRat    
102 //    {                                           
103 //      double prodRateReal = G4UIcommand::Con    
104 //                                                
105 //      if(prodRateReal == 0 || isnan(prodRate    
106 //      {                                         
107 //        G4Exception("G4ReactionTableMessenge    
108 //                    "WRONG_PRODUCTION_RATE",    
109 //                    FatalException, "");        
110 //      }                                         
111 //                                                
112 //      double dimensionedProductionRate = pro    
113 //          * (1e-3 * m3 / (mole * s));           
114 //      reactionData->SetProductionRate(dimens    
115 //    }                                           
116                                                   
117     while(!iss.eof())                             
118     {                                             
119       G4String product;                           
120       iss >> product;                             
121                                                   
122       if(!product.empty())                        
123       {                                           
124         reactionData->AddProduct(product);        
125       }                                           
126       else                                        
127       {                                           
128         break;                                    
129       }                                           
130     };                                            
131                                                   
132     fpTable->SetReaction(reactionData);           
133   }                                               
134 //  else if(command == fpNewPartDiffContReacti    
135 //  {                                             
136 //    std::istringstream iss(newValue);           
137 //                                                
138 //    G4String species1;                          
139 //    iss >> species1;                            
140 //                                                
141 //    G4String species2;                          
142 //    iss >> species2;                            
143 //                                                
144 //    double reactionRate;                        
145 //    iss >> reactionRate;                        
146 //                                                
147 ////    G4String reactionRateUnit;                
148 ////    iss >> reactionRateUnit;                  
149 //                                                
150 ////    G4String reactionRateUnit;                
151 ////    iss >> reactionRateUnit;                  
152 //                                                
153 //    double reactionRadius;                      
154 //    iss >> reactionRadius;                      
155 //                                                
156 ////    G4String reactionRadiusUnit;              
157 ////    iss >> reactionRadiusUnit;                
158 //                                                
159 //    double dimensionedReactionRate = reactio    
160 //                                                
161 ////    double dimensionedReactionRate =          
162 ////        G4UIcmdWithADoubleAndUnit::Convert    
163 ////            + " " + reactionRateUnit).c_st    
164 //                                                
165 //    double dimensionedReactionRadius = react    
166 ////        G4UIcmdWithADoubleAndUnit::Convert    
167 ////            + " " + reactionRadiusUnit).c_    
168 //                                                
169 //    G4DNAMolecularReactionData* reactionData    
170 //        new G4DNAMolecularReactionData(dimen    
171 //                                       speci    
172 //                                       speci    
173 //    reactionData->SetPartiallyDiffusionContr    
174 //                                                
175 //                                                
176 //    while(iss.eof() == false)                   
177 //    {                                           
178 //      G4String product;                         
179 //      iss >> product;                           
180 //                                                
181 //      if(product != "")                         
182 //      {                                         
183 //        reactionData->AddProduct(product);      
184 //      }                                         
185 //      else                                      
186 //      {                                         
187 //        break;                                  
188 //      }                                         
189 //    }                                           
190 //                                                
191 //    fpTable->SetReaction(reactionData);         
192 //  }                                             
193 //  else if(command == fpNewPartDiffContReacti    
194 //  {                                             
195 //    std::istringstream iss(newValue);           
196 //                                                
197 //    G4String species1;                          
198 //    iss >> species1;                            
199 //                                                
200 //    G4String species2;                          
201 //    iss >> species2;                            
202 //                                                
203 //    double reactionRate;                        
204 //    iss >> reactionRate;                        
205 //                                                
206 //    //    G4String reactionRateUnit;            
207 //    //    iss >> reactionRateUnit;              
208 //                                                
209 //    //    G4String reactionRateUnit;            
210 //    //    iss >> reactionRateUnit;              
211 //                                                
212 //    double activationRate;                      
213 //    iss >> activationRate;                      
214 //                                                
215 //    //    G4String reactionRadiusUnit;          
216 //    //    iss >> reactionRadiusUnit;            
217 //                                                
218 //    double dimensionedReactionRate = reactio    
219 //                                                
220 //    double dimensionedActivationRate = activ    
221 //        * (1e-3 * m3 / (mole * s));             
222 //                                                
223 //    G4DNAMolecularReactionData* reactionData    
224 //        new G4DNAMolecularReactionData(dimen    
225 //                                       speci    
226 //                                       speci    
227 //    reactionData->                              
228 //      SetPartiallyDiffusionControlledReactio    
229 //                                                
230 //                                                
231 //    while(iss.eof() == false)                   
232 //    {                                           
233 //      G4String product;                         
234 //      iss >> product;                           
235 //                                                
236 //      if(product != "")                         
237 //      {                                         
238 //        reactionData->AddProduct(product);      
239 //      }                                         
240 //      else                                      
241 //      {                                         
242 //        break;                                  
243 //      }                                         
244 //    }                                           
245 //                                                
246 //    fpTable->SetReaction(reactionData);         
247 //  }                                             
248   else if(command == fpPrintTable)                
249   {                                               
250     fpTable->PrintTable();                        
251   }                                               
252   else if(command == fpAddReaction)               
253   {                                               
254     std::istringstream iss(newValue);             
255                                                   
256     //----------------------------------------    
257     // Reactants definition                       
258                                                   
259     G4String species1;                            
260     iss >> species1;                              
261                                                   
262     G4String marker;                              
263     iss >> marker; // peut etre +, ->, |          
264                                                   
265     G4String species2;                            
266                                                   
267     if(marker == "+")                             
268     {                                             
269         iss >> species2;                          
270         iss >> marker; // peut etre ->, |         
271     }                                             
272                                                   
273     //----------------------------------------    
274                                                   
275     auto  reactionData =                          
276                 new G4DNAMolecularReactionData    
277                                                   
278                                                   
279     //fpTable->SetReaction(reactionData);         
280                                                   
281     //----------------------------------------    
282     // Add products                               
283     if(marker == "->")                            
284     {                                             
285       iss >> marker; // doit etre = species na    
286                                                   
287       while(marker!="|"                           
288           //&& marker!=""                         
289           && !iss.eof()                           
290           )                                       
291       {                                           
292         //G4cout << marker << G4endl;             
293         if(marker == "+")                         
294         {                                         
295           iss >> marker; // doit etre species     
296           continue;                               
297         }                                         
298         if(marker != "H2O")                       
299         {                                         
300           reactionData->AddProduct(marker);       
301         }                                         
302                                                   
303         iss >> marker; // peut etre species na    
304       };                                          
305     }                                             
306                                                   
307 //    G4cout << "out of 1st loop" << G4endl;      
308                                                   
309     //----------------------------------------    
310     // Add reaction rate method                   
311     G4String rateconst_method;                    
312     iss >> rateconst_method;                      
313     if(rateconst_method == "Fix")                 
314     {                                             
315       iss >> marker; // must be |                 
316       double reactionRate;                        
317       iss >> reactionRate;                        
318                                                   
319       double dimensionedReactionRate = reactio    
320       reactionData->SetObservedReactionRateCon    
321       reactionData->ComputeEffectiveRadius();     
322       G4String markerType;                        
323       iss >> markerType; // must be |             
324       if(markerType == "|")                       
325       {                                           
326         G4int reactionType;                       
327         iss >> reactionType;                      
328         if(reactionType == 1)                     
329         {                                         
330           reactionData->SetReactionType(reacti    
331         }                                         
332       }                                           
333                                                   
334                                                   
335 //      G4String productionRate;                  
336 //      iss >> productionRate;                    
337 //                                                
338 //      if(productionRate != "" && productionR    
339 //      {                                         
340 //        double prodRateReal = G4UIcommand::C    
341 //                                                
342 //        if(prodRateReal == 0 || isnan(prodRa    
343 //        {                                       
344 //          G4Exception("G4ReactionTableMessen    
345 //                      "WRONG_PRODUCTION_RATE    
346 //                      FatalException,           
347 //                      "");                      
348 //        }                                       
349 //                                                
350 //        double dimensionedProductionRate = p    
351 //            * (1e-3 * m3 / (mole * s));         
352 //        reactionData->SetProductionRate(dime    
353 //      }                                         
354     }                                             
355     else if(rateconst_method == "Arr")            
356     {                                             
357       iss >> marker; // must be |                 
358       double A0  = 0;                             
359       double E_R = 0;                             
360                                                   
361       iss >> A0;                                  
362       iss >> E_R;                                 
363       reactionData->SetArrehniusParameterizati    
364     }                                             
365     else if(rateconst_method == "Pol")            
366     {                                             
367       iss >> marker; // must be |                 
368       std::vector<double> P = {0, 0, 0, 0, 0};    
369                                                   
370       size_t i = 0;                               
371       while(i < 4) // could be changed to 5 on    
372       {                                           
373         double tmp;                               
374         iss >> tmp;                               
375         P[i] = tmp;                               
376 //        G4cout << newValue << G4endl;           
377 //        G4cout << tmp << G4endl;                
378 //        G4cout << P[i] << G4endl;               
379         ++i;                                      
380       };                                          
381       reactionData->SetPolynomialParameterizat    
382     }                                             
383     else if(rateconst_method == "Scale")          
384     {                                             
385       iss >> marker; // must be |                 
386       double temp_K;                              
387       iss >> temp_K;                              
388       double reactionRateCste;                    
389       iss >> reactionRateCste;                    
390       double dimensionedReactionRate = reactio    
391       reactionData->SetObservedReactionRateCon    
392       reactionData->SetScaledParameterization(    
393     }                                             
394                                                   
395 //    if(iss.eof() == false)                      
396 //    {                                           
397 //      iss >> marker;                            
398 //                                                
399 //      if(marker == "|")                         
400 //      {                                         
401 //        G4String productionRate ;               
402 //        iss >> productionRate;                  
403 //                                                
404 ////        G4cout << productionRate << G4endl    
405 //                                                
406 //        double dimProductionRate = G4UIcomma    
407 //                                                
408 //        G4cout << " DIM PROD RATE = " << rea    
409 //             << " + " << reactionData->GetRe    
410 //                                                
411 //        reactionData->SetProductionRate(dimP    
412 //      }                                         
413 //    }                                           
414     fpTable->SetReaction(reactionData);           
415 //    G4cout << "Reaction " << species1 << " +    
416   }                                               
417 }                                                 
418