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

Fix: bug of training force and stress with DeePKS #3444

Merged
merged 2 commits into from Jan 9, 2024

Conversation

dyzheng
Copy link
Collaborator

@dyzheng dyzheng commented Jan 4, 2024

When user training DeePKS model with ABACUS, force and stress labels contain two gradient files named "grad_vx.npy" and "grad_vepsl.npy".
These two files are needed by DeePKS-kit but don't affect the self-consistent computation with loading DeePKS model in ABACUS.
Before #3444 , when "cal_stress = 1", the line of " https://github.com/deepmodeling/abacus-develop/blob/v3.5.0/source/module_hamilt_lcao/module_deepks/LCAO_deepks_pdm.cpp#L869 " conflict with the line of "https://github.com/deepmodeling/abacus-develop/blob/v3.5.0/source/module_hamilt_lcao/module_deepks/LCAO_deepks_pdm.cpp#L808" , which will cause severe bug that "grad_vx.npy" and "grad_vepsl.npy" are wrong and convergence of DeePKS model training won't be achieved.

This bug will be fixed after #3444 , I also add checklists in deepks test cases for protecting these code.

for (int iw2l = 0; iw2l < col_indexes.size(); ++iw2l)
{
std::vector<double> nlm1 = this->nlm_save_k[iat][key_1][row_indexes[iw1l]][0];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Plz add a UnitTest to trace similar error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have added check lists in deepks test cases for both multi-k and gamma-only cases.
The UnitTest will be implemented in future PRs.

Copy link
Collaborator

@WHUweiqingzhou WHUweiqingzhou left a comment

Choose a reason for hiding this comment

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

Good Debug!

@dyzheng dyzheng merged commit db4fd5a into deepmodeling:develop Jan 9, 2024
11 checks passed
@wenfei-li
Copy link
Collaborator

I am still not convinced by this pr, will raise an issue about this

@dyzheng dyzheng mentioned this pull request Jan 9, 2024
8 tasks
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.

None yet

3 participants