Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -24,84 +24,62 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// 21-04-16, created by E.Bagli
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4CrystalExtension.hh"
|
||||
|
||||
#include "G4AtomicFormFactor.hh"
|
||||
|
||||
G4CrystalExtension::G4CrystalExtension(G4Material* mat, const G4String& name)
|
||||
: G4VMaterialExtension(name)
|
||||
, fMaterial(mat)
|
||||
, theUnitCell(nullptr)
|
||||
: G4VMaterialExtension(name), fMaterial(mat)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4CrystalExtension::~G4CrystalExtension()
|
||||
{}
|
||||
G4complex G4CrystalExtension::ComputeStructureFactor(
|
||||
G4double kScatteringVector, G4int h, G4int k, G4int l)
|
||||
{
|
||||
// SF == Structure Factor
|
||||
// AFF == Atomic Form Factor
|
||||
// GFS == Geometrical Structure Factor
|
||||
G4complex SF = G4complex(0., 0.);
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
for (auto& anElement : *(fMaterial->GetElementVector())) {
|
||||
G4double AFF = G4AtomicFormFactor::GetManager()->Get(kScatteringVector, anElement->GetZ());
|
||||
|
||||
G4complex G4CrystalExtension::
|
||||
ComputeStructureFactor(G4double kScatteringVector,
|
||||
G4int h,
|
||||
G4int k,
|
||||
G4int l){
|
||||
//SF == Structure Factor
|
||||
//AFF == Atomic Form Factor
|
||||
//GFS == Geometrical Structure Factor
|
||||
G4complex SF = G4complex(0.,0.);
|
||||
G4complex GFS = G4complex(0., 0.);
|
||||
|
||||
for(auto & anElement: *(fMaterial->GetElementVector())){
|
||||
G4double AFF = G4AtomicFormFactor::GetManager()->Get(kScatteringVector,anElement->GetZ());
|
||||
|
||||
G4complex GFS = G4complex(0.,0.);
|
||||
|
||||
for(const auto& anAtomPos : GetAtomBase(anElement)->GetPos())
|
||||
{
|
||||
G4double aDouble = h * anAtomPos.x()
|
||||
+ k * anAtomPos.y()
|
||||
+ l * anAtomPos.z();
|
||||
GFS += G4complex(std::cos(CLHEP::twopi * aDouble),
|
||||
std::sin(CLHEP::twopi * aDouble));
|
||||
}
|
||||
|
||||
|
||||
SF += G4complex(AFF * GFS.real(),AFF * GFS.imag());
|
||||
for (const auto& anAtomPos : GetAtomBase(anElement)->GetPos()) {
|
||||
G4double aDouble = h * anAtomPos.x() + k * anAtomPos.y() + l * anAtomPos.z();
|
||||
GFS += G4complex(std::cos(CLHEP::twopi * aDouble), std::sin(CLHEP::twopi * aDouble));
|
||||
}
|
||||
return SF;
|
||||
|
||||
SF += G4complex(AFF * GFS.real(), AFF * GFS.imag());
|
||||
}
|
||||
return SF;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4complex G4CrystalExtension::
|
||||
ComputeStructureFactorGeometrical(G4int h,
|
||||
G4int k,
|
||||
G4int l){
|
||||
//GFS == Geometrical Structure Form Factor
|
||||
G4complex GFS = G4complex(0.,0.);
|
||||
|
||||
for(auto & anElement: *(fMaterial->GetElementVector())){
|
||||
for(const auto& anAtomPos : GetAtomBase(anElement)->GetPos())
|
||||
{
|
||||
G4double aDouble =
|
||||
h * anAtomPos.x() + k * anAtomPos.y() + l * anAtomPos.z();
|
||||
GFS += G4complex(std::cos(CLHEP::twopi * aDouble),
|
||||
std::sin(CLHEP::twopi * aDouble));
|
||||
}
|
||||
G4complex G4CrystalExtension::ComputeStructureFactorGeometrical(G4int h, G4int k, G4int l)
|
||||
{
|
||||
// GFS == Geometrical Structure Form Factor
|
||||
G4complex GFS = G4complex(0., 0.);
|
||||
|
||||
for (auto& anElement : *(fMaterial->GetElementVector())) {
|
||||
for (const auto& anAtomPos : GetAtomBase(anElement)->GetPos()) {
|
||||
G4double aDouble = h * anAtomPos.x() + k * anAtomPos.y() + l * anAtomPos.z();
|
||||
GFS += G4complex(std::cos(CLHEP::twopi * aDouble), std::sin(CLHEP::twopi * aDouble));
|
||||
}
|
||||
return GFS;
|
||||
}
|
||||
return GFS;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4CrystalExtension::SetElReduced(const ReducedElasticity& mat) {
|
||||
for (size_t i=0; i<6; ++i) {
|
||||
for (size_t j=0; j<6; ++j) {
|
||||
void G4CrystalExtension::SetElReduced(const ReducedElasticity& mat)
|
||||
{
|
||||
for (size_t i = 0; i < 6; ++i) {
|
||||
for (size_t j = 0; j < 6; ++j) {
|
||||
fElReduced[i][j] = mat[i][j];
|
||||
}
|
||||
}
|
||||
@@ -109,50 +87,49 @@ void G4CrystalExtension::SetElReduced(const ReducedElasticity& mat) {
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4CrystalExtension::SetCpq(G4int p, G4int q, G4double value) {
|
||||
if(p > 0 && p < 7 && q > 0 && q < 7)
|
||||
{
|
||||
void G4CrystalExtension::SetCpq(G4int p, G4int q, G4double value)
|
||||
{
|
||||
if (p > 0 && p < 7 && q > 0 && q < 7) {
|
||||
fElReduced[p - 1][q - 1] = value;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4CrystalAtomBase* G4CrystalExtension::GetAtomBase(const G4Element* anElement){
|
||||
if((theCrystalAtomBaseMap.count(anElement)<1)){
|
||||
G4String astring = "Atom base for element " + anElement->GetName()
|
||||
+ " is not registered." ;
|
||||
G4Exception ("G4CrystalExtension::GetAtomBase()", "cry001", JustWarning,astring);
|
||||
|
||||
AddAtomBase(anElement, new G4CrystalAtomBase());
|
||||
}
|
||||
return theCrystalAtomBaseMap[anElement];
|
||||
G4CrystalAtomBase* G4CrystalExtension::GetAtomBase(const G4Element* anElement)
|
||||
{
|
||||
if ((theCrystalAtomBaseMap.count(anElement) < 1)) {
|
||||
G4String astring = "Atom base for element " + anElement->GetName() + " is not registered.";
|
||||
G4Exception("G4CrystalExtension::GetAtomBase()", "cry001", JustWarning, astring);
|
||||
|
||||
AddAtomBase(anElement, new G4CrystalAtomBase());
|
||||
}
|
||||
return theCrystalAtomBaseMap[anElement];
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool G4CrystalExtension::GetAtomPos(const G4Element* anEl, std::vector<G4ThreeVector>& vecout){
|
||||
std::vector<G4ThreeVector> pos;
|
||||
for(auto & asinglepos: GetAtomBase(anEl)->GetPos()){
|
||||
pos.clear();
|
||||
theUnitCell->FillAtomicPos(asinglepos,pos);
|
||||
vecout.insert(std::end(vecout), std::begin(pos), std::end(pos));
|
||||
}
|
||||
return true;
|
||||
G4bool G4CrystalExtension::GetAtomPos(const G4Element* anEl, std::vector<G4ThreeVector>& vecout)
|
||||
{
|
||||
std::vector<G4ThreeVector> pos;
|
||||
for (auto& asinglepos : GetAtomBase(anEl)->GetPos()) {
|
||||
pos.clear();
|
||||
theUnitCell->FillAtomicPos(asinglepos, pos);
|
||||
vecout.insert(std::end(vecout), std::begin(pos), std::end(pos));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool G4CrystalExtension::GetAtomPos(std::vector<G4ThreeVector>& vecout){
|
||||
std::vector<G4ThreeVector> pos;
|
||||
vecout.clear();
|
||||
for(auto & anElement: *(fMaterial->GetElementVector())){
|
||||
pos.clear();
|
||||
GetAtomPos(anElement,pos);
|
||||
vecout.insert(std::end(vecout), std::begin(pos), std::end(pos));
|
||||
}
|
||||
return true;
|
||||
G4bool G4CrystalExtension::GetAtomPos(std::vector<G4ThreeVector>& vecout)
|
||||
{
|
||||
std::vector<G4ThreeVector> pos;
|
||||
vecout.clear();
|
||||
for (auto& anElement : *(fMaterial->GetElementVector())) {
|
||||
pos.clear();
|
||||
GetAtomPos(anElement, pos);
|
||||
vecout.insert(std::end(vecout), std::begin(pos), std::end(pos));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
Reference in New Issue
Block a user