Skip to content

Commit

Permalink
precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
esoteric-ephemera committed Oct 9, 2024
1 parent 6120b10 commit 44f625a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,3 @@ docs/reference/atomate2.*
*.doctrees*

.ipynb_checkpoints

11 changes: 3 additions & 8 deletions src/atomate2/common/jobs/mpmorph.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,21 @@
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING

import numpy as np
import pandas as pd
from jobflow import Job
from pymatgen.core import Composition, Molecule, Structure
from pymatgen.io.packmol import PackmolBoxGen


_DEFAULT_AVG_VOL_FILE = Path("~/.cache/atomate2").expanduser() / "db_avg_vols.json.gz"
if not _DEFAULT_AVG_VOL_FILE.parents[0].exists():
os.makedirs(_DEFAULT_AVG_VOL_FILE.parents[0],exist_ok=True)
os.makedirs(_DEFAULT_AVG_VOL_FILE.parents[0], exist_ok=True)
_DEFAULT_AVG_VOL_URL = "https://figshare.com/ndownloader/files/49704288"


def _get_average_volumes_file(
chunk_size: int = 2048,
timeout: float = 60
chunk_size: int = 2048, timeout: float = 60
) -> pd.DataFrame:
"""
Retrieve stored average volume data from figshare if needed.
Expand All @@ -45,7 +42,6 @@ def _get_average_volumes_file(
timeout : float = 60
Timeout time in seconds to wait for the request to resolve
"""

if not _DEFAULT_AVG_VOL_FILE.exists():
import requests # type: ignore[import-untyped]

Expand All @@ -54,7 +50,7 @@ def _get_average_volumes_file(
for chunk in stream_data.iter_content(chunk_size=chunk_size):
file.write(chunk)

return pd.read_json(_DEFAULT_AVG_VOL_FILE,orient="split")
return pd.read_json(_DEFAULT_AVG_VOL_FILE, orient="split")


def get_average_volume_from_mp_api(
Expand Down Expand Up @@ -141,7 +137,6 @@ def get_average_volume_from_db_cached(
float
The average volume per atom for the composition.
"""

avg_vols = cache_file or _get_average_volumes_file()

avg_vols = avg_vols[avg_vols["source"] == db_name]
Expand Down

0 comments on commit 44f625a

Please sign in to comment.