7.2. Silicon with LAMMPS

Here, we demonstrate how to use ALAMODE together with LAMMPS. All input files can be found in the example/Si_LAMMPS directory. Before starting the tutorial, please build the LAMMPS code (e.g. lmp_serial).

As a simple example, we calculate phonon dispersion curves of Si using the Stillinger-Weber (SW) potential implemented in LAMMPS. First, you need to make two input files for LAMMPS: in.sw and Si222.lammps (file name is arbitrary, though). in.sw is the main input file for LAMMPS, in which the type of the empirical force field is defined as follows:

units           metal
atom_style      atomic
boundary        p p p

read_data       tmp.lammps

pair_style      sw
pair_coeff 	* * Si.sw Si

dump            1 all custom 1 XFSET id xu yu zu fx fy fz 
dump_modify     1 format float "%20.15f"
run             0

In the file Si222.lammps, the lattice vectors and atomic positions of a relaxed supercell structure are defined as follows:

# Structure data of Si (2x2x2 conventional) 

64 atoms
1 atom types

0.000000   10.800000   xlo xhi
0.000000   10.800000   ylo yhi
0.000000   10.800000   zlo zhi
0.000000    0.000000    0.000000   xy xz yz

Masses
 
 1 28.085

Atoms

   1  1      0.000000 0.000000 0.000000
   2  1      0.000000 0.000000 5.400000
   3  1      0.000000 2.700000 2.700000
   4  1      0.000000 2.700000 8.100000
   5  1      0.000000 5.400000 0.000000
   6  1      0.000000 5.400000 5.400000
   7  1      0.000000 8.100000 2.700000
   8  1      0.000000 8.100000 8.100000
   9  1      1.350000 1.350000 1.350000
  10  1      1.350000 1.350000 6.750000
  11  1      1.350000 4.050000 4.050000
  12  1      1.350000 4.050000 9.450000
  13  1      1.350000 6.750000 1.350000
  14  1      1.350000 6.750000 6.750000

Next, please generate a set of structure files for displaced configurations using the python script:

$ python displace.py --LAMMPS=Si222.lammps --mag=0.01 --prefix harm  -pf si222.pattern_HARMONIC
$ python displace.py --LAMMPS=Si222.lammps --mag=0.04 --prefix cubic -pf si222.pattern_ANHARM3

The pattern files can be generated by the alm code as decribed here. The above commands create harm1.lammps and cubic[01-20].lammps structure files. Then, run the following script and calculate atomic forces for the generated structures. This should finish in a few seconds.

#!/bin/bash

cp harm1.lammps tmp.lammps
lmp_serial < in.sw > log.lammps
cp XFSET XFSET.harm1

for ((i=1;i<=20;i++))
do
    num=`echo $i | awk '{printf("%02d",$1)}'`
    cp cubic${num}.lammps tmp.lammps
    lmp_serial < in.sw > log.lammps
    cp XFSET XFSET.cubic${num}
done

After the force calculations are finished, displacement and force data sets can be generated as follows:

$ python extract.py --LAMMPS=Si222.lammps XFSET.harm1 > DFSET_harmonic

$ python extract.py --LAMMPS=Si222.lammps XFSET.cubic* > DFSET_cubic

Then, using these files and following exactly the same procedure as the last tutorial section, you can calculate phonons and thermal conductivity of Si using the SW potential.