All Projects → materialsproject → Mapidoc

materialsproject / Mapidoc

Licence: bsd-3-clause
Public repo for Materials API documentation

Projects that are alternatives of or similar to Mapidoc

Learn machine learning
Road to Machine Learning
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Caffe Spn
Codes for Learning Affinity via Spatial Propagation Networks
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Video2gif code
Video2GIF neural network model from our paper at CVPR2016
Stars: ✭ 80 (-1.23%)
Mutual labels:  jupyter-notebook
Unet Tgs
Applying UNET Model on TGS Salt Identification Challenge hosted on Kaggle
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Ai For Trading
code repository for Udacity nanodegree Artificial Intelligence for Trading
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Summerschool2017
Material for the Montréal Deep Learning Summer School 2017
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Deep transfer learning nlp dhs2019
Contains the code and deck for the presentation on Applying Deep Transfer Learning for NLP in Analytics Vidhya's DataHack Summit 2019
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Data8assets
Assets for data8.org
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Whatsapp Radiologist
A chatbot built in python using Selenium module.
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Entailment With Tensorflow
Accompanying notebook for the Entailment with Tensorflow article.
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Mlnetexamples
A collection of examples for the ML.NET machine learning package from Microsoft
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Ltpextraction
基于ltp的简单评论观点抽取模块
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
How to generate video
This is the code for "How to Generate Video - Intro to Deep Learning #15' by Siraj Raval on YouTube
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Scala Cheatsheet
The Biggest Scala Cheat-Sheet.
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Continuous analysis
Computational reproducibility using Continuous Integration to produce verifiable end-to-end runs of scientific analysis.
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Neural Structural Optimization
Neural reparameterization improves structural optimization
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
2017 Ccf Bdci Enterprise
2017-CCF-BDCI-企业经营退出风险预测:9th/569 (Top 1.58%)
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Dviz Course
Data visualization course material
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Expo Mf
Exposure Matrix Factorization: modeling user exposure in recommendation
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook
Mad
Code for "Online and Linear Time Attention by Enforcing Monotonic Alignments"
Stars: ✭ 81 (+0%)
Mutual labels:  jupyter-notebook

Introduction

This is the public repo for the documentation of the Materials API. The Materials API is a simple, flexible and efficient interface to programmatically query and interact with the Materials Project database based on the REpresentational State Transfer (REST) pattern for the web. Since its creation in Aug 2012, the Materials API has been the Materials Project’s de facto platform for data access, supporting not only the Materials Project’s many collaborative efforts but also enabling new applications and analyses.

Example notebooks

We have added a few example ipython notebooks demonstrating the features of the Materials API. The NB Viewer version is at this link. Also, you can use the Binder service (in beta) to launch an interactive notebook right now! Click the button below to open our introductory notebook. To nagivate to other notebooks, go to "File->Open" within the page and click example_notebooks to open one of them.

Binder

Using this repo

The usage of this repo follows a REST format. The primary use of this repo is to explore the Materials Project's document format and use that info for much more powerful queries with the pymatgen (Python Materials Genomics) MPRester.query() method. For more standard queries, the Materials API already has a wiki page and pymatgen already provides useful high-level functions for them.

  1. Start from the materials directory in this repo. The nested directory structure follows the MongoDB json-like document schema for the Materials Project's materials collection.

  2. In each folder, there is a README.md that describes what that key is. For example, in materials/final_energy, the README.md informs you that the final_energy key refers final calculated energy of the material. Similarly, the materials/task_id informs you that the task_id key is in fact the materials id for the Materials Project.

  3. To use this in MPRester, one may use the following code:

    from pymatgen import MPRester
    m = MPRester()
    data = m.query(criteria={"task_id": "mp-1234"}, properties=["final_energy"])
    print(data)
    

    The data obtained is then [{u'final_energy': -26.94736193}]. Note that the data returned is always a list of dicts.

  4. For a more complicated example, you can try:

    data = m.query(criteria={"pretty_formula": "Li2O"}, properties=["spacegroup.symbol"])
    

    You can identify the appropriate key by going to the materials/spacegroup/symbol subfolder. This means that the desired information is in spacegroup.symbol (concantenate all subfolders with "." and drop the initial "materials" prefix).

  5. One more very complicated example. Let's say you would like to query for the tags and icsd_ids of all materials containing Fe and O, and perhaps other elements.

    data = m.query(criteria={"elements": {"$all": ["Fe", "O"]}}, properties=["exp.tags", "icsd_ids"])
    

    Note that the criteria and properties follows the format (and richness) of MongoDB queries. You can refer to the MongoDB documentation for more information on how to customize queries.

It should be noted that not all materials documents contains all keys, e.g., some properties may not have been computed for certain materials yet. If you request for a key that is not present in a doc, the query will return None. For the most part, the documents are relatively consistent, especially for many of the common keys like elements, formulas, etc.

Alternative usage of this documentation

While the easiest way to use the Materials API is to leverage pymatgen's high-level interface to it, you may also directly submit a http POST query to https://www.materialsproject.org/rest/v2/query. For instance, you may wish to write your own app or queries in another language.

The https://www.materialsproject.org/rest/v2/query API provides functionality for flexible queries against the Materials Project database using MongoDB syntax, enabling queries which would otherwise not be possible using the other simpler REST forms. For example, a POST to query with parameters

criteria = '{"elements":{"$in":["Li", "Na", "K"], "$all": ["O"]}, "nelements":2}'
properties ='["formula", "formation_energy_per_atom"]'

will return the formula and formation energy per atom of all Li, Na and K oxides.

Using the command-line tool curl:

curl -s --header "X-API-KEY: <YOUR-API-KEY>" \
    https://materialsproject.org/rest/v2/query \
    -F criteria='{"elements": {"$in": ["Li", "Na", "K"], "$all": ["O"]}, "nelements": 2}' \
    -F properties='["formula", "formation_energy_per_atom"]'

Using Python and the requests library:

import json
import requests

data = {
    'criteria': {
        'elements': {'$in': ['Li', 'Na', 'K'], '$all': ['O']},
        'nelements': 2,
    },
    'properties': [
        'formula',
        'formation_energy_per_atom',
    ]
}
r = requests.post('https://materialsproject.org/rest/v2/query',
                 headers={'X-API-KEY': '<YOUR-API-KEY>'},
                 data={k: json.dumps(v) for k,v in data.items()})
response_content = r.json() # a dict

Using another language, e.g. MATLAB? See this MP discussion forum thread for more guidance. In particular, you need to treat "criteria" and "properties" as fields whose data are JSON-serialized strings.

Tips for efficient querying

Try to minimize the scope of the properties you are requesting. For example, if you are only interested in the XRD pattern for Cu Kα, do not just use properties=["xrd"] which will fetch the computed XRD patterns for all wavelengths. This results in a larger data transfer and slow queries. Instead, use properties=["xrd.Cu"].

Searching for properties

You can use Github's built-in search box at the top to search this repository for text that matches your query. For example, you can try searching for the word "spacegroup" to see the that the "spacegroup" root key exists with sub-keys such as "number" and "symbol".

Beause this repository's folder structure mirrors a material document's structure, you can also use the quick finder (keyboard shortcut: t) to interactively explore the structure.

Contributing

The initial version of this documentation is brought to you by the Materials Project development team. But it is our hope that others can contribute as well, either by cloning and editing this documentation (and sending pull requests) or just by informing us of any errors or omissions in the doc (e.g., by using the "Issues" tab).

Citing the Materials API

If you use the Materials API extensively, you may wish to cite the following publication.

Ong, S. P.; Cholia, S.; Jain, A.; Brafman, M.; Gunter, D.; Ceder, G.; 
Persson, K. a. The Materials Application Programming Interface (API): A 
simple, flexible and efficient API for materials data based on
REpresentational State Transfer (REST) principles, Comput. Mater. Sci.,
2015, 97, 209–215. doi:10.1016/j.commatsci.2014.10.037.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].