Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse the number of valence electrons #575

Merged
merged 2 commits into from Apr 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 13 additions & 6 deletions pyiron/sphinx/base.py
Expand Up @@ -1722,15 +1722,21 @@ def check_conv(line):
if not np.any(["Program exited normally." in line for line in log_file]):
self._job.status.aborted = True
warnings.warn("SPHInX parsing failed; most likely SPHInX crashed.")
main_start = np.where(["Enter Main Loop" in line for line in log_file])[0][
0
]
main_start = np.where([
"Enter Main Loop" in line
for line in log_file]
)[0][0]
log_main = log_file[main_start:]

self._parse_dict["n_valence"] = {log_file[ii-1].split()[1]:int(ll.split('=')[-1])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self._parse_dict["n_valence"] = {
    log_file[ii-1].split()[1]:int(ll.split('=')[-1])
    for ii, ll in enumerate(log_file)
    if ll.startswith('| Z')
}

for ii, ll in enumerate(log_file)
if ll.startswith('| Z')}

def get_partial_log(file_content, start_line, end_line):
start_line = np.where([line == start_line for line in file_content])[0][
0
]
start_line = np.where([
line == start_line
for line in file_content]
)[0][0]
end_line = np.where(
[line == end_line for line in file_content[start_line:]]
)[0][0]
Expand Down Expand Up @@ -1998,6 +2004,7 @@ def to_hdf(self, hdf, force_update=False):
"bands_k_weights",
"bands_eigen_values",
"atom_scf_spins",
"n_valence",
]:
if len(self._parse_dict[k]) > 0:
hdf5_dft[k] = self._parse_dict[k]
Expand Down