Simulation Codes#

ASE#

At the current stage the majority of simulation codes are interfaced using the Atomic Simulation Environment (ASE). The limitation of the ASE based interfaces is that the simulation codes are only used to calculate energies, forces and stresses, while more complex computations like structure optimization or molecular dynamics are implemented in python.

Abinit#

Abinit - Plane wave density functional theory:

import os

from ase.calculators.abinit import Abinit, AbinitProfile
from ase.units import Ry
from atomistics.calculators import evaluate_with_ase

result_dict = evaluate_with_ase(
    task_dict={},
    ase_calculator=Abinit(
        nbands=32,
        ecut=10 * Ry,
        kpts=(3, 3, 3),
        toldfe=1.0e-2,
        profile=AbinitProfile(
            command="abinit",
            pp_paths=os.path.join(os.environ["CONDA_PREFIX"], "share/abinit/LDA_FHI"),
        ),
    ),
)

The full documentation of the corresponding interface is available on the Atomic Simulation Environment website.

EMT#

EMT - Effective medium theory:

from ase.calculators.emt import EMT
from atomistics.calculators import evaluate_with_ase

result_dict = evaluate_with_ase(task_dict={}, ase_calculator=EMT())

The full documentation of the corresponding interface is available on the Atomic Simulation Environment website.

GPAW#

GPAW - Density functional theory Python code based on the projector-augmented wave method:

from gpaw import GPAW, PW
from atomistics.calculators import evaluate_with_ase

result_dict = evaluate_with_ase(
    task_dict={}, ase_calculator=GPAW(xc="PBE", mode=PW(300), kpts=(3, 3, 3))
)
  ___ ___ ___ _ _ _  
 |   |   |_  | | | | 
 | | | | | . | | | | 
 |__ |  _|___|_____|  24.1.0
 |___|_|             

User:   jovyan@jupyter-pyiron-2datomistics-2djetdbyfr
Date:   Wed May  1 22:47:22 2024
Arch:   x86_64
Pid:    754
CWD:    /home/jovyan
Python: 3.10.12
gpaw:   /srv/conda/envs/notebook/lib/python3.10/site-packages/gpaw
_gpaw:  /srv/conda/envs/notebook/lib/python3.10/site-packages/
        _gpaw.cpython-310-x86_64-linux-gnu.so
ase:    /srv/conda/envs/notebook/lib/python3.10/site-packages/ase (version 3.22.1)
numpy:  /srv/conda/envs/notebook/lib/python3.10/site-packages/numpy (version 1.26.4)
scipy:  /srv/conda/envs/notebook/lib/python3.10/site-packages/scipy (version 1.13.0)
libxc:  6.2.2
units:  Angstrom and eV
cores: 1
OpenMP: True
OMP_NUM_THREADS: 1

Input parameters:
  kpts: [3 3 3]
  mode: {ecut: 300.0,
         name: pw}
  xc: PBE

Memory usage: 142.86 MiB
Date: Wed May  1 22:47:22 2024
[jupyter-pyiron-2datomistics-2djetdbyfr:00754] mca_base_component_repository_open: unable to open mca_btl_openib: librdmacm.so.1: cannot open shared object file: No such file or directory (ignored)

The full documentation of the corresponding interface is available on the GPAW website.

Quantum Espresso#

Quantum Espresso - Integrated suite of Open-Source computer codes for electronic-structure calculations:

from ase.calculators.espresso import Espresso, EspressoProfile
from atomistics.calculators import evaluate_with_ase

result_dict = evaluate_with_ase(
    task_dict={},
    ase_calculator=Espresso(
        pseudopotentials={"Al": "Al.pbe-n-kjpaw_psl.1.0.0.UPF"},
        tstress=True,
        tprnfor=True,
        kpts=(3, 3, 3),
        profile=EspressoProfile(
            command="pw.x",
            pseudo_dir="tests/static/qe",
        ),
    ),
)

The full documentation of the corresponding interface is available on the Atomic Simulation Environment website.

Siesta#

Siesta - Electronic structure calculations and ab initio molecular dynamics:

import os
from ase.calculators.siesta import Siesta
from ase.units import Ry
from atomistics.calculators import evaluate_with_ase

result_dict = evaluate_with_ase(
    task_dict={},
    ase_calculator=Siesta(
        label="siesta",
        xc="PBE",
        mesh_cutoff=200 * Ry,
        energy_shift=0.01 * Ry,
        basis_set="DZ",
        kpts=(5, 5, 5),
        fdf_arguments={"DM.MixingWeight": 0.1, "MaxSCFIterations": 100},
        pseudo_path=os.path.abspath("tests/static/siesta"),
        pseudo_qualifier="",
    ),
)

The full documentation of the corresponding interface is available on the Atomic Simulation Environment website.

LAMMPS#

LAMMPS - Molecular Dynamics:

from ase.build import bulk
from atomistics.calculators import evaluate_with_lammpslib, get_potential_by_name

structure = bulk("Al", cubic=True)
potential_dataframe = get_potential_by_name(
    potential_name="1999--Mishin-Y--Al--LAMMPS--ipr1", resource_path="static/lammps"
)

result_dict = evaluate_with_lammpslib(
    task_dict={},
    potential_dataframe=potential_dataframe,
)
/srv/conda/envs/notebook/lib/python3.10/site-packages/atomistics/calculators/lammps/potential.py:299: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  df_pot["Config"] = config_lst

The LAMMPS interface is based on the pylammpsmpi package which couples a LAMMPS instance which is parallelized via the Message Passing Interface (MPI) with a serial python process or jupyter notebook. The challenging part about molecular dynamics simulation is identifying a suitable interatomic potential.

To address this challenge the atomistics package is leveraging the NIST database of interatomic potentials. It is recommended to install this database iprpy-data via the conda package manager, then the resource_path is automatically set to ${CONDA_PREFIX}/share/iprpy. Alternatively, the resource_path can be specified manually as an optional parameter of the get_potential_by_name() function.

In addition, the get_potential_dataframe(structure) function which takes an ase.atoms.Atoms object as input can be used to query the NIST database of interatomic potentials for potentials, which include the interatomic interactions required to simulate the atomic structure defined by the ase.atoms.Atoms object. It returns a pandas.DataFrame with all the available potentials and the resource_path can again be specified as optional parameter.

Finally, another option to specify the interatomic potential for a LAMMPS simulation is by defining the potential_dataframe directly:

import pandas

potential_dataframe = pandas.DataFrame(
    {
        "Config": [
            ["pair_style morse/smooth/linear 9.0", "pair_coeff * * 0.5 1.8 2.95"]
        ],
        "Filename": [[]],
        "Model": ["Morse"],
        "Name": ["Morse"],
        "Species": [["Al"]],
    }
)

Quantum Espresso#

Quantum Espresso - Integrated suite of Open-Source computer codes for electronic-structure calculations:

from atomistics.calculators import evaluate_with_qe

result_dict = evaluate_with_qe(
    task_dict={},
    calculation_name="espresso",
    working_directory=".",
    kpts=(3, 3, 3),
    pseudopotentials={
        "Al": "Al.pbe-n-kjpaw_psl.1.0.0.UPF"
    },
    tstress=True,
    tprnfor=True,
    ecutwfc=40.0,          # kinetic energy cutoff (Ry) for wavefunctions
    conv_thr=1e-06,        # Convergence threshold for selfconsistency
    diagonalization='david',  
    electron_maxstep=100,  # maximum number of iterations in a scf step. 
    nstep=200,             # number of molecular-dynamics or structural optimization steps performed in this run.
    etot_conv_thr=1e-4,    # Convergence threshold on total energy (a.u) for ionic minimization
    forc_conv_thr=1e-3,    # Convergence threshold on forces (a.u) for ionic minimization
    smearing='gaussian',   # ordinary Gaussian spreading (Default)
)

This secondary interface for Quantum Espresso is based on the input writer from the Atomic Simulation Environment (ASE) and the output is parsed using the pwtools. The executable can be set using the ASE_ESPRESSO_COMMAND environment variable:

export ASE_ESPRESSO_COMMAND="pw.x -in PREFIX.pwi > PREFIX.pwo"

The full list of possible keyword arguments is available in the Quantum Espresso Documentation. Finally, the Standard solid-state pseudopotentials (SSSP) for quantum espresso are distributed via the materials cloud.