ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
elecstate::Potential Class Reference

#include <potential_new.h>

Inheritance diagram for elecstate::Potential:
Collaboration diagram for elecstate::Potential:

Public Member Functions

 Potential ()
 Potential (const ModulePW::PW_Basis *rho_basis_in, const ModulePW::PW_Basis *rho_basis_smooth_in, const UnitCell *ucell_in, const ModuleBase::matrix *vloc_in, Structure_Factor *structure_factors_in, surchem *solvent_in, double *etxc_in, double *vtxc_in, VSep *vsep_cell_in=nullptr)
 ~Potential ()
void init_pot (const Charge *const chg)
void pot_register (const std::vector< std::string > &components_list)
void pot_register (const std::vector< std::string > &components_list, const Input_para &input)
void update_from_charge (const Charge *const chg, const UnitCell *const ucell)
void get_vnew (const Charge *chg, ModuleBase::matrix &vnew)
PotBase * get_pot_type (const std::string &pot_type, const Input_para &input, const SccsResume &resume)
bool model_pending () const
bool update_model (int electronic_iteration, double density_residual, std::ostream *log)
void write_corr_iter (std::ostream &output, int level, double residual) const
 sccs_debug output of the SCCS correction.
void sum_sol_energy (double &electrostatic, double &non_electrostatic) const
void sum_sol_force (const UnitCell &cell, ModuleBase::matrix &force) const
const std::vector< double > * find_sol_pot () const
std::vector< SolventGridField > sol_out_fields () const
 Implicit-solvent fields of the registered components, for out_sol.
const TDFieldManager * td_field_manager () const
 Read the shared RT-TDDFT field state.
void set_td_field_manager (const std::shared_ptr< TDFieldManager > &field_manager)
 Inject the shared RT-TDDFT field state before potential setup.
ModuleBase::matrix & get_eff_v ()
const ModuleBase::matrix & get_eff_v () const
double * get_eff_v (int is)
const double * get_eff_v (int is) const
ModuleBase::matrix & get_eff_vofk ()
const ModuleBase::matrix & get_eff_vofk () const
double * get_eff_vofk (int is)
const double * get_eff_vofk (int is) const
ModuleBase::matrix & get_veff_smooth ()
const ModuleBase::matrix & get_veff_smooth () const
ModuleBase::matrix & get_vofk_smooth ()
const ModuleBase::matrix & get_vofk_smooth () const
template<typename FPTYPE>
FPTYPE * get_veff_smooth_data ()
template<typename FPTYPE>
FPTYPE * get_vofk_smooth_data ()
double * get_fixed_v ()
const double * get_fixed_v () const
const ModulePW::PW_Basis * get_rho_basis () const
const UnitCell * get_ucell () const
const ModuleBase::matrix * get_vloc () const
double get_vl_of_0 () const
 get the value of vloc at G=0;
double get_ml_exx_energy () const
 get the ML-EXX energy, avoiding static variable
double pcc_energy_rydberg () const
const std::vector< double > * pcc_electron_potential () const
void add_pcc_force (const UnitCell &cell, ModuleBase::matrix &force) const
template<>
float * get_veff_smooth_data ()
template<>
double * get_veff_smooth_data ()
template<>
float * get_vofk_smooth_data ()
template<>
double * get_vofk_smooth_data ()
Public Member Functions inherited from elecstate::PotBase
 PotBase ()
virtual ~PotBase ()
virtual double get_energy () const
virtual void sol_energy (double &electrostatic, double &non_electrostatic) const
virtual void add_sol_force (const UnitCell &, ModuleBase::matrix &) const
virtual const std::vector< double > * sol_elec_pot () const
virtual void add_sol_fields (std::vector< SolventGridField > &) const

Private Member Functions

void cal_v_eff (const Charge *const chg, const UnitCell *const ucell, ModuleBase::matrix &v_eff) override
void cal_fixed_v (double *vl_pseudo) override
void interpolate_vrs ()
void allocate ()
const PotPcc * pcc_component () const
const PotSccs * sccs_component () const
PotSccs * sccs_component ()
PotBase * make_sccs_pot (const Input_para &input, const SccsResume &resume)
SccsResume get_resume () const

Private Attributes

std::vector< double > v_eff_fixed
ModuleBase::matrix v_eff
ModuleBase::matrix veff_smooth
ModuleBase::matrix vofk_smooth
ModuleBase::matrix v_xc
float * s_veff_smooth = nullptr
float * s_vofk_smooth = nullptr
double * d_veff_smooth = nullptr
double * d_vofk_smooth = nullptr
ModuleBase::matrix vofk_eff
bool fixed_done = false
double * etxc_ = nullptr
double * vtxc_ = nullptr
double vl_of_0 = 0.0
std::vector< PotBase * > components
const UnitCell * ucell_ = nullptr
const ModuleBase::matrix * vloc_ = nullptr
Structure_Factor * structure_factors_ = nullptr
surchem * solvent_ = nullptr
VSep * vsep_cell = nullptr
bool use_gpu_ = false
std::shared_ptr< TDFieldManager > td_field_manager_

Additional Inherited Members

Public Attributes inherited from elecstate::PotBase
bool fixed_mode = 0
bool dynamic_mode = 0
Protected Attributes inherited from elecstate::PotBase
const ModulePW::PW_Basis * rho_basis_ = nullptr
const ModulePW::PW_Basis * rho_basis_smooth_ = nullptr

Detailed Description

Potential is the main class of potentials module, it contains:

  1. Constructors and deconstructor
  2. Func init_pot() a. need istep for update_for_tddft(); b. need Charge for update_from_charge(); c. it will reset fixed_done to false, v_eff_fixed will be calculated; d. it should be called after Charge is initialized; e. it can only be called once in one SCF loop
  3. Func pot_register() and components a. need vector<string> for choose target potentials b. "local", PotLocal introduces local pseudopotential part of potentials; c. "hartree", PotHartree introduces Coulombic interaction of electrons part of potentials; d. "xc", PotXC introduces exchange-correlation including meta-gga part of potentials; e. "surchem", PotSurChem introduces surface chemistry part of potentials; f. "efield", PotEfield introduces electronic field including dipole correction part of potentials; g. "gatefield", PotGate introduces gate field part of potentials;
  4. Func update_from_charge() a. regenerate v_eff b. if Meta-GGA is choosed, it will regenerate vofk_eff
  5. Func update_for_tddft() a. in principle, it should be added to components, but it related to real time(istep) b. it should be called after update_from_charge() as a compensation;
  6. Func get_vnew() a. this function is designed for a special demand:
    1. update etxc and vtxc when SCF converged and
    2. use the final delta_V_eff for calculating force correction
  7. Func write_potential()
  8. Func write_elecstat_pot()
  9. interfaces for v_eff_fixed/v_eff/vofk_eff
  10. Func interpolate_vrs() a. interpolate v_eff on the smooth mesh

Constructor & Destructor Documentation

◆ Potential() [1/2]

elecstate::Potential::Potential ( )
inline
Here is the caller graph for this function:

◆ Potential() [2/2]

elecstate::Potential::Potential ( const ModulePW::PW_Basis * rho_basis_in,
const ModulePW::PW_Basis * rho_basis_smooth_in,
const UnitCell * ucell_in,
const ModuleBase::matrix * vloc_in,
Structure_Factor * structure_factors_in,
surchem * solvent_in,
double * etxc_in,
double * vtxc_in,
VSep * vsep_cell_in = nullptr )
Here is the call graph for this function:

◆ ~Potential()

elecstate::Potential::~Potential ( )

Member Function Documentation

◆ add_pcc_force()

void elecstate::Potential::add_pcc_force ( const UnitCell & cell,
ModuleBase::matrix & force ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ allocate()

void elecstate::Potential::allocate ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cal_fixed_v()

void elecstate::Potential::cal_fixed_v ( double * vl_pseudo)
overrideprivatevirtual

Reimplemented from elecstate::PotBase.

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

◆ cal_v_eff()

void elecstate::Potential::cal_v_eff ( const Charge *const chg,
const UnitCell *const ucell,
ModuleBase::matrix & v_eff )
overrideprivatevirtual

Reimplemented from elecstate::PotBase.

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

◆ find_sol_pot()

const std::vector< double > * elecstate::Potential::find_sol_pot ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_eff_v() [1/4]

ModuleBase::matrix & elecstate::Potential::get_eff_v ( )
inline
Here is the caller graph for this function:

◆ get_eff_v() [2/4]

const ModuleBase::matrix & elecstate::Potential::get_eff_v ( ) const
inline

◆ get_eff_v() [3/4]

double * elecstate::Potential::get_eff_v ( int is)
inline

◆ get_eff_v() [4/4]

const double * elecstate::Potential::get_eff_v ( int is) const
inline

◆ get_eff_vofk() [1/4]

ModuleBase::matrix & elecstate::Potential::get_eff_vofk ( )
inline
Here is the caller graph for this function:

◆ get_eff_vofk() [2/4]

const ModuleBase::matrix & elecstate::Potential::get_eff_vofk ( ) const
inline

◆ get_eff_vofk() [3/4]

double * elecstate::Potential::get_eff_vofk ( int is)
inline

◆ get_eff_vofk() [4/4]

const double * elecstate::Potential::get_eff_vofk ( int is) const
inline

◆ get_fixed_v() [1/2]

double * elecstate::Potential::get_fixed_v ( )
inline
Here is the caller graph for this function:

◆ get_fixed_v() [2/2]

const double * elecstate::Potential::get_fixed_v ( ) const
inline

◆ get_ml_exx_energy()

double elecstate::Potential::get_ml_exx_energy ( ) const

get the ML-EXX energy, avoiding static variable

Returns
E_ML-EXX
Here is the call graph for this function:

◆ get_pot_type()

PotBase * elecstate::Potential::get_pot_type ( const std::string & pot_type,
const Input_para & input,
const SccsResume & resume )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_resume()

SccsResume elecstate::Potential::get_resume ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_rho_basis()

const ModulePW::PW_Basis * elecstate::Potential::get_rho_basis ( ) const
inline

◆ get_ucell()

const UnitCell * elecstate::Potential::get_ucell ( ) const
inline

◆ get_veff_smooth() [1/2]

ModuleBase::matrix & elecstate::Potential::get_veff_smooth ( )
inline
Here is the caller graph for this function:

◆ get_veff_smooth() [2/2]

const ModuleBase::matrix & elecstate::Potential::get_veff_smooth ( ) const
inline

◆ get_veff_smooth_data() [1/3]

template<>
double * elecstate::Potential::get_veff_smooth_data ( )

◆ get_veff_smooth_data() [2/3]

template<>
float * elecstate::Potential::get_veff_smooth_data ( )

◆ get_veff_smooth_data() [3/3]

template<typename FPTYPE>
FPTYPE * elecstate::Potential::get_veff_smooth_data ( )

◆ get_vl_of_0()

double elecstate::Potential::get_vl_of_0 ( ) const
inline

get the value of vloc at G=0;

Returns
vl(0)
Here is the caller graph for this function:

◆ get_vloc()

const ModuleBase::matrix * elecstate::Potential::get_vloc ( ) const
inline

◆ get_vnew()

void elecstate::Potential::get_vnew ( const Charge * chg,
ModuleBase::matrix & vnew )
Here is the call graph for this function:

◆ get_vofk_smooth() [1/2]

ModuleBase::matrix & elecstate::Potential::get_vofk_smooth ( )
inline
Here is the caller graph for this function:

◆ get_vofk_smooth() [2/2]

const ModuleBase::matrix & elecstate::Potential::get_vofk_smooth ( ) const
inline

◆ get_vofk_smooth_data() [1/3]

template<>
double * elecstate::Potential::get_vofk_smooth_data ( )

◆ get_vofk_smooth_data() [2/3]

template<>
float * elecstate::Potential::get_vofk_smooth_data ( )

◆ get_vofk_smooth_data() [3/3]

template<typename FPTYPE>
FPTYPE * elecstate::Potential::get_vofk_smooth_data ( )

◆ init_pot()

void elecstate::Potential::init_pot ( const Charge *const chg)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ interpolate_vrs()

void elecstate::Potential::interpolate_vrs ( void )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_sccs_pot()

PotBase * elecstate::Potential::make_sccs_pot ( const Input_para & input,
const SccsResume & resume )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ model_pending()

bool elecstate::Potential::model_pending ( ) const

True while a component waits to change its model during the SCF (the SCCS delayed start); the state is the same on every rank.

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

◆ pcc_component()

const PotPcc * elecstate::Potential::pcc_component ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pcc_electron_potential()

const std::vector< double > * elecstate::Potential::pcc_electron_potential ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pcc_energy_rydberg()

double elecstate::Potential::pcc_energy_rydberg ( ) const

Results of the registered point-counter-charge (PCC) component, used by the energy, force and output stages; neutral values when PCC is off.

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

◆ pot_register() [1/2]

void elecstate::Potential::pot_register ( const std::vector< std::string > & components_list)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pot_register() [2/2]

void elecstate::Potential::pot_register ( const std::vector< std::string > & components_list,
const Input_para & input )
Here is the call graph for this function:

◆ sccs_component() [1/2]

PotSccs * elecstate::Potential::sccs_component ( )
private
Here is the call graph for this function:

◆ sccs_component() [2/2]

const PotSccs * elecstate::Potential::sccs_component ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_td_field_manager()

void elecstate::Potential::set_td_field_manager ( const std::shared_ptr< TDFieldManager > & field_manager)
inline

Inject the shared RT-TDDFT field state before potential setup.

Parameters
field_managerManager shared with the RT-TDDFT ESolver.

◆ sol_out_fields()

std::vector< SolventGridField > elecstate::Potential::sol_out_fields ( ) const

Implicit-solvent fields of the registered components, for out_sol.

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

◆ sum_sol_energy()

void elecstate::Potential::sum_sol_energy ( double & electrostatic,
double & non_electrostatic ) const
Here is the call graph for this function:

◆ sum_sol_force()

void elecstate::Potential::sum_sol_force ( const UnitCell & cell,
ModuleBase::matrix & force ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ td_field_manager()

const TDFieldManager * elecstate::Potential::td_field_manager ( ) const
inline

Read the shared RT-TDDFT field state.

Here is the caller graph for this function:

◆ update_from_charge()

void elecstate::Potential::update_from_charge ( const Charge *const chg,
const UnitCell *const ucell )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_model()

bool elecstate::Potential::update_model ( int electronic_iteration,
double density_residual,
std::ostream * log )

Called before SCF mixing with the pool-consistent density residual. True only in the iteration in which a component changes its model; log, when not null, receives a one-line notice.

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

◆ write_corr_iter()

void elecstate::Potential::write_corr_iter ( std::ostream & output,
int level,
double residual ) const

sccs_debug output of the SCCS correction.

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

Member Data Documentation

◆ components

std::vector<PotBase*> elecstate::Potential::components
private

◆ d_veff_smooth

double* elecstate::Potential::d_veff_smooth = nullptr
private

◆ d_vofk_smooth

double* elecstate::Potential::d_vofk_smooth = nullptr
private

◆ etxc_

double* elecstate::Potential::etxc_ = nullptr
private

◆ fixed_done

bool elecstate::Potential::fixed_done = false
private

◆ s_veff_smooth

float* elecstate::Potential::s_veff_smooth = nullptr
private

◆ s_vofk_smooth

float* elecstate::Potential::s_vofk_smooth = nullptr
private

◆ solvent_

surchem* elecstate::Potential::solvent_ = nullptr
private

◆ structure_factors_

Structure_Factor* elecstate::Potential::structure_factors_ = nullptr
private

◆ td_field_manager_

std::shared_ptr<TDFieldManager> elecstate::Potential::td_field_manager_
private

◆ ucell_

const UnitCell* elecstate::Potential::ucell_ = nullptr
private

◆ use_gpu_

bool elecstate::Potential::use_gpu_ = false
private

◆ v_eff

ModuleBase::matrix elecstate::Potential::v_eff
private

◆ v_eff_fixed

std::vector<double> elecstate::Potential::v_eff_fixed
private

◆ v_xc

ModuleBase::matrix elecstate::Potential::v_xc
private

◆ veff_smooth

ModuleBase::matrix elecstate::Potential::veff_smooth
private

◆ vl_of_0

double elecstate::Potential::vl_of_0 = 0.0
private

◆ vloc_

const ModuleBase::matrix* elecstate::Potential::vloc_ = nullptr
private

◆ vofk_eff

ModuleBase::matrix elecstate::Potential::vofk_eff
private

◆ vofk_smooth

ModuleBase::matrix elecstate::Potential::vofk_smooth
private

◆ vsep_cell

VSep* elecstate::Potential::vsep_cell = nullptr
private

◆ vtxc_

double* elecstate::Potential::vtxc_ = nullptr
private

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