Skip to content

Commit f343a3b

Browse files
authored
Fix: add model_def_script to ZBL (#4423)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced model definition handling for improved encapsulation and consistency across different model types. - **Bug Fixes** - Ensured that model definition scripts are correctly set to a JSON string representation for all model instances. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent e7ad8dc commit f343a3b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

deepmd/pt/model/model/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def get_zbl_model(model_params):
196196
rmax = model_params["sw_rmax"]
197197
atom_exclude_types = model_params.get("atom_exclude_types", [])
198198
pair_exclude_types = model_params.get("pair_exclude_types", [])
199-
return DPZBLModel(
199+
model = DPZBLModel(
200200
dp_model,
201201
pt_model,
202202
rmin,
@@ -205,6 +205,8 @@ def get_zbl_model(model_params):
205205
atom_exclude_types=atom_exclude_types,
206206
pair_exclude_types=pair_exclude_types,
207207
)
208+
model.model_def_script = json.dumps(model_params)
209+
return model
208210

209211

210212
def _can_be_converted_to_float(value) -> Optional[bool]:

0 commit comments

Comments
 (0)