@@ -4542,12 +4542,21 @@ def gen_json_schema(multi_task: bool = False) -> str:
45424542
45434543
45444544def _check_dpa3_chg_spin_migration (data : dict [str , Any ]) -> None :
4545- """Detect legacy DPA3 charge/spin configs that packed charge_spin into fparam.
4546-
4547- Prior to the charge_spin decoupling, DPA3 models with add_chg_spin_ebd=True
4548- required numb_fparam=2 on the fitting net (and optionally default_fparam).
4549- After the decoupling, charge/spin is a first-class input and fparam is no
4550- longer used for that purpose. Raise a clear error so users update configs.
4545+ """Warn on likely legacy DPA3 configs that packed charge/spin into fparam.
4546+
4547+ Before the charge_spin decoupling, enabling ``add_chg_spin_ebd`` on DPA3
4548+ required ``numb_fparam=2`` on the fitting net so that charge/spin could be
4549+ carried via ``fparam``. After the decoupling, ``charge_spin`` is a
4550+ first-class input that is fully independent of ``fparam``, so users may
4551+ legitimately combine ``add_chg_spin_ebd`` with any ``numb_fparam`` for
4552+ genuine frame parameters.
4553+
4554+ We cannot determine from the config alone whether a user's ``numb_fparam``
4555+ is legacy (charge/spin in disguise) or genuine (real frame parameters).
4556+ But the combination ``add_chg_spin_ebd=True`` together with
4557+ ``numb_fparam=2`` is the strongest heuristic for the legacy pattern, since
4558+ that is exactly what the old code required. Emit a warning — not an error
4559+ — so users can audit their setup without breaking legitimate combinations.
45514560 """
45524561 model = data .get ("model" , {}) if isinstance (data , dict ) else {}
45534562 if not isinstance (model , dict ):
@@ -4566,12 +4575,16 @@ def _check_dpa3_chg_spin_migration(data: dict[str, Any]) -> None:
45664575 continue
45674576 if not desc .get ("add_chg_spin_ebd" , False ):
45684577 continue
4569- if fitting .get ("numb_fparam" , 0 ) or fitting .get ("default_fparam" ) is not None :
4570- raise ValueError (
4571- "DPA3 `add_chg_spin_ebd=True` no longer uses `fparam` for "
4572- "charge/spin. Remove `numb_fparam`/`default_fparam` from "
4573- "`fitting_net` and provide charge/spin via the new "
4574- "`charge_spin` input or the descriptor's `default_chg_spin`."
4578+ if fitting .get ("numb_fparam" , 0 ) == 2 :
4579+ warnings .warn (
4580+ "DPA3 `add_chg_spin_ebd=True` with `numb_fparam=2` matches the "
4581+ "pre-decoupling pattern where charge/spin was carried via "
4582+ "`fparam`. `charge_spin` is now an independent input, so "
4583+ "`numb_fparam=2` will be treated as two genuine frame "
4584+ "parameters. If you intended to feed charge/spin, remove the "
4585+ "charge/spin part of `fparam` and use the `charge_spin` input "
4586+ "or the descriptor's `default_chg_spin` instead." ,
4587+ stacklevel = 2 ,
45754588 )
45764589
45774590
0 commit comments