|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
Classes | |
| class | ExcitonPlotter |
| struct | MPIType |
| Struct to get MPI_traits for different data types. More... | |
| struct | MPIType< int > |
| struct | MPIType< double > |
| struct | MPIType< std::complex< double > > |
| struct | BlockHead |
Typedefs | |
| using | Complex = std::complex<double> |
| template<typename T> | |
| using | Real = typename GetTypeReal<T>::type |
| using | TC = std::array<int, 3> |
| using | TAC = std::pair<int, TC> |
| template<typename T> | |
| using | TLRIX = std::map<int, std::map<TAC, std::vector<T>>> |
Enumerations | |
| enum | MO_TYPE { OO , VO , OV , VV , ALL } |
Functions | |
| template<typename TR> | |
| void | save_HR (const hamilt::HContainer< TR > &hR, const std::string &filename, const Parallel_Orbitals &pv, const std::string &out_dir, const double sparse_thr, std::ostream &running_log) |
| template<typename TK, typename TR> | |
| void | save_DMR (const module_dm::DensityMatrix< TK, TR > &dm, const std::string &filename, const Parallel_Orbitals &pv, const std::string &out_dir, const double sparse_thr, std::ostream &running_log) |
| template void | save_HR (const hamilt::HContainer< double > &, const std::string &, const Parallel_Orbitals &, const std::string &, double, std::ostream &) |
| template void | save_HR (const hamilt::HContainer< Complex > &, const std::string &, const Parallel_Orbitals &, const std::string &, double, std::ostream &) |
| template void | save_DMR (const module_dm::DensityMatrix< double, double > &, const std::string &, const Parallel_Orbitals &, const std::string &, double, std::ostream &) |
| template void | save_DMR (const module_dm::DensityMatrix< Complex, double > &, const std::string &, const Parallel_Orbitals &, const std::string &, double, std::ostream &) |
| template void | save_DMR (const module_dm::DensityMatrix< Complex, Complex > &, const std::string &, const Parallel_Orbitals &, const std::string &, double, std::ostream &) |
| double | hse_sigma_floor () |
| Existing HSE sigma floor (bohr^-8), shared by LR and the GS fallback. | |
| int | spin_population_difference (const ModuleBase::matrix &wg, int kpar, int rank_in_pool) |
| Sum k-point spin populations before rounding; count each pool only once. | |
| std::string | force_window_warning (int basis_size, int gs_bands, int skipped_occupied, const std::vector< int > &x_virtual, const std::vector< int > &z_virtual) |
| Diagnose resolved force windows without modifying X, Z or their energies. | |
| void | check_force_pp (const UnitCell &cell, bool cal_force, const std::string &calculation) |
| Reject unsupported NLCC force requests after pseudopotentials have been loaded. | |
| const std::vector< double > & | prepare_xc_sigma (const std::vector< double > &sigma, bool is_hse06, std::vector< double > &hse_buffer) |
| Preserve signed sigma invariants except for the existing HSE06 stabilization. | |
| const std::vector< double > & | prepare_xc_sigma (const std::vector< double > &sigma, bool is_hse06, std::vector< double > &hse_buffer, std::vector< double > &jacobian) |
| Prepare stabilized sigma and its componentwise derivative. | |
| int | cal_nocc (int nelec) |
| =================PHYSICS==================== | |
| int | cal_nocc (double nelec, int nspin, int nupdown) |
| Largest occupied spin channel; nelec already includes the charge correction. | |
| int | cal_nocc_window (int requested_nocc, int nocc_max) |
| Retain a positive user window, otherwise use all occupied orbitals. | |
| std::pair< ModuleBase::matrix, std::vector< std::pair< int, int > > > | set_ix_map_diagonal (bool mode, int nc, int nv) |
| set the index map: ix to (ic, iv) and vice versa by diagonal traverse the c-v pairs leftdown -> rightup for mode 0, rightup -> leftdown for mode 1 | |
| template<> | |
| void | matsym< double > (const double *in, const int n, const Parallel_Blkcyclic &pmat, double *out) |
| =================ALGORITHM==================== | |
| template<> | |
| void | matsym< double > (double *inout, const int n, const Parallel_Blkcyclic &pmat) |
| template<> | |
| void | matsym< std::complex< double > > (const std::complex< double > *in, const int n, const Parallel_Blkcyclic &pmat, std::complex< double > *out) |
| template<> | |
| void | matsym< std::complex< double > > (std::complex< double > *inout, const int n, const Parallel_Blkcyclic &pmat) |
| template<> | |
| void | mattrans< double > (const double *in, const int n, const Parallel_Blkcyclic &pmat, double *out) |
| template<> | |
| void | mattrans< double > (double *inout, const int n, const Parallel_Blkcyclic &pmat) |
| template<> | |
| void | mattrans< std::complex< double > > (const std::complex< double > *in, const int n, const Parallel_Blkcyclic &pmat, std::complex< double > *out) |
| template<> | |
| void | mattrans< std::complex< double > > (std::complex< double > *inout, const int n, const Parallel_Blkcyclic &pmat) |
| template<> | |
| void | matantisym< double > (double *inout, const int n, const Parallel_Blkcyclic &pmat) |
| template<> | |
| void | matantisym< std::complex< double > > (std::complex< double > *inout, const int n, const Parallel_Blkcyclic &pmat) |
| void | setup_2d_division (Parallel_Blkcyclic &pv, int nb, int gr, int gc) |
| =================2D-block Parallel=============== | |
| void | setup_2d_division (Parallel_Blkcyclic &pv, int nb, int gr, int gc, const int &blacs_ctxt_in) |
| template<> | |
| void | diag_lapack< double > (const int &n, double *mat, double *eig) |
| template<> | |
| void | diag_lapack< std::complex< double > > (const int &n, std::complex< double > *mat, double *eig) |
| template<> | |
| void | diag_lapack_nh< double > (const int &n, double *mat, std::complex< double > *eig) |
| template<> | |
| void | diag_lapack_nh< std::complex< double > > (const int &n, std::complex< double > *mat, std::complex< double > *eig) |
| template<> | |
| int | lapack_linear_solver< double > (const double *A, double *x, const double *b, const int n, const int nrhs) |
| template<> | |
| int | lapack_linear_solver< std::complex< double > > (const std::complex< double > *A, std::complex< double > *x, const std::complex< double > *b, const int n, const int nrhs) |
| std::string | tolower (const std::string &str) |
| =================string option==================== | |
| std::string | toupper (const std::string &str) |
| const std::set< std::string > & | hybrid_xc_list () |
| the xc kernels that carry an exact-exchange (EXX) term | |
| bool | has_local_xc (const std::string &name) |
| check if the xc functional has local xc kernel | |
| template<typename TCell> | |
| int | cal_nelec (const TCell &ucell) |
| calculate the number of electrons | |
| double | inner_product (const double *vec1, const double *vec2, const int &size) |
| =================ALGORITHM==================== | |
| std::complex< double > | inner_product (const std::complex< double > *vec1, const std::complex< double > *vec2, const int &size) |
| template<typename T> | |
| void | _deallocate_2order_nested_ptr (T **p2, size_t size) |
| delete 2d pointer | |
| template<typename T> | |
| void | _allocate_2order_nested_ptr (T **&p2, size_t size1, size_t size2) |
| new 2d pointer | |
| template<typename T> | |
| ct::Tensor | newTensor (const ct::TensorShape &shape) |
| template<typename T> | |
| void | matsym (const T *in, const int n, T *out) |
| template<typename T> | |
| void | matsym (T *inout, const int n) |
| calculate (A+A^T)/2 (in-place version) | |
| template<typename T> | |
| void | matsym (const T *in, const int n, const Parallel_Blkcyclic &pmat, T *out) |
| template<typename T> | |
| void | matsym (T *inout, const int n, const Parallel_Blkcyclic &pmat) |
| template<typename T> | |
| void | mattrans (const T *in, const int n, const Parallel_Blkcyclic &pmat, T *out) |
| template<typename T> | |
| void | mattrans (T *inout, const int n, const Parallel_Blkcyclic &pmat) |
| template<typename T> | |
| void | matantisym (T *inout, const int n, const Parallel_Blkcyclic &pmat) |
| template<typename T> | |
| bool | is_hermitian (const T *mat, const Parallel_Blkcyclic &pmat, const double threshold, const int my_rank) |
| template<typename T> | |
| bool | is_symmetric (const T *mat, const Parallel_Blkcyclic &pmat, const double threshold, const int my_rank) |
| template<typename T, typename Device> | |
| psi::Psi< T, Device > | k1_to_bfirst_wrapper (const psi::Psi< T, Device > &psi_kfirst, int nk_in, int nbasis_in) |
| psi(nk=1, nbands=nb, nk * nbasis) -> psi(nb, nk, nbasis) without memory copy | |
| template<typename T, typename Device> | |
| psi::Psi< T, Device > | bfirst_to_k1_wrapper (const psi::Psi< T, Device > &psi_bfirst) |
| psi(nb, nk, nbasis) -> psi(nk=1, nbands=nb, nk * nbasis) without memory copy | |
| template<typename T> | |
| void | global2local_X (T *local_X, const T *global_X, const int nband, const int nk, const std::vector< int > &nocc, const std::vector< int > &nvirt, const std::vector< Parallel_Blkcyclic > &pX, const bool openshell) |
| assign global X to 2d-matrix, its col is band(excition state), and row is { spin, k-point, occ, virt } | |
| template<typename T> | |
| void | pA2pX (T *X_pX, const T *X_pA, const int nband, const int nk, const std::vector< int > &nocc, const std::vector< int > &nvirt, const std::vector< Parallel_Blkcyclic > &pX, const Parallel_Blkcyclic &pA, const int row_offset, const int col_offset, const bool openshell, const int my_rank, const int nproc) |
| assign X in pA to X in pX | |
| template<typename T> | |
| void | gather_2d_to_full (const Parallel_Blkcyclic &pv, const T *submat, T *fullmat, const bool row_major, const std::size_t global_nrow, const std::size_t global_ncol) |
| gather 2d matrix to full matrix the defination of row and col is consistent with setup_2d_division | |
| template<typename T> | |
| void | scatter_full_to_2d (const Parallel_Blkcyclic &pv, const T *fullmat, T *submat, const bool col_first=false) |
| scatter full matrix to 2d block-cyclic distributed matrix | |
| template<typename T> | |
| void | diag_lapack (const int &n, T *mat, double *eig) |
| diagonalize a hermitian matrix | |
| template<typename T> | |
| void | diag_lapack_nh (const int &n, T *mat, std::complex< double > *eig) |
| diagonalize a general matrix | |
| template<typename T> | |
| int | lapack_linear_solver (const T *A, T *x, const T *b, const int n, const int nrhs) |
| solve linear equations Ax=b using LAPACK | |
| template<typename T, typename... Args> | |
| std::unique_ptr< T > | make_unique (Args &&... args) |
| double | get_conj (const double &x) |
| std::complex< double > | get_conj (const std::complex< double > &x) |
| template<typename T> | |
| psi::Psi< T > | get_psi_spin (const psi::Psi< T > &psi_in, const int &is, const int &nk) |
| get the Psi wrapper of the selected spin from the Psi object | |
| MPI_Datatype | mpi_type_blockhead () |
| template<typename TR> | |
| void | print_HR (const hamilt::HContainer< TR > &HR, const std::string &label, const double &threshold=1e-10) |
| template<typename TK, typename TR> | |
| void | print_DMR (const module_dm::DensityMatrix< TK, TR > &DMR, const std::string &label, const double &threshold=1e-10) |
| template<typename TR_from, typename TR_to> | |
| void | copy_hcontainer_real_imag_part (const hamilt::HContainer< TR_from > &HR, hamilt::HContainer< TR_to > &HR_real, const bool get_imag) |
| template<typename T> | |
| void | get_DMR_real_imag_part (const module_dm::DensityMatrix< T, T > &DMR, module_dm::DensityMatrix< T, Real< T > > &DMR_real, const char &type='R') |
| template<typename T> | |
| void | get_DMR_real_imag_part (const module_dm::DensityMatrix< T, T > &DMR, module_dm::DensityMatrix< T, Real< T > > &DMR_real, const int &is, const char &type='R') |
| void | set_HR_real_imag_part (const hamilt::HContainer< double > &HR_real, hamilt::HContainer< std::complex< double > > &HR, const char &type) |
| template<typename T, typename TR> | |
| void | initialize_HR (hamilt::HContainer< TR > &hR, const UnitCell &ucell, const Grid_Driver &gd, const std::vector< double > &orb_cutoff) |
| template<typename T, typename TR> | |
| void | initialize_DMR (module_dm::DensityMatrix< T, TR > &dm, const Parallel_Orbitals &pmat, const UnitCell &ucell, const Grid_Driver &gd, const std::vector< double > &orb_cutoff) |
| template<typename TR1, typename TR2> | |
| TR1 | dot_R_matrix (const hamilt::HContainer< TR1 > &h1, const hamilt::HContainer< TR2 > &h2) |
| $\sum_{uvR} H1_{uv}(R) H2_{uv}(R)$ | |
| template<typename TK> | |
| void | transpose_DMR (module_dm::DensityMatrix< TK, double > &dm, const Parallel_Orbitals &pv) |
| template<typename TK> | |
| void | transpose_DMR (module_dm::DensityMatrix< TK, std::complex< double > > &dm, const Parallel_Orbitals &pv) |
| template<typename TK, typename TR> | |
| module_dm::DensityMatrix< TK, TR > | build_dm_from_dmk (const std::vector< ct::Tensor > &dmk, const Parallel_Orbitals &pmat, const int &nk, const std::vector< ModuleBase::Vector3< double > > &kvec_d, const UnitCell &ucell, const Grid_Driver &gd, const std::vector< double > &orb_cutoff, const bool symmetrize=false, const bool cal_dmr=true, const bool transpose=false) |
| template<typename TK, typename TR> | |
| module_dm::DensityMatrix< TK, TR > | build_dm_from_dmk_spin (const std::vector< std::vector< ct::Tensor > > &dmk, const Parallel_Orbitals &pmat, const int &nk, const std::vector< ModuleBase::Vector3< double > > &kvec_d, const UnitCell &ucell, const Grid_Driver &gd, const std::vector< double > &orb_cutoff, const bool symmetrize=false, const bool cal_dmr=true) |
| Spin-resolved counterpart of build_dm_from_dmk: one dmk list per spin channel. | |
| void | print_excitation_energies (std::ostream &log, const double *energies, const int nstates, const std::string &channel) |
| template<typename T> | |
| constexpr T | filter (const T &v, const double &threshold=1e-10) |
| template<typename T> | |
| int | read_value (std::ifstream &ifs, T *ptr, const int &size) |
| template<typename T, typename... Args> | |
| int | read_value (std::ifstream &ifs, T *ptr, const int &size, Args &&... args) |
| template<typename T, typename... Args> | |
| int | read_value (const std::string &file, T *ptr, const int &size, Args &&... args) |
| template<typename T> | |
| int | write_value (std::ofstream &ofs, const T *ptr, const int &size) |
| template<typename T, typename... Args> | |
| int | write_value (std::ofstream &ofs, const T *ptr, const int &size, Args &&... args) |
| template<typename T, typename... Args> | |
| int | write_value (const std::string &file, const int &prec, const T *ptr, const int &size, Args &&... args) |
| template<typename T> | |
| int | print_value (const T *ptr, const int &size) |
| template<typename T, typename... Args> | |
| int | print_value (const T *ptr, const int &size, Args &&... args) |
| template<typename T> | |
| void | print_psi_bandfirst (const psi::Psi< T > &psi, const std::string &label, const int &ib, const double &threshold=1e-10) |
| template<typename T> | |
| void | write_psi_bandfirst (const psi::Psi< T > &psi, const std::string &filename, const int &rank, const double &threshold=1e-10, const int &precision=8) |
| template<typename T> | |
| void | write_psi_bandfirst (const T *psi, const int &nband, const int &nk, const int &nbasis, const std::string &filename, const int &rank, const double &threshold=1e-10, const int &precision=8) |
| template<typename T> | |
| psi::Psi< T > | read_psi_bandfirst (const std::string &filename, const int &rank) |
| template<typename T> | |
| void | print_psi_kfirst (const psi::Psi< T > &psi, const std::string &label, const double &threshold=1e-10) |
| template<typename T> | |
| void | print_tensor (const container::Tensor &t, const std::string &label, const Parallel_Blkcyclic *pmat, const double &threshold=1e-10) |
| template<typename T> | |
| void | print_grid_nonzero (T *rho, const int &nrxx, const int &nnz, const std::string &label, const double &threshold=1e-5) |
| template<typename T> | |
| void | print_CsX (const TLRIX< T > &CsX, const int nvirt, const std::string &label, const double &threshold=1e-10) |
| template<typename T> | |
| void | grad (const T *rhor, ModuleBase::Vector3< T > *gradrho, const ModulePW::PW_Basis &rho_basis, const double &tpiba) |
| template<typename T> | |
| void | grad (const std::vector< T > &rhor, std::vector< ModuleBase::Vector3< T > > &gradrho, const ModulePW::PW_Basis &rho_basis, const double &tpiba) |
| template<typename T> | |
| void | lapl (const T *rhor, T *lapn, const ModulePW::PW_Basis &rho_basis, const double &tpiba2) |
| template<typename T> | |
| void | lapl (const std::vector< T > &rhor, std::vector< T > &lapn, const ModulePW::PW_Basis &rho_basis, const double &tpiba2) |
| void | set_dim (const MO_TYPE type, const int &nocc, const int &nvirt, int &nmo1, int &nmo2, int &imo1, int &imo2) |
| template<typename T> | |
| std::vector< std::complex< double > > | cal_velocity_mo (const UnitCell &ucell, const Grid_Driver &gd, const TwoCenterBundle &two_center_bundle, const Parallel_Orbitals &pmat, const Parallel_Blkcyclic &pc, const K_Vectors &kv, const psi::Psi< T > &psi_ks, const int nk, const int nspin_tmp, const int nbasis, const std::vector< int > nocc, const std::vector< int > nvirt) |
| Compute C^dagger v C for the selected KS window; return replicated spin/cartesian/k blocks. | |
| template std::vector< std::complex< double > > | cal_velocity_mo< double > (const UnitCell &, const Grid_Driver &, const TwoCenterBundle &, const Parallel_Orbitals &, const Parallel_Blkcyclic &, const K_Vectors &, const psi::Psi< double > &, const int, const int, const int, const std::vector< int >, const std::vector< int >) |
| template std::vector< std::complex< double > > | cal_velocity_mo< std::complex< double > > (const UnitCell &, const Grid_Driver &, const TwoCenterBundle &, const Parallel_Orbitals &, const Parallel_Blkcyclic &, const K_Vectors &, const psi::Psi< std::complex< double > > &, const int, const int, const int, const std::vector< int >, const std::vector< int >) |
| void | output_spectrum_mo (const std::vector< std::complex< double > > &out_spectrum_mo, const std::string &filename, const double *const eig_ks, const int nk, const int nspin_tmp, const int KS_num, const K_Vectors &kv) |
| output the velocity matrix in KS presentation in human-read friendly format | |
| void | output_spectrum_mo_librpa (const std::vector< std::complex< double > > &out_spectrum_mo, const std::string &filename, const int nk, const int nspin_tmp, const int nbands, const int nbasis, const int KS_num) |
| output the velocity matrix in KS presentation in LibRPA format | |
| double | spatial_k_weight (const double ks_weight, const int nspin_global) |
| std::vector< double > | spatial_k_weights (const std::vector< double > &ks_weights, const int nspin_global) |
| template<typename T> | |
| std::complex< double > | weighted_velocity_transition (const std::complex< double > &velocity, const T &x, const T &y, const double gap, const bool use_ks_gap, const std::vector< double > &weights, const int spin, const int ik, const int nk) |
| using LR_Util::Complex = std::complex<double> |
| using LR_Util::Real = typename GetTypeReal<T>::type |
| using LR_Util::TAC = std::pair<int, TC> |
| using LR_Util::TC = std::array<int, 3> |
| using LR_Util::TLRIX = std::map<int, std::map<TAC, std::vector<T>>> |
| enum LR_Util::MO_TYPE |
| void LR_Util::_allocate_2order_nested_ptr | ( | T **& | p2, |
| size_t | size1, | ||
| size_t | size2 ) |
new 2d pointer
| T |
| size1 | |
| size2 |
delete 2d pointer
| T |
| p2 | |
| size |
| psi::Psi< T, Device > LR_Util::bfirst_to_k1_wrapper | ( | const psi::Psi< T, Device > & | psi_bfirst | ) |
psi(nb, nk, nbasis) -> psi(nk=1, nbands=nb, nk * nbasis) without memory copy
| module_dm::DensityMatrix< TK, TR > LR_Util::build_dm_from_dmk | ( | const std::vector< ct::Tensor > & | dmk, |
| const Parallel_Orbitals & | pmat, | ||
| const int & | nk, | ||
| const std::vector< ModuleBase::Vector3< double > > & | kvec_d, | ||
| const UnitCell & | ucell, | ||
| const Grid_Driver & | gd, | ||
| const std::vector< double > & | orb_cutoff, | ||
| const bool | symmetrize = false, | ||
| const bool | cal_dmr = true, | ||
| const bool | transpose = false ) |
| module_dm::DensityMatrix< TK, TR > LR_Util::build_dm_from_dmk_spin | ( | const std::vector< std::vector< ct::Tensor > > & | dmk, |
| const Parallel_Orbitals & | pmat, | ||
| const int & | nk, | ||
| const std::vector< ModuleBase::Vector3< double > > & | kvec_d, | ||
| const UnitCell & | ucell, | ||
| const Grid_Driver & | gd, | ||
| const std::vector< double > & | orb_cutoff, | ||
| const bool | symmetrize = false, | ||
| const bool | cal_dmr = true ) |
Spin-resolved counterpart of build_dm_from_dmk: one dmk list per spin channel.
Needed by the open-shell gradient, where $D^X$, $T$, $D^Z$ and the energy-weighted density matrix all have two independent channels. DensityMatrix stores DMK as a flat [nspin][nk] array, so channel is starts at is * nk.
| int LR_Util::cal_nelec | ( | const TCell & | ucell | ) |
calculate the number of electrons
=================PHYSICS====================
| TCell |
| ucell |
| int LR_Util::cal_nocc | ( | double | nelec, |
| int | nspin, | ||
| int | nupdown ) |
Largest occupied spin channel; nelec already includes the charge correction.
| int LR_Util::cal_nocc | ( | int | nelec | ) |
=================PHYSICS====================
calculate the number of occupied orbitals
| nelec |
| int LR_Util::cal_nocc_window | ( | int | requested_nocc, |
| int | nocc_max ) |
Retain a positive user window, otherwise use all occupied orbitals.
| std::vector< std::complex< double > > LR_Util::cal_velocity_mo | ( | const UnitCell & | ucell, |
| const Grid_Driver & | gd, | ||
| const TwoCenterBundle & | two_center_bundle, | ||
| const Parallel_Orbitals & | pmat, | ||
| const Parallel_Blkcyclic & | pc, | ||
| const K_Vectors & | kv, | ||
| const psi::Psi< T > & | psi_ks, | ||
| const int | nk, | ||
| const int | nspin_tmp, | ||
| const int | nbasis, | ||
| const std::vector< int > | nocc, | ||
| const std::vector< int > | nvirt ) |
Compute C^dagger v C for the selected KS window; return replicated spin/cartesian/k blocks.
| template std::vector< std::complex< double > > LR_Util::cal_velocity_mo< double > | ( | const UnitCell & | , |
| const Grid_Driver & | , | ||
| const TwoCenterBundle & | , | ||
| const Parallel_Orbitals & | , | ||
| const Parallel_Blkcyclic & | , | ||
| const K_Vectors & | , | ||
| const psi::Psi< double > & | , | ||
| const int | , | ||
| const int | , | ||
| const int | , | ||
| const std::vector< int > | , | ||
| const std::vector< int > | ) |
| template std::vector< std::complex< double > > LR_Util::cal_velocity_mo< std::complex< double > > | ( | const UnitCell & | , |
| const Grid_Driver & | , | ||
| const TwoCenterBundle & | , | ||
| const Parallel_Orbitals & | , | ||
| const Parallel_Blkcyclic & | , | ||
| const K_Vectors & | , | ||
| const psi::Psi< std::complex< double > > & | , | ||
| const int | , | ||
| const int | , | ||
| const int | , | ||
| const std::vector< int > | , | ||
| const std::vector< int > | ) |
| void LR_Util::check_force_pp | ( | const UnitCell & | cell, |
| const bool | cal_force, | ||
| const std::string & | calculation ) |
Reject unsupported NLCC force requests after pseudopotentials have been loaded.
|
inline |
copy one atom pair's HContainer values from a complex DMR into a real-valued one, by matching atom-pair/R rather than by nat-based index iteration (so it needs no nat).
diagonalize a hermitian matrix
=================diago-lapack====================
| void LR_Util::diag_lapack< double > | ( | const int & | n, |
| double * | mat, | ||
| double * | eig ) |
| void LR_Util::diag_lapack< std::complex< double > > | ( | const int & | n, |
| std::complex< double > * | mat, | ||
| double * | eig ) |
| void LR_Util::diag_lapack_nh | ( | const int & | n, |
| T * | mat, | ||
| std::complex< double > * | eig ) |
diagonalize a general matrix
| void LR_Util::diag_lapack_nh< double > | ( | const int & | n, |
| double * | mat, | ||
| std::complex< double > * | eig ) |
| void LR_Util::diag_lapack_nh< std::complex< double > > | ( | const int & | n, |
| std::complex< double > * | mat, | ||
| std::complex< double > * | eig ) |
| TR1 LR_Util::dot_R_matrix | ( | const hamilt::HContainer< TR1 > & | h1, |
| const hamilt::HContainer< TR2 > & | h2 ) |
$\sum_{uvR} H1_{uv}(R) H2_{uv}(R)$
| std::string LR_Util::force_window_warning | ( | const int | basis_size, |
| const int | gs_bands, | ||
| const int | skipped_occupied, | ||
| const std::vector< int > & | x_virtual, | ||
| const std::vector< int > & | z_virtual ) |
Diagnose resolved force windows without modifying X, Z or their energies.
| void LR_Util::gather_2d_to_full | ( | const Parallel_Blkcyclic & | pv, |
| const T * | submat, | ||
| T * | fullmat, | ||
| const bool | row_major, | ||
| const std::size_t | global_nrow, | ||
| const std::size_t | global_ncol ) |
gather 2d matrix to full matrix the defination of row and col is consistent with setup_2d_division
|
inline |
|
inline |
| void LR_Util::get_DMR_real_imag_part | ( | const module_dm::DensityMatrix< T, T > & | DMR, |
| module_dm::DensityMatrix< T, Real< T > > & | DMR_real, | ||
| const char & | type = 'R' ) |
| void LR_Util::get_DMR_real_imag_part | ( | const module_dm::DensityMatrix< T, T > & | DMR, |
| module_dm::DensityMatrix< T, Real< T > > & | DMR_real, | ||
| const int & | is, | ||
| const char & | type = 'R' ) |
overload: only copy the is-th spin channel of DMR (source) into the (single-channel) DMR_real, to avoid mixing/overlapping spin channels when DMR has more than one spin channel
| psi::Psi< T > LR_Util::get_psi_spin | ( | const psi::Psi< T > & | psi_in, |
| const int & | is, | ||
| const int & | nk ) |
get the Psi wrapper of the selected spin from the Psi object
| void LR_Util::global2local_X | ( | T * | local_X, |
| const T * | global_X, | ||
| const int | nband, | ||
| const int | nk, | ||
| const std::vector< int > & | nocc, | ||
| const std::vector< int > & | nvirt, | ||
| const std::vector< Parallel_Blkcyclic > & | pX, | ||
| const bool | openshell ) |
assign global X to 2d-matrix, its col is band(excition state), and row is { spin, k-point, occ, virt }
| void LR_Util::grad | ( | const std::vector< T > & | rhor, |
| std::vector< ModuleBase::Vector3< T > > & | gradrho, | ||
| const ModulePW::PW_Basis & | rho_basis, | ||
| const double & | tpiba ) |
| void LR_Util::grad | ( | const T * | rhor, |
| ModuleBase::Vector3< T > * | gradrho, | ||
| const ModulePW::PW_Basis & | rho_basis, | ||
| const double & | tpiba ) |
|
inline |
check if the xc functional has local xc kernel
| double LR_Util::hse_sigma_floor | ( | ) |
Existing HSE sigma floor (bohr^-8), shared by LR and the GS fallback.
|
inline |
the xc kernels that carry an exact-exchange (EXX) term
=====================PHYSICS====================
Membership here says only that the kernel has an EXX part, never which Coulomb operator that part uses. The operator is the general range-separated form $v_1(r)=[\alpha+\beta\,\mathrm{erfc}(\mu r)]/r$, and it is built from coulomb_param, which input_conv fills from dft_functional plus exx_fock_alpha ($\alpha$), exx_erfc_alpha ($\beta$) and exx_erfc_omega ($\mu$). Its overall weight reaches this module as exx_info.info_global.hybrid_alpha ($=\max(|\alpha|,|\beta|)$, the factor by which coulomb_param was normalized).
| void LR_Util::initialize_DMR | ( | module_dm::DensityMatrix< T, TR > & | dm, |
| const Parallel_Orbitals & | pmat, | ||
| const UnitCell & | ucell, | ||
| const Grid_Driver & | gd, | ||
| const std::vector< double > & | orb_cutoff ) |
| void LR_Util::initialize_HR | ( | hamilt::HContainer< TR > & | hR, |
| const UnitCell & | ucell, | ||
| const Grid_Driver & | gd, | ||
| const std::vector< double > & | orb_cutoff ) |
|
inline |
=================ALGORITHM====================
|
inline |
| bool LR_Util::is_hermitian | ( | const T * | mat, |
| const Parallel_Blkcyclic & | pmat, | ||
| const double | threshold, | ||
| const int | my_rank ) |
| bool LR_Util::is_symmetric | ( | const T * | mat, |
| const Parallel_Blkcyclic & | pmat, | ||
| const double | threshold, | ||
| const int | my_rank ) |
| psi::Psi< T, Device > LR_Util::k1_to_bfirst_wrapper | ( | const psi::Psi< T, Device > & | psi_kfirst, |
| int | nk_in, | ||
| int | nbasis_in ) |
psi(nk=1, nbands=nb, nk * nbasis) -> psi(nb, nk, nbasis) without memory copy
===================Psi wrapper================= psi(nk=1, nbands=nb, nk * nbasis) -> psi(nb, nk, nbasis) without memory copy
| int LR_Util::lapack_linear_solver | ( | const T * | A, |
| T * | x, | ||
| const T * | b, | ||
| const int | n, | ||
| const int | nrhs ) |
solve linear equations Ax=b using LAPACK
================linear-solver-lapack==============
| int LR_Util::lapack_linear_solver< double > | ( | const double * | A, |
| double * | x, | ||
| const double * | b, | ||
| const int | n, | ||
| const int | nrhs ) |
| int LR_Util::lapack_linear_solver< std::complex< double > > | ( | const std::complex< double > * | A, |
| std::complex< double > * | x, | ||
| const std::complex< double > * | b, | ||
| const int | n, | ||
| const int | nrhs ) |
| void LR_Util::lapl | ( | const std::vector< T > & | rhor, |
| std::vector< T > & | lapn, | ||
| const ModulePW::PW_Basis & | rho_basis, | ||
| const double & | tpiba2 ) |
| void LR_Util::lapl | ( | const T * | rhor, |
| T * | lapn, | ||
| const ModulePW::PW_Basis & | rho_basis, | ||
| const double & | tpiba2 ) |
=================ALGORITHM==================== for lack of make_unique in c++11
| void LR_Util::matantisym | ( | T * | inout, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat ) |
| void LR_Util::matantisym< double > | ( | double * | inout, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat ) |
| void LR_Util::matantisym< std::complex< double > > | ( | std::complex< double > * | inout, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat ) |
| void LR_Util::matsym | ( | const T * | in, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat, | ||
| T * | out ) |
================ BLAS ====================== calculate (A+A^T)/2
calculate (A+A^T)/2 (in-place version)
| void LR_Util::matsym | ( | T * | inout, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat ) |
| void LR_Util::matsym< double > | ( | const double * | in, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat, | ||
| double * | out ) |
=================ALGORITHM====================
| void LR_Util::matsym< double > | ( | double * | inout, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat ) |
| void LR_Util::matsym< std::complex< double > > | ( | const std::complex< double > * | in, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat, | ||
| std::complex< double > * | out ) |
| void LR_Util::matsym< std::complex< double > > | ( | std::complex< double > * | inout, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat ) |
| void LR_Util::mattrans | ( | const T * | in, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat, | ||
| T * | out ) |
| void LR_Util::mattrans | ( | T * | inout, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat ) |
| void LR_Util::mattrans< double > | ( | const double * | in, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat, | ||
| double * | out ) |
| void LR_Util::mattrans< double > | ( | double * | inout, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat ) |
| void LR_Util::mattrans< std::complex< double > > | ( | const std::complex< double > * | in, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat, | ||
| std::complex< double > * | out ) |
| void LR_Util::mattrans< std::complex< double > > | ( | std::complex< double > * | inout, |
| const int | n, | ||
| const Parallel_Blkcyclic & | pmat ) |
|
inline |
| ct::Tensor LR_Util::newTensor | ( | const ct::TensorShape & | shape | ) |
| void LR_Util::output_spectrum_mo | ( | const std::vector< std::complex< double > > & | out_spectrum_mo, |
| const std::string & | filename, | ||
| const double *const | eig_ks, | ||
| const int | nk, | ||
| const int | nspin_tmp, | ||
| const int | KS_num, | ||
| const K_Vectors & | kv ) |
output the velocity matrix in KS presentation in human-read friendly format
| void LR_Util::output_spectrum_mo_librpa | ( | const std::vector< std::complex< double > > & | out_spectrum_mo, |
| const std::string & | filename, | ||
| const int | nk, | ||
| const int | nspin_tmp, | ||
| const int | nbands, | ||
| const int | nbasis, | ||
| const int | KS_num ) |
output the velocity matrix in KS presentation in LibRPA format
| void LR_Util::pA2pX | ( | T * | X_pX, |
| const T * | X_pA, | ||
| const int | nband, | ||
| const int | nk, | ||
| const std::vector< int > & | nocc, | ||
| const std::vector< int > & | nvirt, | ||
| const std::vector< Parallel_Blkcyclic > & | pX, | ||
| const Parallel_Blkcyclic & | pA, | ||
| const int | row_offset, | ||
| const int | col_offset, | ||
| const bool | openshell, | ||
| const int | my_rank, | ||
| const int | nproc ) |
assign X in pA to X in pX
| const std::vector< double > & LR_Util::prepare_xc_sigma | ( | const std::vector< double > & | sigma, |
| const bool | is_hse06, | ||
| std::vector< double > & | hse_buffer ) |
Preserve signed sigma invariants except for the existing HSE06 stabilization.
| const std::vector< double > & LR_Util::prepare_xc_sigma | ( | const std::vector< double > & | sigma, |
| bool | is_hse06, | ||
| std::vector< double > & | hse_buffer, | ||
| std::vector< double > & | jacobian ) |
Prepare stabilized sigma and its componentwise derivative.
| [in] | sigma | LibXC sigma invariants, in bohr^-8, in native spin layout. |
| [in] | is_hse06 | Whether to apply the existing HSE LR stabilization. |
| [out] | hse_buffer | Owned stabilized values; unused for other kernels. |
| [out] | jacobian | Derivatives of stabilized values with respect to raw sigma. Empty means identity; the clipped branch uses zero, including the nondifferentiable junction itself. |
| void LR_Util::print_CsX | ( | const TLRIX< T > & | CsX, |
| const int | nvirt, | ||
| const std::string & | label, | ||
| const double & | threshold = 1e-10 ) |
| void LR_Util::print_DMR | ( | const module_dm::DensityMatrix< TK, TR > & | DMR, |
| const std::string & | label, | ||
| const double & | threshold = 1e-10 ) |
|
inline |
Report selected excitation energies without evaluating optical matrix elements. Match transition_analysis's energy precision so existing energy regressions apply.
| void LR_Util::print_grid_nonzero | ( | T * | rho, |
| const int & | nrxx, | ||
| const int & | nnz, | ||
| const std::string & | label, | ||
| const double & | threshold = 1e-5 ) |
| void LR_Util::print_HR | ( | const hamilt::HContainer< TR > & | HR, |
| const std::string & | label, | ||
| const double & | threshold = 1e-10 ) |
| void LR_Util::print_psi_bandfirst | ( | const psi::Psi< T > & | psi, |
| const std::string & | label, | ||
| const int & | ib, | ||
| const double & | threshold = 1e-10 ) |
| void LR_Util::print_psi_kfirst | ( | const psi::Psi< T > & | psi, |
| const std::string & | label, | ||
| const double & | threshold = 1e-10 ) |
| void LR_Util::print_tensor | ( | const container::Tensor & | t, |
| const std::string & | label, | ||
| const Parallel_Blkcyclic * | pmat, | ||
| const double & | threshold = 1e-10 ) |
| int LR_Util::print_value | ( | const T * | ptr, |
| const int & | size, | ||
| Args &&... | args ) |
| psi::Psi< T > LR_Util::read_psi_bandfirst | ( | const std::string & | filename, |
| const int & | rank ) |
| int LR_Util::read_value | ( | const std::string & | file, |
| T * | ptr, | ||
| const int & | size, | ||
| Args &&... | args ) |
| int LR_Util::read_value | ( | std::ifstream & | ifs, |
| T * | ptr, | ||
| const int & | size, | ||
| Args &&... | args ) |
| template void LR_Util::save_DMR | ( | const module_dm::DensityMatrix< Complex, Complex > & | , |
| const std::string & | , | ||
| const Parallel_Orbitals & | , | ||
| const std::string & | , | ||
| double | , | ||
| std::ostream & | ) |
| template void LR_Util::save_DMR | ( | const module_dm::DensityMatrix< Complex, double > & | , |
| const std::string & | , | ||
| const Parallel_Orbitals & | , | ||
| const std::string & | , | ||
| double | , | ||
| std::ostream & | ) |
| template void LR_Util::save_DMR | ( | const module_dm::DensityMatrix< double, double > & | , |
| const std::string & | , | ||
| const Parallel_Orbitals & | , | ||
| const std::string & | , | ||
| double | , | ||
| std::ostream & | ) |
| void LR_Util::save_DMR | ( | const module_dm::DensityMatrix< TK, TR > & | dm, |
| const std::string & | filename, | ||
| const Parallel_Orbitals & | pv, | ||
| const std::string & | out_dir, | ||
| const double | sparse_thr, | ||
| std::ostream & | running_log ) |
| template void LR_Util::save_HR | ( | const hamilt::HContainer< Complex > & | , |
| const std::string & | , | ||
| const Parallel_Orbitals & | , | ||
| const std::string & | , | ||
| double | , | ||
| std::ostream & | ) |
| template void LR_Util::save_HR | ( | const hamilt::HContainer< double > & | , |
| const std::string & | , | ||
| const Parallel_Orbitals & | , | ||
| const std::string & | , | ||
| double | , | ||
| std::ostream & | ) |
| void LR_Util::save_HR | ( | const hamilt::HContainer< TR > & | hR, |
| const std::string & | filename, | ||
| const Parallel_Orbitals & | pv, | ||
| const std::string & | out_dir, | ||
| const double | sparse_thr, | ||
| std::ostream & | running_log ) |
| void LR_Util::scatter_full_to_2d | ( | const Parallel_Blkcyclic & | pv, |
| const T * | fullmat, | ||
| T * | submat, | ||
| const bool | col_first = false ) |
scatter full matrix to 2d block-cyclic distributed matrix
|
inline |
|
inline |
| std::pair< ModuleBase::matrix, std::vector< std::pair< int, int > > > LR_Util::set_ix_map_diagonal | ( | bool | mode, |
| int | nc, | ||
| int | nv ) |
set the index map: ix to (ic, iv) and vice versa by diagonal traverse the c-v pairs leftdown -> rightup for mode 0, rightup -> leftdown for mode 1
| mode | 0: homo-1 -> lumo first; 1: homo -> lumo+1 first |
| nc | number of occupied bands |
| nv | number of virtual bands |
| void LR_Util::setup_2d_division | ( | Parallel_Blkcyclic & | pv, |
| int | nb, | ||
| int | gr, | ||
| int | gc ) |
=================2D-block Parallel===============
| void LR_Util::setup_2d_division | ( | Parallel_Blkcyclic & | pv, |
| int | nb, | ||
| int | gr, | ||
| int | gc, | ||
| const int & | blacs_ctxt_in ) |
|
inline |
KS weights include a factor two only for nspin=1. Optical singlet amplitudes account for that degeneracy separately through sqrt(2).
|
inline |
Convert KS weights at the LR/spectrum boundary without changing the shared k list. BSE already owns spatial weights and must pass them directly to LR_Spectrum.
| int LR_Util::spin_population_difference | ( | const ModuleBase::matrix & | wg, |
| const int | kpar, | ||
| const int | rank_in_pool ) |
Sum k-point spin populations before rounding; count each pool only once.
| std::string LR_Util::tolower | ( | const std::string & | str | ) |
=================string option====================
| std::string LR_Util::toupper | ( | const std::string & | str | ) |
| void LR_Util::transpose_DMR | ( | module_dm::DensityMatrix< TK, double > & | dm, |
| const Parallel_Orbitals & | pv ) |
| void LR_Util::transpose_DMR | ( | module_dm::DensityMatrix< TK, std::complex< double > > & | dm, |
| const Parallel_Orbitals & | pv ) |
|
inline |
One production velocity-gauge transition, before the common i/omega and singlet factors. Spatial weights are indexed by response spin and k point.
| void LR_Util::write_psi_bandfirst | ( | const psi::Psi< T > & | psi, |
| const std::string & | filename, | ||
| const int & | rank, | ||
| const double & | threshold = 1e-10, | ||
| const int & | precision = 8 ) |
| void LR_Util::write_psi_bandfirst | ( | const T * | psi, |
| const int & | nband, | ||
| const int & | nk, | ||
| const int & | nbasis, | ||
| const std::string & | filename, | ||
| const int & | rank, | ||
| const double & | threshold = 1e-10, | ||
| const int & | precision = 8 ) |
| int LR_Util::write_value | ( | const std::string & | file, |
| const int & | prec, | ||
| const T * | ptr, | ||
| const int & | size, | ||
| Args &&... | args ) |
| int LR_Util::write_value | ( | std::ofstream & | ofs, |
| const T * | ptr, | ||
| const int & | size ) |