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 9.6.p4)


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