Geant4  10.01
G4Molecule.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // Contact: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
27 //
28 // WARNING : This class is released as a prototype.
29 // It might strongly evolve or even disapear in the next releases.
30 //
31 // The code is developed in the framework of the ESA AO7146
32 //
33 // We would be very happy hearing from you, send us your feedback! :)
34 //
35 // In order for Geant4-DNA to be maintained and still open-source,
36 // article citations are crucial.
37 // If you use Geant4-DNA chemistry and you publish papers about your software,
38 // in addition to the general paper on Geant4-DNA:
39 //
40 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
41 //
42 // we would be very happy if you could please also cite the following
43 // reference papers on chemistry:
44 //
45 // J. Comput. Phys. 274 (2014) 841-882
46 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508
47 //
48 // ---------------------------------------------------------------------
49 // GEANT 4 class header file
50 //
51 // History: first implementation, based on G4DynamicParticle
52 // New dependency : G4VUserTrackInformation
53 //
54 // ---------------- G4Molecule ----------------
55 // first design&implementation by Alfonso Mantero, 7 Apr 2009
56 // New developments Alfonso Mantero & Mathieu Karamitros
57 // Oct/Nov 2009 Class Name changed to G4Molecule
58 // Removed dependency from G4DynamicParticle
59 // New constructors :
60 // copy constructor
61 // direct ionized/excited molecule
62 // New methods :
63 // Get : name,atoms' number,nb electrons,decayChannel
64 // PrintState //To get the electronic level and the
65 // corresponding name of the excitation
66 // Kinematic :
67 // BuildTrack,GetKineticEnergy,GetDiffusionVelocity
68 // Change the way dynCharge and eNb is calculated
69 // ---------------------------------------------------------------------
70 
71 #ifndef G4Molecule_h
72 #define G4Molecule_h 1
73 
74 #include "G4IT.hh"
75 #include "G4Allocator.hh"
76 #include "G4MoleculeDefinition.hh"
77 
78 class G4Molecule;
82 class G4DynamicParticle;
83 
84 G4Molecule* GetMolecule(const G4Track& track);
85 G4Molecule* GetMolecule(const G4Track* track);
86 
93 class G4Molecule : public G4IT
94 {
95 
96 public:
97  // With Description
98 
100 
101  //From G4VUserTrackInformation
102  void Print() const;
103 
104  // new/delete operators are overloded to use G4Allocator
105  inline void *operator new(size_t);
106 #ifdef __IBMCPP__
107  inline void *operator new(size_t sz, void* p)
108  { return p;}
109 #endif
110  inline void operator delete(void*);
111 
112  G4Molecule(const G4Molecule&);
113  G4Molecule & operator=(const G4Molecule &right);
114  G4bool operator==(const G4Molecule &right) const;
115  G4bool operator!=(const G4Molecule &right) const;
116  G4bool operator<(const G4Molecule &right) const;
117 
118  virtual G4ITType GetITSubType() const
119  {
120  return GetMoleculeID();
121  }
122 
123 public:
124  //------ Constructors --------------------------
128  G4Molecule(G4MoleculeDefinition * molecule);
129 
130  G4Molecule(G4MoleculeDefinition* molDef, int charge);
131 
136 
142 
143  virtual ~G4Molecule();
144 
145  //-------- Methods -------------------------------
146  //Get from static definition
149  const G4String& GetName() const;
150 
153  const G4String& GetFormatedName() const;
154 
157  G4int GetAtomsNumber() const;
158 
163 
166  void ExciteMolecule(G4int);
167 
170  void IonizeMolecule(G4int);
171 
176  void AddElectron(G4int orbit, G4int n = 1);
177 
180  void RemoveElectron(G4int, G4int number = 1);
181 
184  void MoveOneElectron(G4int /*orbit*/, G4int /*orbit*/);
185 
188  G4double GetNbElectrons() const; //This method can be used to check if the electron s number is physical
189 
192  void PrintState() const;
193 
194  G4Track * BuildTrack(G4double globalTime, const G4ThreeVector& Position);
195 
196  G4double GetKineticEnergy() const;
197 
199 
200  const std::vector<const G4MolecularDissociationChannel*>* GetDecayChannel() const;
201 
202  G4int GetFakeParticleID() const;
203  G4int GetMoleculeID() const;
204 
205  //-------------Inline functions ---------------------
209  const G4MoleculeDefinition* GetDefinition() const;
210 
211  //methods to set/get changing parameters
212 
214 
220 
224 
227  void SetDecayTime(G4double);
228 
231  G4double GetDecayTime() const;
232 
237 
242 
245  G4int GetCharge() const;
246 
249  void SetMass(G4double);
250 
253  G4double GetMass() const;
255 
257 
258  static void SetGlobalTemperature(G4double);
260 
261  static G4Molecule* GetMolecule(const G4Track*);
262 
263 private:
266  G4Molecule();
267 
269 
270  static /*G4ThreadLocal*/double fgTemperature;
271 };
272 
273 #if defined G4EM_ALLOC_EXPORT
275 #else
277 #endif
278 
280 inline void * G4Molecule::operator new(size_t)
282 {
284  return (void *) aMoleculeAllocator->MallocSingle();
285 }
286 
288 inline void G4Molecule::operator delete(void * aMolecule)
290 {
291  aMoleculeAllocator->FreeSingle((G4Molecule *) aMolecule);
292 }
293 
294 #endif
The pointer G4MolecularConfiguration will be shared by all the molecules having the same molecule def...
ITDef(G4Molecule) void Print() const
void SetDiffusionCoefficient(G4double)
Sets the diffusion coefficient D of the molecule used in diffusion processes to calculate the mean sq...
Definition: G4Molecule.cc:460
const std::vector< const G4MolecularDissociationChannel * > * GetDecayChannel() const
Definition: G4Molecule.cc:400
#define G4DLLEXPORT
Definition: G4Types.hh:62
G4bool operator!=(const G4Molecule &right) const
Definition: G4Molecule.cc:109
CLHEP::Hep3Vector G4ThreeVector
G4Molecule()
Default molecule builder.
Definition: G4Molecule.cc:128
#define G4DLLIMPORT
Definition: G4Types.hh:63
G4bool operator<(const G4Molecule &right) const
The two methods below are the most called of the simulation : compare molecules in the MoleculeStackM...
Definition: G4Molecule.cc:119
static G4Molecule * GetMolecule(const G4Track *)
Definition: G4Molecule.cc:77
G4double GetMass() const
Returns the total mass of the molecule.
Definition: G4Molecule.cc:445
void SetMass(G4double)
Set the total mass of the molecule.
Definition: G4Molecule.cc:440
G4MolecularConfiguration * fpMolecularConfiguration
Definition: G4Molecule.hh:268
Tag the G4IT Should be automatically setup by G4IT using : ITDef(MyIT) and ITImp(MyIT) ...
Definition: G4ITType.hh:60
G4double GetDiffusionCoefficient() const
Returns the diffusion coefficient D.
Definition: G4Molecule.cc:465
G4double GetNbElectrons() const
Returns the number of electron.
Definition: G4Molecule.cc:318
G4MolecularConfiguration * GetMolecularConfiguration() const
Definition: G4Molecule.cc:470
#define G4ThreadLocal
Definition: tls.hh:84
virtual ~G4Molecule()
Definition: G4Molecule.cc:136
int G4int
Definition: G4Types.hh:78
static G4double GetGlobalTemperature()
Definition: G4Molecule.cc:480
const G4String & GetName() const
Returns the name of the molecule.
Definition: G4Molecule.cc:303
void MoveOneElectron(G4int, G4int)
Move one electron from an orbit to another.
Definition: G4Molecule.cc:297
void SetElectronOccupancy(const G4ElectronOccupancy *)
Will set up the correct molecularConfiguration given an electron configuration.
Definition: G4Molecule.cc:262
G4int GetAtomsNumber() const
Returns the nomber of atoms compouning the molecule.
Definition: G4Molecule.cc:313
G4int GetFakeParticleID() const
Definition: G4Molecule.cc:405
bool G4bool
Definition: G4Types.hh:79
void SetVanDerVaalsRadius(G4double)
The Van Der Valls Radius of the molecule.
Definition: G4Molecule.cc:425
G4Molecule & operator=(const G4Molecule &right)
Definition: G4Molecule.cc:93
const G4int n
G4Molecule * GetMolecule(const G4Track &track)
Definition: G4Molecule.cc:67
void IonizeMolecule(G4int)
Method used in Geant4-DNA to ionize water molecules.
Definition: G4Molecule.cc:279
const G4MoleculeDefinition * GetDefinition() const
Get molecule definition.
Definition: G4Molecule.cc:455
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
Definition: G4Molecule.cc:328
const G4String & GetFormatedName() const
Returns the formated name of the molecule.
Definition: G4Molecule.cc:308
G4int GetCharge() const
Returns the charge of molecule.
Definition: G4Molecule.cc:435
G4double GetKineticEnergy() const
Definition: G4Molecule.cc:368
void RemoveElectron(G4int, G4int number=1)
Remove n electrons to a given orbit.
Definition: G4Molecule.cc:291
G4DLLIMPORT G4ThreadLocal G4Allocator< G4Molecule > * aMoleculeAllocator
void PrintState() const
Show the electronic state of the molecule.
Definition: G4Molecule.cc:323
virtual G4ITType GetITSubType() const
Definition: G4Molecule.hh:118
G4double GetDiffusionVelocity() const
Definition: G4Molecule.cc:378
Class Description The dynamic molecule holds all the data that change for a molecule It has a pointer...
Definition: G4Molecule.hh:93
double G4double
Definition: G4Types.hh:76
const G4ElectronOccupancy * GetElectronOccupancy() const
Returns the object ElectronOccupancy describing the electronic configuration of the molecule...
Definition: G4Molecule.cc:450
G4double GetVanDerVaalsRadius() const
Definition: G4Molecule.cc:430
static void SetGlobalTemperature(G4double)
Definition: G4Molecule.cc:475
G4double GetDecayTime() const
Returns the decay time of the molecule.
Definition: G4Molecule.cc:420
{ Class description:
virtual void Print() const
Definition: G4IT.hh:104
void AddElectron(G4int orbit, G4int n=1)
Add n electrons to a given orbit.
Definition: G4Molecule.cc:285
G4bool operator==(const G4Molecule &right) const
Definition: G4Molecule.cc:100
void SetDecayTime(G4double)
Set the decay time of the molecule.
Definition: G4Molecule.cc:415
static double fgTemperature
Definition: G4Molecule.hh:270
void ExciteMolecule(G4int)
Method used in Geant4-DNA to excite water molecules.
Definition: G4Molecule.cc:271
G4int GetMoleculeID() const
Definition: G4Molecule.cc:410