Skip to content

Commit bf38543

Browse files
patch tasks for v8
1 parent 2b82e62 commit bf38543

5 files changed

Lines changed: 14 additions & 6 deletions

File tree

dev/generate_mcp_tools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def regenerate_tools(
5959
COORDINATION_GEOMETRIES_IUPAC,
6060
COORDINATION_GEOMETRIES_NAMES,
6161
)
62-
from emmet.core.electronic_structure import BSPathType, DOSProjectionType
62+
from emmet.core.band_theory import BSPathType
63+
from emmet.core.electronic_structure import DOSProjectionType
6364
from emmet.core.grain_boundary import GBTypeEnum
6465
from emmet.core.mpid import MPID
6566
from emmet.core.thermo import ThermoType

mp_api/client/mprester.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from functools import cache, lru_cache
88
from typing import TYPE_CHECKING
99

10-
from emmet.core.electronic_structure import BSPathType
10+
from emmet.core.band_theory import BSPathType
1111
from emmet.core.mpid import MPID, AlphaID
1212
from emmet.core.types.enums import ThermoType
1313
from emmet.core.vasp.calc_types import CalcType
@@ -1231,9 +1231,11 @@ def get_charge_density_from_task_id(
12311231
Returns:
12321232
(Chgcar, (Chgcar, CoreTaskDoc | dict), None): Pymatgen Chgcar object, or tuple with object and CoreTaskDoc
12331233
"""
1234+
# TODO: change when `validate_ids` is updated to return AlphaID
1235+
validated_id = AlphaID(f"mp-{validate_ids([task_id])[0].split(" - ")[-1]}")
12341236
chgcar = self.materials.tasks._query_open_data(
12351237
bucket="materialsproject-parsed",
1236-
key=f"chgcars/{validate_ids([task_id])[0]}.json.gz",
1238+
key=f"chgcars/{validated_id.string}.json.gz",
12371239
decoder=lambda x: load_json(x, deser=True),
12381240
)[0][0]["data"]
12391241

mp_api/client/routes/materials/electronic_structure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from collections import defaultdict
55
from typing import TYPE_CHECKING
66

7+
from emmet.core.band_theory import BSPathType
78
from emmet.core.electronic_structure import (
8-
BSPathType,
99
DOSProjectionType,
1010
ElectronicStructureDoc,
1111
)

mp_api/client/routes/materials/tasks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ def search(
9696
if isinstance(task_ids, str):
9797
task_ids = [task_ids]
9898

99-
query_params.update({"task_ids": ",".join(validate_ids(task_ids))})
99+
# TODO: fix when validate_ids returns AlphaID
100+
query_params["task_ids"] = ",".join(
101+
str(AlphaID(task_id.split("-")[-1], padlen=8))
102+
for task_id in validate_ids(task_ids)
103+
)
100104

101105
if formula:
102106
query_params.update({"formula": formula})

mp_api/mcp/tools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
COORDINATION_GEOMETRIES_IUPAC,
1313
COORDINATION_GEOMETRIES_NAMES,
1414
)
15-
from emmet.core.electronic_structure import BSPathType, DOSProjectionType
15+
from emmet.core.band_theory import BSPathType
16+
from emmet.core.electronic_structure import DOSProjectionType
1617
from emmet.core.grain_boundary import GBTypeEnum
1718
from emmet.core.mpid import MPID
1819
from emmet.core.summary import HasProps

0 commit comments

Comments
 (0)