Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4MolecularConfiguration.hh
이 파일의 문서화 페이지로 가기
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
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 "G4Threading.hh"
52 #include "G4ElectronOccupancy.hh"
53 #include <cassert>
54 #include <functional>
55 
58 class G4Material;
60 
61 struct comparator
62 {
63  bool operator()(const G4ElectronOccupancy& occ1,
64  const G4ElectronOccupancy& occ2) const
65  {
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 < sizeOrbit; i++)
78  {
79  occupancy1 = occ1.GetOccupancy(i);
80  occupancy2 = occ2.GetOccupancy(i);
81 
82  if (occupancy1 != occupancy2)
83  {
84  return occupancy1 < occupancy2;
85  }
86  }
87  }
88  return false;
89  }
90 };
91 
99 {
100 public:
101 
102  typedef std::function<double(const G4Material*,
103  double,
105 
106  //____________________________________________________________________________
107  // Static methods
108 
110  // CREATE FINALIZED SPECIES
111  // Get ground state electronic configuration
114 
115  // Get for a given moleculeDefinition and a given electronic configuration,
116  // the molecular configuration
119  const G4ElectronOccupancy& eOcc);
120 
121  // Get for a given moleculeDefinition and a given electronic configuration,
122  // the molecular configuration
125 
127  // CREATE UNFINALIZED SPECIES
128  // Create ground state electronic configuration - to be finalized
130  CreateMolecularConfiguration(const G4String& userIdentifier,
131  const G4MoleculeDefinition*,
132  bool& wasAlreadyCreated);
133 
135  CreateMolecularConfiguration(const G4String& userIdentifier,
136  const G4MoleculeDefinition*,
137  const G4String& label,
138  const G4ElectronOccupancy& eOcc,
139  bool& wasAlreadyCreated);
140 
142  CreateMolecularConfiguration(const G4String& userIdentifier,
143  const G4MoleculeDefinition*,
144  int charge,
145  const G4String& label,
146  bool& wasAlreadyCreated);
147 
149  CreateMolecularConfiguration(const G4String& userIdentifier,
150  const G4MoleculeDefinition*,
151  const G4String& label,
152  bool& wasAlreadyCreated);
153 
155  // GET MOL CONF
156  //
159  const G4String& label);
160 
162  GetMolecularConfiguration(int moleculeID);
163 
165  GetMolecularConfiguration(const G4String& userID);
166 
167  static int GetNumberOfSpecies();
168 
169  static std::map<G4String, G4MolecularConfiguration*>& GetUserIDTable()
170  {
171  return GetManager()->GetUserIDTable();
172  }
173 
174  // Release memory of the mol conf manager
175  static void DeleteManager();
176 
177  static double DiffCoeffWater(double temperature_K);
178 
180 
181  //____________________________________________________________________________
182 
183  const G4MoleculeDefinition* GetDefinition() const;
184 
187  const G4String& GetName() const;
188 
191  const G4String& GetFormatedName() const;
192 
195  G4int GetAtomsNumber() const;
196 
200 
204 
210 
214 
217  G4MolecularConfiguration* MoveOneElectron(G4int /*orbit*/, G4int /*orbit*/);
218 
221  G4double GetNbElectrons() const;
222 
225  void PrintState() const;
226 
227  const std::vector<const G4MolecularDissociationChannel*>*
228  GetDecayChannel() const;
229 
230  G4int GetFakeParticleID() const;
231 
232  inline G4int GetMoleculeID() const;
233 
245  inline void SetDiffusionCoefficient(G4double);
246 
249  inline G4double GetDiffusionCoefficient() const;
250 
252  double temperature) const;
253 
256  inline void SetDecayTime(G4double);
257 
260  inline G4double GetDecayTime() const;
261 
264  inline void SetVanDerVaalsRadius(G4double);
265  inline G4double GetVanDerVaalsRadius() const;
266 
270  inline const G4ElectronOccupancy* GetElectronOccupancy() const;
271 
274  inline G4int GetCharge() const;
275 
278  inline void SetMass(G4double);
279 
282  inline G4double GetMass() const;
283 
284  /*
285  * Adds a label to the molecular configuration
286  * (Can be used for vibrational states for instance)
287  */
288  inline void SetLabel(const G4String&);
289 
290  /*
291  * Returns the label assigned by the user
292  */
293  inline const G4String& GetLabel() const;
294 
295  inline void Finalize();
296  static void FinalizeAll();
297 
298  inline const G4String& GetUserID() const;
299 
300  static void SetGlobalTemperature(G4double);
302 
303  //___________________________________________________________________________
304  // EXPERIMENTAL
305 
306  static G4MolecularConfiguration* Load(std::istream&);
307 
308  void Serialize(std::ostream&);
309  void Unserialize(std::istream&);
310  //___________________________________________________________________________
311 
312 
313 protected:
315  const G4ElectronOccupancy&,
316  const G4String& label = "");
317 
319  int charge);
320 
322  const G4String& label,
323  int charge);
324 
325  G4MolecularConfiguration(std::istream&);
326 
332 
333  void CheckElectronOccupancy(const char* line) const;
335  void SetUserID(const G4String& userID);
336 
338  static void ScaleAllDiffusionCoefficientsOnWater(double temperature_K);
339 
340 public:
342  {
343  public:
346  {
347  fLastMoleculeID = -1;
348  }
350 
352  {
353  return fLastMoleculeID+1;
354  }
355 
356  // TODO: TO BE IMPLEMENTED
357 // void InsertMolecularConfiguration(G4MolecularConfiguration*);
358 
359  //------------------------------------------------------------------------
360  // CALLED FROM CONSTRUCTORS
361  G4int Insert(const G4MoleculeDefinition* molDef,
362  const G4ElectronOccupancy& eOcc,
363  G4MolecularConfiguration* molConf);
364 
365  G4int Insert(const G4MoleculeDefinition* molDef,
366  int charge,
367  G4MolecularConfiguration* molConf);
368 
369  G4int Insert(const G4MoleculeDefinition* molDef,
370  const G4String& label,
371  G4MolecularConfiguration* molConf);
372 
373  //------------------------------------------------------------------------
374  // CALLED WHEN USER ADD SPECIES
375  void AddUserID(const G4String& name,
376  G4MolecularConfiguration* molecule);
377 
379 
380  const G4ElectronOccupancy*
382  const G4ElectronOccupancy& eOcc);
383 
386  const G4ElectronOccupancy& eOcc);
387 
390  int charge);
391 
394  const G4String& label);
395 
397 
399 
402  const G4ElectronOccupancy& eOcc);
403 
406  int charge);
407 
409 
411 
412  const std::vector<G4MolecularConfiguration*>& GetAllSpecies()
413  {
414  return fMolConfPerID;
415  }
416 
417  std::map<G4String, G4MolecularConfiguration*>& GetUserIDTable()
418  {
419  return fUserIDTable;
420  }
421 
422  private:
423 
424  //__________________________________________________________________________
425  typedef std::map<G4ElectronOccupancy,
428  typedef std::map<const G4MoleculeDefinition*,
431 
432  //__________________________________________________________________________
433  typedef std::map<int,
435  typedef std::map<const G4MoleculeDefinition*,
438 
439  //__________________________________________________________________________
440  typedef std::map<const G4String,
442  typedef std::map<const G4MoleculeDefinition*,
443  std::map<const G4String, G4MolecularConfiguration*> > MolLabelConfTable;
445 
446  //__________________________________________________________________________
447  typedef std::map<G4String, G4MolecularConfiguration*> UserIDTable;
449 
450  //__________________________________________________________________________
451  std::vector<G4MolecularConfiguration*> fMolConfPerID;
452  // Indexed by molecule ID
453 
454  //__________________________________________________________________________
457  };
458 
459 protected:
462 
465 
466  mutable G4String* fLabel;
467 
474  /*mutable*/ G4String fFormatedName;
475  /*mutable*/ G4String fName;
478 
480  static /*G4ThreadLocal*/double fgTemperature;
481 
482  static double ReturnDefaultDiffCoeff(const G4Material*,
483  double,
485  molConf);
486 };
487 
489 {
490  return fMoleculeDefinition;
491 }
492 
494 {
495  return fElectronOccupancy;
496 }
497 
499 {
501  fDynDiffusionCoefficient = dynDiffusionCoefficient;
502 }
503 
505 {
507 }
508 
510 {
512  fDynDecayTime = dynDecayTime;
513 }
514 
516 {
517  return fDynDecayTime;
518 }
519 
521 {
523  fDynVanDerVaalsRadius = dynVanDerVaalsRadius;
524 }
525 
527 {
528  return fDynVanDerVaalsRadius;
529 }
530 
532 {
533  return fDynCharge;
534 }
535 
537 {
539  fDynMass = aMass;
540 }
541 
543 {
544  return fDynMass;
545 }
546 
548 {
549  return fMoleculeID;
550 }
551 
553 {
554  assert(fLabel == 0 || *fLabel == "");
555  if(fLabel == 0)
556  {
557  fLabel = new G4String(label);
558  }
559  else
560  {
561  *fLabel = label;
562  }
564 }
565 
567 {
568  if(fLabel == 0)
569  fLabel = new G4String();
570 
571  return (*fLabel);
572 }
573 
575 {
577  fIsFinalized = true;
578 }
579 
581 {
582  return fUserIdentifier;
583 }
584 
586 (const G4DiffCoeffParam& para)
587 {
588  fDiffParam = para;
589 }
590 
591 inline G4double
593  double temperature) const
594 {
595  return fDiffParam(material, temperature, this);
596 }
597 
598 #endif
std::map< const G4MoleculeDefinition *, ElectronOccupancyTable > MolElectronConfTable
void CheckElectronOccupancy(const char *line) const
const XML_Char * name
Definition: expat.h:151
G4double(* function)(G4double)
static double DiffCoeffWater(double temperature_K)
const G4MoleculeDefinition * GetDefinition() const
G4MolecularConfiguration * ChangeConfiguration(const G4ElectronOccupancy &newElectronOccupancy)
std::map< G4String, G4MolecularConfiguration * > UserIDTable
const G4String & GetLabel() const
static G4MolecularConfiguration * GetMolecularConfiguration(const G4MoleculeDefinition *, const G4String &label)
static G4MolecularConfiguration * GetOrCreateMolecularConfiguration(const G4MoleculeDefinition *)
G4int GetSizeOfOrbit() const
static G4MolecularConfiguration * Load(std::istream &)
std::map< G4ElectronOccupancy, G4MolecularConfiguration *, comparator > ElectronOccupancyTable
G4int GetOccupancy(G4int orbit) const
G4MolecularConfiguration * RemoveElectron(G4int, G4int number=1)
static std::map< G4String, G4MolecularConfiguration * > & GetUserIDTable()
static void SetGlobalTemperature(G4double)
void AddUserID(const G4String &name, G4MolecularConfiguration *molecule)
const G4String & GetFormatedName() const
void SetUserID(const G4String &userID)
bool operator()(const G4ElectronOccupancy &occ1, const G4ElectronOccupancy &occ2) const
G4MolecularConfiguration * MoveOneElectron(G4int, G4int)
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
const G4MoleculeDefinition * fMoleculeDefinition
std::map< const G4String, G4MolecularConfiguration * > LabelTable
static G4MolecularConfigurationManager * fgManager
void RecordNewlyLabeledConfiguration(G4MolecularConfiguration *molConf)
G4int GetTotalOccupancy() const
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
static double ReturnDefaultDiffCoeff(const G4Material *, double, const G4MolecularConfiguration *molConf)
std::function< double(const G4Material *, double, const G4MolecularConfiguration *)> G4DiffCoeffParam
const G4ElectronOccupancy * fElectronOccupancy
G4MolecularConfiguration * AddElectron(G4int orbit, G4int n=1)
G4MolecularConfiguration * IonizeMolecule(G4int)
G4MolecularConfiguration(const G4MoleculeDefinition *, const G4ElectronOccupancy &, const G4String &label="")
static G4MolecularConfiguration * CreateMolecularConfiguration(const G4String &userIdentifier, const G4MoleculeDefinition *, bool &wasAlreadyCreated)
G4MolecularConfiguration * GetOrCreateMolecularConfiguration(const G4MoleculeDefinition *molDef, const G4ElectronOccupancy &eOcc)
const G4ElectronOccupancy * GetElectronOccupancy() const
const G4ElectronOccupancy * FindCommonElectronOccupancy(const G4MoleculeDefinition *molDef, const G4ElectronOccupancy &eOcc)
const std::vector< G4MolecularConfiguration * > & GetAllSpecies()
static void ScaleAllDiffusionCoefficientsOnWater(double temperature_K)
G4MolecularConfiguration & operator=(G4MolecularConfiguration &right)
int G4int
Definition: G4Types.hh:78
G4int Insert(const G4MoleculeDefinition *molDef, const G4ElectronOccupancy &eOcc, G4MolecularConfiguration *molConf)
G4MolecularConfiguration * GetMolecularConfiguration(const G4MoleculeDefinition *molDef, const G4ElectronOccupancy &eOcc)
G4MolecularConfiguration * ExciteMolecule(G4int)
std::map< G4String, G4MolecularConfiguration * > & GetUserIDTable()
static G4MolecularConfigurationManager * GetManager()
void AddDiffCoeffParameterization(const G4DiffCoeffParam &)
Char_t n[5]
const G4String & GetName() const
const std::vector< const G4MolecularDissociationChannel * > * GetDecayChannel() const
std::map< const G4MoleculeDefinition *, ChargeTable > MolChargeConfTable
const G4String & GetUserID() const
std::map< const G4MoleculeDefinition *, std::map< const G4String, G4MolecularConfiguration * > > MolLabelConfTable
std::mutex G4Mutex
Definition: G4Threading.hh:84