Geant4 10.7.0
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"
36
38
39//------------------------------------------------------------------------------
40
42{
43}
44
45//------------------------------------------------------------------------------
46
48{
49}
50
51//------------------------------------------------------------------------------
52
54{
56 return fpgMoleculeTable;
57}
58
59//------------------------------------------------------------------------------
60
62{
63 return Instance();
64}
65
66//------------------------------------------------------------------------------
67
70 double diffusion_coefficient)
71{
72 return new G4MoleculeDefinition(name, -1 /* mass*/,
73 diffusion_coefficient);
74}
75
76//------------------------------------------------------------------------------
77
80 bool mustExist)
81{
82 MoleculeDefTable::iterator it = fMoleculeDefTable.find(name);
83 G4MoleculeDefinition* definition(0);
84 if (it != fMoleculeDefTable.end())
85 {
86 definition = it->second;
87 }
88 else if(mustExist)
89 {
90 // exception
91 G4ExceptionDescription description;
92 description << "The molecule definition " << name
93 << " was NOT recorded in the table" << G4endl;
94 G4Exception("G4MoleculeTable::CreateMoleculeModel",
95 "MOLECULE_DEFINITION_NOT_CREATED",
97 description);
98 }
99 return definition;
100}
101
102//------------------------------------------------------------------------------
103
105G4MoleculeTable::GetConfiguration(const G4String& name, bool mustExist)
106{
107 G4MolecularConfiguration* species =
109
110 if(species == 0 && mustExist)
111 {
112 // exception
113 G4ExceptionDescription description;
114 description << "The configuration " << name
115 << " was not recorded in the table" << G4endl;
116 G4Exception("G4MoleculeTable::GetConfiguration",
117 "CONF_NOT_CREATED",
119 description);
120 }
121
122 return species;
123}
124
125//------------------------------------------------------------------------------
126
129{
130 G4MolecularConfiguration* species =
132
133 return species;
134}
135
136//------------------------------------------------------------------------------
137
139{
140
141 const G4String& name = moleculeDefinition->GetName();
142 MoleculeDefTable::iterator it = fMoleculeDefTable.find(name);
143 if (it == fMoleculeDefTable.end())
144 {
145 fMoleculeDefTable[name] = moleculeDefinition;
146 }
147 else
148 {
149 // exception
150 G4ExceptionDescription description;
151 description << "The molecule definition " << name
152 << " was already recorded in the table" << G4endl;
153 G4Exception("G4MoleculeTable::CreateMoleculeDefinition",
154 "DEFINITION_ALREADY_CREATED", FatalException, description);
155 }
156}
157
158//------------------------------------------------------------------------------
159
161{
162 MoleculeDefTable::iterator it = fMoleculeDefTable.begin();
163
164 for(; it != fMoleculeDefTable.end() ; ++it)
165 {
167 }
168}
169
170//------------------------------------------------------------------------------
171
174 G4MoleculeDefinition* molDef)
175{
176 bool alreadyCreated(false);
177
178 G4MolecularConfiguration* molConf =
180 molDef,
181 alreadyCreated);
182
183 return molConf;
184}
185
186//------------------------------------------------------------------------------
187
190 G4MoleculeDefinition* molDef,
191 const G4String& configurationLabel,
192 int charge)
193{
194 bool alreadyCreated(false);
195
196 G4MolecularConfiguration* molConf =
198 molDef,
199 charge,
200 configurationLabel,
201 alreadyCreated);
202
203 return molConf;
204}
205
206//------------------------------------------------------------------------------
207
210 G4MoleculeDefinition* molDef,
211 int charge,
212 double diffusion_coefficient)
213{
214 bool alreadyCreated(false);
215
216 G4MolecularConfiguration* molConf =
218 molDef,
219 charge,
220 userIdentifier,
221 alreadyCreated);
222
223 if(diffusion_coefficient!=-1) // TODO
224 {
225 molConf->SetDiffusionCoefficient(diffusion_coefficient);
226 }
227 return molConf;
228}
229
230//------------------------------------------------------------------------------
231
234 const G4MoleculeDefinition* molDef,
235 const G4String& configurationLabel,
236 const G4ElectronOccupancy& eOcc)
237{
238 bool alreadyCreated(false);
239
240 G4MolecularConfiguration* molConf =
242 molDef,
243 configurationLabel,
244 eOcc,
245 alreadyCreated);
246
247 return molConf;
248}
249
250//------------------------------------------------------------------------------
251
253{
255}
256
257//------------------------------------------------------------------------------
258
260{
262}
263
264//------------------------------------------------------------------------------
265
267{
269}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
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