Skip to content

Commit e5e0644

Browse files
committed
modify grep command to align with ABACUS new output format (for conv)
1 parent 1d1cbec commit e5e0644

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

deepks/iterate/template_abacus.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ def make_run_scf_abacus(systems_train, systems_test=None,
284284
for f in range(nframes):
285285
singletask["command"]=str(f"cd {sys_name[i]}/ABACUS/{f}/ && \
286286
{run_cmd} -n {task_per_node} {abacus_path} > {outlog} 2>{errlog} && \
287-
echo {f}`grep convergence ./OUT.ABACUS/running_scf.log` > conv && \
288-
echo {f}`grep convergence ./OUT.ABACUS/running_scf.log`")
287+
echo {f}`grep -i converge ./OUT.ABACUS/running_scf.log` > conv && \
288+
echo {f}`grep -i converge ./OUT.ABACUS/running_scf.log`")
289289
singletask["task_work_path"]="."
290290
singletask["forward_files"]=[str(f"./{sys_name[i]}/ABACUS/{f}/")]
291291
singletask["backward_files"]=[str(f"./{sys_name[i]}/ABACUS/{f}/")]
@@ -315,8 +315,8 @@ def make_run_scf_abacus(systems_train, systems_test=None,
315315
batch_tasks.append(BatchTask(
316316
cmds=str(f"cd {sys_name[i]}/ABACUS/{f}/ && \
317317
{run_cmd} -n {task_per_node} {abacus_path} > {outlog} 2>{errlog} && \
318-
echo {f}`grep convergence ./OUT.ABACUS/running_scf.log` > conv && \
319-
echo {f}`grep convergence ./OUT.ABACUS/running_scf.log`"),
318+
echo {f}`grep -i converge ./OUT.ABACUS/running_scf.log` > conv && \
319+
echo {f}`grep -i converge ./OUT.ABACUS/running_scf.log`"),
320320
workdir="systems",
321321
forward_files=[str(f"./{sys_name[i]}/ABACUS/{f}/")],
322322
backward_files=[str(f"./{sys_name[i]}/ABACUS/{f}/")]
@@ -405,7 +405,8 @@ def gather_stats_abacus(systems_train, systems_test,
405405
# Check convergence of each frame
406406
with open(f"{sys_train_paths[i]}/ABACUS/{f}/conv","r") as conv_file:
407407
ic=conv_file.read().split()
408-
if "achieved" in ic and "not" not in ic:
408+
ic = [item.strip('#') for item in ic]
409+
if "CONVERGED" in ic and "NOT" not in ic:
409410
conv[(int)(ic[0])]=True
410411

411412
# Energy and eigenvalues of density matrix
@@ -668,7 +669,8 @@ def gather_stats_abacus(systems_train, systems_test,
668669
# Check convergence of each frame
669670
with open(f"{sys_test_paths[i]}/ABACUS/{f}/conv","r") as conv_file:
670671
ic=conv_file.read().split()
671-
if "achieved" in ic and "not" not in ic:
672+
ic = [item.strip('#') for item in ic]
673+
if "CONVERGED" in ic and "NOT" not in ic:
672674
conv[(int)(ic[0])]=True
673675

674676
# Energy and eigenvalues of density matrix

deepks/iterate/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def gather_system_data(nframes,data_dir,ref_dir,out_dir,npy_dict=NPY_DICT,**stat
6464
for f in range(nframes):
6565
with open(f"{data_dir}/{f}/conv", "r") as conv_file:
6666
ic = conv_file.read().split()
67-
if "achieved" in ic and "not" not in ic:
67+
ic = [item.strip('#') for item in ic]
68+
if "CONVERGED" in ic and "NOT" not in ic:
6869
c_list[(int)(ic[0])]=True
6970

7071
for key, dicts in npy_dict["load"].items():

0 commit comments

Comments
 (0)