Message: G4Material->GetN() uses amu for calculation Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None G4Material->GetN() uses amu for calculation 

Forum: Hadronic Processes
Date: 22 Oct, 2015
From: John Leacock <John Leacock>

I found this difference (bug?) when comparing NIST and geant4 defined materials.

Calling GetN() on a NIST defined material

    G4Material* G4_He  = manager->FindOrBuildMaterial("G4_He");

gives the average N of the atoms in the materials. This is calculated by the fractional abundance multiplied by the integer nucleon number. For NIST helium it is 3.99999863000050703832.

The same call for a geant4 defined material

    G4String name;
    G4double z, a, density;
    z = G4_He->GetZ();
    a = G4_He->GetA();
    density = G4_He->GetDensity();

    G4Material* He = new G4Material(name="He", z, a, density);

gives a value of 4.00264258508573878004. This value is calculated by using the atomic mass unit instead of the integer nucleon number.

Why is there a difference between the two? I think NIST has the nucleon number correct. Am I right?

Here is the code I used to produce this bug.

    G4Material* G4_He  = manager->FindOrBuildMaterial("G4_He");

    G4String name;
    G4double z, a, density;
    z = G4_He->GetZ();
    a = G4_He->GetA();
    density = G4_He->GetDensity();

    G4Material* He = new G4Material(name="He", z, a, density);

    G4double * G4_He_ab = ((*G4_He->GetElementVector())[0])->GetRelativeAbundanceVector();
    G4double * He_ab = ((*He->GetElementVector())[0])->GetRelativeAbundanceVector();

    G4cout
      << std::fixed << std::setprecision(20)
      << G4_He_ab[0] * 3 + G4_He_ab[1] * 4 << " " << G4endl
      << He_ab[0] * 3 + He_ab[1] * 4 << " "
      << G4endl;

    G4cout
      << std::fixed << std::setprecision(20)
      << G4_He_ab[0] * (*(*(G4_He->GetElementVector()))[0]->GetIsotopeVector())[0]->GetA()/(g/mole)
      + G4_He_ab[1] * (*(*(G4_He->GetElementVector()))[0]->GetIsotopeVector())[1]->GetA()/(g/mole)
      << " " << G4endl
      << He_ab[0] * (*(*(He->GetElementVector()))[0]->GetIsotopeVector())[0]->GetA()/(g/mole)
      + He_ab[1] * (*(*(He->GetElementVector()))[0]->GetIsotopeVector())[1]->GetA()/(g/mole)
      << G4endl;

    G4cout
      << std::fixed << std::setprecision(20)
      << (*(G4_He->GetElementVector()))[0]->GetN() << " " << G4endl
      << (*(He->GetElementVector()))[0]->GetN() << " "
      << G4endl;

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Ok: Re: G4Material->GetN() uses amu for calculation   (Vladimir Ivanchenko - 27 Oct, 2015)
 Add Message Add Message
to: "G4Material->GetN() uses amu for calculation"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]