Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/abinit/abipy into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
gmatteo committed Feb 6, 2024
2 parents daa20e4 + 170508a commit db55c14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion abipy/flowtk/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -2498,7 +2498,11 @@ def make_tarfile(self, name=None, max_filesize=None, exclude_exts=None, exclude_
def any2bytes(s):
"""Convert string or number to memory in bytes."""
if is_string(s):
return int(Memory.from_string(s).to("b"))
# Support for deprecated pymatgen API
try:
mem = int(Memory.from_string(s).to("b"))
except:
mem = int(Memory.from_str(s).to("b"))
else:
return int(s)

Expand Down
6 changes: 5 additions & 1 deletion abipy/flowtk/qadapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ def __init__(self, **kwargs):

# Convert memory to megabytes.
m = str(kwargs.pop("mem_per_node"))
self.mem_per_node = int(Memory.from_str(m).to("Mb"))
# Support for old pymatgen API
try:
self.mem_per_node = int(Memory.from_string(m).to("Mb"))
except:
self.mem_per_node = int(Memory.from_str(m).to("Mb"))

if self.mem_per_node <= 0 or self.sockets_per_node <= 0 or self.cores_per_socket <= 0:
raise ValueError("invalid parameters: %s" % kwargs)
Expand Down

0 comments on commit db55c14

Please sign in to comment.