Skip to content

Instantly share code, notes, and snippets.

@computron
computron / gcpd_example.py
Last active February 27, 2022 09:47
Create, plot, and analyze OPEN (grand canonical) Phase Diagrams using the pymatgen codebase and Materials Project database
"""
This is a basic example of how to create, plot, and analyze OPEN Phase Diagrams using the pymatgen
codebase and Materials Project database. To run this example, you should:
* have pymatgen (www.pymatgen.org) installed along with matplotlib
* obtain a Materials Project API key (https://www.materialsproject.org/open)
* paste that API key in the MAPI_KEY variable below, e.g. MAPI_KEY = "foobar1234"
For citation, see https://www.materialsproject.org/citing
For the accompanying comic book, see http://www.hackingmaterials.com/pdcomic
"""
from __future__ import print_function
@computron
computron / create_vaspinputs.py
Created May 18, 2014 20:55
Create VASP inputs for an MP structure
"""
This example prints out VASP inputs for an MP structure.
To run this example, you should:
* have pymatgen (www.pymatgen.org) installed
* obtain a Materials Project API key (https://www.materialsproject.org/open)
* paste that API key in the MAPI_KEY variable below, e.g. MAPI_KEY = "foobar1234"
as well as:
@computron
computron / co_authors_v3.py
Created February 9, 2022 23:58
A script to automatically generate a list of co-authors / collaborators using the Scopus database - now with year of last collaboration
"""
OVERVIEW: This script will automatically export a list of all your co-authors and
their institutions to an Excel file based on information already in the Scopus database.
LIMITATIONS:
1. Only up to 150 collaborators are supported by Scopus.
2. Sometimes, you want to filter by collaborators for only the last 4 years. Unfortunately, there
is no simple way to do this up front, but by enabling the years option you can filter at the end.
INSTRUCTIONS (these are actually important!):
@computron
computron / plot_bs.py
Last active July 13, 2022 23:19
plot_bandstructure
"""
This example prints out a band structure object of a Materials Project entry.
To run this example, you should:
* have pymatgen (www.pymatgen.org) installed
* obtain a Materials Project API key (https://www.materialsproject.org/open)
* paste that API key in the MAPI_KEY variable below, e.g. MAPI_KEY = "foobar1234"
as well as:
@computron
computron / check_stability.py
Last active August 18, 2023 16:26
Check a new material's stability using the pymatgen codebase and Materials Project database
"""
This is a basic example of how to check a new material for stability using the pymatgen
codebase and Materials Project database. It assumes that you have already calculated
the energy of your predicted compound with DFT.
It is very important to note that this code does NOT do a detailed check to make sure
your computed energies are compatible with those in the Materials Project database
(i.e., uses the same functional, +U corrections, k-point mesh, etc). You must ensure
that the energies you provide are directly comparable with those in Materials Project,
otherwise this code will give you false results!
@computron
computron / pd_example.py
Created May 8, 2014 18:33
Create, plot, and analyze Phase Diagrams using the pymatgen codebase and Materials Project database
"""
This is a basic example of how to create, plot, and analyze Phase Diagrams using the pymatgen
codebase and Materials Project database. To run this example, you should:
* have pymatgen (www.pymatgen.org) installed along with matplotlib
* obtain a Materials Project API key (https://www.materialsproject.org/open)
* paste that API key in the MAPI_KEY variable below, e.g. MAPI_KEY = "foobar1234"
For citation, see https://www.materialsproject.org/citing
For the accompanying comic book, see http://www.hackingmaterials.com/pdcomic