Skip to content

7.9 LAMMPS

Hua Xu edited this page Nov 28, 2023 · 3 revisions

Install LAMMPS

use spack to install lammps

spack install lammps^[email protected]^mpi

use lammps

  1. Write a lammps script with name in.file
# LAMMPS input script with dump command example

# Initialization
units lj
dimension 3
boundary p p p
atom_style atomic

# Create a simple simulation box
lattice fcc 0.8442
region box block 0 10 0 10 0 10
create_box 1 box
create_atoms 1 box

# Set mass and potential interactions
mass 1 1.0
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5

# Define dump command to output particle positions
dump 1 all custom/adios 100 dump.atom id type x y z

# Run the simulation
velocity all create 1.0 87287 loop geom
fix 1 all nve
timestep 0.005
run 1000

In this script, the dump is used to export the information in file with adios2 type output. After that, run the following command with the same directory in this script

lmp -in in.file

You can have multiple options to run lammps

lmp_serial -in in.file
lmp_serial < in.file
lmp -in in.file
lmp < in.file
/path/to/lammps/src/lmp_serial -i in.file
mpirun -np 4 lmp_mpi -in in.file
mpiexec -np 4 lmp -in in.file
mpirun -np 8 /path/to/lammps/src/lmp_mpi -in in.file
mpiexec -n 6 /usr/local/bin/lmp -in in.file

run the lammps with coeus-adapter

  1. write a deployment script in jarvis-cd
  2. add coesu-adapter path to it
export PATH=~/coeus-adapter/build/bin/:$PATH
export LD_LIBRARY_PATH=~/coeus-adapter/build/bin:$LD_LIBRARY_PATH

add adios2.xml file in directory:

<?xml version="1.0"?>
<adios-config>
    <io name="atom">
    <engine type="Plugin">
      <parameter key="PluginName" value="hermes"/>
      <parameter key="PluginLibrary" value="hermes_engine"/>
      <parameter key="ppn" value="4"/>
      <parameter key="db_file" value="/mnt/nvme/hxu40/metadata.db"/>
    </engine>
    </io>
    <io name="custom">
      <engine type="Plugin">
      <parameter key="PluginName" value="hermes"/>
      <parameter key="PluginLibrary" value="hermes_engine"/>
      <parameter key="ppn" value="4"/>
      <parameter key="db_file" value="/mnt/nvme/hxu40/metadata.db"/>
    </engine>
    </io>
    <io name="read_dump">
       <engine type="Plugin">
      <parameter key="PluginName" value="hermes"/>
      <parameter key="PluginLibrary" value="hermes_engine"/>
      <parameter key="ppn" value="4"/>
      <parameter key="db_file" value="/mnt/nvme/hxu40/metadata.db"/>
        </engine>
    </io>
</adios-config>
  1. create a pipeline for hermes_run and lammps
Clone this wiki locally