LAMMPS indent example with comments

I have recently been learning LAMMPS for one of my projects and while the documentation is decent, learning everything is a bit of a challenge. I might turn this into a decent tutorial on how to run LAMMPS. But for now, I have gone through the indent example and commented all the lines of code.  If you are learning LAMMPS as I am, I hope this helps.

# 2d indenter simulation

dimension 2
boundary p s p
#periodic in the x and z, and shrink wrapped in the y direction

atom_style atomic #sets atom style to atomic (only default values position, mass,
neighbor 0.3 bin
neigh_modify delay 5

# create geometry

lattice hex 0.9 #hexagonal lattice with 0.9 units between atoms
region box block 0 20 0 10 -0.25 0.25 #creates a geometric domain
create_box 2 box #creates a simulation box in region box of atom type two
create_atoms 1 box #creates atoms of atom type 1 in a box pattern

mass 1 1.0 #mass of atom 1
mass 2 1.0 #mass of atom 2

# LJ potentials

pair_style lj/cut 2.5 #lennard jones with cutoff of 2.5
pair_coeff * * 1.0 1.0 2.5 #lenard jones potential for all atoms with epsilon =1 (energy), sigma = 1.0 (distance) cutoff1 = 2.5

# define groups

region 1 block INF INF INF 1.25 INF INF #creates infinite region of all atoms with x<1.25
group lower region 1 #groups atoms called lower in region 1 (just defined above)
group mobile subtract all lower #groups into group mobile all atoms that aren’t in lower. Note that mobile is the indenter and lower is the
set group lower type 2 #sets atoms in group lower to type 2

# initial velocities

compute new mobile temp #id new computes temp of mobile group (indenter)
velocity mobile create 0.2 482748 temp new
fix 1 all nve
#holds constant number of particles, volume and total energy
fix 2 lower setforce 0.0 0.0 0.0
#zeros forces on all particles
fix 3 all temp/rescale 100 0.1 0.1 0.01 1.0
#resets the temperature of the particles by scaling their velocity every 100 steps with a desired temperature of 0.1. Will rescale temperature only if the temperature is more than .01 from its desired tempearture

# run with indenter

timestep 0.003 #sets time steps
variable k equal 1000.0/xlat
variable y equal “13.0*ylat – step*dt*0.02*ylat”

fix 4 all indent $k sphere 10 v_y 0 5.0 #command for creating an indenter with force k.
#the keyword sphere means
fix 5 all enforce2d
#forces model to be 2d, no movement in the z direction

thermo 1000
thermo_modify temp new

dump 1 all atom 250 dump.indent

#dump 2 all image 1000 image.*.jpg type type &
# zoom 1.6 adiam 1.5
#dump_modify 2 pad 5

#dump 3 all movie 1000 movie.mpg type type &
# zoom 1.6 adiam 1.5
#dump_modify 3 pad 5

run 30000 #runs for 30000 timesteps

# run without indenter

unfix 4 #removes indenter
run 30000 #runs for 30000 timesteps

LAMMPS indent example with comments

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s