Skip to content

Commit

Permalink
Add document model
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhorton committed Apr 1, 2021
1 parent 3c8ee36 commit 7d7037f
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions src/mp_api/fermi/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from mp_api.core.client import BaseRester, MPRestError
from mp_api.fermi.models import FermiDoc

from collections import defaultdict
from typing import Optional, List
import warnings
Expand All @@ -7,24 +9,7 @@
class FermiRester(BaseRester):

suffix = "fermi"

def get_fermi_surface_from_material_id(self, material_id: str):
"""
Get fermi surface data for a given Materials Project ID.
Arguments:
material_id (str): Materials project ID
Returns:
results (Dict): Dictionary containing fermi surface data.
"""

result = self._make_request("{}/?all_fields=true".format(material_id))

if len(result.get("data", [])) > 0:
return result
else:
raise MPRestError("No document found")
document_model = FermiDoc

def search_fermi_docs(
self,
Expand All @@ -38,7 +23,7 @@ def search_fermi_docs(
Arguments:
num_chunks (int): Maximum number of chunks of data to yield. None will yield all possible.
chunk_size (int): Number of data entries per chunk.
fields (List[str]): List of fields in EOSDoc to return data for.
fields (List[str]): List of fields in FermiDoc to return data for.
Default is material_id and last_updated only.
Yields:
Expand Down

0 comments on commit 7d7037f

Please sign in to comment.