Skip to content

Commit b80ce73

Browse files
committed
try fixing get_phonon_bs/dos_by_material_id
1 parent 2b4626b commit b80ce73

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

mp_api/client/mprester.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,10 +1248,9 @@ def get_phonon_dos_by_material_id(self, material_id: str):
12481248
CompletePhononDos: A phonon DOS object.
12491249
12501250
"""
1251-
doc = self.materials.phonon.search(material_ids=material_id, fields=["ph_dos"])
1252-
if not doc:
1253-
return None
1254-
return doc[0].ph_dos if self.use_document_model else doc[0]["ph_dos"] # type: ignore
1251+
return self.materials.phonon.get_dos_from_material_id(
1252+
material_id=material_id, phonon_method="dfpt"
1253+
)
12551254

12561255
def get_phonon_bandstructure_by_material_id(self, material_id: str):
12571256
"""Get phonon dispersion data corresponding to a material_id.
@@ -1262,11 +1261,9 @@ def get_phonon_bandstructure_by_material_id(self, material_id: str):
12621261
Returns:
12631262
PhononBandStructureSymmLine: phonon band structure.
12641263
"""
1265-
doc = self.materials.phonon.search(material_ids=material_id, fields=["ph_bs"])
1266-
if not doc:
1267-
return None
1268-
1269-
return doc[0].ph_bs if self.use_document_model else doc[0]["ph_bs"] # type: ignore
1264+
return self.materials.phonon.get_bandstructure_from_material_id(
1265+
material_id=material_id, phonon_method="dfpt"
1266+
)
12701267

12711268
def get_wulff_shape(self, material_id: str):
12721269
"""Constructs a Wulff shape for a material.

0 commit comments

Comments
 (0)