Geant4  10.03
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 class G4Material;
84 
85 G4Molecule* GetMolecule(const G4Track& track);
86 G4Molecule* GetMolecule(const G4Track* track);
87 
94 class G4Molecule : public G4IT
95 {
96 
97 public:
98  // With Description
99 
101 
102  //From G4VUserTrackInformation
103  void Print() const;
104 
105  // new/delete operators are overloded to use G4Allocator
106  inline void *operator new(size_t);
107 #ifdef __IBMCPP__
108  inline void *operator new(size_t sz, void* p)
109  { return p;}
110 #endif
111  inline void operator delete(void*);
112 
113  G4Molecule(const G4Molecule&);
114  G4Molecule & operator=(const G4Molecule &right);
115  G4bool operator==(const G4Molecule &right) const;
116  G4bool operator!=(const G4Molecule &right) const;
117  G4bool operator<(const G4Molecule &right) const;
118 
119  operator int() const
120  {
121  return GetMoleculeID();
122  }
123 
124  virtual G4ITType GetITSubType() const
125  {
126  return GetMoleculeID();
127  }
128 
129 public:
130  //------ Constructors --------------------------
134  G4Molecule(G4MoleculeDefinition * molecule);
135 
136  G4Molecule(G4MoleculeDefinition* molDef, int charge);
137 
142 
148 
150 
151  virtual ~G4Molecule();
152 
153  //-------- Methods -------------------------------
154  //Get from static definition
157  const G4String& GetName() const;
158 
161  const G4String& GetFormatedName() const;
162 
165  G4int GetAtomsNumber() const;
166 
171 
174  void ExciteMolecule(G4int);
175 
178  void IonizeMolecule(G4int);
179 
184  void AddElectron(G4int orbit, G4int n = 1);
185 
188  void RemoveElectron(G4int, G4int number = 1);
189 
192  void MoveOneElectron(G4int /*orbit*/, G4int /*orbit*/);
193 
196  G4double GetNbElectrons() const; //This method can be used to check if the electron s number is physical
197 
200  void PrintState() const;
201 
202  G4Track * BuildTrack(G4double globalTime, const G4ThreeVector& Position);
203 
204  G4double GetKineticEnergy() const;
205 
207 
208  const std::vector<const G4MolecularDissociationChannel*>* GetDecayChannel() const;
209 
210  G4int GetFakeParticleID() const;
211  G4int GetMoleculeID() const;
212 
213  //-------------Inline functions ---------------------
217  const G4MoleculeDefinition* GetDefinition() const;
218 
219  //methods to set/get changing parameters
220 
222 
228 
232 
236  double temperature) const;
237 
240  void SetDecayTime(G4double);
241 
244  G4double GetDecayTime() const;
245 
250 
255 
258  G4int GetCharge() const;
259 
262  void SetMass(G4double);
263 
266  G4double GetMass() const;
267 
270  const G4String& GetLabel() const;
271 
272  void SetLabel(const G4String& label);
273 
274  void ChangeConfigurationToLabel(const G4String& label);
275 
277 
279 
280 // static void SetGlobalTemperature(G4double);
281 // static G4double GetGlobalTemperature();
282 
283  static G4Molecule* GetMolecule(const G4Track*);
284 
285 private:
288  G4Molecule();
289 
291 
292 // double fCachedDiffusionCoefficient;
293 
294 // static /*G4ThreadLocal*/double fgTemperature;
295 };
296 
297 #if defined G4EM_ALLOC_EXPORT
299 #else
301 #endif
302 
304 inline void * G4Molecule::operator new(size_t)
306 {
308  return (void *) aMoleculeAllocator->MallocSingle();
309 }
310 
312 inline void G4Molecule::operator delete(void * aMolecule)
314 {
315  aMoleculeAllocator->FreeSingle((G4Molecule *) aMolecule);
316 }
317 
318 #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:546
const std::vector< const G4MolecularDissociationChannel * > * GetDecayChannel() const
Definition: G4Molecule.cc:462
#define G4DLLEXPORT
Definition: G4Types.hh:62
G4bool operator!=(const G4Molecule &right) const
Definition: G4Molecule.cc:125
CLHEP::Hep3Vector G4ThreeVector
G4Molecule()
Default molecule builder.
Definition: G4Molecule.cc:144
#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:136
static G4Molecule * GetMolecule(const G4Track *)
Definition: G4Molecule.cc:83
G4double GetMass() const
Returns the total mass of the molecule.
Definition: G4Molecule.cc:525
void SetMass(G4double)
Set the total mass of the molecule.
Definition: G4Molecule.cc:518
void SetLabel(const G4String &label)
Definition: G4Molecule.cc:597
G4MolecularConfiguration * fpMolecularConfiguration
Definition: G4Molecule.hh:290
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:553
G4double GetNbElectrons() const
Returns the number of electron.
Definition: G4Molecule.cc:370
G4MolecularConfiguration * GetMolecularConfiguration() const
Definition: G4Molecule.cc:569
#define G4ThreadLocal
Definition: tls.hh:89
virtual ~G4Molecule()
Definition: G4Molecule.cc:153
int G4int
Definition: G4Types.hh:78
void ChangeConfigurationToLabel(const G4String &label)
Definition: G4Molecule.cc:604
const G4String & GetName() const
Returns the name of the molecule.
Definition: G4Molecule.cc:349
void MoveOneElectron(G4int, G4int)
Move one electron from an orbit to another.
Definition: G4Molecule.cc:341
const G4String & GetLabel() const
Returns the label of the molecule configuration.
Definition: G4Molecule.cc:590
void SetElectronOccupancy(const G4ElectronOccupancy *)
Will set up the correct molecularConfiguration given an electron configuration.
Definition: G4Molecule.cc:296
G4int GetAtomsNumber() const
Returns the nomber of atoms compouning the molecule.
Definition: G4Molecule.cc:363
G4int GetFakeParticleID() const
Definition: G4Molecule.cc:469
bool G4bool
Definition: G4Types.hh:79
void SetVanDerVaalsRadius(G4double)
The Van Der Valls Radius of the molecule.
Definition: G4Molecule.cc:497
G4Molecule & operator=(const G4Molecule &right)
Definition: G4Molecule.cc:105
const G4int n
G4Molecule * GetMolecule(const G4Track &track)
Definition: G4Molecule.cc:69
void IonizeMolecule(G4int)
Method used in Geant4-DNA to ionize water molecules.
Definition: G4Molecule.cc:317
const G4MoleculeDefinition * GetDefinition() const
Get molecule definition.
Definition: G4Molecule.cc:539
G4Track * BuildTrack(G4double globalTime, const G4ThreeVector &Position)
Definition: G4Molecule.cc:384
const G4String & GetFormatedName() const
Returns the formated name of the molecule.
Definition: G4Molecule.cc:356
G4int GetCharge() const
Returns the charge of molecule.
Definition: G4Molecule.cc:511
G4double GetKineticEnergy() const
Definition: G4Molecule.cc:425
void RemoveElectron(G4int, G4int number=1)
Remove n electrons to a given orbit.
Definition: G4Molecule.cc:333
G4DLLIMPORT G4ThreadLocal G4Allocator< G4Molecule > * aMoleculeAllocator
void PrintState() const
Show the electronic state of the molecule.
Definition: G4Molecule.cc:377
virtual G4ITType GetITSubType() const
Definition: G4Molecule.hh:124
G4double GetDiffusionVelocity() const
Definition: G4Molecule.cc:437
Class Description The dynamic molecule holds all the data that change for a molecule It has a pointer...
Definition: G4Molecule.hh:94
double G4double
Definition: G4Types.hh:76
const G4ElectronOccupancy * GetElectronOccupancy() const
Returns the object ElectronOccupancy describing the electronic configuration of the molecule...
Definition: G4Molecule.cc:532
G4double GetVanDerVaalsRadius() const
Definition: G4Molecule.cc:504
G4double GetDecayTime() const
Returns the decay time of the molecule.
Definition: G4Molecule.cc:490
{ Class description:
virtual void Print() const
Definition: G4IT.hh:94
void AddElectron(G4int orbit, G4int n=1)
Add n electrons to a given orbit.
Definition: G4Molecule.cc:325
G4bool operator==(const G4Molecule &right) const
Definition: G4Molecule.cc:114
void SetDecayTime(G4double)
Set the decay time of the molecule.
Definition: G4Molecule.cc:483
void ExciteMolecule(G4int)
Method used in Geant4-DNA to excite water molecules.
Definition: G4Molecule.cc:307
G4int GetMoleculeID() const
Definition: G4Molecule.cc:476