76 :
fName(name), fSymbol(symbol)
81 ed <<
"Fail to create G4Element " << name
82 <<
" Z= " << zeff <<
" < 1 !" <<
G4endl;
87 ed <<
"G4Element Warning: " << name <<
" Z= " << zeff
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);
136 AddNaturalIsotopes();
139 fRelativeAbundanceVector =
new G4double[nIsotopes];
149 if (theIsotopeVector == 0) {
151 ed <<
"Fail to add Isotope to G4Element " << fName
152 <<
" with Z= " << fZeff <<
" N= " << fNeff <<
G4endl;
159 if ( fNumberOfIsotopes < theIsotopeVector->size() ) {
161 if (fNumberOfIsotopes==0) { fZeff =
G4double(iz); }
164 ed <<
"Fail to add Isotope Z= " << iz <<
" to G4Element " << fName
165 <<
" with different Z= " << fZeff << fNeff
171 fRelativeAbundanceVector[fNumberOfIsotopes] = abundance;
172 (*theIsotopeVector)[fNumberOfIsotopes] = isotope;
177 ed <<
"Fail to add Isotope Z= " << iz <<
" to G4Element " << fName
178 <<
" - more isotopes than declaired " <<
G4endl;
184 if ( fNumberOfIsotopes == theIsotopeVector->size() ) {
189 for (
size_t i=0;i<fNumberOfIsotopes;i++) {
190 fAeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetA();
191 fNeff += fRelativeAbundanceVector[i]*(*theIsotopeVector)[i]->GetN();
192 wtSum += fRelativeAbundanceVector[i];
198 for(
size_t i=0; i<fNumberOfIsotopes; ++i) {
199 fRelativeAbundanceVector[i] /= wtSum;
204 fAtomicShells =
new G4double[fNbOfAtomicShells];
205 fNbOfShellElectrons =
new G4int[fNbOfAtomicShells];
207 for (
G4int j = 0; j < fNbOfAtomicShells; j++ )
212 ComputeDerivedQuantities();
219 void G4Element::InitializePointers()
221 theIsotopeVector = 0;
222 fRelativeAbundanceVector = 0;
224 fNbOfShellElectrons = 0;
226 fNumberOfIsotopes = 0;
227 fNaturalAbandances =
false;
233 fNbOfAtomicShells = 0;
237 fNaturalAbandances =
false;
248 : fZeff(0), fNeff(0), fAeff(0)
250 InitializePointers();
259 if (theIsotopeVector) {
delete theIsotopeVector; }
260 if (fRelativeAbundanceVector) {
delete [] fRelativeAbundanceVector; }
261 if (fAtomicShells) {
delete [] fAtomicShells; }
262 if (fNbOfShellElectrons) {
delete [] fNbOfShellElectrons; }
263 if (fIonisation) {
delete fIonisation; }
266 theElementTable[fIndexInTable] = 0;
271 void G4Element::ComputeDerivedQuantities()
276 theElementTable.push_back(
this);
277 fIndexInTable = theElementTable.size() - 1;
281 for (
size_t J=0 ; J<fIndexInTable ; J++) {
282 if (theElementTable[J]->
GetZ() == fZeff) { ++fIndexZ; }
288 ComputeCoulombFactor();
289 ComputeLradTsaiFactor();
292 if (fIonisation) {
delete fIonisation; }
298 void G4Element::ComputeCoulombFactor()
303 const G4double k1 = 0.0083 , k2 = 0.20206 ,k3 = 0.0020 , k4 = 0.0369 ;
308 fCoulomb = (k1*az4 + k2 + 1./(1.+az2))*az2 - (k3*az4 + k4)*az4;
313 void G4Element::ComputeLradTsaiFactor()
319 const G4double Lrad_light[] = {5.31 , 4.79 , 4.74 , 4.71} ;
320 const G4double Lprad_light[] = {6.144 , 5.621 , 5.805 , 5.924} ;
322 const G4double logZ3 = std::log(fZeff)/3.;
326 if (iz <= 3) { Lrad = Lrad_light[
iz] ; Lprad = Lprad_light[
iz] ; }
327 else { Lrad = std::log(184.15) - logZ3 ; Lprad = std::log(1194.) - 2*logZ3;}
329 fRadTsai = 4*
alpha_rcl2*fZeff*(fZeff*(Lrad-fCoulomb) + Lprad);
334 void G4Element::AddNaturalIsotopes()
340 fNumberOfIsotopes = 0;
341 for(
G4int i=0; i<
n; ++i) {
345 fRelativeAbundanceVector =
new G4double[fNumberOfIsotopes];
348 for(
G4int i=0; i<
n; ++i) {
352 std::ostringstream strm;
353 strm << fSymbol <<
N;
354 (*theIsotopeVector)[idx] =
new G4Isotope(strm.str(),
Z,
N, 0.0, 0);
355 fRelativeAbundanceVector[idx] =
x;
360 if(xsum != 0.0 && xsum != 1.0) {
361 for(
G4int i=0; i<idx; ++i) { fRelativeAbundanceVector[i] /= xsum; }
369 if (i<0 || i>=fNbOfAtomicShells) {
371 ed <<
"Invalid argument " << i <<
" in for G4Element " << fName
372 <<
" with Z= " << fZeff
373 <<
" and Nshells= " << fNbOfAtomicShells
378 return fAtomicShells[i];
385 if (i<0 || i>=fNbOfAtomicShells) {
387 ed <<
"Invalid argument " << i <<
" for G4Element " << fName
388 <<
" with Z= " << fZeff
389 <<
" and Nshells= " << fNbOfAtomicShells
394 return fNbOfShellElectrons[i];
401 return &theElementTable;
408 return theElementTable.size();
416 for (
size_t J=0 ; J<theElementTable.size() ; J++)
418 if (theElementTable[J]->
GetName() == elementName)
419 return theElementTable[J];
424 G4cout <<
"\n---> warning from G4Element::GetElement(). The element: "
425 << elementName <<
" does not exist in the table. Return NULL pointer."
435 InitializePointers();
439 theElementTable.push_back(
this);
440 fIndexInTable = theElementTable.size() - 1;
450 fSymbol = right.fSymbol;
455 if (fAtomicShells)
delete [] fAtomicShells;
456 fNbOfAtomicShells = right.fNbOfAtomicShells;
457 fAtomicShells =
new G4double[fNbOfAtomicShells];
459 if (fNbOfShellElectrons)
delete [] fNbOfShellElectrons;
460 fNbOfAtomicShells = right.fNbOfAtomicShells;
461 fNbOfShellElectrons =
new G4int[fNbOfAtomicShells];
463 for (
G4int i = 0; i < fNbOfAtomicShells; i++ )
465 fAtomicShells[i] = right.fAtomicShells[i];
466 fNbOfShellElectrons[i] = right.fNbOfShellElectrons[i];
468 if (theIsotopeVector)
delete theIsotopeVector;
469 if (fRelativeAbundanceVector)
delete [] fRelativeAbundanceVector;
471 fNumberOfIsotopes = right.fNumberOfIsotopes;
472 if (fNumberOfIsotopes > 0)
475 fRelativeAbundanceVector =
new G4double[fNumberOfIsotopes];
476 for (
size_t i=0;i<fNumberOfIsotopes;i++)
478 (*theIsotopeVector)[i] = (*right.theIsotopeVector)[i];
479 fRelativeAbundanceVector[i] = right.fRelativeAbundanceVector[i];
482 ComputeDerivedQuantities();
505 std::ios::fmtflags mode = flux.flags();
506 flux.setf(std::ios::fixed,std::ios::floatfield);
507 G4long prec = flux.precision(3);
510 <<
" Element: " << element->fName <<
" (" << element->fSymbol <<
")"
511 <<
" Z = " << std::setw(4) << std::setprecision(1) << element->fZeff
512 <<
" N = " << std::setw(5) << std::setprecision(1) << element->fNeff
513 <<
" A = " << std::setw(6) << std::setprecision(2)
514 << (element->fAeff)/(
g/
mole) <<
" g/mole";
516 for (
size_t i=0; i<element->fNumberOfIsotopes; i++)
518 <<
"\n ---> " << (*(element->theIsotopeVector))[i]
519 <<
" abundance: " << std::setw(6) << std::setprecision(2)
520 << (element->fRelativeAbundanceVector[i])/
perCent <<
" %";
522 flux.precision(prec);
523 flux.setf(mode,std::ios::floatfield);
540 flux <<
"\n***** Table : Nb of elements = " << ElementTable.size()
543 for (
size_t i=0; i<ElementTable.size(); i++) flux << ElementTable[i]