// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // $Id: G4NistElementBuilder.cc,v 1.22 2008/08/11 11:53:11 vnivanch Exp $ // GEANT4 tag $Name: geant4-09-02-ref-02 $ // // ------------------------------------------------------------------- // // GEANT4 Class file // // File name: G4NistElementBuilder // // Author: Vladimir Ivanchenko // // Creation date: 23.12.2004 // // Modifications: // 02.05.2006 Subtract mass of atomic electrons from NIST mass (VI) // 11.05.2006 Do not subtract mass of atomic electrons from NIST mass (VI) // 17.10.2006 Add natiral abandances flag to element and // use G4 units for isotope mass vector (VI) // 10.05.2007 Add protection agains Z>101 (VI) // 26.07.2007 Create one and only one Nist element with given Z and // allow users to create there own elements with the same Z (VI) // // ------------------------------------------------------------------- // // Class Description: // // Element data from the NIST DB on Atomic Weights and Isotope Compositions // http://physics.nist.gov/PhysRefData/Compositions/index.html // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "G4NistElementBuilder.hh" #include "G4Element.hh" #include //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4NistElementBuilder::G4NistElementBuilder(G4int vb): verbose(vb), first(true) { Initialise(); // Atomic shells are defined only for 101 elements limitNumElements = 101; for(G4int i=0; i0 && elmSymbol[Z] != name); return Z; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4Element* G4NistElementBuilder::FindOrBuildElement(const G4String& symb, G4bool buildIsotopes) { if(first) { if(verbose > 0) { G4cout << "### NIST DataBase for Elements is used" << G4endl; } first = false; } G4int Z = 0; G4Element* elm = 0; do {Z++;} while (Z= 0) { const G4ElementTable* theElementTable = G4Element::GetElementTable(); anElement = (*theElementTable)[elmIndex[Z]]; // build new element } else { anElement = BuildElement(Z, buildIsotopes); if(anElement) elmIndex[Z] = anElement->GetIndex(); } return anElement; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4Element* G4NistElementBuilder::BuildElement(G4int Z, G4bool buildIsotopes) { G4Element* theElement = 0; if(Z<1 || Z>=limitNumElements) return theElement; G4double Zeff = (G4double)Z; G4double Aeff = atomicMass[Z]; if (verbose > 1) { G4cout << "G4NistElementBuilder: Build Element <" << elmSymbol[Z] << "> Z= " << Zeff << " A= " << Aeff; if(buildIsotopes) G4cout << " with natural isotope composition" << G4endl; else G4cout << " isotopes are not built" << G4endl; } //build Element with its Isotopes // if (buildIsotopes) { G4int nc = nIsotopes[Z]; G4int n0 = nFirstIsotope[Z]; G4int idx = idxIsotopes[Z]; std::vector iso; G4Isotope* ist; for (G4int i=0; i 0.0) { std::ostringstream os; os << elmSymbol[Z] << n0 + i; ist = new G4Isotope(os.str(), Z, n0 + i, GetAtomicMass(Z, n0 + i)*g/(mole*amu_c2)); /* G4cout << " Z= " << Z << " N= " << n0 + i << " miso(amu)= " << GetIsotopeMass(Z, n0 + i)/amu_c2 << " matom(amu)= " << GetAtomicMass(Z, n0 + i)/amu_c2 << G4endl; */ iso.push_back(ist); } } G4int ni = iso.size(); G4double w; theElement = new G4Element(elmSymbol[Z],elmSymbol[Z],ni); for(G4int j=0; jGetN() - n0]; ist = iso[j]; theElement->AddIsotope(ist, w); } } //build Element without Isotopes // else { theElement = new G4Element(elmSymbol[Z],elmSymbol[Z],Zeff,Aeff*gram/mole); } theElement->SetNaturalAbandancesFlag(buildIsotopes); return theElement; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void G4NistElementBuilder::PrintElement(G4int Z) { G4int imin = Z; G4int imax = Z+1; if (Z == 0) { imin = 1; imax = maxNumElements; } if(imax > maxNumElements) imax = maxNumElements; for(G4int i=imin; i Z= " << i << " Aeff(amu)= " << atomicMass[i] << " " << nc << " isotopes:" << G4endl; if(verbose > 1) { G4int j; G4int idx = idxIsotopes[i]; G4int n0 = nFirstIsotope[i]; G4cout << " N: "; for(j=0; j 1) G4cout << "AddElement " << name << " Z= " << Z << " nc= " << nc << G4endl; if (Z >= maxNumElements) { G4cout << "G4NistElementBuilder::AddElement: Warning! Z= " << Z << " is too big" << G4endl; return; } if (index >= maxAbundance) { G4cout << "G4NistElementBuilder::AddElement: Warning! index= " << index << " is too big" << G4endl; return; } elmSymbol[Z] = name; atomicMass[Z] = 0.0; idxIsotopes[Z] = index; nIsotopes[Z] = nc; nFirstIsotope[Z] = (&N)[0]; G4double ww = 0.0; G4double www; size_t nm = nc; for(size_t i=0; i 0) PrintElement(Z); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void G4NistElementBuilder::Initialise() { // Parameterisation from D.Lunney,J.M.Pearson,C.Thibault, // Rev.Mod.Phys. 75 (2003) 1021 bindingEnergy[0] = 0.0; for(G4int i=1; i