|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
Classes | |
| struct | ShiftRealComplex |
| map a real/complex type to the opposite one ShiftRealComplex<double>::type = std::complex<double> ShiftRealComplex<std::complex<double>>::type = double More... | |
| struct | ShiftRealComplex< double > |
| struct | ShiftRealComplex< std::complex< double > > |
| class | DensityMatrix |
| DensityMatrix Class <TK,TR> = <double,double> for Gamma-only calculation <TK,TR> = <std::complex<double>,double> for multi-k calculation. More... | |
| struct | DmrBlock |
| geometry of one atom-pair sub-block within the global DMK matrix row0/col0: global index of the block's top-left element in the 2D block-cyclic DMK nrows/ncols: orbital dimensions of the two atoms More... | |
| class | Setup_DM |
| struct | Init_DM_Config |
Functions | |
| template<typename TK, typename TR_in, typename TR_out> | |
| void | cal_dmr (const DensityMatrix< TK, TR_in > &dm, std::vector< hamilt::HContainer< TR_out > * > &dmR_out, const int ik_in) |
| template<typename TK, typename TR_in, typename TR_out> | |
| void | cal_dmr_td (DensityMatrix< TK, TR_in > &dm, std::vector< hamilt::HContainer< TR_out > * > &dmR_out, const std::map< ModuleBase::Vector3< int >, std::complex< double > > &phase_hybrid, const ModuleBase::Vector3< double > At, const int ik_in) |
| template<typename TK, typename TR_in, typename TR_out> | |
| void | cal_dmr_full (const DensityMatrix< TK, TR_in > &dm, hamilt::HContainer< TR_out > *dmR_out, const int ik_in) |
| template<typename TK, typename TR_in, typename TR_out> | |
| void | accumulate_dmr (const DensityMatrix< TK, TR_in > &dm, std::vector< hamilt::HContainer< TR_out > * > &dmR_out, const std::map< ModuleBase::Vector3< int >, std::complex< double > > &phase_hybrid, const int ik_in, const char *func_name) |
| shared inner loop of cal_dmr / cal_dmr_td: for each spin channel, zero the DMR HContainer and accumulate kphase * DMK into DMR blocks. Pass an empty phase_hybrid map for the non-TD (cal_dmr) case. | |
| template<typename TR> | |
| void | exp_mul_dmk (const std::complex< double > kphase, const std::vector< std::complex< double > > &dmk_row, TR *dmr_mat) |
| template<typename TR> | |
| void | xyz_to_updown (const std::complex< double > spin_block[4], const int icol, const int spin_stride[4], TR *dmr_mat) |
| DmrBlock | get_dmr_block (const Parallel_Orbitals *pv, const int iat1, const int iat2) |
| extract the block geometry for atom pair (iat1, iat2) from the parallel orbitals layout | |
| template<typename TK, typename TR> | |
| void | build_kphase (hamilt::AtomPair< TR > &atom_pair, const std::vector< ModuleBase::Vector3< double > > &kvec_d, const int nk, const std::map< ModuleBase::Vector3< int >, std::complex< double > > &phase_hybrid, std::vector< std::vector< TK > > &kphase_vec, std::vector< TR * > &dmr_mats) |
| precompute k-phase factors e^{ikR} and collect DMR block pointers for one atom pair | |
| template<typename TK> | |
| void | transpose_dmk_block (const TK *dmk_col_major, const int ld_hk, const DmrBlock &block, TK *dmk_row) |
| transpose a col-major DMK sub-block into row-major order | |
| template<typename TK, typename TR> | |
| void | add_dmr_real (const DensityMatrix< TK, TR > &dm, const DmrBlock &block, const int ik_begin, const std::vector< std::vector< TK > > &kphase_vec, const int ld_hk, const int ik_in, std::vector< TR * > &dmr_mats) |
| nspin=1/2: accumulate Re(kphase * DMK) into DMR blocks | |
| template<typename TK, typename TR> | |
| void | add_dmr_soc (const DensityMatrix< TK, TR > &dm, const DmrBlock &block, const int ik_begin, const std::vector< std::vector< TK > > &kphase_vec, const int ld_hk, const int ik_in, const int col_stride, std::vector< TR * > &dmr_mats) |
| nspin==4 (SOC): accumulate k-phase * DMK into a per-R complex buffer, then transform 2x2 spin blocks from (upup, updown, downup, downdown) to (rho_0, rho_x, rho_y, rho_z) via xyz_to_updown. | |
| void | dm_from_psi (const Parallel_Orbitals *ParaV, const ModuleBase::matrix &wg, const psi::Psi< double > &wfc, DensityMatrix< double, double > &DM) |
| Calculate the k-point density matrix from wavefunctions for the Gamma-only case. | |
| template<typename TR> | |
| void | dm_from_psi (const Parallel_Orbitals *ParaV, const ModuleBase::matrix &wg, const psi::Psi< std::complex< double > > &wfc, DensityMatrix< std::complex< double >, TR > &DM) |
| Calculate the k-point density matrix from wavefunctions for the multi-k case. | |
| void | dmk_from_psi (const Parallel_Orbitals *ParaV, const ModuleBase::matrix &wg, const int ik, const psi::Psi< double > &wfc, double *dmk_out) |
| Calculate one k-point block of the density matrix (Gamma-only case). | |
| void | dmk_from_psi (const Parallel_Orbitals *ParaV, const ModuleBase::matrix &wg, const int ik, const psi::Psi< std::complex< double > > &wfc, std::complex< double > *dmk_out) |
| Calculate one k-point block of the density matrix (multi-k case). | |
| template void | dm_from_psi (const Parallel_Orbitals *ParaV, const ModuleBase::matrix &wg, const psi::Psi< std::complex< double > > &wfc, module_dm::DensityMatrix< std::complex< double >, std::complex< double > > &DM) |
| template void | dm_from_psi (const Parallel_Orbitals *ParaV, const ModuleBase::matrix &wg, const psi::Psi< std::complex< double > > &wfc, module_dm::DensityMatrix< std::complex< double >, double > &DM) |
| template<typename TK> | |
| void | init_dm (UnitCell &ucell, elecstate::ElecState *pelec, Setup_DM< TK > &dmat, psi::Psi< TK > *psi, Charge &chr, const Parallel_Orbitals &pv, const int iter, const int exx_two_level_step, const Init_DM_Config &cfg) |
| template<> | |
| void | exp_mul_dmk< double > (const std::complex< double > kphase, const std::vector< std::complex< double > > &dmk_row, double *dmr_mat) |
| template<> | |
| void | exp_mul_dmk< std::complex< double > > (const std::complex< double > kphase, const std::vector< std::complex< double > > &dmk_row, std::complex< double > *dmr_mat) |
| template<> | |
| void | xyz_to_updown< double > (const std::complex< double > spin_block[4], const int icol, const int spin_stride[4], double *dmr_mat) |
| template<> | |
| void | xyz_to_updown< std::complex< double > > (const std::complex< double > spin_block[4], const int icol, const int spin_stride[4], std::complex< double > *dmr_mat) |
| template void | build_kphase< std::complex< double >, double > (hamilt::AtomPair< double > &, const std::vector< ModuleBase::Vector3< double > > &, const int, const std::map< ModuleBase::Vector3< int >, std::complex< double > > &, std::vector< std::vector< std::complex< double > > > &, std::vector< double * > &) |
| template void | transpose_dmk_block< std::complex< double > > (const std::complex< double > *, const int, const DmrBlock &, std::complex< double > *) |
| template void | add_dmr_real< std::complex< double >, double > (const DensityMatrix< std::complex< double >, double > &, const DmrBlock &, const int, const std::vector< std::vector< std::complex< double > > > &, const int, const int, std::vector< double * > &) |
| template void | add_dmr_soc< std::complex< double >, double > (const DensityMatrix< std::complex< double >, double > &, const DmrBlock &, const int, const std::vector< std::vector< std::complex< double > > > &, const int, const int, const int, std::vector< double * > &) |
| template void | accumulate_dmr< std::complex< double >, double, double > (const DensityMatrix< std::complex< double >, double > &, std::vector< hamilt::HContainer< double > * > &, const std::map< ModuleBase::Vector3< int >, std::complex< double > > &, const int, const char *) |
| void | edm_tddft (const Parallel_Blkcyclic &layout, const ModuleBase::MatrixBlock< std::complex< double > > &h_mat, const ModuleBase::MatrixBlock< std::complex< double > > &s_mat, std::complex< double > *dmk, ModuleBase::ComplexMatrix &edmk) |
| template<typename Device> | |
| void | edm_tddft_lapack (const Parallel_Blkcyclic &layout, const ModuleBase::MatrixBlock< std::complex< double > > &h_mat, const ModuleBase::MatrixBlock< std::complex< double > > &s_mat, std::complex< double > *dmk, ModuleBase::ComplexMatrix &edmk) |
| template void | edm_tddft_lapack< base_device::DEVICE_CPU > (const Parallel_Blkcyclic &layout, const ModuleBase::MatrixBlock< std::complex< double > > &h_mat, const ModuleBase::MatrixBlock< std::complex< double > > &s_mat, std::complex< double > *dmk, ModuleBase::ComplexMatrix &edmk) |
|
extern |
shared inner loop of cal_dmr / cal_dmr_td: for each spin channel, zero the DMR HContainer and accumulate kphase * DMK into DMR blocks. Pass an empty phase_hybrid map for the non-TD (cal_dmr) case.
| template void module_dm::accumulate_dmr< std::complex< double >, double, double > | ( | const DensityMatrix< std::complex< double >, double > & | , |
| std::vector< hamilt::HContainer< double > * > & | , | ||
| const std::map< ModuleBase::Vector3< int >, std::complex< double > > & | , | ||
| const int | , | ||
| const char * | ) |
|
extern |
nspin=1/2: accumulate Re(kphase * DMK) into DMR blocks
Formula: DMR_ij(R) += Re[ e^{ik·R} * DMK_ij(k) ] If ik_in >= 0, only that k-point contributes; if ik_in < 0, sum over all k-points.
| template void module_dm::add_dmr_real< std::complex< double >, double > | ( | const DensityMatrix< std::complex< double >, double > & | , |
| const DmrBlock & | , | ||
| const int | , | ||
| const std::vector< std::vector< std::complex< double > > > & | , | ||
| const int | , | ||
| const int | , | ||
| std::vector< double * > & | ) |
|
extern |
nspin==4 (SOC): accumulate k-phase * DMK into a per-R complex buffer, then transform 2x2 spin blocks from (upup, updown, downup, downdown) to (rho_0, rho_x, rho_y, rho_z) via xyz_to_updown.
Formula: S_ij(R) = sum_k e^{ik·R} * DMK_ij(k) rho_0 = rho_upup + rho_downdown rho_x = rho_updown + rho_downup rho_y = Im(rho_updown) - Im(rho_downup) (sign for conjugated stored DM) rho_z = rho_upup - rho_downdown Each orbital corresponds to a 2x2 spin block, so rows/cols step by 2. If ik_in >= 0, only that k-point contributes; if ik_in < 0, sum over all k-points.
| template void module_dm::add_dmr_soc< std::complex< double >, double > | ( | const DensityMatrix< std::complex< double >, double > & | , |
| const DmrBlock & | , | ||
| const int | , | ||
| const std::vector< std::vector< std::complex< double > > > & | , | ||
| const int | , | ||
| const int | , | ||
| const int | , | ||
| std::vector< double * > & | ) |
|
extern |
precompute k-phase factors e^{ikR} and collect DMR block pointers for one atom pair
| atom_pair | the atom pair whose R-vectors and matrices are used |
| kvec_d | direct coordinates of k-points |
| nk | number of k-points |
| phase_hybrid | additional hybrid-gauge phase per R (empty map = no extra phase) |
| kphase_vec | output: kphase_vec[ik][iR] |
| dmr_mats | output: dmr_mats[iR] points to the DMR block for R-vector iR |
| template void module_dm::build_kphase< std::complex< double >, double > | ( | hamilt::AtomPair< double > & | , |
| const std::vector< ModuleBase::Vector3< double > > & | , | ||
| const int | , | ||
| const std::map< ModuleBase::Vector3< int >, std::complex< double > > & | , | ||
| std::vector< std::vector< std::complex< double > > > & | , | ||
| std::vector< double * > & | ) |
|
extern |
|
extern |
|
extern |
| void module_dm::dm_from_psi | ( | const Parallel_Orbitals * | ParaV, |
| const ModuleBase::matrix & | wg, | ||
| const psi::Psi< double > & | wfc, | ||
| DensityMatrix< double, double > & | DM ) |
Calculate the k-point density matrix from wavefunctions for the Gamma-only case.
For every k-point block of the wavefunction this computes dmk(iw1, iw2) = sum_ib wg(ik, ib) * wfc(ib, iw1) * wfc(ib, iw2), i.e. the wavefunction weights are real so no conjugation is needed.
| ParaV | 2D block-cyclic distribution descriptor of the orbitals |
| wg | band weights, wg(ik, ib_global) for the global band index |
| wfc | wavefunction coefficients, shape (nk, nbands_local, nbasis_local) |
| DM | output density matrix, one block per k-point |
| void module_dm::dm_from_psi | ( | const Parallel_Orbitals * | ParaV, |
| const ModuleBase::matrix & | wg, | ||
| const psi::Psi< std::complex< double > > & | wfc, | ||
| DensityMatrix< std::complex< double >, TR > & | DM ) |
Calculate the k-point density matrix from wavefunctions for the multi-k case.
For every k-point block of the wavefunction this computes dmk(iw1, iw2) = sum_ib wg(ik, ib) * conj(wfc(ib, iw1)) * wfc(ib, iw2). The conjugation is applied to the FIRST basis index ("conj-first" storage): the stored block is the transpose of the physical one-body density matrix P = C diag(wg) C^H. cal_dmr(), SOC magnetization and Mulliken analysis all rely on this convention, see dm_tools.cpp and unittests/test_soc_magnetization_roundtrip.cpp.
| TR | real type of the real-space density matrix of DM |
| ParaV | 2D block-cyclic distribution descriptor of the orbitals |
| wg | band weights, wg(ik, ib_global) for the global band index |
| wfc | wavefunction coefficients, shape (nk, nbands_local, nbasis_local) |
| DM | output density matrix, one block per k-point |
| template void module_dm::dm_from_psi | ( | const Parallel_Orbitals * | ParaV, |
| const ModuleBase::matrix & | wg, | ||
| const psi::Psi< std::complex< double > > & | wfc, | ||
| module_dm::DensityMatrix< std::complex< double >, double > & | DM ) |
| template void module_dm::dm_from_psi | ( | const Parallel_Orbitals * | ParaV, |
| const ModuleBase::matrix & | wg, | ||
| const psi::Psi< std::complex< double > > & | wfc, | ||
| module_dm::DensityMatrix< std::complex< double >, std::complex< double > > & | DM ) |
| void module_dm::dmk_from_psi | ( | const Parallel_Orbitals * | ParaV, |
| const ModuleBase::matrix & | wg, | ||
| const int | ik, | ||
| const psi::Psi< double > & | wfc, | ||
| double * | dmk_out ) |
Calculate one k-point block of the density matrix (Gamma-only case).
Single-k-point worker behind dm_from_psi(); exposed for callers that own the output storage themselves. The conjugation/weighting contract is the same as dm_from_psi(), the caller only provides the output slot.
| ParaV | 2D block-cyclic distribution descriptor of the orbitals |
| wg | band weights, wg(ik, ib_global) for the global band index |
| ik | k-point index of the block to calculate |
| wfc | wavefunction coefficients |
| dmk_out | output block, distributed according to ParaV->desc (serial builds: a dense nbasis_local x nbasis_local column-major matrix) |
| void module_dm::dmk_from_psi | ( | const Parallel_Orbitals * | ParaV, |
| const ModuleBase::matrix & | wg, | ||
| const int | ik, | ||
| const psi::Psi< std::complex< double > > & | wfc, | ||
| std::complex< double > * | dmk_out ) |
Calculate one k-point block of the density matrix (multi-k case).
Single-k-point worker behind dm_from_psi(), using the conj-first convention dmk(iw1, iw2) = sum_ib wg(ik, ib) * conj(wfc(ib, iw1)) * wfc(ib, iw2).
| ParaV | 2D block-cyclic distribution descriptor of the orbitals |
| wg | band weights, wg(ik, ib_global) for the global band index |
| ik | k-point index of the block to calculate |
| wfc | wavefunction coefficients |
| dmk_out | output block, distributed according to ParaV->desc (serial builds: a dense nbasis_local x nbasis_local column-major matrix) |
| void module_dm::edm_tddft | ( | const Parallel_Blkcyclic & | layout, |
| const ModuleBase::MatrixBlock< std::complex< double > > & | h_mat, | ||
| const ModuleBase::MatrixBlock< std::complex< double > > & | s_mat, | ||
| std::complex< double > * | dmk, | ||
| ModuleBase::ComplexMatrix & | edmk ) |
| void module_dm::edm_tddft_lapack | ( | const Parallel_Blkcyclic & | layout, |
| const ModuleBase::MatrixBlock< std::complex< double > > & | h_mat, | ||
| const ModuleBase::MatrixBlock< std::complex< double > > & | s_mat, | ||
| std::complex< double > * | dmk, | ||
| ModuleBase::ComplexMatrix & | edmk ) |
| template void module_dm::edm_tddft_lapack< base_device::DEVICE_CPU > | ( | const Parallel_Blkcyclic & | layout, |
| const ModuleBase::MatrixBlock< std::complex< double > > & | h_mat, | ||
| const ModuleBase::MatrixBlock< std::complex< double > > & | s_mat, | ||
| std::complex< double > * | dmk, | ||
| ModuleBase::ComplexMatrix & | edmk ) |
|
extern |
| void module_dm::exp_mul_dmk< double > | ( | const std::complex< double > | kphase, |
| const std::vector< std::complex< double > > & | dmk_row, | ||
| double * | dmr_mat ) |
| void module_dm::exp_mul_dmk< std::complex< double > > | ( | const std::complex< double > | kphase, |
| const std::vector< std::complex< double > > & | dmk_row, | ||
| std::complex< double > * | dmr_mat ) |
| DmrBlock module_dm::get_dmr_block | ( | const Parallel_Orbitals * | pv, |
| const int | iat1, | ||
| const int | iat2 ) |
extract the block geometry for atom pair (iat1, iat2) from the parallel orbitals layout
| void module_dm::init_dm | ( | UnitCell & | ucell, |
| elecstate::ElecState * | pelec, | ||
| module_dm::Setup_DM< TK > & | dmat, | ||
| psi::Psi< TK > * | psi, | ||
| Charge & | chr, | ||
| const Parallel_Orbitals & | pv, | ||
| const int | iter, | ||
| const int | exx_two_level_step, | ||
| const Init_DM_Config & | cfg ) |
update the potentials by using new electron charge density
compute the correction energy for metals
|
extern |
transpose a col-major DMK sub-block into row-major order
| template void module_dm::transpose_dmk_block< std::complex< double > > | ( | const std::complex< double > * | , |
| const int | , | ||
| const DmrBlock & | , | ||
| std::complex< double > * | ) |
|
extern |
| void module_dm::xyz_to_updown< double > | ( | const std::complex< double > | spin_block[4], |
| const int | icol, | ||
| const int | spin_stride[4], | ||
| double * | dmr_mat ) |
| void module_dm::xyz_to_updown< std::complex< double > > | ( | const std::complex< double > | spin_block[4], |
| const int | icol, | ||
| const int | spin_stride[4], | ||
| std::complex< double > * | dmr_mat ) |