Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 26, 2023
1 parent 2cca35a commit 3e95d6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions dpgen/auto_test/lib/abacus.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python3
import os,glob
import glob
import os

import dpdata
import numpy as np
Expand Down Expand Up @@ -315,10 +316,12 @@ def final_stru(abacus_path):
# find the final name by STRU_ION*_D,
# for abacus version < v3.2.2, there has no STRU_ION_D file but has STRU_ION0_D STRU_ION1_D ... STRU_ION10_D ...
# so we need to find the last STRU_ION*_D file
stru_ions = glob.glob(os.path.join(abacus_path, f"OUT.{suffix}/STRU_ION*_D"))
stru_ions = glob.glob(
os.path.join(abacus_path, f"OUT.{suffix}/STRU_ION*_D")
)
if len(stru_ions) > 0:
# sort the file name by the number in the file name
stru_ions.sort(key=lambda x: int(x.split('_')[-2][3:]))
stru_ions.sort(key=lambda x: int(x.split("_")[-2][3:]))
final_stru_ion = os.path.basename(stru_ions[-1])
return f"OUT.{suffix}/{final_stru_ion}"
else:
Expand Down
5 changes: 4 additions & 1 deletion dpgen/data/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,10 @@ def make_scale_ABACUS(jdata):
assert os.path.isfile(pos_src)
else:
try:
from dpgen.auto_test.lib.abacus import final_stru as abacus_final_stru
from dpgen.auto_test.lib.abacus import (
final_stru as abacus_final_stru,
)

pos_src = abacus_final_stru(os.path.join(init_path, ii))
pos_src = os.path.join(init_path, ii, pos_src)
assert os.path.isfile(pos_src)
Expand Down

0 comments on commit 3e95d6a

Please sign in to comment.