mp_api.client.routes.materials.synthesis.SynthesisRester¶
- class mp_api.client.routes.materials.synthesis.SynthesisRester(api_key: str | None = None, endpoint: str = 'https://api.materialsproject.org/', include_user_agent: bool = True, session: requests.Session | None = None, s3_resource: Any | None = None, debug: bool = False, monty_decode: bool = True, use_document_model: bool = True, timeout: int = 20, headers: dict = None, mute_progress_bars: bool = False)[source]¶
Bases:
BaseRester
[SynthesisSearchResultModel
]Args: api_key (str): A String API key for accessing the MaterialsProject REST interface. Please obtain your API key at https://www.materialsproject.org/dashboard. If this is None, the code will check if there is a “PMG_MAPI_KEY” setting. If so, it will use that environment variable. This makes easier for heavy users to simply add this environment variable to their setups and MPRester can then be called without any arguments. endpoint (str): Url of endpoint to access the MaterialsProject REST interface. Defaults to the standard Materials Project REST address at “https://api.materialsproject.org”, but can be changed to other urls implementing a similar interface. include_user_agent (bool): If True, will include a user agent with the HTTP request including information on pymatgen and system version making the API request. This helps MP support pymatgen users, and is similar to what most web browsers send with each page request. Set to False to disable the user agent. session: requests Session object with which to connect to the API, for advanced usage only. debug: if True, print the URL for every request monty_decode: Decode the data using monty into python objects use_document_model: If False, skip the creating the document model and return data as a dictionary. This can be simpler to work with but bypasses data validation and will not give auto-complete for available fields. timeout: Time in seconds to wait until a request timeout error is thrown headers (dict): Custom headers for localhost connections.
- __init__(api_key: str | None = None, endpoint: str = 'https://api.materialsproject.org/', include_user_agent: bool = True, session: requests.Session | None = None, s3_resource: Any | None = None, debug: bool = False, monty_decode: bool = True, use_document_model: bool = True, timeout: int = 20, headers: dict = None, mute_progress_bars: bool = False)¶
Args: api_key (str): A String API key for accessing the MaterialsProject REST interface. Please obtain your API key at https://www.materialsproject.org/dashboard. If this is None, the code will check if there is a “PMG_MAPI_KEY” setting. If so, it will use that environment variable. This makes easier for heavy users to simply add this environment variable to their setups and MPRester can then be called without any arguments. endpoint (str): Url of endpoint to access the MaterialsProject REST interface. Defaults to the standard Materials Project REST address at “https://api.materialsproject.org”, but can be changed to other urls implementing a similar interface. include_user_agent (bool): If True, will include a user agent with the HTTP request including information on pymatgen and system version making the API request. This helps MP support pymatgen users, and is similar to what most web browsers send with each page request. Set to False to disable the user agent. session: requests Session object with which to connect to the API, for advanced usage only. debug: if True, print the URL for every request monty_decode: Decode the data using monty into python objects use_document_model: If False, skip the creating the document model and return data as a dictionary. This can be simpler to work with but bypasses data validation and will not give auto-complete for available fields. timeout: Time in seconds to wait until a request timeout error is thrown headers (dict): Custom headers for localhost connections.
Methods
__init__
([api_key, endpoint, ...])Args: api_key (str): A String API key for accessing the MaterialsProject REST interface.
count
([criteria])Return a count of total documents.
get_data_by_id
(document_id[, fields])Query the endpoint for a single document.
search
([keywords, synthesis_type, ...])Search synthesis recipe text.
search_synthesis_text
(*args, **kwargs)Deprecated.
Attributes
available_fields
primary_key
s3_resource
session
suffix
supports_versions
- document_model¶
alias of
SynthesisSearchResultModel
- search(keywords: list[str] | None = None, synthesis_type: list[SynthesisTypeEnum] | None = None, target_formula: str | None = None, precursor_formula: str | None = None, operations: list[OperationTypeEnum] | None = None, condition_heating_temperature_min: float | None = None, condition_heating_temperature_max: float | None = None, condition_heating_time_min: float | None = None, condition_heating_time_max: float | None = None, condition_heating_atmosphere: list[str] | None = None, condition_mixing_device: list[str] | None = None, condition_mixing_media: list[str] | None = None, num_chunks: int | None = None, chunk_size: int | None = 10)[source]¶
Search synthesis recipe text.
- Parameters:
keywords (Optional[List[str]]) – List of string keywords to search synthesis paragraph text with
synthesis_type (Optional[List[SynthesisTypeEnum]]) – Type of synthesis to include
target_formula (Optional[str]) – Chemical formula of the target material
precursor_formula (Optional[str]) – Chemical formula of the precursor material
operations (Optional[List[OperationTypeEnum]]) – List of operations that syntheses must have
condition_heating_temperature_min (Optional[float]) – Minimal heating temperature
condition_heating_temperature_max (Optional[float]) – Maximal heating temperature
condition_heating_time_min (Optional[float]) – Minimal heating time
condition_heating_time_max (Optional[float]) – Maximal heating time
condition_heating_atmosphere (Optional[List[str]]) – Required heating atmosphere, such as “air”, “argon”
condition_mixing_device (Optional[List[str]]) – Required mixing device, such as “zirconia”, “Al2O3”.
condition_mixing_media (Optional[List[str]]) – Required mixing media, such as “alcohol”, “water”
num_chunks (Optional[int]) – Maximum number of chunks of data to yield. None will yield all possible.
chunk_size (Optional[int]) – Number of data entries per chunk.
- Returns:
List of synthesis documents.
- Return type:
synthesis_docs ([SynthesisDoc])