76 :
fName(name), fSymbol(symbol)
81 ed <<
"Fail to create G4Element " << name
82 <<
" Z= " << zeff <<
" < 1 !";
87 ed <<
"G4Element Warning: " << name <<
" Z= " << zeff
88 <<
" A= " << aeff/(
g/
mole);
95 fNeff = aeff/(
g/
mole);
98 if(fNeff < 1.0) fNeff = 1.0;
102 ed <<
"Fail to create G4Element " << name
103 <<
" with Z= " << zeff <<
" N= " << fNeff
104 <<
" N < Z is not allowed" <<
G4endl;
109 fAtomicShells =
new G4double[fNbOfAtomicShells];
110 fNbOfShellElectrons =
new G4int[fNbOfAtomicShells];
112 AddNaturalIsotopes();
114 for (
G4int i=0;i<fNbOfAtomicShells;i++)
119 ComputeDerivedQuantities();
129 :
fName(name),fSymbol(symbol)
131 InitializePointers();
133 size_t n = size_t(nIsotopes);
137 ed <<
"Fail to create G4Element " << name
138 <<
" <" << symbol <<
"> with " << nIsotopes
143 fRelativeAbundanceVector =
new G4double[nIsotopes];
153 if (theIsotopeVector == 0) {
155 ed <<
"Fail to add Isotope to G4Element " << fName
156 <<
" with Z= " << fZeff <<
" N= " << fNeff;
163 if ( fNumberOfIsotopes < theIsotopeVector->size() ) {
165 if (fNumberOfIsotopes==0) { fZeff =
G4double(iz); }
168 ed <<
"Fail to add Isotope Z= " << iz <<
" to G4Element " << fName
169 <<
" with different Z= " << fZeff << fNeff;
174 fRelativeAbundanceVector[fNumberOfIsotopes] = abundance;
175 (*theIsotopeVector)[fNumberOfIsotopes] = isotope;
180 ed <<
"Fail to add Isotope Z= " << iz <<
" to G4Element " << fName
181 <<
" - more isotopes than declaired ";
187 if ( fNumberOfIsotopes == theIsotopeVector->size() ) {
193 for (
size_t i=0;i<fNumberOfIsotopes;i++) {
194 aeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetA();
195 neff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetN();
196 wtSum += fRelativeAbundanceVector[i];
206 for(
size_t i=0; i<fNumberOfIsotopes; ++i) {
207 fRelativeAbundanceVector[i] /= wtSum;
212 fAtomicShells =
new G4double[fNbOfAtomicShells];
213 fNbOfShellElectrons =
new G4int[fNbOfAtomicShells];
215 for (
G4int j = 0; j < fNbOfAtomicShells; j++ )
220 ComputeDerivedQuantities();
227 void G4Element::InitializePointers()
229 theIsotopeVector = 0;
230 fRelativeAbundanceVector = 0;
232 fNbOfShellElectrons = 0;
234 fNumberOfIsotopes = 0;
235 fNaturalAbundance =
false;
241 fNbOfAtomicShells = 0;
253 : fZeff(0), fNeff(0), fAeff(0)
255 InitializePointers();
264 if (theIsotopeVector) {
delete theIsotopeVector; }
265 if (fRelativeAbundanceVector) {
delete [] fRelativeAbundanceVector; }
266 if (fAtomicShells) {
delete [] fAtomicShells; }
267 if (fNbOfShellElectrons) {
delete [] fNbOfShellElectrons; }
268 if (fIonisation) {
delete fIonisation; }
271 theElementTable[fIndexInTable] = 0;
276 void G4Element::ComputeDerivedQuantities()
281 theElementTable.push_back(
this);
282 fIndexInTable = theElementTable.size() - 1;
285 ComputeCoulombFactor();
286 ComputeLradTsaiFactor();
289 if (fIonisation) {
delete fIonisation; }
295 void G4Element::ComputeCoulombFactor()
300 static const G4double k1 = 0.0083 , k2 = 0.20206 ,k3 = 0.0020 , k4 = 0.0369 ;
305 fCoulomb = (k1*az4 + k2 + 1./(1.+az2))*az2 - (k3*az4 + k4)*az4;
310 void G4Element::ComputeLradTsaiFactor()
316 static const G4double Lrad_light[] = {5.31 , 4.79 , 4.74 , 4.71} ;
317 static const G4double Lprad_light[] = {6.144 , 5.621 , 5.805 , 5.924} ;
319 const G4double logZ3 = std::log(fZeff)/3.;
323 if (iz <= 3) { Lrad = Lrad_light[
iz] ; Lprad = Lprad_light[
iz] ; }
324 else { Lrad = std::log(184.15) - logZ3 ; Lprad = std::log(1194.) - 2*logZ3;}
326 fRadTsai = 4*
alpha_rcl2*fZeff*(fZeff*(Lrad-fCoulomb) + Lprad);
331 void G4Element::AddNaturalIsotopes()
337 fNumberOfIsotopes = 0;
338 for(
G4int i=0; i<
n; ++i) {
342 fRelativeAbundanceVector =
new G4double[fNumberOfIsotopes];
345 for(
G4int i=0; i<
n; ++i) {
349 std::ostringstream strm;
350 strm << fSymbol <<
N;
351 (*theIsotopeVector)[idx] =
new G4Isotope(strm.str(),
Z,
N, 0.0, 0);
352 fRelativeAbundanceVector[idx] =
x;
357 if(xsum != 0.0 && xsum != 1.0) {
358 for(
G4int i=0; i<idx; ++i) { fRelativeAbundanceVector[i] /= xsum; }
360 fNaturalAbundance =
true;
367 if (i<0 || i>=fNbOfAtomicShells) {
369 ed <<
"Invalid argument " << i <<
" in for G4Element " << fName
370 <<
" with Z= " << fZeff
371 <<
" and Nshells= " << fNbOfAtomicShells;
375 return fAtomicShells[i];
382 if (i<0 || i>=fNbOfAtomicShells) {
384 ed <<
"Invalid argument " << i <<
" for G4Element " << fName
385 <<
" with Z= " << fZeff
386 <<
" and Nshells= " << fNbOfAtomicShells;
390 return fNbOfShellElectrons[i];
397 return &theElementTable;
404 return theElementTable.size();
412 for (
size_t J=0 ; J<theElementTable.size() ; J++)
414 if (theElementTable[J]->
GetName() == elementName)
415 return theElementTable[J];
420 G4cout <<
"\n---> warning from G4Element::GetElement(). The element: "
421 << elementName <<
" does not exist in the table. Return NULL pointer."
431 InitializePointers();
435 theElementTable.push_back(
this);
436 fIndexInTable = theElementTable.size() - 1;
446 fSymbol = right.fSymbol;
451 if (fAtomicShells)
delete [] fAtomicShells;
452 fNbOfAtomicShells = right.fNbOfAtomicShells;
453 fAtomicShells =
new G4double[fNbOfAtomicShells];
455 if (fNbOfShellElectrons)
delete [] fNbOfShellElectrons;
456 fNbOfAtomicShells = right.fNbOfAtomicShells;
457 fNbOfShellElectrons =
new G4int[fNbOfAtomicShells];
459 for (
G4int i = 0; i < fNbOfAtomicShells; i++ )
461 fAtomicShells[i] = right.fAtomicShells[i];
462 fNbOfShellElectrons[i] = right.fNbOfShellElectrons[i];
464 if (theIsotopeVector)
delete theIsotopeVector;
465 if (fRelativeAbundanceVector)
delete [] fRelativeAbundanceVector;
467 fNumberOfIsotopes = right.fNumberOfIsotopes;
468 if (fNumberOfIsotopes > 0)
471 fRelativeAbundanceVector =
new G4double[fNumberOfIsotopes];
472 for (
size_t i=0;i<fNumberOfIsotopes;i++)
474 (*theIsotopeVector)[i] = (*right.theIsotopeVector)[i];
475 fRelativeAbundanceVector[i] = right.fRelativeAbundanceVector[i];
478 ComputeDerivedQuantities();
501 std::ios::fmtflags mode = flux.flags();
502 flux.setf(std::ios::fixed,std::ios::floatfield);
503 G4long prec = flux.precision(3);
506 <<
" Element: " << element->fName <<
" (" << element->fSymbol <<
")"
507 <<
" Z = " << std::setw(4) << std::setprecision(1) << element->fZeff
508 <<
" N = " << std::setw(5) << std::setprecision(1) << element->fNeff
509 <<
" A = " << std::setw(6) << std::setprecision(2)
510 << (element->fAeff)/(
g/
mole) <<
" g/mole";
512 for (
size_t i=0; i<element->fNumberOfIsotopes; i++)
514 <<
"\n ---> " << (*(element->theIsotopeVector))[i]
515 <<
" abundance: " << std::setw(6) << std::setprecision(2)
516 << (element->fRelativeAbundanceVector[i])/
perCent <<
" %";
518 flux.precision(prec);
519 flux.setf(mode,std::ios::floatfield);
536 flux <<
"\n***** Table : Nb of elements = " << ElementTable.size()
539 for (
size_t i=0; i<ElementTable.size(); i++) flux << ElementTable[i]
std::vector< G4Isotope * > G4IsotopeVector
std::ostringstream G4ExceptionDescription
static G4Element * GetElement(G4String name, G4bool warning=true)
G4int GetNbOfShellElectrons(G4int index) const
static G4NistManager * Instance()
G4int GetNistFirstIsotopeN(G4int Z) const
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
static G4double GetBindingEnergy(G4int Z, G4int SubshellNb)
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
G4Element(const G4String &name, const G4String &symbol, G4double Zeff, G4double Aeff)
G4double GetIsotopeAbundance(G4int Z, G4int N) const
G4int GetNumberOfNistIsotopes(G4int Z) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4int operator==(const G4Element &) const
G4int operator!=(const G4Element &) const
static G4int GetNumberOfElectrons(G4int Z, G4int SubshellNb)
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
G4double GetAtomicShell(G4int index) const
std::vector< G4Element * > G4ElementTable
const G4String & GetName() const
static G4ElementTable * GetElementTable()
static G4int GetNumberOfShells(G4int Z)