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

breaking(pt/dp):change env_protection for spin #4394

Merged
merged 1 commit into from
Nov 22, 2024
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
2 changes: 1 addition & 1 deletion deepmd/pt/model/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def get_spin_model(model_params):
"env_protection" not in model_params["descriptor"]
or model_params["descriptor"]["env_protection"] == 0.0
):
model_params["descriptor"]["env_protection"] = 1e-6
model_params["descriptor"]["env_protection"] = 0.01
iProzd marked this conversation as resolved.
Show resolved Hide resolved
if model_params["descriptor"]["type"] in ["se_e2_a"]:
# only expand sel for se_e2_a
model_params["descriptor"]["sel"] += model_params["descriptor"]["sel"]
Expand Down
8 changes: 8 additions & 0 deletions doc/model/train-energy-spin.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ See `se_e2_a` examples in `$deepmd_source_dir/examples/spin/se_e2_a/input_torch.
List of float values with shape of `ntypes` or `ntypes_spin` or one single float value for all types,
only used when {ref}`use_spin <model/spin[ener_spin]/use_spin>` is True for each atom type.

:::{note}
It should be noted that the spin models in PyTorch/DP are capable of addressing scenarios where the spin approaches zero
(indicating the virtual atom is in close proximity to the real atom) by adjusting the non-zero
{ref}`env_protection <model[standard]/descriptor[se_e2_a]/env_protection>` parameter within the descriptor.
This parameter is set to 0.01 by default in the spin model. It appears that a value of 0.01 is generally sufficient for maintaining model stability.
For systems with nearly zero spin, users can also consider tuning this parameter to potentially enhance stability.
:::
iProzd marked this conversation as resolved.
Show resolved Hide resolved

## Spin Loss

The spin loss function $L$ for training energy is given by
Expand Down