猪头Geant4讲座(7)
时间:2025-04-20
时间:2025-04-20
G4Isotope* U8 = new G4Isotope("U238", iz=92, n=238, a=238.03*g/mole);
G4Element* U = new G4Element("enriched Uranium",symbol="U",ncomponents=2);
U->AddIsotope(U5, abundance= 90.*perCent);
U->AddIsotope(U8, abundance= 10.*perCent);
定义完元素之后我们就可以定义材料了。
前面我们说了,材料可以分为单质(只有一种元素)和化合物(或混合物,含有两种或两种以上的元素)。 不管是单质还是化合物,如果我们知道其中每种元素的份额(单质可以认为其组成元素的份额是100%),那我们就可以确定这种材料的组成了。再加上密度等信息就可以确定这种材料的具体状态了。这就是Geant4中的一种材料定义法。而Geant4中为了方便定义材料,将份额还分为了两种,分别是原子数份额和质量份额。
定义方法参考$G4INSTLL/source/materials/include/G4Material.hh如下:
// Constructor to create a material from a combination of elements
// and/or materials subsequently added via AddElement and/or AddMaterial
//
G4Material(const G4String& name, //its name
G4double density, //density
G4int nComponents, //nbOfComponents
G4State state = kStateUndefined, //solid,gas
G4double temp = STP_Temperature, //temperature
G4double pressure = STP_Pressure); //pressure
//
// Add an element, giving number of atoms
//
void AddElement(G4Element* element, //the element
G4int nAtoms); //nb of atoms in
// a molecule
//
// Add an element or material, giving fraction of mass
//
void AddElement (G4Element* element , //the element
G4double fraction); //fractionOfMass
$G4INSTALL/example/novice/N03中二氧化硅就是采用的原子数份额定义的,而空气则是采用的质量份额定义的。
G4Material* SiO2 =
new G4Material("quartz",density= 2.200*g/cm3, ncomponents=2);
SiO2->AddElement(Si, natoms=1);
SiO2->AddElement(O , natoms=2);
G4Material* Air =
new G4Material("Air" , density= 1.290*mg/cm3, ncomponents=2);
Air->AddElement(N, fractionmass=0.7);
Air->AddElement(O, fractionmass=0.3);
上一篇:日常工作准则