Skip to content

Commit

Permalink
feat(fix): add MACE type of interation for Lammps.py; fix potential u…
Browse files Browse the repository at this point in the history
…ndeleted issue in post OP in property_ops.py
  • Loading branch information
ZLI-afk committed Feb 22, 2024
1 parent 180b2cb commit 131618b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions apex/op/property_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class PropsMake(OP):
"""
OP class for making calculation tasks (make property)
"""

def __init__(self):
pass

Expand Down Expand Up @@ -165,7 +166,7 @@ def execute(self, op_in: OPIO) -> OPIO:
shutil.copytree(input_post, './', dirs_exist_ok=True)
else:
os.chdir(input_all)
#src_path = str(input_post) + str(local_path)
# src_path = str(input_post) + str(local_path)
shutil.copytree(src_path, './', dirs_exist_ok=True)

if ("cal_setting" in prop_param
Expand All @@ -187,7 +188,10 @@ def execute(self, op_in: OPIO) -> OPIO:
if inter_type in LAMMPS_INTER_TYPE:
os.chdir(abs_path_to_prop)
inter_files_name = []
inter_files_name.extend([inter_param["model"]])
if type(inter_param["model"]) is str:
inter_files_name = [inter_param["model"]]
elif type(inter_param["model"]) is list:
inter_files_name.extend(inter_param["model"])
for file in inter_files_name:
cmd = f"for kk in task.*; do rm -f $kk/{file}; done"
subprocess.call(cmd, shell=True)
Expand All @@ -200,13 +204,12 @@ def execute(self, op_in: OPIO) -> OPIO:
for ii in copy_dir_list:
shutil.copytree(input_all / ii, ii, dirs_exist_ok=True)
retrieve_path = [Path(ii) for ii in copy_dir_list]
#out_path = Path(cwd) / 'retrieve_pool'
#os.mkdir(out_path)
#shutil.copytree(input_all / path_to_prop,
# out_path = Path(cwd) / 'retrieve_pool'
# os.mkdir(out_path)
# shutil.copytree(input_all / path_to_prop,
# out_path / path_to_prop, dirs_exist_ok=True)

op_out = OPIO({
'retrieve_path': retrieve_path
})
return op_out

1 change: 1 addition & 0 deletions tests/test_lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def test_set_inter_type_func(self):
def test_set_model_param(self):
self.Lammps.set_model_param()
model_param = {
"type": "deepmd",
"model_name": ["frozen_model.pb"],
"param_type": {"Al": 0},
"deepmd_version": "1.1.0",
Expand Down

0 comments on commit 131618b

Please sign in to comment.