{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Nuclides and ARMI\n", "For starters, we will explore some features of ARMI related to nuclides (recall: a *nuclide* is some isotope of an element. Iron-56, Uranium-238, and Boron-10 are all nuclides). Everyone needs information about nuclides: atomic weights, natural isotopics, number of protons, etc. ARMI comes with some features that can help you in this respect. \n", "\n", "Fire up a Python interpreter, either by running `$ python` or (preferred) `$ ipython`, and let's dive in by importing some modules from the `nucDirectory` package.\n", "\n", "(NOTE: This demo itself is a sourced from a Jupyter notebook)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from armi.nucDirectory import nuclideBases\n", "from armi.nucDirectory import elements" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The ``nuclideBases`` subpackage contains information like Z, A, and abundance of each nuclide. These are loaded from a fairly large [RIPL-based](https://www-nds.iaea.org/RIPL-3/) database that should have pretty much everything that's been measured." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "u235 = nuclideBases.byName['U235']\n", "print(u235)\n", "print('Atomic weight: {}'.format(u235.weight))\n", "print('Natural abundance: {}'.format(u235.abundance))\n", "print(nuclideBases.byName['CF252'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can get information about elements too, like average molecular weight and natural isotopics. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "zirconium = elements.bySymbol['ZR']\n", "print('Average atomic weight: {}'.format(zirconium.standardWeight))\n", "for iso in zirconium.getNaturalIsotopics():\n", " print('{:.5f}: {}'.format(iso.abundance, iso))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "With this info it's pretty easy to do all sorts of neat things, like plot a chart of the nuclides:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "from matplotlib import colors\n", "xyc = []\n", "for name, base in nuclideBases.byName.items():\n", " if not base.a:\n", " continue\n", " xyc.append((base.a-base.z, base.z, base.abundance or 0.5))\n", "x,y,c = zip(*xyc)\n", "plt.figure(figsize=(12,8))\n", "plt.scatter(x,y,c = c, marker='s', s=6)\n", "plt.title('Chart of the nuclides')\n", "plt.xlabel('Number of neutrons (N)')\n", "plt.ylabel('Number of protons (Z)')\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Behold." ] } ], "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.6.3" }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }