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.4.p2)


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