69 : fName(name), fSymbol(symbol)
74 ed <<
"Failed to create G4Element " << name <<
" Z= " << zeff <<
" < 1 !";
77 if (std::abs(zeff - iz) > perMillion) {
79 ed <<
"G4Element Warning: " << name <<
" Z= " << zeff <<
" A= " << aeff / (g / mole);
87 fNeff = fAeff / (g / mole);
95 ed <<
"Failed to create G4Element " << name <<
" with Z= " << zeff <<
" N= " << fNeff
96 <<
" N < Z is not allowed" <<
G4endl;
101 fAtomicShells =
new G4double[fNbOfAtomicShells];
102 fNbOfShellElectrons =
new G4int[fNbOfAtomicShells];
104 AddNaturalIsotopes();
106 for (
G4int i = 0; i < fNbOfAtomicShells; ++i) {
110 ComputeDerivedQuantities();
119 : fName(name), fSymbol(symbol)
121 InitializePointers();
123 auto n = size_t(nIsotopes);
125 if (0 >= nIsotopes) {
127 ed <<
"Failed to create G4Element " << name <<
" <" << symbol <<
"> with " << nIsotopes
133 fRelativeAbundanceVector =
new G4double[nIsotopes];
143 if (theIsotopeVector ==
nullptr) {
145 ed <<
"Failed to add Isotope to G4Element " << fName <<
" with Z= " << fZeff
153 if (fNumberOfIsotopes < (
G4int)theIsotopeVector->size()) {
155 if (fNumberOfIsotopes == 0) {
160 ed <<
"Failed to add Isotope Z= " << iz <<
" to G4Element " << fName
161 <<
" with different Z= " << fZeff << fNeff;
166 fRelativeAbundanceVector[fNumberOfIsotopes] = abundance;
167 (*theIsotopeVector)[fNumberOfIsotopes] = isotope;
172 ed <<
"Failed to add Isotope Z= " << iz <<
" to G4Element " << fName
173 <<
" - more isotopes than declared.";
179 if (fNumberOfIsotopes == (
G4int)theIsotopeVector->size()) {
182 for (
G4int i = 0; i < fNumberOfIsotopes; ++i) {
183 fAeff += fRelativeAbundanceVector[i] * (*theIsotopeVector)[i]->GetA();
184 wtSum += fRelativeAbundanceVector[i];
189 fNeff = fAeff / (g / mole);
192 for (
G4int i = 0; i < fNumberOfIsotopes; ++i) {
193 fRelativeAbundanceVector[i] /= wtSum;
198 fAtomicShells =
new G4double[fNbOfAtomicShells];
199 fNbOfShellElectrons =
new G4int[fNbOfAtomicShells];
201 for (
G4int j = 0; j < fNbOfAtomicShells; ++j) {
205 ComputeDerivedQuantities();
211void G4Element::InitializePointers()
213 theIsotopeVector =
nullptr;
214 fRelativeAbundanceVector =
nullptr;
215 fAtomicShells =
nullptr;
216 fNbOfShellElectrons =
nullptr;
217 fIonisation =
nullptr;
218 fNumberOfIsotopes = 0;
219 fNaturalAbundance =
false;
225 fNbOfAtomicShells = 0;
236 delete theIsotopeVector;
237 delete[] fRelativeAbundanceVector;
238 delete[] fAtomicShells;
239 delete[] fNbOfShellElectrons;
243 theElementTable[fIndexInTable] =
nullptr;
248void G4Element::ComputeDerivedQuantities()
253 theElementTable.push_back(
this);
254 fIndexInTable = theElementTable.size() - 1;
257 ComputeCoulombFactor();
258 ComputeLradTsaiFactor();
268void G4Element::ComputeCoulombFactor()
273 static const G4double k1 = 0.0083, k2 = 0.20206, k3 = 0.0020, k4 = 0.0369;
275 G4double az2 = (fine_structure_const * fZeff) * (fine_structure_const * fZeff);
278 fCoulomb = (k1 * az4 + k2 + 1. / (1. + az2)) * az2 - (k3 * az4 + k4) * az4;
283void G4Element::ComputeLradTsaiFactor()
289 static const G4double Lrad_light[] = {5.31, 4.79, 4.74, 4.71};
290 static const G4double Lprad_light[] = {6.144, 5.621, 5.805, 5.924};
299 Lrad = Lrad_light[iz];
300 Lprad = Lprad_light[iz];
303 Lrad = log184 - logZ3;
304 Lprad = log1194 - 2 * logZ3;
307 fRadTsai = 4 * alpha_rcl2 * fZeff * (fZeff * (Lrad - fCoulomb) + Lprad);
312void G4Element::AddNaturalIsotopes()
319 if (fSymbol.empty()) {
321 if (Z < (
G4int)elmnames.size()) {
322 fSymbol = elmnames[Z];
329 fNumberOfIsotopes = 0;
330 for (
G4int i = 0; i <
n; ++i) {
335 theIsotopeVector =
new G4IsotopeVector((
unsigned int)fNumberOfIsotopes,
nullptr);
336 fRelativeAbundanceVector =
new G4double[fNumberOfIsotopes];
339 for (
G4int i = 0; i <
n; ++i) {
343 std::ostringstream strm;
344 strm << fSymbol <<
N;
345 (*theIsotopeVector)[idx] =
new G4Isotope(strm.str(), Z,
N, 0.0, 0);
346 fRelativeAbundanceVector[idx] = x;
351 if (xsum != 0.0 && xsum != 1.0) {
352 for (
G4int i = 0; i < idx; ++i) {
353 fRelativeAbundanceVector[i] /= xsum;
356 fNaturalAbundance =
true;
363 if (i < 0 || i >= fNbOfAtomicShells) {
365 ed <<
"Invalid argument " << i <<
" in for G4Element " << fName <<
" with Z= " << fZeff
366 <<
" and Nshells= " << fNbOfAtomicShells;
370 return fAtomicShells[i];
377 if (i < 0 || i >= fNbOfAtomicShells) {
379 ed <<
"Invalid argument " << i <<
" for G4Element " << fName <<
" with Z= " << fZeff
380 <<
" and Nshells= " << fNbOfAtomicShells;
384 return fNbOfShellElectrons[i];
400 for (
auto J : theElementTable) {
401 if (J->GetName() == elementName) {
408 G4cout <<
"\n---> warning from G4Element::GetElement(). The element: " << elementName
409 <<
" does not exist in the table. Return NULL pointer." <<
G4endl;
418 std::ios::fmtflags mode = flux.flags();
419 flux.setf(std::ios::fixed, std::ios::floatfield);
420 G4long prec = flux.precision(3);
422 flux <<
" Element: " << element->fName <<
" (" << element->fSymbol <<
")"
423 <<
" Z = " << std::setw(4) << std::setprecision(1) << element->fZeff
424 <<
" N = " << std::setw(5) << std::setprecision(1) <<
G4lrint(element->fNeff)
425 <<
" A = " << std::setw(6) << std::setprecision(3) << (element->fAeff) / (g / mole)
428 for (
G4int i = 0; i < element->fNumberOfIsotopes; i++) {
429 flux <<
"\n ---> " << (*(element->theIsotopeVector))[i]
430 <<
" abundance: " << std::setw(6) << std::setprecision(3)
431 << (element->fRelativeAbundanceVector[i]) / perCent <<
" %";
434 flux.precision(prec);
435 flux.setf(mode, std::ios::floatfield);
452 flux <<
"\n***** Table : Nb of elements = " << ElementTable.size() <<
" *****\n" <<
G4endl;
454 for (
auto i : ElementTable) {
466 flux <<
"\n***** Vector : Nb of elements = " << ElementVector.size() <<
" *****\n" <<
G4endl;
468 for (
auto i : ElementVector) {
std::vector< G4Element * > G4ElementTable
std::vector< const G4Element * > G4ElementVector
std::ostream & operator<<(std::ostream &flux, const G4Element *element)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::vector< G4Isotope * > G4IsotopeVector
G4double G4Log(G4double x)
G4GLOB_DLL std::ostream G4cout
static G4int GetNumberOfElectrons(G4int Z, G4int SubshellNb)
static G4double GetBindingEnergy(G4int Z, G4int SubshellNb)
static G4int GetNumberOfShells(G4int Z)
static G4ElementTable * GetElementTable()
static size_t GetNumberOfElements()
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
G4Element(const G4String &name, const G4String &symbol, G4double Zeff, G4double Aeff)
G4int GetNbOfShellElectrons(G4int index) const
static G4Element * GetElement(const G4String &name, G4bool warning=true)
G4double GetAtomicShell(G4int index) const
G4int GetNumberOfNistIsotopes(G4int Z) const
const std::vector< G4String > & GetNistElementNames() const
G4int GetNistFirstIsotopeN(G4int Z) const
static G4NistManager * Instance()
G4double GetIsotopeAbundance(G4int Z, G4int N) const