Geant4  10.01.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@cenbg.in2p3.fr
28 
29 // The code is developed in the framework of the ESA AO7146
30 //
31 // We would be very happy hearing from you, send us your feedback! :)
32 //
33 // In order for Geant4-DNA to be maintained and still open-source,
34 // article citations are crucial.
35 // If you use Geant4-DNA chemistry and you publish papers about your software,
36 // in addition to the general paper on Geant4-DNA:
37 //
38 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
39 //
40 // we would be very happy if you could please also cite the following
41 // reference papers on chemistry:
42 //
43 // J. Comput. Phys. 274 (2014) 841-882
44 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508
45 
46 #ifndef G4MolecularConfiguration_
47 #define G4MolecularConfiguration_ 1
48 
49 #include <vector>
50 #include <map>
51 #include <CLHEP/Utility/memory.h>
52 #include "G4Threading.hh"
53 
56 
57 #include "G4ElectronOccupancy.hh"
58 
59 struct comparator
60 {
61  bool operator()(const G4ElectronOccupancy& occ1,
62  const G4ElectronOccupancy& occ2) const
63  {
64  // Since this method is called a lot of time,
65  // we retrieve only once the totOcc
66  G4int totalOcc1 = occ1.GetTotalOccupancy();
67  G4int totalOcc2 = occ2.GetTotalOccupancy();
68  if (totalOcc1 != totalOcc2)
69  {
70  return totalOcc1 < totalOcc2;
71  }
72  else
73  {
74  G4int occupancy1 = -1;
75  G4int occupancy2 = -1;
76  const G4int sizeOrbit = occ1.GetSizeOfOrbit();
77  for (G4int i = 0; i < occ1.GetSizeOfOrbit();)
78  {
79  // Since this method is called a lot of time,
80  // we retrieve only once the Occ
81 
82  occupancy1 = occ1.GetOccupancy(i);
83  occupancy2 = occ2.GetOccupancy(i);
84 
85  if (occupancy1 != occupancy2)
86  {
87  return occupancy1 < occupancy2;
88  }
89  else
90  {
91  i++;
92  if (i >= sizeOrbit) return false;
93  }
94  }
95  }
96  return false;
97  }
98 };
99 
107 {
108 public:
109 
111  // Static methods
112 
113  // Get ground state electronic configuration
115 
116  // Get for a given moleculeDefinition and a given electronic configuration, the mol conf
118  const G4ElectronOccupancy& electronOccupancy);
119 
120  // Get for a given moleculeDefinition and a given electronic configuration, the mol conf
122  int charge);
123 
124  // Release memory of the mol conf manager
125  static void DeleteManager();
127 
128  // Methods
129  const G4MoleculeDefinition* GetDefinition() const;
130 
133  const G4String& GetName() const;
134 
137  const G4String& GetFormatedName() const;
138 
141  G4int GetAtomsNumber() const;
142 
146 
150 
156 
160 
163  G4MolecularConfiguration* MoveOneElectron(G4int /*orbit*/, G4int /*orbit*/);
164 
167  G4double GetNbElectrons() const;
168 
171  void PrintState() const;
172 
173  const std::vector<const G4MolecularDissociationChannel*>* GetDecayChannel() const;
174 
175  G4int GetFakeParticleID() const;
176 
177  inline G4int GetMoleculeID() const;
178 
190  inline void SetDiffusionCoefficient(G4double);
191 
194  inline G4double GetDiffusionCoefficient() const;
195 
198  inline void SetDecayTime(G4double);
199 
202  inline G4double GetDecayTime() const;
203 
206  inline void SetVanDerVaalsRadius(G4double);
207  inline G4double GetVanDerVaalsRadius() const;
208 
212  inline const G4ElectronOccupancy* GetElectronOccupancy() const;
213 
216  inline G4int GetCharge() const;
217 
220  inline void SetMass(G4double);
221 
224  inline G4double GetMass() const;
225 
226 protected:
228  const G4ElectronOccupancy&);
235 
238 
239  void CheckElectronOccupancy(const char* line) const;
240 
241 public:
243  {
244  public:
247  {
248  fLastMoleculeID = -1;
249  }
251 
253  const G4ElectronOccupancy& eOcc,
254  G4MolecularConfiguration* molConf);
255 
257  int charge,
258  G4MolecularConfiguration* molConf);
259 
261  const G4ElectronOccupancy& eOcc);
262 
264  const G4ElectronOccupancy& eOcc);
265 
267  int charge);
268 
270 
272 
273  private:
274  typedef std::map<const G4MoleculeDefinition*,
275  std::map<G4ElectronOccupancy, G4MolecularConfiguration*, comparator> > MolecularConfigurationTable;
276  MolecularConfigurationTable fTable;
277  typedef std::map<const G4MoleculeDefinition*,
278  std::map<int, G4MolecularConfiguration*, comparator> > MolChargeConfigurationTable;
279  MolChargeConfigurationTable fChargeTable;
281 
283  };
284 
285 protected:
288 
295  /*mutable*/ G4String fFormatedName;
296  /*mutable*/ G4String fName;
297 };
298 
300 {
301  return fMoleculeDefinition;
302 }
303 
305 {
306  return fElectronOccupancy;
307 }
308 
310 {
311  fDynDiffusionCoefficient = dynDiffusionCoefficient;
312 }
313 
315 {
317 }
318 
320 {
321  fDynDecayTime = dynDecayTime;
322 }
323 
325 {
326  return fDynDecayTime;
327 }
328 
330 {
331  fDynVanDerVaalsRadius = dynVanDerVaalsRadius;
332 }
333 
335 {
336  return fDynVanDerVaalsRadius;
337 }
338 
340 {
341  return fDynCharge;
342 }
343 
345 {
346  fDynMass = aMass;
347 }
348 
350 {
351  return fDynMass;
352 }
353 
355 {
356  return fMoleculeID;
357 }
358 #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)
G4int SetMolecularConfiguration(const G4MoleculeDefinition *molDef, const G4ElectronOccupancy &eOcc, G4MolecularConfiguration *molConf)
G4double GetNbElectrons() const
Returns the number of electron.
G4int GetSizeOfOrbit() const
const std::vector< const G4MolecularDissociationChannel * > * GetDecayChannel() const
const G4ElectronOccupancy * FindCommonElectronOccupancy(const G4MoleculeDefinition *molDef, const G4ElectronOccupancy &eOcc)
const G4ElectronOccupancy * GetElectronOccupancy() const
Returns the object ElectronOccupancy describing the electronic configuration of the molecule...
int G4int
Definition: G4Types.hh:78
std::map< const G4MoleculeDefinition *, std::map< int, G4MolecularConfiguration *, comparator > > MolChargeConfigurationTable
static G4MolecularConfigurationManager * fgManager
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.
void CheckElectronOccupancy(const char *line) const
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)
static G4MolecularConfiguration * GetMolecularConfiguration(const G4MoleculeDefinition *)
const G4int n
static G4MolecularConfigurationManager * GetManager()
G4double GetMass() const
Returns the total mass of the molecule.
G4int G4Mutex
Definition: G4Threading.hh:169
const G4String & GetFormatedName() const
Returns the formated name of the molecule.
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
std::map< const G4MoleculeDefinition *, std::map< G4ElectronOccupancy, G4MolecularConfiguration *, comparator > > MolecularConfigurationTable
G4MolecularConfiguration(const G4MoleculeDefinition *, const G4ElectronOccupancy &)
G4MolecularConfiguration * GetMolecularConfiguration(const G4MoleculeDefinition *molDef, const G4ElectronOccupancy &eOcc)
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