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

Functions

bool run_deltaspin_lambda_loop (const int iter, const double drho, const Input_para &inp)
 Run the inner lambda loop for DeltaSpin method to constrain atomic magnetic moments.
 
void check_deltaspin_oscillation (const int iter, const double drho, Charge_Mixing *p_chgmix, const Input_para &inp)
 Check if SCF oscillation occurs for DeltaSpin method.
 
void iter_init_dftu_pw (const int iter, const int istep, Plus_U &dftu, const void *psi, const ModuleBase::matrix &wg, const UnitCell &ucell, const Input_para &inp)
 
template<typename T , typename Device >
void setup_pot (const int istep, UnitCell &ucell, const K_Vectors &kv, Structure_Factor &sf, elecstate::ElecState *pelec, const Parallel_Grid &para_grid, const Charge &chr, pseudopot_cell_vl &locpp, pseudopot_cell_vnl &ppcell, Plus_U &dftu, VSep *vsep_cell, psi::Psi< T, Device > *kspw_psi, hamilt::HamiltBase *p_hamilt, ModulePW::PW_Basis_K *pw_wfc, const ModulePW::PW_Basis *pw_rhod, const Input_para &inp)
 
void setup_pwrho (UnitCell &ucell, const bool double_grid, bool &pw_rho_flag, ModulePW::PW_Basis *&pw_rho, ModulePW::PW_Basis *&pw_rhod, ModulePW::PW_Basis_Big *&pw_big, const std::string &classname, const Input_para &inp)
 
void teardown_pwrho (bool &pw_rho_flag, const bool double_grid, ModulePW::PW_Basis *&pw_rho, ModulePW::PW_Basis *&pw_rhod)
 
void teardown_pwwfc (ModulePW::PW_Basis_K *&pw_wfc)
 
void setup_pwwfc (const Input_para &inp, const UnitCell &ucell, const ModulePW::PW_Basis &pw_rho, K_Vectors &kv, ModulePW::PW_Basis_K *&pw_wfc)
 
void update_cell_pw (const UnitCell &ucell, pseudopot_cell_vnl &ppcell, const K_Vectors &kv, ModulePW::PW_Basis_K *pw_wfc, const Input_para &inp)
 

Function Documentation

◆ check_deltaspin_oscillation()

void pw::check_deltaspin_oscillation ( const int  iter,
const double  drho,
Charge_Mixing p_chgmix,
const Input_para inp 
)

Check if SCF oscillation occurs for DeltaSpin method.

This function checks if the SCF iteration is oscillating and sets the mixing restart step if oscillation is detected. This is used to increase the precision of magnetization calculation.

Parameters
iterThe current iteration number (1-indexed).
drhoThe current charge density difference.
p_chgmixPointer to the Charge_Mixing object.
inpThe input parameters.

Return if DeltaSpin is not enabled

Get the singleton instance of SpinConstrain

Check if higher magnetization precision is needed

Detect SCF oscillation

If oscillation detected, set mixing restart step for next iteration

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

◆ iter_init_dftu_pw()

void pw::iter_init_dftu_pw ( const int  iter,
const int  istep,
Plus_U dftu,
const void *  psi,
const ModuleBase::matrix wg,
const UnitCell ucell,
const Input_para inp 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_deltaspin_lambda_loop()

bool pw::run_deltaspin_lambda_loop ( const int  iter,
const double  drho,
const Input_para inp 
)

Run the inner lambda loop for DeltaSpin method to constrain atomic magnetic moments.

This function is used in the PW basis SCF iteration to optimize lambda parameters for constraining atomic magnetic moments to target values using the DeltaSpin method.

Parameters
iterThe current iteration number (0-indexed).
drhoThe current charge density difference.
inpThe input parameters.
Returns
true if the solver should be skipped (lambda loop was executed), false otherwise.

Return false if DeltaSpin is not enabled

Get the singleton instance of SpinConstrain

Case 1: Magnetic moments not yet converged and SCF is close to convergence. This is the first time we enter the lambda loop after SCF is nearly converged.

Optimize lambda to get target magnetic moments

Case 2: Magnetic moments already converged in previous iteration. Continue to refine lambda in subsequent SCF iterations.

Default: run the normal solver

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

◆ setup_pot()

template<typename T , typename Device >
void pw::setup_pot ( const int  istep,
UnitCell ucell,
const K_Vectors kv,
Structure_Factor sf,
elecstate::ElecState pelec,
const Parallel_Grid para_grid,
const Charge chr,
pseudopot_cell_vl locpp,
pseudopot_cell_vnl ppcell,
Plus_U dftu,
VSep vsep_cell,
psi::Psi< T, Device > *  kspw_psi,
hamilt::HamiltBase p_hamilt,
ModulePW::PW_Basis_K pw_wfc,
const ModulePW::PW_Basis pw_rhod,
const Input_para inp 
)

0) DFT-1/2 calculations, sep potential need to generate

1) Renew local pseudopotential

2) Symmetrize the charge density (rho)

Symmetry_rho should behind init_scf, because charge should be initialized first. liuyu comment: Symmetry_rho should be located between init_rho and v_of_rho?

3) Calculate the effective potential with rho

liuyu move here 2023-10-09 D in uspp need vloc, thus behind init_scf() calculate the effective coefficient matrix for non-local pseudopotential projectors

4) Onsite projectors

5) Spin-constrained algorithms

6) DFT+U algorithm

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

◆ setup_pwrho()

void pw::setup_pwrho ( UnitCell ucell,
const bool  double_grid,
bool &  pw_rho_flag,
ModulePW::PW_Basis *&  pw_rho,
ModulePW::PW_Basis *&  pw_rhod,
ModulePW::PW_Basis_Big *&  pw_big,
const std::string &  classname,
const Input_para inp 
)

initialie the plane wave basis for rho

for OFDFT calculations

initialize the FFT grid

initialize the double grid (for uspp) if necessary

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

◆ setup_pwwfc()

void pw::setup_pwwfc ( const Input_para inp,
const UnitCell ucell,
const ModulePW::PW_Basis pw_rho,
K_Vectors kv,
ModulePW::PW_Basis_K *&  pw_wfc 
)

setup pw_wfc

new plane wave basis, fft grids, etc.

initialize the number of plane waves for each k point

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

◆ teardown_pwrho()

void pw::teardown_pwrho ( bool &  pw_rho_flag,
const bool  double_grid,
ModulePW::PW_Basis *&  pw_rho,
ModulePW::PW_Basis *&  pw_rhod 
)
Here is the caller graph for this function:

◆ teardown_pwwfc()

void pw::teardown_pwwfc ( ModulePW::PW_Basis_K *&  pw_wfc)
Here is the caller graph for this function:

◆ update_cell_pw()

void pw::update_cell_pw ( const UnitCell ucell,
pseudopot_cell_vnl ppcell,
const K_Vectors kv,
ModulePW::PW_Basis_K pw_wfc,
const Input_para inp 
)
Here is the call graph for this function:
Here is the caller graph for this function: