{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Entropy parameters" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this example, the entropy parameters are calculated and used for distinction of solid and liquid. For a description of entropy parameters, see [here](http://pyscal.com/en/latest/methods/entropy_parameters/entropy_parameters.html). " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pyscal.core as pc\n", "import matplotlib.pyplot as plt\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We have two test configurations for Al at 900 K, one is fcc structured and the other one is in liquid state. We calculate the entropy parameters for each of these configurations. First we start by reading in the fcc configuration. For entropy parameters, the values of the integration limit $r_m$ is chosen as 1.4, based on the [original publication](https://aip.scitation.org/doi/10.1063/1.4998408). " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "sys = pc.System()\n", "sys.read_inputfile(\"../tests/conf.fcc.Al.dump\")\n", "sys.find_neighbors(method=\"cutoff\", cutoff=0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The values of $r_m$ is in units of lattice constant, so we need to calculate the lattice constant first. Since is a cubic box, we can do this by," ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "lat = (sys.box[0][1]-sys.box[0][0])/5" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we calculate the entropy parameter and its averaged version. Averaging can be done in two methods, as a simple average over neighbors or using a switching function. We will use a simple averaging over the neighbors. The local keyword allows to use a local density instead of the global one. However, this only works if the neighbors were calculated using a cutoff method." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "sys.calculate_entropy(1.4*lat, averaged=True, local=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The calculated values are stored for each atom. This can be accessed as follows," ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "atoms = sys.atoms\n", "solid_entropy = [atom.entropy for atom in atoms]\n", "solid_avg_entropy = [atom.avg_entropy for atom in atoms]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we can quickly repeat the calculation for the liquid structure." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "sys = pc.System()\n", "sys.read_inputfile(\"../tests/conf.lqd.Al.dump\")\n", "sys.find_neighbors(method=\"cutoff\", cutoff=0)\n", "lat = (sys.box[0][1]-sys.box[0][0])/5\n", "sys.calculate_entropy(1.4*lat, local=True, averaged=True)\n", "atoms = sys.atoms\n", "liquid_entropy = [atom.entropy for atom in atoms]\n", "liquid_avg_entropy = [atom.avg_entropy for atom in atoms]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally we can plot the results" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Text(0.5, 0, '$s_s^i$')" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAENCAYAAAASUO4dAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAASZklEQVR4nO3df4zkd13H8eeL6xnKD0Ox23r9xQleENLoFTcVU2OAUlMLodSooYnljOgRsbGkGC2QCGhUUChoouABDSc/Ck2QtDYIlAoCBop7cD2uXvXAnNj27C2iUoSIbd/+Md+T7d7u7XdnZ3bms/t8JJOZ73e+M/PK3N5rP/uZ73y/qSokSe161KQDSJLWxiKXpMZZ5JLUOItckhpnkUtS4yxySWrcKev5Yqeffnpt3759PV9Skpq3b9++r1XVzHL3r2uRb9++nbm5ufV8SUlqXpJ/Odn9Tq1IUuMscklqnEUuSY2zyCWpcRa5JDXOIpekxlnkktQ4i1ySGreuXwhq3eHrrz9h3Y5rr51AEkn6LkfkktQ4i1ySGmeRS1LjLHJJapx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