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

new check_if_bin2xml_routine #210

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/koopmans/workflows/_ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,20 @@ def convert_bin2xml(self):

def check_if_bin2xml_is_complete(self) -> bool:
"""
Checks if the bin2xml conversion was already performed
Checks if the bin2xml conversion was already performed.

For this we first check if the next step is complete, i.e. the decomposition into spherical harmonics and
radial basis functions. If we haven't yet computed the decomposition, we check if this step, i.e. the
conversion to xml, was already performed. This way we can delete the (possibly large) binary and xml files
and only keep the expansion coefficients and still be able to restart the calculation.
"""

# If there are as many xml files as there are bands to solve, the calculation was already completed
return len([name for name in os.listdir(self.dirs['xml']) if os.path.isfile(self.dirs['xml'] / name)]) \
== (self.num_bands_to_extract[0] + self.num_bands_to_extract[1] + 1)
if self.check_if_compute_decomposition_is_complete():
return True
else:
# If there are as many xml files as there are bands to solve, the calculation was already completed
return len([name for name in os.listdir(self.dirs['xml']) if os.path.isfile(self.dirs['xml'] / name)]) \
== (self.num_bands_to_extract[0] + self.num_bands_to_extract[1] + 1)

def compute_decomposition(self):
"""
Expand Down