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