mirror of
https://github.com/triqs/dft_tools
synced 2024-10-31 11:13:46 +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:
parent
f3a0d611ff
commit
dcb47d6e27
@ -98,20 +98,21 @@ class readElkfiles:
|
||||
if not(os.path.exists(filename)):
|
||||
raise IOError("File %s does not exist." % filename)
|
||||
for line in open(filename, 'r'):
|
||||
for old, new in to_replace.items():
|
||||
line = line.replace(old, new)
|
||||
# removes the substring after '(' character - if it exists
|
||||
if "(" in line:
|
||||
line = self.split_string2(line,'(')
|
||||
# removes the substring after '+' character - if it exists
|
||||
if "+" in line:
|
||||
line = self.split_string2(line,'+')
|
||||
# removes the substring after '|' character - if it exists
|
||||
if "|" in line:
|
||||
line = self.split_string2(line,'|')
|
||||
#only include lines which have multiple characters
|
||||
if(len(line)>1):
|
||||
yield line.split()
|
||||
if line.strip():
|
||||
for old, new in to_replace.items():
|
||||
line = line.replace(old, new)
|
||||
# removes the substring after '(' character - if it exists
|
||||
if "(" in line:
|
||||
line = self.split_string2(line,'(')
|
||||
# removes the substring after '+' character - if it exists
|
||||
if "+" in line:
|
||||
line = self.split_string2(line,'+')
|
||||
# removes the substring after '|' character - if it exists
|
||||
if "|" in line:
|
||||
line = self.split_string2(line,'|')
|
||||
#only include lines which have multiple characters
|
||||
if(len(line)>1):
|
||||
yield line.split()
|
||||
|
||||
def split_string(self,line):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user