Main class for parallel PEXSI. More...
#include <ppexsi.hpp>
Public Member Functions | |
PPEXSIData (const PEXSI::GridType *g, Int nprow, Int npcol) | |
void | Solve (Int numPole, Real temperature, Real numElectronExact, Real gap, Real deltaE, Real &mu, Real &muMin, Real &muMax, const DistSparseMatrix< Real > &HMat, const DistSparseMatrix< Real > &SMat, Int muMaxIter, Real numElectronTolerance, std::string ColPerm, Int numProcSymbFact, bool isFreeEnergyDensityMatrix, bool isEnergyDensityMatrix, bool isDerivativeTMatrix, std::vector< Real > &muList, std::vector< Real > &numElectronList, std::vector< Real > &numElectronDrvMuList, bool &isConverged) |
Solve is the main subroutine for PPEXSI. More... | |
DistSparseMatrix< Real > & | DensityMatrix () |
DensityMatrix returns the single particle density matrix. | |
DistSparseMatrix< Real > & | FreeEnergyDensityMatrix () |
DensityMatrix returns the free energy density matrix. | |
DistSparseMatrix< Real > & | EnergyDensityMatrix () |
DensityMatrix returns the energy density matrix for computing the force. | |
Real | CalculateNumElectron (const DistSparseMatrix< Real > &SMat) |
CalculateNumElectron computes the number of electrons given the current density matrix. More... | |
Real | CalculateNumElectronDrvMu (const DistSparseMatrix< Real > &SMat) |
CalculateNumElectronDrvMu computes the derivative of the number of electrons with respect to the chemical potential. More... | |
Real | CalculateNumElectronDrvT (const DistSparseMatrix< Real > &SMat) |
CalculateNumElectronDrvT computes the derivative of the number of electrons with respect to the temperature (1/beta, in atomic unit). More... | |
Real | CalculateTotalEnergy (const DistSparseMatrix< Real > &HMat) |
CalculateTotalEnergy computes the total energy (band energy part only). More... | |
Real | CalculateFreeEnergy (const DistSparseMatrix< Real > &SMat) |
CalculateFreeEnergy computes the total Helmholtz free energy (band energy part only). More... | |
Real | CalculateForce (const DistSparseMatrix< Real > &HDerivativeMat, const DistSparseMatrix< Real > &SDerivativeMat) |
CalculateFreeEnergy computes the force, including the Hellman-Feynman force and the Pulay force. More... | |
Real | EstimateZeroTemperatureChemicalPotential (Real temperature, Real mu, const DistSparseMatrix< Real > &SMat) |
Estimate the chemical potential at zero temperature using quadratic approximation. More... | |
void | CalculateNegativeInertia (const std::vector< Real > &shiftVec, std::vector< Real > &inertiaVec, const DistSparseMatrix< Real > &HMat, const DistSparseMatrix< Real > &SMat, std::string ColPerm, Int numProcSymbFact) |
Compute the negative inertia (the number of eigenvalues below a shift). More... | |
void | CalculateNegativeInertiaReal (const std::vector< Real > &shiftVec, std::vector< Real > &inertiaVec, const DistSparseMatrix< Real > &HMat, const DistSparseMatrix< Real > &SMat, std::string ColPerm, Int numProcSymbFact) |
Compute the negative inertia (the number of eigenvalues below a shift) with real arithmetic which directly using SuperLU. | |
void | EstimateSpectralRadius (Int method, const DistSparseMatrix< Real > &HMat, const DistSparseMatrix< Real > &SMat, const NumVec< Real > &v0, Real tol, Int maxNumIter, Int &numIter, Real &sigma) |
Estimate the spectral radius of the matrix stencil (H,S). More... | |
Main class for parallel PEXSI.
Real PEXSI::PPEXSIData::CalculateForce | ( | const DistSparseMatrix< Real > & | HDerivativeMat, |
const DistSparseMatrix< Real > & | SDerivativeMat | ||
) |
CalculateFreeEnergy computes the force, including the Hellman-Feynman force and the Pulay force.
[in] | HDerivativeMat | Derivative of the Hamilotian matrix with respect to the atomic position R_{i,j}, i = 1, ..., natoms, j=1,2,3. |
[in] | HDerivativeMat | Derivative of the overlap matrix with respect to the atomic position R_{i,j}, i = 1, ..., natoms, j=1,2,3. |
Real PEXSI::PPEXSIData::CalculateFreeEnergy | ( | const DistSparseMatrix< Real > & | SMat | ) |
CalculateFreeEnergy computes the total Helmholtz free energy (band energy part only).
For more information see Alavi, A., Kohanoff, J., Parrinello, M., & Frenkel, D. (1994). Ab initio molecular dynamics with excited electrons. Physical review letters, 73(19), 2599–2602.
[in] | HMat | Hamilotian matrix. |
void PEXSI::PPEXSIData::CalculateNegativeInertia | ( | const std::vector< Real > & | shiftVec, |
std::vector< Real > & | inertiaVec, | ||
const DistSparseMatrix< Real > & | HMat, | ||
const DistSparseMatrix< Real > & | SMat, | ||
std::string | ColPerm, | ||
Int | numProcSymbFact | ||
) |
Compute the negative inertia (the number of eigenvalues below a shift).
This subroutine computes the negative inertia of the matrix
I = H - shift * S
where I is the same as the number of eigenvalues lambda for
H x = lambda S x
with lambda < shift according to the Sylvester's law of inertia.
[in] | shiftVec | Shift vectors. |
[out] | inertiaVec | Negative inertia count, the same size as shiftVec. |
[in] | HMat | Hamiltonian matrix saved in distributed compressed sparse column format. See DistSparseMatrix. |
[in] | SMat | Overlap matrix saved in distributed compressed sparse column format. See DistSparseMatrix. |
Note: If SMat.size == 0, SMat is treated as an identity matrix.
[in] | ColPerm | Permutation method used for SuperLU_DIST |
[in] | numProcSymbFact | Number of processors used for parallel symbolic factorization and PARMETIS/PT-SCOTCH. |
Real PEXSI::PPEXSIData::CalculateNumElectron | ( | const DistSparseMatrix< Real > & | SMat | ) |
CalculateNumElectron computes the number of electrons given the current density matrix.
[in] | SMat | overlap matrix. |
Real PEXSI::PPEXSIData::CalculateNumElectronDrvMu | ( | const DistSparseMatrix< Real > & | SMat | ) |
CalculateNumElectronDrvMu computes the derivative of the number of electrons with respect to the chemical potential.
[in] | SMat | overlap matrix. |
Real PEXSI::PPEXSIData::CalculateNumElectronDrvT | ( | const DistSparseMatrix< Real > & | SMat | ) |
CalculateNumElectronDrvT computes the derivative of the number of electrons with respect to the temperature (1/beta, in atomic unit).
[in] | SMat | overlap matrix. |
Real PEXSI::PPEXSIData::CalculateTotalEnergy | ( | const DistSparseMatrix< Real > & | HMat | ) |
CalculateTotalEnergy computes the total energy (band energy part only).
[in] | HMat | Hamilotian matrix. |
void PEXSI::PPEXSIData::EstimateSpectralRadius | ( | Int | method, |
const DistSparseMatrix< Real > & | HMat, | ||
const DistSparseMatrix< Real > & | SMat, | ||
const NumVec< Real > & | v0, | ||
Real | tol, | ||
Int | maxNumIter, | ||
Int & | numIter, | ||
Real & | sigma | ||
) |
Estimate the spectral radius of the matrix stencil (H,S).
The current method uses the locally optimal conjugate gradient (LOCG) method.
[in] | method | Method for estimating the spectral radius
|
[in] | HMat | Hamiltonian matrix saved in distributed compressed sparse column format. See DistSparseMatrix. |
[in] | SMat | Overlap matrix saved in distributed compressed sparse column format. See DistSparseMatrix. S can be an identity matrix. |
[in] | v0 | Initial starting vector. |
If v0.m() == 0, then a random vector is used as the initial starting vector.
[in] | tol | Relative tolerance for estimating sigma. |
[in] | maxNumIter | Maximum number of iterations. |
[out] | numIter | The number of iterations. |
[out] | sigma | The estimated spectral radius. |
Real PEXSI::PPEXSIData::EstimateZeroTemperatureChemicalPotential | ( | Real | temperature, |
Real | mu, | ||
const DistSparseMatrix< Real > & | SMat | ||
) |
Estimate the chemical potential at zero temperature using quadratic approximation.
[in] | temperature | Temperature (in the unit of K), usually high (~3000K) |
[in] | mu | Computed chemical potential at high temperature |
[in] | SMat | Overlap matrix |
void PEXSI::PPEXSIData::Solve | ( | Int | numPole, |
Real | temperature, | ||
Real | numElectronExact, | ||
Real | gap, | ||
Real | deltaE, | ||
Real & | mu, | ||
Real & | muMin, | ||
Real & | muMax, | ||
const DistSparseMatrix< Real > & | HMat, | ||
const DistSparseMatrix< Real > & | SMat, | ||
Int | muMaxIter, | ||
Real | numElectronTolerance, | ||
std::string | ColPerm, | ||
Int | numProcSymbFact, | ||
bool | isFreeEnergyDensityMatrix, | ||
bool | isEnergyDensityMatrix, | ||
bool | isDerivativeTMatrix, | ||
std::vector< Real > & | muList, | ||
std::vector< Real > & | numElectronList, | ||
std::vector< Real > & | numElectronDrvMuList, | ||
bool & | isConverged | ||
) |
Solve is the main subroutine for PPEXSI.
Compute the single particle density matrix, the Helmholtz free energy density matrix, and the energy density matrix (for computing the Pulay force) simultaneously. These matrices can be called later via member functions DensityMatrix, FreeEnergyDensityMatrix, EnergyDensityMatrix.
[in] | numPole | Number of poles for the pole expansion |
[in] | temperature | Temperature (in the unit of K) |
[in] | numElectronExact | Exact number of electrons |
[in] | gap | Band gap (in the unit of au) |
[in] | deltaE | Upperbound of the spectrum width |
[in,out] | mu | Input: Initial guess of chemical potential (in the unit of au). Output: The final update of the chemical potential, for which the number of electrons has NOT been computed. Note: The output mu is NOT the same as last element in muList. muList[end] corresponds to numElectronList[end]. |
[in,out] | muMin | Input: Initial guess for the lower bound of the chemical potential. Output: Lower bound of the chemical potential. |
[in,out] | muMax | Input: Initial guess for the upper bound of the chemical potential. Output: Upper bound of the chemical potential. |
[in] | HMat | Hamiltonian matrix saved in distributed compressed sparse column format. See DistSparseMatrix. |
[in] | SMat | Overlap matrix saved in distributed compressed sparse column format. See DistSparseMatrix. Note: If SMat.size == 0, SMat is treated as an identity matrix. |
[in] | muMaxIter | Maximum iteration number for chemical potential |
[in] | numElectronTolerance | Stopping criterion for the mu iteration |
[in] | ColPerm | Permutation method used for SuperLU_DIST |
[in] | numProcSymbFact | Number of processors used for parallel symbolic factorization and PARMETIS/PT-SCOTCH. |
[in] | isFreeEnergyDensityMatrix | Whether to compute the Helmholtz free energy matrix |
[in] | isEnergyDensityMatrix | Whether to compute the energy density matrix for force |
[in] | isDerivativeTMatrix | Whether to compute the derivative of the single particle density matrix with respect to the temperature. |
[out] | muList | Convergence history of the chemical potential |
[out] | numElectronList | Convergence history of the number of electrons |
[out] | numElectronDrvMuList | Convergence history of the derivative of electrons with respect to the chemical potential. |
[out] | isConverged | Whether PEXSI has converged. |