Get started#

Requirements#

To use aiida-lammps one should have already:

  • installed aiida-core

  • configured an AiiDA profile.

Information about how to perform these steps can be found in the aiida-core documentation

Installation#

The package can be installed either from the Python Package Index PyPI or from the source.

Installing via PyPI can be done making use of the Python package manager pip:

pip install aiida-lammps

This will install the latest release version available in PyPI. Other releases can be installed vy explicitly passing the release version number in the installation command.

To install from source one needs to clone the repository and then install the package making use of pip:

git clone https://github.com/aiidaplugins/aiida-lammps.git
pip install -e aiida-lammps

Notice that the flag -e means that the package is installed in editable mode, meaning that any changes to the source code will be automatically picked up.

Note

Installing from source in the editable mode is recommended when developing as one would not need to re-install the package every time that a change has been made.

Setup#

Setting up aiida-lammps to run a LAMMPS job is done in a similar way as any other AiiDA plugin. That is a Computer and a Code need to be setup for the current profile.

Computer#

A Computer is an aiida data type that contains the information about a compute resource, this could be a local machine, a remote personal computer, an HPC center, etc. Basically it is the machine where LAMMPS is installed and it will be run.

For the following it will be considered that LAMMPS is installed in the same machine where the AiiDA instance is running, i.e. localhost.

The computer setup can be done either via the AiiDA command line interface (CLI), verdi, or the Python application programming interface (API).

To define the computer via the CLI one needs to run the following command:

verdi computer setup -n --label localhost --hostname localhost --transport core.local --scheduler core.direct --work-dir /home/my_username/aiida_workspace

This command will create a Computer named localhost, with the localhost hostname, no scheduler is considered and no special transport plugin is needed. All the calculations performed using this computer will be stored in the directory /home/my_username/aiida_workspace.

After this its is still necessary to configure the core.local transport:

verdi computer configure core.local localhost -n --safe-interval 0 --user my_email@provider.com

This configures that the computer will wait 0 seconds between connections attempts (one can increase this to avoid putting pressure in a network) for the user with email my_email@provider.com

Using the Python API one can create a Computer by running the following code either in the verdi shell or using verdi run in a script that contains the code

from aiida.orm import Computer
from pathlib import Path

# Create the node with the computer
computer = Computer(
    label='localhost',
    hostname='localhost',
    transport_type='core.local',
    scheduler_type='core.direct',
    workdir=Path('/home/my_username/aiida_workspace').resolve()
)
# Store the node in the database
computer.store()
# Configure the core.local transport
computer.configure()

For more detailed information, please refer to the documentation on setting up compute resources.

Code#

Since LAMMPS is a piece of software that is installed in a machine we have to create a InstalledCode node in the database which contains the information about this program. As with the Computer it is possible to define this both via the AiiDA command line interface (CLI), verdi, or the Python application programming interface (API).

In the following it will be assumed that LAMMPS is installed in the same machine that is running AiiDA, localhost, that the executable is called lmp and that there is already a Computer named localhost setup in the database.

To define the InstalledCode which refers to the LAMMPS installation via the CLI one runs the command:

verdi code create core.code.installed --label lammps  --computer localhost --default-calc-job-plugin lammps.base --filepath-executable /path/to/lammps/lmp

This will create an InstalledCode with the name lammps associated to the Computer named localhost whose executable absolute path is /path/to/lammps/lmp

To define the InstalledCode which refers to the LAMMPS installation via the Python API one can use the following code in either the verdi shell or by running a script which contains it via verdi run:

from aiida.orm import InstalledCode

# Load the computer resource where LAMMPS is installed
computer = load_computer('localhost')

# Define the code node
code = InstalledCode(
    label='lammps',
    computer=computer,
    filepath_executable='/path/to/lammps/lmp',
    default_calc_job_plugin='lammps.base'
)

# Store the code node in the database
code.store()

For more detailed information, please refer to the documentation on setting up codes.