3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-22 20:34:38 +01:00

Update readElkfiles.py

During the Elk conversion process, two files, SYMCRYS.OUT and LATTICE.OUT, need to be read. However, after the Elk calculation is completed, there are some blank lines in these files, which leads to recognition failure of readElkfiles.py.  By using line.strip(), non-blank lines can be directly read.
This commit is contained in:
Xiao Jiang 2024-09-04 17:19:56 +08:00 committed by the-hampel
parent b002037ac4
commit fafd625879

View File

@ -98,6 +98,7 @@ class readElkfiles:
if not(os.path.exists(filename)): if not(os.path.exists(filename)):
raise IOError("File %s does not exist." % filename) raise IOError("File %s does not exist." % filename)
for line in open(filename, 'r'): for line in open(filename, 'r'):
if line.strip():
for old, new in to_replace.items(): for old, new in to_replace.items():
line = line.replace(old, new) line = line.replace(old, new)
# removes the substring after '(' character - if it exists # removes the substring after '(' character - if it exists