ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
ModuleESolver::ESolver_LR< T, TR > Class Template Reference

Forward declaration for the linear-response solver. More...

#include <esolver_lr_lcao_tddft.h>

Inheritance diagram for ModuleESolver::ESolver_LR< T, TR >:
Collaboration diagram for ModuleESolver::ESolver_LR< T, TR >:

Classes

struct  MultipletLVC
 The linear vibronic coupling (LVC) data of one degenerate multiplet. More...

Public Member Functions

 ESolver_LR (const Input_para &inp, const std::string &in_dir, const std::string &out_dir, const LRRuntime &runtime)
 ~ESolver_LR ()
virtual void before_all_runners (BaseCell &basecell, const Input_para &inp) override
 input: input, call, basis(LCAO), psi(ground state), elecstate
virtual void runner (BaseCell &basecell, int istep) override
 run energy solver
virtual void after_all_runners (BaseCell &basecell) override
 perform post processing calculations
virtual double cal_energy () override
virtual void cal_force (BaseCell &basecell, ModuleBase::matrix &force) override
 Force on the atoms in the relaxed excited state, F = -d(E_gs + Omega)/dR (Ry/Bohr).
virtual void cal_stress (BaseCell &basecell, ModuleBase::matrix &stress) override
 Not implemented: there is no excited-state stress. cell-relax is rejected at input.
Public Member Functions inherited from ModuleESolver::ESolver_FP
 ESolver_FP ()
virtual ~ESolver_FP ()
Public Member Functions inherited from ModuleESolver::ESolver
 ESolver ()
virtual ~ESolver ()
virtual void others (BaseCell &, const int)

Protected Member Functions

Grid_Driver & gd () const
const TwoCenterBundle & tcb () const
Parallel_Grid & pgrid () const
Structure_Factor & sfac () const
pseudopot_cell_vl & vloc () const
void bind_ground_state_aliases_ ()
 bind the aliases above; ks_ must already be set (or null for the lr path)
void initialize_from_unitcell_ (UnitCell &ucell, const Input_para &inp)
void initialize_from_ks_ (UnitCell &ucell, const Input_para &inp)
 one-time setup from the ground-state solver; ends by calling refresh_from_ks_
void refresh_from_ks_ (UnitCell &ucell)
 re-read everything that depends on the atomic positions, once per ionic step
void setup_relax_target_ ()
void follow_target_state_ (std::ofstream &ofs)
 Compare roots in a common electron-hole basis using exact cross-geometry AO overlap.
int target_ekb_offset_ () const
 index of the relaxed state inside pelec->ekb
void set_gint ()
void fill_z_window_ (const int *desc_src)
ct::Tensor pad_X_to_z_ (const int ispin, const int istate_begin, const int nst) const
void setup_eigenvectors_X ()
 allocate and set the inital value of X
void set_X_initial_guess ()
virtual void read_ks_wfc ()
 read in the ground state wave function, band energy and occupation
void read_ks_chg (Charge &chg)
 read in the ground state charge density
virtual void init_pot (const Charge &chg_gs)
void set_dimension ()
 check the legality of the input parameters
void reset_dim_spin2 ()
 reset nocc, nvirt, npairs after read ground-state wavefunction when nspin=2
void set_parallel_orbitals_band (Parallel_Orbitals &p, const int nbands_in)
 setup Parallel_Orbitals info. beyond Parallel_Blkcyclic
void init_pot_groundstate (const Charge &chg_gs)
 ========================== for gradient calculation =========================
ct::Tensor solve_zvector_eqation (const int ispin, const int nst, const ct::Tensor &Xz, const std::vector< std::vector< ct::Tensor > > &window_density)
 Solve the Z-vector equation for nst independent blocks of Xz.
std::vector< ModuleBase::matrix > cal_force (const int ispin, const int istate_only=-1)
std::vector< ModuleBase::matrix > cal_force_openshell (const int istate_only=-1)
std::vector< ModuleBase::matrix > cal_force_Xz (const int ispin, const ct::Tensor &Xz, const std::vector< double > &omega, const int label_begin)
 Gradients for excitation vectors supplied by the caller, already widened into the Z window – the two functions above are thin wrappers that widen the stored eigenvectors and look up their omega.
std::vector< ModuleBase::matrix > cal_force_openshell_Xz (const ct::Tensor &Xz, const std::vector< double > &omega, const int label_begin)
 open-shell counterpart of cal_force_Xz
void resolve_target_multiplet_ ()
 Fill target_group_ from the excitation energies of the current geometry.
double target_omega_ () const
ModuleBase::matrix cal_lr_force_relax_ (std::ofstream &ofs)
ModuleBase::matrix cal_jt_force_ (const std::vector< ModuleBase::matrix > &diag, std::ofstream &ofs)
 The force of the steepest-descending branch of the target multiplet, i.e. lr_degen_mode = jt.
LR::GradientInputs< T > gradient_inputs_ () const
ct::Tensor pad_group_to_z_ (const int ispin, const std::vector< int > &group) const
void cal_force_and_grad_matrix_ (const int ispin, std::ofstream &ofs)
 Per-state gradients of every state, plus the gradient matrix of each degenerate multiplet when lr_degen_thr asks for it. The single-point entry point.
std::vector< std::vector< ModuleBase::matrix > > cal_grad_matrix_degenerate (const int ispin, const std::vector< int > &group, const std::vector< ModuleBase::matrix > &diag, std::ofstream &ofs)
 The gradient matrix of one degenerate multiplet, $G^{(A\alpha)}_{kl}=\langle X_k|\partial A/\partial R_{A\alpha}|X_l\rangle$.
void test_force ()
module_dm::DensityMatrix< T, double > cal_dm_gs ()
 ground-state density matrix
Protected Member Functions inherited from ModuleESolver::ESolver_FP
virtual void before_scf (UnitCell &ucell, const int istep)
virtual void after_scf (UnitCell &ucell, const int istep, const bool conv_esolver)
virtual void iter_finish (UnitCell &ucell, const int istep, int &iter, bool &conv_esolver)
const vdw::VdwResult * get_vdw_result () const

Protected Attributes

const std::string in_dir
const std::string out_dir
const UnitCell * ucell_ = nullptr
std::vector< double > orb_cutoff_
std::ofstream & ofs_running_
 cached aliases, read once here instead of at every log/print call site below
std::ofstream & ofs_warning_
const int my_rank_
std::unique_ptr< ModuleESolver::ESolver_KS_LCAO< T, TR > > ks_
 the ground-state solver, kept alive across ionic steps (esolver_type = "ks-lr"). Null on the lr path, where the ground state comes from files instead.
Grid_Driver gd_own_
 only used when ks_ is null
TwoCenterBundle two_center_bundle_own_
 only used when ks_ is null
Grid_Driver * gd_ptr_ = nullptr
const TwoCenterBundle * tcb_ptr_ = nullptr
Parallel_Grid * pgrid_ptr_ = nullptr
Structure_Factor * sf_ptr_ = nullptr
pseudopot_cell_vl * locpp_ptr_ = nullptr
std::vector< std::shared_ptr< LR::PotHxcLR > > pot
std::unique_ptr< psi::Psi< T > > psi_ks
 ground state wave function
psi::Psi< T > * psi_ks_all_ = nullptr
 all KS orbitals. On the ks-lr path this aliases the ground-state solver's psi (nk x nbands x nbasis – far too big to copy every ionic step, and only read here); on the lr path it points at psi_ks_all_own_, filled from file.
std::unique_ptr< psi::Psi< T > > psi_ks_all_own_
ModuleBase::matrix eig_ks
 ground state bands, read from the file, or moved from ESolver_FP::pelec.ekb
ModuleBase::matrix eig_ks_all
 all eigenvalues of ground state, read from the file, or moved from ESolver_FP::pelec.ekb
ModuleBase::matrix wg_ks
ModuleBase::matrix wg_ks_all
 occupation numbers of ground state in the [nocc+nvirt] window
std::unique_ptr< elecstate::Potential > pot_gs
 occupation number of all bands of ground state
std::unique_ptr< elecstate::Potential > pot_gs_hartree
double etxc_gs = 0.
 ground-state Hartree potential, only used for test_force
double vtxc_gs = 0.
std::shared_ptr< LR::PotHxcLR > pot_hxc_gs
std::vector< ct::Tensor > X
 used in lr-grad, in the ground-state Hxc gradient term coming from dF/dC
int nloc_per_state = 1
std::vector< int > nocc
 number of occupied orbitals for each spin used in the calculation
int nocc_in = 1
 nocc read from input (adjusted by nelec): max(spin-up, spindown)
int nocc_max = 1
 full occupied count in the largest spin channel
std::vector< int > nvirt
 number of virtual orbitals for each spin used in the calculation
int nvirt_in = 1
 nvirt read from input (adjusted by nelec): min(spin-up, spindown)
int nbands = 2
int nbasis = 2
std::vector< int > npairs
 n_occ*nvirt, the basis size of electron-hole pair representation
int nstates = 1
 how many 2-particle states to be solved
int nspin = 1
int nk = 1
int nupdown = 0
bool openshell = false
std::string xc_kernel
bool ks_initialized_ = false
 whether initialize_from_ks_ has already run
bool exx_owned_ = false
 exx_lri was built here (so its Cs/Vs are ours to refresh)
bool excited_relax_ = false
 driving calculation = relax from an excited state
int target_is_ = 0
 spin block of the relaxed state in X and pelec->ekb
double etot_gs_ = 0.0
 ground-state total energy of the current step (Ry)
ModuleBase::matrix force_gs_
ModuleBase::matrix lr_force_
 The LR part of the excited-state force, -d(Omega)/dR (Ry/Bohr).
int target_state_ = -1
std::vector< T > target_X_prev_
LR::RootBasis< T > target_basis_prev_
std::vector< std::string > spin_types
std::unique_ptr< ModuleGint::GintInfo > gint_info_ = nullptr
Parallel_Blkcyclic paraC_
 variables for parallel distribution of KS orbitals
std::vector< Parallel_Blkcyclic > paraX_
 variables for parallel distribution of excited states
std::unique_ptr< psi::Psi< T > > psi_ks_z_
ModuleBase::matrix eig_ks_z_
Parallel_Blkcyclic paraC_z_
std::vector< Parallel_Blkcyclic > paraX_z_
std::vector< int > nvirt_z_
int nbands_z_ = 0
int nloc_per_state_z_ = 0
Parallel_Orbitals paraMat_
 variables for parallel distribution of matrix in AO representation
Parallel_Orbitals paraMat_all_
LCAO_Orbitals orb_
 numerical atomic orbital data for single-point evaluation
std::vector< std::complex< double > > velocity_mo
 store the velocity matrix elements in MO basis
std::vector< MultipletLVC > multiplet_lvc_
std::vector< int > target_group_
Protected Attributes inherited from ModuleESolver::ESolver_FP
std::unique_ptr< const vdw::VdwResult > vdw_result_
 vdW correction evaluated once for the current ionic configuration.
elecstate::ElecState * pelec = nullptr
 These pointers will be deleted in the free_pointers() function every ion step.
K_Vectors kv
 K points in Brillouin zone.
Charge chr
 Electorn charge density.
ModulePW::PW_Basis * pw_rho = nullptr
ModulePW::PW_Basis * pw_rhod = nullptr
ModulePW::PW_Basis_Big * pw_big = nullptr
 dense grid for USPP
Parallel_Grid Pgrid
 parallel for rho grid
Structure_Factor sf
 Structure factors that used with plane-wave basis set.
pseudopot_cell_vl locpp
 local pseudopotentials
module_charge::Charge_Extra CE
 charge extrapolation method
surchem solvent
 solvent model
bool pw_rho_flag = false
 flag for pw_rho, 0: not initialized, 1: initialized
ModuleBase::TimePoint iter_time
 the start time of scf iteration
Protected Attributes inherited from ModuleESolver::ESolver
const Input_para * inp_ = nullptr
 Bound in before_all_runners; members use inp_->xxx instead of PARAM.inp.xxx.

Additional Inherited Members

Public Attributes inherited from ModuleESolver::ESolver
bool conv_esolver = true
std::string classname

Detailed Description

template<typename T, typename TR = double>
class ModuleESolver::ESolver_LR< T, TR >

Forward declaration for the linear-response solver.

Excited State Solver: Linear Response TDDFT (Tamm Dancoff Approximation).

Constructor & Destructor Documentation

◆ ESolver_LR()

template<typename T, typename TR>
ModuleESolver::ESolver_LR< T, TR >::ESolver_LR ( const Input_para & inp,
const std::string & in_dir,
const std::string & out_dir,
const LRRuntime & runtime )
Here is the call graph for this function:

◆ ~ESolver_LR()

template<typename T, typename TR = double>
ModuleESolver::ESolver_LR< T, TR >::~ESolver_LR ( )
inline

Member Function Documentation

◆ after_all_runners()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::after_all_runners ( BaseCell & cell)
overridevirtual

perform post processing calculations

Reimplemented from ModuleESolver::ESolver_FP.

Reimplemented in ModuleESolver::ESolver_BSE< T, TR >.

Here is the call graph for this function:

◆ before_all_runners()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::before_all_runners ( BaseCell & basecell,
const Input_para & inp )
overridevirtual

input: input, call, basis(LCAO), psi(ground state), elecstate

Reimplemented from ModuleESolver::ESolver_FP.

Reimplemented in ModuleESolver::ESolver_BSE< T, TR >.

Here is the call graph for this function:

◆ bind_ground_state_aliases_()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::bind_ground_state_aliases_ ( )
protected

bind the aliases above; ks_ must already be set (or null for the lr path)

Here is the caller graph for this function:

◆ cal_dm_gs()

template<typename T, typename TR>
module_dm::DensityMatrix< T, double > ModuleESolver::ESolver_LR< T, TR >::cal_dm_gs ( )
protected

ground-state density matrix

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

◆ cal_energy()

template<typename T, typename TR>
double ModuleESolver::ESolver_LR< T, TR >::cal_energy ( )
overridevirtual

Total energy of the excited state being relaxed: E_gs + Omega. Zero outside a relaxation, where nothing consumes it and the old behaviour is kept.

Implements ModuleESolver::ESolver.

Here is the call graph for this function:

◆ cal_force() [1/2]

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::cal_force ( BaseCell & basecell,
ModuleBase::matrix & force )
overridevirtual

Force on the atoms in the relaxed excited state, F = -d(E_gs + Omega)/dR (Ry/Bohr).

Implements ModuleESolver::ESolver.

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

◆ cal_force() [2/2]

template<typename T, typename TR>
std::vector< ModuleBase::matrix > ModuleESolver::ESolver_LR< T, TR >::cal_force ( const int ispin,
const int istate_only = -1 )
protected

Excited-state gradients d(Omega)/dR, one matrix per state solved. istate_only >= 0 restricts it to that one state: geometry relaxation follows a single state, and the Z-vector solve dominates the cost. -1 does all nstates.

Here is the call graph for this function:

◆ cal_force_and_grad_matrix_()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::cal_force_and_grad_matrix_ ( const int ispin,
std::ofstream & ofs )
protected

Per-state gradients of every state, plus the gradient matrix of each degenerate multiplet when lr_degen_thr asks for it. The single-point entry point.

Fills multiplet_lvc_.

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

◆ cal_force_openshell()

template<typename T, typename TR>
std::vector< ModuleBase::matrix > ModuleESolver::ESolver_LR< T, TR >::cal_force_openshell ( const int istate_only = -1)
protected

open-shell (spin-unrestricted) excited-state force: X holds [up | down] and every density matrix has two independent channels

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

◆ cal_force_openshell_Xz()

template<typename T, typename TR>
std::vector< ModuleBase::matrix > ModuleESolver::ESolver_LR< T, TR >::cal_force_openshell_Xz ( const ct::Tensor & Xz,
const std::vector< double > & omega,
const int label_begin )
protected

open-shell counterpart of cal_force_Xz

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

◆ cal_force_Xz()

template<typename T, typename TR>
std::vector< ModuleBase::matrix > ModuleESolver::ESolver_LR< T, TR >::cal_force_Xz ( const int ispin,
const ct::Tensor & Xz,
const std::vector< double > & omega,
const int label_begin )
protected

Gradients for excitation vectors supplied by the caller, already widened into the Z window – the two functions above are thin wrappers that widen the stored eigenvectors and look up their omega.

The blocks of Xz need not be the eigenvectors the Casida diagonalizer returned. Any normalized vector inside a degenerate multiplet is an eigenvector with the same omega, so passing a linear combination is what turns the per-state gradient into the full degenerate-subspace gradient matrix; see cal_grad_matrix_degenerate and grad_degen.h.

Parameters
omegaexcitation energy of each block (Ry); its size sets the block count
label_beginstate index the first block is reported under (labels only)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_grad_matrix_degenerate()

template<typename T, typename TR>
std::vector< std::vector< ModuleBase::matrix > > ModuleESolver::ESolver_LR< T, TR >::cal_grad_matrix_degenerate ( const int ispin,
const std::vector< int > & group,
const std::vector< ModuleBase::matrix > & diag,
std::ofstream & ofs )
protected

The gradient matrix of one degenerate multiplet, $G^{(A\alpha)}_{kl}=\langle X_k|\partial A/\partial R_{A\alpha}|X_l\rangle$.

At a degeneracy no single state has a gradient vector – the branch slopes along a displacement $u$ are the eigenvalues of $\sum_{A\alpha}u_{A\alpha}G^{(A\alpha)}$, whose eigenvectors depend on $u$ – so this whole matrix, not its diagonal, is the first-order information. It is obtained from the polarization identity $G_{kl}=\mathcal F[(X_k{+}X_l)/\sqrt2]-\tfrac12(G_{kk}+G_{ll})$, which needs no new physics. grad_degen.h derives why that is exact.

Parameters
groupstate indices of the multiplet, from LR::group_degenerate_states
diagtheir per-state gradients, i.e. $G_{kk}$, already computed by cal_force
ofslog stream the matrix and the precondition diagnostics are written to
Returns
G[k][l], symmetric, each entry a (nat, 3) force matrix
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_jt_force_()

template<typename T, typename TR>
ModuleBase::matrix ModuleESolver::ESolver_LR< T, TR >::cal_jt_force_ ( const std::vector< ModuleBase::matrix > & diag,
std::ofstream & ofs )
protected

The force of the steepest-descending branch of the target multiplet, i.e. lr_degen_mode = jt.

Assembles the off-diagonal part of the gradient matrix (which average does not need), solves the joint direction/mixing optimization in LR::find_jt_direction, and returns that branch's own force. Once a step has split the multiplet there is no group left and the ordinary single-state path takes over, so the mode is self-limiting.

Parameters
diagthe multiplet's per-state forces, already computed
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_lr_force_relax_()

template<typename T, typename TR>
ModuleBase::matrix ModuleESolver::ESolver_LR< T, TR >::cal_lr_force_relax_ ( std::ofstream & ofs)
protected

The LR half of the force for the current geometry, following whichever surface lr_degen_mode selects. ofs receives the note when that is not a single state.

Here is the call graph for this function:

◆ cal_stress()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::cal_stress ( BaseCell & basecell,
ModuleBase::matrix & stress )
overridevirtual

Not implemented: there is no excited-state stress. cell-relax is rejected at input.

Implements ModuleESolver::ESolver.

Here is the call graph for this function:

◆ fill_z_window_()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::fill_z_window_ ( const int * desc_src)
protected

(re)build the Z window from psi_ks_all_ / eig_ks_all. desc_src describes the source wavefunction's 2D layout; unused (and may be null) in a serial build.

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

◆ follow_target_state_()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::follow_target_state_ ( std::ofstream & ofs)
protected

Compare roots in a common electron-hole basis using exact cross-geometry AO overlap.

Match the old subspace to current energy groups and refresh the single/group references. ofs receives the note when the followed root changes index, and the warning when no current root resembles the previous one.

Here is the call graph for this function:

◆ gd()

template<typename T, typename TR = double>
Grid_Driver & ModuleESolver::ESolver_LR< T, TR >::gd ( ) const
inlineprotected
Here is the caller graph for this function:

◆ gradient_inputs_()

template<typename T, typename TR>
LR::GradientInputs< T > ModuleESolver::ESolver_LR< T, TR >::gradient_inputs_ ( ) const
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_pot()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::init_pot ( const Charge & chg_gs)
protectedvirtual

Reimplemented in ModuleESolver::ESolver_BSE< T, TR >.

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

◆ init_pot_groundstate()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::init_pot_groundstate ( const Charge & chg_gs)
protected

========================== for gradient calculation =========================

========================= excited-state geometry relaxation =========================

11) calculate the structure factor

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

◆ initialize_from_ks_()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::initialize_from_ks_ ( UnitCell & ucell,
const Input_para & inp )
protected

one-time setup from the ground-state solver; ends by calling refresh_from_ks_

Here is the call graph for this function:

◆ initialize_from_unitcell_()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::initialize_from_unitcell_ ( UnitCell & ucell,
const Input_para & inp )
protected

read orbitals and build the interpolation table

Here is the call graph for this function:

◆ pad_group_to_z_()

template<typename T, typename TR>
ct::Tensor ModuleESolver::ESolver_LR< T, TR >::pad_group_to_z_ ( const int ispin,
const std::vector< int > & group ) const
protected

Widen a multiplet's eigenvectors into the Z window, one block each. Members need not be contiguous, so they are padded one at a time.

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

◆ pad_X_to_z_()

template<typename T, typename TR>
ct::Tensor ModuleESolver::ESolver_LR< T, TR >::pad_X_to_z_ ( const int ispin,
const int istate_begin,
const int nst ) const
protected

Widen nst X blocks starting at istate_begin from the X window into the Z window, zero-filling the virtual rows X does not have.

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

◆ pgrid()

template<typename T, typename TR = double>
Parallel_Grid & ModuleESolver::ESolver_LR< T, TR >::pgrid ( ) const
inlineprotected
Here is the caller graph for this function:

◆ read_ks_chg()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::read_ks_chg ( Charge & chg)
protected

read in the ground state charge density

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

◆ read_ks_wfc()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::read_ks_wfc ( )
protectedvirtual

read in the ground state wave function, band energy and occupation

Reimplemented in ModuleESolver::ESolver_BSE< T, TR >.

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

◆ refresh_from_ks_()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::refresh_from_ks_ ( UnitCell & ucell)
protected

re-read everything that depends on the atomic positions, once per ionic step

Here is the call graph for this function:

◆ reset_dim_spin2()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::reset_dim_spin2 ( )
protected

reset nocc, nvirt, npairs after read ground-state wavefunction when nspin=2

Here is the caller graph for this function:

◆ resolve_target_multiplet_()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::resolve_target_multiplet_ ( )
protected

Fill target_group_ from the excitation energies of the current geometry.

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

◆ runner()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::runner ( BaseCell & cell,
int istep )
overridevirtual

run energy solver

Implements ModuleESolver::ESolver.

Reimplemented in ModuleESolver::ESolver_BSE< T, TR >.

Here is the call graph for this function:

◆ set_dimension()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::set_dimension ( )
protected

check the legality of the input parameters

set nocc, nvirt, nbasis, npairs and nstates

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

◆ set_gint()

template<typename T, typename TR = double>
void ModuleESolver::ESolver_LR< T, TR >::set_gint ( )
protected

◆ set_parallel_orbitals_band()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::set_parallel_orbitals_band ( Parallel_Orbitals & p,
const int nbands_in )
protected

setup Parallel_Orbitals info. beyond Parallel_Blkcyclic

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

◆ set_X_initial_guess()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::set_X_initial_guess ( )
protected

global index map between (i,c) and ix

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

◆ setup_eigenvectors_X()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::setup_eigenvectors_X ( )
protected

allocate and set the inital value of X

Here is the call graph for this function:

◆ setup_relax_target_()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::setup_relax_target_ ( )
protected

resolve and validate lr_target_state / lr_target_spin; call once the dimensions (and therefore openshell) are final

Here is the call graph for this function:

◆ sfac()

template<typename T, typename TR = double>
Structure_Factor & ModuleESolver::ESolver_LR< T, TR >::sfac ( ) const
inlineprotected
Here is the caller graph for this function:

◆ solve_zvector_eqation()

template<typename T, typename TR>
ct::Tensor ModuleESolver::ESolver_LR< T, TR >::solve_zvector_eqation ( const int ispin,
const int nst,
const ct::Tensor & Xz,
const std::vector< std::vector< ct::Tensor > > & window_density )
protected

Solve the Z-vector equation for nst independent blocks of Xz.

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

◆ target_ekb_offset_()

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::target_ekb_offset_ ( ) const
inlineprotected

index of the relaxed state inside pelec->ekb

Here is the caller graph for this function:

◆ target_omega_()

template<typename T, typename TR>
double ModuleESolver::ESolver_LR< T, TR >::target_omega_ ( ) const
protected

The excitation energy the relaxation is minimising: the target state's own, or the multiplet average when target_group_ is set.

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

◆ tcb()

template<typename T, typename TR = double>
const TwoCenterBundle & ModuleESolver::ESolver_LR< T, TR >::tcb ( ) const
inlineprotected
Here is the caller graph for this function:

◆ test_force()

template<typename T, typename TR>
void ModuleESolver::ESolver_LR< T, TR >::test_force ( )
protected

========================== test 1: reproduce the force of ground state =========================

======================================= END test 1 ========================================= ========================== test 2: reproduce the DX Hartree term =========================

======================================= END test 2 =========================================

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

◆ vloc()

template<typename T, typename TR = double>
pseudopot_cell_vl & ModuleESolver::ESolver_LR< T, TR >::vloc ( ) const
inlineprotected
Here is the caller graph for this function:

Member Data Documentation

◆ eig_ks

template<typename T, typename TR = double>
ModuleBase::matrix ModuleESolver::ESolver_LR< T, TR >::eig_ks
protected

ground state bands, read from the file, or moved from ESolver_FP::pelec.ekb

ground state eigenvalues in the [nocc+nvirt] window

◆ eig_ks_all

template<typename T, typename TR = double>
ModuleBase::matrix ModuleESolver::ESolver_LR< T, TR >::eig_ks_all
protected

all eigenvalues of ground state, read from the file, or moved from ESolver_FP::pelec.ekb

◆ eig_ks_z_

template<typename T, typename TR = double>
ModuleBase::matrix ModuleESolver::ESolver_LR< T, TR >::eig_ks_z_
protected

◆ etot_gs_

template<typename T, typename TR = double>
double ModuleESolver::ESolver_LR< T, TR >::etot_gs_ = 0.0
protected

ground-state total energy of the current step (Ry)

◆ etxc_gs

template<typename T, typename TR = double>
double ModuleESolver::ESolver_LR< T, TR >::etxc_gs = 0.
protected

ground-state Hartree potential, only used for test_force

◆ excited_relax_

template<typename T, typename TR = double>
bool ModuleESolver::ESolver_LR< T, TR >::excited_relax_ = false
protected

driving calculation = relax from an excited state

◆ exx_owned_

template<typename T, typename TR = double>
bool ModuleESolver::ESolver_LR< T, TR >::exx_owned_ = false
protected

exx_lri was built here (so its Cs/Vs are ours to refresh)

◆ force_gs_

template<typename T, typename TR = double>
ModuleBase::matrix ModuleESolver::ESolver_LR< T, TR >::force_gs_
protected

ground-state force of the current step (Ry/Bohr, F = -dE/dR)

◆ gd_own_

template<typename T, typename TR = double>
Grid_Driver ModuleESolver::ESolver_LR< T, TR >::gd_own_
protected

only used when ks_ is null

◆ gd_ptr_

template<typename T, typename TR = double>
Grid_Driver* ModuleESolver::ESolver_LR< T, TR >::gd_ptr_ = nullptr
protected

◆ gint_info_

template<typename T, typename TR = double>
std::unique_ptr<ModuleGint::GintInfo> ModuleESolver::ESolver_LR< T, TR >::gint_info_ = nullptr
protected

◆ in_dir

template<typename T, typename TR = double>
const std::string ModuleESolver::ESolver_LR< T, TR >::in_dir
protected

◆ ks_

template<typename T, typename TR = double>
std::unique_ptr<ModuleESolver::ESolver_KS_LCAO<T, TR> > ModuleESolver::ESolver_LR< T, TR >::ks_
protected

the ground-state solver, kept alive across ionic steps (esolver_type = "ks-lr"). Null on the lr path, where the ground state comes from files instead.

◆ ks_initialized_

template<typename T, typename TR = double>
bool ModuleESolver::ESolver_LR< T, TR >::ks_initialized_ = false
protected

whether initialize_from_ks_ has already run

◆ locpp_ptr_

template<typename T, typename TR = double>
pseudopot_cell_vl* ModuleESolver::ESolver_LR< T, TR >::locpp_ptr_ = nullptr
protected

◆ lr_force_

template<typename T, typename TR = double>
ModuleBase::matrix ModuleESolver::ESolver_LR< T, TR >::lr_force_
protected

The LR part of the excited-state force, -d(Omega)/dR (Ry/Bohr).

◆ multiplet_lvc_

template<typename T, typename TR = double>
std::vector<MultipletLVC> ModuleESolver::ESolver_LR< T, TR >::multiplet_lvc_
protected

LVC data of every multiplet found at this geometry, rebuilt on each call of cal_force_and_grad_matrix_. Empty unless lr_degen_thr > 0.

◆ my_rank_

template<typename T, typename TR = double>
const int ModuleESolver::ESolver_LR< T, TR >::my_rank_
protected

◆ nbands

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nbands = 2
protected

◆ nbands_z_

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nbands_z_ = 0
protected

◆ nbasis

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nbasis = 2
protected

◆ nk

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nk = 1
protected

◆ nloc_per_state

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nloc_per_state = 1
protected

◆ nloc_per_state_z_

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nloc_per_state_z_ = 0
protected

◆ nocc

template<typename T, typename TR = double>
std::vector<int> ModuleESolver::ESolver_LR< T, TR >::nocc
protected

number of occupied orbitals for each spin used in the calculation

◆ nocc_in

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nocc_in = 1
protected

nocc read from input (adjusted by nelec): max(spin-up, spindown)

◆ nocc_max

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nocc_max = 1
protected

full occupied count in the largest spin channel

◆ npairs

template<typename T, typename TR = double>
std::vector<int> ModuleESolver::ESolver_LR< T, TR >::npairs
protected

n_occ*nvirt, the basis size of electron-hole pair representation

◆ nspin

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nspin = 1
protected

◆ nstates

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nstates = 1
protected

how many 2-particle states to be solved

◆ nupdown

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nupdown = 0
protected

◆ nvirt

template<typename T, typename TR = double>
std::vector<int> ModuleESolver::ESolver_LR< T, TR >::nvirt
protected

number of virtual orbitals for each spin used in the calculation

◆ nvirt_in

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::nvirt_in = 1
protected

nvirt read from input (adjusted by nelec): min(spin-up, spindown)

◆ nvirt_z_

template<typename T, typename TR = double>
std::vector<int> ModuleESolver::ESolver_LR< T, TR >::nvirt_z_
protected

◆ ofs_running_

template<typename T, typename TR = double>
std::ofstream& ModuleESolver::ESolver_LR< T, TR >::ofs_running_
protected

cached aliases, read once here instead of at every log/print call site below

◆ ofs_warning_

template<typename T, typename TR = double>
std::ofstream& ModuleESolver::ESolver_LR< T, TR >::ofs_warning_
protected

◆ openshell

template<typename T, typename TR = double>
bool ModuleESolver::ESolver_LR< T, TR >::openshell = false
protected

◆ orb_

template<typename T, typename TR = double>
LCAO_Orbitals ModuleESolver::ESolver_LR< T, TR >::orb_
protected

numerical atomic orbital data for single-point evaluation

◆ orb_cutoff_

template<typename T, typename TR = double>
std::vector<double> ModuleESolver::ESolver_LR< T, TR >::orb_cutoff_
protected

◆ out_dir

template<typename T, typename TR = double>
const std::string ModuleESolver::ESolver_LR< T, TR >::out_dir
protected

◆ paraC_

template<typename T, typename TR = double>
Parallel_Blkcyclic ModuleESolver::ESolver_LR< T, TR >::paraC_
protected

variables for parallel distribution of KS orbitals

◆ paraC_z_

template<typename T, typename TR = double>
Parallel_Blkcyclic ModuleESolver::ESolver_LR< T, TR >::paraC_z_
protected

◆ paraMat_

template<typename T, typename TR = double>
Parallel_Orbitals ModuleESolver::ESolver_LR< T, TR >::paraMat_
protected

variables for parallel distribution of matrix in AO representation

◆ paraMat_all_

template<typename T, typename TR = double>
Parallel_Orbitals ModuleESolver::ESolver_LR< T, TR >::paraMat_all_
protected

◆ paraX_

template<typename T, typename TR = double>
std::vector<Parallel_Blkcyclic> ModuleESolver::ESolver_LR< T, TR >::paraX_
protected

variables for parallel distribution of excited states

◆ paraX_z_

template<typename T, typename TR = double>
std::vector<Parallel_Blkcyclic> ModuleESolver::ESolver_LR< T, TR >::paraX_z_
protected

◆ pgrid_ptr_

template<typename T, typename TR = double>
Parallel_Grid* ModuleESolver::ESolver_LR< T, TR >::pgrid_ptr_ = nullptr
protected

◆ pot

template<typename T, typename TR = double>
std::vector<std::shared_ptr<LR::PotHxcLR> > ModuleESolver::ESolver_LR< T, TR >::pot
protected

◆ pot_gs

template<typename T, typename TR = double>
std::unique_ptr<elecstate::Potential> ModuleESolver::ESolver_LR< T, TR >::pot_gs
protected

occupation number of all bands of ground state

◆ pot_gs_hartree

template<typename T, typename TR = double>
std::unique_ptr<elecstate::Potential> ModuleESolver::ESolver_LR< T, TR >::pot_gs_hartree
protected

◆ pot_hxc_gs

template<typename T, typename TR = double>
std::shared_ptr<LR::PotHxcLR> ModuleESolver::ESolver_LR< T, TR >::pot_hxc_gs
protected

◆ psi_ks

template<typename T, typename TR = double>
std::unique_ptr<psi::Psi<T> > ModuleESolver::ESolver_LR< T, TR >::psi_ks
protected

ground state wave function

KS orbitals used in the [nocc+nvirt] window

◆ psi_ks_all_

template<typename T, typename TR = double>
psi::Psi<T>* ModuleESolver::ESolver_LR< T, TR >::psi_ks_all_ = nullptr
protected

all KS orbitals. On the ks-lr path this aliases the ground-state solver's psi (nk x nbands x nbasis – far too big to copy every ionic step, and only read here); on the lr path it points at psi_ks_all_own_, filled from file.

◆ psi_ks_all_own_

template<typename T, typename TR = double>
std::unique_ptr<psi::Psi<T> > ModuleESolver::ESolver_LR< T, TR >::psi_ks_all_own_
protected

◆ psi_ks_z_

template<typename T, typename TR = double>
std::unique_ptr<psi::Psi<T> > ModuleESolver::ESolver_LR< T, TR >::psi_ks_z_
protected

◆ sf_ptr_

template<typename T, typename TR = double>
Structure_Factor* ModuleESolver::ESolver_LR< T, TR >::sf_ptr_ = nullptr
protected

◆ spin_types

template<typename T, typename TR = double>
std::vector<std::string> ModuleESolver::ESolver_LR< T, TR >::spin_types
protected

◆ target_basis_prev_

template<typename T, typename TR = double>
LR::RootBasis<T> ModuleESolver::ESolver_LR< T, TR >::target_basis_prev_
protected

◆ target_group_

template<typename T, typename TR = double>
std::vector<int> ModuleESolver::ESolver_LR< T, TR >::target_group_
protected

The multiplet lr_target_state belongs to, or empty when the target is non-degenerate or lr_degen_mode = state. Refreshed every ionic step by resolve_target_multiplet_, and it is what makes cal_energy and the reported gradient describe the same surface.

◆ target_is_

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::target_is_ = 0
protected

spin block of the relaxed state in X and pelec->ekb

◆ target_state_

template<typename T, typename TR = double>
int ModuleESolver::ESolver_LR< T, TR >::target_state_ = -1
protected

The state currently being followed, as an index into X / pelec->ekb. Seeded from lr_target_state on the first ionic step, then re-chosen at every later step by cross-geometry group overlap, then the single/JT reference. Following a fixed INDEX instead is what makes a relaxation fail near a degeneracy: the index always names the n-th lowest root, so as soon as two surfaces cross, "the target" jumps to a different diabatic state and the force is discontinuous. CG assumes a conservative field and cannot recover from that.

◆ target_X_prev_

template<typename T, typename TR = double>
std::vector<T> ModuleESolver::ESolver_LR< T, TR >::target_X_prev_
protected

Previous ionic step's amplitude for the followed state (local part), the reference the overlap is taken against. Empty on the first step.

◆ tcb_ptr_

template<typename T, typename TR = double>
const TwoCenterBundle* ModuleESolver::ESolver_LR< T, TR >::tcb_ptr_ = nullptr
protected

◆ two_center_bundle_own_

template<typename T, typename TR = double>
TwoCenterBundle ModuleESolver::ESolver_LR< T, TR >::two_center_bundle_own_
protected

only used when ks_ is null

◆ ucell_

template<typename T, typename TR = double>
const UnitCell* ModuleESolver::ESolver_LR< T, TR >::ucell_ = nullptr
protected

◆ velocity_mo

template<typename T, typename TR = double>
std::vector<std::complex<double> > ModuleESolver::ESolver_LR< T, TR >::velocity_mo
protected

store the velocity matrix elements in MO basis

◆ vtxc_gs

template<typename T, typename TR = double>
double ModuleESolver::ESolver_LR< T, TR >::vtxc_gs = 0.
protected

◆ wg_ks

template<typename T, typename TR = double>
ModuleBase::matrix ModuleESolver::ESolver_LR< T, TR >::wg_ks
protected

◆ wg_ks_all

template<typename T, typename TR = double>
ModuleBase::matrix ModuleESolver::ESolver_LR< T, TR >::wg_ks_all
protected

occupation numbers of ground state in the [nocc+nvirt] window

◆ X

template<typename T, typename TR = double>
std::vector<ct::Tensor> ModuleESolver::ESolver_LR< T, TR >::X
protected

used in lr-grad, in the ground-state Hxc gradient term coming from dF/dC

Excited state wavefunction (locc, lvirt are local size of nocc and nvirt in each process) size of X: [neq][{nstate, nloc_per_state}], namely:

  • [nspin][{nstates, nk* (locc* lvirt}] for close- shell,
  • [1][{nstates, nk * (locc[0] * lvirt[0]) + nk * (locc[1] * lvirt[1])}] for open-shell

◆ xc_kernel

template<typename T, typename TR = double>
std::string ModuleESolver::ESolver_LR< T, TR >::xc_kernel
protected

The documentation for this class was generated from the following files: