Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4CrystalExtension.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 
0026 //---------------------------------------------------------------------------
0027 //
0028 // ClassName:   G4CrystalExtension
0029 //
0030 // Description: Contains crystal properties
0031 //
0032 // Class description:
0033 //
0034 // Extension of G4Material for the management of a crystal
0035 // structure. It has to be attached to a G4ExtendedMaterial
0036 // in order to instantiate a G4LogicalCrystalVolume.
0037 //
0038 // 21-04-16, created by E.Bagli
0039 
0040 #ifndef G4CrystalExtension_HH
0041 #define G4CrystalExtension_HH 1
0042 
0043 #include "G4AtomicBond.hh"
0044 #include "G4CrystalAtomBase.hh"
0045 #include "G4CrystalUnitCell.hh"
0046 #include "G4NistManager.hh"
0047 #include "G4VMaterialExtension.hh"
0048 
0049 #include <vector>
0050 
0051 class G4CrystalExtension : public G4VMaterialExtension
0052 {
0053  public:
0054   // Elasticity and reduced elasticity tensors
0055   using Elasticity = G4double[3][3][3][3];
0056   using ReducedElasticity = G4double[6][6];
0057 
0058  public:  // with description
0059   // Constructor to create a material
0060   G4CrystalExtension(G4Material*, const G4String& name = "crystal");
0061 
0062   ~G4CrystalExtension() override = default;
0063 
0064   void Print() const override { ; };
0065 
0066   G4Material* GetMaterial() { return fMaterial; };
0067   void SetMaterial(G4Material* aMat) { fMaterial = aMat; };
0068 
0069   inline void SetUnitCell(G4CrystalUnitCell* aUC) { theUnitCell = aUC; }
0070   inline G4CrystalUnitCell* GetUnitCell() const { return theUnitCell; }
0071 
0072   const Elasticity& GetElasticity() const { return fElasticity; }
0073   const ReducedElasticity& GetElReduced() const { return fElReduced; }
0074 
0075   G4double GetCijkl(G4int i, G4int j, G4int k, G4int l) const { return fElasticity[i][j][k][l]; }
0076 
0077   // Reduced elasticity tensor: C11-C66 interface for clarity
0078   void SetElReduced(const ReducedElasticity& mat);
0079 
0080   void SetCpq(G4int p, G4int q, G4double value);
0081   G4double GetCpq(G4int p, G4int q) const { return fElReduced[p - 1][q - 1]; }
0082 
0083   G4CrystalAtomBase* GetAtomBase(const G4Element* anElement);
0084   void AddAtomBase(const G4Element* anElement, G4CrystalAtomBase* aBase)
0085   {
0086     theCrystalAtomBaseMap.insert(std::pair<const G4Element*, G4CrystalAtomBase*>(anElement, aBase));
0087   }
0088 
0089   G4CrystalAtomBase* GetAtomBase(G4int anElIdx)
0090   {
0091     return GetAtomBase(fMaterial->GetElement(anElIdx));
0092   }
0093 
0094   void AddAtomBase(G4int anElIdx, G4CrystalAtomBase* aLattice)
0095   {
0096     AddAtomBase(fMaterial->GetElement(anElIdx), aLattice);
0097   }
0098 
0099   // Get the position of all the atoms in the unit cell
0100   // for a single element or all the elements
0101   G4bool GetAtomPos(const G4Element* anEl, std::vector<G4ThreeVector>& vecout);
0102   G4bool GetAtomPos(std::vector<G4ThreeVector>& vecout);
0103 
0104   G4bool GetAtomPos(G4int anElIdx, std::vector<G4ThreeVector>& vecout)
0105   {
0106     GetAtomPos(fMaterial->GetElement(anElIdx), vecout);
0107     return true;
0108   }
0109 
0110   // Structure factor calculations
0111   // Eq. 46, Chapter 2 , Introduction to solid state physics, C. Kittel
0112   G4complex ComputeStructureFactor(G4double kScatteringVector, G4int h, G4int k, G4int l);
0113   G4complex ComputeStructureFactorGeometrical(G4int h, G4int k, G4int l);
0114 
0115   void AddAtomicBond(G4AtomicBond* aBond) { theAtomicBondVector.push_back(aBond); };
0116   G4AtomicBond* GetAtomicBond(G4int idx) { return theAtomicBondVector[idx]; };
0117   std::vector<G4AtomicBond*> GetAtomicBondVector() { return theAtomicBondVector; };
0118 
0119  protected:
0120   Elasticity fElasticity;  // Full 4D elasticity tensor
0121   ReducedElasticity fElReduced;  // Reduced 2D elasticity tensor
0122 
0123  private:
0124   G4Material* fMaterial;
0125 
0126   // Crystal cell description, i.e. space group
0127   // and cell parameters
0128   G4CrystalUnitCell* theUnitCell{nullptr};
0129 
0130   // Map of atom positions for each element
0131   // The coordinate system is the unit cell
0132   std::map<const G4Element*, G4CrystalAtomBase*> theCrystalAtomBaseMap;
0133 
0134   // Bond between atoms. Each bond is mapped with two Elements
0135   // and the number of the atoms in the corresponding G4CrystalBaseAtomPos
0136   std::vector<G4AtomicBond*> theAtomicBondVector;
0137 };
0138 
0139 #endif