Skip to content
Snippets Groups Projects
validation_LiAl.ipynb 673 KiB
Newer Older
Sudarsan Surendralal's avatar
Sudarsan Surendralal committed
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "25d5b0d5-f330-4dcb-9b7c-f57c4bea9596",
   "metadata": {},
   "source": [
    "# **Workshop: From electrons to phase diagrams**\n",
    "\n",
    "# Day 2: Validation of the potentials\n",
    "\n",
    "Once we have the fitted potentials, it is necessary to validate them in order to assess their quality with respect to applications.\n",
    "\n",
    "In this exercise, we use the fitted potentials and perform some basic calculations."
Sudarsan Surendralal's avatar
Sudarsan Surendralal committed
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4756d4c9-304a-4ccc-b772-ba67d008c5a4",
   "metadata": {},
   "source": [
    "## Import the fitted potentials for Li-Al (from earlier excercise)\n",
    "\n",
    "The same directory contains a `helper.py` file which among other things, also contains the necessary specifications of each of the potentials that we will use today. Individual potentials are descrbed in the LAMMPS format as:\n",
    "```\n",
    "pot_eam = pd.DataFrame({\n",
    "    'Name': ['LiAl_eam'],\n",
    "    'Filename': [[\"../potentials/AlLi.eam.fs\")]],\n",
    "    'Model': [\"EAM\"],\n",
    "    'Species': [['Li', 'Al']],\n",
    "    'Config': [['pair_style eam/fs\\n', 'pair_coeff * * AlLi.eam.fs Li Al\\n']]\n",
    "})\n",
    "\n",
    "```\n",
    "A list of such DataFrames describing the potentials is saved in a list called `potentials_list`. We import the list as:"
Sudarsan Surendralal's avatar
Sudarsan Surendralal committed
   ]
  },
  {
   "cell_type": "code",
qamarmt2's avatar
qamarmt2 committed
   "execution_count": 1,
   "id": "b90e0ac0",
Sudarsan Surendralal's avatar
Sudarsan Surendralal committed
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Name</th>\n",
       "      <th>Filename</th>\n",
       "      <th>Model</th>\n",
       "      <th>Species</th>\n",
       "      <th>Config</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
qamarmt2's avatar
qamarmt2 committed
       "      <td>LiAl_eam</td>\n",
       "      <td>[/home/jovyan/workshop_preparation/potentials/...</td>\n",
       "      <td>EAM</td>\n",
       "      <td>[Li, Al]</td>\n",
       "      <td>[pair_style eam/fs\\n, pair_coeff * * AlLi.eam....</td>\n",
Sudarsan Surendralal's avatar
Sudarsan Surendralal committed
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
qamarmt2's avatar
qamarmt2 committed
       "       Name                                           Filename Model  \\\n",
       "0  LiAl_eam  [/home/jovyan/workshop_preparation/potentials/...   EAM   \n",
qamarmt2's avatar
qamarmt2 committed
       "\n",
qamarmt2's avatar
qamarmt2 committed
       "    Species                                             Config  \n",
       "0  [Li, Al]  [pair_style eam/fs\\n, pair_coeff * * AlLi.eam....  "
Sudarsan Surendralal's avatar
Sudarsan Surendralal committed
      ]
     },
qamarmt2's avatar
qamarmt2 committed
     "execution_count": 1,
Sudarsan Surendralal's avatar
Sudarsan Surendralal committed
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from helper import potentials_list\n",
    "\n",
qamarmt2's avatar
qamarmt2 committed
    "# potentials_list = [potentials_list[1]]\n",
    "\n",
    "# display the first element in the list\n",
    "# which is an EAM potential\n",
qamarmt2's avatar
qamarmt2 committed
    "potentials_list[0]"
  {
   "cell_type": "markdown",
   "id": "4c84560c",
   "metadata": {},
   "source": [
    "### Import other important modules"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "83f7a2c9-d45a-4987-9e35-59badd754d4f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
qamarmt2's avatar
qamarmt2 committed
       "1654601899.1397257"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pylab as plt\n",
    "import seaborn as sns\n",
    "import pandas as pd\n",
    "import time\n",
    "from helper import get_clean_project_name\n",
    "from pyiron_atomistics import Project\n",
    "from pyiron import pyiron_to_ase\n",
    "import pyiron_gpl\n",
    "\n",
    "# save start time to record runtime of the notebook\n",
qamarmt2's avatar
qamarmt2 committed
    "time_start =  time.time()\n",
    "time_start"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "acc0ee8f",
   "metadata": {},
   "source": [
    "### Create a new project to perform validation calculations\n",
    "\n",
    "It is useful to create a new project directory for every kind of calculation. Pyiron will automatically create subdirectories for each potential and property we calculate. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "706be2a9-5f94-4eb5-8e4f-6c349fe216b3",
   "metadata": {},
qamarmt2's avatar
qamarmt2 committed
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "e51d75e54818412eb80fb490eb51d974",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "  0%|          | 0/551 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "pr = Project(\"validation_LiAl\")\n",
    "\n",
    "# remove earlier jobs\n",
qamarmt2's avatar
qamarmt2 committed
    "pr.remove_jobs(silently=True, recursive=True)"
Sudarsan Surendralal's avatar
Sudarsan Surendralal committed
  {
   "cell_type": "markdown",
   "id": "3b84ed62-e841-4526-893e-dc4f61477c88",
   "metadata": {},
   "source": [
    "### Define the important pases to consider for validation\n",
    "\n",
    "We construct a python dictionary `struct_dict` which contains a description of all the important phases that we want to consider for this exercise. The descriptions given in the dictionary will be later used by Pyiron to generate or read the structural configurations for the respective phases.\n",
    "\n",
    "For unary phases, we provide an initial guess for the lattice parameter and use pyiron to generate the structural prototype.\n",
    "\n",
    "For binary phases, we provide a phase name and an additional dictionary `fl_dict` which maps the phase name to a `.cif` file saved in a subdirectory. Pyiron will use this information to read the respective configurations from the file."
Loading
Loading full blame...