Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4CrystalExtension.hh
Go to the documentation of this file.
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: G4CrystalExtension.hh 94016 2015-11-05 10:14:49Z gcosmo $
28 //
29 
30 //---------------------------------------------------------------------------
31 //
32 // ClassName: G4CrystalExtension
33 //
34 // Description: Contains crystal properties
35 //
36 // Class description:
37 //
38 // Extension of G4Material for the management of a crystal
39 // structure. It has to be attached to a G4ExtendedMaterial
40 // in order to instantiate a G4LogicalCrystalVolume.
41 //
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
45 // 21-04-16, created by E.Bagli
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
49 #ifndef G4CrystalExtension_HH
50 #define G4CrystalExtension_HH 1
51 
52 #include "G4VMaterialExtension.hh"
53 #include "G4CrystalAtomBase.hh"
54 #include "G4AtomicBond.hh"
55 #include "G4CrystalUnitCell.hh"
56 #include "G4NistManager.hh"
57 #include <vector>
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60 
62 {
63 public: // with description
64  //
65  // Constructor to create a material
66  //
67  G4CrystalExtension(G4Material* ,const G4String& name = "crystal");
68 
70 
71  void Print() const {;};
72 private:
73  G4Material* fMaterial;
74 
75 public:
76  G4Material* GetMaterial() {return fMaterial;};
77  void SetMaterial(G4Material* aMat) {fMaterial = aMat;};
78 
79 
80  //
81  // Crystal cell description, i.e. space group
82  // and cell parameters
83  //
84 
85 private:
86  G4CrystalUnitCell* theUnitCell;
87 public:
88  inline void SetUnitCell(G4CrystalUnitCell* aUC) {theUnitCell=aUC;}
90  const {return theUnitCell;}
91 
92  //
93  // Elasticity and reduced elasticity tensors
94  //
95 
96 public:
97  typedef G4double Elasticity[3][3][3][3];
98  typedef G4double ReducedElasticity[6][6];
99 
100 protected:
101  Elasticity fElasticity; // Full 4D elasticity tensor
102  ReducedElasticity fElReduced; // Reduced 2D elasticity tensor
103 
104 public:
105  const Elasticity& GetElasticity() const { return fElasticity; }
106  const ReducedElasticity& GetElReduced() const { return fElReduced; }
107 
108 public:
109  G4double GetCijkl(G4int i, G4int j, G4int k, G4int l) const {
110  return fElasticity[i][j][k][l];
111  }
112 
113  // Reduced elasticity tensor: C11-C66 interface for clarity
114  void SetElReduced(const ReducedElasticity& mat);
115 
116  void SetCpq(G4int p, G4int q, G4double value);
117  G4double GetCpq(G4int p, G4int q) const { return fElReduced[p-1][q-1]; }
118 
119  //
120  // Map of atom positions for each element
121  // The coordinate system is the unit cell
122  //
123 private:
124  std::map<const G4Element*,G4CrystalAtomBase*> theCrystalAtomBaseMap;
125 
126 public:
127  G4CrystalAtomBase* GetAtomBase(const G4Element* anElement);
128 
129  void AddAtomBase(const G4Element* anElement,G4CrystalAtomBase* aBase){
130  theCrystalAtomBaseMap.insert(std::pair<const G4Element*,G4CrystalAtomBase*>(anElement,aBase));
131  }
132 
133 
135  return GetAtomBase(fMaterial->GetElement(anElIdx));
136  }
137 
138  void AddAtomBase(G4int anElIdx,G4CrystalAtomBase* aLattice){
139  AddAtomBase(fMaterial->GetElement(anElIdx),aLattice);
140  }
141 
142  //
143  // Get the position of all the atoms in the unit cell
144  // for a single element or all the elements
145  //
146  G4bool GetAtomPos(const G4Element* anEl, std::vector<G4ThreeVector>& vecout);
147  G4bool GetAtomPos(std::vector<G4ThreeVector>& vecout);
148 
149  G4bool GetAtomPos(G4int anElIdx, std::vector<G4ThreeVector>& vecout){
150  GetAtomPos(fMaterial->GetElement(anElIdx),vecout);
151  return true;
152  }
153 
154 
155  //
156  // Structure factor calculations
157  // Eq. 46, Chapter 2 , Introduction to solid state physics, C. Kittel
158  //
159  G4complex ComputeStructureFactor(G4double kScatteringVector,
160  G4int h,
161  G4int k,
162  G4int l);
164  G4int k,
165  G4int l);
166 
167  //
168  // Bond between atoms. Each bond is mapped with two Elements
169  // and the number of the atoms in the corresponding G4CrystalBaseAtomPos
170  //
171 
172 private:
173  std::vector<G4AtomicBond*> theAtomicBondVector;
174 
175 public:
176  void AddAtomicBond(G4AtomicBond* aBond) {theAtomicBondVector.push_back(aBond);};
177  G4AtomicBond* GetAtomicBond(G4int idx) {return theAtomicBondVector[idx];};
178  std::vector<G4AtomicBond*> GetAtomicBondVector() {return theAtomicBondVector;};
179 
180 };
181 
182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
183 
184 #endif
void SetUnitCell(G4CrystalUnitCell *aUC)
const XML_Char * name
Definition: expat.h:151
G4bool GetAtomPos(const G4Element *anEl, std::vector< G4ThreeVector > &vecout)
G4CrystalUnitCell * GetUnitCell() const
G4double GetCpq(G4int p, G4int q) const
G4bool GetAtomPos(G4int anElIdx, std::vector< G4ThreeVector > &vecout)
G4Material * GetMaterial()
void SetMaterial(G4Material *aMat)
void AddAtomBase(const G4Element *anElement, G4CrystalAtomBase *aBase)
const char * p
Definition: xmltok.h:285
void SetCpq(G4int p, G4int q, G4double value)
std::vector< G4AtomicBond * > GetAtomicBondVector()
G4complex ComputeStructureFactor(G4double kScatteringVector, G4int h, G4int k, G4int l)
G4CrystalExtension(G4Material *, const G4String &name="crystal")
const G4Element * GetElement(G4int iel) const
Definition: G4Material.hh:202
int G4int
Definition: G4Types.hh:78
const ReducedElasticity & GetElReduced() const
G4AtomicBond * GetAtomicBond(G4int idx)
std::complex< G4double > G4complex
Definition: G4Types.hh:81
void AddAtomicBond(G4AtomicBond *aBond)
const XML_Char int const XML_Char * value
Definition: expat.h:331
G4complex ComputeStructureFactorGeometrical(G4int h, G4int k, G4int l)
bool G4bool
Definition: G4Types.hh:79
G4double GetCijkl(G4int i, G4int j, G4int k, G4int l) const
G4double Elasticity[3][3][3][3]
void SetElReduced(const ReducedElasticity &mat)
G4CrystalAtomBase * GetAtomBase(const G4Element *anElement)
G4double ReducedElasticity[6][6]
const Elasticity & GetElasticity() const
double G4double
Definition: G4Types.hh:76
ReducedElasticity fElReduced
G4CrystalAtomBase * GetAtomBase(G4int anElIdx)
void AddAtomBase(G4int anElIdx, G4CrystalAtomBase *aLattice)