LAMMPS

From HPCwiki
Jump to: navigation, search

Contents


Introduction

LAMMPS is a molecular dynamics simulator created by several national labs (Sandia and LLNL) and companies (Cray, Bristol Myers Squibb, and Dupont).

LAMMPS can model atomic, polymeric, biological, metallic, granular, and coarse-grained systems using a variety of force fields and boundary conditions (1).

See the lammps website for more information.

Notes

The July 4, 2012 build of LAMMPS is installed on Cowboy.

LAMMPS on Cowboy is built using the Intel openmpi implementation.

Using LAMMPS

LAMMPS is installed on Cowboy in /opt/lammps/4Jul12/openmpi-1.4-intel/

The LAMMPS executable is /opt/lammps/4Jul12/openmpi-1.4-intel/bin

LAMMPS examples and potentials are also available in /opt/lammps/4Jul12/openmpi-1.4-intel/examples and /opt/lammps/4Jul12/openmpi-1.4-intel/potentials, respectively.

A manual is provided by the developers that details the installation and usage of LAMMPS.

There is also a command list available.

A test run written by Jeff Pummill is provided below.

An example LAMMPS input

This example is graciously provided by Jeff Pummill at the University of Arkansas.

  1. Create an input file for LAMMPS. We named our in.testbench. Notice the path of the potentials directory.
  2. # 3d metal shear simulation
    # Jeff Pummill
    
    #log            log.testbench
    units           metal
    boundary        p  p  p
    processors      2  3  4
    
    atom_style      atomic
    lattice         fcc 3.52 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1 &
                    origin 0.0 0.0 0.0
    
    region          box block 0 30.0 0 30.0 0 30.0
    create_box      3 box
    create_atoms    1 region box
    
    pair_style      eam
    pair_coeff      * * /opt/lammps/4Jul12/openmpi-1.4-intel/potentials/Ni_u3.eam
    
    neighbor        0.3 bin
    neigh_modify    delay 1
    
    region          lower block INF INF INF 0.8 INF INF
    region          upper block INF INF 28.8 INF INF INF
    group           lower region lower
    group           upper region upper
    group           boundary union lower upper
    group           mobile subtract all boundary
    
    set             region lower type 2
    set             region upper type 3
    
    # temp controllers
    
    compute         new3d mobile temp
    
    # equilibrate
    
    velocity        mobile create 300.0 5812775 temp new3d
    fix             1 all nve
    fix             2 boundary setforce 0.0 0.0 0.0
    fix             3 mobile temp/rescale 10 300.0 300.0 10.0 1.0
    fix_modify      3 temp new3d
    
    thermo          1000
    thermo_modify   temp new3d flush yes
    dump            1       all     atom    5000    dump.testbench_large
    dump_modify     1   flush   yes
    
    timestep        0.001
    run             100000[dbrunson@login1 lammps]$ cat in.testbench
    # 3d metal shear simulation
    # Jeff Pummill
    
    #log            log.testbench
    units           metal
    boundary        p  p  p
    processors      2  3  4
    
    atom_style      atomic
    lattice         fcc 3.52 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1 &
                    origin 0.0 0.0 0.0
    
    region          box block 0 30.0 0 30.0 0 30.0
    create_box      3 box
    create_atoms    1 region box
    
    pair_style      eam
    pair_coeff      * * /opt/lammps/4Jul12/openmpi-1.4-intel/potentials/Ni_u3.eam
    
    neighbor        0.3 bin
    neigh_modify    delay 1
    
    region          lower block INF INF INF 0.8 INF INF
    region          upper block INF INF 28.8 INF INF INF
    group           lower region lower
    group           upper region upper
    group           boundary union lower upper
    group           mobile subtract all boundary
    
    set             region lower type 2
    set             region upper type 3
    
    # temp controllers
    
    compute         new3d mobile temp
    
    # equilibrate
    
    velocity        mobile create 300.0 5812775 temp new3d
    fix             1 all nve
    fix             2 boundary setforce 0.0 0.0 0.0
    fix             3 mobile temp/rescale 10 300.0 300.0 10.0 1.0
    fix_modify      3 temp new3d
    
    thermo          1000
    thermo_modify   temp new3d flush yes
    dump            1       all     atom    5000    dump.testbench_large
    dump_modify     1   flush   yes
    
    timestep        0.001
    run             100000
    
  3. Now build a batch script to run your LAMMPS simulation..
  4. 
    #!/bin/bash
    
    #PBS -q batch
    #PBS -l nodes=2:ppn=12
    #PBS -l walltime=2:00:00
    #PBS -j oe
    module load lammps/4Jul12
    cd $PBS_O_WORKDIR
    NP=`cat $PBS_NODEFILE | wc -l`
    mpirun -np ${NP} lmp_cowboy  < ./in.testbench
    
    
  5. Run the simulation
  6. qsub lammps.pbs
    

    The run verification (lammps.pbs.o<jobid>) is shown below (and is truncated in the middle). This run takes less than 20 minutes on Cowboy.

    LAMMPS (4 Jul 2012)
    Lattice spacing in x,y,z = 3.52 3.52 3.52
    Created orthogonal box = (0 0 0) to (105.6 105.6 105.6)
      2 by 3 by 4 MPI processor grid
    Created 108000 atoms
    3600 atoms in group lower
    3600 atoms in group upper
    7200 atoms in group boundary
    100800 atoms in group mobile
    Setting atom values ...
      3600 settings made for type
    Setting atom values ...
      3600 settings made for type
    WARNING: Temperature for thermo pressure is not for group all (thermo.cpp:432)
    Setting up run ...
    Memory usage per processor = 2.82501 Mbytes
    Step Temp E_pair E_mol TotEng Press
           0          300      -480600            0   -476691.21    3545.3141
        1000     299.8971   -476686.42            0   -472778.97    21602.168
        2000    299.84873    -476685.8            0   -472778.98    21702.273
        3000    301.01961   -476701.07            0      -472779    21685.359
        4000    299.31959   -476678.92            0   -472778.99    21788.833
        5000    299.98518   -476687.59            0    
    .
    .
    .
       98000    300.03422   -476688.27            0   -472779.04     21808.65
       99000    301.30034   -476704.78            0   -472779.05    21751.146
      100000    300.64635   -476696.26            0   -472779.05    21775.351
    Loop time of 972.172 on 24 procs for 100000 steps with 108000 atoms
    
    Pair  time (%) = 846.039 (87.0256)
    Neigh time (%) = 41.9082 (4.31078)
    Comm  time (%) = 62.0375 (6.38133)
    Outpt time (%) = 2.69141 (0.276845)
    Other time (%) = 19.4961 (2.00542)
    
    Nlocal:    4500 ave 4670 max 4353 min
    Histogram: 3 4 2 3 2 2 0 3 1 4
    Nghost:    4254.46 ave 4399 max 4083 min
    Histogram: 2 3 3 0 2 2 3 2 4 3
    Neighs:    119731 ave 125150 max 115010 min
    Histogram: 2 2 3 6 1 2 1 4 1 2
    
    Total # of neighbors = 2873555
    Ave neighs/atom = 26.607
    Neighbor list builds = 6794
    Dangerous builds = 0
    [dbrunson@login1 lammps]$ tail lammps.pbs.o3116
    Histogram: 3 4 2 3 2 2 0 3 1 4
    Nghost:    4254.46 ave 4399 max 4083 min
    Histogram: 2 3 3 0 2 2 3 2 4 3
    Neighs:    119731 ave 125150 max 115010 min
    Histogram: 2 2 3 6 1 2 1 4 1 2
    
    Total # of neighbors = 2873555
    Ave neighs/atom = 26.607
    Neighbor list builds = 6794
    Dangerous builds = 0
    
    


Personal tools