Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
- [mixing\_gg0\_min](#mixing_gg0_min)
- [mixing\_tau](#mixing_tau)
- [mixing\_dftu](#mixing_dftu)
- [mixing\_angle](#mixing_angle)
- [gamma\_only](#gamma_only)
- [printe](#printe)
- [scf\_nmax](#scf_nmax)
Expand Down Expand Up @@ -1015,6 +1016,17 @@ We recommend the following options:
- **Description**: the minimum kerker coefficient
- **Default**: 0.1

### mixing_angle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the description in https://abacus.deepmodeling.com/en/latest/advanced/scf/converge.html#charge-mixing for new mixing parameters.


- **Type**: Real
- **Availability**: Only relevant for non-colinear calculations `nspin=4`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users often set "lspinorb=1" or "noncolin=1" rather than "nspin=4".

- **Description**: Normal broyden mixing can give the converged result for a given magnetic configuration. If one is not interested in the energies of a given magnetic configuration but wants to determine the ground state by relaxing the magnetic moments’ directions, one cannot rely on the standard Broyden mixing algorithm. To enhance the ability to find correct magnetic configuration for non-colinear calculations, ABACUS implements a promising mixing method proposed by J. Phys. Soc. Jpn. 82 (2013) 114706. Here, `mixing_angle` is the angle mixing parameter. In fact, only `mixing_angle=1.0` is implemented currently.
- **<=0**: Normal broyden mixing for $m_{x}, m_{y}, m_{z}$
- **>0**: Angle mixing for the modulus $|m|$ with `mixing_angle=1.0`
- **Default**: -10.0

Note: In new angle mixing, you should set `mixing_beta_mag >> mixing_beta`. The setup of `mixing_beta=0.2`, `mixing_beta_mag=1.0` usually works well.

### mixing_tau

- **Type**: Boolean
Expand Down
1 change: 1 addition & 0 deletions source/module_base/global_variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ double MIXING_GG0 = 1.00;
double MIXING_BETA_MAG = 1.6;
double MIXING_GG0_MAG = 1.00;
double MIXING_GG0_MIN = 0.1;
double MIXING_ANGLE = 0.0;
bool MIXING_TAU = 0;

//==========================================================
Expand Down
1 change: 1 addition & 0 deletions source/module_base/global_variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ extern bool MIXING_TAU;
extern double MIXING_BETA_MAG;
extern double MIXING_GG0_MAG;
extern double MIXING_GG0_MIN;
extern double MIXING_ANGLE;

//==========================================================
// device flags added by denghui
Expand Down
406 changes: 286 additions & 120 deletions source/module_elecstate/module_charge/charge_mixing.cpp

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions source/module_io/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ void Input::Default(void)
mixing_beta_mag = -10.0; // only set when nspin == 2 || nspin == 4
mixing_gg0_mag = 0.0; // defaultly exclude Kerker from mixing magnetic density
mixing_gg0_min = 0.1; // defaultly minimum kerker coefficient
mixing_angle = -10.0; // defaultly close for npsin = 4
mixing_tau = false;
mixing_dftu = false;
//----------------------------------------------------------
Expand Down Expand Up @@ -1256,6 +1257,10 @@ bool Input::Read(const std::string &fn)
{
read_value(ifs, mixing_gg0_min);
}
else if (strcmp("mixing_angle", word) == 0)
{
read_value(ifs, mixing_angle);
}
else if (strcmp("mixing_tau", word) == 0)
{
read_bool(ifs, mixing_tau);
Expand Down Expand Up @@ -3181,6 +3186,7 @@ void Input::Bcast()
Parallel_Common::bcast_double(mixing_beta_mag);
Parallel_Common::bcast_double(mixing_gg0_mag);
Parallel_Common::bcast_double(mixing_gg0_min);
Parallel_Common::bcast_double(mixing_angle);
Parallel_Common::bcast_bool(mixing_tau);
Parallel_Common::bcast_bool(mixing_dftu);

Expand Down
1 change: 1 addition & 0 deletions source/module_io/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ class Input
double mixing_beta_mag;
double mixing_gg0_mag;
double mixing_gg0_min;
double mixing_angle;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add unit-test for this mixing_angle parameter.


bool mixing_tau; // whether to mix tau in mgga
bool mixing_dftu; //whether to mix locale in DFT+U
Expand Down
1 change: 1 addition & 0 deletions source/module_io/input_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ void Input_Conv::Convert(void)
GlobalV::MIXING_BETA_MAG = INPUT.mixing_beta_mag;
GlobalV::MIXING_GG0_MAG = INPUT.mixing_gg0_mag;
GlobalV::MIXING_GG0_MIN = INPUT.mixing_gg0_min;
GlobalV::MIXING_ANGLE = INPUT.mixing_angle;
GlobalV::MIXING_TAU = INPUT.mixing_tau;

ModuleBase::timer::tick("Input_Conv", "Convert");
Expand Down
4 changes: 4 additions & 0 deletions source/module_io/parameter_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,10 @@ bool input_parameters_set(std::map<std::string, InputParameter> input_parameters
{
INPUT.mixing_gg0_min = *static_cast<double*>(input_parameters["mixing_gg0_min"].get());
}
else if (input_parameters.count("mixing_angle") != 0)
{
INPUT.mixing_angle = *static_cast<double*>(input_parameters["mixing_angle"].get());
}
else if (input_parameters.count("mixing_tau") != 0)
{
INPUT.mixing_tau = *static_cast<bool*>(input_parameters["mixing_tau"].get());
Expand Down
1 change: 1 addition & 0 deletions source/module_io/write_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ ModuleBase::GlobalFunc::OUTP(ofs, "out_bandgap", out_bandgap, "if true, print ou
ModuleBase::GlobalFunc::OUTP(ofs, "mixing_beta_mag", mixing_beta_mag, "mixing parameter for magnetic density");
ModuleBase::GlobalFunc::OUTP(ofs, "mixing_gg0_mag", mixing_gg0_mag, "mixing parameter in kerker");
ModuleBase::GlobalFunc::OUTP(ofs, "mixing_gg0_min", mixing_gg0_min, "the minimum kerker coefficient");
ModuleBase::GlobalFunc::OUTP(ofs, "mixing_angle", mixing_angle, "angle mixing parameter for non-colinear calculations");
ModuleBase::GlobalFunc::OUTP(ofs, "mixing_tau", mixing_tau, "whether to mix tau in mGGA calculation");
ModuleBase::GlobalFunc::OUTP(ofs, "mixing_dftu", mixing_dftu, "whether to mix locale in DFT+U calculation");

Expand Down