ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
LR Namespace Reference

Namespaces

namespace  HSolver
namespace  libxc_idx

Classes

struct  GradientInputs
struct  JTDirection
 The outcome of the Jahn-Teller search: the displacement direction that lowers one branch of the multiplet fastest, and the electronic state that follows it. More...
struct  WindowResponse
class  HamiltLR
class  HamiltULR
class  Z_vector_L
class  Z_vector_UL
 Open-shell (spin-unrestricted) counterpart of Z_vector_L. More...
class  Z_vector_R
class  Z_vector_UR
 Open-shell (spin-unrestricted) counterpart of Z_vector_R. More...
class  ZeqULR
 Common skeleton of the open-shell (spin-unrestricted) Z-vector operators. More...
struct  KernelPotentials
 Own the LR spin potentials and the shared coefficient set prepared for this geometry. More...
class  LR_Density
struct  ForceSettings
 Force-term switches and functional name, owned by the caller's resolved INPUT. More...
class  LR_Force
class  LR_Spectrum
class  OperatorGxcULR
 The open-shell $g^{xc}$ term, i.e. $\sum_{\kappa\lambda\sigma'}\sum_{\alpha\beta\sigma''}D^X_{\sigma'}D^X_{\sigma''} g^{xc}_{\kappa\lambda\sigma',\alpha\beta\sigma'',pq\tau}$ projected onto the MO block selected by mo_type (VO for the Z-vector right-hand side, OO for $W^c$). More...
class  OperatorLRDiag
 Diag part of A operator: [AX]_iak = (e_ak - e_ik) X_iak. More...
class  OperatorLRHxc
 Hxc part of A operator for LR-TDDFT. More...
class  PotGradXCLR
class  PotHxcLR
class  PotLRBase
class  KernelXC
 Calculate the exchange-correlation (XC) kernel ($f_{xc}=\delta^2E_xc/\delta\rho^2$) and store its components. More...
struct  GroupMatch
struct  RootBasis
struct  RootInputs
class  OperatorLREXX

Typedefs

template<typename T>
using Real = typename GetTypeReal<T>::type
using Vec3 = ModuleBase::Vector3<double>

Functions

template<typename T>
void ao_to_mo_forloop_serial (const std::vector< container::Tensor > &mat_ao, const psi::Psi< T > &coeff, const int &nocc, const int &nvirt, T *const mat_mo, const LR_Util::MO_TYPE type, const T factor)
template<typename T>
void ao_to_mo_blas (const std::vector< container::Tensor > &mat_ao, const psi::Psi< T > &coeff, const int &nocc, const int &nvirt, T *const mat_mo, const bool add_on, const LR_Util::MO_TYPE type, const T factor)
template<typename T>
void ao_to_mo_pblas (const std::vector< container::Tensor > &mat_ao, const Parallel_Blkcyclic &pmat_ao, const psi::Psi< T > &coeff, const Parallel_Blkcyclic &pcoeff, const int &naos, const int &nocc, const int &nvirt, const Parallel_Blkcyclic &pmat_mo, T *const mat_mo, const bool add_on, const LR_Util::MO_TYPE type, const T factor)
template<>
void ao_to_mo_pblas (const std::vector< container::Tensor > &mat_ao, const Parallel_Blkcyclic &pmat_ao, const psi::Psi< double > &coeff, const Parallel_Blkcyclic &pcoeff, const int &naos, const int &nocc, const int &nvirt, const Parallel_Blkcyclic &pmat_mo, double *mat_mo, const bool add_on, const LR_Util::MO_TYPE type, const double factor)
template<>
void ao_to_mo_pblas (const std::vector< container::Tensor > &mat_ao, const Parallel_Blkcyclic &pmat_ao, const psi::Psi< std::complex< double > > &coeff, const Parallel_Blkcyclic &pcoeff, const int &naos, const int &nocc, const int &nvirt, const Parallel_Blkcyclic &pmat_mo, std::complex< double > *const mat_mo, const bool add_on, const LR_Util::MO_TYPE type, const std::complex< double > factor)
template<>
void ao_to_mo_forloop_serial (const std::vector< container::Tensor > &mat_ao, const psi::Psi< double > &coeff, const int &nocc, const int &nvirt, double *mat_mo, const LR_Util::MO_TYPE type, const double factor)
template<>
void ao_to_mo_forloop_serial (const std::vector< container::Tensor > &mat_ao, const psi::Psi< std::complex< double > > &coeff, const int &nocc, const int &nvirt, std::complex< double > *const mat_mo, const LR_Util::MO_TYPE type, const std::complex< double > factor)
template<>
void ao_to_mo_blas (const std::vector< container::Tensor > &mat_ao, const psi::Psi< double > &coeff, const int &nocc, const int &nvirt, double *mat_mo, const bool add_on, const LR_Util::MO_TYPE type, const double factor)
template<>
void ao_to_mo_blas (const std::vector< container::Tensor > &mat_ao, const psi::Psi< std::complex< double > > &coeff, const int &nocc, const int &nvirt, std::complex< double > *const mat_mo, const bool add_on, const LR_Util::MO_TYPE type, const std::complex< double > factor)
template<typename T>
void CVCX_occ_forloop_serial (const std::vector< container::Tensor > &V_istate, const psi::Psi< T, base_device::DEVICE_CPU > &c, const T *const X_istate, const int &naos, const int &nocc, const int &nvirt, T *const AX_istate)
 $\sum_{k\mu\nu}C^*_{\mu i}K_{\mu\nu}C_{\nu k}X_{ak}^*$
template<typename T>
void CVCX_occ_blas (const std::vector< container::Tensor > &V_istate, const psi::Psi< T, base_device::DEVICE_CPU > &c, const T *const X_istate, const int &naos, const int &nocc, const int &nvirt, T *const AX_istate, const bool add_on=true, const T factor=(T) 1.0)
template<typename T>
void CVCX_occ_pblas (const std::vector< container::Tensor > &V_istate, const Parallel_Blkcyclic &pmat, const psi::Psi< T, base_device::DEVICE_CPU > &c, const Parallel_Blkcyclic &pc, const T *const X_istate, const Parallel_Blkcyclic &px, const int &naos, const int &nocc, const int &nvirt, T *const AX_istate, const bool add_on=true, const T factor=(T) 1.0)
template<typename T>
void CVCX_virt_forloop_serial (const std::vector< container::Tensor > &V_istate, const psi::Psi< T, base_device::DEVICE_CPU > &c, const T *const X_istate, const int &naos, const int &nocc, const int &nvirt, T *const AX_istate)
 $\sum_{b\mu\nu}X^*_{bi}C^*_{\mu b}K_{\mu\nu}C_{\nu a}$
template<typename T>
void CVCX_virt_blas (const std::vector< container::Tensor > &V_istate, const psi::Psi< T, base_device::DEVICE_CPU > &c, const T *const X_istate, const int &naos, const int &nocc, const int &nvirt, T *const AX_istate, const bool add_on=true, const T factor=(T) 1.0)
template<typename T>
void CVCX_virt_pblas (const std::vector< container::Tensor > &V_istate, const Parallel_Blkcyclic &pmat, const psi::Psi< T, base_device::DEVICE_CPU > &c, const Parallel_Blkcyclic &pc, const T *const X_istate, const Parallel_Blkcyclic &px, const int &naos, const int &nocc, const int &nvirt, T *const AX_istate, const bool add_on=true, const T factor=(T) 1.0)
template<>
void CVCX_occ_pblas (const std::vector< container::Tensor > &V_istate, const Parallel_Blkcyclic &pmat, const psi::Psi< double, base_device::DEVICE_CPU > &c, const Parallel_Blkcyclic &pc, const double *const X_istate, const Parallel_Blkcyclic &px, const int &naos, const int &nocc, const int &nvirt, double *const AX_istate, const bool add_on, const double factor)
template<>
void CVCX_occ_pblas (const std::vector< container::Tensor > &V_istate, const Parallel_Blkcyclic &pmat, const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > &c, const Parallel_Blkcyclic &pc, const std::complex< double > *const X_istate, const Parallel_Blkcyclic &px, const int &naos, const int &nocc, const int &nvirt, std::complex< double > *const AX_istate, const bool add_on, const std::complex< double > factor)
template<>
void CVCX_virt_pblas (const std::vector< container::Tensor > &V_istate, const Parallel_Blkcyclic &pmat, const psi::Psi< double, base_device::DEVICE_CPU > &c, const Parallel_Blkcyclic &pc, const double *const X_istate, const Parallel_Blkcyclic &px, const int &naos, const int &nocc, const int &nvirt, double *const AX_istate, const bool add_on, const double factor)
template<>
void CVCX_virt_pblas (const std::vector< container::Tensor > &V_istate, const Parallel_Blkcyclic &pmat, const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > &c, const Parallel_Blkcyclic &pc, const std::complex< double > *const X_istate, const Parallel_Blkcyclic &px, const int &naos, const int &nocc, const int &nvirt, std::complex< double > *const AX_istate, const bool add_on, const std::complex< double > factor)
template<>
void CVCX_occ_forloop_serial (const std::vector< container::Tensor > &V_istate, const psi::Psi< double, base_device::DEVICE_CPU > &c, const double *const X_istate, const int &naos, const int &nocc, const int &nvirt, double *const AX_istate)
template<>
void CVCX_occ_forloop_serial (const std::vector< container::Tensor > &V_istate, const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > &c, const std::complex< double > *const X_istate, const int &naos, const int &nocc, const int &nvirt, std::complex< double > *const AX_istate)
template<>
void CVCX_occ_blas (const std::vector< container::Tensor > &V_istate, const psi::Psi< double, base_device::DEVICE_CPU > &c, const double *const X_istate, const int &naos, const int &nocc, const int &nvirt, double *const AX_istate, const bool add_on, const double factor)
template<>
void CVCX_occ_blas (const std::vector< container::Tensor > &V_istate, const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > &c, const std::complex< double > *const X_istate, const int &naos, const int &nocc, const int &nvirt, std::complex< double > *const AX_istate, const bool add_on, const std::complex< double > factor)
template<>
void CVCX_virt_forloop_serial (const std::vector< container::Tensor > &V_istate, const psi::Psi< double, base_device::DEVICE_CPU > &c, const double *const X_istate, const int &naos, const int &nocc, const int &nvirt, double *const AX_istate)
template<>
void CVCX_virt_forloop_serial (const std::vector< container::Tensor > &V_istate, const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > &c, const std::complex< double > *const X_istate, const int &naos, const int &nocc, const int &nvirt, std::complex< double > *const AX_istate)
template<>
void CVCX_virt_blas (const std::vector< container::Tensor > &V_istate, const psi::Psi< double, base_device::DEVICE_CPU > &c, const double *const X_istate, const int &naos, const int &nocc, const int &nvirt, double *const AX_istate, const bool add_on, const double factor)
template<>
void CVCX_virt_blas (const std::vector< container::Tensor > &V_istate, const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > &c, const std::complex< double > *const X_istate, const int &naos, const int &nocc, const int &nvirt, std::complex< double > *const AX_istate, const bool add_on, const std::complex< double > factor)
template<typename T>
void cal_X_ao_occ (const T *const X, const Parallel_Blkcyclic &px, const T *const c, const Parallel_Blkcyclic &pc, T *const X_ao_occ, const Parallel_Blkcyclic &px_ao_occ)
template<typename T>
void matdot (const T *const vec1, const T *const vec2, const Parallel_Blkcyclic &pvec, T *const dm, const Parallel_Blkcyclic &pmat)
template void cal_X_ao_occ< double > (const double *, const Parallel_Blkcyclic &, const double *, const Parallel_Blkcyclic &, double *, const Parallel_Blkcyclic &)
template void cal_X_ao_occ< std::complex< double > > (const std::complex< double > *, const Parallel_Blkcyclic &, const std::complex< double > *, const Parallel_Blkcyclic &, std::complex< double > *, const Parallel_Blkcyclic &)
template void matdot< double > (const double *, const double *, const Parallel_Blkcyclic &, double *, const Parallel_Blkcyclic &)
template void matdot< std::complex< double > > (const std::complex< double > *, const std::complex< double > *, const Parallel_Blkcyclic &, std::complex< double > *, const Parallel_Blkcyclic &)
template<typename T>
void multiply_eig_onto_vec (const T *const vec, const double *const eig, const Parallel_Blkcyclic &pvec, T *const evec)
template<typename T>
ct::Tensor cal_edm_single_kpoint (const T *const vec, const Parallel_Blkcyclic &pvec, const double *eig, const Parallel_Blkcyclic &pmat)
template<typename T>
std::vector< ct::Tensor > cal_edm_term4 (const T *X, const double eig_ext_istate, const double *const eig_ks, const psi::Psi< T > &c, const Parallel_Blkcyclic &px, const Parallel_Blkcyclic &pc, const Parallel_Orbitals &pmat)
template<typename T>
std::vector< ct::Tensor > cal_edm_terms_from_XZWK (const T *const X, const T *const Z, const T *const W, const T *const K_cvcx, const double eig_ext_istate, const double *const eig_ks, const psi::Psi< T > &c, const int nspin, const bool test_force, const Parallel_Blkcyclic &p_occ_occ, const Parallel_Blkcyclic &p_virt_occ, const Parallel_Blkcyclic &pc, const Parallel_Orbitals &pmat)
template<typename T>
std::vector< ct::Tensor > cal_edm_from_XZ_istate (const GradientInputs< T > &inputs, const T *const X, const T *const Z, const double eig_ext_istate, const double *const eig_ks, module_dm::DensityMatrix< T, T > &dm_trans, const psi::Psi< T > &c, std::weak_ptr< PotHxcLR > pot, const std::string &spin_type, const std::vector< ct::Tensor > &relaxed_density)
template<typename T>
std::vector< std::vector< ct::Tensor > > cal_edm_from_XZ_istate_openshell (const GradientInputs< T > &inputs, const T *const X, const T *const Z, const double eig_ext_istate, const double *const eig_ks, const module_dm::DensityMatrix< T, T > &dm_trans, std::weak_ptr< PotHxcLR > pot, const std::vector< std::vector< ct::Tensor > > &relaxed_density)
 Open-shell (spin-unrestricted) counterpart of cal_edm_from_XZ_istate. Returns the energy-weighted density matrix of each spin channel: [is][ik].
template<typename T>
void add_ediff_term (T *const inout, const T *const X, const double eig_ext_istate, const double *const eig_ks, const int nk, const int nocc, const int nvirt, const Parallel_Blkcyclic &px, const Parallel_Blkcyclic &p_occ_occ)
template<typename T>
void cal_W_from_Z (const GradientInputs< T > &inputs, T *const W, const std::vector< ct::Tensor > &relaxed_density, const T *const X, const double eig, const double *const eig_ks, const psi::Psi< T > &psi_ks, const std::vector< Parallel_Blkcyclic > &p_occ_occ, const std::string &spin_type="singlet")
template<typename T>
void cal_W_from_Z_openshell (const GradientInputs< T > &inputs, std::vector< std::vector< T > > &W, const std::vector< std::vector< ct::Tensor > > &relaxed_density, const T *const X, const double eig, const double *const eig_ks, const std::vector< Parallel_Blkcyclic > &p_occ_occ)
 Open-shell (spin-unrestricted) counterpart of cal_W_from_Z.
void CvX (const double *C, const double *X, const int &naos, const int &nocc, const int &nvirt, double *CvX)
 Orbital-amplitude contractions C_v X and C_o X^T, shared with the EXX operator.
void CvX (const std::complex< double > *C, const std::complex< double > *X, const int &naos, const int &nocc, const int &nvirt, std::complex< double > *CvX)
void CoXT (const double *C, const double *X, const int &naos, const int &nocc, const int &nvirt, double *CoXT)
void CoXT (const std::complex< double > *C, const std::complex< double > *X, const int &naos, const int &nocc, const int &nvirt, std::complex< double > *CoXT)
void CvX (const double *C, const Parallel_Blkcyclic &pc, const double *X, const Parallel_Blkcyclic &px, const int &naos, const int &nocc, const int &nvirt, double *CvX, const Parallel_Blkcyclic &pcx)
void CvX (const std::complex< double > *C, const Parallel_Blkcyclic &pc, const std::complex< double > *X, const Parallel_Blkcyclic &px, const int &naos, const int &nocc, const int &nvirt, std::complex< double > *CvX, const Parallel_Blkcyclic &pcx)
void CoXT (const double *C, const Parallel_Blkcyclic &pc, const double *X, const Parallel_Blkcyclic &px, const int &naos, const int &nocc, const int &nvirt, double *CoXT, const Parallel_Blkcyclic &pcxt)
void CoXT (const std::complex< double > *C, const Parallel_Blkcyclic &pc, const std::complex< double > *X, const Parallel_Blkcyclic &px, const int &naos, const int &nocc, const int &nvirt, std::complex< double > *CoXT, const Parallel_Blkcyclic &pcxt)
template<typename T>
std::vector< container::Tensor > cal_dm_diff_pblas (const T *const X_istate, const Parallel_Blkcyclic &px, const psi::Psi< T, base_device::DEVICE_CPU > &c, const Parallel_Blkcyclic &pc, const int &naos, const int &nocc, const int &nvirt, const Parallel_Blkcyclic &pmat, const bool renorm_k=true, const int nspin=1)
 calculate the 2d-block difference density matrix in AO basis using p?gemm
template<typename T>
std::vector< container::Tensor > cal_dm_diff_blas (const T *const X_istate, const psi::Psi< T, base_device::DEVICE_CPU > &c, const int &naos, const int &nocc, const int &nvirt, const bool renorm_k=true, const int nspin=1)
 calculate the 2d-block transition density matrix in AO basis using ?gemm
template<typename T>
std::vector< container::Tensor > cal_dm_diff_forloop (const T *const X_istate, const psi::Psi< T, base_device::DEVICE_CPU > &c, const int &naos, const int &nocc, const int &nvirt, const bool renorm_k=true, const int nspin=1)
 calculate the 2d-block transition density matrix in AO basis using for loop (for test)
void AAT (const double *A, const Parallel_Blkcyclic &pa, const int &nrow, const int &ncol, double *C, const Parallel_Blkcyclic &pc, const bool add=false, const double &alpha=1.0)
void AAT (const std::complex< double > *A, const Parallel_Blkcyclic &pa, const int &nrow, const int &ncol, std::complex< double > *C, const Parallel_Blkcyclic &pc, const bool add=false, const std::complex< double > &alpha=std::complex< double >(1.0, 0.0))
template<typename T>
std::vector< ct::Tensor > cal_dm_diff_pblas (const T *const X_istate, const Parallel_Blkcyclic &px, const psi::Psi< T, base_device::DEVICE_CPU > &c, const Parallel_Blkcyclic &pc, const int &naos, const int &nocc, const int &nvirt, const Parallel_Blkcyclic &pmat, const bool renorm_k, const int nspin)
 calculate the 2d-block difference density matrix in AO basis using p?gemm
template std::vector< container::Tensor > cal_dm_diff_pblas< double > (const double *const, const Parallel_Blkcyclic &, const psi::Psi< double, base_device::DEVICE_CPU > &, const Parallel_Blkcyclic &, const int &, const int &, const int &, const Parallel_Blkcyclic &, const bool, const int)
template std::vector< container::Tensor > cal_dm_diff_pblas< std::complex< double > > (const std::complex< double > *const, const Parallel_Blkcyclic &, const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > &, const Parallel_Blkcyclic &, const int &, const int &, const int &, const Parallel_Blkcyclic &, const bool, const int)
template<typename T>
void print_colfirst (const T *ptr, const std::string &name, const int &nrow, const int &ncol)
void AAT (const double *A, const int &nrow, const int &ncol, double *C, const bool add=false, const double &alpha=1.0)
void AAT (const std::complex< double > *A, const int &nrow, const int &ncol, std::complex< double > *C, const bool add=false, const std::complex< double > &alpha=std::complex< double >(1.0, 0.0))
template<typename T>
std::vector< ct::Tensor > cal_dm_diff_blas (const T *const X_istate, const psi::Psi< T, base_device::DEVICE_CPU > &c, const int &naos, const int &nocc, const int &nvirt, const bool renorm_k, const int nspin)
 calculate the 2d-block transition density matrix in AO basis using ?gemm
double get_conj (const double &x)
std::complex< double > get_conj (const std::complex< double > &x)
template<typename T>
std::vector< ct::Tensor > cal_dm_diff_forloop (const T *const X_istate, const psi::Psi< T, base_device::DEVICE_CPU > &c, const int &naos, const int &nocc, const int &nvirt, const bool renorm_k, const int nspin)
 calculate the 2d-block transition density matrix in AO basis using for loop (for test)
template std::vector< container::Tensor > cal_dm_diff_blas< double > (const double *const, const psi::Psi< double, base_device::DEVICE_CPU > &, const int &, const int &, const int &, const bool, const int)
template std::vector< container::Tensor > cal_dm_diff_forloop< double > (const double *const, const psi::Psi< double, base_device::DEVICE_CPU > &, const int &, const int &, const int &, const bool, const int)
template std::vector< container::Tensor > cal_dm_diff_blas< std::complex< double > > (const std::complex< double > *const, const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > &, const int &, const int &, const int &, const bool, const int)
template std::vector< container::Tensor > cal_dm_diff_forloop< std::complex< double > > (const std::complex< double > *const, const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > &, const int &, const int &, const int &, const bool, const int)
template<typename T>
std::vector< container::Tensor > cal_dm_trans_pblas (const T *const X_istate, const Parallel_Blkcyclic &px, const psi::Psi< T > &c, const Parallel_Blkcyclic &pc, const int naos, const int nocc, const int nvirt, const Parallel_Blkcyclic &pmat, const T factor=(T) 1.0, const LR_Util::MO_TYPE type=LR_Util::MO_TYPE::VO)
 calculate the 2d-block transition density matrix in AO basis using p?gemm
template<typename T>
std::vector< container::Tensor > cal_dm_trans_blas (const T *const X_istate, const psi::Psi< T > &c, const int &nocc, const int &nvirt, const T factor=(T) 1.0, const LR_Util::MO_TYPE type=LR_Util::MO_TYPE::VO)
 calculate the 2d-block transition density matrix in AO basis using ?gemm
template<typename T>
std::vector< container::Tensor > cal_dm_trans_forloop_serial (const T *const X_istate, const psi::Psi< T > &c, const int &nocc, const int &nvirt, const T factor=(T) 1.0, const LR_Util::MO_TYPE type=LR_Util::MO_TYPE::VO)
 calculate the 2d-block transition density matrix in AO basis using for loop (for test)
template<>
std::vector< container::Tensor > cal_dm_trans_pblas (const double *const X_istate, const Parallel_Blkcyclic &px, const psi::Psi< double > &c, const Parallel_Blkcyclic &pc, const int naos, const int nocc, const int nvirt, const Parallel_Blkcyclic &pmat, const double factor, const LR_Util::MO_TYPE type)
template<>
std::vector< container::Tensor > cal_dm_trans_pblas (const std::complex< double > *const X_istate, const Parallel_Blkcyclic &px, const psi::Psi< std::complex< double > > &c, const Parallel_Blkcyclic &pc, const int naos, const int nocc, const int nvirt, const Parallel_Blkcyclic &pmat, const std::complex< double > factor, const LR_Util::MO_TYPE type)
template<>
std::vector< container::Tensor > cal_dm_trans_forloop_serial (const double *const X_istate, const psi::Psi< double > &c, const int &nocc, const int &nvirt, const double factor, const LR_Util::MO_TYPE type)
template<>
std::vector< container::Tensor > cal_dm_trans_forloop_serial (const std::complex< double > *const X_istate, const psi::Psi< std::complex< double > > &c, const int &nocc, const int &nvirt, const std::complex< double > factor, const LR_Util::MO_TYPE type)
template<>
std::vector< container::Tensor > cal_dm_trans_blas (const double *const X_istate, const psi::Psi< double > &c, const int &nocc, const int &nvirt, const double factor, const LR_Util::MO_TYPE type)
template<>
std::vector< container::Tensor > cal_dm_trans_blas (const std::complex< double > *const X_istate, const psi::Psi< std::complex< double > > &c, const int &nocc, const int &nvirt, const std::complex< double > factor, const LR_Util::MO_TYPE type)
void project_exx (const double *h, const double *left, const double *right, const int naos, const int nleft, const int nright, const double factor, double *scratch, double *result)
void project_exx (const std::complex< double > *h, const std::complex< double > *left, const std::complex< double > *right, const int naos, const int nleft, const int nright, const double factor, std::complex< double > *scratch, std::complex< double > *result)
std::vector< std::vector< int > > group_degenerate_states (const std::vector< double > &omega, const double thr)
 Split states into multiplets of (near-)degenerate excitation energies.
std::vector< std::pair< int, int > > degenerate_pairs (const int d)
 The $(k,l)$, $k<l$ pairs of a $d$-dimensional multiplet, lexicographically.
template<typename T>
void combine_normalized (const T *const Xk, const T *const Xl, const size_t nloc, T *const Xplus)
 $X_+=(X_k+X_l)/\sqrt2$, normalized when $X_k$ and $X_l$ are orthonormal.
template<typename TMat>
std::vector< std::vector< TMat > > assemble_grad_matrix (const std::vector< TMat > &diag, const std::vector< TMat > &plus, const std::vector< std::pair< int, int > > &pairs)
 Assemble $G_{kl}$ of one multiplet from the diagonal gradients and the combinations, i.e. route (A2) above.
JTDirection find_jt_direction (const std::vector< double > &gflat, const int ncoord, const int d)
 Find the Jahn-Teller direction: the displacement that splits the multiplet and lowers one branch as fast as possible.
std::vector< double > split_symmetric_part (const std::vector< double > &gflat, const int ncoord, const int d, const std::vector< double > &mixing, std::vector< double > &jt_part)
 Split a branch gradient into the part shared by the whole multiplet and the part that actually breaks the degeneracy.
template<typename T>
void test_dm_diff_H2 (const T *dm, const psi::Psi< T > &c, const int nbasis)
template<typename T>
void test_edm_H2 (const T *const edm, const double *const eig_ks, const psi::Psi< T > &c, const int nbasis)
template<typename T>
std::vector< ModuleBase::matrix > evaluate_closed_shell_force (const GradientInputs< T > &inputs, LR_Force< T > &force_terms, const module_dm::DensityMatrix< T, double > &dm_gs, const ct::Tensor &Xz, const ct::Tensor &Z, const std::vector< double > &omega, int label_begin, int ispin, const WindowResponse< T > &window)
template<typename T>
std::vector< ModuleBase::matrix > evaluate_open_shell_force (const GradientInputs< T > &inputs, LR_Force< T > &force_terms, const module_dm::DensityMatrix< T, double > &dm_gs, const ct::Tensor &Xz, const ct::Tensor &Z, const std::vector< double > &omega, int label_begin, const WindowResponse< T > &window)
void print_lr_force (const std::vector< ModuleBase::matrix > &force, std::ostream &ofs, const int istate_begin)
ModuleBase::matrix average_forces (const std::vector< ModuleBase::matrix > &f)
 The mean of a set of force matrices.
void print_grad_matrix (const std::vector< std::vector< ModuleBase::matrix > > &g, const std::vector< int > &group, const UnitCell &ucell, std::ofstream &ofs)
 Print the degenerate-subspace gradient matrix $G_{kl}$, one $d\times d$ block per nuclear coordinate, plus the multiplet average on its diagonal.
void setup_nonlocal_info (LCAO_Orbitals &, UnitCell &, const Input_para &, int, std::ofstream &)
 Initialize nonlocal projector metadata used by neighbor searches, independently of optical output.
void setup_2center_table (TwoCenterBundle &, UnitCell &, const Input_para &)
 Build beta integrals and tabulate two-center integrals after setup_nonlocal_info.
void check_lr_parameters (const Input_para &, const std::string &xc_kernel, int nspin)
 Validate LR solver, functional, spin count and optical gauge without global input access.
KernelPotentials prepare_lr_potentials (const Input_para &input, const std::string &xc_kernel, const ModulePW::PW_Basis &rho_basis, const UnitCell &ucell, const Charge &chg_gs, const Parallel_Grid &grid, const int nspin, const bool openshell)
std::shared_ptr< PotHxcLR > prepare_gs_potential (const Input_para &, const std::string &xc_kernel, const ModulePW::PW_Basis &, const UnitCell &, const Charge &, const Parallel_Grid &, int nspin, bool openshell, const KernelPotentials &)
 Reuse LR coefficients for an identical GS functional and sufficient derivative order.
int electron_hole_offset (const int state, const int nk, const int up_size, const int down_size, const int ispin, const bool openshell)
template<typename T>
void save_mixed_root (const T *Xall, const int n, const std::vector< int > &group, const std::vector< double > &mixing, std::vector< T > &previous)
template<typename T>
void follow_root (const T *Xall, const int n, const int nstates, const int initial_state, int &target_state, std::vector< T > &previous, std::ostream &ofs)
template<typename T>
ct::Tensor pad_amplitudes (const std::vector< ct::Tensor > &X, const bool openshell, const std::vector< Parallel_Blkcyclic > &px, const std::vector< Parallel_Blkcyclic > &px_z, const std::vector< int > &nocc, const std::vector< int > &nvirt, const int nk, const int nloc, const int nloc_z, const int ispin, const int istate_begin, const int nst)
template<typename TK>
bool is_openshell_dm (const module_dm::DensityMatrix< TK, double > &dm)
double gs_dm_channel_factor (const int &nspin)
template std::vector< ModuleBase::matrix > evaluate_closed_shell_force< double > (const GradientInputs< double > &, LR_Force< double > &, const module_dm::DensityMatrix< double, double > &, const ct::Tensor &, const ct::Tensor &, const std::vector< double > &, int, int, const WindowResponse< double > &)
template std::vector< ModuleBase::matrix > evaluate_closed_shell_force< std::complex< double > > (const GradientInputs< std::complex< double > > &, LR_Force< std::complex< double > > &, const module_dm::DensityMatrix< std::complex< double >, double > &, const ct::Tensor &, const ct::Tensor &, const std::vector< double > &, int, int, const WindowResponse< std::complex< double > > &)
template std::vector< ModuleBase::matrix > evaluate_open_shell_force< double > (const GradientInputs< double > &, LR_Force< double > &, const module_dm::DensityMatrix< double, double > &, const ct::Tensor &, const ct::Tensor &, const std::vector< double > &, int, const WindowResponse< double > &)
template std::vector< ModuleBase::matrix > evaluate_open_shell_force< std::complex< double > > (const GradientInputs< std::complex< double > > &, LR_Force< std::complex< double > > &, const module_dm::DensityMatrix< std::complex< double >, double > &, const ct::Tensor &, const ct::Tensor &, const std::vector< double > &, int, const WindowResponse< std::complex< double > > &)
Velocity_op< std::complex< double > > get_velocity_matrix_R (const UnitCell &ucell, const Grid_Driver &gd, const Parallel_Orbitals &pmat, const TwoCenterBundle &two_center_bundle)
 get the velocity matrix v(R)
double lorentz_delta (const double dfreq_au, const double eta_au)
double gauss_delta (const double dfreq_au, const double eta_au)
template<typename T>
ModuleBase::Vector3< T > convert_vector_to_vector3 (const std::vector< std::complex< double > > &vec)
template<>
ModuleBase::Vector3< double > convert_vector_to_vector3 (const std::vector< std::complex< double > > &vec)
template<>
ModuleBase::Vector3< std::complex< double > > convert_vector_to_vector3 (const std::vector< std::complex< double > > &vec)
template<typename T>
ModuleBase::Vector3< T > convert_ptr_to_vector3 (const std::complex< double > *ptr)
template<>
ModuleBase::Vector3< double > convert_ptr_to_vector3< double > (const std::complex< double > *ptr)
template<>
ModuleBase::Vector3< std::complex< double > > convert_ptr_to_vector3< std::complex< double > > (const std::complex< double > *ptr)
void cal_eig_ks_diff (double *const eig_ks_diff, const double *const eig_ks, const Parallel_Blkcyclic &px, const int nk, const int nocc, const int nvirt)
template<typename T>
void act_with_shared_density (hamilt::Operator< T > *node, const int nbasis, const T *psi_in, T *hpsi, typename OperatorLRHxc< T >::TransitionDensityCache &density_cache)
double sigma_potential_derivative (const double *rho_sigma, const double *sigma_sigma, const int channel, const double *density_response, const double *sigma_response, const int first_spin, const int end_spin)
std::shared_ptr< const KernelXC > build_xc_kernel (const std::string &kernel_name, const ModulePW::PW_Basis &rho_basis, const UnitCell &ucell, const Charge &chg_gs, const Parallel_Grid &pgrid, const int nspin, const bool openshell, const int gxc_spin, const std::vector< std::string > &lr_init_xc_kernel)
std::shared_ptr< const KernelXC > build_gs_xc_kernel (const std::string &kernel_name, const ModulePW::PW_Basis &rho_basis, const UnitCell &ucell, const Charge &chg_gs, const Parallel_Grid &pgrid, int nspin, bool openshell, const std::vector< std::string > &lr_init_xc_kernel)
GroupMatch match_state_group (const std::vector< std::complex< double > > &overlap, const int old_dimension, const int nstates, const std::vector< std::vector< int > > &groups, const std::vector< double > &reference_overlap, const bool reference_first)
std::vector< ModuleBase::Vector3< int > > cross_image_indices (const ModuleBase::Vector3< double > &displacement, const ModuleBase::Matrix3 &lattice, const double cutoff)
std::vector< double > cross_ao_overlap (const UnitCell &cell, const std::vector< ModuleBase::Vector3< double > > &old_positions, const std::vector< double > &cutoff, const TwoCenterIntegrator &integrator, const Parallel_Orbitals &pmat)
template<typename T>
std::vector< T > mo_overlap_dist (const std::vector< T > &old_coefficients, const std::vector< T > &ao, const std::vector< T > &current_coefficients, const Parallel_Blkcyclic &pc, const Parallel_Blkcyclic &ps, const Parallel_Blkcyclic &po, const int first_band)
template<typename T>
std::vector< T > project_reference_dist (const std::vector< T > &previous, const std::vector< T > &occupied_overlap, const std::vector< T > &virtual_overlap, const Parallel_Blkcyclic &pi, const Parallel_Blkcyclic &pv, const Parallel_Blkcyclic &px)
template std::vector< double > mo_overlap_dist (const std::vector< double > &, const std::vector< double > &, const std::vector< double > &, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &, int)
template std::vector< std::complex< double > > mo_overlap_dist (const std::vector< std::complex< double > > &, const std::vector< std::complex< double > > &, const std::vector< std::complex< double > > &, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &, int)
template std::vector< double > project_reference_dist (const std::vector< double > &, const std::vector< double > &, const std::vector< double > &, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &)
template std::vector< std::complex< double > > project_reference_dist (const std::vector< std::complex< double > > &, const std::vector< std::complex< double > > &, const std::vector< std::complex< double > > &, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &)
template<typename T>
void follow_cross_root (const RootInputs< T > &inputs, const T *amplitudes, const int nlocal, const int nstates, const int initial_state, const std::vector< double > &energies, const double group_threshold, int &target, std::vector< T > &previous, RootBasis< T > &basis, std::ostream &log)
template void follow_cross_root< double > (const RootInputs< double > &, const double *, int, int, int, const std::vector< double > &, double, int &, std::vector< double > &, RootBasis< double > &, std::ostream &)
template void follow_cross_root< std::complex< double > > (const RootInputs< std::complex< double > > &, const std::complex< double > *, int, int, int, const std::vector< double > &, double, int &, std::vector< std::complex< double > > &, RootBasis< std::complex< double > > &, std::ostream &)
template<>
WindowResponse< double > build_window_response (const GradientInputs< double > &inputs, const container::Tensor &X, const int nstates, const int nactive, const int ispin, const std::string &in_dir)
template<>
WindowResponse< std::complex< double > > build_window_response (const GradientInputs< std::complex< double > > &inputs, const container::Tensor &X, const int nstates, const int nactive, const int ispin, const std::string &in_dir)
template<>
WindowResponse< double > build_open_shell_window_response (const GradientInputs< double > &inputs, const container::Tensor &X, const int nstates, const std::vector< int > &nactive)
template<>
WindowResponse< std::complex< double > > build_open_shell_window_response (const GradientInputs< std::complex< double > > &inputs, const container::Tensor &X, const int nstates, const std::vector< int > &nactive)
template<typename T>
WindowResponse< T > build_window_response (const GradientInputs< T > &inputs, const container::Tensor &X, int nstates, int nactive, int ispin, const std::string &in_dir)
template<typename T>
WindowResponse< T > build_open_shell_window_response (const GradientInputs< T > &inputs, const container::Tensor &X, int nstates, const std::vector< int > &nactive)
std::vector< double > window_multipliers (const int nocc, const int nvirt, const int nactive, const double *virtual_energies, const double *X, const double *AX)
void solve_Z_CG (double *const Z, double *R, const int &ld, const int &nstates, std::function< void(const double *const, double *const)> f_LZ, const bool test_force)
void solve_Z_CG (std::complex< double > *const Z, std::complex< double > *R, const int &ld, const int &nstates, std::function< void(const std::complex< double > *const, std::complex< double > *const)> f_LZ, const bool test_force)
template<typename T>
void Z_vector_equation (const GradientInputs< T > &inputs, const T *const X, T *const Z, const int &nstates, std::weak_ptr< PotHxcLR > pot, const std::string &spin_type, const std::string &in_dir, const bool openshell, const std::string &zvec_solver, const std::vector< std::vector< ct::Tensor > > &window_density)
template void Z_vector_equation< double > (const GradientInputs< double > &, const double *const, double *const, const int &, std::weak_ptr< PotHxcLR >, const std::string &, const std::string &, const bool, const std::string &, const std::vector< std::vector< ct::Tensor > > &)
template void Z_vector_equation< std::complex< double > > (const GradientInputs< std::complex< double > > &, const std::complex< double > *const, std::complex< double > *const, const int &, std::weak_ptr< PotHxcLR >, const std::string &, const std::string &, const bool, const std::string &, const std::vector< std::vector< ct::Tensor > > &)
template<typename THam>
int zvec_global_dim (THam &hm, const int nspin_x)
 Global length of one state's Z-vector: $\sum_\sigma n_k n_{occ,\sigma} n_{virt,\sigma}$. THam only has to expose nk, nocc and nvirt.
template<typename T, typename THam>
void zvec_local_to_full (THam &hm, const int nspin_x, const T *const local, T *const full)
 Gather one state's Z-vector from the hm.pX layout (local, length ld) into the global vector full (length zvec_global_dim), replicated on every rank. Collective.
template<typename T, typename THam>
void zvec_full_to_local (THam &hm, const int nspin_x, const T *const full, T *const local)
 Inverse of zvec_local_to_full: pick this rank's entries of the global vector full into the hm.pX layout local. No communication.
template<typename T, typename THam>
void solve_Z_lapack (T *const Z, const T *const R, const int &ld, const int &nstates, THam &hm, const int nspin_x, const bool test_force)
 Solve the Z-vector equation with a dense LAPACK solve.
template<typename T, typename THam>
std::vector< T > zvec_hessian_2d (THam &hm, const int nspin_x, const int ld, const Parallel_Blkcyclic &ph)
 Build this rank's block of the Z-vector Hessian on the 2D block-cyclic layout ph (n_global x n_global), one column at a time: column g is hm.hPsi of the g-th unit vector, i.e. exactly the operator the CG solve applies. Only O(n_global) is replicated per rank (one column in flight), instead of the O(n_global^2) of hm.matrix(). Collective: every rank walks every column, since hPsi and the gather communicate.
template<typename T, typename THam>
void solve_Z_2d (T *const Z, const T *const R, const int ld, const int nstates, THam &hm, const int nspin_x, void(*linear_solver)(T *, T *, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &))
 Distributed dense Z-vector solve: the Hessian (zvec_hessian_2d) and the right-hand side are laid out 2D block-cyclically on the BLACS grid of hm.pX[0], and linear_solver (scalapack_linear_solver or scalapack_cholesky_linear_solver) solves them in place.
template<typename T, typename THam>
void solve_Z_scalapack (T *const Z, const T *const R, const int ld, const int nstates, THam &hm, const int nspin_x)
 Distributed dense Z-vector solve with ScaLAPACK LU (p?gesv). Same system as solve_Z_lapack, but neither the Hessian nor the factorization is replicated.
template<typename T, typename THam>
void solve_Z_scalapack_chol (T *const Z, const T *const R, const int ld, const int nstates, THam &hm, const int nspin_x)
 Distributed dense Z-vector solve with a ScaLAPACK Cholesky factorization (p?potrf), about half the flops of the LU in solve_Z_scalapack. Requires a positive-definite orbital Hessian; a factorization failure is reported on every rank.
template<typename T, typename THamL>
void solve_zeq_with (T *const Z, T *const R, const int ld, const int nstates, THamL &ops_L, const int nspin_x, const std::string &zvec_solver, const bool test_force)
 Run the configured solver (and then, for testing, every supported one). Shared by the closed- and open-shell paths; THamL only needs hPsi plus what solve_Z_lapack reads.
template<typename T, typename TOpsR, typename TOpsL>
void build_and_solve_zeq (TOpsR &ops_R, TOpsL &ops_L, const int nspin_x, const T *const X, container::Tensor &R, T *const Z, const int nloc_per_band, const int nstates, const std::string &zvec_solver, const bool test_force, const std::vector< std::vector< ct::Tensor > > &window_density)
template<typename T>
void hermitize_2d (T *A, const Parallel_Blkcyclic &pA)
template<typename T>
void scalapack_linear_solver (T *A, T *B, const Parallel_Blkcyclic &pA, const Parallel_Blkcyclic &pB)
 Solve A Z = B with ScaLAPACK LU (p?gesv), the distributed counterpart of LR_Util::lapack_linear_solver.
template<typename T>
void scalapack_cholesky_linear_solver (T *A, T *B, const Parallel_Blkcyclic &pA, const Parallel_Blkcyclic &pB)
 Solve A Z = B for a Hermitian positive-definite A with ScaLAPACK alone: Cholesky p?potrf A = U^H U, then p?potrs. A is Hermitized as (A + A^H)/2 first. Arguments as in scalapack_linear_solver; A is overwritten by U. Throws on every rank if A is not positive definite (p?potrf's INFO is global).
template void scalapack_linear_solver< double > (double *, double *, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &)
template void scalapack_linear_solver< std::complex< double > > (std::complex< double > *, std::complex< double > *, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &)
template void scalapack_cholesky_linear_solver< double > (double *, double *, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &)
template void scalapack_cholesky_linear_solver< std::complex< double > > (std::complex< double > *, std::complex< double > *, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &)

Typedef Documentation

◆ Real

template<typename T>
using LR::Real = typename GetTypeReal<T>::type

◆ Vec3

typedef ModuleBase::Vector3< double > LR::Vec3 = ModuleBase::Vector3<double>

Function Documentation

◆ AAT() [1/4]

void LR::AAT ( const double * A,
const int & nrow,
const int & ncol,
double * C,
const bool add = false,
const double & alpha = 1.0 )
Here is the call graph for this function:

◆ AAT() [2/4]

void LR::AAT ( const double * A,
const Parallel_Blkcyclic & pa,
const int & nrow,
const int & ncol,
double * C,
const Parallel_Blkcyclic & pc,
const bool add = false,
const double & alpha = 1.0 )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AAT() [3/4]

void LR::AAT ( const std::complex< double > * A,
const int & nrow,
const int & ncol,
std::complex< double > * C,
const bool add = false,
const std::complex< double > & alpha = std::complex<double>(1.0, 0.0) )
Here is the call graph for this function:

◆ AAT() [4/4]

void LR::AAT ( const std::complex< double > * A,
const Parallel_Blkcyclic & pa,
const int & nrow,
const int & ncol,
std::complex< double > * C,
const Parallel_Blkcyclic & pc,
const bool add = false,
const std::complex< double > & alpha = std::complex<double>(1.0, 0.0) )
Here is the call graph for this function:

◆ act_with_shared_density()

template<typename T>
void LR::act_with_shared_density ( hamilt::Operator< T > * node,
const int nbasis,
const T * psi_in,
T * hpsi,
typename OperatorLRHxc< T >::TransitionDensityCache & density_cache )

Apply one node, reusing only Hxc grid densities. Other operators retain their original action and ordering (including diagonal and EXX terms).

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

◆ add_ediff_term()

template<typename T>
void LR::add_ediff_term ( T *const inout,
const T *const X,
const double eig_ext_istate,
const double *const eig_ks,
const int nk,
const int nocc,
const int nvirt,
const Parallel_Blkcyclic & px,
const Parallel_Blkcyclic & p_occ_occ )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ao_to_mo_blas() [1/3]

template<>
void LR::ao_to_mo_blas ( const std::vector< container::Tensor > & mat_ao,
const psi::Psi< double > & coeff,
const int & nocc,
const int & nvirt,
double * mat_mo,
const bool add_on,
const LR_Util::MO_TYPE type,
const double factor )
Here is the call graph for this function:

◆ ao_to_mo_blas() [2/3]

template<>
void LR::ao_to_mo_blas ( const std::vector< container::Tensor > & mat_ao,
const psi::Psi< std::complex< double > > & coeff,
const int & nocc,
const int & nvirt,
std::complex< double > *const mat_mo,
const bool add_on,
const LR_Util::MO_TYPE type,
const std::complex< double > factor )
Here is the call graph for this function:

◆ ao_to_mo_blas() [3/3]

template<typename T>
void LR::ao_to_mo_blas ( const std::vector< container::Tensor > & mat_ao,
const psi::Psi< T > & coeff,
const int & nocc,
const int & nvirt,
T *const mat_mo,
const bool add_on,
const LR_Util::MO_TYPE type,
const T factor )
Here is the caller graph for this function:

◆ ao_to_mo_forloop_serial() [1/3]

template<>
void LR::ao_to_mo_forloop_serial ( const std::vector< container::Tensor > & mat_ao,
const psi::Psi< double > & coeff,
const int & nocc,
const int & nvirt,
double * mat_mo,
const LR_Util::MO_TYPE type,
const double factor )
Here is the call graph for this function:

◆ ao_to_mo_forloop_serial() [2/3]

template<>
void LR::ao_to_mo_forloop_serial ( const std::vector< container::Tensor > & mat_ao,
const psi::Psi< std::complex< double > > & coeff,
const int & nocc,
const int & nvirt,
std::complex< double > *const mat_mo,
const LR_Util::MO_TYPE type,
const std::complex< double > factor )
Here is the call graph for this function:

◆ ao_to_mo_forloop_serial() [3/3]

template<typename T>
void LR::ao_to_mo_forloop_serial ( const std::vector< container::Tensor > & mat_ao,
const psi::Psi< T > & coeff,
const int & nocc,
const int & nvirt,
T *const mat_mo,
const LR_Util::MO_TYPE type,
const T factor )
Here is the caller graph for this function:

◆ ao_to_mo_pblas() [1/3]

template<>
void LR::ao_to_mo_pblas ( const std::vector< container::Tensor > & mat_ao,
const Parallel_Blkcyclic & pmat_ao,
const psi::Psi< double > & coeff,
const Parallel_Blkcyclic & pcoeff,
const int & naos,
const int & nocc,
const int & nvirt,
const Parallel_Blkcyclic & pmat_mo,
double * mat_mo,
const bool add_on,
const LR_Util::MO_TYPE type,
const double factor )
Here is the call graph for this function:

◆ ao_to_mo_pblas() [2/3]

template<>
void LR::ao_to_mo_pblas ( const std::vector< container::Tensor > & mat_ao,
const Parallel_Blkcyclic & pmat_ao,
const psi::Psi< std::complex< double > > & coeff,
const Parallel_Blkcyclic & pcoeff,
const int & naos,
const int & nocc,
const int & nvirt,
const Parallel_Blkcyclic & pmat_mo,
std::complex< double > *const mat_mo,
const bool add_on,
const LR_Util::MO_TYPE type,
const std::complex< double > factor )
Here is the call graph for this function:

◆ ao_to_mo_pblas() [3/3]

template<typename T>
void LR::ao_to_mo_pblas ( const std::vector< container::Tensor > & mat_ao,
const Parallel_Blkcyclic & pmat_ao,
const psi::Psi< T > & coeff,
const Parallel_Blkcyclic & pcoeff,
const int & naos,
const int & nocc,
const int & nvirt,
const Parallel_Blkcyclic & pmat_mo,
T *const mat_mo,
const bool add_on,
const LR_Util::MO_TYPE type,
const T factor )
Here is the caller graph for this function:

◆ assemble_grad_matrix()

template<typename TMat>
std::vector< std::vector< TMat > > LR::assemble_grad_matrix ( const std::vector< TMat > & diag,
const std::vector< TMat > & plus,
const std::vector< std::pair< int, int > > & pairs )

Assemble $G_{kl}$ of one multiplet from the diagonal gradients and the combinations, i.e. route (A2) above.

Parameters
diag$G_,{kk}=

mathcal F[X_k]$, d entries

Parameters
plus$\mathcal F[(X_k+X_l)/\sqrt2]$, one per entry of pairs, in that order
pairsas returned by degenerate_pairs(d)
Returns
G[k][l], symmetric by construction

TMat needs operator+, operator- and operator*(double); ModuleBase::matrix and plain double both qualify, which is what keeps this testable.

Here is the caller graph for this function:

◆ average_forces()

ModuleBase::matrix LR::average_forces ( const std::vector< ModuleBase::matrix > & f)

The mean of a set of force matrices.

Used for the multiplet average $\operatorname{Tr}G/d$, the one smooth, basis-independent $3N$ vector field a degenerate multiplet has. Factored out because three callers need it from different inputs: the printout and the stored LVC hold the whole gradient matrix, while the relaxation only ever computes its diagonal.

Here is the caller graph for this function:

◆ build_and_solve_zeq()

template<typename T, typename TOpsR, typename TOpsL>
void LR::build_and_solve_zeq ( TOpsR & ops_R,
TOpsL & ops_L,
const int nspin_x,
const T *const X,
container::Tensor & R,
T *const Z,
const int nloc_per_band,
const int nstates,
const std::string & zvec_solver,
const bool test_force,
const std::vector< std::vector< ct::Tensor > > & window_density )

Builds the Z-vector equation's RHS from ops_R and solves it with ops_L. Extracted to a template function (rather than a generic lambda, which needs C++14) so the closed- and open-shell call sites in Z_vector_equation – which pass different Z_vector_R/UR and Z_vector_L/UL types – can share this body under the repository's C++11 baseline.

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

◆ build_gs_xc_kernel()

std::shared_ptr< const LR::KernelXC > LR::build_gs_xc_kernel ( const std::string & kernel_name,
const ModulePW::PW_Basis & rho_basis,
const UnitCell & ucell,
const Charge & chg_gs,
const Parallel_Grid & pgrid,
int nspin,
bool openshell,
const std::vector< std::string > & lr_init_xc_kernel )

Build immutable GS response from raw coefficients, retrying non-finite HSE with the LR floor. Uses the supplied GS functional, density and grid, requesting no third derivatives.

Here is the caller graph for this function:

◆ build_open_shell_window_response() [1/3]

template<>
WindowResponse< double > LR::build_open_shell_window_response ( const GradientInputs< double > & inputs,
const container::Tensor & X,
const int nstates,
const std::vector< int > & nactive )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_open_shell_window_response() [2/3]

template<>
WindowResponse< std::complex< double > > LR::build_open_shell_window_response ( const GradientInputs< std::complex< double > > & inputs,
const container::Tensor & X,
const int nstates,
const std::vector< int > & nactive )

◆ build_open_shell_window_response() [3/3]

template<typename T>
WindowResponse< T > LR::build_open_shell_window_response ( const GradientInputs< T > & inputs,
const container::Tensor & X,
int nstates,
const std::vector< int > & nactive )

◆ build_window_response() [1/3]

template<>
WindowResponse< double > LR::build_window_response ( const GradientInputs< double > & inputs,
const container::Tensor & X,
const int nstates,
const int nactive,
const int ispin,
const std::string & in_dir )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_window_response() [2/3]

template<>
WindowResponse< std::complex< double > > LR::build_window_response ( const GradientInputs< std::complex< double > > & inputs,
const container::Tensor & X,
const int nstates,
const int nactive,
const int ispin,
const std::string & in_dir )

◆ build_window_response() [3/3]

template<typename T>
WindowResponse< T > LR::build_window_response ( const GradientInputs< T > & inputs,
const container::Tensor & X,
int nstates,
int nactive,
int ispin,
const std::string & in_dir )

◆ build_xc_kernel()

std::shared_ptr< const LR::KernelXC > LR::build_xc_kernel ( const std::string & kernel_name,
const ModulePW::PW_Basis & rho_basis,
const UnitCell & ucell,
const Charge & chg_gs,
const Parallel_Grid & pgrid,
const int nspin,
const bool openshell,
const int gxc_spin,
const std::vector< std::string > & lr_init_xc_kernel )

Explicitly evaluate a coefficient set for one functional and ground-state density. Sharing potentials must use compatible spin layouts and derivative requirements.

Here is the caller graph for this function:

◆ cal_dm_diff_blas() [1/2]

template<typename T>
std::vector< ct::Tensor > LR::cal_dm_diff_blas ( const T *const X_istate,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const int & naos,
const int & nocc,
const int & nvirt,
const bool renorm_k,
const int nspin )

calculate the 2d-block transition density matrix in AO basis using ?gemm

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

◆ cal_dm_diff_blas() [2/2]

template<typename T>
std::vector< container::Tensor > LR::cal_dm_diff_blas ( const T *const X_istate,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const int & naos,
const int & nocc,
const int & nvirt,
const bool renorm_k = true,
const int nspin = 1 )

calculate the 2d-block transition density matrix in AO basis using ?gemm

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

◆ cal_dm_diff_blas< double >()

template std::vector< container::Tensor > LR::cal_dm_diff_blas< double > ( const double * const ,
const psi::Psi< double, base_device::DEVICE_CPU > & ,
const int & ,
const int & ,
const int & ,
const bool ,
const int  )

◆ cal_dm_diff_blas< std::complex< double > >()

template std::vector< container::Tensor > LR::cal_dm_diff_blas< std::complex< double > > ( const std::complex< double > * const ,
const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > & ,
const int & ,
const int & ,
const int & ,
const bool ,
const int  )
Here is the call graph for this function:

◆ cal_dm_diff_forloop() [1/2]

template<typename T>
std::vector< ct::Tensor > LR::cal_dm_diff_forloop ( const T *const X_istate,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const int & naos,
const int & nocc,
const int & nvirt,
const bool renorm_k,
const int nspin )

calculate the 2d-block transition density matrix in AO basis using for loop (for test)

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

◆ cal_dm_diff_forloop() [2/2]

template<typename T>
std::vector< container::Tensor > LR::cal_dm_diff_forloop ( const T *const X_istate,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const int & naos,
const int & nocc,
const int & nvirt,
const bool renorm_k = true,
const int nspin = 1 )

calculate the 2d-block transition density matrix in AO basis using for loop (for test)

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

◆ cal_dm_diff_forloop< double >()

template std::vector< container::Tensor > LR::cal_dm_diff_forloop< double > ( const double * const ,
const psi::Psi< double, base_device::DEVICE_CPU > & ,
const int & ,
const int & ,
const int & ,
const bool ,
const int  )

◆ cal_dm_diff_forloop< std::complex< double > >()

template std::vector< container::Tensor > LR::cal_dm_diff_forloop< std::complex< double > > ( const std::complex< double > * const ,
const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > & ,
const int & ,
const int & ,
const int & ,
const bool ,
const int  )
Here is the call graph for this function:

◆ cal_dm_diff_pblas() [1/2]

template<typename T>
std::vector< ct::Tensor > LR::cal_dm_diff_pblas ( const T *const X_istate,
const Parallel_Blkcyclic & px,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const Parallel_Blkcyclic & pc,
const int & naos,
const int & nocc,
const int & nvirt,
const Parallel_Blkcyclic & pmat,
const bool renorm_k = true,
const int nspin = 1 )

calculate the 2d-block difference density matrix in AO basis using p?gemm

\‍[ T=(C_v*X) * (C_v * X)^\dagger + (C_o*X^T) * (C_o*X^T)^\dagger \‍]

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

◆ cal_dm_diff_pblas() [2/2]

template<typename T>
std::vector< container::Tensor > LR::cal_dm_diff_pblas ( const T *const X_istate,
const Parallel_Blkcyclic & px,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const Parallel_Blkcyclic & pc,
const int & naos,
const int & nocc,
const int & nvirt,
const Parallel_Blkcyclic & pmat,
const bool renorm_k = true,
const int nspin = 1 )

calculate the 2d-block difference density matrix in AO basis using p?gemm

\‍[ T=(C_v*X) * (C_v * X)^\dagger + (C_o*X^T) * (C_o*X^T)^\dagger \‍]

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

◆ cal_dm_diff_pblas< double >()

template std::vector< container::Tensor > LR::cal_dm_diff_pblas< double > ( const double * const ,
const Parallel_Blkcyclic & ,
const psi::Psi< double, base_device::DEVICE_CPU > & ,
const Parallel_Blkcyclic & ,
const int & ,
const int & ,
const int & ,
const Parallel_Blkcyclic & ,
const bool ,
const int  )

◆ cal_dm_diff_pblas< std::complex< double > >()

template std::vector< container::Tensor > LR::cal_dm_diff_pblas< std::complex< double > > ( const std::complex< double > * const ,
const Parallel_Blkcyclic & ,
const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > & ,
const Parallel_Blkcyclic & ,
const int & ,
const int & ,
const int & ,
const Parallel_Blkcyclic & ,
const bool ,
const int  )
Here is the call graph for this function:

◆ cal_dm_trans_blas() [1/3]

template<>
std::vector< container::Tensor > LR::cal_dm_trans_blas ( const double *const X_istate,
const psi::Psi< double > & c,
const int & nocc,
const int & nvirt,
const double factor,
const LR_Util::MO_TYPE type )
Here is the call graph for this function:

◆ cal_dm_trans_blas() [2/3]

template<>
std::vector< container::Tensor > LR::cal_dm_trans_blas ( const std::complex< double > *const X_istate,
const psi::Psi< std::complex< double > > & c,
const int & nocc,
const int & nvirt,
const std::complex< double > factor,
const LR_Util::MO_TYPE type )
Here is the call graph for this function:

◆ cal_dm_trans_blas() [3/3]

template<typename T>
std::vector< container::Tensor > LR::cal_dm_trans_blas ( const T *const X_istate,
const psi::Psi< T > & c,
const int & nocc,
const int & nvirt,
const T factor = (T) 1.0,
const LR_Util::MO_TYPE type = LR_Util::MO_TYPE::VO )

calculate the 2d-block transition density matrix in AO basis using ?gemm

Here is the caller graph for this function:

◆ cal_dm_trans_forloop_serial() [1/3]

template<>
std::vector< container::Tensor > LR::cal_dm_trans_forloop_serial ( const double *const X_istate,
const psi::Psi< double > & c,
const int & nocc,
const int & nvirt,
const double factor,
const LR_Util::MO_TYPE type )
Here is the call graph for this function:

◆ cal_dm_trans_forloop_serial() [2/3]

template<>
std::vector< container::Tensor > LR::cal_dm_trans_forloop_serial ( const std::complex< double > *const X_istate,
const psi::Psi< std::complex< double > > & c,
const int & nocc,
const int & nvirt,
const std::complex< double > factor,
const LR_Util::MO_TYPE type )
Here is the call graph for this function:

◆ cal_dm_trans_forloop_serial() [3/3]

template<typename T>
std::vector< container::Tensor > LR::cal_dm_trans_forloop_serial ( const T *const X_istate,
const psi::Psi< T > & c,
const int & nocc,
const int & nvirt,
const T factor = (T) 1.0,
const LR_Util::MO_TYPE type = LR_Util::MO_TYPE::VO )

calculate the 2d-block transition density matrix in AO basis using for loop (for test)

Here is the caller graph for this function:

◆ cal_dm_trans_pblas() [1/3]

template<>
std::vector< container::Tensor > LR::cal_dm_trans_pblas ( const double *const X_istate,
const Parallel_Blkcyclic & px,
const psi::Psi< double > & c,
const Parallel_Blkcyclic & pc,
const int naos,
const int nocc,
const int nvirt,
const Parallel_Blkcyclic & pmat,
const double factor,
const LR_Util::MO_TYPE type )
Here is the call graph for this function:

◆ cal_dm_trans_pblas() [2/3]

template<>
std::vector< container::Tensor > LR::cal_dm_trans_pblas ( const std::complex< double > *const X_istate,
const Parallel_Blkcyclic & px,
const psi::Psi< std::complex< double > > & c,
const Parallel_Blkcyclic & pc,
const int naos,
const int nocc,
const int nvirt,
const Parallel_Blkcyclic & pmat,
const std::complex< double > factor,
const LR_Util::MO_TYPE type )
Here is the call graph for this function:

◆ cal_dm_trans_pblas() [3/3]

template<typename T>
std::vector< container::Tensor > LR::cal_dm_trans_pblas ( const T *const X_istate,
const Parallel_Blkcyclic & px,
const psi::Psi< T > & c,
const Parallel_Blkcyclic & pc,
const int naos,
const int nocc,
const int nvirt,
const Parallel_Blkcyclic & pmat,
const T factor = (T) 1.0,
const LR_Util::MO_TYPE type = LR_Util::MO_TYPE::VO )

calculate the 2d-block transition density matrix in AO basis using p?gemm

\‍[ \tilde{\rho}_{\mu_j\mu_b}=\sum_{jb}c_{j,\mu_j}X_{jb}c^*_{b,\mu_b} \‍]

Here is the caller graph for this function:

◆ cal_edm_from_XZ_istate()

template<typename T>
std::vector< ct::Tensor > LR::cal_edm_from_XZ_istate ( const GradientInputs< T > & inputs,
const T *const X,
const T *const Z,
const double eig_ext_istate,
const double *const eig_ks,
module_dm::DensityMatrix< T, T > & dm_trans,
const psi::Psi< T > & c,
std::weak_ptr< PotHxcLR > pot,
const std::string & spin_type,
const std::vector< ct::Tensor > & relaxed_density )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_edm_from_XZ_istate_openshell()

template<typename T>
std::vector< std::vector< ct::Tensor > > LR::cal_edm_from_XZ_istate_openshell ( const GradientInputs< T > & inputs,
const T *const X,
const T *const Z,
const double eig_ext_istate,
const double *const eig_ks,
const module_dm::DensityMatrix< T, T > & dm_trans,
std::weak_ptr< PotHxcLR > pot,
const std::vector< std::vector< ct::Tensor > > & relaxed_density )

Open-shell (spin-unrestricted) counterpart of cal_edm_from_XZ_istate. Returns the energy-weighted density matrix of each spin channel: [is][ik].

The four EDM terms are all spin-diagonal AO outer products; the spin coupling only enters when building the two multipliers, $W^c$ (see cal_W_from_Z_openshell) and $W^X_{ki\sigma}=2K_{ki\sigma}[D^X]$ (the op_K_cvcx blocks below).

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

◆ cal_edm_single_kpoint()

template<typename T>
ct::Tensor LR::cal_edm_single_kpoint ( const T *const vec,
const Parallel_Blkcyclic & pvec,
const double * eig,
const Parallel_Blkcyclic & pmat )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_edm_term4()

template<typename T>
std::vector< ct::Tensor > LR::cal_edm_term4 ( const T * X,
const double eig_ext_istate,
const double *const eig_ks,
const psi::Psi< T > & c,
const Parallel_Blkcyclic & px,
const Parallel_Blkcyclic & pc,
const Parallel_Orbitals & pmat )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_edm_terms_from_XZWK()

template<typename T>
std::vector< ct::Tensor > LR::cal_edm_terms_from_XZWK ( const T *const X,
const T *const Z,
const T *const W,
const T *const K_cvcx,
const double eig_ext_istate,
const double *const eig_ks,
const psi::Psi< T > & c,
const int nspin,
const bool test_force,
const Parallel_Blkcyclic & p_occ_occ,
const Parallel_Blkcyclic & p_virt_occ,
const Parallel_Blkcyclic & pc,
const Parallel_Orbitals & pmat )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_eig_ks_diff()

void LR::cal_eig_ks_diff ( double *const eig_ks_diff,
const double *const eig_ks,
const Parallel_Blkcyclic & px,
const int nk,
const int nocc,
const int nvirt )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_W_from_Z()

template<typename T>
void LR::cal_W_from_Z ( const GradientInputs< T > & inputs,
T *const W,
const std::vector< ct::Tensor > & relaxed_density,
const T *const X,
const double eig,
const double *const eig_ks,
const psi::Psi< T > & psi_ks,
const std::vector< Parallel_Blkcyclic > & p_occ_occ,
const std::string & spin_type = "singlet" )

operators

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

◆ cal_W_from_Z_openshell()

template<typename T>
void LR::cal_W_from_Z_openshell ( const GradientInputs< T > & inputs,
std::vector< std::vector< T > > & W,
const std::vector< std::vector< ct::Tensor > > & relaxed_density,
const T *const X,
const double eig,
const double *const eig_ks,
const std::vector< Parallel_Blkcyclic > & p_occ_occ )

Open-shell (spin-unrestricted) counterpart of cal_W_from_Z.

$$W^c_{ij\sigma}=\tfrac12 H_{ij\sigma}[T+D^Z] +\sum_a X_{ai\sigma}(\Omega-\epsilon_{a\sigma})X_{aj\sigma} +\sum_{\kappa\lambda\sigma'}\sum_{\alpha\beta\sigma''}D^X D^X g^{xc}_{\dots,ij\sigma}$$

W[is] is the occ-occ block of spin channel is, distributed over p_occ_occ[is]. Factor 1.0 on the $H[T+D^Z]$ operator (the closed-shell version uses 2.0): there $\tfrac12 H^S = K^S = 2\cdot$pot_hxc_gs because pot_hxc_gs is the halved S2_gs; here it is S2_updown, one $K_{\sigma\sigma'}$ component, and the $\sum_{\sigma'}$ is done by the block loop below.

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

◆ cal_X_ao_occ()

template<typename T>
void LR::cal_X_ao_occ ( const T *const X,
const Parallel_Blkcyclic & px,
const T *const c,
const Parallel_Blkcyclic & pc,
T *const X_ao_occ,
const Parallel_Blkcyclic & px_ao_occ )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_X_ao_occ< double >()

template void LR::cal_X_ao_occ< double > ( const double * ,
const Parallel_Blkcyclic & ,
const double * ,
const Parallel_Blkcyclic & ,
double * ,
const Parallel_Blkcyclic &  )

◆ cal_X_ao_occ< std::complex< double > >()

template void LR::cal_X_ao_occ< std::complex< double > > ( const std::complex< double > * ,
const Parallel_Blkcyclic & ,
const std::complex< double > * ,
const Parallel_Blkcyclic & ,
std::complex< double > * ,
const Parallel_Blkcyclic &  )
Here is the call graph for this function:

◆ check_lr_parameters()

void LR::check_lr_parameters ( const Input_para & input,
const std::string & xc_kernel,
const int nspin )

Validate LR solver, functional, spin count and optical gauge without global input access.

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

◆ combine_normalized()

template<typename T>
void LR::combine_normalized ( const T *const Xk,
const T *const Xl,
const size_t nloc,
T *const Xplus )

$X_+=(X_k+X_l)/\sqrt2$, normalized when $X_k$ and $X_l$ are orthonormal.

Using the normalized combination rather than $X_k+X_l$ is what lets the gradient be evaluated by the untouched per-state path: $X_+$ is then a genuine normalized eigenvector, so every normalization, $\Omega$ and $W^X$ convention inside that path still holds.

Here is the caller graph for this function:

◆ convert_ptr_to_vector3()

template<typename T>
ModuleBase::Vector3< T > LR::convert_ptr_to_vector3 ( const std::complex< double > * ptr)
inline
Here is the caller graph for this function:

◆ convert_ptr_to_vector3< double >()

template<>
ModuleBase::Vector3< double > LR::convert_ptr_to_vector3< double > ( const std::complex< double > * ptr)
inline

◆ convert_ptr_to_vector3< std::complex< double > >()

template<>
ModuleBase::Vector3< std::complex< double > > LR::convert_ptr_to_vector3< std::complex< double > > ( const std::complex< double > * ptr)
inline

◆ convert_vector_to_vector3() [1/3]

template<>
ModuleBase::Vector3< std::complex< double > > LR::convert_vector_to_vector3 ( const std::vector< std::complex< double > > & vec)
inline

◆ convert_vector_to_vector3() [2/3]

template<>
ModuleBase::Vector3< double > LR::convert_vector_to_vector3 ( const std::vector< std::complex< double > > & vec)
inline

◆ convert_vector_to_vector3() [3/3]

template<typename T>
ModuleBase::Vector3< T > LR::convert_vector_to_vector3 ( const std::vector< std::complex< double > > & vec)
inline
Here is the caller graph for this function:

◆ CoXT() [1/4]

void LR::CoXT ( const double * C,
const double * X,
const int & naos,
const int & nocc,
const int & nvirt,
double * CoXT )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CoXT() [2/4]

void LR::CoXT ( const double * C,
const Parallel_Blkcyclic & pc,
const double * X,
const Parallel_Blkcyclic & px,
const int & naos,
const int & nocc,
const int & nvirt,
double * CoXT,
const Parallel_Blkcyclic & pcxt )
Here is the call graph for this function:

◆ CoXT() [3/4]

void LR::CoXT ( const std::complex< double > * C,
const Parallel_Blkcyclic & pc,
const std::complex< double > * X,
const Parallel_Blkcyclic & px,
const int & naos,
const int & nocc,
const int & nvirt,
std::complex< double > * CoXT,
const Parallel_Blkcyclic & pcxt )
Here is the call graph for this function:

◆ CoXT() [4/4]

void LR::CoXT ( const std::complex< double > * C,
const std::complex< double > * X,
const int & naos,
const int & nocc,
const int & nvirt,
std::complex< double > * CoXT )
Here is the call graph for this function:

◆ cross_ao_overlap()

std::vector< double > LR::cross_ao_overlap ( const UnitCell & cell,
const std::vector< ModuleBase::Vector3< double > > & old_positions,
const std::vector< double > & cutoff,
const TwoCenterIntegrator & integrator,
const Parallel_Orbitals & pmat )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cross_image_indices()

std::vector< ModuleBase::Vector3< int > > LR::cross_image_indices ( const ModuleBase::Vector3< double > & displacement,
const ModuleBase::Matrix3 & lattice,
const double cutoff )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CVCX_occ_blas() [1/3]

template<>
void LR::CVCX_occ_blas ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< double, base_device::DEVICE_CPU > & c,
const double *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
double *const AX_istate,
const bool add_on,
const double factor )
Here is the call graph for this function:

◆ CVCX_occ_blas() [2/3]

template<>
void LR::CVCX_occ_blas ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > & c,
const std::complex< double > *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
std::complex< double > *const AX_istate,
const bool add_on,
const std::complex< double > factor )
Here is the call graph for this function:

◆ CVCX_occ_blas() [3/3]

template<typename T>
void LR::CVCX_occ_blas ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const T *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
T *const AX_istate,
const bool add_on = true,
const T factor = (T) 1.0 )
Here is the caller graph for this function:

◆ CVCX_occ_forloop_serial() [1/3]

template<>
void LR::CVCX_occ_forloop_serial ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< double, base_device::DEVICE_CPU > & c,
const double *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
double *const AX_istate )
Here is the call graph for this function:

◆ CVCX_occ_forloop_serial() [2/3]

template<>
void LR::CVCX_occ_forloop_serial ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > & c,
const std::complex< double > *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
std::complex< double > *const AX_istate )
Here is the call graph for this function:

◆ CVCX_occ_forloop_serial() [3/3]

template<typename T>
void LR::CVCX_occ_forloop_serial ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const T *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
T *const AX_istate )

$\sum_{k\mu\nu}C^*_{\mu i}K_{\mu\nu}C_{\nu k}X_{ak}^*$

Here is the caller graph for this function:

◆ CVCX_occ_pblas() [1/3]

template<>
void LR::CVCX_occ_pblas ( const std::vector< container::Tensor > & V_istate,
const Parallel_Blkcyclic & pmat,
const psi::Psi< double, base_device::DEVICE_CPU > & c,
const Parallel_Blkcyclic & pc,
const double *const X_istate,
const Parallel_Blkcyclic & px,
const int & naos,
const int & nocc,
const int & nvirt,
double *const AX_istate,
const bool add_on,
const double factor )
Here is the call graph for this function:

◆ CVCX_occ_pblas() [2/3]

template<>
void LR::CVCX_occ_pblas ( const std::vector< container::Tensor > & V_istate,
const Parallel_Blkcyclic & pmat,
const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > & c,
const Parallel_Blkcyclic & pc,
const std::complex< double > *const X_istate,
const Parallel_Blkcyclic & px,
const int & naos,
const int & nocc,
const int & nvirt,
std::complex< double > *const AX_istate,
const bool add_on,
const std::complex< double > factor )
Here is the call graph for this function:

◆ CVCX_occ_pblas() [3/3]

template<typename T>
void LR::CVCX_occ_pblas ( const std::vector< container::Tensor > & V_istate,
const Parallel_Blkcyclic & pmat,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const Parallel_Blkcyclic & pc,
const T *const X_istate,
const Parallel_Blkcyclic & px,
const int & naos,
const int & nocc,
const int & nvirt,
T *const AX_istate,
const bool add_on = true,
const T factor = (T) 1.0 )
Here is the caller graph for this function:

◆ CVCX_virt_blas() [1/3]

template<>
void LR::CVCX_virt_blas ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< double, base_device::DEVICE_CPU > & c,
const double *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
double *const AX_istate,
const bool add_on,
const double factor )
Here is the call graph for this function:

◆ CVCX_virt_blas() [2/3]

template<>
void LR::CVCX_virt_blas ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > & c,
const std::complex< double > *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
std::complex< double > *const AX_istate,
const bool add_on,
const std::complex< double > factor )
Here is the call graph for this function:

◆ CVCX_virt_blas() [3/3]

template<typename T>
void LR::CVCX_virt_blas ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const T *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
T *const AX_istate,
const bool add_on = true,
const T factor = (T) 1.0 )
Here is the caller graph for this function:

◆ CVCX_virt_forloop_serial() [1/3]

template<>
void LR::CVCX_virt_forloop_serial ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< double, base_device::DEVICE_CPU > & c,
const double *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
double *const AX_istate )
Here is the call graph for this function:

◆ CVCX_virt_forloop_serial() [2/3]

template<>
void LR::CVCX_virt_forloop_serial ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > & c,
const std::complex< double > *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
std::complex< double > *const AX_istate )
Here is the call graph for this function:

◆ CVCX_virt_forloop_serial() [3/3]

template<typename T>
void LR::CVCX_virt_forloop_serial ( const std::vector< container::Tensor > & V_istate,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const T *const X_istate,
const int & naos,
const int & nocc,
const int & nvirt,
T *const AX_istate )

$\sum_{b\mu\nu}X^*_{bi}C^*_{\mu b}K_{\mu\nu}C_{\nu a}$

Here is the caller graph for this function:

◆ CVCX_virt_pblas() [1/3]

template<>
void LR::CVCX_virt_pblas ( const std::vector< container::Tensor > & V_istate,
const Parallel_Blkcyclic & pmat,
const psi::Psi< double, base_device::DEVICE_CPU > & c,
const Parallel_Blkcyclic & pc,
const double *const X_istate,
const Parallel_Blkcyclic & px,
const int & naos,
const int & nocc,
const int & nvirt,
double *const AX_istate,
const bool add_on,
const double factor )
Here is the call graph for this function:

◆ CVCX_virt_pblas() [2/3]

template<>
void LR::CVCX_virt_pblas ( const std::vector< container::Tensor > & V_istate,
const Parallel_Blkcyclic & pmat,
const psi::Psi< std::complex< double >, base_device::DEVICE_CPU > & c,
const Parallel_Blkcyclic & pc,
const std::complex< double > *const X_istate,
const Parallel_Blkcyclic & px,
const int & naos,
const int & nocc,
const int & nvirt,
std::complex< double > *const AX_istate,
const bool add_on,
const std::complex< double > factor )
Here is the call graph for this function:

◆ CVCX_virt_pblas() [3/3]

template<typename T>
void LR::CVCX_virt_pblas ( const std::vector< container::Tensor > & V_istate,
const Parallel_Blkcyclic & pmat,
const psi::Psi< T, base_device::DEVICE_CPU > & c,
const Parallel_Blkcyclic & pc,
const T *const X_istate,
const Parallel_Blkcyclic & px,
const int & naos,
const int & nocc,
const int & nvirt,
T *const AX_istate,
const bool add_on = true,
const T factor = (T) 1.0 )
Here is the caller graph for this function:

◆ CvX() [1/4]

void LR::CvX ( const double * C,
const double * X,
const int & naos,
const int & nocc,
const int & nvirt,
double * CvX )

Orbital-amplitude contractions C_v X and C_o X^T, shared with the EXX operator.

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

◆ CvX() [2/4]

void LR::CvX ( const double * C,
const Parallel_Blkcyclic & pc,
const double * X,
const Parallel_Blkcyclic & px,
const int & naos,
const int & nocc,
const int & nvirt,
double * CvX,
const Parallel_Blkcyclic & pcx )
Here is the call graph for this function:

◆ CvX() [3/4]

void LR::CvX ( const std::complex< double > * C,
const Parallel_Blkcyclic & pc,
const std::complex< double > * X,
const Parallel_Blkcyclic & px,
const int & naos,
const int & nocc,
const int & nvirt,
std::complex< double > * CvX,
const Parallel_Blkcyclic & pcx )
Here is the call graph for this function:

◆ CvX() [4/4]

void LR::CvX ( const std::complex< double > * C,
const std::complex< double > * X,
const int & naos,
const int & nocc,
const int & nvirt,
std::complex< double > * CvX )
Here is the call graph for this function:

◆ degenerate_pairs()

std::vector< std::pair< int, int > > LR::degenerate_pairs ( const int d)

The $(k,l)$, $k<l$ pairs of a $d$-dimensional multiplet, lexicographically.

This fixes the order assemble_grad_matrix expects its plus argument in, and hence the order the combinations have to be handed to the gradient evaluation in.

Here is the caller graph for this function:

◆ electron_hole_offset()

int LR::electron_hole_offset ( const int state,
const int nk,
const int up_size,
const int down_size,
const int ispin,
const bool openshell )
inline
Here is the caller graph for this function:

◆ evaluate_closed_shell_force()

template<typename T>
std::vector< ModuleBase::matrix > LR::evaluate_closed_shell_force ( const GradientInputs< T > & inputs,
LR_Force< T > & force_terms,
const module_dm::DensityMatrix< T, double > & dm_gs,
const ct::Tensor & Xz,
const ct::Tensor & Z,
const std::vector< double > & omega,
int label_begin,
int ispin,
const WindowResponse< T > & window )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluate_closed_shell_force< double >()

template std::vector< ModuleBase::matrix > LR::evaluate_closed_shell_force< double > ( const GradientInputs< double > & ,
LR_Force< double > & ,
const module_dm::DensityMatrix< double, double > & ,
const ct::Tensor & ,
const ct::Tensor & ,
const std::vector< double > & ,
int ,
int ,
const WindowResponse< double > &  )

◆ evaluate_closed_shell_force< std::complex< double > >()

template std::vector< ModuleBase::matrix > LR::evaluate_closed_shell_force< std::complex< double > > ( const GradientInputs< std::complex< double > > & ,
LR_Force< std::complex< double > > & ,
const module_dm::DensityMatrix< std::complex< double >, double > & ,
const ct::Tensor & ,
const ct::Tensor & ,
const std::vector< double > & ,
int ,
int ,
const WindowResponse< std::complex< double > > &  )
Here is the call graph for this function:

◆ evaluate_open_shell_force()

template<typename T>
std::vector< ModuleBase::matrix > LR::evaluate_open_shell_force ( const GradientInputs< T > & inputs,
LR_Force< T > & force_terms,
const module_dm::DensityMatrix< T, double > & dm_gs,
const ct::Tensor & Xz,
const ct::Tensor & Z,
const std::vector< double > & omega,
int label_begin,
const WindowResponse< T > & window )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluate_open_shell_force< double >()

template std::vector< ModuleBase::matrix > LR::evaluate_open_shell_force< double > ( const GradientInputs< double > & ,
LR_Force< double > & ,
const module_dm::DensityMatrix< double, double > & ,
const ct::Tensor & ,
const ct::Tensor & ,
const std::vector< double > & ,
int ,
const WindowResponse< double > &  )

◆ evaluate_open_shell_force< std::complex< double > >()

template std::vector< ModuleBase::matrix > LR::evaluate_open_shell_force< std::complex< double > > ( const GradientInputs< std::complex< double > > & ,
LR_Force< std::complex< double > > & ,
const module_dm::DensityMatrix< std::complex< double >, double > & ,
const ct::Tensor & ,
const ct::Tensor & ,
const std::vector< double > & ,
int ,
const WindowResponse< std::complex< double > > &  )
Here is the call graph for this function:

◆ find_jt_direction()

JTDirection LR::find_jt_direction ( const std::vector< double > & gflat,
const int ncoord,
const int d )

Find the Jahn-Teller direction: the displacement that splits the multiplet and lowers one branch as fast as possible.

The Jahn-Teller theorem says a degenerate electronic state of a non-linear molecule is unstable against some symmetry-lowering displacement. Finding it is a JOINT optimization over the displacement and the mixing inside the subspace – the two are determined together, which is why it cannot be done one Cartesian axis at a time:

$\min_{\|u\|=1}\lambda_{\min}\big(\sum_a u_a G^{(a)}\big)$.

Written that way it looks like a non-convex problem on the unit sphere in $3N$ dimensions. It is not: since $\lambda_{\min}(M)=\min_{|v|=1}v^\top Mv$, the two minimizations can be swapped, and the inner one over $u$ has a closed form,

$\min_{\|u\|=1}\ u\cdot q(v)=-\|q(v)\|$, where $q(v)_a=v^\top G^{(a)}v$,

leaving

$\min_{\|u\|=1}\lambda_{\min}\big(M(u)\big)=-\max_{\|v\|=1}\|q(v)\|$,
with the optimal direction $u^*=-q(v^*)/\|q(v^*)\|$.

So the search runs over the $d$-dimensional subspace, not over $3N$ coordinates, and it has a plain physical reading: $q(v)$ is the gradient of the mixed state $|v\rangle=\sum_kv_k|X_k\rangle$, so the Jahn-Teller direction is the steepest-descent direction of whichever state in the multiplet has the largest gradient.

Solved by alternating exact minimization – $u\leftarrow-q(v)/|q(v)|$, then $v\leftarrow$ the $\lambda_{\min}$ eigenvector of $M(u)$ – which decreases the joint objective monotonically. The objective is homogeneous of degree one and only piecewise smooth, so several deterministic starting points are tried and the best kept; restarts_agreeing reports how many landed on it, which is the practical signal that the optimum is global.

This is first order only. It gives the DIRECTION; the actual distortion amplitude needs the harmonic term as well ($Q\approx-g/k$), and a norm that means anything physically should be taken in mass-weighted coordinates rather than plain Cartesian ones.

Parameters
gflatthe gradient matrix, flattened as gflat[a * d * d + k * d + l], symmetric in (k, l). The sign convention is the caller's: feeding FORCES ($-\partial\Omega/\partial R$) makes displacement point downhill directly, while feeding gradients makes it point uphill.
ncoord$3N$
dthe multiplet's dimension, must be 2 or 3 (tracking has no dimension cap)
Here is the caller graph for this function:

◆ follow_cross_root()

template<typename T>
void LR::follow_cross_root ( const RootInputs< T > & inputs,
const T * amplitudes,
const int nlocal,
const int nstates,
const int initial_state,
const std::vector< double > & energies,
const double group_threshold,
int & target,
std::vector< T > & previous,
RootBasis< T > & basis,
std::ostream & log )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ follow_cross_root< double >()

template void LR::follow_cross_root< double > ( const RootInputs< double > & ,
const double * ,
int ,
int ,
int ,
const std::vector< double > & ,
double ,
int & ,
std::vector< double > & ,
RootBasis< double > & ,
std::ostream &  )

◆ follow_cross_root< std::complex< double > >()

template void LR::follow_cross_root< std::complex< double > > ( const RootInputs< std::complex< double > > & ,
const std::complex< double > * ,
int ,
int ,
int ,
const std::vector< double > & ,
double ,
int & ,
std::vector< std::complex< double > > & ,
RootBasis< std::complex< double > > & ,
std::ostream &  )
Here is the call graph for this function:

◆ follow_root()

template<typename T>
void LR::follow_root ( const T * Xall,
const int n,
const int nstates,
const int initial_state,
int & target_state,
std::vector< T > & previous,
std::ostream & ofs )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gauss_delta()

double LR::gauss_delta ( const double dfreq_au,
const double eta_au )
inline

◆ get_conj() [1/2]

double LR::get_conj ( const double & x)
Here is the caller graph for this function:

◆ get_conj() [2/2]

std::complex< double > LR::get_conj ( const std::complex< double > & x)

◆ get_velocity_matrix_R()

Velocity_op< std::complex< double > > LR::get_velocity_matrix_R ( const UnitCell & ucell,
const Grid_Driver & gd,
const Parallel_Orbitals & pmat,
const TwoCenterBundle & two_center_bundle )
inline

get the velocity matrix v(R)

Here is the call graph for this function:

◆ group_degenerate_states()

std::vector< std::vector< int > > LR::group_degenerate_states ( const std::vector< double > & omega,
const double thr )

Split states into multiplets of (near-)degenerate excitation energies.

A state joins the group it is within thr of the group's first member, not of its predecessor: chaining on consecutive gaps would let a run of small steps span a spread far larger than thr, and "degenerate" has to mean a bounded total spread.

The threshold alone does NOT decide whether route (A2) applies: an accidental near-degeneracy falls inside any loose threshold, yet there $\Omega$ differs between the states, so they are not one quadratic form and the combinations $X_\pm$ are not eigenvectors. The discriminator is whether both the analytic and the finite-difference side split by the same amount (see section 2(B) of the document above); this function only proposes the candidates.

Parameters
omegaexcitation energies, any order (Ry)
thrmaximum spread inside one multiplet (Ry); <= 0 puts every state alone
Returns
groups of indices into omega, each group ascending, groups ordered by their lowest energy
Here is the caller graph for this function:

◆ gs_dm_channel_factor()

double LR::gs_dm_channel_factor ( const int & nspin)
inline

dm_gs carries the ground-state occupations, at nspin=1 they are 2 for fully occupied bands, so any term that contracts against ONE channel of dm_gs needs this factor. Closed-shell bookkeeping only: the open-shell path sums the two channels explicitly and must not apply it.

Here is the caller graph for this function:

◆ hermitize_2d()

template<typename T>
void LR::hermitize_2d ( T * A,
const Parallel_Blkcyclic & pA )

A <- (A + A^H) / 2 on the 2D layout pA. The Cholesky solvers read only the upper triangle, so any numerical asymmetry of A would otherwise be dropped silently instead of averaged.

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

◆ is_openshell_dm()

template<typename TK>
bool LR::is_openshell_dm ( const module_dm::DensityMatrix< TK, double > & dm)
inline

The LR density matrices ($D^X$, $T+D^Z$, EDM) carry one channel in the closed-shell singlet/triplet algorithm and two independent channels in the open-shell one.

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

◆ lorentz_delta()

double LR::lorentz_delta ( const double dfreq_au,
const double eta_au )
inline
Here is the caller graph for this function:

◆ match_state_group()

GroupMatch LR::match_state_group ( const std::vector< std::complex< double > > & overlap,
const int old_dimension,
const int nstates,
const std::vector< std::vector< int > > & groups,
const std::vector< double > & reference_overlap,
const bool reference_first )
Here is the caller graph for this function:

◆ matdot()

template<typename T>
void LR::matdot ( const T *const vec1,
const T *const vec2,
const Parallel_Blkcyclic & pvec,
T *const dm,
const Parallel_Blkcyclic & pmat )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ matdot< double >()

template void LR::matdot< double > ( const double * ,
const double * ,
const Parallel_Blkcyclic & ,
double * ,
const Parallel_Blkcyclic &  )

◆ matdot< std::complex< double > >()

template void LR::matdot< std::complex< double > > ( const std::complex< double > * ,
const std::complex< double > * ,
const Parallel_Blkcyclic & ,
std::complex< double > * ,
const Parallel_Blkcyclic &  )
Here is the call graph for this function:

◆ mo_overlap_dist() [1/3]

template std::vector< double > LR::mo_overlap_dist ( const std::vector< double > & ,
const std::vector< double > & ,
const std::vector< double > & ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic & ,
int  )

◆ mo_overlap_dist() [2/3]

template std::vector< std::complex< double > > LR::mo_overlap_dist ( const std::vector< std::complex< double > > & ,
const std::vector< std::complex< double > > & ,
const std::vector< std::complex< double > > & ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic & ,
int  )

◆ mo_overlap_dist() [3/3]

template<typename T>
std::vector< T > LR::mo_overlap_dist ( const std::vector< T > & old_coefficients,
const std::vector< T > & ao,
const std::vector< T > & current_coefficients,
const Parallel_Blkcyclic & pc,
const Parallel_Blkcyclic & ps,
const Parallel_Blkcyclic & po,
const int first_band )
Here is the call graph for this function:

◆ multiply_eig_onto_vec()

template<typename T>
void LR::multiply_eig_onto_vec ( const T *const vec,
const double *const eig,
const Parallel_Blkcyclic & pvec,
T *const evec )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pad_amplitudes()

template<typename T>
ct::Tensor LR::pad_amplitudes ( const std::vector< ct::Tensor > & X,
const bool openshell,
const std::vector< Parallel_Blkcyclic > & px,
const std::vector< Parallel_Blkcyclic > & px_z,
const std::vector< int > & nocc,
const std::vector< int > & nvirt,
const int nk,
const int nloc,
const int nloc_z,
const int ispin,
const int istate_begin,
const int nst )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepare_gs_potential()

std::shared_ptr< PotHxcLR > LR::prepare_gs_potential ( const Input_para & input,
const std::string & xc_kernel,
const ModulePW::PW_Basis & rho_basis,
const UnitCell & ucell,
const Charge & chg_gs,
const Parallel_Grid & grid,
const int nspin,
const bool openshell,
const KernelPotentials & prepared )

Reuse LR coefficients for an identical GS functional and sufficient derivative order.

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

◆ prepare_lr_potentials()

KernelPotentials LR::prepare_lr_potentials ( const Input_para & ,
const std::string & xc_kernel,
const ModulePW::PW_Basis & ,
const UnitCell & ,
const Charge & ,
const Parallel_Grid & ,
int nspin,
bool openshell )

Prepare LR potential views. At nspin=1, lr_target_spin selects a single channel; triplets use a polarized kernel evaluated at rho_up=rho_down=rho/2. nspin=2 retains both closed-shell views or the unrestricted spin blocks.

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

◆ print_colfirst()

template<typename T>
void LR::print_colfirst ( const T * ptr,
const std::string & name,
const int & nrow,
const int & ncol )

◆ print_grad_matrix()

void LR::print_grad_matrix ( const std::vector< std::vector< ModuleBase::matrix > > & g,
const std::vector< int > & group,
const UnitCell & ucell,
std::ofstream & ofs )

Print the degenerate-subspace gradient matrix $G_{kl}$, one $d\times d$ block per nuclear coordinate, plus the multiplet average on its diagonal.

The individual diagonal entries are basis-dependent: only the eigenvalues of $M(u)=\sum_a u_aG^{(a)}$ are branch slopes, and only $\operatorname{Tr}G$ is invariant. The average $\operatorname{Tr}G/d$ is printed because it IS a smooth, basis-independent $3N$ vector field – the one a symmetry-constrained relaxation can follow.

Here is the call graph for this function:

◆ print_lr_force()

void LR::print_lr_force ( const std::vector< ModuleBase::matrix > & force,
std::ostream & ofs,
const int istate_begin )
Here is the caller graph for this function:

◆ project_exx() [1/2]

void LR::project_exx ( const double * h,
const double * left,
const double * right,
int naos,
int nleft,
int nright,
double factor,
double * scratch,
double * result )

Project a real, generally nonsymmetric AO matrix against two sets of columns. All matrices are column major. result(right,left) += factor * left^T H right. The caller owns the naos*nleft scratch buffer; inputs and outputs cannot alias.

Here is the call graph for this function:

◆ project_exx() [2/2]

void LR::project_exx ( const std::complex< double > * h,
const std::complex< double > * left,
const std::complex< double > * right,
int naos,
int nleft,
int nright,
double factor,
std::complex< double > * scratch,
std::complex< double > * result )

Complex Bloch projection: result(right,left) += factor * right^H H(k) left. H(k) must contain the positive Bloch phase, conjugate to the probe density. All matrices are column major; scratch has naos*nleft elements.

Here is the call graph for this function:

◆ project_reference_dist() [1/3]

template std::vector< double > LR::project_reference_dist ( const std::vector< double > & ,
const std::vector< double > & ,
const std::vector< double > & ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic &  )

◆ project_reference_dist() [2/3]

template std::vector< std::complex< double > > LR::project_reference_dist ( const std::vector< std::complex< double > > & ,
const std::vector< std::complex< double > > & ,
const std::vector< std::complex< double > > & ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic &  )

◆ project_reference_dist() [3/3]

template<typename T>
std::vector< T > LR::project_reference_dist ( const std::vector< T > & previous,
const std::vector< T > & occupied_overlap,
const std::vector< T > & virtual_overlap,
const Parallel_Blkcyclic & pi,
const Parallel_Blkcyclic & pv,
const Parallel_Blkcyclic & px )
Here is the call graph for this function:

◆ save_mixed_root()

template<typename T>
void LR::save_mixed_root ( const T * Xall,
const int n,
const std::vector< int > & group,
const std::vector< double > & mixing,
std::vector< T > & previous )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ scalapack_cholesky_linear_solver()

template<typename T>
void LR::scalapack_cholesky_linear_solver ( T * A,
T * B,
const Parallel_Blkcyclic & pA,
const Parallel_Blkcyclic & pB )

Solve A Z = B for a Hermitian positive-definite A with ScaLAPACK alone: Cholesky p?potrf A = U^H U, then p?potrs. A is Hermitized as (A + A^H)/2 first. Arguments as in scalapack_linear_solver; A is overwritten by U. Throws on every rank if A is not positive definite (p?potrf's INFO is global).

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

◆ scalapack_cholesky_linear_solver< double >()

template void LR::scalapack_cholesky_linear_solver< double > ( double * ,
double * ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic &  )

◆ scalapack_cholesky_linear_solver< std::complex< double > >()

template void LR::scalapack_cholesky_linear_solver< std::complex< double > > ( std::complex< double > * ,
std::complex< double > * ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic &  )
Here is the call graph for this function:

◆ scalapack_linear_solver()

template<typename T>
void LR::scalapack_linear_solver ( T * A,
T * B,
const Parallel_Blkcyclic & pA,
const Parallel_Blkcyclic & pB )

Solve A Z = B with ScaLAPACK LU (p?gesv), the distributed counterpart of LR_Util::lapack_linear_solver.

Parameters
A[in/out] local block of the n x n matrix on pA; overwritten by its LU factors
B[in/out] local block of the n x nrhs right-hand side on pB; overwritten by Z
Attention
pA and pB must share the BLACS context and the block size.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ scalapack_linear_solver< double >()

template void LR::scalapack_linear_solver< double > ( double * ,
double * ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic &  )

◆ scalapack_linear_solver< std::complex< double > >()

template void LR::scalapack_linear_solver< std::complex< double > > ( std::complex< double > * ,
std::complex< double > * ,
const Parallel_Blkcyclic & ,
const Parallel_Blkcyclic &  )
Here is the call graph for this function:

◆ setup_2center_table()

void LR::setup_2center_table ( TwoCenterBundle & two_center_bundle,
UnitCell & ucell,
const Input_para & input )

Build beta integrals and tabulate two-center integrals after setup_nonlocal_info.

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

◆ setup_nonlocal_info()

void LR::setup_nonlocal_info ( LCAO_Orbitals & orb,
UnitCell & ucell,
const Input_para & input,
const int rank,
std::ofstream & running_log )

Initialize nonlocal projector metadata used by neighbor searches, independently of optical output.

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

◆ sigma_potential_derivative()

double LR::sigma_potential_derivative ( const double * rho_sigma,
const double * sigma_sigma,
const int channel,
const double * density_response,
const double * sigma_response,
const int first_spin,
const int end_spin )
inline

Derivative of the local energy's sigma-channel partial derivative along a density perturbation. Input coefficients are the packed LibXC arrays for ONE grid point; density_response has two components and sigma_response has (uu, ud, dd). The half-open spin range selects one input spin or both. Only structurally active sigma channels are read, avoiding artificial zero-times-NaN contributions. Used by the unrestricted second-order potential contraction.

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

◆ solve_Z_2d()

template<typename T, typename THam>
void LR::solve_Z_2d ( T *const Z,
const T *const R,
const int ld,
const int nstates,
THam & hm,
const int nspin_x,
void(* linear_solver )(T *, T *, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &) )

Distributed dense Z-vector solve: the Hessian (zvec_hessian_2d) and the right-hand side are laid out 2D block-cyclically on the BLACS grid of hm.pX[0], and linear_solver (scalapack_linear_solver or scalapack_cholesky_linear_solver) solves them in place.

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

◆ solve_Z_CG() [1/2]

void LR::solve_Z_CG ( double *const Z,
double * R,
const int & ld,
const int & nstates,
std::function< void(const double *const, double *const)> f_LZ,
const bool test_force )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ solve_Z_CG() [2/2]

void LR::solve_Z_CG ( std::complex< double > *const Z,
std::complex< double > * R,
const int & ld,
const int & nstates,
std::function< void(const std::complex< double > *const, std::complex< double > *const)> f_LZ,
const bool test_force )

◆ solve_Z_lapack()

template<typename T, typename THam>
void LR::solve_Z_lapack ( T *const Z,
const T *const R,
const int & ld,
const int & nstates,
THam & hm,
const int nspin_x,
const bool test_force )
inline

Solve the Z-vector equation with a dense LAPACK solve.

Works for both the closed-shell (nspin_x == 1) and the open-shell (nspin_x == 2, X = [up | down]) layouts: everything is expressed through per-spin segment sizes, which collapse to the single-block case when nspin_x == 1. THam only has to expose matrix(), nk, nocc, nvirt and pX.

Attention
Every rank builds the full Hessian and solves the same system redundantly; see solve_Z_scalapack / solve_Z_scalapack_chol for the distributed solves.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ solve_Z_scalapack()

template<typename T, typename THam>
void LR::solve_Z_scalapack ( T *const Z,
const T *const R,
const int ld,
const int nstates,
THam & hm,
const int nspin_x )
inline

Distributed dense Z-vector solve with ScaLAPACK LU (p?gesv). Same system as solve_Z_lapack, but neither the Hessian nor the factorization is replicated.

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

◆ solve_Z_scalapack_chol()

template<typename T, typename THam>
void LR::solve_Z_scalapack_chol ( T *const Z,
const T *const R,
const int ld,
const int nstates,
THam & hm,
const int nspin_x )
inline

Distributed dense Z-vector solve with a ScaLAPACK Cholesky factorization (p?potrf), about half the flops of the LU in solve_Z_scalapack. Requires a positive-definite orbital Hessian; a factorization failure is reported on every rank.

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

◆ solve_zeq_with()

template<typename T, typename THamL>
void LR::solve_zeq_with ( T *const Z,
T *const R,
const int ld,
const int nstates,
THamL & ops_L,
const int nspin_x,
const std::string & zvec_solver,
const bool test_force )
inline

Run the configured solver (and then, for testing, every supported one). Shared by the closed- and open-shell paths; THamL only needs hPsi plus what solve_Z_lapack reads.

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

◆ split_symmetric_part()

std::vector< double > LR::split_symmetric_part ( const std::vector< double > & gflat,
const int ncoord,
const int d,
const std::vector< double > & mixing,
std::vector< double > & jt_part )

Split a branch gradient into the part shared by the whole multiplet and the part that actually breaks the degeneracy.

$q(v)=\bar q+\big(q(v)-\bar q\big)$ with $\bar q_a=\operatorname{Tr}G^{(a)}/d$. The first term is the multiplet average: totally symmetric, common to every branch, and it only relaxes the geometry without splitting anything. The second is the Jahn-Teller part. The distinction matters when reading the result – at a stationary point of the average surface, which is where an lr_degen_mode = average relaxation ends up, the first term vanishes and the whole direction is Jahn-Teller.

Returns
the symmetric part $\bar q$; jt_part receives $q(v)-\bar q$
Here is the caller graph for this function:

◆ test_dm_diff_H2()

template<typename T>
void LR::test_dm_diff_H2 ( const T * dm,
const psi::Psi< T > & c,
const int nbasis )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_edm_H2()

template<typename T>
void LR::test_edm_H2 ( const T *const edm,
const double *const eig_ks,
const psi::Psi< T > & c,
const int nbasis )
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_multipliers()

std::vector< double > LR::window_multipliers ( const int nocc,
const int nvirt,
const int nactive,
const double * virtual_energies,
const double * X,
const double * AX )
Here is the caller graph for this function:

◆ Z_vector_equation()

template<typename T>
void LR::Z_vector_equation ( const GradientInputs< T > & inputs,
const T *const X,
T *const Z,
const int & nstates,
std::weak_ptr< PotHxcLR > pot,
const std::string & spin_type,
const std::string & in_dir,
const bool openshell,
const std::string & zvec_solver,
const std::vector< std::vector< ct::Tensor > > & window_density )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Z_vector_equation< double >()

template void LR::Z_vector_equation< double > ( const GradientInputs< double > & ,
const double * const ,
double * const ,
const int & ,
std::weak_ptr< PotHxcLR > ,
const std::string & ,
const std::string & ,
const bool ,
const std::string & ,
const std::vector< std::vector< ct::Tensor > > &  )

◆ Z_vector_equation< std::complex< double > >()

template void LR::Z_vector_equation< std::complex< double > > ( const GradientInputs< std::complex< double > > & ,
const std::complex< double > * const ,
std::complex< double > * const ,
const int & ,
std::weak_ptr< PotHxcLR > ,
const std::string & ,
const std::string & ,
const bool ,
const std::string & ,
const std::vector< std::vector< ct::Tensor > > &  )
Here is the call graph for this function:

◆ zvec_full_to_local()

template<typename T, typename THam>
void LR::zvec_full_to_local ( THam & hm,
const int nspin_x,
const T *const full,
T *const local )
inline

Inverse of zvec_local_to_full: pick this rank's entries of the global vector full into the hm.pX layout local. No communication.

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

◆ zvec_global_dim()

template<typename THam>
int LR::zvec_global_dim ( THam & hm,
const int nspin_x )
inline

Global length of one state's Z-vector: $\sum_\sigma n_k n_{occ,\sigma} n_{virt,\sigma}$. THam only has to expose nk, nocc and nvirt.

Here is the caller graph for this function:

◆ zvec_hessian_2d()

template<typename T, typename THam>
std::vector< T > LR::zvec_hessian_2d ( THam & hm,
const int nspin_x,
const int ld,
const Parallel_Blkcyclic & ph )

Build this rank's block of the Z-vector Hessian on the 2D block-cyclic layout ph (n_global x n_global), one column at a time: column g is hm.hPsi of the g-th unit vector, i.e. exactly the operator the CG solve applies. Only O(n_global) is replicated per rank (one column in flight), instead of the O(n_global^2) of hm.matrix(). Collective: every rank walks every column, since hPsi and the gather communicate.

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

◆ zvec_local_to_full()

template<typename T, typename THam>
void LR::zvec_local_to_full ( THam & hm,
const int nspin_x,
const T *const local,
T *const full )
inline

Gather one state's Z-vector from the hm.pX layout (local, length ld) into the global vector full (length zvec_global_dim), replicated on every rank. Collective.

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