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

#include <esolver_ks_pw_tddft.h>

Inheritance diagram for ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >:
Collaboration diagram for ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >:

Public Member Functions

 ESolver_KS_PW_TDDFT ()
 ~ESolver_KS_PW_TDDFT () override=default
void before_all_runners (BaseCell &basecell, const Input_para &inp) override
 Initialize the field, propagation solver and time-step history.
void runner (BaseCell &basecell, const int istep) override
 Run the electronic steps belonging to the current MD step.
Public Member Functions inherited from ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >
 ESolver_KS_PW ()
 ~ESolver_KS_PW ()
double cal_energy () override
 calculate total energy of a given system
void cal_force (BaseCell &basecell, ModuleBase::matrix &force) override
 calcualte forces for the atoms in the given cell
void cal_stress (BaseCell &basecell, ModuleBase::matrix &stress) override
 calcualte stress of given cell
void after_all_runners (BaseCell &basecell) override
 perform post processing calculations
Public Member Functions inherited from ModuleESolver::ESolver_KS
 ESolver_KS ()
 Constructor.
virtual ~ESolver_KS ()
 Deconstructor.
Public Member Functions inherited from ModuleESolver::ESolver_FP
 ESolver_FP ()
virtual ~ESolver_FP ()
Public Member Functions inherited from ModuleESolver::ESolver
 ESolver ()
virtual ~ESolver ()

Protected Member Functions

int scf_iter_limit (const int istep) const override
 Use independent iteration limits for initial-state SCF and propagation.
std::string diag_policy (const int istep) const override
 Use ground-state diagonalization for the initial electronic step.
ESolver_KS::DensityStage density_stage (const int istep, const int iter) const override
 Require an unmixed endpoint prediction before accepting a corrected step.
bool defer_iter_output (const int istep) const override
 Whether KS iterations defer output until the final state is accepted.
void before_scf (UnitCell &ucell, const int istep) override
 Something to do before SCF iterations.
void prepare_init_hamilt (const UnitCell &ucell) override
 Cover shifted projectors and bind endpoint A before the first Hamiltonian application.
void iter_init (UnitCell &ucell, const int istep, const int iter) override
 Print the TDDFT iteration header and initialize the PW iteration.
void hamilt2rho_single (UnitCell &ucell, const int istep, const int iter, const double ethr) override
 Switch between ground-state diagonalization and real-time propagation.
void after_scf (UnitCell &ucell, const int istep, const bool conv_esolver) override
 Save the converged or iteration-limited endpoint for the next propagation step.
Protected Member Functions inherited from ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >
virtual void iter_finish (UnitCell &ucell, const int istep, int &iter, bool &conv_esolver) override
 Something to do after hamilt2rho function in each iter loop.
virtual void others (BaseCell &basecell, const int istep) override
virtual void allocate_hamilt (const UnitCell &ucell)
Protected Member Functions inherited from ModuleESolver::ESolver_KS
bool scf_loop (UnitCell &ucell, int istep, int iter_limit)
 Run SCF iterations without preparing or committing a physical endpoint.
void record_iteration (const UnitCell &ucell, double duration)
 Record an accepted iteration in JSON without changing its convergence status.
void write_iter_bands ()
 Write current band expectations when iterative band output is requested.
void hamilt2rho (UnitCell &ucell, const int istep, const int iter, const double ethr)
Protected Member Functions inherited from ModuleESolver::ESolver_FP
const vdw::VdwResult * get_vdw_result () const

Private Types

using Real = typename GetTypeReal<T>::type

Private Member Functions

void run_prop (UnitCell &cell, int step)
bool advance_interval (UnitCell &cell, int step, int index, int depth, const elecstate::TDFieldState &full, pw::TDElecSnap &accepted, hsolver::TDOrthStats &stats)
void output_field (int step) const
void print_step (const int istep) const
 Print the one-based electronic step header.
void prep_td_step (const int istep)

Private Attributes

std::ofstream & log_
std::unique_ptr< pw::TDPropPW< T, Device > > td_prop_
std::shared_ptr< elecstate::TDFieldManager > td_field_manager_
pw::TDVelPW< Real, Device > vel_
pw::TDSpinPW< Real, Device > spin_
pw::CurrentRequest current_req_
pw::TDHistoryPW< T, Device > history_
double initial_wave_electrons_ = 0.0
double initial_rho_electrons_ = 0.0

Additional Inherited Members

Public Attributes inherited from ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >
Exx_HelperBase * exx_helper
Public Attributes inherited from ModuleESolver::ESolver
bool conv_esolver = true
std::string classname
Protected Types inherited from ModuleESolver::ESolver_KS
enum class  DensityStage { standard , predictor }
 Select whether the density is an endpoint predictor or an SCF iterate. More...
Protected Attributes inherited from ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >
int istep_
Setup_Psi_pw stp
VSep * vsep_cell
Protected Attributes inherited from ModuleESolver::ESolver_KS
hamilt::HamiltBase * p_hamilt = nullptr
 Hamiltonian (base class pointer, actual type determined at runtime).
ModulePW::PW_Basis_K * pw_wfc = nullptr
 PW for wave functions, only used in KSDFT, not in OFDFT.
Charge_Mixing * p_chgmix = nullptr
 Charge mixing method.
pseudopot_cell_vnl ppcell
 nonlocal pseudopotentials
std::unique_ptr< Plus_U_Base > dftu_
std::string basisname
double esolver_KS_ne = 0.0
 esolver_ks_lcao.cpp
double diag_ethr
 number of electrons
double scf_thr
 the threshold for diagonalization
double scf_ene_thr
 scf density threshold
double drho
 scf energy threshold
double hsolver_error
 the difference between rho_in (before HSolver) and rho_out (After HSolver)
double ds_rms_ = -1.0
int maxniter
int niter
 maximum iter steps for scf
bool oscillate_esolver = false
 iter steps actually used in scf
bool scf_nmax_flag = false
bool scf_rerun_ = false
General_Exx_Info general_exx_info_
 General EXX info owned by ESolver, initialized from input parameters.
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.

Member Typedef Documentation

◆ Real

template<typename T, typename Device = base_device::DEVICE_CPU>
using ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::Real = typename GetTypeReal<T>::type
private

Constructor & Destructor Documentation

◆ ESolver_KS_PW_TDDFT()

template<typename T, typename Device>
ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::ESolver_KS_PW_TDDFT ( )

◆ ~ESolver_KS_PW_TDDFT()

template<typename T, typename Device = base_device::DEVICE_CPU>
ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::~ESolver_KS_PW_TDDFT ( )
overridedefault

Member Function Documentation

◆ advance_interval()

template<typename T, typename Device>
bool ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::advance_interval ( UnitCell & cell,
int step,
int index,
int depth,
const elecstate::TDFieldState & full,
pw::TDElecSnap & accepted,
hsolver::TDOrthStats & stats )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ after_scf()

template<typename T, typename Device>
void ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::after_scf ( UnitCell & ucell,
const int istep,
const bool conv_esolver )
overrideprotectedvirtual

Save the converged or iteration-limited endpoint for the next propagation step.

Reimplemented from ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >.

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

◆ before_all_runners()

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

Initialize the field, propagation solver and time-step history.

Reimplemented from ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >.

Here is the call graph for this function:

◆ before_scf()

template<typename T, typename Device>
void ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::before_scf ( UnitCell & ucell,
const int istep )
overrideprotectedvirtual

Something to do before SCF iterations.

Init variables (once the cell has changed)

Init Hamiltonian (cell changed) Operators in HamiltPW should be reallocated once cell changed delete Hamilt if not first scf

Allocate HamiltPW

Setup potentials (local, non-local, spin constraint, DFT-1/2)

Setup EXX helper for Hamiltonian and psi

Reimplemented from ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >.

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

◆ defer_iter_output()

template<typename T, typename Device>
bool ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::defer_iter_output ( const int istep) const
overrideprotectedvirtual

Whether KS iterations defer output until the final state is accepted.

Reimplemented from ModuleESolver::ESolver_KS.

Here is the caller graph for this function:

◆ density_stage()

template<typename T, typename Device>
ESolver_KS::DensityStage ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::density_stage ( const int istep,
const int iter ) const
overrideprotectedvirtual

Require an unmixed endpoint prediction before accepting a corrected step.

Reimplemented from ModuleESolver::ESolver_KS.

◆ diag_policy()

template<typename T, typename Device>
std::string ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::diag_policy ( const int istep) const
overrideprotectedvirtual

Use ground-state diagonalization for the initial electronic step.

Reimplemented from ModuleESolver::ESolver_KS.

Here is the call graph for this function:

◆ hamilt2rho_single()

template<typename T, typename Device>
void ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::hamilt2rho_single ( UnitCell & ucell,
const int istep,
const int iter,
const double ethr )
overrideprotectedvirtual

Switch between ground-state diagonalization and real-time propagation.

Reimplemented from ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >.

Here is the call graph for this function:

◆ iter_init()

template<typename T, typename Device>
void ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::iter_init ( UnitCell & ucell,
const int istep,
const int iter )
overrideprotectedvirtual

Print the TDDFT iteration header and initialize the PW iteration.

Reimplemented from ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >.

Here is the call graph for this function:

◆ output_field()

template<typename T, typename Device>
void ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::output_field ( int step) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prep_td_step()

template<typename T, typename Device>
void ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::prep_td_step ( const int istep)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepare_init_hamilt()

template<typename T, typename Device>
void ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::prepare_init_hamilt ( const UnitCell & ucell)
overrideprotectedvirtual

Cover shifted projectors and bind endpoint A before the first Hamiltonian application.

Reimplemented from ModuleESolver::ESolver_KS_PW< T, base_device::DEVICE_CPU >.

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

◆ print_step()

template<typename T, typename Device>
void ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::print_step ( const int istep) const
private

Print the one-based electronic step header.

Here is the caller graph for this function:

◆ run_prop()

template<typename T, typename Device>
void ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::run_prop ( UnitCell & cell,
int step )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ runner()

template<typename T, typename Device>
void ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::runner ( BaseCell & basecell,
const int istep )
overridevirtual

Run the electronic steps belonging to the current MD step.

Reimplemented from ModuleESolver::ESolver_KS.

Here is the call graph for this function:

◆ scf_iter_limit()

template<typename T, typename Device>
int ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::scf_iter_limit ( const int istep) const
overrideprotectedvirtual

Use independent iteration limits for initial-state SCF and propagation.

Reimplemented from ModuleESolver::ESolver_KS.

Here is the caller graph for this function:

Member Data Documentation

◆ current_req_

template<typename T, typename Device = base_device::DEVICE_CPU>
pw::CurrentRequest ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::current_req_
private

◆ history_

template<typename T, typename Device = base_device::DEVICE_CPU>
pw::TDHistoryPW<T, Device> ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::history_
private

◆ initial_rho_electrons_

template<typename T, typename Device = base_device::DEVICE_CPU>
double ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::initial_rho_electrons_ = 0.0
private

◆ initial_wave_electrons_

template<typename T, typename Device = base_device::DEVICE_CPU>
double ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::initial_wave_electrons_ = 0.0
private

◆ log_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::ofstream& ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::log_
private

◆ spin_

template<typename T, typename Device = base_device::DEVICE_CPU>
pw::TDSpinPW<Real, Device> ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::spin_
private

◆ td_field_manager_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::shared_ptr<elecstate::TDFieldManager> ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::td_field_manager_
private

◆ td_prop_

template<typename T, typename Device = base_device::DEVICE_CPU>
std::unique_ptr<pw::TDPropPW<T, Device> > ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::td_prop_
private

◆ vel_

template<typename T, typename Device = base_device::DEVICE_CPU>
pw::TDVelPW<Real, Device> ModuleESolver::ESolver_KS_PW_TDDFT< T, Device >::vel_
private

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