mp-api 0.46.2rc7__tar.gz → 0.46.2rc9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/PKG-INFO +1 -1
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/core/settings.py +4 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/mprester.py +5 -3
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/electronic_structure.py +58 -10
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/thermo.py +3 -1
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api.egg-info/PKG-INFO +1 -1
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/requirements/requirements-ubuntu-latest_py3.11.txt +1 -1
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/requirements/requirements-ubuntu-latest_py3.11_extras.txt +1 -1
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/requirements/requirements-ubuntu-latest_py3.12.txt +1 -1
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/requirements/requirements-ubuntu-latest_py3.12_extras.txt +1 -1
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/requirements/requirements-ubuntu-latest_py3.13.txt +1 -1
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/requirements/requirements-ubuntu-latest_py3.13_extras.txt +1 -1
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/requirements/requirements-ubuntu-latest_py3.14.txt +1 -1
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/requirements/requirements-ubuntu-latest_py3.14_extras.txt +1 -1
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/.coveragerc +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/.github/workflows/lint.yml +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/.github/workflows/release.yml +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/.github/workflows/testing.yml +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/.github/workflows/upgrade_dependencies.yml +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/.gitignore +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/.pre-commit-config.yaml +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/CODE_OF_CONDUCT.md +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/LICENSE +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/README.md +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/dev/generate_mcp_tools.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/dev/inspect_mcp.sh +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/docs/Makefile +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/docs/_templates/custom-class-template.rst +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/docs/_templates/custom-module-template.rst +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/docs/conf.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/docs/index.rst +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/docs/make.bat +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/docs/modules.rst +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/_test_utils.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/_server_utils.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/contribs/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/contribs/_logger.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/contribs/_types.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/contribs/_units.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/contribs/client.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/contribs/schemas.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/contribs/settings.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/contribs/utils.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/core/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/core/_oxygen_evolution.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/core/client.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/core/exceptions.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/core/schemas.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/core/utils.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/_server.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/absorption.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/alloys.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/bonds.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/chemenv.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/dielectric.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/doi.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/elasticity.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/electrodes.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/eos.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/grain_boundaries.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/magnetism.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/materials.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/oxidation_states.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/phonon.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/piezo.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/provenance.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/robocrys.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/similarity.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/substrates.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/summary.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/surface_properties.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/synthesis.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/tasks.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/xas.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/molecules/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/molecules/jcesr.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/molecules/molecules.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/molecules/summary.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/mcp/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/mcp/_schemas.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/mcp/mp_mcp.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/mcp/server.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/mcp/tools.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/mcp/utils.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/py.typed +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api.egg-info/SOURCES.txt +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api.egg-info/dependency_links.txt +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api.egg-info/entry_points.txt +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api.egg-info/requires.txt +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api.egg-info/top_level.txt +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/pyproject.toml +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/setup.cfg +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/test_files/Si_mp_149.cif +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/contribs/conftest.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/contribs/test_client.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/contribs/test_contribs_schemas.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/contribs/test_contribs_utils.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/contribs/test_types.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/core/test_oxygen_evolution.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/core/test_schemas.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/core/test_utils.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_absorption.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_alloys.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_bonds.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_chemenv.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_dielectric.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_doi.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_elasticity.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_electrodes.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_electronic_structure.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_eos.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_grain_boundary.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_magnetism.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_materials.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_oxidation_states.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_phonon.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_piezo.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_provenance.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_robocrys.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_similarity.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_substrates.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_summary.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_surface_properties.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_synthesis.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_tasks.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_thermo.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/materials/test_xas.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/molecules/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/molecules/test_jcesr.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/molecules/test_molecules.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/molecules/test_summary.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/test_client.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/test_core_client.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/test_heartbeat.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/client/test_mprester.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/mcp/__init__.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/mcp/test_server.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/mcp/test_tools.py +0 -0
- {mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/tests/mcp/test_utils.py +0 -0
|
@@ -2,12 +2,16 @@ import os
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
|
|
4
4
|
from emmet.core.settings import EmmetSettings
|
|
5
|
+
from emmet.core.types.enums import ThermoType
|
|
5
6
|
from pydantic import Field, field_validator
|
|
6
7
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
7
8
|
from pymatgen.core import _load_pmg_settings
|
|
8
9
|
|
|
9
10
|
from mp_api.client import __file__ as root_dir
|
|
10
11
|
|
|
12
|
+
DEFAULT_THERMOTYPE = ThermoType("GGA_GGA+U_R2SCAN")
|
|
13
|
+
DEFAULT_THERMOTYPE_CRITERIA = {"thermo_types": [DEFAULT_THERMOTYPE.value]}
|
|
14
|
+
|
|
11
15
|
PMG_SETTINGS = _load_pmg_settings()
|
|
12
16
|
_NUM_PARALLEL_REQUESTS = min(PMG_SETTINGS.get("MPRESTER_NUM_PARALLEL_REQUESTS", 4), 4)
|
|
13
17
|
_MAX_RETRIES = min(PMG_SETTINGS.get("MPRESTER_MAX_RETRIES", 3), 3)
|
|
@@ -32,7 +32,11 @@ from mp_api.client.core.exceptions import (
|
|
|
32
32
|
MPRestWarning,
|
|
33
33
|
_emit_status_warning,
|
|
34
34
|
)
|
|
35
|
-
from mp_api.client.core.settings import
|
|
35
|
+
from mp_api.client.core.settings import (
|
|
36
|
+
DEFAULT_THERMOTYPE,
|
|
37
|
+
DEFAULT_THERMOTYPE_CRITERIA,
|
|
38
|
+
MAPI_CLIENT_SETTINGS,
|
|
39
|
+
)
|
|
36
40
|
from mp_api.client.core.utils import LazyImport, load_json, validate_ids
|
|
37
41
|
from mp_api.client.routes import GENERIC_RESTERS
|
|
38
42
|
from mp_api.client.routes.materials import MATERIALS_RESTERS
|
|
@@ -58,8 +62,6 @@ if TYPE_CHECKING:
|
|
|
58
62
|
from mp_api.client.core.client import QueryBuilderWithCache
|
|
59
63
|
from mp_api.client.core.schemas import _DictLikeAccess
|
|
60
64
|
|
|
61
|
-
DEFAULT_THERMOTYPE = ThermoType("GGA_GGA+U_R2SCAN")
|
|
62
|
-
DEFAULT_THERMOTYPE_CRITERIA = {"thermo_types": [DEFAULT_THERMOTYPE.value]}
|
|
63
65
|
|
|
64
66
|
RESTER_LAYOUT = {
|
|
65
67
|
"molecules/core": LazyImport(
|
{mp_api-0.46.2rc7 → mp_api-0.46.2rc9}/mp_api/client/routes/materials/electronic_structure.py
RENAMED
|
@@ -264,6 +264,7 @@ class BandStructureRester(BaseESPropertyRester):
|
|
|
264
264
|
task_id: str,
|
|
265
265
|
run_type: str | RunType | None = None,
|
|
266
266
|
path_type: str | BSPathType | None = None,
|
|
267
|
+
load_projections: bool = False,
|
|
267
268
|
) -> BandStructure:
|
|
268
269
|
"""Get the band structure pymatgen object associated with a given task ID.
|
|
269
270
|
|
|
@@ -273,6 +274,9 @@ class BandStructureRester(BaseESPropertyRester):
|
|
|
273
274
|
will speed up query due to delta table partitioning.
|
|
274
275
|
path_type (str, BSPathType, or None) : Optional path type to
|
|
275
276
|
speed up query
|
|
277
|
+
load_projections (bool) : Optionally load atom- and spin-projected
|
|
278
|
+
bandstructure, if available.
|
|
279
|
+
|
|
276
280
|
Returns:
|
|
277
281
|
bandstructure (BandStructure): BandStructure or BandStructureSymmLine object
|
|
278
282
|
"""
|
|
@@ -296,6 +300,20 @@ class BandStructureRester(BaseESPropertyRester):
|
|
|
296
300
|
|
|
297
301
|
table = self._query_delta_single(query)
|
|
298
302
|
if len(deser := table.to_pylist(maps_as_pydicts="strict")) > 0:
|
|
303
|
+
if load_projections:
|
|
304
|
+
proj_bs_label, _ = self._get_delta_table(
|
|
305
|
+
"materialsproject-parsed",
|
|
306
|
+
"core/electronic-structure/projected-bandstructures/",
|
|
307
|
+
label="bandstructure_projections",
|
|
308
|
+
)
|
|
309
|
+
proj_table = self._query_delta_single(
|
|
310
|
+
query.replace(bs_lbl, proj_bs_label)
|
|
311
|
+
)
|
|
312
|
+
if (
|
|
313
|
+
len(deser_proj := proj_table.to_pylist(maps_as_pydicts="strict"))
|
|
314
|
+
> 0
|
|
315
|
+
):
|
|
316
|
+
deser[0]["projections"] = deser_proj[0]
|
|
299
317
|
emmet_bs = ElectronicBS(**deser[0])
|
|
300
318
|
return emmet_bs.to_pmg(
|
|
301
319
|
pmg_cls=BandStructureSymmLine if emmet_bs.labels_dict else BandStructure
|
|
@@ -308,19 +326,25 @@ class BandStructureRester(BaseESPropertyRester):
|
|
|
308
326
|
def get_bandstructure_from_material_id(
|
|
309
327
|
self,
|
|
310
328
|
material_id: str,
|
|
311
|
-
path_type: BSPathType = BSPathType.setyawan_curtarolo,
|
|
329
|
+
path_type: str | BSPathType = BSPathType.setyawan_curtarolo,
|
|
312
330
|
line_mode=True,
|
|
331
|
+
load_projections: bool = False,
|
|
313
332
|
):
|
|
314
333
|
"""Get the band structure pymatgen object associated with a Materials Project ID.
|
|
315
334
|
|
|
316
335
|
Arguments:
|
|
317
336
|
material_id (str): Materials Project ID for a material
|
|
318
|
-
path_type (BSPathType): k-point path selection convention
|
|
337
|
+
path_type (BSPathType or its value as a str): k-point path selection convention
|
|
319
338
|
line_mode (bool): Whether to return data for a line-mode calculation
|
|
339
|
+
load_projections (bool) : Optionally load atom- and spin-projected
|
|
340
|
+
bandstructure, if available.
|
|
320
341
|
|
|
321
342
|
Returns:
|
|
322
343
|
bandstructure (Union[BandStructure, BandStructureSymmLine]): BandStructure or BandStructureSymmLine object
|
|
323
344
|
"""
|
|
345
|
+
pt: BSPathType = (
|
|
346
|
+
BSPathType(path_type) if isinstance(path_type, str) else path_type
|
|
347
|
+
)
|
|
324
348
|
if line_mode:
|
|
325
349
|
bs_doc = self.es_rester.search(
|
|
326
350
|
material_ids=material_id, fields=["bandstructure"]
|
|
@@ -332,18 +356,18 @@ class BandStructureRester(BaseESPropertyRester):
|
|
|
332
356
|
|
|
333
357
|
if (_bs_data := bs_doc[0]["bandstructure"]) is None:
|
|
334
358
|
raise MPRestError(
|
|
335
|
-
f"No {
|
|
359
|
+
f"No {pt.value} band structure data found for {material_id}"
|
|
336
360
|
)
|
|
337
361
|
|
|
338
362
|
bs_data = (
|
|
339
363
|
_bs_data.model_dump() if self.use_document_model else _bs_data # type: ignore
|
|
340
364
|
)
|
|
341
365
|
|
|
342
|
-
if bs_data.get(
|
|
366
|
+
if bs_data.get(pt.value, None) is None:
|
|
343
367
|
raise MPRestError(
|
|
344
|
-
f"No {
|
|
368
|
+
f"No {pt.value} band structure data found for {material_id}"
|
|
345
369
|
)
|
|
346
|
-
bs_task_id = bs_data[
|
|
370
|
+
bs_task_id = bs_data[pt.value]["task_id"]
|
|
347
371
|
|
|
348
372
|
else:
|
|
349
373
|
if not (
|
|
@@ -370,7 +394,8 @@ class BandStructureRester(BaseESPropertyRester):
|
|
|
370
394
|
|
|
371
395
|
bs_obj = self.get_bandstructure_from_task_id(
|
|
372
396
|
bs_task_id,
|
|
373
|
-
path_type=
|
|
397
|
+
path_type=pt if line_mode else BSPathType.unknown,
|
|
398
|
+
load_projections=load_projections,
|
|
374
399
|
)
|
|
375
400
|
|
|
376
401
|
if bs_obj:
|
|
@@ -495,7 +520,10 @@ class DosRester(BaseESPropertyRester):
|
|
|
495
520
|
)
|
|
496
521
|
|
|
497
522
|
def get_dos_from_task_id(
|
|
498
|
-
self,
|
|
523
|
+
self,
|
|
524
|
+
task_id: str,
|
|
525
|
+
run_type: str | RunType | None = None,
|
|
526
|
+
load_projections: bool = False,
|
|
499
527
|
) -> Dos:
|
|
500
528
|
"""Get the density of states pymatgen object associated with a given calculation ID.
|
|
501
529
|
|
|
@@ -503,6 +531,8 @@ class DosRester(BaseESPropertyRester):
|
|
|
503
531
|
task_id (str): Task ID for the density of states calculation
|
|
504
532
|
run_type (str, RunType, or None): Optional run type to query by.
|
|
505
533
|
Will speed up query due to delta table partitioning.
|
|
534
|
+
load_projections (bool) : Optionally load atom- and spin-projected
|
|
535
|
+
DOS, if available.
|
|
506
536
|
|
|
507
537
|
Returns:
|
|
508
538
|
pymatgen Dos
|
|
@@ -525,16 +555,34 @@ class DosRester(BaseESPropertyRester):
|
|
|
525
555
|
|
|
526
556
|
table = self._query_delta_single(query)
|
|
527
557
|
if len(deser := table.to_pylist(maps_as_pydicts="strict")) > 0:
|
|
558
|
+
if load_projections:
|
|
559
|
+
proj_dos_label, _ = self._get_delta_table(
|
|
560
|
+
"materialsproject-parsed",
|
|
561
|
+
"core/electronic-structure/projected-dos/",
|
|
562
|
+
label="dos_projections",
|
|
563
|
+
)
|
|
564
|
+
proj_table = self._query_delta_single(
|
|
565
|
+
query.replace(dos_lbl, proj_dos_label)
|
|
566
|
+
)
|
|
567
|
+
if (
|
|
568
|
+
len(deser_proj := proj_table.to_pylist(maps_as_pydicts="strict"))
|
|
569
|
+
> 0
|
|
570
|
+
):
|
|
571
|
+
deser[0]["projected_densities"] = deser_proj[0]
|
|
528
572
|
return ElectronicDos(**deser[0]).to_pmg()
|
|
529
573
|
raise MPRestError(
|
|
530
574
|
f"No DOS data found for {task_id=}" + (f"run_type={rt}" if run_type else "")
|
|
531
575
|
)
|
|
532
576
|
|
|
533
|
-
def get_dos_from_material_id(
|
|
577
|
+
def get_dos_from_material_id(
|
|
578
|
+
self, material_id: str, load_projections: bool = False
|
|
579
|
+
) -> Dos:
|
|
534
580
|
"""Get the complete density of states pymatgen object associated with a Materials Project ID.
|
|
535
581
|
|
|
536
582
|
Arguments:
|
|
537
583
|
material_id (str): Materials Project ID for a material
|
|
584
|
+
load_projections (bool) : Optionally load atom- and spin-projected
|
|
585
|
+
DOS, if available.
|
|
538
586
|
|
|
539
587
|
Returns:
|
|
540
588
|
pymatgen Dos
|
|
@@ -552,4 +600,4 @@ class DosRester(BaseESPropertyRester):
|
|
|
552
600
|
dos_task_id = (dos_data.model_dump() if self.use_document_model else dos_data)[
|
|
553
601
|
"task_id"
|
|
554
602
|
]
|
|
555
|
-
return self.get_dos_from_task_id(dos_task_id)
|
|
603
|
+
return self.get_dos_from_task_id(dos_task_id, load_projections=load_projections)
|
|
@@ -13,6 +13,7 @@ from pymatgen.core import Element
|
|
|
13
13
|
|
|
14
14
|
from mp_api.client.core import BaseRester
|
|
15
15
|
from mp_api.client.core.exceptions import MPRestError
|
|
16
|
+
from mp_api.client.core.settings import DEFAULT_THERMOTYPE
|
|
16
17
|
from mp_api.client.core.utils import validate_ids
|
|
17
18
|
|
|
18
19
|
if TYPE_CHECKING:
|
|
@@ -185,13 +186,14 @@ class ThermoRester(BaseRester):
|
|
|
185
186
|
)
|
|
186
187
|
|
|
187
188
|
def get_phase_diagram_from_chemsys(
|
|
188
|
-
self, chemsys: str, thermo_type: ThermoType | str
|
|
189
|
+
self, chemsys: str, thermo_type: ThermoType | str = DEFAULT_THERMOTYPE
|
|
189
190
|
) -> PhaseDiagram:
|
|
190
191
|
"""Get a pre-computed phase diagram for a given chemsys.
|
|
191
192
|
|
|
192
193
|
Arguments:
|
|
193
194
|
chemsys (str): A chemical system (e.g. Li-Fe-O)
|
|
194
195
|
thermo_type (ThermoType): The thermo type for the phase diagram.
|
|
196
|
+
Defaults to ThermoType.GGA_GGA_U_R2SCAN.
|
|
195
197
|
|
|
196
198
|
Returns:
|
|
197
199
|
(PhaseDiagram): Pymatgen phase diagram object.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|