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

Use convenience exports from pymatgen/core/__init__.py where no risk of circular imports #3461

Merged
merged 3 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pymatgen/alchemy/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from monty.json import MSONable

from pymatgen.analysis.structure_matcher import ElementComparator, StructureMatcher
from pymatgen.core.periodic_table import get_el_sp
from pymatgen.core import get_el_sp
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/bond_valence.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import numpy as np
from monty.serialization import loadfn

from pymatgen.core.periodic_table import Element, Species, get_el_sp
from pymatgen.core import Element, Species, get_el_sp
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

if TYPE_CHECKING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
from pymatgen.analysis.chemenv.coordination_environments.voronoi import DetailedVoronoiContainer
from pymatgen.analysis.chemenv.utils.chemenv_errors import ChemenvError
from pymatgen.analysis.chemenv.utils.defs_utils import AdditionalConditions
from pymatgen.core.periodic_table import Element, Species
from pymatgen.core.sites import PeriodicSite
from pymatgen.core.structure import PeriodicNeighbor, Structure
from pymatgen.core import Element, PeriodicNeighbor, PeriodicSite, Species, Structure

if TYPE_CHECKING:
import matplotlib.pyplot as plt
Expand Down
3 changes: 1 addition & 2 deletions pymatgen/analysis/cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
from monty.design_patterns import singleton

from pymatgen.analysis.phase_diagram import PDEntry, PhaseDiagram
from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import Element
from pymatgen.core import Composition, Element
from pymatgen.util.provenance import is_valid_bibtex

__author__ = "Anubhav Jain"
Expand Down
3 changes: 1 addition & 2 deletions pymatgen/analysis/hhi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

from monty.design_patterns import singleton

from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import Element
from pymatgen.core import Composition, Element

__author__ = "Anubhav Jain"
__copyright__ = "Copyright 2014, The Materials Project"
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/magnetism/jahnteller.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from pymatgen.analysis.bond_valence import BVAnalyzer
from pymatgen.analysis.local_env import LocalStructOrderParams, get_neighbors_of_site_with_index
from pymatgen.core.periodic_table import Species, get_el_sp
from pymatgen.core import Species, get_el_sp
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

if TYPE_CHECKING:
Expand Down
3 changes: 1 addition & 2 deletions pymatgen/analysis/nmr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

import numpy as np

from pymatgen.core.periodic_table import Species
from pymatgen.core.structure import Site
from pymatgen.core import Site, Species
from pymatgen.core.tensors import SquareTensor
from pymatgen.core.units import FloatWithUnit
from pymatgen.util.due import Doi, due
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/phase_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
from tqdm import tqdm

from pymatgen.analysis.reaction_calculator import Reaction, ReactionError
from pymatgen.core import DummySpecies, Element, get_el_sp
from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import DummySpecies, Element, get_el_sp
from pymatgen.entries import Entry
from pymatgen.util.coord import Simplex, in_coord_list
from pymatgen.util.due import Doi, due
Expand Down
4 changes: 1 addition & 3 deletions pymatgen/analysis/structure_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
from scipy.spatial import Voronoi

from pymatgen.analysis.local_env import JmolNN, VoronoiNN
from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import Element, Species
from pymatgen.core.sites import PeriodicSite
from pymatgen.core import Composition, Element, PeriodicSite, Species
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

if TYPE_CHECKING:
Expand Down
7 changes: 3 additions & 4 deletions pymatgen/analysis/structure_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@
import numpy as np
from monty.json import MSONable

from pymatgen.core.composition import Composition, SpeciesLike
from pymatgen.core.lattice import Lattice
from pymatgen.core.periodic_table import get_el_sp
from pymatgen.core.structure import Structure
from pymatgen.core import Composition, Lattice, Structure, get_el_sp
from pymatgen.optimization.linear_assignment import LinearAssignment
from pymatgen.util.coord import lattice_points_in_supercell
from pymatgen.util.coord_cython import is_coord_subset_pbc, pbc_shortest_vectors

if TYPE_CHECKING:
from collections.abc import Mapping, Sequence

from pymatgen.util.typing import SpeciesLike

__author__ = "William Davidson Richards, Stephen Dacek, Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np

from pymatgen.analysis.structure_prediction.substitution_probability import SubstitutionPredictor
from pymatgen.core.periodic_table import Element, Species
from pymatgen.core import Element, Species


def get_dopants_from_substitution_probabilities(structure, num_dopants=5, threshold=0.001, match_oxi_sign=False):
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/structure_prediction/substitutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pymatgen.alchemy.materials import TransformedStructure
from pymatgen.alchemy.transmuters import StandardTransmuter
from pymatgen.analysis.structure_prediction.substitution_probability import SubstitutionProbability
from pymatgen.core.periodic_table import get_el_sp
from pymatgen.core import get_el_sp
from pymatgen.transformations.standard_transformations import SubstitutionTransformation
from pymatgen.util.due import Doi, due

Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/xps.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import numpy as np
import pandas as pd

from pymatgen.core.periodic_table import Element
from pymatgen.core import Element
from pymatgen.core.spectrum import Spectrum
from pymatgen.util.due import Doi, due

Expand Down
3 changes: 1 addition & 2 deletions pymatgen/apps/battery/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

import scipy.constants as const

from pymatgen.core.periodic_table import Element, Species
from pymatgen.core.structure import Composition
from pymatgen.core import Composition, Element, Species

__author__ = "Anubhav Jain"
__copyright__ = "Copyright 2011, The Materials Project"
Expand Down
3 changes: 1 addition & 2 deletions pymatgen/apps/battery/conversion_battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from pymatgen.analysis.phase_diagram import PhaseDiagram
from pymatgen.analysis.reaction_calculator import BalancedReaction
from pymatgen.apps.battery.battery_abc import AbstractElectrode, AbstractVoltagePair
from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import Element
from pymatgen.core import Composition, Element
from pymatgen.core.units import Charge, Time

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/command_line/critic2_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from scipy.spatial import KDTree

from pymatgen.analysis.graphs import StructureGraph
from pymatgen.core.periodic_table import DummySpecies
from pymatgen.core import DummySpecies
from pymatgen.io.vasp.inputs import Potcar
from pymatgen.io.vasp.outputs import Chgcar, VolumetricData
from pymatgen.util.due import Doi, due
Expand Down
4 changes: 1 addition & 3 deletions pymatgen/command_line/enumlib_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
from monty.fractions import lcm
from monty.tempfile import ScratchDir

from pymatgen.core.periodic_table import DummySpecies
from pymatgen.core.sites import PeriodicSite
from pymatgen.core.structure import Structure
from pymatgen.core import DummySpecies, PeriodicSite, Structure
from pymatgen.io.vasp.inputs import Poscar
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

Expand Down
4 changes: 1 addition & 3 deletions pymatgen/command_line/gulp_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
from monty.tempfile import ScratchDir

from pymatgen.analysis.bond_valence import BVAnalyzer
from pymatgen.core.lattice import Lattice
from pymatgen.core.periodic_table import Element
from pymatgen.core.structure import Structure
from pymatgen.core import Element, Lattice, Structure
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

__author__ = "Bharat Medasani, Wenhao Sun"
Expand Down
2 changes: 2 additions & 0 deletions pymatgen/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
from pymatgen.core.periodic_table import DummySpecies as DummySpecies
from pymatgen.core.periodic_table import Element as Element
from pymatgen.core.periodic_table import Species as Species
from pymatgen.core.periodic_table import get_el_sp as get_el_sp
from pymatgen.core.sites import PeriodicSite as PeriodicSite
from pymatgen.core.sites import Site as Site
from pymatgen.core.structure import IMolecule as IMolecule
from pymatgen.core.structure import IStructure as IStructure
from pymatgen.core.structure import Molecule as Molecule
from pymatgen.core.structure import PeriodicNeighbor as PeriodicNeighbor
from pymatgen.core.structure import SiteCollection as SiteCollection
from pymatgen.core.structure import Structure as Structure
from pymatgen.core.units import ArrayWithUnit as ArrayWithUnit
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/core/bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import warnings
from typing import TYPE_CHECKING

from pymatgen.core.periodic_table import Element
from pymatgen.core import Element

if TYPE_CHECKING:
from pymatgen.core.sites import Site
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/core/molecular_orbitals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from itertools import chain, combinations

from pymatgen.core import Element
from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import Element


class MolecularOrbitals:
Expand Down
5 changes: 1 addition & 4 deletions pymatgen/core/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
from scipy.spatial.distance import squareform

from pymatgen.analysis.structure_matcher import StructureMatcher
from pymatgen.core.lattice import Lattice
from pymatgen.core.periodic_table import get_el_sp
from pymatgen.core.sites import PeriodicSite
from pymatgen.core.structure import Structure
from pymatgen.core import Lattice, PeriodicSite, Structure, get_el_sp
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen.util.coord import in_coord_list
from pymatgen.util.due import Doi, due
Expand Down
4 changes: 1 addition & 3 deletions pymatgen/electronic_structure/bandstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
import numpy as np
from monty.json import MSONable

from pymatgen.core.lattice import Lattice
from pymatgen.core.periodic_table import Element, get_el_sp
from pymatgen.core.structure import Structure
from pymatgen.core import Element, Lattice, Structure, get_el_sp
from pymatgen.electronic_structure.core import Orbital, Spin
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen.util.coord import pbc_diff
Expand Down
3 changes: 1 addition & 2 deletions pymatgen/electronic_structure/dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
from scipy.constants import value as _cd
from scipy.signal import hilbert

from pymatgen.core.periodic_table import get_el_sp
from pymatgen.core import Structure, get_el_sp
from pymatgen.core.spectrum import Spectrum
from pymatgen.core.structure import Structure
from pymatgen.electronic_structure.core import Orbital, OrbitalType, Spin
from pymatgen.util.coord import get_linear_interpolated_value

Expand Down
6 changes: 3 additions & 3 deletions pymatgen/electronic_structure/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from monty.dev import requires
from monty.json import jsanitize

from pymatgen.core.periodic_table import Element
from pymatgen.core import Element
from pymatgen.electronic_structure.bandstructure import BandStructureSymmLine
from pymatgen.electronic_structure.boltztrap import BoltztrapError
from pymatgen.electronic_structure.core import OrbitalType, Spin
Expand Down Expand Up @@ -1823,7 +1823,7 @@ def _Orbitals_SumOrbitals(cls, dictio, sum_morbs):
def _number_of_subfigures(self, dictio, dictpa, sum_atoms, sum_morbs):
from collections import Counter

from pymatgen.core.periodic_table import Element
from pymatgen.core import Element

if not isinstance(dictpa, dict):
raise TypeError("The invalid type of 'dictpa' was bound. It should be dict type.")
Expand Down Expand Up @@ -1949,7 +1949,7 @@ def _number_of_subfigures(self, dictio, dictpa, sum_atoms, sum_morbs):
return dictpa, sum_atoms, number_figs

def _summarize_keys_for_plot(self, dictio, dictpa, sum_atoms, sum_morbs):
from pymatgen.core.periodic_table import Element
from pymatgen.core import Element

individual_orbs = {
"p": ["px", "py", "pz"],
Expand Down
3 changes: 1 addition & 2 deletions pymatgen/entries/compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
from uncertainties import ufloat

from pymatgen.analysis.structure_analyzer import oxide_type, sulfide_type
from pymatgen.core import SETTINGS
from pymatgen.core.periodic_table import Element
from pymatgen.core import SETTINGS, Element
from pymatgen.entries.computed_entries import (
CompositionEnergyAdjustment,
ComputedEntry,
Expand Down
3 changes: 1 addition & 2 deletions pymatgen/entries/correction_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

from pymatgen.analysis.reaction_calculator import ComputedReaction
from pymatgen.analysis.structure_analyzer import sulfide_type
from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import Element
from pymatgen.core import Composition, Element


class CorrectionCalculator:
Expand Down
3 changes: 1 addition & 2 deletions pymatgen/entries/entry_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

from pymatgen.analysis.phase_diagram import PDEntry
from pymatgen.analysis.structure_matcher import SpeciesComparator, StructureMatcher
from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import Element
from pymatgen.core import Composition, Element

if TYPE_CHECKING:
from collections.abc import Iterable
Expand Down
5 changes: 1 addition & 4 deletions pymatgen/ext/matproj_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@
from ruamel.yaml import YAML
from tqdm import tqdm

from pymatgen.core import SETTINGS
from pymatgen.core import SETTINGS, Composition, Element, Structure
from pymatgen.core import __version__ as PMG_VERSION
from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import Element
from pymatgen.core.structure import Structure
from pymatgen.core.surface import get_symmetrically_equivalent_miller_indices
from pymatgen.entries.computed_entries import ComputedEntry, ComputedStructureEntry
from pymatgen.entries.exp_entries import ExpEntry
Expand Down
3 changes: 1 addition & 2 deletions pymatgen/ext/optimade.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
import requests
from tqdm import tqdm

from pymatgen.core.periodic_table import DummySpecies
from pymatgen.core.structure import Structure
from pymatgen.core import DummySpecies, Structure
from pymatgen.util.due import Doi, due
from pymatgen.util.provenance import StructureNL

Expand Down
2 changes: 1 addition & 1 deletion pymatgen/io/abinit/pseudos.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from monty.os.path import find_exts
from tabulate import tabulate

from pymatgen.core.periodic_table import Element
from pymatgen.core import Element
from pymatgen.core.xcfunc import XcFunc
from pymatgen.io.core import ParseError
from pymatgen.util.plotting import add_fig_kwargs, get_ax_fig
Expand Down
4 changes: 1 addition & 3 deletions pymatgen/io/atat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import numpy as np
from monty.dev import deprecated

from pymatgen.core.lattice import Lattice
from pymatgen.core.periodic_table import get_el_sp
from pymatgen.core.structure import Structure
from pymatgen.core import Lattice, Structure, get_el_sp

__author__ = "Matthew Horton"
__copyright__ = "Copyright 2017, The Materials Project"
Expand Down
6 changes: 1 addition & 5 deletions pymatgen/io/cif.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@
from monty.io import zopen
from monty.serialization import loadfn

from pymatgen.core.composition import Composition
from pymatgen.core.lattice import Lattice
from pymatgen.core import Composition, DummySpecies, Element, Lattice, PeriodicSite, Species, Structure, get_el_sp
from pymatgen.core.operations import MagSymmOp, SymmOp
from pymatgen.core.periodic_table import DummySpecies, Element, Species, get_el_sp
from pymatgen.core.sites import PeriodicSite
from pymatgen.core.structure import Structure
from pymatgen.electronic_structure.core import Magmom
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer, SpacegroupOperations
from pymatgen.symmetry.groups import SYMM_DATA, SpaceGroup
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/io/cp2k/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from monty.io import zopen
from monty.json import MSONable

from pymatgen.core.periodic_table import Element
from pymatgen.core import Element
from pymatgen.io.cp2k.utils import chunk, postprocessor, preprocessor
from pymatgen.io.vasp.inputs import Kpoints as VaspKpoints
from pymatgen.io.vasp.inputs import KpointsSupportedModes
Expand Down
4 changes: 1 addition & 3 deletions pymatgen/io/exciting/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
from monty.io import zopen
from monty.json import MSONable

from pymatgen.core.lattice import Lattice
from pymatgen.core.periodic_table import Element
from pymatgen.core.structure import Structure
from pymatgen.core import Element, Lattice, Structure
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen.symmetry.bandstructure import HighSymmKpath

Expand Down
4 changes: 1 addition & 3 deletions pymatgen/io/feff/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
from monty.json import MSONable
from tabulate import tabulate

from pymatgen.core.lattice import Lattice
from pymatgen.core.periodic_table import Element
from pymatgen.core.structure import Molecule, Structure
from pymatgen.core import Element, Lattice, Molecule, Structure
from pymatgen.io.cif import CifParser
from pymatgen.io.core import ParseError
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
Expand Down
Loading