KirillBelov/ MaterialsProjectLink

Wolfram functions for calling Materials Project Rest API

Contributed by: Kirill Belov

The package that allows you to get data using the Rest API of the Materials Project.

Installation Instructions

To install this paclet in your Wolfram Language environment, evaluate this code:
PacletInstall["KirillBelov/MaterialsProjectLink"]


To load the code after installation, evaluate this code:
Needs["KirillBelov`MaterialsProjectLink`"]

Details

All functions are generated during package import automatically from open api schema.

Examples

Basic Examples (3) 

Import the package:

In[1]:=
<< KirillBelov`MaterialsProjectLink`

Save your API key:

In[2]:=
Export[
 FileNameJoin[{$HomeDirectory, ".MaterialsProjectLinkAPIKey.wl"}], <|"APIKey" -> "g7EYgVnYFjXbbq7Fh6dsKwDdZElmAmyF"|>
 ]
Out[2]=

Check that API is available:

In[3]:=
getMaterials[allFields -> True]
Out[3]=

Materials explorer (2) 

Find chemical system H-O:

In[4]:=
CH = getSummary[chemsys -> "C-H"][["data", All, "material_id"]]
Out[4]=

All formulas:

In[5]:=
getMaterialsByMaterialId[#, fields -> {"formula_pretty", "material_id"}][["data", 1]] & /@ CH
Out[5]=

Summary Queries (11) 

Structure data for silicon (mp-149):

In[6]:=
docs = getSummaryByMaterialId["mp-149", fields -> "structure"]
Out[6]=

And structure:

In[7]:=
structure = docs[["data", 1, "structure"]]
Out[7]=

Find all Materials Project IDs for entries with dielectric data:

In[8]:=
docs = getSummary["hasProps" -> "dielectric", fields -> "material_id"];

And all materials:

In[9]:=
docs[["data", All, "material_id"]]
Out[9]=

Calculation (task) IDs and types for silicon (mp-149):

In[10]:=
docs = getMaterialsByMaterialId["mp-149", fields -> "calc_types"]
Out[10]=

Task ids:

In[11]:=
taskIds = Keys[docs[["data", 1, "calc_types"]]]
Out[11]=

Task types:

In[12]:=
taskTypes = Values[docs[["data", 1, "calc_types"]]]
Out[12]=

Band gaps for all materials containing only Si and O:

In[13]:=
docs = getSummary[chemsys -> "Si-O", fields -> {"material_id", "band_gap"}];

As assoc:

In[14]:=
mpid = <|Query["data", All, {"material_id", "band_gap"} /* Apply[Rule]] @ docs|>
Out[14]=

Stable materials (on the hull) with large band gaps (>3eV):

In[15]:=
docs = getSummary[fields -> "material_id", bandGapMin -> 3, isStable -> True];

Stable mpids:

In[16]:=
stableMpids = docs[["data", All, "material_id"]]
Out[16]=

Publisher

Kirill Belov

Disclosures

Compatibility

Wolfram Language Version 13.0

Version History

  • 1.0.2 – 05 December 2022
  • 1.0.1 – 01 November 2022
  • 1.0.0 – 01 November 2022

License Information

MIT License

Paclet Source