pymatgen.ext.optimade module

Optimade support.

class OptimadeRester(alias_or_structure_resource_url='mp')[source]

Bases: object

Class to call OPTIMADE-compliant APIs, see optimade.org

This class is ready to use but considered in-development and subject to change until the OPTIMADE paper is published.

OPTIMADE is an effort to provide a standardized interface to retrieve information from many different materials science databases.

This is a client to retrieve structures from OPTIMADE v1 compliant endpoints. It does not yet support all features of the OPTIMADE v1 specification but is intended as a way to quickly search an endpoint in a way familiar to users of pymatgen without needing to know the full OPTIMADE specification.

For advanced usage, please see the OPTIMADE documentation at optimate.org and consider calling the APIs directly.

For convenience, known OPTIMADE endpoints have been given aliases in pymatgen to save typing the full URL. The current list of aliases is:

aflow, cod, mcloud.sssp, mcloud.2dstructures, mcloud.2dtopo, mcloud.tc-applicability, mcloud.threedd, mcloud.scdm, mcloud.curated-cofs, mcloud.optimade-sample, mcloud.stoceriaitf, mcloud.pyrene-mofs, mcloud.li-ion-conductors, mp, odbx, omdb.omdb_production, oqmd, tcod

To refresh this list of aliases, generated from the current list of OPTIMADE providers at optimade.org, call the refresh_aliases() method.

Parameters

alias_or_structure_resource_url – the alias or structure resource URL

aliases = {'aflow': 'http://aflow.org/API/optimade/', 'cod': 'https://www.crystallography.net/cod/optimade', 'mcloud.2dstructures': 'https://aiida.materialscloud.org/2dstructures/optimade', 'mcloud.2dtopo': 'https://aiida.materialscloud.org/2dtopo/optimade', 'mcloud.curated-cofs': 'https://aiida.materialscloud.org/curated-cofs/optimade', 'mcloud.li-ion-conductors': 'https://aiida.materialscloud.org/li-ion-conductors/optimade', 'mcloud.optimade-sample': 'https://aiida.materialscloud.org/optimade-sample/optimade', 'mcloud.pyrene-mofs': 'https://aiida.materialscloud.org/pyrene-mofs/optimade', 'mcloud.scdm': 'https://aiida.materialscloud.org/autowannier/optimade', 'mcloud.sssp': 'https://aiida.materialscloud.org/sssplibrary/optimade', 'mcloud.stoceriaitf': 'https://aiida.materialscloud.org/stoceriaitf/optimade', 'mcloud.tc-applicability': 'https://aiida.materialscloud.org/tc-applicability/optimade', 'mcloud.threedd': 'https://aiida.materialscloud.org/3dd/optimade', 'mp': 'https://optimade.materialsproject.org', 'odbx': 'https://optimade.odbx.science', 'omdb.omdb_production': 'http://optimade.openmaterialsdb.se', 'oqmd': 'http://oqmd.org/optimade/', 'tcod': 'https://www.crystallography.net/tcod/optimade'}[source]
get_structures(elements=None, nelements=None, nsites=None, chemical_formula_anonymous=None, chemical_formula_hill=None) → Dict[str, pymatgen.core.structure.Structure][source]

Retrieve structures from the OPTIMADE database.

Not all functionality of OPTIMADE is currently exposed in this convenience method. To use a custom filter, call get_structures_with_filter().

Parameters
  • elements – List of elements

  • nelements – Number of elements, e.g. 4 or [2, 5] for the range >=2 and <=5

  • nsites – Number of sites, e.g. 4 or [2, 5] for the range >=2 and <=5

  • chemical_formula_anonymous – Anonymous chemical formula

  • chemical_formula_hill – Chemical formula following Hill convention

Returns: Dict of Structures keyed by that database’s id system

get_structures_with_filter(optimade_filter: str) → Dict[str, pymatgen.core.structure.Structure][source]

Get structures satisfying a given OPTIMADE filter.

Parameters

filter – An OPTIMADE-compliant filter

Returns: Dict of Structures keyed by that database’s id system

refresh_aliases(providers_url='https://providers.optimade.org/providers.json')[source]

Updates available OPTIMADE structure resources based on the current list of OPTIMADE providers.