Geant4  10.00.p01
G4MolecularConfiguration.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 //
27 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
28 //
29 // WARNING : This class is released as a prototype.
30 // It might strongly evolve or even disapear in the next releases.
31 //
32 // History:
33 // -----------
34 // 10 Oct 2011 M.Karamitros created
35 //
36 // -------------------------------------------------------------------
37 
38 
39 #ifndef G4MolecularConfiguration_
40 #define G4MolecularConfiguration_ 1
41 #include <G4MoleculeDefinition.hh>
42 #include <map>
43 #include <vector>
44 #include <CLHEP/Utility/memory.h>
45 
46 struct comparator;
47 
52 
60 {
61 public :
62 
64  // Static methods
65 
66  // Get for a given moleculeDefinition and a given electronic configuration, the mol conf
68  const G4ElectronOccupancy& electronOccupancy);
69 
70  // Get ground state electronic configuration
72 
73  // Release memory of the mol conf manager
74  static void DeleteManager();
76 
77  // Methods
78  const G4MoleculeDefinition* GetDefinition() const;
79 
82  const G4String& GetName() const;
83 
86  G4int GetAtomsNumber() const;
87 
91 
95 
101 
105 
108  G4MolecularConfiguration* MoveOneElectron(G4int /*orbit*/,G4int /*orbit*/);
109 
112  G4double GetNbElectrons() const;
113 
116  void PrintState() const;
117 
118  const std::vector <const G4MolecularDecayChannel*>* GetDecayChannel() const;
119 
120  G4int GetMoleculeID() const;
121 
133  inline void SetDiffusionCoefficient(G4double);
134 
137  inline G4double GetDiffusionCoefficient() const;
138 
141  inline void SetDecayTime(G4double);
142 
145  inline G4double GetDecayTime() const;
146 
149  inline void SetVanDerVaalsRadius(G4double);
150  inline G4double GetVanDerVaalsRadius() const ;
151 
155  inline const G4ElectronOccupancy* GetElectronOccupancy() const;
156 
159  inline G4int GetCharge() const;
160 
163  inline void SetMass(G4double);
164 
167  inline G4double GetMass() const;
168 
169 protected :
175 
178 
179 public:
181  {
184 
185  typedef std::map<const G4MoleculeDefinition*, std::map<G4ElectronOccupancy, G4MolecularConfiguration*, comparator> > MolecularConfigurationTable;
186  MolecularConfigurationTable fTable;
187  };
188 
189 protected:
191 
193 
199  mutable G4String fName; // mutable allowed this member to be changed in const methods
200 };
201 
203 {
204  bool operator() (const G4ElectronOccupancy& occ1, const G4ElectronOccupancy& occ2) const
205  {
206  // Since this method is called a lot of time,
207  // we retrieve only once the totOcc
208  G4int totalOcc1 = occ1.GetTotalOccupancy() ;
209  G4int totalOcc2 = occ2.GetTotalOccupancy() ;
210  if ( totalOcc1!= totalOcc2)
211  {
212  return totalOcc1<totalOcc2;
213  }
214  else
215  {
216  G4int occupancy1 = -1 ;
217  G4int occupancy2 = -1 ;
218  const G4int sizeOrbit = occ1.GetSizeOfOrbit() ;
219  for (G4int i=0; i<occ1.GetSizeOfOrbit();)
220  {
221  // Since this method is called a lot of time,
222  // we retrieve only once the Occ
223 
224  occupancy1 = occ1.GetOccupancy(i);
225  occupancy2 = occ2.GetOccupancy(i);
226 
227  if (occupancy1 != occupancy2)
228  {
229  return occupancy1 < occupancy2;
230  }
231  else
232  {
233  i++;
234  if (i >= sizeOrbit) return false;
235  }
236  }
237  }
238  return false;
239  }
240 };
241 
242 
244 {
245  return fMoleculeDefinition;
246 }
247 
249 {
250  return fElectronOccupancy ;
251 }
252 
254 {
255  fDynDiffusionCoefficient = dynDiffusionCoefficient ;
256 }
257 
259 {
261 }
262 
264 {
265  fDynDecayTime = dynDecayTime;
266 }
267 
269 {
270  return fDynDecayTime;
271 }
272 
274 {
275  fDynVanDerVaalsRadius = dynVanDerVaalsRadius ;
276 }
277 
279 {
280  return fDynVanDerVaalsRadius;
281 }
282 
284 {
285  return fDynCharge ;
286 }
287 
289 {
290  fDynMass = aMass ;
291 }
292 
294 {
295  return fDynMass;
296 }
297 #endif
The pointer G4MolecularConfiguration will be shared by all the molecules having the same molecule def...
G4double GetDiffusionCoefficient() const
Returns the diffusion coefficient D.
void PrintState() const
Display the electronic state of the molecule.
G4int GetCharge() const
Returns the charge of molecule.
const G4String & GetName() const
Returns the name of the molecule.
G4int GetTotalOccupancy() const
G4MolecularConfiguration * ChangeConfiguration(const G4ElectronOccupancy &newElectronOccupancy)
static G4MolecularConfiguration * GetMolecularConfiguration(const G4MoleculeDefinition *, const G4ElectronOccupancy &electronOccupancy)
G4double GetNbElectrons() const
Returns the number of electron.
G4int GetSizeOfOrbit() const
const G4ElectronOccupancy * GetElectronOccupancy() const
Returns the object ElectronOccupancy describing the electronic configuration of the molecule...
#define G4ThreadLocal
Definition: tls.hh:52
int G4int
Definition: G4Types.hh:78
const std::vector< const G4MolecularDecayChannel * > * GetDecayChannel() const
bool operator()(const G4ElectronOccupancy &occ1, const G4ElectronOccupancy &occ2) const
G4int GetOccupancy(G4int orbit) const
G4MolecularConfiguration * IonizeMolecule(G4int)
Method used in Geant4-DNA to ionize water molecules.
G4MolecularConfiguration * AddElectron(G4int orbit, G4int n=1)
Add n electrons to a given orbit.
std::map< const G4MoleculeDefinition *, std::map< G4ElectronOccupancy, G4MolecularConfiguration *, comparator > > MolecularConfigurationTable
G4MolecularConfiguration * MoveOneElectron(G4int, G4int)
Move one electron from an orbit to another.
void SetDiffusionCoefficient(G4double)
Sets the diffusion coefficient D of the molecule used in diffusion processes to calculate the mean sq...
G4MolecularConfiguration & operator=(G4MolecularConfiguration &right)
const G4int n
static G4MolecularConfigurationManager * GetManager()
G4double GetMass() const
Returns the total mass of the molecule.
static G4ThreadLocal G4MolecularConfigurationManager * fgManager
void SetMass(G4double)
Set the total mass of the molecule.
void SetDecayTime(G4double)
Set the decay time of the molecule.
void SetVanDerVaalsRadius(G4double)
The Van Der Valls Radius of the molecule.
G4int GetAtomsNumber() const
Returns the nomber of atoms compouning the molecule.
const G4MoleculeDefinition * GetDefinition() const
G4MolecularConfiguration(const G4MoleculeDefinition *, const G4ElectronOccupancy &)
G4double GetDecayTime() const
Returns the decay time of the molecule.
double G4double
Definition: G4Types.hh:76
G4MolecularConfiguration * RemoveElectron(G4int, G4int number=1)
Remove n electrons to a given orbit.
const G4ElectronOccupancy * fElectronOccupancy
G4MolecularConfiguration * ExciteMolecule(G4int)
Method used in Geant4-DNA to excite water molecules.
const G4MoleculeDefinition * fMoleculeDefinition