From 862c0e42bd825a5c83dab1d3aaf62436a528678f Mon Sep 17 00:00:00 2001 From: Duo <50307526+iProzd@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:03:43 +0800 Subject: [PATCH] breaking(pt/dp):change env_protection for spin --- deepmd/pt/model/model/__init__.py | 2 +- doc/model/train-energy-spin.md | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/deepmd/pt/model/model/__init__.py b/deepmd/pt/model/model/__init__.py index da1edb3354..a46909622b 100644 --- a/deepmd/pt/model/model/__init__.py +++ b/deepmd/pt/model/model/__init__.py @@ -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"] diff --git a/doc/model/train-energy-spin.md b/doc/model/train-energy-spin.md index 98e2b603da..1d56d59449 100644 --- a/doc/model/train-energy-spin.md +++ b/doc/model/train-energy-spin.md @@ -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 ` 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 ` 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