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] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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;
 79 template<>
 80 G4KDNode<G4Molecule>::~G4KDNode();
 81 
 82 class G4Molecule;
 83 class G4MolecularConfiguration;
 84 class G4MoleculeDefinition;
 85 class G4MolecularDissociationChannel;
 86 class G4DynamicParticle;
 87 class G4Material;
 88 
 89 G4Molecule* GetMolecule(const G4Track& track);
 90 G4Molecule* GetMolecule(const G4Track* track);
 91 
 92 /** Class Description
 93  *  The dynamic molecule holds all the data that change for a molecule
 94  *  It has a pointer to G4MoleculeDefinition object, which holds
 95  *   all the "ground level" information.
 96  */
 97 
 98 class G4Molecule : public G4IT
 99 {
100 
101 public:
102     // With Description
103 
104     ITDef(G4Molecule) // NOLINT because it's a macro
105 
106         //From G4VUserTrackInformation
107         void Print() const override;
108 
109     //  new/delete operators are overloded to use G4Allocator
110     inline void *operator new(size_t);
111 #ifdef __IBMCPP__
112     inline void *operator new(size_t sz, void* p)
113     {
114         return p;
115     }
116 #endif
117     inline void operator delete(void*);
118 
119     G4Molecule(const G4Molecule&);
120     G4Molecule & operator=(const G4Molecule &right);
121     G4bool operator==(const G4Molecule &right) const;
122     G4bool operator!=(const G4Molecule &right) const;
123     G4bool operator<(const G4Molecule &right) const;
124 
125     operator int() const
126     {
127         return GetMoleculeID();
128     }
129 
130     G4ITType GetITSubType() const override
131     {
132         return GetMoleculeID();
133     }
134 
135 public:
136     //------ Constructors --------------------------
137     /** To build a molecule at ground state according to a given
138      * G4MoleculeDefinition that can be obtained from G4GenericMoleculeManager
139      */
140     G4Molecule(G4MoleculeDefinition* pMoleculeDefinition);
141 
142     G4Molecule(G4MoleculeDefinition* pMoleculeDefinition, int charge);
143 
144     /** To build a molecule at a specific excitation/ionisation state according
145      * to a ground state that can be obtained from G4GenericMoleculeManager
146      */
147     G4Molecule(G4MoleculeDefinition* pMoleculeDefinition, G4int, G4int);
148 
149     /** Specific builder for water molecules to be used in Geant4-DNA,
150      * the last option Excitation is true if the molecule is excited, is
151      * false is the molecule is ionized.
152      */
153     G4Molecule(G4MoleculeDefinition* pMoleculeDefinition, G4int, G4bool);
154 
155     G4Molecule(const G4MolecularConfiguration*);
156 
157     ~G4Molecule() override;
158 
159     //-------- Methods -------------------------------
160     //Get from static definition
161     /** Returns the name of the molecule
162      */
163     const G4String& GetName() const override;
164 
165     /** Returns the formated name of the molecule
166      */
167     const G4String& GetFormatedName() const;
168 
169     /** Returns the nomber of atoms compouning the molecule
170      */
171     G4int GetAtomsNumber() const;
172 
173     /** Will set up the correct molecularConfiguration given
174      * an electron configuration
175      */
176     void SetElectronOccupancy(const G4ElectronOccupancy*);
177 
178     /** Method used in Geant4-DNA to excite water molecules
179      */
180     void ExciteMolecule(G4int);
181 
182     /** Method used in Geant4-DNA to ionize water molecules
183      */
184     void IonizeMolecule(G4int);
185 
186     /** Add n electrons to a given orbit.
187      * Note : You can add as many electrons to a given orbit, the result
188      * may be unrealist.
189      */
190     void AddElectron(G4int orbit, G4int n = 1);
191 
192     /** Remove n electrons to a given orbit.
193      */
194     void RemoveElectron(G4int, G4int number = 1);
195 
196     /** Move one electron from an orbit to another.
197      */
198     void MoveOneElectron(G4int /*orbit*/, G4int /*orbit*/);
199 
200     /** Returns the number of electron.
201      */
202     G4double GetNbElectrons() const; //This method can be used to check if the electron s number is physical
203 
204     /** Show the electronic state of the molecule.
205      */
206     void PrintState() const;
207 
208     G4Track * BuildTrack(G4double globalTime, const G4ThreeVector& Position);
209 
210     G4double GetKineticEnergy() const;
211 
212     G4double GetDiffusionVelocity() const;
213 
214     const std::vector<const G4MolecularDissociationChannel*>* GetDissociationChannels() const;
215 
216     G4int GetFakeParticleID() const;
217     G4int GetMoleculeID() const;
218 
219     //-------------Inline functions ---------------------
220     /**  Get molecule definition. This G4MoleculeDefinition has the ground
221      * electronic state of the molecule.
222      */
223     const G4MoleculeDefinition* GetDefinition() const;
224 
225     //methods to set/get changing parameters
226 
227   /////////////////////////////////////////////////////////////////////////////
228     /** Sets the diffusion coefficient D of the molecule used in diffusion
229      * processes to calculate the mean square jump distance between two
230      * changes of direction. In three dimension : <x^2> = 6 D t where t is
231      * the mean jump time between two changes of direction.
232      */
233     void SetDiffusionCoefficient(G4double);
234 
235     /** Returns the diffusion coefficient D.
236      */
237     G4double GetDiffusionCoefficient() const;
238 
239     /** Returns the diffusion coefficient D.
240      */
241     G4double GetDiffusionCoefficient(const G4Material*,
242                                      double temperature) const;
243 
244     /** Set the decay time of the molecule.
245      */
246     void SetDecayTime(G4double);
247 
248     /** Returns the decay time of the molecule.
249      */
250     G4double GetDecayTime() const;
251 
252     /** The Van Der Valls Radius of the molecule
253      */
254     void SetVanDerVaalsRadius(G4double);
255     G4double GetVanDerVaalsRadius() const;
256 
257     /** Returns the object ElectronOccupancy describing the electronic
258      * configuration of the molecule.
259      */
260     const G4ElectronOccupancy* GetElectronOccupancy() const;
261 
262     /** Returns the charge of molecule.
263      */
264     G4int GetCharge() const;
265 
266     /** Set the total mass of the molecule.
267      */
268     void SetMass(G4double);
269 
270     /** Returns the total mass of the molecule.
271      */
272     G4double GetMass() const;
273 
274     /** Returns the label of the molecule configuration
275      */
276     const G4String& GetLabel() const;
277 
278     void SetLabel(const G4String& label);
279 
280     void ChangeConfigurationToLabel(const G4String& label);
281 
282     ////////////////////////////////////////////////////////////////////////
283 
284     const G4MolecularConfiguration* GetMolecularConfiguration() const;
285 
286     static G4Molecule* GetMolecule(const G4Track*);
287 
288 private:
289     /** Default molecule builder
290      */
291     G4Molecule();
292     const G4MolecularConfiguration* fpMolecularConfiguration;
293 };
294 
295 #if defined G4EM_ALLOC_EXPORT
296 extern G4DLLEXPORT G4Allocator<G4Molecule>*& aMoleculeAllocator();
297 #else
298 extern G4DLLIMPORT G4Allocator<G4Molecule>*& aMoleculeAllocator();
299 #endif
300 
301 //////////////////////////
302 inline void * G4Molecule::operator new(size_t)
303 //////////////////////////
304 {
305     if (aMoleculeAllocator() == nullptr)
306     {
307         aMoleculeAllocator() = new G4Allocator<G4Molecule>;
308     }
309     return (void *)aMoleculeAllocator()->MallocSingle();
310 }
311 
312 //////////////////////////
313 inline void G4Molecule::operator delete(void * aMolecule)
314 //////////////////////////
315 {
316     aMoleculeAllocator()->FreeSingle((G4Molecule *)aMolecule);
317 }
318 
319 #endif
320