Skip to content

omnilab/materials-project API reference

Floor
Provider · Omnilab
Version
1.x
Conformance suite
not wired
Verified for real
Its README does not say
Licence
MIT
composer require omnilab/materials-project:1.x-dev

Read from the package's own PHP files at the commit 758f53a3013c: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.

Omnilab\MaterialsProject

  • MaterialsProjectSource class

    The Materials Project (Lawrence Berkeley National Laboratory), computed properties of inorganic materials, through its API (api.materialsproject.org, an account's key required): a material by its id ("mp-149") - its formula, chemical system, elements, sites, density, volume, symmetry (crystal system, space group, point group), energies per atom (total, formation, above the hull), stability, band gap, metal or not, magnetism, elastic moduli, whether theoretical, the ids it has in other databases (ICSD...) -; the materials of a formula or a chemical system.

    5 methods · 3 constants

  • MaterialsProjectSourceFactory class

    The Materials Project: computed properties of inorganic materials by their id, the materials of a formula or a chemical system - an account's API key required (free, on registering).

    3 options

Omnilab\MaterialsProject

MaterialsProjectSource class

final class MaterialsProjectSource extends HttpSource MaterialsProjectSource.php:33

The Materials Project (Lawrence Berkeley National Laboratory), computed properties of inorganic materials, through its API (api.materialsproject.org, an account's key required): a material by its id ("mp-149") - its formula, chemical system, elements, sites, density, volume, symmetry (crystal system, space group, point group), energies per atom (total, formation, above the hull), stability, band gap, metal or not, magnetism, elastic moduli, whether theoretical, the ids it has in other databases (ICSD...) -; the materials of a formula or a chemical system.

One call an entity or a page (its summary endpoint, the fields asked). Not tested live: no key was available (README).

const BASE_URI = 'https://api.materialsproject.org/'
const MAX_LIMIT = 1000

The most materials a page holds (the API's limit is 1000).

const FIELDS = ['material_id', 'formula_pretty', 'chemsys', 'elements', 'nelements', 'nsites', 'density', 'density_atomic', 'volume', 'symmetry', 'energy_per_atom', 'format…

The summary fields asked: what an entity holds.

MaterialsProjectSource::__construct()

public function __construct(HttpClientInterface $http, readonly ?string $apiKey, string $baseUri = self::BASE_URI, array $headers = [], float $throttle = 0.0)

MaterialsProjectSource::getName()

public function getName(): string

MaterialsProjectSource::capabilities()

public function capabilities(): array

MaterialsProjectSource::entity()

public function entity(Identifier|string $id): ?Entity

A material by its id ("mp-149", "materialsproject:mp-149", its page); another base's identifier is refused before any call; null when the Materials Project has none.

public function search(Query $query): Page

The materials of a formula ("Fe2O3", "SiO2", an anonymous "AB2", a wildcard "Fe*O3") or of a chemical system ("Fe-O": a dash), in the API's order; a domain other than chemistry answers nothing. An entity of a page holds what entity() gives.

MaterialsProjectSourceFactory class

final class MaterialsProjectSourceFactory extends SourceFactory MaterialsProjectSourceFactory.php:21

The Materials Project: computed properties of inorganic materials by their id, the materials of a formula or a chemical system - an account's API key required (free, on registering).

options: api_key: '%env(MP_API_KEY)%' # the key of a Materials Project account: every call needs one mailto: 'support@glitchr.io' # in the User-Agent throttle: 0 # seconds between two calls: no rate published base_uri: 'https://api.materialsproject.org/'

Options

OptionDefault
api_keynull
throttle0.0
base_uriMaterialsProjectSource::BASE_URI