Skip to content

Commit

Permalink
breaking(pt/dp):change env_protection for spin
Browse files Browse the repository at this point in the history
  • Loading branch information
iProzd committed Nov 21, 2024
1 parent 142ac39 commit 862c0e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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
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.
:::

## Spin Loss

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

0 comments on commit 862c0e4

Please sign in to comment.