This module provides classes to interface with the Materials Project REST API v2 to enable the creation of data structures and pymatgen objects using Materials Project data.
To make use of the Materials API, you need to be a registered user of the Materials Project, and obtain an API key by going to your dashboard at https://materialsproject.org/dashboard.
- exception MPRestError
Exception class for legacy MPRestAdaptor. Raised when the query has problems, e.g., bad query format.
- class MPRester(*args, **kwargs)
A class to conveniently interface with the new and legacy Materials Project REST interface. The recommended way to use MPRester is with the “with” context manager to ensure that sessions are properly closed after usage:
with MPRester("API_KEY") as m: do_something
MPRester uses the “requests” package, which provides for HTTP connection pooling. All connections are made via https for security.
Note that this barebones class is to handle transition between the old and new API keys in a transparent manner, providing backwards compatibility. Use it as you would with normal MPRester usage. If a new API key is detected, the _MPResterNew will be initialized. Otherwise, the _MPResterLegacy. Consult the Materials Project documentation at https://docs.materialsproject.org for advice on which API to use.
*args – Pass through to either legacy or new MPRester.
**kwargs – Pass through to either legacy or new MPRester.
- class TaskType(value)
task types available in legacy MP data
- GGAU_DEF = 'GGA+U Deformation'
- GGAU_LINE = 'GGA+U NSCF Line'
- GGAU_OPT = 'GGA+U Structure Optimization'
- GGAU_STATIC = 'GGA+U Static'
- GGAU_STATIC_DIEL = 'GGA+U Static Dielectric'
- GGAU_UNIFORM = 'GGA+U NSCF Uniform'
- GGA_DEF = 'GGA Deformation'
- GGA_LINE = 'GGA NSCF Line'
- GGA_OPT = 'GGA Structure Optimization'
- GGA_STATIC = 'GGA Static'
- GGA_STATIC_DIEL = 'GGA Static Dielectric'
- GGA_UNIFORM = 'GGA NSCF Uniform'
- LDA_STATIC_DIEL = 'LDA Static Dielectric'
- SCAN_OPT = 'SCAN Structure Optimization'
- get_chunks(sequence: Sequence[Any], size=1)
sequence (Sequence[Any]) – Any sequence.
size (int) – Chunk length. Defaults to 1.
input sequence in chunks of length size.
- Return type: