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 ] [ 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 /examples/advanced/dna/moleculardna/src/DNAGeometryMessenger.cc (Version 11.3.0) and /examples/advanced/dna/moleculardna/src/DNAGeometryMessenger.cc (Version 5.0)


  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 #include "DNAGeometryMessenger.hh"                
 28                                                   
 29 #include "DNAGeometry.hh"                         
 30 #include "UtilityFunctions.hh"                    
 31                                                   
 32 #include "G4UIcmdWith3VectorAndUnit.hh"           
 33 #include "G4UIcmdWithABool.hh"                    
 34 #include "G4UIcmdWithADouble.hh"                  
 35 #include "G4UIcmdWithADoubleAndUnit.hh"           
 36 #include "G4UIcmdWithAString.hh"                  
 37 #include "G4UIcmdWithAnInteger.hh"                
 38 #include "G4UIcmdWithoutParameter.hh"             
 39 #include "G4UIdirectory.hh"                       
 40                                                   
 41 //....oooOO0OOooo........oooOO0OOooo........oo    
 42                                                   
 43 DNAGeometryMessenger::DNAGeometryMessenger(DNA    
 44   : fpDNAGeometry(dnaGeometry),                   
 45     fpDNADirectory(new G4UIdirectory("/dnageom    
 46     fpNewPlacementVolumeFile(new G4UIcmdWithAS    
 47     fpVoxelPlacementsFile(new G4UIcmdWithAStri    
 48     fpVoxelSideLength(new G4UIcmdWith3VectorAn    
 49     fpFractalScaling(new G4UIcmdWith3VectorAnd    
 50     fpAnglesAsPi(new G4UIcmdWithABool("/dnageo    
 51     fpCustomMoleculeSizes(new G4UIcmdWithABool    
 52     fpAddMoleculeSize(new G4UIcmdWithAString("    
 53     fpCheckDNAOverlaps(new G4UIcmdWithABool("/    
 54     fpVerbosity(new G4UIcmdWithAnInteger("/dna    
 55     fpSmartless(new G4UIcmdWithAnInteger("/dna    
 56     fpIntRangeDirect(new G4UIcmdWithADoubleAnd    
 57     fpRadicalKillDistance(new G4UIcmdWithADoub    
 58     fpUseHistoneScav(new G4UIcmdWithABool("/dn    
 59     fpDrawCellVolumes(new G4UIcmdWithABool("/d    
 60     fpTestDirectory(new G4UIdirectory("/dnates    
 61     fpChromosomeTest(new G4UIcmdWithoutParamet    
 62     fpBasePairTest(new G4UIcmdWithoutParameter    
 63     fpUniqueIDTest(new G4UIcmdWithoutParameter    
 64 {                                                 
 65   // Fractals                                     
 66   fpDNADirectory->SetGuidance("Commands to con    
 67                                                   
 68   fpNewPlacementVolumeFile->SetGuidance("Set a    
 69   fpNewPlacementVolumeFile->SetGuidance("forma    
 70   fpNewPlacementVolumeFile->SetParameterName("    
 71                                                   
 72   fpVoxelPlacementsFile->SetGuidance("Path to     
 73   fpVoxelPlacementsFile->SetParameterName("pat    
 74                                                   
 75   fpVoxelSideLength->SetGuidance("Side length     
 76   fpVoxelSideLength->SetParameterName("xlength    
 77                                                   
 78   fpFractalScaling->SetGuidance("Scaling of XY    
 79   fpFractalScaling->SetParameterName("xlength"    
 80                                                   
 81   fpAnglesAsPi->SetGuidance("Take the angles i    
 82   fpAnglesAsPi->SetGuidance("E.g. set to true     
 83   fpAnglesAsPi->SetParameterName("true/false a    
 84   fpAnglesAsPi->SetDefaultValue(false);           
 85                                                   
 86   fpCustomMoleculeSizes->SetGuidance("Enable c    
 87   fpCustomMoleculeSizes->SetGuidance("These ca    
 88   fpCustomMoleculeSizes->SetParameterName("tru    
 89   fpCustomMoleculeSizes->SetDefaultValue(false    
 90                                                   
 91   fpAddMoleculeSize->SetGuidance("Set a molecu    
 92   fpAddMoleculeSize->SetGuidance("format: mole    
 93   fpAddMoleculeSize->SetGuidance("E.G.: PHOSPH    
 94   fpAddMoleculeSize->SetGuidance("Note: molecu    
 95   fpAddMoleculeSize->SetParameterName("name x     
 96                                                   
 97   // control                                      
 98   fpCheckDNAOverlaps->SetGuidance("Check overl    
 99   fpCheckDNAOverlaps->SetParameterName("true/f    
100                                                   
101   fpVerbosity->SetGuidance("Verbosity for DNA     
102   fpVerbosity->SetParameterName("int verbose l    
103                                                   
104   fpSmartless->SetGuidance("Optimisation value    
105   fpSmartless->SetGuidance("The G4 default is     
106   fpSmartless->SetParameterName("Optimasation     
107                                                   
108   fpIntRangeDirect->SetGuidance("Critical rang    
109   fpIntRangeDirect->SetParameterName("Range",     
110                                                   
111   fpRadicalKillDistance->SetGuidance("Distance    
112   fpRadicalKillDistance->SetParameterName("Ran    
113                                                   
114   fpUseHistoneScav->SetGuidance("Activate Hist    
115   fpUseHistoneScav->SetGuidance("Radius can be    
116   fpUseHistoneScav->SetParameterName("true/fal    
117                                                   
118   fpDrawCellVolumes->SetGuidance(                 
119     "Draw cell/chromosome volumes rather than     
120   fpDrawCellVolumes->SetParameterName("true/fa    
121                                                   
122   // Tests                                        
123   fpTestDirectory->SetGuidance("Tests of the D    
124                                                   
125   fpChromosomeTest->SetGuidance("Test Chromoso    
126                                                   
127   fpBasePairTest->SetGuidance("Test Base Pair     
128                                                   
129   fpUniqueIDTest->SetGuidance("Test Unique ID     
130 }                                                 
131                                                   
132 //....oooOO0OOooo........oooOO0OOooo........oo    
133                                                   
134 void DNAGeometryMessenger::SetNewValue(G4UIcom    
135 {                                                 
136   // Fractals                                     
137   if (command == fpNewPlacementVolumeFile.get(    
138     std::vector<G4String> cmd = utility::Split    
139     // input validation                           
140     if (!(cmd.size() == 2 || cmd.size() == 3))    
141       G4cout << "Invalid input. Command takes     
142              << "separated by a space, or thre    
143              << "where the last is a boolean."    
144     }                                             
145     else {                                        
146       G4String vname = (G4String)cmd[0];          
147       G4String path = (G4String)cmd[1];           
148       G4bool twist = false;                       
149       if (cmd.size() == 3) {                      
150         if ((G4String)cmd[2] == "true") {         
151           twist = true;                           
152         }                                         
153         else if ((G4String)cmd[2] != "false")     
154           G4ExceptionDescription errmsg;          
155           errmsg << "Invalid input. Third valu    
156                  << "written as true or false.    
157           G4Exception("DNAGeometryMessenger::S    
158                       errmsg);                    
159         }                                         
160       }                                           
161                                                   
162       if (utility::Path_exists(path)) {           
163         fpDNAGeometry->AddVoxelFile(vname, pat    
164       }                                           
165       else {                                      
166         G4ExceptionDescription errmsg;            
167         errmsg << path << " has wrong path or     
168         G4Exception("DNAGeometryMessenger::Set    
169       }                                           
170     }                                             
171   }                                               
172   else if (command == fpVoxelPlacementsFile.ge    
173     G4String path = newValue;                     
174     if (utility::Path_exists(path)) {             
175       fpDNAGeometry->SetFractalFilename(path);    
176     }                                             
177     else {                                        
178       G4ExceptionDescription errmsg;              
179       errmsg << "The fractal file path has wro    
180       G4Exception("DNAGeometryMessenger::SetNe    
181     }                                             
182   }                                               
183   else if (command == fpVoxelSideLength.get())    
184     fpDNAGeometry->SetVoxelSideLength(G4UIcmdW    
185   }                                               
186   else if (command == fpFractalScaling.get())     
187     fpDNAGeometry->SetFractalScaling(G4UIcmdWi    
188   }                                               
189   else if (command == fpAnglesAsPi.get()) {       
190     fpDNAGeometry->SetFractalAnglesAsPi(G4UIcm    
191   }                                               
192   else if (command == fpCustomMoleculeSizes.ge    
193     fpDNAGeometry->EnableCustomMoleculeSizes(G    
194   }                                               
195   else if (command == fpAddMoleculeSize.get())    
196     std::vector<G4String> cmd = utility::Split    
197     // input validation                           
198     if (cmd.size() == 4) {                        
199       G4cout << "Invalid input. Command takes     
200              << "separated by a space, e.g. ph    
201     }                                             
202     else {                                        
203       try {                                       
204         G4String name = cmd[0];                   
205         G4int x_size = std::stod(cmd[1]);         
206         G4int y_size = std::stod(cmd[2]);         
207         G4int z_size = std::stod(cmd[3]);         
208         G4ThreeVector molecule_size = G4ThreeV    
209         fpDNAGeometry->AddChangeMoleculeSize(n    
210       }                                           
211       catch (const std::invalid_argument& ia)     
212         G4cerr << "Invalid argument to convert    
213       }                                           
214     }                                             
215   }                                               
216   // control                                      
217   else if (command == fpCheckDNAOverlaps.get()    
218     fpDNAGeometry->SetOverlaps(G4UIcmdWithABoo    
219   }                                               
220   else if (command == fpVerbosity.get()) {        
221     fpDNAGeometry->SetVerbosity(G4UIcmdWithAnI    
222   }                                               
223   else if (command == fpSmartless.get()) {        
224     fpDNAGeometry->SetSmartless(G4UIcmdWithAnI    
225   }                                               
226   else if (command == fpIntRangeDirect.get())     
227     fpDNAGeometry->SetDirectInteractionRange(     
228       G4UIcmdWithADoubleAndUnit::GetNewDoubleV    
229   }                                               
230   else if (command == fpRadicalKillDistance.ge    
231     fpDNAGeometry->SetRadicalKillDistance(G4UI    
232   }                                               
233   else if (command == fpUseHistoneScav.get())     
234     fpDNAGeometry->SetHistoneScav(G4UIcmdWithA    
235   }                                               
236   else if (command == fpDrawCellVolumes.get())    
237     fpDNAGeometry->SetDrawCellVolumes(G4UIcmdW    
238   }                                               
239   else if (command == fpChromosomeTest.get())     
240     fpDNAGeometry->ChromosomeTest();              
241   }                                               
242   else if (command == fpBasePairTest.get()) {     
243     fpDNAGeometry->BasePairIndexTest();           
244   }                                               
245   else if (command == fpUniqueIDTest.get()) {     
246     fpDNAGeometry->UniqueIDTest();                
247   }                                               
248 }                                                 
249                                                   
250 //....oooOO0OOooo........oooOO0OOooo........oo    
251