Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/dna/molecules/management/src/G4Molecule.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 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/molecules/management/src/G4Molecule.cc (Version 11.3.0) and /processes/electromagnetic/dna/molecules/management/src/G4Molecule.cc (Version 10.3)


  1 // *******************************************      1 // ********************************************************************
  2 // * License and Disclaimer                         2 // * License and Disclaimer                                           *
  3 // *                                                3 // *                                                                  *
  4 // * The  Geant4 software  is  copyright of th      4 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  5 // * the Geant4 Collaboration.  It is provided      5 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  6 // * conditions of the Geant4 Software License      6 // * conditions of the Geant4 Software License,  included in the file *
  7 // * LICENSE and available at  http://cern.ch/      7 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  8 // * include a list of copyright holders.           8 // * include a list of copyright holders.                             *
  9 // *                                                9 // *                                                                  *
 10 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 11 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 12 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 13 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 14 // * use.  Please see the license in the file      14 // * use.  Please see the license in the file  LICENSE  and URL above *
 15 // * for the full disclaimer and the limitatio     15 // * for the full disclaimer and the limitation of liability.         *
 16 // *                                               16 // *                                                                  *
 17 // * This  code  implementation is the result      17 // * This  code  implementation is the result of  the  scientific and *
 18 // * technical work of the GEANT4 collaboratio     18 // * technical work of the GEANT4 collaboration.                      *
 19 // * By using,  copying,  modifying or  distri     19 // * By using,  copying,  modifying or  distributing the software (or *
 20 // * any work based  on the software)  you  ag     20 // * any work based  on the software)  you  agree  to acknowledge its *
 21 // * use  in  resulting  scientific  publicati     21 // * use  in  resulting  scientific  publications,  and indicate your *
 22 // * acceptance of all terms of the Geant4 Sof     22 // * acceptance of all terms of the Geant4 Software license.          *
 23 // *******************************************     23 // ********************************************************************
 24 //                                                 24 //
                                                   >>  25 // $Id: G4Molecule.cc 100802 2016-11-02 14:55:27Z gcosmo $
 25 //                                                 26 //
 26 // -------------------------------------------     27 // ---------------------------------------------------------------------
 27 //  GEANT 4 class header file                      28 //  GEANT 4 class header file
 28 //                                                 29 //
 29 //  History: first implementation, based on G4     30 //  History: first implementation, based on G4DynamicParticle
 30 //           New dependency : G4VUserTrackInfo     31 //           New dependency : G4VUserTrackInformation
 31 //                                                 32 //
 32 //      ---------------- G4Molecule  ---------     33 //      ---------------- G4Molecule  ----------------
 33 //      first design&implementation by Alfonso     34 //      first design&implementation by Alfonso Mantero, 7 Apr 2009
 34 //      New developments Alfonso Mantero & Mat     35 //      New developments Alfonso Mantero & Mathieu Karamitros
 35 //      Oct/Nov 2009 Class Name changed to G4M     36 //      Oct/Nov 2009 Class Name changed to G4Molecule
 36 //                   Removed dependency from G     37 //                   Removed dependency from G4DynamicParticle
 37 //                   New constructors :            38 //                   New constructors :
 38 //                    copy constructor             39 //                    copy constructor
 39 //                    direct ionized/excited m     40 //                    direct ionized/excited molecule
 40 //                   New methods :                 41 //                   New methods :
 41 //                    Get : name,atoms' number     42 //                    Get : name,atoms' number,nb electrons,decayChannel
 42 //                    PrintState //To get the      43 //                    PrintState //To get the electronic level and the
 43 //                                 correspondi     44 //                                 corresponding name of the excitation
 44 //                    Kinematic :                  45 //                    Kinematic :
 45 //                    BuildTrack,GetKineticEne     46 //                    BuildTrack,GetKineticEnergy,GetDiffusionVelocity
 46 //                    Change the way dynCharge     47 //                    Change the way dynCharge and eNb is calculated
 47 // -------------------------------------------     48 // ---------------------------------------------------------------------
 48                                                    49 
 49 #include "G4Molecule.hh"                           50 #include "G4Molecule.hh"
 50 #include "G4MolecularConfiguration.hh"             51 #include "G4MolecularConfiguration.hh"
 51 #include "Randomize.hh"                            52 #include "Randomize.hh"
 52 #include "G4PhysicalConstants.hh"                  53 #include "G4PhysicalConstants.hh"
 53 #include "G4SystemOfUnits.hh"                      54 #include "G4SystemOfUnits.hh"
 54 #include "G4Track.hh"                              55 #include "G4Track.hh"
 55 #include "G4VMoleculeCounter.hh"                   56 #include "G4VMoleculeCounter.hh"
 56                                                    57 
 57 using namespace std;                               58 using namespace std;
 58                                                    59 
 59 G4Allocator<G4Molecule>*& aMoleculeAllocator() <<  60 ///*G4ThreadLocal*/G4double G4Molecule::fgTemperature = 310; // 310*kelvin;
 60 {                                              <<  61 // 37°C, used to shoot an energy
 61     G4ThreadLocalStatic G4Allocator<G4Molecule << 
 62     return _instance;                          << 
 63 }                                              << 
 64                                                    62 
 65 //____________________________________________ <<  63 ITImp(G4Molecule)
 66                                                    64 
 67 template<>                                     <<  65 G4ThreadLocal G4Allocator<G4Molecule> *aMoleculeAllocator = 0;
 68 G4KDNode<G4Molecule>::~G4KDNode() {            << 
 69     fPoint->SetNode(nullptr);                  << 
 70 }                                              << 
 71                                                    66 
 72 //____________________________________________     67 //______________________________________________________________________________
 73                                                    68 
 74 G4Molecule* GetMolecule(const G4Track& track)      69 G4Molecule* GetMolecule(const G4Track& track)
 75 {                                                  70 {
 76     return (G4Molecule*)(GetIT(track));        <<  71   return (G4Molecule*) (GetIT(track));
 77 }                                                  72 }
 78                                                    73 
 79 //____________________________________________     74 //______________________________________________________________________________
 80                                                    75 
 81 G4Molecule* GetMolecule(const G4Track* track)      76 G4Molecule* GetMolecule(const G4Track* track)
 82 {                                                  77 {
 83     return (G4Molecule*)(GetIT(track));        <<  78   return (G4Molecule*) (GetIT(track));
 84 }                                                  79 }
 85                                                    80 
 86 //____________________________________________     81 //______________________________________________________________________________
 87                                                    82 
 88 G4Molecule* G4Molecule::GetMolecule(const G4Tr     83 G4Molecule* G4Molecule::GetMolecule(const G4Track* track)
 89 {                                                  84 {
 90     return (G4Molecule*)(GetIT(track));        <<  85   return (G4Molecule*) (GetIT(track));
 91 }                                                  86 }
 92                                                    87 
 93 //____________________________________________     88 //______________________________________________________________________________
 94                                                    89 
 95 void G4Molecule::Print() const                     90 void G4Molecule::Print() const
 96 {                                                  91 {
 97     G4cout << "The user track information is a <<  92   G4cout << "The user track information is a molecule" << G4endl;
 98 }                                                  93 }
 99                                                    94 
100 //____________________________________________     95 //______________________________________________________________________________
101                                                    96 
102 G4Molecule::G4Molecule(const G4Molecule& right <<  97 G4Molecule::G4Molecule(const G4Molecule& right) :
103     : G4VUserTrackInformation("G4Molecule")    <<  98     G4VUserTrackInformation("G4Molecule"), G4IT(right)
104     , G4IT(right)                              << 
105 {                                                  99 {
106     fpMolecularConfiguration = right.fpMolecul << 100   fpMolecularConfiguration = right.fpMolecularConfiguration;
107 }                                                 101 }
108                                                   102 
109 //____________________________________________    103 //______________________________________________________________________________
110                                                   104 
111 G4Molecule& G4Molecule::operator=(const G4Mole    105 G4Molecule& G4Molecule::operator=(const G4Molecule& right)
112 {                                                 106 {
113     if (&right == this) return *this;          << 107   if (&right == this) return *this;
114     fpMolecularConfiguration = right.fpMolecul << 108   fpMolecularConfiguration = right.fpMolecularConfiguration;
115     return *this;                              << 109   return *this;
116 }                                                 110 }
117                                                   111 
118 //____________________________________________    112 //______________________________________________________________________________
119                                                   113 
120 G4bool G4Molecule::operator==(const G4Molecule    114 G4bool G4Molecule::operator==(const G4Molecule& right) const
121 {                                                 115 {
122     return fpMolecularConfiguration == right.f << 116   if (fpMolecularConfiguration == right.fpMolecularConfiguration)
                                                   >> 117   {
                                                   >> 118     return true;
                                                   >> 119   }
                                                   >> 120   return false;
123 }                                                 121 }
124                                                   122 
125 //____________________________________________    123 //______________________________________________________________________________
126                                                   124 
127 G4bool G4Molecule::operator!=(const G4Molecule    125 G4bool G4Molecule::operator!=(const G4Molecule& right) const
128 {                                                 126 {
129     return !(*this == right);                  << 127   return !(*this == right);
130 }                                                 128 }
131                                                   129 
132 //____________________________________________    130 //______________________________________________________________________________
133 /** The two methods below are the most called     131 /** The two methods below are the most called of the simulation :
134  *  compare molecules in the MoleculeStackMana    132  *  compare molecules in the MoleculeStackManager or in
135  *  the InteractionTable                          133  *  the InteractionTable
136  */                                               134  */
137                                                   135 
138 G4bool G4Molecule::operator<(const G4Molecule&    136 G4bool G4Molecule::operator<(const G4Molecule& right) const
139 {                                                 137 {
140     return fpMolecularConfiguration < right.fp << 138   return fpMolecularConfiguration < right.fpMolecularConfiguration;
141 }                                                 139 }
142                                                   140 
143 //____________________________________________    141 //______________________________________________________________________________
                                                   >> 142 /** Default molecule builder
                                                   >> 143  */
                                                   >> 144 G4Molecule::G4Molecule() :
                                                   >> 145     G4VUserTrackInformation("G4Molecule"), G4IT()
144                                                   146 
145 G4Molecule::G4Molecule()                       << 
146     : G4VUserTrackInformation("G4Molecule")    << 
147 {                                                 147 {
148     fpMolecularConfiguration = nullptr;        << 148   fpMolecularConfiguration = 0;
149 }                                                 149 }
150                                                   150 
151 //____________________________________________    151 //______________________________________________________________________________
152                                                   152 
153 G4Molecule::~G4Molecule()                         153 G4Molecule::~G4Molecule()
154 {                                                 154 {
155     if (fpTrack != nullptr)                    << 155   if (fpTrack != NULL)
                                                   >> 156   {
                                                   >> 157     if (G4VMoleculeCounter::Instance()->InUse())
156     {                                             158     {
157         if (G4VMoleculeCounter::Instance()->In << 159       G4VMoleculeCounter::Instance()->
158         {                                      << 160         RemoveAMoleculeAtTime(fpMolecularConfiguration,
159             G4VMoleculeCounter::Instance()->   << 161                               fpTrack->GetGlobalTime(),
160                 RemoveAMoleculeAtTime(fpMolecu << 162                               &(fpTrack->GetPosition()));
161                                       fpTrack- << 
162                                       &(fpTrac << 
163         }                                      << 
164         fpTrack = nullptr;                     << 
165     }                                             163     }
166     fpMolecularConfiguration = nullptr;        << 164     fpTrack = 0;
                                                   >> 165   }
                                                   >> 166   fpMolecularConfiguration = 0;
167 }                                                 167 }
168                                                   168 
169 //____________________________________________    169 //______________________________________________________________________________
170 /** Build a molecule at ground state according    170 /** Build a molecule at ground state according to a given
171  *  G4MoleculeDefinition that can be obtained     171  *  G4MoleculeDefinition that can be obtained from G4GenericMoleculeManager
172  */                                               172  */
173 G4Molecule::G4Molecule(G4MoleculeDefinition* p << 173 //////////////////////////
174     : G4VUserTrackInformation("G4Molecule")    << 174 G4Molecule::G4Molecule(G4MoleculeDefinition * moleculeDefinition) :
                                                   >> 175     G4VUserTrackInformation("G4Molecule"), G4IT()
                                                   >> 176 //////////////////////////
175 {                                                 177 {
176     fpMolecularConfiguration = G4MolecularConf << 178   fpMolecularConfiguration =
                                                   >> 179       G4MolecularConfiguration::
                                                   >> 180         GetOrCreateMolecularConfiguration(moleculeDefinition);
177 }                                                 181 }
178                                                   182 
179 //____________________________________________    183 //______________________________________________________________________________
180                                                   184 
181 G4Molecule::G4Molecule(G4MoleculeDefinition* p << 185 G4Molecule::G4Molecule(G4MoleculeDefinition* moleculeDefinition, int charge)
182 {                                                 186 {
183     fpMolecularConfiguration = G4MolecularConf << 187   fpMolecularConfiguration =
184                                                << 188       G4MolecularConfiguration::
                                                   >> 189         GetOrCreateMolecularConfiguration(moleculeDefinition,
                                                   >> 190                                           charge);
185 }                                                 191 }
186                                                   192 
187 //____________________________________________    193 //______________________________________________________________________________
188 /** Build a molecule at a specific excitation/    194 /** Build a molecule at a specific excitation/ionisation state according
189  *  to a ground state that can be obtained fro    195  *  to a ground state that can be obtained from G4GenericMoleculeManager.
190  *  Put 0 in the second option if this is a io    196  *  Put 0 in the second option if this is a ionisation.
191  */                                               197  */
192 G4Molecule::G4Molecule(G4MoleculeDefinition* p << 198 //////////////////////////
                                                   >> 199 G4Molecule::G4Molecule(G4MoleculeDefinition * moleculeDefinition,
193                        G4int OrbitalToFree,       200                        G4int OrbitalToFree,
194                        G4int OrbitalToFill)    << 201                        G4int OrbitalToFill) :
195    : G4VUserTrackInformation("G4Molecule")     << 202     G4VUserTrackInformation("G4Molecule"), G4IT()
196 {                                              << 203 //////////////////////////
197     if (pMoleculeDefinition->GetGroundStateEle << 204 {
198     {                                          << 205   if (moleculeDefinition->GetGroundStateElectronOccupancy())
199         G4ElectronOccupancy dynElectronOccupan << 206   {
                                                   >> 207     G4ElectronOccupancy dynElectronOccupancy(
                                                   >> 208         *moleculeDefinition->GetGroundStateElectronOccupancy());
200                                                   209 
201         if (OrbitalToFill != 0)                << 210     if (OrbitalToFill != 0)
202         {                                      << 211     {
203             dynElectronOccupancy.RemoveElectro << 212       dynElectronOccupancy.RemoveElectron(OrbitalToFree - 1, 1);
204             dynElectronOccupancy.AddElectron(O << 213       dynElectronOccupancy.AddElectron(OrbitalToFill - 1, 1);
205             // dynElectronOccupancy.DumpInfo() << 214       // dynElectronOccupancy.DumpInfo(); // DEBUG
206         }                                      << 
207                                                << 
208         if (OrbitalToFill == 0)                << 
209         {                                      << 
210             dynElectronOccupancy.RemoveElectro << 
211             // dynElectronOccupancy.DumpInfo() << 
212         }                                      << 
213                                                << 
214         fpMolecularConfiguration =             << 
215             G4MolecularConfiguration::GetOrCre << 
216                 pMoleculeDefinition, dynElectr << 
217     }                                             215     }
218     else                                       << 216 
                                                   >> 217     if (OrbitalToFill == 0)
219     {                                             218     {
220         fpMolecularConfiguration = nullptr;    << 219       dynElectronOccupancy.RemoveElectron(OrbitalToFree - 1, 1);
221         G4Exception(                           << 220       // dynElectronOccupancy.DumpInfo(); // DEBUG
222             "G4Molecule::G4Molecule(G4Molecule << 
223             "G4int OrbitalToFree, G4int Orbita << 
224             "G4Molecule_wrong_usage_of_constru << 
225             FatalErrorInArgument,              << 
226             "If you want to use this construct << 
227             "first defined with electron occup << 
228     }                                             221     }
                                                   >> 222 
                                                   >> 223     fpMolecularConfiguration =
                                                   >> 224         G4MolecularConfiguration::GetOrCreateMolecularConfiguration(
                                                   >> 225             moleculeDefinition, dynElectronOccupancy);
                                                   >> 226   }
                                                   >> 227   else
                                                   >> 228   {
                                                   >> 229     fpMolecularConfiguration = 0;
                                                   >> 230     G4Exception(
                                                   >> 231         "G4Molecule::G4Molecule(G4MoleculeDefinition * moleculeDefinition, "
                                                   >> 232         "G4int OrbitalToFree, G4int OrbitalToFill)",
                                                   >> 233         "G4Molecule_wrong_usage_of_constructor",
                                                   >> 234         FatalErrorInArgument,
                                                   >> 235         "If you want to use this constructor, the molecule definition has to be "
                                                   >> 236         "first defined with electron occupancies");
                                                   >> 237   }
229 }                                                 238 }
230                                                   239 
231 //____________________________________________    240 //______________________________________________________________________________
232 /** Specific builder for water molecules to be    241 /** Specific builder for water molecules to be used in Geant4-DNA,
233  * the last option Excitation is true if the m    242  * the last option Excitation is true if the molecule is excited, is
234  * false is the molecule is ionized.              243  * false is the molecule is ionized.
235  */                                               244  */
236 G4Molecule::G4Molecule(G4MoleculeDefinition* p << 
237                        G4int level,            << 
238                        G4bool excitation)      << 
239     : G4VUserTrackInformation("G4Molecule")    << 
240 {                                              << 
241     if (pMoleculeDefinition->GetGroundStateEle << 
242     {                                          << 
243         G4ElectronOccupancy dynElectronOccupan << 
244                                                   245 
245         if (excitation)                        << 246 G4Molecule::G4Molecule(G4MoleculeDefinition * moleculeDefinition,
246         {                                      << 247                        G4int Level,
247             dynElectronOccupancy.RemoveElectro << 248                        G4bool Excitation) :
248             dynElectronOccupancy.AddElectron(5 << 249     G4VUserTrackInformation("G4Molecule"), G4IT()
249             // dynElectronOccupancy.DumpInfo() << 250 {
250         }                                      << 251   if (moleculeDefinition->GetGroundStateElectronOccupancy())
251         else                                   << 252   {
252         {                                      << 253     G4ElectronOccupancy dynElectronOccupancy(
253             dynElectronOccupancy.RemoveElectro << 254         *moleculeDefinition->GetGroundStateElectronOccupancy());
254             // dynElectronOccupancy.DumpInfo() << 
255         }                                      << 
256                                                   255 
257         fpMolecularConfiguration = G4Molecular << 256     if (Excitation == true)
258                 dynElectronOccupancy);         << 257     {
                                                   >> 258       dynElectronOccupancy.RemoveElectron(Level, 1);
                                                   >> 259       dynElectronOccupancy.AddElectron(5, 1);
                                                   >> 260       // dynElectronOccupancy.DumpInfo(); // DEBUG
259     }                                             261     }
260     else                                       << 262 
                                                   >> 263     if (Excitation == false)
261     {                                             264     {
262         fpMolecularConfiguration = nullptr;    << 265       dynElectronOccupancy.RemoveElectron(Level, 1);
263         G4Exception(                           << 266       // dynElectronOccupancy.DumpInfo(); // DEBUG
264             "G4Molecule::G4Molecule(G4Molecule << 
265             "G4int OrbitalToFree, G4int Orbita << 
266             "G4Molecule_wrong_usage_of_constru << 
267             FatalErrorInArgument,              << 
268             "If you want to use this construct << 
269             "first defined with electron occup << 
270     }                                             267     }
                                                   >> 268 
                                                   >> 269     fpMolecularConfiguration =
                                                   >> 270         G4MolecularConfiguration::GetOrCreateMolecularConfiguration(
                                                   >> 271             moleculeDefinition, dynElectronOccupancy);
                                                   >> 272   }
                                                   >> 273   else
                                                   >> 274   {
                                                   >> 275     fpMolecularConfiguration = 0;
                                                   >> 276     G4Exception(
                                                   >> 277         "G4Molecule::G4Molecule(G4MoleculeDefinition * moleculeDefinition, "
                                                   >> 278         "G4int OrbitalToFree, G4int OrbitalToFill)",
                                                   >> 279         "G4Molecule_wrong_usage_of_constructor",
                                                   >> 280         FatalErrorInArgument,
                                                   >> 281         "If you want to use this constructor, the molecule definition has to be "
                                                   >> 282         "first defined with electron occupancies");
                                                   >> 283 
                                                   >> 284   }
271 }                                                 285 }
272                                                   286 
273 //____________________________________________    287 //______________________________________________________________________________
274                                                   288 
275 G4Molecule::G4Molecule(const G4MolecularConfig << 289 G4Molecule::G4Molecule(G4MolecularConfiguration* molConf)
276 {                                                 290 {
277     fpMolecularConfiguration = pMolecularConfi << 291   fpMolecularConfiguration = molConf;
278 }                                                 292 }
279                                                   293 
280 //____________________________________________    294 //______________________________________________________________________________
281                                                   295 
282 void G4Molecule::SetElectronOccupancy(const G4 << 296 void G4Molecule::SetElectronOccupancy(const G4ElectronOccupancy* occ)
283 {                                                 297 {
284     fpMolecularConfiguration =                 << 298   fpMolecularConfiguration =
285         G4MolecularConfiguration::GetOrCreateM << 299       G4MolecularConfiguration::GetOrCreateMolecularConfiguration(
286                                                << 300           fpMolecularConfiguration->GetDefinition(), *occ);
287 }                                                 301 }
288                                                   302 
289 //____________________________________________    303 //______________________________________________________________________________
290                                                   304 
291 void G4Molecule::ExciteMolecule(G4int excitati << 305 /** Method used in Geant4-DNA to excite water molecules
                                                   >> 306  */
                                                   >> 307 void G4Molecule::ExciteMolecule(G4int ExcitedLevel)
292 {                                                 308 {
293     fpMolecularConfiguration = fpMolecularConf << 309   fpMolecularConfiguration = fpMolecularConfiguration->ExciteMolecule(
                                                   >> 310       ExcitedLevel);
294 }                                                 311 }
295                                                   312 
296 //____________________________________________    313 //______________________________________________________________________________
297                                                   314 
298 void G4Molecule::IonizeMolecule(G4int ionizati << 315 /** Method used in Geant4-DNA to ionize water molecules
                                                   >> 316  */
                                                   >> 317 void G4Molecule::IonizeMolecule(G4int IonizedLevel)
299 {                                                 318 {
300     fpMolecularConfiguration = fpMolecularConf << 319   fpMolecularConfiguration = fpMolecularConfiguration->IonizeMolecule(
                                                   >> 320       IonizedLevel);
301 }                                                 321 }
302                                                   322 
303 //____________________________________________    323 //______________________________________________________________________________
304                                                   324 
305 void G4Molecule::AddElectron(G4int orbit, G4in    325 void G4Molecule::AddElectron(G4int orbit, G4int number)
306 {                                                 326 {
307     fpMolecularConfiguration = fpMolecularConf << 327   fpMolecularConfiguration = fpMolecularConfiguration->AddElectron(orbit,
                                                   >> 328                                                                    number);
308 }                                                 329 }
309                                                   330 
310 //____________________________________________    331 //______________________________________________________________________________
311                                                   332 
312 void G4Molecule::RemoveElectron(G4int orbit, G    333 void G4Molecule::RemoveElectron(G4int orbit, G4int number)
313 {                                                 334 {
314     fpMolecularConfiguration =                 << 335   fpMolecularConfiguration = fpMolecularConfiguration->RemoveElectron(orbit,
315         fpMolecularConfiguration->RemoveElectr << 336                                                                       number);
316 }                                                 337 }
317                                                   338 
318 //____________________________________________    339 //______________________________________________________________________________
319                                                   340 
320 void G4Molecule::MoveOneElectron(G4int orbitTo    341 void G4Molecule::MoveOneElectron(G4int orbitToFree, G4int orbitToFill)
321 {                                                 342 {
322     fpMolecularConfiguration =                 << 343   fpMolecularConfiguration = fpMolecularConfiguration->MoveOneElectron(
323         fpMolecularConfiguration->MoveOneElect << 344       orbitToFree, orbitToFill);
324 }                                                 345 }
325                                                   346 
326 //____________________________________________    347 //______________________________________________________________________________
327                                                   348 
328 const G4String& G4Molecule::GetName() const       349 const G4String& G4Molecule::GetName() const
329 {                                                 350 {
330     return fpMolecularConfiguration->GetName() << 351   return fpMolecularConfiguration->GetName();
331 }                                                 352 }
332                                                   353 
333 //____________________________________________    354 //______________________________________________________________________________
334                                                   355 
335 const G4String& G4Molecule::GetFormatedName()     356 const G4String& G4Molecule::GetFormatedName() const
336 {                                                 357 {
337     return fpMolecularConfiguration->GetFormat << 358   return fpMolecularConfiguration->GetFormatedName();
338 }                                                 359 }
339                                                   360 
340 //____________________________________________    361 //______________________________________________________________________________
341                                                   362 
342 G4int G4Molecule::GetAtomsNumber() const          363 G4int G4Molecule::GetAtomsNumber() const
343 {                                                 364 {
344     return fpMolecularConfiguration->GetAtomsN << 365   return fpMolecularConfiguration->GetAtomsNumber();
345 }                                                 366 }
346                                                   367 
347 //____________________________________________    368 //______________________________________________________________________________
348                                                   369 
349 G4double G4Molecule::GetNbElectrons() const       370 G4double G4Molecule::GetNbElectrons() const
350 {                                                 371 {
351     return fpMolecularConfiguration->GetNbElec << 372   return fpMolecularConfiguration->GetNbElectrons();
352 }                                                 373 }
353                                                   374 
354 //____________________________________________    375 //______________________________________________________________________________
355                                                   376 
356 void G4Molecule::PrintState() const               377 void G4Molecule::PrintState() const
357 {                                                 378 {
358     fpMolecularConfiguration->PrintState();    << 379   fpMolecularConfiguration->PrintState();
359 }                                                 380 }
360                                                   381 
361 //____________________________________________    382 //______________________________________________________________________________
362                                                   383 
363 G4Track* G4Molecule::BuildTrack(G4double globa << 384 G4Track * G4Molecule::BuildTrack(G4double globalTime,
364                                  const G4Three    385                                  const G4ThreeVector& position)
365 {                                                 386 {
366     if (fpTrack != nullptr)                    << 387   if (fpTrack != 0){
367     {                                          << 388     G4Exception("G4Molecule::BuildTrack", "Molecule001", FatalErrorInArgument,
368         G4Exception("G4Molecule::BuildTrack",  << 389                 "A track was already assigned to this molecule");
369                     "A track was already assig << 390   }
370     }                                          << 391 
371                                                << 392   // Kinetic Values
372     // Kinetic Values                          << 393   // Set a random direction to the molecule
373     // Set a random direction to the molecule  << 394   G4double costheta = (2 * G4UniformRand()-1);
374     G4double costheta = (2 * G4UniformRand() - << 395   G4double theta = acos(costheta);
375     G4double theta = acos(costheta);           << 396   G4double phi = 2 * pi * G4UniformRand();
376     G4double phi = 2 * pi * G4UniformRand();   << 397 
377                                                << 398   G4double xMomentum = cos(phi) * sin(theta);
378     G4double xMomentum = cos(phi) * sin(theta) << 399   G4double yMomentum = sin(theta) * sin(phi);
379     G4double yMomentum = sin(theta) * sin(phi) << 400   G4double zMomentum = costheta;
380     G4double zMomentum = costheta;             << 401 
381                                                << 402   G4ThreeVector MomentumDirection(xMomentum, yMomentum, zMomentum);
382     G4ThreeVector MomentumDirection(xMomentum, << 403   G4double KineticEnergy = GetKineticEnergy();
383     G4double KineticEnergy = GetKineticEnergy( << 404 
384                                                << 405   G4DynamicParticle* dynamicParticle = new G4DynamicParticle(
385     auto  dynamicParticle = new G4DynamicParti << 406       fpMolecularConfiguration->GetDefinition(), MomentumDirection,
386         fpMolecularConfiguration->GetDefinitio << 407       KineticEnergy);
387         KineticEnergy);                        << 408 
388                                                << 409   if (G4VMoleculeCounter::InUse()){
389     if (G4VMoleculeCounter::Instance()->InUse( << 410     G4VMoleculeCounter::Instance()->
390     {                                          << 411       AddAMoleculeAtTime(fpMolecularConfiguration,
391         G4VMoleculeCounter::Instance()->       << 412                          globalTime,
392             AddAMoleculeAtTime(fpMolecularConf << 413                          &(fpTrack->GetPosition()));
393                                globalTime,     << 414   }
394                                &(fpTrack->GetP << 415 
395     }                                          << 416   //Set the Track
396                                                << 417   fpTrack = new G4Track(dynamicParticle, globalTime, position);
397     //Set the Track                            << 418   fpTrack->SetUserInformation(this);
398     fpTrack = new G4Track(dynamicParticle, glo << 
399     fpTrack->SetUserInformation(this);         << 
400                                                   419 
401     return fpTrack;                            << 420   return fpTrack;
402 }                                                 421 }
403                                                   422 
404 //____________________________________________    423 //______________________________________________________________________________
405                                                   424 
406 G4double G4Molecule::GetKineticEnergy() const     425 G4double G4Molecule::GetKineticEnergy() const
407 {                                                 426 {
408     ////                                       << 427   ////
409     // Ideal Gaz case                          << 428   // Ideal Gaz case
410     double v = GetDiffusionVelocity();         << 429   double v = GetDiffusionVelocity();
411     double E = (fpMolecularConfiguration->GetM << 430   double E = (fpMolecularConfiguration->GetMass() / (c_squared)) * (v * v) / 2.;
412     ////                                       << 431   ////
413     return E;                                  << 432   return E;
414 }                                                 433 }
415                                                   434 
416 //____________________________________________    435 //______________________________________________________________________________
417                                                   436 
418 G4double G4Molecule::GetDiffusionVelocity() co    437 G4double G4Molecule::GetDiffusionVelocity() const
419 {                                                 438 {
420     double moleculeMass = fpMolecularConfigura << 439   double moleculeMass = fpMolecularConfiguration->GetMass() / (c_squared);
421                                                   440 
422     ////                                       << 441   ////
423     // Different possibilities                 << 442   // Different possibilities
424     ////                                       << 443   ////
425     // Ideal Gaz case : Maxwell Boltzmann Dist << 444   // Ideal Gaz case : Maxwell Boltzmann Distribution
426     //    double sigma = k_Boltzmann * fgTempe << 445   //    double sigma = k_Boltzmann * fgTemperature / mass;
427     //    return G4RandGauss::shoot( 0, sigma  << 446   //    return G4RandGauss::shoot( 0, sigma );
428     ////                                       << 447   ////
429     // Ideal Gaz case : mean velocity from equ << 448   // Ideal Gaz case : mean velocity from equipartition theorem
430     return sqrt(3 * k_Boltzmann *              << 449   return sqrt(3 * k_Boltzmann *
431                 G4MolecularConfiguration::GetG << 450               G4MolecularConfiguration::GetGlobalTemperature()/ moleculeMass);
432     ////                                       << 451   ////
433     // Using this approximation for liquid is  << 452   // Using this approximation for liquid is wrong
434     // However the brownian process avoid taki << 453   // However the brownian process avoid taking
435     // care of energy consideration and plays  << 454   // care of energy consideration and plays only
436     // with positions                          << 455   // with positions
437 }                                                 456 }
438                                                   457 
439 //____________________________________________    458 //______________________________________________________________________________
440                                                   459 
441 // added - to be transformed in a "Decay metho    460 // added - to be transformed in a "Decay method"
442 const vector<const G4MolecularDissociationChan    461 const vector<const G4MolecularDissociationChannel*>*
443 G4Molecule::GetDissociationChannels() const    << 462 G4Molecule::GetDecayChannel() const
444 {                                                 463 {
445     return fpMolecularConfiguration->GetDissoc << 464   return fpMolecularConfiguration->GetDecayChannel();
446 }                                                 465 }
447                                                   466 
448 //____________________________________________    467 //______________________________________________________________________________
449                                                   468 
450 G4int G4Molecule::GetFakeParticleID() const       469 G4int G4Molecule::GetFakeParticleID() const
451 {                                                 470 {
452     return fpMolecularConfiguration->GetFakePa << 471   return fpMolecularConfiguration->GetFakeParticleID();
453 }                                                 472 }
454                                                   473 
455 //____________________________________________    474 //______________________________________________________________________________
456                                                   475 
457 G4int G4Molecule::GetMoleculeID() const           476 G4int G4Molecule::GetMoleculeID() const
458 {                                                 477 {
459     return fpMolecularConfiguration->GetMolecu << 478   return fpMolecularConfiguration->GetMoleculeID();
                                                   >> 479 }
                                                   >> 480 
                                                   >> 481 //______________________________________________________________________________
                                                   >> 482 
                                                   >> 483 void G4Molecule::SetDecayTime(G4double dynDecayTime)
                                                   >> 484 {
                                                   >> 485   fpMolecularConfiguration->SetDecayTime(dynDecayTime);
460 }                                                 486 }
461                                                   487 
462 //____________________________________________    488 //______________________________________________________________________________
463                                                   489 
464 G4double G4Molecule::GetDecayTime() const         490 G4double G4Molecule::GetDecayTime() const
465 {                                                 491 {
466     return fpMolecularConfiguration->GetDecayT << 492   return fpMolecularConfiguration->GetDecayTime();
                                                   >> 493 }
                                                   >> 494 
                                                   >> 495 //______________________________________________________________________________
                                                   >> 496 
                                                   >> 497 void G4Molecule::SetVanDerVaalsRadius(G4double dynVanDerVaalsRadius)
                                                   >> 498 {
                                                   >> 499   fpMolecularConfiguration->SetVanDerVaalsRadius(dynVanDerVaalsRadius);
467 }                                                 500 }
468                                                   501 
469 //____________________________________________    502 //______________________________________________________________________________
470                                                   503 
471 G4double G4Molecule::GetVanDerVaalsRadius() co    504 G4double G4Molecule::GetVanDerVaalsRadius() const
472 {                                                 505 {
473     return fpMolecularConfiguration->GetVanDer << 506   return fpMolecularConfiguration->GetVanDerVaalsRadius();
474 }                                                 507 }
475                                                   508 
476 //____________________________________________    509 //______________________________________________________________________________
477                                                   510 
478 G4int G4Molecule::GetCharge() const               511 G4int G4Molecule::GetCharge() const
479 {                                                 512 {
480     return fpMolecularConfiguration->GetCharge << 513   return fpMolecularConfiguration->GetCharge();
                                                   >> 514 }
                                                   >> 515 
                                                   >> 516 //______________________________________________________________________________
                                                   >> 517 
                                                   >> 518 void G4Molecule::SetMass(G4double aMass)
                                                   >> 519 {
                                                   >> 520   fpMolecularConfiguration->SetMass(aMass);
481 }                                                 521 }
482                                                   522 
483 //____________________________________________    523 //______________________________________________________________________________
484                                                   524 
485 G4double G4Molecule::GetMass() const              525 G4double G4Molecule::GetMass() const
486 {                                                 526 {
487     return fpMolecularConfiguration->GetMass() << 527   return fpMolecularConfiguration->GetMass();
488 }                                                 528 }
489                                                   529 
490 //____________________________________________    530 //______________________________________________________________________________
491                                                   531 
492 const G4ElectronOccupancy* G4Molecule::GetElec    532 const G4ElectronOccupancy* G4Molecule::GetElectronOccupancy() const
493 {                                                 533 {
494     return fpMolecularConfiguration->GetElectr << 534   return fpMolecularConfiguration->GetElectronOccupancy();
495 }                                                 535 }
496                                                   536 
497 //____________________________________________    537 //______________________________________________________________________________
498                                                   538 
499 const G4MoleculeDefinition* G4Molecule::GetDef    539 const G4MoleculeDefinition* G4Molecule::GetDefinition() const
500 {                                                 540 {
501     return fpMolecularConfiguration->GetDefini << 541   return fpMolecularConfiguration->GetDefinition();
                                                   >> 542 }
                                                   >> 543 
                                                   >> 544 //______________________________________________________________________________
                                                   >> 545 
                                                   >> 546 void G4Molecule::SetDiffusionCoefficient(G4double dynDiffusionCoefficient)
                                                   >> 547 {
                                                   >> 548   fpMolecularConfiguration->SetDiffusionCoefficient(dynDiffusionCoefficient);
502 }                                                 549 }
503                                                   550 
504 //____________________________________________    551 //______________________________________________________________________________
505                                                   552 
506 G4double G4Molecule::GetDiffusionCoefficient()    553 G4double G4Molecule::GetDiffusionCoefficient() const
507 {                                                 554 {
508     return fpMolecularConfiguration->GetDiffus << 555   return fpMolecularConfiguration->GetDiffusionCoefficient();
509 }                                                 556 }
510                                                   557 
511 //____________________________________________    558 //______________________________________________________________________________
512                                                   559 
513 G4double G4Molecule::GetDiffusionCoefficient(c << 560 G4double G4Molecule::GetDiffusionCoefficient(const G4Material* mat,
514                                              d    561                                              double temperature) const
515 {                                                 562 {
516     return fpMolecularConfiguration->GetDiffus << 563   return fpMolecularConfiguration->GetDiffusionCoefficient(mat,
517                                                << 564                                                            temperature);
518 }                                                 565 }
519                                                   566 
520 //____________________________________________    567 //______________________________________________________________________________
521                                                   568 
522 const G4MolecularConfiguration* G4Molecule::Ge << 569 G4MolecularConfiguration* G4Molecule::GetMolecularConfiguration() const
523 {                                                 570 {
524     return fpMolecularConfiguration;           << 571   return fpMolecularConfiguration;
525 }                                                 572 }
526                                                   573 
527 //____________________________________________    574 //______________________________________________________________________________
528                                                   575 
                                                   >> 576 //void G4Molecule::SetGlobalTemperature(G4double temperature)
                                                   >> 577 //{
                                                   >> 578 //  fgTemperature = temperature;
                                                   >> 579 //}
                                                   >> 580 //
                                                   >> 581 ////______________________________________________________________________________
                                                   >> 582 //
                                                   >> 583 //G4double G4Molecule::GetGlobalTemperature()
                                                   >> 584 //{
                                                   >> 585 //  return fgTemperature;
                                                   >> 586 //}
                                                   >> 587 
                                                   >> 588 //______________________________________________________________________________
                                                   >> 589 
529 const G4String& G4Molecule::GetLabel() const      590 const G4String& G4Molecule::GetLabel() const
530 {                                                 591 {
531     return fpMolecularConfiguration->GetLabel( << 592   return fpMolecularConfiguration->GetLabel();
                                                   >> 593 }
                                                   >> 594 
                                                   >> 595 //______________________________________________________________________________
                                                   >> 596 
                                                   >> 597 void G4Molecule::SetLabel(const G4String& label)
                                                   >> 598 {
                                                   >> 599   fpMolecularConfiguration->SetLabel(label);
532 }                                                 600 }
533                                                   601 
534 //____________________________________________    602 //______________________________________________________________________________
535                                                   603 
536 void G4Molecule::ChangeConfigurationToLabel(co    604 void G4Molecule::ChangeConfigurationToLabel(const G4String& label)
537 {                                                 605 {
538     // TODO check fpMolecularConfiguration alr << 606   // TODO check fpMolecularConfiguration already exists
539     // and new one as well                     << 607   // and new one as well
540     // TODO notify for stack change            << 608   // TODO notify for stack change
541     fpMolecularConfiguration = G4MolecularConf << 609   fpMolecularConfiguration =
542         fpMolecularConfiguration->GetDefinitio << 610       G4MolecularConfiguration::GetMolecularConfiguration(
                                                   >> 611           fpMolecularConfiguration->GetDefinition(), label);
543                                                   612 
544     assert(fpMolecularConfiguration != nullptr << 613   assert(fpMolecularConfiguration!=0);
545 }                                                 614 }
546                                                   615