{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Test your pyiron installation\n", "The goal of this notebooks is to evaluate your pyiron installation - to identify which components are working and which are might need some additional configuration." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Your operation system\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'linux'" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import sys\n", "sys.platform # ['linux', 'darwin', 'win32']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Test pyiron \n", "Install pyiron from conda-forge: \n", "```\n", "conda install -c conda-forge pyiron\n", "```" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "# packages in environment at /srv/conda/envs/notebook:\r\n", "#\r\n", "# Name Version Build Channel\r\n", "pyiron 0.2.11 pyh9f0ad1d_0 conda-forge\r\n" ] } ], "source": [ "! conda list pyiron" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Install location\n", "List where conda is installed:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'/srv/conda/envs/notebook/lib/python3.7/site-packages/pyiron/__init__.py'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pyiron\n", "pyiron.__file__ # location where pyiron is installed " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Your .pyiron configuration \n", "Check pyiron configuration, if pyiron is not configured, configure it using: \n", "```\n", "python\n", ">>> import pyiron\n", ">>> pyiron.install()\n", "```" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'user': 'pyiron',\n", " 'resource_paths': ['/home/jovyan/resources'],\n", " 'project_paths': ['/home/jovyan/'],\n", " 'sql_connection_string': 'sqlite:////home/jovyan/resources/sqlite.db',\n", " 'sql_table_name': 'jobs_pyiron',\n", " 'sql_view_connection_string': None,\n", " 'sql_view_table_name': None,\n", " 'sql_view_user': None,\n", " 'sql_view_user_key': None,\n", " 'sql_file': '/home/jovyan/resources/sqlite.db',\n", " 'sql_host': None,\n", " 'sql_type': 'SQLite',\n", " 'sql_user_key': None,\n", " 'sql_database': None,\n", " 'project_check_enabled': True,\n", " 'disable_database': False}" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from pyiron_base import Settings\n", "s = Settings()\n", "s._configuration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Your pyiron working directory \n", "pyiron restricts the users to execute notebooks only in the `project_paths`. We check if the current working directory is part of the `project_paths`." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "from pyiron import Project\n", "pr = Project('.')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# NGLview for visualizing atomistic structures\n", "NGLView is used for visualisation of atomistic structures. First we check if NGLview was installed using conda: " ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "# packages in environment at /srv/conda/envs/notebook:\r\n", "#\r\n", "# Name Version Build Channel\r\n", "nglview 2.7.5 pyh5ca1d4c_0 conda-forge\r\n" ] } ], "source": [ "! conda list nglview" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For jupyter notebooks nglview can be installed using: \n", "\n", "```\n", "conda install -c conda-forge nglview\n", "jupyter nbextension install nglview --py --sys-prefix\n", "jupyter nbextension enable nglview --py --sys-prefix\n", "```\n", "\n", "For jupyterlab the installation is slightly different: \n", "```\n", "conda install -c conda-forge nodejs nglview\n", "jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build\n", "jupyter labextension install nglview-js-widgets\n", "```" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8e74af25dd9246d4bc680137bea3b686", "version_major": 2, "version_minor": 0 }, "text/plain": [ "_ColormakerRegistry()" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8f7ac643d19c4a96807b70df0f7f75cf", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import nglview\n", "nglview.demo() # You should see a molecule which you can rotate in 3D " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Simulation codes\n", "pyiron does not include any simulation codes, these have to be installed separatley:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Lammps \n", "We start with installing Lammps directly from Anaconda (the conda-forge channel provides the executables for Linux and Mac Os X): \n", "```\n", "conda install -c conda-forge lammps \n", "```\n", "For windows Lammps is available from the pyiron conda channel: \n", "```\n", "conda install -c pyiron lammps \n", "```" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "# packages in environment at /srv/conda/envs/notebook:\r\n", "#\r\n", "# Name Version Build Channel\r\n", "lammps 2020.03.03 py37_mpich_2 conda-forge\r\n" ] } ], "source": [ "! conda list lammps" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The job static was saved and received the ID: 1\n" ] } ], "source": [ "from pyiron import Project\n", "pr = Project('lammps')\n", "lmp = pr.create_job(pr.job_type.Lammps, 'static')\n", "lmp.structure = pr.create_structure('Fe', 'bcc', 2.55)\n", "lmp.potential = 'Fe_C_Hepburn_Ackland_eam'\n", "lmp.run() # The job static was saved and received the ID: 1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Lammps interactive \n", "The conda-forge channel includes the Lammps executables as well as the Lammps library, unfortunatley this is not available for windows. Therefore for Windows we recommend installing pyiron using the Linux subsystem." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The job interactive was saved and received the ID: 1\n", "[-6.38884508 -6.38884508 -6.38884508]\n", "[-6.38884508 -6.38884508 -6.38884508 -6.38884508]\n" ] } ], "source": [ "from pyiron import Project\n", "pr = Project('lammps')\n", "lmp = pr.create_job(pr.job_type.Lammps, 'interactive')\n", "lmp.structure = pr.create_structure('Fe', 'bcc', 2.55)\n", "lmp.potential = 'Fe_C_Hepburn_Ackland_eam'\n", "lmp.server.run_mode.interactive = True\n", "lmp.run() # The job interactive was saved and received the ID: 1\n", "print(lmp.output.energy_tot) # [-6.38884508]\n", "lmp.run()\n", "print(lmp.output.energy_tot) # [-6.38884508 -6.38884508]\n", "lmp.interactive_close() " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Sphinx \n", "The Sphinx DFT code is developed at the MPIE and it can be installed for Linux using the conda-forge channel: \n", "```\n", "conda install -c conda-forge sphinxdft\n", "```" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "# packages in environment at /srv/conda/envs/notebook:\r\n", "#\r\n", "# Name Version Build Channel\r\n", "sphinxdft 2.6.1 h6ced99e_5 conda-forge\r\n" ] } ], "source": [ "! conda list sphinxdft" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The job static was saved and received the ID: 2\n", "The files are already compressed!\n" ] } ], "source": [ "from pyiron import Project\n", "pr = Project('sphinx')\n", "lmp = pr.create_job(pr.job_type.Sphinx, 'static')\n", "lmp.structure = pr.create_structure('Fe', 'bcc', 2.55)\n", "lmp.run() # The job static was saved and received the ID: 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## GPAW \n", "Besides Sphinx is GPAW a second opensource DFT code available for pyiron. For both Mac Os X and Linux GPAW is available from conda-forge available: \n", "```\n", "conda install -c conda-forge \n", "```" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "# packages in environment at /srv/conda/envs/notebook:\r\n", "#\r\n", "# Name Version Build Channel\r\n", "gpaw 19.8.1 py37_nompi_0 conda-forge\r\n" ] } ], "source": [ "! conda list gpaw" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The job static was saved and received the ID: 3\n" ] } ], "source": [ "from pyiron import Project\n", "pr = Project('gpaw')\n", "lmp = pr.create_job(pr.job_type.Gpaw, 'static')\n", "lmp.structure = pr.create_structure('Fe', 'bcc', 2.55)\n", "lmp.run() # The job static was saved and received the ID: 3" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.7.6" } }, "nbformat": 4, "nbformat_minor": 4 }