Skip to content

Commit c9315ff

Browse files
anyangmlnjzjz
authored andcommitted
Fix: add model_def_script to ZBL (deepmodeling#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 --> (cherry picked from commit f343a3b)
1 parent 9adb190 commit c9315ff

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)