Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify post_fp_cp2k, adapt to SCF not converged situation. #1562

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions dpgen/generator/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4437,16 +4437,19 @@ def post_fp_cp2k(iter_index, jdata, rfailed=None):
sys_output = glob.glob(os.path.join(work_path, "task.%s.*/output" % ss))
dulinhan marked this conversation as resolved.
Show resolved Hide resolved
sys_output.sort()
tcount += len(sys_output)
all_sys = None
log_file_path = os.path.join(work_path, f"{ss}.fp-fail.log")
all_sys = dpdata.MultiSystems(type_map=jdata["type_map"])
for oo in sys_output:
_sys = dpdata.LabeledSystem(oo, fmt="cp2k/output")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this fmt revert back?

dpgen/dpgen/generator/run.py

Lines 4483 to 4489 in 54e48c6

for oo in sys_output:
_sys = dpdata.LabeledSystem(
oo, fmt="cp2kdata/e_f", type_map=jdata["type_map"]
)
all_sys.append(_sys)
icount += 1

# _sys.check_type_map(type_map = jdata['type_map'])
if all_sys is None:
all_sys = _sys
else:
all_sys.append(_sys)
with open(oo, 'r') as file:
content = file.read()
if 'SCF run NOT converged' in content:
dulinhan marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cp2kdata already checks the convergence.
if the scf is not converged, dpdata will return empty object.
https://github.com/robinzyb/cp2kdata/blob/d74c14cbf7470451af443c706d8479c8b486a68d/cp2kdata/dpdata_plugin.py#L24-L43

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it will. But when using MultiSystems, the empty object will be added into that, for example create an empty "C0H0O0". This will raise error when save the MultiSystems to data.xxx. Maybe we should change the subroutine which you mentioned to skip instead of creating empty object.

with open(log_file_path, 'a') as log_file:
log_file.write(f"Skipping file {oo} due to SCF run NOT converged\n")
continue
_sys = dpdata.LabeledSystem(oo, fmt="cp2kdata/e_f", type_map=jdata["type_map"])
all_sys.append(_sys)
icount += 1

icount += len(all_sys)
if (all_sys is not None) and (len(all_sys) > 0):
sys_data_path = os.path.join(work_path, "data.%s" % ss)
all_sys.to_deepmd_raw(sys_data_path)
Expand Down