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 Dec 25, 2023
1 parent b8196c5 commit 8e13d7d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions dpdata/abacus/scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
"LATTICE_VECTORS",
"ATOMIC_POSITIONS",
"NUMERICAL_DESCRIPTOR",
"PAW_FILES"
"PAW_FILES",
]


def CheckFile(ifile):
if not os.path.isfile(ifile):
print("Can not find file %s" % ifile)
Expand Down Expand Up @@ -51,28 +52,30 @@ def get_block(lines, keyword, skip=0, nlines=None):
return None
return ret


def get_stru_block(lines, keyword):
# return the block of lines after keyword in STRU file, and skip the blank lines

def clean_comment(line):
return re.split("[#]", line)[0]

ret = []
found = False
for i in range(len(lines)):
if clean_comment(lines[i]).strip() == keyword:
found = True
for j in range(i+1, len(lines)):
if clean_comment(lines[j]).strip() == '':
for j in range(i + 1, len(lines)):
if clean_comment(lines[j]).strip() == "":
continue
elif clean_comment(lines[j]).strip() in ABACUS_STRU_KEYS:
break
else:
ret.append(clean_comment(lines[j]))
ret.append(clean_comment(lines[j]))
if not found:
return None
return ret


def get_geometry_in(fname, inlines):
geometry_path_in = os.path.join(fname, "STRU")
for line in inlines:
Expand Down

0 comments on commit 8e13d7d

Please sign in to comment.