Volcano Plot
Overview¶
Welcome! This guide will teach you how to get started with Python and The Materials Project API. The Materials Project is a powerful database providing access to over 140,000 unique materials. These materials along with a plethora of their properties were calculated ab-initio, or from first principles. Many of these calculations are driven by high-throughput density-functional theory (DFT). Given only a materials crystal structure, DFT can calculate a variety of different materials properties. By the end of this guide you'll have learned to (1) run Python scripts, (2) connect to the Materials Project API, and (3) plot in matplotlib. This will be done by creating what we like to call "The Volcano Plot" from the paper, "A map of the inorganic ternary metal nitrides", by Wenhao Sun et al.

Connecting to the Materials Project API¶
The Materials Project allows anyone to have direct access to current, most up-to-date information for the Materials Project database through their application programming interface (API).
Getting a Key¶
Go to the Materials Project API and create an account to acquire a key. This key is your API access to their database. Keep track of this.
Connecting to the API¶
Since you've created a new conda environment, you'll need to install the required packages in order to connect to the Materials Project API. This can be done via conda install <package name>
. In your environment type:
conda install mp-api
into your terminal. After doing open a new python file and run the following code:
# Testing connectivity to API by grabbing data for "mp-149"
from mp_api import MPRester
with MPRester(api_key=YOUR_KEY) as mpr:
doc = mpr.summary.get_data_by_id("mp-149")
Completing the Onboarding Assignment¶
Now you have all the necessary ground work to produce the volcano plot! The next steps are entirely up to you, but I would recommend following the ordered list below.
- Read "A map of the inorganic ternary metal nitrides", by Wenhao Sun et al.
- Read the Materials Project API Docs and play around with the API functionality.
- Acquire the data needed to create the volcano plot.
- Familiarize yourself with matplotlib, then make the plot! Note: The plot may look slightly different from API changes over the years.
Lastly, good luck!