-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
173 additions
and
0 deletions.
There are no files selected for viewing
173 changes: 173 additions & 0 deletions
173
mpcontribs-portal/notebooks/contribs.materialsproject.org/melting_points.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "respected-disaster", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import pandas as pd\n", | ||
"\n", | ||
"from mpcontribs.client import Client\n", | ||
"from monty.serialization import loadfn" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "changed-vermont", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# client = Client()\n", | ||
"# client.create_project(\n", | ||
"# name=\"melting_points\",\n", | ||
"# title=\"Melting Points using GNN model\",\n", | ||
"# authors=\"Q.-J. Hong, S.V. Ushakov, A. van de Walle, A. Navrotsky, M. McDermott\",\n", | ||
"# description=\"\"\"\n", | ||
"# The melting point is a fundamental property that is time-consuming to measure or compute, thus hindering\n", | ||
"# high-throughput analyses of melting relations and phase diagrams over large sets of candidate compounds.\n", | ||
"# To address this, we build a machine learning model, trained on a database of ∼10,000 compounds, that can\n", | ||
"# predict the melting temperature in a fraction of a second. The model, made publicly available online,\n", | ||
"# features graph neural network and residual neural network architectures. We demonstrate the model’s usefulness\n", | ||
"# in diverse applications. For the purpose of materials design and discovery, we show that it can quickly discover\n", | ||
"# novel multicomponent materials with high melting points. These predictions are confirmed by density functional\n", | ||
"# theory calculations and experimentally validated. In an application to planetary science and geology, we employ\n", | ||
"# the model to analyze the melting temperatures of ∼4,800 minerals to uncover correlations relevant to the study of\n", | ||
"# mineral evolution.\n", | ||
"# \"\"\",\n", | ||
"# url=\"https://doi.org/10.1073/pnas.2209630119\",\n", | ||
"# )" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "unexpected-edward", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"client = Client(project=\"melting_points\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "entertaining-variance", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"indir = \"/Users/patrick/GoogleDriveLBNL/My Drive/MaterialsProject/gitrepos/mpcontribs-data\"\n", | ||
"melting_pts = pd.DataFrame(loadfn(f\"{indir}/melting_points_df_08_08_23.json.gz\")) # Note: temps in Kelvin" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "convenient-myanmar", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"melting_pts.reset_index(inplace=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "valid-content", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = melting_pts.to_dict(orient=\"records\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "choice-aluminum", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"columns = {\"MeltingPoint\": \"K\"}\n", | ||
"client.init_columns(columns)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "suspended-mailing", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"contributions = []\n", | ||
"\n", | ||
"for d in data:\n", | ||
" val, err = d[\"melting_point\"], d[\"melting_point_uncertainty\"]\n", | ||
" contributions.append({\n", | ||
" \"identifier\": d[\"index\"],\n", | ||
" \"formula\": d[\"reduced_formula\"],\n", | ||
" \"data\": {\n", | ||
" \"MeltingPoint\": f\"{val}+/-{err} K\"\n", | ||
" }\n", | ||
" })\n", | ||
" \n", | ||
"contributions[0]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ffaae86d-f27f-4043-9937-4762f3647794", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"len(contributions)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "surprising-variance", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# client.delete_contributions()\n", | ||
"client.init_columns(columns)\n", | ||
"client.submit_contributions(contributions)\n", | ||
"client.init_columns(columns)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "hearing-vaccine", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"download = client.download_contributions()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.1" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |