.. _label_tutorial_si_lammps:
.. raw:: html
.. role:: red
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: :red:`in.sw` and :red:`Si222.lammps` (file name is arbitrary, though).
:red:`in.sw` is the main input file for LAMMPS, in which the type of the empirical force field is defined as follows:
.. literalinclude:: ../../../example/Si_LAMMPS/in.sw
In the file :red:`Si222.lammps`, the lattice vectors and atomic positions of a relaxed supercell structure are defined as follows:
.. literalinclude:: ../../../example/Si_LAMMPS/Si222.lammps
:lines: 1-30
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 :ref:`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.