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