Skip to content

Instantly share code, notes, and snippets.

@computron
computron / print_corrections.py
Last active August 29, 2015 14:01
Print all corrections applied on a Materials Project entry
"""
This example prints out the corrections applied by a Compatibility scheme
(e.g., MaterialsProjectCompatibility) in order to improve the accuracy of reaction energies
and phase diagrams.
To run this example, you should:
* have pymatgen (www.pymatgen.org) installed
* obtain a Materials Project API key (https://www.materialsproject.org/open)
@computron
computron / get_dos_csv.py
Created February 24, 2016 19:24
Helps convert a DOS to tab-delimited. Useful for experimentalists working in Excel
from pymatgen import MPRester, Spin, Element
def print_dos_data(dos):
print("The Fermi energy is {}".format(dos.efermi))
cols = ["energy", "total_dos", "up_dos", "down_dos"]
energies = dos.energies
total_dos = dos.get_densities() # note that you can also get smeaered densities using a different function
up_dos = dos.get_densities(Spin.up)
@computron
computron / BulkModulus.ipynb
Created November 30, 2016 19:10
Demo: Bulk modulus prediction with MatMiner
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@computron
computron / esdr_scopus_to_endnote.py
Last active September 22, 2017 22:33
Look up ESDR researchers by Scopus ID and export citation data to Endnote
from scopus import ScopusAuthor, ScopusAbstract
AUTHOR_SCOPUS_ID = """
Sumanjeet Kaur, 15071548400
Sean Lubner, 55895288700
Fuduo Ma, 55390403200
Ravi Prasher, 7004221271
Peiyuan Yu, 56412335300
Vivek Subramanian, 56504639000
David Suich, 55804751900
@computron
computron / Matminer_bulkmodulus.ipynb
Last active January 21, 2018 01:32
An introductory tutorial for matminer that involves data mining bulk modulus
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@computron
computron / oxidative_stability.py
Last active March 2, 2018 19:40
estimate oxidative stability of a compound using Materials Project data. The higher (less negative) the maximum chemical potential of oxygen that is tolerated, the more stable.
from pymatgen import Composition, Element, MPRester
from pymatgen.analysis.phase_diagram import PhaseDiagram
if __name__ == "__main__":
# stuff the user needs to set
MAPI_KEY = None
FORMULA = "FeP2"
OPEN_ELEMENT = "O"
@computron
computron / print_structures.py
Created May 18, 2014 20:51
Print structures from Materials Project
"""
This example prints out structure(s) by MP id, by formula, or by chemical system
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 / fireworks-vasp_demo.py
Created November 9, 2014 06:09
basic demo of using the fireworks-vasp codebase
from fireworks import Firework
from fireworks.core.firework import Workflow
from fireworks_vasp.tasks import WriteVaspInputTask, VaspCustodianTask, VaspAnalyzeTask
from pymatgen.matproj.rest import MPRester
"""
This demo shows how one can use the fireworks-vasp codebase. It runs only a single VASP job.
To run multiple VASP jobs in a workflow, one needs to pass the directory information between
jobs such that input files can be copied.
"""
@computron
computron / co_authors.py
Last active January 15, 2020 00:04
A script to automatically generate a list of co-authors / collaborators using the Scopus database
"""
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.
INSTRUCTIONS:
@computron
computron / co_authors_v2.py
Created January 9, 2021 03:05
Get co-authors via Scopus
# Thanks to Shyam Dwaraknath!
# Make sure you have an API to SCOPUS set up
from pandas import DataFrame
from pybliometrics.scopus import AuthorRetrieval
author_number = 7404463800 # enter your Scopus author number here, look up on Scopus Author Search (free) https://www.scopus.com/freelookup/form/author.uri
au = AuthorRetrieval(author_number)
coauthors = DataFrame(au.get_coauthors())