Problem 2356

Summary: Missing unit in G4AtomicShells::GetNumberOfFreeElectrons
Product: Geant4 Reporter: Valentin <niess>
Component: materialsAssignee: Vladimir.Ivantchenko
Status: RESOLVED FIXED    
Severity: minor    
Priority: P4    
Version: 10.7   
Hardware: All   
OS: All   

Description Valentin 2021-04-07 13:37:00 CEST
In method ComputeDerivedQuantities of G4Material.cc, at line:

https://gitlab.cern.ch/geant4/geant4/-/blob/master/source/materials/src/G4Material.cc#L318

G4AtomicShells::GetNumberOfFreeElectrons is called with a threshold elecTh given as `15 * CLHEP::eV` i.e. 15E-06 (MeV). However, in the corresponding method at line:

https://gitlab.cern.ch/geant4/geant4/-/blob/master/source/materials/src/G4AtomicShells.cc#L792

elecTh (th) is compared to fBindingEnergies which is expressed raw in eV, e.g. 13.6 for H. As a result the comparison always fails. Instead, the previous line should be:

if (fBindingEnergies[i] * CLEHP::eV <= th) ...

E.g. as here:

https://gitlab.cern.ch/geant4/geant4/-/blob/master/source/materials/src/G4AtomicShells.cc#L763
Comment 1 Vladimir.Ivantchenko 2021-04-19 09:02:29 CEST
Hello,

thank you very much for this very detailed and clear bug report. The fix is merged to the current master of Geant4 and prepared for the next patch for Geant4 10.7. The date of this patch is not yet defined.

Vladimir