{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "d22847a1", "metadata": {}, "outputs": [], "source": [ "import o2sclpy\n", "import numpy" ] }, { "cell_type": "code", "execution_count": 2, "id": "d8bfc0af", "metadata": {}, "outputs": [], "source": [ "link=o2sclpy.linker()\n", "link.link_o2scl()" ] }, { "cell_type": "markdown", "id": "c0d1a855", "metadata": {}, "source": [ "Get a copy (a pointer to) the O$_2$scl unit conversion object, which\n", "also allows access to the constant library, then get ħc." ] }, { "cell_type": "code", "execution_count": 3, "id": "4b2bf486", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "hbarc = 1.973270e+02\n" ] } ], "source": [ "cu=link.o2scl_settings.get_convert_units()" ] }, { "cell_type": "code", "execution_count": null, "id": "46208972", "metadata": {}, "outputs": [], "source": [ "hc=cu.find_unique('hbarc','MeV*fm')\n", "print('hbarc = %7.6e' % (hc))" ] }, { "cell_type": "code", "execution_count": 4, "id": "6932b5bc", "metadata": {}, "outputs": [], "source": [ "# Instantiate and load the Atomic Mass Evaluation\n", "ame=o2sclpy.nucmass_ame(link)\n", "o2sclpy.ame_load(link,ame,'16',False)" ] }, { "cell_type": "code", "execution_count": 5, "id": "3ecc90a3", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of isotopes in the AME list: 3436\n" ] } ], "source": [ "# Print out the number of entries\n", "print('Number of isotopes in the AME list:',ame.get_nentries())" ] }, { "cell_type": "code", "execution_count": 6, "id": "9e0805fb", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Get lead-208\n", "nuc=o2sclpy.nucleus(link)\n", "ame.get_nucleus(82,126,nuc)" ] }, { "cell_type": "code", "execution_count": 7, "id": "b8bdd0ac", "metadata": { "lines_to_next_cell": 1 }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Binding energy per nucleon in Pb-208 = -7.867459e+00 \n" ] } ], "source": [ "# Output the binding energy per nucleon in MeV\n", "print('Binding energy per nucleon in Pb-208 = %7.6e ' % (nuc.be/208*hc))" ] }, { "cell_type": "code", "execution_count": 8, "id": "acfea247", "metadata": {}, "outputs": [], "source": [ "def test_fun():\n", " assert numpy.allclose(nuc.be/208*hc,-7.867,rtol=1.0e-3)\n", " return" ] } ], "metadata": { "jupytext": { "cell_metadata_filter": "-all", "main_language": "python", "notebook_metadata_filter": "-all" }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.2" } }, "nbformat": 4, "nbformat_minor": 5 }