Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: a promising angle mixing method for non-colinear calculations #3356

Merged
merged 12 commits into from
Dec 21, 2023

Conversation

WHUweiqingzhou
Copy link
Collaborator

@WHUweiqingzhou WHUweiqingzhou commented Dec 19, 2023

Linked Issue

Fix #3336. As is mentioned in Issue #3336, 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 ABACUS's ability to find correct magnetic configuration for non-colinear calculations, I implement a promising mixing method proposed by J. Phys. Soc. Jpn. 82 (2013) 114706.
b.t.w, in this PR, I only realize a special case with angle mixing parameter is 1 NOW.

What's changed?

  1. add a new parameter mixing_angle to control if this method is used.
  2. new angle mixing method is actually implemented in mix_rho_real() and mix_rho_recip_new().
  3. add resize_tmp in Kerker and inner_product to corporate with new angle mixing method.
  4. delete Charge_Mixing::Kerker_screen_real_test().
  5. add corresponding docs of angle mixing method.

Notice that:

  1. After test, new angle mixing can give exactly same result with old broyden mixing when old method can find the correct magnectic configuration.
  2. Old broyden mixing sometimes fails to find the correct magnectic configuration. At that time, you can try new method with mixing_angle 1
  3. In new angle mixing, you should set mixing_beta_mag >> mixing_beta, and mixing_beta_mag is around 1.

@WHUweiqingzhou WHUweiqingzhou self-assigned this Dec 20, 2023
@Qianruipku Qianruipku merged commit 4288cc9 into deepmodeling:develop Dec 21, 2023
11 checks passed
Copy link
Collaborator

@dyzheng dyzheng left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution, mixing method for noncollinear spin will be improved with this PR.

@@ -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.

### mixing_angle

- **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".

@@ -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.

@@ -896,10 +1002,13 @@ double Charge_Mixing::inner_product_recip(std::complex<double>* rho1, std::compl
double Charge_Mixing::inner_product_recip_new1(std::complex<double>* rho1, std::complex<double>* rho2)
{
double rnorm = 0.0;
// consider a resize for mixing_angle
int resize_tmp = 1;
if (GlobalV::NSPIN == 4 && GlobalV::MIXING_ANGLE > 0) resize_tmp = 2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I hope you can replace the use of "GlobalV" with local variables or class members in Charge_Mixing code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: more advanced mixing method for non-colinear calculations
3 participants