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

Refactor atoms handling #1000

Merged
merged 13 commits into from
Sep 27, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Changed

- Pydantic field type validation has been improved.
- Moved `quacc.utils.atoms`/`.slabs`/`.defects` into `quacc.atoms.core`/`.slabs`/`.defects`
- Moved `quacc.custodian` to `quacc.calculators.custodian`
- Moved `quacc.utils.thermo.ideal_gas` to `quacc.builders.thermo.build_ideal_gas`
- Renamed `quacc.schemas.ase.summarize_thermo` to `quacc.schemas.ase.summarize_igt_thermo`
Expand Down
1 change: 1 addition & 0 deletions src/quacc/atoms/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tools for handling and manipulating Atoms objects"""
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/quacc/utils/slabs.py → src/quacc/atoms/slabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pymatgen.core.surface import Slab, center_slab, generate_all_slabs
from pymatgen.io.ase import AseAtomsAdaptor

from quacc.utils.atoms import copy_atoms
from quacc.atoms.core import copy_atoms

if TYPE_CHECKING:
from pymatgen.core import Structure
Expand Down
2 changes: 1 addition & 1 deletion src/quacc/calculators/vasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from pymatgen.symmetry.bandstructure import HighSymmKpath

from quacc import SETTINGS
from quacc.atoms.core import check_is_metal
from quacc.calculators.custodian import vasp as custodian_vasp
from quacc.runners.prep import set_magmoms
from quacc.utils.atoms import check_is_metal
from quacc.utils.files import load_yaml_calc

if TYPE_CHECKING:
Expand Down
4 changes: 2 additions & 2 deletions src/quacc/recipes/emt/defects.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from pymatgen.analysis.defects.generators import VacancyGenerator

from quacc import fetch_atoms, flow, job, subflow
from quacc.atoms.defects import make_defects_from_bulk
from quacc.recipes.emt.core import relax_job, static_job
from quacc.utils.defects import make_defects_from_bulk

if TYPE_CHECKING:
from ase import Atoms
Expand Down Expand Up @@ -57,7 +57,7 @@ def bulk_to_defects_flow(
defect_charge
Charge state of the defect
make_defects_kwargs
Keyword arguments to pass to [quacc.utils.defects.make_defects_from_bulk][]
Keyword arguments to pass to [quacc.atoms.defects.make_defects_from_bulk][]
run_static
Whether to run the static calculation.
defect_relax_kwargs
Expand Down
4 changes: 2 additions & 2 deletions src/quacc/recipes/emt/slabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from typing import TYPE_CHECKING

from quacc import fetch_atoms, flow, job, subflow
from quacc.atoms.slabs import make_slabs_from_bulk
from quacc.recipes.emt.core import relax_job, static_job
from quacc.utils.slabs import make_slabs_from_bulk

if TYPE_CHECKING:
from ase import Atoms
Expand Down Expand Up @@ -37,7 +37,7 @@ def bulk_to_slabs_flow(
the value
make_slabs_kwargs
Additional keyword arguments to pass to
[quacc.utils.slabs.make_slabs_from_bulk][]
[quacc.atoms.slabs.make_slabs_from_bulk][]
run_static
Whether to run the static calculation.
slab_relax_kwargs
Expand Down
6 changes: 3 additions & 3 deletions src/quacc/recipes/vasp/slabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from typing import TYPE_CHECKING

from quacc import fetch_atoms, flow, job, subflow
from quacc.atoms.slabs import make_adsorbate_structures, make_slabs_from_bulk
from quacc.recipes.vasp.core import _base_job
from quacc.utils.slabs import make_adsorbate_structures, make_slabs_from_bulk

if TYPE_CHECKING:
from ase import Atoms
Expand Down Expand Up @@ -168,7 +168,7 @@ def bulk_to_slabs_flow(
Atoms object or a dictionary with the key "atoms" and an Atoms object as
the value
make_slabs_kwargs
Additional keyword arguments to pass to [quacc.utils.slabs.make_slabs_from_bulk][]
Additional keyword arguments to pass to [quacc.atoms.slabs.make_slabs_from_bulk][]
run_static
Whether to run the static calculation.
slab_relax_kwargs
Expand Down Expand Up @@ -233,7 +233,7 @@ def slab_to_ads_flow(
adsorbate
Atoms object for the adsorbate.
make_ads_kwargs
Additional keyword arguments to pass to [quacc.utils.slabs.make_adsorbate_structures][]
Additional keyword arguments to pass to [quacc.atoms.slabs.make_adsorbate_structures][]
run_static
Whether to run the static calculation.
slab_relax_kwargs
Expand Down
2 changes: 1 addition & 1 deletion src/quacc/runners/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from monty.shutil import copy_r, gzip_dir

from quacc import SETTINGS
from quacc.utils.atoms import copy_atoms
from quacc.atoms.core import copy_atoms
from quacc.utils.files import copy_decompress, make_unique_dir

try:
Expand Down
2 changes: 1 addition & 1 deletion src/quacc/runners/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import numpy as np

from quacc.utils.atoms import copy_atoms, get_atoms_id
from quacc.atoms.core import copy_atoms, get_atoms_id

if TYPE_CHECKING:
from ase import Atoms
Expand Down
2 changes: 1 addition & 1 deletion src/quacc/schemas/atoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from monty.json import jsanitize
from pymatgen.io.ase import AseAtomsAdaptor

from quacc.utils.atoms import copy_atoms
from quacc.atoms.core import copy_atoms
from quacc.utils.dicts import clean_dict

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/quacc/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Miscellaneous utility functions"""

from quacc.utils.atoms import check_charge_and_spin
from quacc.atoms.core import check_charge_and_spin

__all__ = ["check_charge_and_spin"]
2 changes: 1 addition & 1 deletion tests/recipes/qchem_recipes/test_qchem_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from pymatgen.io.qchem.inputs import QCInput

from quacc import SETTINGS
from quacc.atoms.core import check_charge_and_spin
from quacc.calculators.qchem import QChem
from quacc.utils import check_charge_and_spin

pytest.importorskip("sella")
pytestmark = pytest.mark.skipif(
Expand Down
2 changes: 1 addition & 1 deletion tests/runners/test_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from ase.build import bulk, molecule
from ase.io import read

from quacc.atoms.core import get_atoms_id
from quacc.calculators.vasp import Vasp
from quacc.runners.prep import prep_next_run
from quacc.utils.atoms import get_atoms_id

FILE_DIR = Path(__file__).resolve().parent
ATOMS_MAG = read(os.path.join(FILE_DIR, "..", "calculators", "vasp", "OUTCAR_mag.gz"))
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_slabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ase.build import bulk, fcc100, molecule
from ase.io import read

from quacc.utils.slabs import (
from quacc.atoms.slabs import (
flip_atoms,
get_surface_energy,
make_adsorbate_structures,
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_utils_atoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from ase.build import bulk, molecule
from ase.io import read

from quacc.atoms.core import check_charge_and_spin, check_is_metal, get_atoms_id
from quacc.calculators.vasp import Vasp
from quacc.runners.prep import prep_next_run
from quacc.utils.atoms import check_charge_and_spin, check_is_metal, get_atoms_id

FILE_DIR = Path(__file__).resolve().parent
ATOMS_MAG = read(os.path.join(FILE_DIR, "..", "calculators", "vasp", "OUTCAR_mag.gz"))
Expand Down