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

Class used to store the "vector" of out-of-equilibrium populations. More...

#include <vector_bte.h>

Inheritance diagram for VectorBTE:
Collaboration diagram for VectorBTE:

Public Member Functions

 VectorBTE (StatisticsSweep &statisticsSweep_, BaseBandStructure &bandStructure_, const int &dimensionality_=3)
 Constructor method, initializes raw buffer data and saves helper variables. More...
 
 VectorBTE (const VectorBTE &that)
 Copy constructor.
 
VectorBTEoperator= (const VectorBTE &that)
 Copy assignment operator.
 
double & operator() (const int &iCalc, const int &iDim, const int &iState)
 Get and set operator.
 
const double & operator() (const int &iCalc, const int &iDim, const int &iState) const
 Const get and set operator.
 
Eigen::MatrixXd dot (const VectorBTE &that)
 Computes the scalar product between two VectorBTE objects. More...
 
VectorBTE operator* (VectorBTE &that)
 element wise product between two VectorBTE objects x and y. More...
 
VectorBTE operator* (const double &scalar)
 Computes the product of a VectorBTE with a scalar, i.e. More...
 
VectorBTE operator* (const Eigen::MatrixXd &vector)
 Computes the product of a VectorBTE with a vector. More...
 
VectorBTE operator* (ParallelMatrix< double > &matrix)
 Computes the product of a VectorBTE with a parallel matrix. More...
 
VectorBTE operator+ (VectorBTE &that)
 element wise sum between two VectorBTE objects x and y. More...
 
VectorBTE operator- (VectorBTE &that)
 element wise difference between two VectorBTE objects x and y. More...
 
VectorBTE operator- ()
 Invert the sign of the VectorBTE content i.e. More...
 
VectorBTE operator/ (VectorBTE &that)
 element wise division between two VectorBTE objects x and y. More...
 
VectorBTE sqrt ()
 Return a new VectorBTE object containing the square root of this one (element-wise x -> sqrt(x) ).
 
VectorBTE reciprocal () const
 Return a new VectorBTE object containing the reciprocal of this one (element-wise x -> 1/x).
 
void canonical2Population ()
 Convert an out-of-equilibrium population from the canonical form f to the absolute value n, such that n = bose(bose+1)f or n=fermi(1-fermi)f.
 
void population2Canonical ()
 Convert an out-of-equilibrium population from the absolute value n to the canonical value n, such that n = bose(bose+1)f or n=fermi(1-fermi)f.
 
void outputToJSON (const std::string &outFileName, BaseBandStructure &outerBandStructure)
 Output the contents of a vector BTE object to a JSON file.
 
int glob2Loc (const ChemPotIndex &imu, const TempIndex &it, const CartIndex &iDim) const
 glob2Loc and loc2Glob compress/decompress the indices on temperature, chemical potential, and cartesian direction into/from a single index. More...
 
std::tuple< ChemPotIndex, TempIndex, CartIndexloc2Glob (const int &i) const
 
void setConst (const double &constant)
 Set the whole content (raw buffer) of BaseVectorBTE to a scalar value. More...
 
int getNumStates ()
 return the number of states in this vector BTE object More...
 

Public Attributes

Eigen::MatrixXd data
 raw buffer containing the values of the vector The matrix has size (numCalculations, numStates), where numCalculations is the number of pairs of temperature and chemical potentials, and numStates is the number of Bloch states used in the Boltzmann equation.
 
std::vector< int > excludeIndices
 List of Bloch states to be excluded from the calculation (i.e. More...
 
int dimensionality
 

Protected Member Functions

VectorBTE baseOperator (VectorBTE &that, const int &operatorType)
 base class to implement +, -, / and * operations. More...
 

Protected Attributes

StatisticsSweepstatisticsSweep
 
int numCalculations
 
int numStates
 
int numChemPots
 
int numTemps
 
BaseBandStructurebandStructure
 
const int operatorSums = 0
 
const int operatorDivs = 1
 
const int operatorProd = 2
 
const int operatorDiff = 3
 

Friends

class ScatteringMatrix
 

Detailed Description

The vector indices are over the Bloch state. Additionally, there is one of these vector for each pair of (temperatures,chemicalPotentials). Can be used to store both scalar quantities (linewidths) or vectors (like velocities).

Constructor & Destructor Documentation

◆ VectorBTE()

VectorBTE::VectorBTE ( StatisticsSweep statisticsSweep_,
BaseBandStructure bandStructure_,
const int &  dimensionality_ = 3 
)
Parameters
statisticsSweepsaves the info on how many temperatures/chemical potentials we are evaluating.
bandStructuresaves the underlying band structure for which we compute the out-of-equilibrium populations.
dimensionalitydetermines the size of the vector on cartesian indices. 1 for scalar quantities like linewidths Gamma(BlochIndices), 3 for vector quantities like phonon populations f(blochIndices,cartesian).
Here is the call graph for this function:

Member Function Documentation

◆ baseOperator()

VectorBTE VectorBTE::baseOperator ( VectorBTE that,
const int &  operatorType 
)
protected

It's split separately so that subclasses can create the correct output class, and also because operations are rather similar.

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

◆ dot()

Eigen::MatrixXd VectorBTE::dot ( const VectorBTE that)

The scalar product of x and y, is defined such as z(iCalc) = sum_i x(iCalc,i) y(iCalc,i), where i is an index over Bloch states, and iCalc is an index over temperatures and chemical potentials.

Parameters
thatthe second vector used in the scalar product
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNumStates()

int VectorBTE::getNumStates ( )
Returns
numStates

◆ glob2Loc()

int VectorBTE::glob2Loc ( const ChemPotIndex imu,
const TempIndex it,
const CartIndex iDim 
) const

TODO: these indices, and how they are used elsewhere, is rather messy That's because we have to work both with quantities such as line-widths, which are a scalar over the Bloch states, and phonon populations, which are cartesian vectors over the Bloch states. I should probably create two different classes for these.

Here is the caller graph for this function:

◆ operator*() [1/4]

VectorBTE VectorBTE::operator* ( const double &  scalar)

all elements of vectorBTE x -> x * scalar.

Parameters
scalara double with the constant factor to be used in the element-wise multiplication.

◆ operator*() [2/4]

VectorBTE VectorBTE::operator* ( const Eigen::MatrixXd &  vector)

The vector has size equal to the number of calculations (i.e. number of temperatures times the number of chemical potentials) used in the run. Given a calculation index iCalc, the result is an element-wise x(it)*vector(it).

Parameters
vectora double vector to be used in the product, of size equal to numCalculations.
Here is the call graph for this function:

◆ operator*() [3/4]

VectorBTE VectorBTE::operator* ( ParallelMatrix< double > &  matrix)

Only works if the number of temperatures/chemical potentials (numCalculations) is equal to one. At fixed calculation index iCalc, the result is an matrix-vector multiplication x(it,i)*pMatrix(i,j).

Parameters
pMatrixa parallel distributed double matrix to be used in the product, of size equal to numStates x numStates.
Here is the call graph for this function:

◆ operator*() [4/4]

VectorBTE VectorBTE::operator* ( VectorBTE that)

If the dimensionality of the two objects is the same, we compute element-wise result = x*y. If y has dimensionality 1, we compute x(every dim)*y(0), and the result has the dimensionality of x.

Parameters
thatthe second VectorBTE object y, such that result = *this*y
Here is the call graph for this function:

◆ operator+()

VectorBTE VectorBTE::operator+ ( VectorBTE that)

If the dimensionality of the two objects is the same, we compute element-wise result = x+y. If y has dimensionality 1, we compute x(every dim)+y(0), and the result has the dimensionality of x.

Parameters
thatthe second VectorBTE object y, such that result = *this+y
Here is the call graph for this function:

◆ operator-() [1/2]

VectorBTE VectorBTE::operator- ( )

x -> -x

◆ operator-() [2/2]

VectorBTE VectorBTE::operator- ( VectorBTE that)

If the dimensionality of the two objects is the same, we compute element-wise result = x-y. If y has dimensionality 1, we compute x(every dim)-y(0), and the result has the dimensionality of x.

Parameters
thatthe second VectorBTE object y, such that result = *this-y
Here is the call graph for this function:

◆ operator/()

VectorBTE VectorBTE::operator/ ( VectorBTE that)

If the dimensionality of the two objects is the same, we compute element-wise result = x/y. If y has dimensionality 1, we compute x(every dim)/y(0), and the result has the dimensionality of x.

Parameters
thatthe second VectorBTE object y, such that result = *this/y
Here is the call graph for this function:

◆ setConst()

void VectorBTE::setConst ( const double &  constant)
Parameters
constantthe value to be used in the set.
Here is the caller graph for this function:

Member Data Documentation

◆ excludeIndices

std::vector<int> VectorBTE::excludeIndices

for which vectorBTE values are 0), for example, the acoustic modes at the gamma point, whose zero frequencies may cause problems.