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

Class container of the quasiparticle band structure, i.e. More...

#include <active_bandstructure.h>

Inheritance diagram for ActiveBandStructure:
Collaboration diagram for ActiveBandStructure:

Public Member Functions

 ActiveBandStructure (Particle &particle_, Points &points_)
 Almost empty constructor, to be used internally.
 
 ActiveBandStructure (const Points &points_, HarmonicHamiltonian *h0, const bool &withEigenvectors, const bool &withVelocities)
 Default constructor. More...
 
Particle getParticle () override
 Get the Particle object associated with this class. More...
 
Points getPoints () override
 Returns the wavevectors on which the band structure is computed. More...
 
Point getPoint (const int &pointIndex) override
 Returns a wavevector, given a wavevector index. More...
 
int getNumPoints (const bool &useFullGrid=false) override
 Returns the total number of k/q-points. More...
 
int getNumBands () override
 Returns the number of bands. More...
 
int getFullNumBands () override
 
int getNumBands (WavevectorIndex &ik) override
 Returns the number of bands at a given wavevector. More...
 
int hasWindow () override
 Checks whether the bandStructure has been built discarding some Bloch states from those available. More...
 
bool getIsDistributed () override
 Returns if this band structure is distributed. More...
 
size_t getIndex (const WavevectorIndex &ik, const BandIndex &ib) override
 Builds a Bloch state index, which runs on both wavevector index and band index. More...
 
std::tuple< WavevectorIndex, BandIndexgetIndex (const int &is) override
 Given a Bloch state index, finds the corresponding wavevector and band index. More...
 
std::tuple< WavevectorIndex, BandIndexgetIndex (StateIndex &is) override
 Given a Bloch state index, finds the corresponding wavevector and band index. More...
 
int getNumStates () override
 Returns the total number of Bloch states, equal to numPoints*numBands. More...
 
const double & getEnergy (StateIndex &is) override
 Returns the energy of a quasiparticle from its Bloch index. More...
 
Eigen::VectorXd getEnergies (WavevectorIndex &ik) override
 Returns the energies of all quasiparticle computed at a specified wavevector. More...
 
double getMaxEnergy () override
 Returns the maximum energy value. More...
 
Eigen::Vector3d getGroupVelocity (StateIndex &is) override
 Returns the group velocity of a quasiparticle from its Bloch index. More...
 
Eigen::MatrixXd getGroupVelocities (WavevectorIndex &ik) override
 Returns the group velocity of a quasiparticle for all bands at a specified wavevector index. More...
 
Eigen::Tensor< std::complex< double >, 3 > getVelocities (WavevectorIndex &ik) override
 Returns the velocity operator (including off-diagonal matrix elements) of the quasiparticles at the specified wavevector index. More...
 
Eigen::MatrixXcd getEigenvectors (WavevectorIndex &ik) override
 Obtain the eigenvectors of the quasiparticles at a specified wavevector. More...
 
Eigen::Tensor< std::complex< double >, 3 > getPhEigenvectors (WavevectorIndex &ik) override
 Obtain the eigenvectors of the quasiparticles at a specified wavevector. More...
 
Eigen::Vector3d getWavevector (StateIndex &is) override
 Returns the energy of a quasiparticle from its Bloch index Used for accessing the band structure in the BTE. More...
 
Eigen::Vector3d getWavevector (WavevectorIndex &ik) override
 Returns the energy of a quasiparticle from its Bloch index. More...
 
void setEnergies (Point &point, Eigen::VectorXd &energies_) override
 Method to save quasiparticle energies inside ActiveBandStructure(). More...
 
void setEnergies (Point &point, std::vector< double > &energies_)
 Method to save quasiparticle energies inside ActiveBandStructure(). More...
 
void setEigenvectors (Point &point, Eigen::MatrixXcd &eigenvectors_) override
 Method to save quasiparticle eigenvectors inside ActiveBandStructure. More...
 
void setVelocities (Point &point, Eigen::Tensor< std::complex< double >, 3 > &velocities_) override
 Method to save quasiparticle velocity operator in ActiveBandStructure. More...
 
std::vector< Eigen::Matrix3d > getRotationsStar (WavevectorIndex &ikIndex) override
 Given a irreducible point index, find the list of rotations to reconstruct the equivalent points. More...
 
std::vector< Eigen::Matrix3d > getRotationsStar (StateIndex &isIndex) override
 Given an irreducible Bloch state (i.e. More...
 
std::tuple< int, Eigen::Matrix3d > getRotationToIrreducible (const Eigen::Vector3d &x, const int &basis=Points::crystalCoordinates) override
 Given a point in crystal or cartesian coordinates, returns the index of the irreducible point and the rotation such that rotation*irrPoint = redPoint. More...
 
BteIndex stateToBte (StateIndex &isIndex) override
 Utility method to convert an index over Bloch states in the band structure into a Bloch state index usable by VectorBTE. More...
 
StateIndex bteToState (BteIndex &iBteIndex) override
 Utility method to convert an index over Bloch states in a VectorBTE into the Bloch state index in the band structure. More...
 
std::vector< int > irrStateIterator () override
 Iterator over the Bloch states in the band structure, over just the irreducible wavevectors, but isn't distributed over MPI processes. More...
 
std::vector< int > parallelIrrStateIterator () override
 Iterator over the Bloch states in the band structure, distributed over MPI processes, running only over irreducible wavevectors. More...
 
std::vector< int > irrPointsIterator () override
 Iterator over the irreducible points indices. More...
 
std::vector< int > parallelIrrPointsIterator () override
 Iterator over the irreducible points indices. More...
 
int getNumIrrStates () override
 Returns the number of irr points in this band structure.
 
int getPointIndex (const Eigen::Vector3d &crystalCoordinates, const bool &suppressError=false) override
 Find the index of a point in the reducible list of points, given its coordinates in the crystal basis. More...
 
std::vector< int > getReducibleStarFromIrreducible (const int &ik) override
 Method to find the points equivalent to an irreducible point. More...
 
- Public Member Functions inherited from BaseBandStructure
virtual ~BaseBandStructure ()=default
 Base destructor for bandstructure class, silences warnings.
 
virtual std::vector< size_t > parallelStateIterator ()
 Returns an iterator to be used for loops over the Bloch state index. More...
 
void outputComponentsToJSON (const std::string &outFileName="bandstructure.json")
 Outputs the bandstructure information to file, either sym reduced or not. More...
 
void printBandStructureStateInfo (const int &fullNumBands)
 A function to print information about how many states are in this bandstructure, and how things were reduced by filtering of states. More...
 

Static Public Member Functions

static std::tuple< ActiveBandStructure, StatisticsSweepbuilder (Context &context, HarmonicHamiltonian &h0, Points &points, const bool &withEigenvectors=true, const bool &withVelocities=true, const bool &forceBuildAPP=false)
 Preferred method to initialize the ActiveBandStructure class. More...
 

Protected Member Functions

void buildIndices ()
 
void buildSymmetries ()
 
size_t velBloch2Comb (const int &ik, const int &ib1, const int &ib2, const int &i)
 
size_t eigBloch2Comb (const int &ik, const int &ibFull, const int &ibRed)
 
size_t bloch2Comb (const int &k, const int &b)
 
std::tuple< int, int > comb2Bloch (const int &is)
 
size_t bteBloch2Comb (const int &k, const int &b)
 
std::tuple< int, int > bteComb2Bloch (const int &is)
 
void buildOnTheFly (Window &window, Points points_, HarmonicHamiltonian &h0, const bool &withEigenvectors=true, const bool &withVelocities=true)
 
StatisticsSweep buildAsPostprocessing (Context &context, Points points_, HarmonicHamiltonian &h0, const bool &withEigenvector=true, const bool &withVelocities=true)
 in this function, useful for electrons, we first compute the band structure on a dense grid of wavevectors, then compute chemical potential/temperatures and then filter it
 

Protected Attributes

Particle particle
 
Points points
 
std::vector< double > energies
 
std::vector< std::complex< double > > velocities
 
std::vector< std::complex< double > > eigenvectors
 
bool hasEigenvectors = false
 
bool hasVelocities = false
 
int numStates = 0
 
int numIrrStates
 
int numIrrPoints
 
int numPoints
 
Eigen::VectorXi numBands
 
int numFullBands = 0
 
int windowMethod = 0
 
Eigen::MatrixXi auxBloch2Comb
 
Eigen::VectorXi cumulativeKbOffset
 
Eigen::MatrixXi bteAuxBloch2Comb
 
Eigen::VectorXi bteCumulativeKbOffset
 
Eigen::VectorXi cumulativeKbbOffset
 

Detailed Description

energies, velocities, eigenvectors and wavevectors. In contrast to FullBandStructure, which stores this information for all wavevectors and bands, ActiveBandStructure stores this data for a specified subset of wavevectors, and a subset of bands which may change from one wavevector to another. Should be initialized through the static method provided below, which makes use of the Window that is selected by user input. The subset of wavevectors is specified using an ActivePoints class.

Constructor & Destructor Documentation

◆ ActiveBandStructure()

ActiveBandStructure::ActiveBandStructure ( const Points points_,
HarmonicHamiltonian h0,
const bool &  withEigenvectors,
const bool &  withVelocities 
)

Populate the band structure for the subset of wavevectors specified by points, but saving all bands for such wavevector. Using this constructor, we populate the band structure on the wavevectors specified by points. Currently used for the caching of the 3rd wavevectors info in the 3-phonon scattering matrix.

Here is the call graph for this function:

Member Function Documentation

◆ bteToState()

StateIndex ActiveBandStructure::bteToState ( BteIndex iBteIndex)
overridevirtual

Unlike stateToBte, this should always have a solution.

Parameters
iBteIndexindex of the Bloch state in the BTE
Returns
StateIndex: the index of the Bloch state in the band structure.

Implements BaseBandStructure.

Here is the call graph for this function:

◆ builder()

std::tuple< ActiveBandStructure, StatisticsSweep > ActiveBandStructure::builder ( Context context,
HarmonicHamiltonian h0,
Points points,
const bool &  withEigenvectors = true,
const bool &  withVelocities = true,
const bool &  forceBuildAPP = false 
)
static
Parameters
contextobject with user input variables.
h0hamiltonian object to be diagonalized.
pointsinitial unfiltered list of wavevectors, which will be filtered into an ActivePoints object.
withEigenvectorscompute and store the eigenvectors
withVelocitiescompute and store the velocity matrix elements
forceBuildAPPforces activeBandStructure to be built using the internal buildAsPostprocessing method, even if the input H0 is for phonons.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEigenvectors()

Eigen::MatrixXcd ActiveBandStructure::getEigenvectors ( WavevectorIndex ik)
overridevirtual
Parameters
wavevectorIndexa WavevectorIndex(ik) object where ik is the integer wavevector index running over [0,numPoints-1].
Returns
eigenvectors: a complex matrix(numBands,numActiveBands) where numBands is the full (before applying the window) number of Bloch states present at the specified wavevector and numActiveBands is the number of filtered bands at the desired wavevector. Eigenvectors are ordered along columns. Note that all band structure interpolations may give eigenvectors.

Implements BaseBandStructure.

Here is the caller graph for this function:

◆ getEnergies()

Eigen::VectorXd ActiveBandStructure::getEnergies ( WavevectorIndex ik)
overridevirtual
Parameters
wavevectorIndexa WavevectorIndex(ik) where ik is an integer index running over the wavevectors [0,numPoints-1]
Returns
energies: an Eigen vector of quasiparticle energies for that given wavevector. Phonon energies are referred to zero, with negative energies being actually complex phonon frequencies. Electronic energies are not saved with any particular reference, and should be used together with the chemical potential computed by StatisticsSweep. In rydberg units.

Implements BaseBandStructure.

◆ getEnergy()

const double & ActiveBandStructure::getEnergy ( StateIndex is)
overridevirtual

Same as getEnergy(const int &stateIndex), but using a StateIndex input

Parameters
stateIndexa StateIndex(is) object where 'is' is an integer running over the number of states [0,numStates-1].
Returns
energy: the value of the QP energy for that given Bloch index. Phonon energies are referred to zero, with negative energies being actually complex phonon frequencies. Electronic energies are not saved with any particular reference, and should be used together with the chemical potential computed by StatisticsSweep. By policy, it's in rydberg units.

Implements BaseBandStructure.

◆ getGroupVelocities()

Eigen::MatrixXd ActiveBandStructure::getGroupVelocities ( WavevectorIndex ik)
overridevirtual

Used for accessing the band structure in the BTE.

Parameters
wavevectorIndexa WavevectorIndex(ik) object where 'ik' is an integer index running over the wavevectors in range [0,numPoints-1]
Returns
velocity: a matrix(numActiveBands,3) with the group velocity, in cartesian basis and in atomic rydberg units, where numActiveBands is the number of active bands present at the specified wavevector.

Implements BaseBandStructure.

◆ getGroupVelocity()

Eigen::Vector3d ActiveBandStructure::getGroupVelocity ( StateIndex is)
overridevirtual

Used for accessing the band structure in the BTE.

Parameters
stateIndexa StateIndex(is) object where 'is' is an integer index in the range [0,numStates[
Returns
velocity: a 3d vector with velocity. By policy, we save it in the cartesian basis and in atomic rydberg units.

Implements BaseBandStructure.

◆ getIndex() [1/3]

std::tuple< WavevectorIndex, BandIndex > ActiveBandStructure::getIndex ( const int &  is)
overridevirtual
Parameters
stateIndexinteger from 0 to numStates-1
Returns
WavevectorIndex: a strong-typed index on wavevector
BandIndex: a strong-typed index on bands

Implements BaseBandStructure.

◆ getIndex() [2/3]

size_t ActiveBandStructure::getIndex ( const WavevectorIndex ik,
const BandIndex ib 
)
overridevirtual
Parameters
wavevectorIndexstrong-typed index on wavevector index
bandIndexstrong-typed index on band index. Note that bandIndex has different range for every wavevector
Returns
stateIndex: integer from 0 to numStates-1

Implements BaseBandStructure.

Here is the caller graph for this function:

◆ getIndex() [3/3]

std::tuple< WavevectorIndex, BandIndex > ActiveBandStructure::getIndex ( StateIndex is)
overridevirtual
Parameters
stateIndexa StateIndex(is) object where is is an integer from 0 to numStates-1
Returns
WavevectorIndex: strong-typed index on wavevector
BandIndex: strong-typed index on bands

Implements BaseBandStructure.

Here is the call graph for this function:

◆ getIsDistributed()

bool ActiveBandStructure::getIsDistributed ( )
overridevirtual

In the case of activeBandStructure, currently always returns false.

Implements BaseBandStructure.

Here is the caller graph for this function:

◆ getMaxEnergy()

double ActiveBandStructure::getMaxEnergy ( )
overridevirtual

This can be useful when setting energy scales based on which phonons are discarded (as in the phel scattering, where the window is set relative to the maximum phonon energies)

Implements BaseBandStructure.

Here is the call graph for this function:

◆ getNumBands() [1/2]

int ActiveBandStructure::getNumBands ( )
overridevirtual

If the number of bands is not constant, it raises an error. In that case, it's best to check the size of the objects returned by the get*() methods or use getNumBands(ik).

Returns
numBandsFull: the total number of bands of the bandStructure (only returned in the case where the bands have not been filtered.)

Implements BaseBandStructure.

◆ getNumBands() [2/2]

int ActiveBandStructure::getNumBands ( WavevectorIndex ik)
overridevirtual
Returns
numBands: the number of bands at the requested ik.

Implements BaseBandStructure.

◆ getNumPoints()

int ActiveBandStructure::getNumPoints ( const bool &  useFullGrid = false)
overridevirtual
Parameters
useFullGriddefault = false. If true, returns the number of points of the full monkhorst-pack grid of wavevectors, otherwise, returns the number of wavevectors stored in the BandStructure. In particular for this class, the number of wavevectors stored in the list is obtained with false, if true, and if activePoints.parentPoints is a FullPoints object, then we will return the number of points in the original full grid of points (useful when normalizing equations).
Returns
numPoints: the total number of wavevectors of the bandStructure.

Implements BaseBandStructure.

Here is the call graph for this function:

◆ getNumStates()

int ActiveBandStructure::getNumStates ( )
overridevirtual
Returns
numStates: the total number of Bloch states in the class.

Implements BaseBandStructure.

◆ getParticle()

Particle ActiveBandStructure::getParticle ( )
overridevirtual
Returns
particle: a Particle object, describing e.g. whether this is a phonon or electron bandStructure

Implements BaseBandStructure.

◆ getPhEigenvectors()

Eigen::Tensor< std::complex< double >, 3 > ActiveBandStructure::getPhEigenvectors ( WavevectorIndex ik)
overridevirtual

It's only meaningful for the phonon band structure, where eigenvectors are more naturally represented in this shape!

Parameters
wavevectorIndexa WavevectorIndex(ik) object where ik is the integer wavevector index running over [0,numPoints-1].
Returns
eigenvectors: a complex tensor (3,numAtoms,numActiveBands) where numActiveBands is the number of Bloch states present at the specified wavevector, numAtoms is the number of atoms in the crystal unit cell and 3 are the cartesian directions.

Implements BaseBandStructure.

Here is the call graph for this function:

◆ getPoint()

Point ActiveBandStructure::getPoint ( const int &  pointIndex)
overridevirtual

The wavevector index runs from 0 to numPoints-1, where numPoints is the number of active wavevectors to be used in the calculations.

Implements BaseBandStructure.

Here is the call graph for this function:

◆ getPointIndex()

int ActiveBandStructure::getPointIndex ( const Eigen::Vector3d &  crystalCoordinates,
const bool &  suppressError = false 
)
overridevirtual
Parameters
crystalCoordinatescoordinates of the point in crystal basis
suppressErrordefault false. If false, will throw an error if the point is not found
Returns
ik: the index of the point

Implements BaseBandStructure.

Here is the call graph for this function:

◆ getPoints()

Points ActiveBandStructure::getPoints ( )
overridevirtual
Returns
Points: the object representing the Brillouin zone wavevectors. Should be an ActivePoints class.

Implements BaseBandStructure.

◆ getReducibleStarFromIrreducible()

std::vector< int > ActiveBandStructure::getReducibleStarFromIrreducible ( const int &  ik)
overridevirtual
Parameters
ikindex of the irreducible point, with ik running on the full list of reducible points.
Returns
vector<int>: the list of indices of the reducible points equivalent to point #ik.

Implements BaseBandStructure.

Here is the call graph for this function:

◆ getRotationsStar() [1/2]

std::vector< Eigen::Matrix3d > ActiveBandStructure::getRotationsStar ( StateIndex isIndex)
overridevirtual

any band at an irreducible point), find the list of rotations to reconstruct the equivalent points.

Parameters
isIndexIndex of the irreducible Bloch State. This index is a number between 0 and numStates.
Returns
rotations: a vector with the rotations used to reconstruct the symmetry-equivalent Bloch states.

Implements BaseBandStructure.

Here is the call graph for this function:

◆ getRotationsStar() [2/2]

std::vector< Eigen::Matrix3d > ActiveBandStructure::getRotationsStar ( WavevectorIndex ikIndex)
overridevirtual
Parameters
ikIndexIndex of the irreducible wavevector. This index is a number between 0 and N_k_reducible.
Returns
rotations: a vector with the rotations used to reconstruct the symmetry-equivalent Bloch states.

Implements BaseBandStructure.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRotationToIrreducible()

std::tuple< int, Eigen::Matrix3d > ActiveBandStructure::getRotationToIrreducible ( const Eigen::Vector3d &  x,
const int &  basis = Points::crystalCoordinates 
)
overridevirtual
Parameters
xpoint coordinates
basiseither Points::crystalCoordinates or Points::cartesianCoordinates, this will treat x in the appropriate coordinate. Also the returned rotation will be in the corresponding basis.
Returns
<ik,rot>: a tuple with the index of the irreducible point and the rotation matrix connecting the irreducible and reducible point.

Implements BaseBandStructure.

Here is the call graph for this function:

◆ getVelocities()

Eigen::Tensor< std::complex< double >, 3 > ActiveBandStructure::getVelocities ( WavevectorIndex ik)
overridevirtual

Used for accessing the band structure in the BTE.

Parameters
wavevectorIndexa WavevectorIndex(ik) object where 'ik' is an integer index running over the wavevectors in range [0,numPoints-1]
Returns
velocity: a tensor (numActiveBands,numActiveBands,3) with the velocity operator matrix elements, in cartesian basis and in atomic rydberg units, where numActiveBands is the number of active bands present at the specified wavevector.

Implements BaseBandStructure.

◆ getWavevector() [1/2]

Eigen::Vector3d ActiveBandStructure::getWavevector ( StateIndex is)
overridevirtual
Parameters
stateIndexan integer index in range [0,numStates[
Returns
wavevector: a 3d vector with the wavevector in cartesian coordinates in units of Bohr^-1.

Implements BaseBandStructure.

Here is the call graph for this function:

◆ getWavevector() [2/2]

Eigen::Vector3d ActiveBandStructure::getWavevector ( WavevectorIndex ik)
overridevirtual
Parameters
wavevectorIndexa WavevectorIndex(ik) object where 'ik' is an integer index in range [0,numPoints-1].
Returns
wavevector: a 3d vector with the wavevector in cartesian coordinates in units of Bohr^-1.

Implements BaseBandStructure.

Here is the call graph for this function:

◆ hasWindow()

int ActiveBandStructure::hasWindow ( )
overridevirtual
Returns
windowMethod: one of the values of Window::filterMethod. 0 for no filter.

Implements BaseBandStructure.

◆ irrPointsIterator()

std::vector< int > ActiveBandStructure::irrPointsIterator ( )
overridevirtual

The iterator is serial, not parallelized with MPI.

Returns
k-indices: a std::vector<int> with the indices of the irreducible points.

Implements BaseBandStructure.

Here is the call graph for this function:

◆ irrStateIterator()

std::vector< int > ActiveBandStructure::irrStateIterator ( )
overridevirtual
Returns
State-indices: a vector<int> with the indices over Bloch states stored in the band structure

Implements BaseBandStructure.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parallelIrrPointsIterator()

std::vector< int > ActiveBandStructure::parallelIrrPointsIterator ( )
overridevirtual

The iterator is parallelized over MPI processes.

Returns
k-indices: a std::vector<int> with the indices of the irreducible points.

Implements BaseBandStructure.

Here is the call graph for this function:

◆ parallelIrrStateIterator()

std::vector< int > ActiveBandStructure::parallelIrrStateIterator ( )
overridevirtual
Returns
State-indices: a vector<int> with the indices over Bloch states stored in the band structure

Implements BaseBandStructure.

Here is the call graph for this function:

◆ setEigenvectors()

void ActiveBandStructure::setEigenvectors ( Point point,
Eigen::MatrixXcd &  eigenvectors_ 
)
overridevirtual
Parameters
pointa point object, which will be used to lookup the wavevector index ik.
eigenvectorsa matrix of size (numFullBands, numBands(ik)) with the quasiparticle eigenvectors for this point.

Implements BaseBandStructure.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEnergies() [1/2]

void ActiveBandStructure::setEnergies ( Point point,
Eigen::VectorXd &  energies_ 
)
overridevirtual
Parameters
pointa point object, which will be used to lookup the wavevector index ik.
energiesa vector of size (numBands(ik)) with the quasiparticle energies for that point.

Implements BaseBandStructure.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEnergies() [2/2]

void ActiveBandStructure::setEnergies ( Point point,
std::vector< double > &  energies_ 
)
Parameters
pointa point object, which will be used to lookup the wavevector index ik.
energiesa vector of size (numBands(ik)) with the quasiparticle energies for that point.
Here is the call graph for this function:

◆ setVelocities()

void ActiveBandStructure::setVelocities ( Point point,
Eigen::Tensor< std::complex< double >, 3 > &  velocities_ 
)
overridevirtual
Parameters
pointa point object, which will be used to lookup the wavevector index ik.
velocitiesa tensor of size (numBands(ik),numBands(ik),3) with the quasiparticle velocity matrix elements for this wavevector.

Implements BaseBandStructure.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stateToBte()

BteIndex ActiveBandStructure::stateToBte ( StateIndex isIndex)
overridevirtual

If a state is not mapped to the VectorBTE, throws an error.

Parameters
StateIndexthe index of the Bloch state in the band structure.
Returns
BteIndex: index of the Bloch state in the BTE

Implements BaseBandStructure.

Here is the call graph for this function: