[1199] | 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 | // $Id: testG4AtomicShells.cc,v 1.7 2009/09/18 07:47:07 grichine Exp $ |
---|
| 28 | // GEANT4 tag $Name: materials-V09-02-18 $ |
---|
| 29 | // |
---|
| 30 | // |
---|
| 31 | // Test for access to atomic subshell data table, which is the field of |
---|
| 32 | // G4AtomicShells class |
---|
| 33 | // |
---|
| 34 | // 17.09.09 check of electron numbers, V. Grichine |
---|
| 35 | // 09-11-98 adaptation, MMA |
---|
| 36 | // 28-04-98 implementation of the first version, V. Grichine |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | #include "G4ios.hh" |
---|
| 40 | #include <iomanip> |
---|
| 41 | |
---|
| 42 | #include "globals.hh" |
---|
| 43 | #include "G4UnitsTable.hh" |
---|
| 44 | |
---|
| 45 | #include "G4AtomicShells.hh" |
---|
| 46 | #include "G4Element.hh" |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | int main() |
---|
| 50 | { |
---|
| 51 | G4cout.precision(3); |
---|
| 52 | G4UnitDefinition::BuildUnitsTable(); |
---|
| 53 | // |
---|
| 54 | //direct access to G4AtomicShells |
---|
| 55 | // |
---|
| 56 | |
---|
| 57 | G4int Z, NbOfShells, shell, sumNe, Nshell ; |
---|
| 58 | G4double BindingEnergy; |
---|
| 59 | |
---|
| 60 | // for ( Z = 1; Z <= 100; Z++ ) |
---|
| 61 | for ( Z = 100; Z <= 100; Z++ ) |
---|
| 62 | { |
---|
| 63 | G4cout << "\n Atomic Number: " << Z << G4endl; |
---|
| 64 | NbOfShells = G4AtomicShells::GetNumberOfShells(Z); |
---|
| 65 | G4cout << "\n NbOfShells = " << NbOfShells << G4endl; |
---|
| 66 | sumNe = 0; |
---|
| 67 | |
---|
| 68 | for ( shell = 0; shell < NbOfShells; shell++ ) |
---|
| 69 | { |
---|
| 70 | BindingEnergy = G4AtomicShells::GetBindingEnergy(Z,shell); |
---|
| 71 | Nshell = G4AtomicShells::GetNumberOfElectrons(Z,shell); |
---|
| 72 | sumNe += Nshell; |
---|
| 73 | G4cout << std::setw(12) << G4BestUnit(BindingEnergy, "Energy")<<"("<<Nshell<<")"; |
---|
| 74 | if ((shell+1)%4 == 0) G4cout << G4endl; |
---|
| 75 | } |
---|
| 76 | if( sumNe != Z ) |
---|
| 77 | { |
---|
| 78 | G4cout<<"sumNe = "<<sumNe<<"; for Z = "<<Z<<G4endl; |
---|
| 79 | break; |
---|
| 80 | } |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | // |
---|
| 84 | // access via G4Element |
---|
| 85 | // |
---|
| 86 | G4Element* van = new G4Element("Vanadium","V" ,23.0 ,50.9415*g/mole); |
---|
| 87 | |
---|
| 88 | G4cout << "\n Element: " << van->GetName() << G4endl; |
---|
| 89 | NbOfShells = van->GetNbOfAtomicShells(); |
---|
| 90 | G4cout << "\n NbOfShells = " << NbOfShells << G4endl; |
---|
| 91 | |
---|
| 92 | for ( shell = 0; shell < NbOfShells; shell++ ) |
---|
| 93 | { |
---|
| 94 | BindingEnergy = van->GetAtomicShell(shell); |
---|
| 95 | Nshell = van->GetNbOfShellElectrons(shell); |
---|
| 96 | G4cout << std::setw(12) << G4BestUnit(BindingEnergy, "Energy")<<"("<<Nshell<<")"; |
---|
| 97 | if ((shell+1)%4 == 0) G4cout << G4endl; |
---|
| 98 | } |
---|
| 99 | // |
---|
| 100 | // |
---|
| 101 | G4Element xe("Xenon","Xe",54.0,131.29*g/mole); |
---|
| 102 | G4cout << "\n Element: " << xe.GetName() << G4endl; |
---|
| 103 | NbOfShells = xe.GetNbOfAtomicShells(); |
---|
| 104 | G4cout << "\n NbOfShells = " << NbOfShells << G4endl; |
---|
| 105 | |
---|
| 106 | for ( shell = 0; shell < NbOfShells; shell++ ) |
---|
| 107 | { |
---|
| 108 | BindingEnergy = xe.GetAtomicShell(shell); |
---|
| 109 | Nshell = xe.GetNbOfShellElectrons(shell); |
---|
| 110 | G4cout << std::setw(12) << G4BestUnit(BindingEnergy, "Energy")<<"("<<Nshell<<")"; |
---|
| 111 | if ((shell+1)%4 == 0) G4cout << G4endl; |
---|
| 112 | } |
---|
| 113 | // |
---|
| 114 | // |
---|
| 115 | G4Element* fm = new G4Element("Fermium" ,"Fm",100.0,257.083*g/mole); |
---|
| 116 | G4cout << "\n Element: " << fm->GetName() << G4endl; |
---|
| 117 | NbOfShells = fm->GetNbOfAtomicShells(); |
---|
| 118 | G4cout << "\n NbOfShells = " << NbOfShells << G4endl; |
---|
| 119 | |
---|
| 120 | for ( shell = 0; shell < NbOfShells; shell++ ) |
---|
| 121 | { |
---|
| 122 | BindingEnergy = fm->GetAtomicShell(shell); |
---|
| 123 | Nshell = fm->GetNbOfShellElectrons(shell); |
---|
| 124 | G4cout << std::setw(12) << G4BestUnit(BindingEnergy, "Energy")<<"("<<Nshell<<")"; |
---|
| 125 | if ((shell+1)%4 == 0) G4cout << G4endl; |
---|
| 126 | } |
---|
| 127 | G4cout << G4endl; |
---|
| 128 | |
---|
| 129 | return EXIT_SUCCESS; |
---|
| 130 | } |
---|