Skip to content

Instantly share code, notes, and snippets.

@whitead
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save whitead/c7c661e57d597f514470 to your computer and use it in GitHub Desktop.

Select an option

Save whitead/c7c661e57d597f514470 to your computer and use it in GitHub Desktop.
Lammps Tutorial Stuff
units lj #Lennard Jones - derived units
atom_style atomic #This says, we're using particles with interatomic forces
#THESE ARE MAGIC!
neighbor 1 bin
atom_modify map array sort 10 6
#-------------------------------------------------
#----------THESE COMMANDS SET-UP SIM BOX----------
#-------------------------------------------------
boundary p p p # periodic in xyz
#command name - options
region bbox block 0 10 0 10 0 10
#command 1 - number of atom types
create_box 1 bbox
#-------------------------------------------------
#----------THESE COMMANDS PUT ATOMS IN BOX--------
#-------------------------------------------------
#make a lattice (fcc) with Lennard-Jones density of 0.25
lattice fcc 0.25
#create atoms in the box, and units are in box units
create_atoms 1 box
mass 1 1.0
dump dcheck all xyz 1 initial.xyz
run 0
undump dcheck
#-------------------------------------------------
#----------SET-UP FORCE FIELD---------------------
#-------------------------------------------------
pair_style lj/cut 2.5
pair_coeff * * 1.0 1.0
#create velocity for all at temperature 1.0, with random number seed
# 549.... "rot yes" mean remove rotation and "dist gaussian" means
# gaussian distribution
velocity all create 1.0 5493108 rot yes dist gaussian
timestep 0.001
#-------------------------------------------------
#----------NVE ENSEMBLE---------------------------
#-------------------------------------------------
dump dnve all xyz 1 nve.xyz
fix nve_int all nve
thermo 10
run 1000
undump dnve
unfix nve_int
#-------------------------------------------------
#----------NVT (Nose-Hoover) ENSEMBLE-------------
#-------------------------------------------------
dump dnvt all xyz 1 nvt.xyz
fix nvt_nh all nvt temp 1.0 1.0 0.5
fix com_remove all momentum 100 linear 1 1 1
run 10000
LAMMPS data for SPC Water
3 atoms
2 bonds
1 angles
2 atom types
1 bond types
1 angle types
0.0 3.1 xlo xhi
0.0 3.1 ylo yhi
0.0 3.1 zlo zhi
Masses
1 1
2 16
Atoms
1 1 2 -0.82 1.55000 1.55000 1.50000
2 1 1 0.41 1.55000 2.36649 2.07736
3 1 1 0.41 1.55000 0.73351 2.07736
Bonds
1 1 1 2
2 1 1 3
Angles
1 1 2 1 3
# OXYGEN = 2
# HYDROGEN = 1
units real # Angstrom, kcal, fs
atom_style full # allows charge, angle, bond, etc
bond_style harmonic
angle_style harmonic
pair_style lj/cut/coul/long 10.0
kspace_style pppm 1.0e-5
pair_modify tail yes
read_data spcsingle.data
pair_coeff 1 1 0.0 0.0
pair_coeff 1 2 0.0 0.0
pair_coeff 2 2 0.1553 3.166
bond_coeff 1 0.0 1.0
angle_coeff 1 0.0 109.47
replicate 4 4 4
velocity all create 0.1 43892390 rot yes mom yes dist gaussian
fix wshake all shake 0.0001 20 0 b 1 a 1
fix com_remove all momentum 1 linear 1 1 1
#neighbor 2.0 bin
#neigh_modify every 1 delay 0 check yes
timestep 2.0
write_data water_replicated.data
dump dcheck all xyz 1 check.xyz
run 0
undump dcheck
fix nvt_int all nvt temp 300.0 300.0 10.0
thermo 100
run 10000
unfix nvt_int
dump dnvt all xyz 10 nvt.xyz
fix nve_int all nve
compute oordf all rdf 100 2 2
fix oordf_avg all ave/time 250 1 250 c_oordf file oo.rdf mode vector ave running overwrite
run 15000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment