From d4608eac7e2274aeff432f349945cf06885cd96b Mon Sep 17 00:00:00 2001 From: Jason Munro Date: Thu, 18 Aug 2022 14:57:46 -0700 Subject: [PATCH] Update mp_api import and add has_props to query --- notebooks/download_from_api.ipynb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/notebooks/download_from_api.ipynb b/notebooks/download_from_api.ipynb index bd9e851..bfd9316 100644 --- a/notebooks/download_from_api.ipynb +++ b/notebooks/download_from_api.ipynb @@ -53,7 +53,7 @@ "metadata": {}, "outputs": [], "source": [ - "from mp_api import MPRester\n", + "from mp_api.client import MPRester\n", "with MPRester(API_KEY) as mpr:\n", " chgcar = mpr.get_charge_density_from_material_id(\"mp-149\")\n", "type(chgcar)" @@ -137,9 +137,14 @@ "metadata": {}, "outputs": [], "source": [ - "from mp_api import MPRester\n", + "from mp_api.client import MPRester\n", + "from emmet.core.summary import HasProps\n", + "\n", "with MPRester(API_KEY) as mpr:\n", - " hexagonal_materials = mpr.summary.search(crystal_system=\"Hexagonal\", is_stable=True, fields=[\"material_id\"])" + " hexagonal_materials = mpr.summary.search(crystal_system=\"Hexagonal\", \n", + " is_stable=True,\n", + " has_props=[HasProps.charge_density], \n", + " fields=[\"material_id\"])" ] }, {