#include <chg_mix.h>
|
| | Charge_Mixing () |
| | ~Charge_Mixing () |
| void | set_mixing (const MixingConfig &cfg, ModulePW::PW_Basis *rhopw_in, ModulePW::PW_Basis *rhodpw_in, double &omega_in, double &tpiba_in) |
| | Set all private mixing parameters from an aggregated config.
|
| void | close_kerker_gg0 () |
| void | init_mixing () |
| | initialize mixing, including constructing mixing and allocating memory for mixing data
|
| void | mix_rho (Charge *chr) |
| | charge mixing
|
| void | allocate_mixing_uom (int size_uom) |
| | allocate memory of uom_mdata
|
| void | mix_uom (std::vector< double > &uom_in, std::vector< double > &uom_save_in) |
| | DFT+U occupation matrix mixing.
|
| void | mix_reset () |
| | reset mixing, actually we only call init_mixing() to reset mixing instead of this function
|
| void | reset_scf_history (int iter_limit) |
| | Reset restart counters and residual history for an independently limited SCF trial.
|
| void | restart_for_new_model (const int iter) |
| | restart mixing after the potential model changed during the SCF (SCCS delayed start)
|
| const std::string & | get_mixing_mode () const |
| double | get_mixing_beta () const |
| int | get_mixing_ndim () const |
| Base_Mixing::Mixing * | get_mixing () const |
| Base_Mixing::Mixing_Data & | get_dmr_mdata () |
| | mutable access to the real-space density-matrix mixing history
|
| Base_Mixing::Mixing_Data & | get_rho_mdata () |
| | mutable access to the charge-density mixing history
|
| Base_Mixing::Mixing_Data & | get_tau_mdata () |
| | mutable access to the kinetic-energy-density mixing history
|
| const MixingConfig & | get_mixing_config () const |
| | read-only access to the aggregated mixing config set by set_mixing()
|
| void | set_mixing_config (const MixingConfig &cfg) |
| | replace the aggregated mixing config without re-running set_mixing()
|
| bool | if_scf_oscillate (const int iteration, const double drho, const int iternum_used, const double threshold) |
◆ Charge_Mixing()
| Charge_Mixing::Charge_Mixing |
( |
| ) |
|
◆ ~Charge_Mixing()
| Charge_Mixing::~Charge_Mixing |
( |
| ) |
|
◆ allocate_mixing_uom()
| void Charge_Mixing::allocate_mixing_uom |
( |
int | size_uom | ) |
|
allocate memory of uom_mdata
- Parameters
-
| uom_size | size of DFT+U occupation matrix |
◆ close_kerker_gg0()
| void Charge_Mixing::close_kerker_gg0 |
( |
| ) |
|
|
inline |
Disable Kerker screening for subsequent mix_rho calls. Used by the non-separate-loop EXX path (exx_lri_interface.cpp) after EXX convergence: Kerker damping fights the DM update there. The Kerker kernels read cfg_ (immutable INPUT snapshot), so the disable flag must live on Charge_Mixing itself rather than mutating cfg_.
◆ get_dmr_mdata()
◆ get_mixing()
◆ get_mixing_beta()
| double Charge_Mixing::get_mixing_beta |
( |
| ) |
const |
|
inline |
◆ get_mixing_config()
| const MixingConfig & Charge_Mixing::get_mixing_config |
( |
| ) |
const |
|
inline |
read-only access to the aggregated mixing config set by set_mixing()
◆ get_mixing_mode()
| const std::string & Charge_Mixing::get_mixing_mode |
( |
| ) |
const |
|
inline |
◆ get_mixing_ndim()
| int Charge_Mixing::get_mixing_ndim |
( |
| ) |
const |
|
inline |
◆ get_rho_mdata()
mutable access to the charge-density mixing history
Same ownership story as get_dmr_mdata(): the buffer belongs to Charge_Mixing but is driven through Base_Mixing::Mixing, so callers that reset or inspect the history need a handle on it.
◆ get_tau_mdata()
mutable access to the kinetic-energy-density mixing history
◆ if_scf_oscillate()
| bool Charge_Mixing::if_scf_oscillate |
( |
const int | iteration, |
|
|
const double | drho, |
|
|
const int | iternum_used, |
|
|
const double | threshold ) |
Fail fast when set_mixing was skipped: cfg_.scf_nmax is otherwise an indeterminate value, which would resize the history to zero and then write out of bounds (heap corruption instead of a clear error).
◆ init_mixing()
| void Charge_Mixing::init_mixing |
( |
| ) |
|
initialize mixing, including constructing mixing and allocating memory for mixing data
this function should be called at eachiterinit()
Fail fast when set_mixing was skipped: the grid sizes below would otherwise dereference a null pointer.
◆ mix_reset()
| void Charge_Mixing::mix_reset |
( |
| ) |
|
reset mixing, actually we only call init_mixing() to reset mixing instead of this function
◆ mix_rho()
| void Charge_Mixing::mix_rho |
( |
Charge * | chr | ) |
|
charge mixing
- Parameters
-
Fail fast on invalid arguments and a skipped set_mixing: the body dereferences these pointers unconditionally below.
◆ mix_rho_real()
| void Charge_Mixing::mix_rho_real |
( |
Charge * | chr | ) |
|
|
private |
charge mixing for real space
- Parameters
-
◆ mix_rho_recip()
| void Charge_Mixing::mix_rho_recip |
( |
Charge * | chr | ) |
|
|
private |
charge mixing for reciprocal space
- Parameters
-
◆ mix_uom()
| void Charge_Mixing::mix_uom |
( |
std::vector< double > & | uom_in, |
|
|
std::vector< double > & | uom_save_in ) |
DFT+U occupation matrix mixing.
- Parameters
-
| uom_in | output occupation matrix |
| uom_save_in | input occupation matrix |
◆ reset_scf_history()
| void Charge_Mixing::reset_scf_history |
( |
int | iter_limit | ) |
|
Reset restart counters and residual history for an independently limited SCF trial.
◆ restart_for_new_model()
| void Charge_Mixing::restart_for_new_model |
( |
const int | iter | ) |
|
restart mixing after the potential model changed during the SCF (SCCS delayed start)
The drho of earlier iterations belongs to the old model, so the window of if_scf_oscillate also restarts at iteration iter, as after a mixing restart.
◆ set_mixing()
Set all private mixing parameters from an aggregated config.
- Parameters
-
| cfg | mixing parameters and runtime globals (nspin, scf_thr_type, double_grid) |
| rhopw_in | smooth grid |
| rhodpw_in | dense grid when double grid is used, otherwise same as rhopw |
| omega_in | omega for non-linear core correction |
| tpiba_in | 2*pi/beta for non-linear core correction |
◆ set_mixing_config()
| void Charge_Mixing::set_mixing_config |
( |
const MixingConfig & | cfg | ) |
|
|
inline |
replace the aggregated mixing config without re-running set_mixing()
set_mixing() both stores the config and rebuilds the mixing objects. This setter is for callers that need to update the snapshot alone - typically because a derived runtime global (nspin, domag, ...) changed after the mixing objects were already built - and must not disturb the mixing history. Pair it with get_mixing_config() to amend individual fields.
◆ _drho_history
| std::vector<double> Charge_Mixing::_drho_history |
|
private |
Residual history for oscillation detection, sized to the active SCF limit.
◆ cfg_
aggregated mixing config, also holds nspin/scf_thr_type/double_grid
◆ dmr_mdata
Mixing data for real space density matrix.
◆ kerker_disabled_
| bool Charge_Mixing::kerker_disabled_ = false |
|
private |
Runtime override set by close_kerker_gg0(): short-circuits the Kerker screening lambdas in mix_rho_recip/mix_rho_real so the non-separate-loop EXX path can disable Kerker after convergence. Lives here, not in MixingConfig, because cfg_ is an immutable INPUT snapshot consumed by the stateless Kerker kernels.
◆ mixing
Mixing object for charge and kinetic energy.
◆ mixing_highf
The high_frequency part is mixed by plain mixing method.
◆ mixing_restart_count
| int Charge_Mixing::mixing_restart_count = 0 |
the number of restart mixing during SCF
◆ mixing_restart_last
| int Charge_Mixing::mixing_restart_last = 0 |
the label of mixing restart step
◆ mixing_restart_step
| int Charge_Mixing::mixing_restart_step = 0 |
which step to restart mixing during SCF
◆ omega
| double* Charge_Mixing::omega = nullptr |
|
private |
omega for non-linear core correction
◆ rho_mdata
Mixing data for charge density.
◆ rhodpw
dense grid, same as rhopw for ncpp.
◆ rhopw
◆ tau_mdata
Mixing data for kinetic energy density.
◆ tpiba
| double* Charge_Mixing::tpiba = nullptr |
|
private |
2*pi/beta for non-linear core correction
◆ uom_mdata
Mixing data for DFT+U occupation matrix.
The documentation for this class was generated from the following files:
- /home/runner/work/abacus-develop/abacus-develop/source/source_estate/module_charge/chg_mix.h
- /home/runner/work/abacus-develop/abacus-develop/source/source_estate/module_charge/chg_mix.cpp
- /home/runner/work/abacus-develop/abacus-develop/source/source_estate/module_charge/chg_mix_rho.cpp
- /home/runner/work/abacus-develop/abacus-develop/source/source_pw/module_dfpt/unittests/test_dfpt_mocks.cpp