Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4MoleculeTable.cc
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 * G4MoleculeTable.cc
28 *
29 * Created on: 23 oct. 2013
30 * Author: kara
31 */
32
33#include "G4MoleculeTable.hh"
37
39
40//------------------------------------------------------------------------------
41
43 : fMoleculeDefTableMessenger(new G4MoleculeTableMessenger())
44{
45}
46
47//------------------------------------------------------------------------------
48
50{
51}
52
53//------------------------------------------------------------------------------
54
56{
58 return fpgMoleculeTable;
59}
60
61//------------------------------------------------------------------------------
62
64{
65 return Instance();
66}
67
68//------------------------------------------------------------------------------
69
72 double diffusion_coefficient)
73{
74 return new G4MoleculeDefinition(name, -1 /* mass*/,
75 diffusion_coefficient);
76}
77
78//------------------------------------------------------------------------------
79
82 bool mustExist)
83{
84 MoleculeDefTable::iterator it = fMoleculeDefTable.find(name);
85 G4MoleculeDefinition* definition(0);
86 if (it != fMoleculeDefTable.end())
87 {
88 definition = it->second;
89 }
90 else if(mustExist)
91 {
92 // exception
93 G4ExceptionDescription description;
94 description << "The molecule definition " << name
95 << " was NOT recorded in the table" << G4endl;
96 G4Exception("G4MoleculeTable::CreateMoleculeModel",
97 "MOLECULE_DEFINITION_NOT_CREATED",
99 description);
100 }
101 return definition;
102}
103
104//------------------------------------------------------------------------------
105
107G4MoleculeTable::GetConfiguration(const G4String& name, bool mustExist)
108{
109 G4MolecularConfiguration* species =
111
112 if(species == 0 && mustExist)
113 {
114 // exception
115 G4ExceptionDescription description;
116 description << "The configuration " << name
117 << " was not recorded in the table" << G4endl;
118 G4Exception("G4MoleculeTable::GetConfiguration",
119 "CONF_NOT_CREATED",
121 description);
122 }
123
124 return species;
125}
126
127//------------------------------------------------------------------------------
128
131{
132 G4MolecularConfiguration* species =
134
135 return species;
136}
137
138//------------------------------------------------------------------------------
139
141{
142
143 const G4String& name = moleculeDefinition->GetName();
144 MoleculeDefTable::iterator it = fMoleculeDefTable.find(name);
145 if (it == fMoleculeDefTable.end())
146 {
147 fMoleculeDefTable[name] = moleculeDefinition;
148 }
149 else
150 {
151 // exception
152 G4ExceptionDescription description;
153 description << "The molecule definition " << name
154 << " was already recorded in the table" << G4endl;
155 G4Exception("G4MoleculeTable::CreateMoleculeDefinition",
156 "DEFINITION_ALREADY_CREATED", FatalException, description);
157 }
158}
159
160//------------------------------------------------------------------------------
161
163{
164 MoleculeDefTable::iterator it = fMoleculeDefTable.begin();
165
166 for(; it != fMoleculeDefTable.end() ; ++it)
167 {
169 }
170}
171
172//------------------------------------------------------------------------------
173
176 G4MoleculeDefinition* molDef)
177{
178 bool alreadyCreated(false);
179
180 G4MolecularConfiguration* molConf =
182 molDef,
183 alreadyCreated);
184
185 return molConf;
186}
187
188//------------------------------------------------------------------------------
189
192 G4MoleculeDefinition* molDef,
193 const G4String& configurationLabel,
194 int charge)
195{
196 bool alreadyCreated(false);
197
198 G4MolecularConfiguration* molConf =
200 molDef,
201 charge,
202 configurationLabel,
203 alreadyCreated);
204
205 return molConf;
206}
207
208//------------------------------------------------------------------------------
209
212 G4MoleculeDefinition* molDef,
213 int charge,
214 double diffusion_coefficient)
215{
216 bool alreadyCreated(false);
217
218 G4MolecularConfiguration* molConf =
220 molDef,
221 charge,
222 userIdentifier,
223 alreadyCreated);
224
225 if(diffusion_coefficient!=-1) // TODO
226 {
227 molConf->SetDiffusionCoefficient(diffusion_coefficient);
228 }
229 return molConf;
230}
231
232//------------------------------------------------------------------------------
233
236 const G4MoleculeDefinition* molDef,
237 const G4String& configurationLabel,
238 const G4ElectronOccupancy& eOcc)
239{
240 bool alreadyCreated(false);
241
242 G4MolecularConfiguration* molConf =
244 molDef,
245 configurationLabel,
246 eOcc,
247 alreadyCreated);
248
249 return molConf;
250}
251
252//------------------------------------------------------------------------------
253
255{
257}
258
259//------------------------------------------------------------------------------
260
262{
264}
265
266//------------------------------------------------------------------------------
267
269{
271}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
G4MoleculeIterator< G4MolecularConfiguration > G4ConfigurationIterator
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
static std::map< G4String, G4MolecularConfiguration * > & GetUserIDTable()
static G4MolecularConfiguration * GetOrCreateMolecularConfiguration(const G4MoleculeDefinition *)
static G4MolecularConfiguration * GetMolecularConfiguration(const G4MoleculeDefinition *, const G4String &label)
static G4MolecularConfiguration * CreateMolecularConfiguration(const G4String &userIdentifier, const G4MoleculeDefinition *, bool &wasAlreadyCreated)
const G4String & GetName() const
static G4MoleculeTable * GetMoleculeTable()
G4MolecularConfiguration * GetConfiguration(const G4String &, bool mustExist=true)
G4MolecularConfiguration * CreateConfiguration(const G4String &userIdentifier, const G4MoleculeDefinition *molDef, const G4String &configurationLabel, const G4ElectronOccupancy &eOcc)
int GetNumberOfDefinedSpecies()
virtual ~G4MoleculeTable()
G4MoleculeDefinition * CreateMoleculeDefinition(const G4String &userIdentifier, double diffusion_coefficient)
G4MoleculeDefinition * GetMoleculeDefinition(const G4String &, bool mustExist=true)
void PrepareMolecularConfiguration()
void Insert(G4MoleculeDefinition *)
MoleculeDefTable fMoleculeDefTable
static G4MoleculeTable * Instance()
G4ConfigurationIterator GetConfigurationIterator()
static G4MoleculeTable * fpgMoleculeTable