Test your pyiron installation

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.

Your operation system

In [1]:
import sys
sys.platform  # ['linux', 'darwin', 'win32']
Out[1]:
'linux'

Test pyiron

Install pyiron from conda-forge:

conda install -c conda-forge pyiron
In [2]:
! conda list pyiron
# packages in environment at /srv/conda/envs/notebook:
#
# Name                    Version                   Build  Channel
pyiron                    0.2.11             pyh9f0ad1d_0    conda-forge

Install location

List where conda is installed:

In [3]:
import pyiron
pyiron.__file__  # location where pyiron is installed 
Out[3]:
'/srv/conda/envs/notebook/lib/python3.7/site-packages/pyiron/__init__.py'

Your .pyiron configuration

Check pyiron configuration, if pyiron is not configured, configure it using:

python
>>> import pyiron
>>> pyiron.install()
In [4]:
from pyiron.base.settings.generic import Settings
s = Settings()
s._configuration
Out[4]:
{'user': 'pyiron',
 'resource_paths': ['/home/jovyan/resources'],
 'project_paths': ['/home/jovyan/'],
 'sql_connection_string': 'sqlite:////home/jovyan/resources/sqlite.db',
 'sql_table_name': 'jobs_pyiron',
 'sql_view_connection_string': None,
 'sql_view_table_name': None,
 'sql_view_user': None,
 'sql_view_user_key': None,
 'sql_file': '/home/jovyan/resources/sqlite.db',
 'sql_host': None,
 'sql_type': 'SQLite',
 'sql_user_key': None,
 'sql_database': None,
 'project_check_enabled': True,
 'disable_database': False}

Your pyiron working directory

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.

In [5]:
from pyiron import Project
pr = Project('.')

NGLview for visualizing atomistic structures

NGLView is used for visualisation of atomistic structures. First we check if NGLview was installed using conda:

In [6]:
! conda list nglview
# packages in environment at /srv/conda/envs/notebook:
#
# Name                    Version                   Build  Channel
nglview                   2.7.5              pyh5ca1d4c_0    conda-forge

For jupyter notebooks nglview can be installed using:

conda install -c conda-forge nglview
jupyter nbextension install nglview --py --sys-prefix
jupyter nbextension enable nglview --py --sys-prefix

For jupyterlab the installation is slightly different:

conda install -c conda-forge nodejs nglview
jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build
jupyter labextension install nglview-js-widgets
In [7]:
import nglview
nglview.demo()  # You should see a molecule which you can rotate in 3D 

Simulation codes

pyiron does not include any simulation codes, these have to be installed separatley:

Lammps

We start with installing Lammps directly from Anaconda (the conda-forge channel provides the executables for Linux and Mac Os X):

conda install -c conda-forge lammps

For windows Lammps is available from the pyiron conda channel:

conda install -c pyiron lammps
In [8]:
! conda list lammps
# packages in environment at /srv/conda/envs/notebook:
#
# Name                    Version                   Build  Channel
lammps                    2020.03.03         py37_mpich_2    conda-forge
In [9]:
from pyiron import Project
pr = Project('lammps')
pr.remove_jobs(recursive=True)
lmp = pr.create_job(pr.job_type.Lammps, 'static')
lmp.structure = pr.create_structure('Fe', 'bcc', 2.55)
lmp.potential = 'Fe_C_Hepburn_Ackland_eam'
lmp.run()  # The job static was saved and received the ID: 1
The job static was saved and received the ID: 1

Lammps interactive

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.

In [10]:
from pyiron import Project
pr = Project('lammps')
pr.remove_jobs(recursive=True)
lmp = pr.create_job(pr.job_type.Lammps, 'interactive')
lmp.structure = pr.create_structure('Fe', 'bcc', 2.55)
lmp.potential = 'Fe_C_Hepburn_Ackland_eam'
lmp.server.run_mode.interactive = True
lmp.run()  # The job interactive was saved and received the ID: 1
print(lmp.output.energy_tot)  # [-6.38884508]
lmp.run()
print(lmp.output.energy_tot) # [-6.38884508 -6.38884508]
lmp.interactive_close()  
The job interactive was saved and received the ID: 1
[-6.38884508 -6.38884508 -6.38884508]
[-6.38884508 -6.38884508 -6.38884508 -6.38884508]

Sphinx

The Sphinx DFT code is developed at the MPIE and it can be installed for Linux using the conda-forge channel:

conda install -c conda-forge sphinxdft
In [11]:
! conda list sphinxdft
# packages in environment at /srv/conda/envs/notebook:
#
# Name                    Version                   Build  Channel
sphinxdft                 2.6.1                h6ced99e_5    conda-forge
In [12]:
from pyiron import Project
pr = Project('sphinx')
pr.remove_jobs(recursive=True)
lmp = pr.create_job(pr.job_type.Sphinx, 'static')
lmp.structure = pr.create_structure('Fe', 'bcc', 2.55)
lmp.run()  # The job static was saved and received the ID: 2
The job static was saved and received the ID: 2
The files are already compressed!

GPAW

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:

conda install -c conda-forge
In [13]:
! conda list gpaw
# packages in environment at /srv/conda/envs/notebook:
#
# Name                    Version                   Build  Channel
gpaw                      19.8.1             py37_nompi_0    conda-forge
In [14]:
from pyiron import Project
pr = Project('gpaw')
pr.remove_jobs(recursive=True)
lmp = pr.create_job(pr.job_type.GpawJob, 'static')
lmp.structure = pr.create_structure('Fe', 'bcc', 2.55)
lmp.run()  # The job static was saved and received the ID: 3
The job static was saved and received the ID: 3
In [ ]: