ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
#include <density_matrix.h>
Public Member Functions | |
~DensityMatrix () | |
Destructor of class DensityMatrix. | |
DensityMatrix (const Parallel_Orbitals *_paraV, const int nspin, const std::vector< ModuleBase::Vector3< double > > &kvec_d, const int nk) | |
Constructor of class DensityMatrix for multi-k calculation. | |
DensityMatrix (const Parallel_Orbitals *_paraV, const int nspin) | |
Constructor of class DensityMatrix for gamma-only calculation, where kvector is not required. | |
void | init_DMR (const Grid_Driver *GridD_in, const UnitCell *ucell) |
initialize density matrix DMR from UnitCell | |
void | init_DMR (Record_adj &ra, const UnitCell *ucell) |
initialize density matrix DMR from UnitCell and RA | |
void | init_DMR (const hamilt::HContainer< TR > &_DMR_in) |
initialize density matrix DMR from another HContainer now only support HContainer<double> | |
void | init_DMR (const hamilt::HContainer< TRShift > &_DMR_in) |
initialize density matrix DMR from another HContainer this is a temprory function for NSPIN=4 case since copy HContainer from another HContainer with different TR is not supported yet would be refactor in the future | |
void | set_DMK (const int ispin, const int ik, const int i, const int j, const TK value) |
set _DMK element directly | |
void | set_DMK_zero () |
set _DMK element to zero | |
TK | get_DMK (const int ispin, const int ik, const int i, const int j) const |
get a matrix element of density matrix dm(k) | |
int | get_DMK_nks () const |
get total number of k-points of density matrix dm(k) | |
int | get_DMK_size () const |
int | get_DMK_nrow () const |
get number of rows of density matrix dm(k) | |
int | get_DMK_ncol () const |
get number of columns of density matrix dm(k) | |
hamilt::HContainer< TR > * | get_DMR_pointer (const int ispin) const |
get pointer of DMR | |
const std::vector< hamilt::HContainer< TR > * > & | get_DMR_vector () const |
get pointer vector of DMR | |
std::vector< hamilt::HContainer< TR > * > & | get_DMR_vector () |
const std::vector< std::vector< TR > > & | get_DMR_save () const |
std::vector< std::vector< TR > > & | get_DMR_save () |
TK * | get_DMK_pointer (const int ik) const |
get pointer of DMK | |
const std::vector< std::vector< TK > > & | get_DMK_vector () const |
get pointer vector of DMK | |
std::vector< std::vector< TK > > & | get_DMK_vector () |
void | set_DMK_pointer (const int ik, TK *DMK_in) |
set _DMK using a input TK* pointer please make sure the size of TK* is correct | |
const Parallel_Orbitals * | get_paraV_pointer () const |
get pointer of paraV | |
const std::vector< ModuleBase::Vector3< double > > & | get_kvec_d () const |
void | cal_DMR (const int ik_in=-1) |
calculate density matrix DMR from dm(k) using blas::axpy if ik_in < 0, calculate all k-points if ik_in >= 0, calculate only one k-point without summing over k-points | |
void | cal_DMR_td (const UnitCell &ucell, const ModuleBase::Vector3< double > At, const int ik_in=-1) |
calculate density matrix DMR with additional vector potential phase, used for hybrid gauge tddft if ik_in < 0, calculate all k-points if ik_in >= 0, calculate only one k-point without summing over k-points | |
void | cal_DMR_full (hamilt::HContainer< std::complex< double > > *dmR_out) const |
calculate complex density matrix DMR with both real and imaginary part for noncollinear-spin calculation the stored dm(k) has been used to calculate the passin DMR | |
void | switch_dmr (const int mode) |
(Only nspin=2) switch DMR to total density matrix or magnetization density matrix | |
void | write_DMK (const std::string directory, const int ispin, const int ik) |
write density matrix dm(ik) into *.dmk | |
void | read_DMK (const std::string directory, const int ispin, const int ik) |
read *.dmk into density matrix dm(ik) | |
void | save_DMR () |
save _DMR into _DMR_save | |
void | cal_DMR (const int ik_in) |
void | cal_DMR_td (const UnitCell &ucell, const ModuleBase::Vector3< double > At, const int ik_in) |
void | cal_DMR_full (hamilt::HContainer< std::complex< double > > *dmR_out) const |
void | cal_DMR_full (hamilt::HContainer< std::complex< double > > *dmR_out) const |
void | cal_DMR (const int ik_in) |
void | write_DMK (const std::string directory, const int ispin, const int ik) |
void | write_DMK (const std::string directory, const int ispin, const int ik) |
void | cal_DMR (int ik_in) |
Public Attributes | |
std::vector< ModuleBase::ComplexMatrix > | EDMK |
Private Types | |
using | TRShift = typename ShiftRealComplex< TR >::type |
Private Attributes | |
std::vector< hamilt::HContainer< TR > * > | _DMR |
HContainer for density matrix in real space for 2D parallelization vector.size() = 1 for non-polarization and SOC vector.size() = 2 for spin-polarization. | |
std::vector< std::vector< TR > > | _DMR_save |
std::vector< hamilt::HContainer< TR > * > | _DMR_grid |
HContainer for density matrix in real space for gird parallelization vector.size() = 1 for non-polarization and SOC vector.size() = 2 for spin-polarization. | |
std::vector< std::vector< TK > > | _DMK |
density matrix in k space, which is a vector[ik] DMK should be a [_nspin][_nk][i][j] matrix, whose size is _nspin * _nk * _paraV->get_nrow() * _paraV->get_ncol() | |
const std::vector< ModuleBase::Vector3< double > > | _kvec_d |
K_Vectors object, which is used to get k-point information. | |
const Parallel_Orbitals * | _paraV = nullptr |
Parallel_Orbitals object, which contain all information of 2D block cyclic distribution. | |
int | _nspin = 1 |
spin-polarization index (1 - none spin and SOC ; 2 - spin polarization) Attention: this is not as same as GlovalV::NSPIN _nspin means the number of isolated spin-polarization states | |
int | _nk = 0 |
real number of k-points _nk is not equal to _kv->get_nks() when spin-polarization is considered _nk = kv->get_nks() / nspin when nspin=2 | |
std::vector< TR > | dmr_origin_ |
temporary pointers for switch DMR, only used with nspin=2 | |
TR * | dmr_tmp_ = nullptr |
|
private |
elecstate::DensityMatrix< TK, TR >::~DensityMatrix | ( | ) |
Destructor of class DensityMatrix.
elecstate::DensityMatrix< TK, TR >::DensityMatrix | ( | const Parallel_Orbitals * | _paraV, |
const int | nspin, | ||
const std::vector< ModuleBase::Vector3< double > > & | kvec_d, | ||
const int | nk | ||
) |
Constructor of class DensityMatrix for multi-k calculation.
_paraV | pointer of Parallel_Orbitals object |
nspin | number of spin of the density matrix, set by user according to global nspin (usually {nspin_global -> nspin_dm} = {1->1, 2->2, 4->1}, but sometimes 2->1 like in LR-TDDFT) |
kvec_d | direct coordinates of kpoints |
nk | number of k-points, not always equal to K_Vectors::get_nks()/nspin_dm. it will be set to kvec_d.size() if the value is invalid |
elecstate::DensityMatrix< TK, TR >::DensityMatrix | ( | const Parallel_Orbitals * | _paraV, |
const int | nspin | ||
) |
Constructor of class DensityMatrix for gamma-only calculation, where kvector is not required.
_paraV | pointer of Parallel_Orbitals object |
nspin | number of spin of the density matrix, set by user according to global nspin (usually {nspin_global -> nspin_dm} = {1->1, 2->2, 4->1}, but sometimes 2->1 like in LR-TDDFT) |
void elecstate::DensityMatrix< std::complex< double >, double >::cal_DMR | ( | const int | ik_in | ) |
void elecstate::DensityMatrix< double, double >::cal_DMR | ( | const int | ik_in | ) |
void elecstate::DensityMatrix< TK, TR >::cal_DMR | ( | const int | ik_in = -1 | ) |
calculate density matrix DMR from dm(k) using blas::axpy if ik_in < 0, calculate all k-points if ik_in >= 0, calculate only one k-point without summing over k-points
void elecstate::DensityMatrix< std::complex< double >, std::complex< double > >::cal_DMR | ( | int | ik_in | ) |
void elecstate::DensityMatrix< double, double >::cal_DMR_full | ( | hamilt::HContainer< std::complex< double > > * | dmR_out | ) | const |
void elecstate::DensityMatrix< std::complex< double >, double >::cal_DMR_full | ( | hamilt::HContainer< std::complex< double > > * | dmR_out | ) | const |
void elecstate::DensityMatrix< TK, TR >::cal_DMR_full | ( | hamilt::HContainer< std::complex< double > > * | dmR_out | ) | const |
calculate complex density matrix DMR with both real and imaginary part for noncollinear-spin calculation the stored dm(k) has been used to calculate the passin DMR
dmR_out | pointer of HContainer object to store the calculated complex DMR |
void elecstate::DensityMatrix< std::complex< double >, double >::cal_DMR_td | ( | const UnitCell & | ucell, |
const ModuleBase::Vector3< double > | At, | ||
const int | ik_in | ||
) |
void elecstate::DensityMatrix< TK, TR >::cal_DMR_td | ( | const UnitCell & | ucell, |
const ModuleBase::Vector3< double > | At, | ||
const int | ik_in = -1 |
||
) |
calculate density matrix DMR with additional vector potential phase, used for hybrid gauge tddft if ik_in < 0, calculate all k-points if ik_in >= 0, calculate only one k-point without summing over k-points
TK elecstate::DensityMatrix< TK, TR >::get_DMK | ( | const int | ispin, |
const int | ik, | ||
const int | i, | ||
const int | j | ||
) | const |
get a matrix element of density matrix dm(k)
ispin | spin index (1 - spin up (support SOC) or 2 - spin down) |
ik | k-point index |
i | row index |
j | column index |
int elecstate::DensityMatrix< TK, TR >::get_DMK_ncol | ( | ) | const |
get number of columns of density matrix dm(k)
int elecstate::DensityMatrix< TK, TR >::get_DMK_nks | ( | ) | const |
get total number of k-points of density matrix dm(k)
int elecstate::DensityMatrix< TK, TR >::get_DMK_nrow | ( | ) | const |
get number of rows of density matrix dm(k)
TK * elecstate::DensityMatrix< TK, TR >::get_DMK_pointer | ( | const int | ik | ) | const |
get pointer of DMK
ik | k-point index, which is the index of _DMK |
int elecstate::DensityMatrix< TK, TR >::get_DMK_size | ( | ) | const |
|
inline |
|
inline |
get pointer vector of DMK
hamilt::HContainer< TR > * elecstate::DensityMatrix< TK, TR >::get_DMR_pointer | ( | const int | ispin | ) | const |
get pointer of DMR
ispin | spin index (1 - spin up (support SOC) or 2 - spin down) |
* pointer of DMR
|
inline |
|
inline |
|
inline |
|
inline |
get pointer vector of DMR
* vector of DMR
|
inline |
|
inline |
get pointer of paraV
void elecstate::DensityMatrix< TK, TR >::init_DMR | ( | const Grid_Driver * | GridD_in, |
const UnitCell * | ucell | ||
) |
initialize density matrix DMR from UnitCell
GridD_in | pointer of Grid_Driver object (used to find ajacent atoms) |
ucell | pointer of UnitCell object |
void elecstate::DensityMatrix< TK, TR >::init_DMR | ( | const hamilt::HContainer< TR > & | _DMR_in | ) |
initialize density matrix DMR from another HContainer now only support HContainer<double>
_DMR_in | pointer of another HContainer object |
void elecstate::DensityMatrix< TK, TR >::init_DMR | ( | const hamilt::HContainer< TRShift > & | _DMR_in | ) |
initialize density matrix DMR from another HContainer this is a temprory function for NSPIN=4 case since copy HContainer from another HContainer with different TR is not supported yet would be refactor in the future
_DMR_in |
void elecstate::DensityMatrix< TK, TR >::init_DMR | ( | Record_adj & | ra, |
const UnitCell * | ucell | ||
) |
initialize density matrix DMR from UnitCell and RA
initialize density matrix DMR from UnitCell and RA (mainly used in UnitTest)
ra | pointer of Record_adj object (used to find ajacent atoms) |
ucell | pointer of UnitCell object |
void elecstate::DensityMatrix< TK, TR >::read_DMK | ( | const std::string | directory, |
const int | ispin, | ||
const int | ik | ||
) |
read *.dmk into density matrix dm(ik)
directory | directory of *.dmk files |
ispin | spin index (1 - spin up (support SOC) or 2 - spin down) |
ik | k-point index |
void elecstate::DensityMatrix< TK, TR >::save_DMR | ( | ) |
save _DMR into _DMR_save
void elecstate::DensityMatrix< TK, TR >::set_DMK | ( | const int | ispin, |
const int | ik, | ||
const int | i, | ||
const int | j, | ||
const TK | value | ||
) |
set _DMK element directly
ispin | spin index (1 - spin up (support SOC) or 2 - spin down) |
ik | k-point index |
i | row index |
j | column index |
value | value to be set |
void elecstate::DensityMatrix< TK, TR >::set_DMK_pointer | ( | const int | ik, |
TK * | DMK_in | ||
) |
set _DMK using a input TK* pointer please make sure the size of TK* is correct
void elecstate::DensityMatrix< TK, TR >::set_DMK_zero | ( | ) |
set _DMK element to zero
void elecstate::DensityMatrix< TK, TR >::switch_dmr | ( | const int | mode | ) |
(Only nspin=2) switch DMR to total density matrix or magnetization density matrix
mode | 0 - original density matrix; 1 - total density matrix; 2 - magnetization density matrix |
void elecstate::DensityMatrix< TK, TR >::write_DMK | ( | const std::string | directory, |
const int | ispin, | ||
const int | ik | ||
) |
write density matrix dm(ik) into *.dmk
directory | directory of *.dmk files |
ispin | spin index (1 - spin up (support SOC) or 2 - spin down) |
ik | k-point index |
void elecstate::DensityMatrix< double, double >::write_DMK | ( | const std::string | directory, |
const int | ispin, | ||
const int | ik | ||
) |
void elecstate::DensityMatrix< std::complex< double >, double >::write_DMK | ( | const std::string | directory, |
const int | ispin, | ||
const int | ik | ||
) |
|
private |
density matrix in k space, which is a vector[ik] DMK should be a [_nspin][_nk][i][j] matrix, whose size is _nspin * _nk * _paraV->get_nrow() * _paraV->get_ncol()
|
private |
HContainer for density matrix in real space for 2D parallelization vector.size() = 1 for non-polarization and SOC vector.size() = 2 for spin-polarization.
|
private |
HContainer for density matrix in real space for gird parallelization vector.size() = 1 for non-polarization and SOC vector.size() = 2 for spin-polarization.
|
private |
|
private |
K_Vectors object, which is used to get k-point information.
|
private |
real number of k-points _nk is not equal to _kv->get_nks() when spin-polarization is considered _nk = kv->get_nks() / nspin when nspin=2
|
private |
spin-polarization index (1 - none spin and SOC ; 2 - spin polarization) Attention: this is not as same as GlovalV::NSPIN _nspin means the number of isolated spin-polarization states
|
private |
Parallel_Orbitals object, which contain all information of 2D block cyclic distribution.
|
private |
temporary pointers for switch DMR, only used with nspin=2
|
private |
std::vector<ModuleBase::ComplexMatrix> elecstate::DensityMatrix< TK, TR >::EDMK |