From 3e95d6ad38ee96772a00fa43157d5e83d26459b8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:17:57 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- dpgen/auto_test/lib/abacus.py | 9 ++++++--- dpgen/data/gen.py | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dpgen/auto_test/lib/abacus.py b/dpgen/auto_test/lib/abacus.py index 0defa7052..34b53af62 100644 --- a/dpgen/auto_test/lib/abacus.py +++ b/dpgen/auto_test/lib/abacus.py @@ -1,5 +1,6 @@ #!/usr/bin/python3 -import os,glob +import glob +import os import dpdata import numpy as np @@ -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: diff --git a/dpgen/data/gen.py b/dpgen/data/gen.py index 80fff3b14..27134ef64 100644 --- a/dpgen/data/gen.py +++ b/dpgen/data/gen.py @@ -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)