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.
MaterialsProjectSourceclassThe 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
MaterialsProjectSourceFactoryclassThe 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 = 1000The 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(): stringMaterialsProjectSource::capabilities()
public function capabilities(): arrayMaterialsProjectSource::entity()
public function entity(Identifier|string $id): ?EntityA 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.
MaterialsProjectSource::search()
public function search(Query $query): PageThe 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
| Option | Default | |
|---|---|---|
api_key | null | |
throttle | 0.0 | |
base_uri | MaterialsProjectSource::BASE_URI |