Phoebe developer's documentation  1.1.0
Phonon and Electron Boltzmann Equations
Crystal Class Reference

Object to store the information on the crystal unit cell, such as atomic positions, crystal lattice vectors, etc... More...

#include <crystal.h>

Public Member Functions

 Crystal (Context &context, Eigen::Matrix3d &directUnitCell_, Eigen::MatrixXd &atomicPositions_, Eigen::VectorXi &atomicSpecies_, std::vector< std::string > &speciesNames_, Eigen::VectorXd &speciesMasses_, Eigen::Tensor< double, 3 > &bornCharges_, Eigen::Matrix3d &dielectricMatrix)
 Class containing the information on the crystal structure Note: a number of important quantities used throughout the code are referenced here, so check if it does go out of scope. More...
 
 Crystal ()
 Empty constructor.
 
 Crystal (const Crystal &obj)
 Copy constructor.
 
Crystaloperator= (const Crystal &obj)
 Copy assignment operator.
 
void print () const
 Print the crystal information.
 
const Eigen::Matrix3d & getDirectUnitCell ()
 Returns the crystal unit cell in real space, in Bohr. More...
 
const Eigen::Matrix3d & getReciprocalUnitCell ()
 Returns the reciprocal lattice vectors, in units of Bohr^-1/tpi. More...
 
const int & getNumAtoms ()
 get the number of atoms in the unit cell
 
const Eigen::Tensor< double, 3 > getBornEffectiveCharges ()
 Return the born effective charges for the crystal object.
 
const Eigen::Matrix3d getDielectricMatrix ()
 Return the dielectric matrix for the crystal object. More...
 
double getVolumeUnitCell (int dimensionality_=3) const
 get the volume of the crystal unit cell in Bohr^3 More...
 
const std::vector< SymmetryOperation > & getSymmetryOperations ()
 get the symmetry operations of the crystal, in cartesian coordinates. More...
 
int getNumSymmetries () const
 get the number of symmetries operations that are used by phoebe. More...
 
const Eigen::MatrixXd & getAtomicPositions ()
 get the atomic positions, in cartesian coordinates we return an array of size (numAtoms,3)
 
const Eigen::VectorXi & getAtomicSpecies ()
 get the species of each atom in the unit cell. More...
 
const std::vector< std::string > & getAtomicNames ()
 get the vector of atomic names vector has size (numAtoms)
 
const Eigen::VectorXd & getAtomicMasses ()
 get the vector of atomic masses the vector has size (numAtoms)
 
const std::vector< std::string > & getSpeciesNames ()
 get the vector of names of atomic species the vector has size (numSpecies)
 
const Eigen::VectorXd & getSpeciesMasses ()
 get the vector of masses of atomic species, in rydberg the vector has size (numSpecies)
 
int getDimensionality () const
 return the dimensionality of the crystal, i.e. More...
 
int getNumSpecies () const
 Return the number of atomic species present in the crystal.
 
const Eigen::VectorXd & getAtomicIsotopeCouplings ()
 
Eigen::Vector3d crystalToCartesian (const Eigen::Vector3d &point)
 Change of basis method to convert crystal wavevector to cartesian coordinates. More...
 
Eigen::Vector3d cartesianToCrystal (const Eigen::Vector3d &point)
 Change of basis method to convert crystal wavevector to cartesian coordinates. More...
 
std::tuple< Eigen::MatrixXd, Eigen::VectorXd > buildWignerSeitzVectors (const Eigen::Vector3i &grid, const int &superCellFactor=2)
 Build the list of Bravais lattice vectors (real space) that live within the Wigner Seitz zone of a super cell which is grid(0) x grid(1) x grid(2) bigger than the unitCell. More...
 
std::tuple< Eigen::MatrixXd, Eigen::Tensor< double, 3 > > buildWignerSeitzVectorsWithShift (const Eigen::Vector3i &grid, const Eigen::MatrixXd &shift, const int &superCellFactor=2)
 Similar to buildWignerSeitzVectors, we build the list of Bravais lattice vectors (real space) that live within the Wigner Seitz zone of a super cell which is grid(0) x grid(1) x grid(2) bigger than the unitCell. More...
 
void generateSymmetryInformation (Context &context)
 A function to set up the symmetry rotation matrices for a crystal, which are then stored in this object.
 

Protected Member Functions

void setDirectUnitCell (const Eigen::Matrix3d &directUnitCell_)
 Internal utility to set the crystal unit cell and the reciprocal cell.
 

Static Protected Member Functions

static Eigen::Matrix3d calcReciprocalCell (const Eigen::Matrix3d &directUnitCell)
 utility function to invert the direct unit cell
 

Protected Attributes

Eigen::Matrix3d directUnitCell
 These are the internal quantities used to store. More...
 
Eigen::Matrix3d reciprocalUnitCell
 
double volumeUnitCell
 
int numAtoms
 
int numSpecies
 
int dimensionality
 
Eigen::MatrixXd atomicPositions
 
Eigen::VectorXi atomicSpecies
 
std::vector< std::string > atomicNames
 
Eigen::VectorXd atomicMasses
 
Eigen::VectorXd atomicIsotopeCouplings
 
Eigen::Tensor< double, 3 > bornCharges
 
Eigen::Matrix3d dielectricMatrix
 
std::vector< std::string > speciesNames
 
Eigen::VectorXd speciesMasses
 
Eigen::VectorXd speciesIsotopeCouplings
 
std::vector< SymmetryOperationsymmetryOperations
 
int numSymmetries
 

Detailed Description

Note that fractional occupancies are not supported.

Constructor & Destructor Documentation

◆ Crystal()

Crystal::Crystal ( Context context,
Eigen::Matrix3d &  directUnitCell_,
Eigen::MatrixXd &  atomicPositions_,
Eigen::VectorXi &  atomicSpecies_,
std::vector< std::string > &  speciesNames_,
Eigen::VectorXd &  speciesMasses_,
Eigen::Tensor< double, 3 > &  bornCharges_,
Eigen::Matrix3d &  dielectricMatrix 
)
Parameters
directUnitCella matrix containing the crystal lattice vectors in Bohr.
atomicPositions(numAtoms,3)list of atomic positions in cartesian coordinates.
atomicSpecies(numAtoms)list of integers identifying the species of each atom.
speciesNames(numSpecies)list of names of species. The position should match the indices of the parameter atomicSpecies.
speciesMasses(numSpecies)array with the masses of each species, in rydberg.
Here is the call graph for this function:

Member Function Documentation

◆ buildWignerSeitzVectors()

std::tuple< Eigen::MatrixXd, Eigen::VectorXd > Crystal::buildWignerSeitzVectors ( const Eigen::Vector3i &  grid,
const int &  superCellFactor = 2 
)
Parameters
gridsize of the super cell for the WS construction.
superCellFactorin order to do the correct folding of wavevectors, we look for wavevectors in a slightly bigger super cell. A factor 2 should be enough, but could be increased if the code fails to find all vectors.
Returns
: a tuple with bravaisLatticeVectors(3,numVectors) in cartesian coordinates and their degeneracies(numVectors). Note: the weights to be used for integrations are 1/degeneracies.
Here is the caller graph for this function:

◆ buildWignerSeitzVectorsWithShift()

std::tuple< Eigen::MatrixXd, Eigen::Tensor< double, 3 > > Crystal::buildWignerSeitzVectorsWithShift ( const Eigen::Vector3i &  grid,
const Eigen::MatrixXd &  shift,
const int &  superCellFactor = 2 
)

However, the vectors are slightly shifted. For example, for phonons, we want the vectors R+tau(3,na)-tau(3,nb), where tau are atomic positions. A similar transform may be used for the Wannier transformation, where the WS is centered on the Wannier-functions' centers.

Note: for a well-converged calculation, the difference between with and without shift shouldn't make a difference when used in Fourier transforms. This is because the interactions should decay quickly.

Parameters
gridsize of the super cell for the WS construction.
shifta shift in cartesian coordinates of shape(3,nDim).
superCellFactorin order to do the correct folding of wavevectors, we look for wavevectors in a slightly bigger super cell. A factor 2 should be enough, but could be increased if the code fails to find all vectors.
Returns
: a tuple with bravaisLatticeVectors(3,numVectors) in cartesian coordinates and their degeneracies(numVectors,nDim,nDim), where the last two indices must be used in conjunction with the meaning of shift. Some weights might be set to zero if they don't fall in the WS zone. Note: the weights to be used for integrations are 1/degeneracies.

◆ cartesianToCrystal()

Eigen::Vector3d Crystal::cartesianToCrystal ( const Eigen::Vector3d &  point)
Parameters
pointa point in cartesian coordinates
Returns
the point in crystal coordiantes
Here is the call graph for this function:

◆ crystalToCartesian()

Eigen::Vector3d Crystal::crystalToCartesian ( const Eigen::Vector3d &  point)
Parameters
pointa point in crystal coordinates
Returns
the point in cartesian coordiantes
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAtomicSpecies()

const Eigen::VectorXi & Crystal::getAtomicSpecies ( )

The atomic species are simply identified by an integer id The vector returned has size (numAtoms)

Here is the caller graph for this function:

◆ getDielectricMatrix()

const Eigen::Matrix3d Crystal::getDielectricMatrix ( )
inline
Returns
dielectricMatrix: crystal structure's dielectric matrix. Zero if non-polar
Here is the caller graph for this function:

◆ getDimensionality()

int Crystal::getDimensionality ( ) const

a number from 1 to 3

Here is the caller graph for this function:

◆ getDirectUnitCell()

const Eigen::Matrix3d & Crystal::getDirectUnitCell ( )

Lattice vectors are rows (e.g. a0 = cell.row(0), ...)

Here is the caller graph for this function:

◆ getNumSymmetries()

int Crystal::getNumSymmetries ( ) const

For the time being, we only retain symmetry operations that don't use a translation.

Here is the caller graph for this function:

◆ getReciprocalUnitCell()

const Eigen::Matrix3d & Crystal::getReciprocalUnitCell ( )

Lattice vectors are rows (e.g. a0 = cell.row(0), ...) must be multiplied by twoPi to be complete

Here is the caller graph for this function:

◆ getSymmetryOperations()

const std::vector< SymmetryOperation > & Crystal::getSymmetryOperations ( )

Returns a vector of SymmetryOperation. A SymmetryOperation is a structure containing the rotation matrix and the translation vector for the given symmetry. The size of the vector is equal to getNumSymmetries().

Here is the caller graph for this function:

◆ getVolumeUnitCell()

double Crystal::getVolumeUnitCell ( int  dimensionality_ = 3) const
Parameters
dimensionalityreturns the volume of the unit cell on a reduced dimensionality. If 2D, it is ASSUMED that the z-direction is the non periodic direction. If 1D, it's assumed that z is the periodic direction
Here is the caller graph for this function:

Member Data Documentation

◆ directUnitCell

Eigen::Matrix3d Crystal::directUnitCell
protected
  • lattice vectors
  • reciprocal lattice vectors
  • (real space) crystal unit cell volume
  • number of atoms in unit cell
  • number of atomic species in the crystal
  • dimensionality (to log whether we work in 1, 2, or 3D.