forked from lijiext/lammps
77 lines
1.8 KiB
Plaintext
77 lines
1.8 KiB
Plaintext
# sample LAMMPS input script for viscosity of 2d LJ liquid
|
|
# Green-Kubo method via fix ave/correlate
|
|
|
|
# settings
|
|
|
|
variable x equal 20
|
|
variable y equal 20
|
|
|
|
variable rho equal 0.6
|
|
variable t equal 1.0
|
|
variable rc equal 2.5
|
|
|
|
variable p equal 400 # correlation length
|
|
variable s equal 5 # sample interval
|
|
variable d equal $p*$s # dump interval
|
|
|
|
# problem setup
|
|
|
|
units lj
|
|
dimension 2
|
|
atom_style atomic
|
|
neigh_modify delay 0 every 1
|
|
|
|
lattice sq2 ${rho}
|
|
region simbox block 0 $x 0 $y -0.1 0.1
|
|
create_box 1 simbox
|
|
create_atoms 1 box
|
|
|
|
pair_style lj/cut ${rc}
|
|
pair_coeff * * 1 1
|
|
|
|
mass * 1.0
|
|
velocity all create $t 97287
|
|
|
|
# equilibration run
|
|
|
|
fix 1 all nve
|
|
fix 2 all langevin $t $t 0.1 498094
|
|
fix 3 all enforce2d
|
|
|
|
thermo $d
|
|
run 10000
|
|
|
|
velocity all scale $t
|
|
|
|
unfix 2
|
|
|
|
# Green-Kubo viscosity calculation
|
|
|
|
reset_timestep 0
|
|
|
|
# Define distinct components of symmetric traceless stress tensor
|
|
|
|
variable pxy equal pxy
|
|
variable pxx equal pxx-press
|
|
|
|
fix SS all ave/correlate $s $p $d &
|
|
v_pxy v_pxx type auto file profile.gk.2d ave running
|
|
|
|
# Diagonal components of SS are larger by factor 2-2/d,
|
|
# which is 4/3 for d=3, but 1 for d=2.
|
|
# See Daivis and Evans, J.Chem.Phys, 100, 541-547 (1994)
|
|
|
|
variable scale equal 1.0/$t*vol*$s*dt
|
|
variable diagfac equal 2-2/2
|
|
variable vxy equal trap(f_SS[3])*${scale}
|
|
variable vxx equal trap(f_SS[4])*${scale}/${diagfac}
|
|
|
|
thermo_style custom step temp press pxy v_vxy v_vxx
|
|
|
|
run 500000
|
|
|
|
variable etaxy equal v_vxy
|
|
variable etaxx equal v_vxx
|
|
variable eta equal 0.5*(${etaxy}+${etaxx})
|
|
print "running average viscosity: ${eta}"
|