Files
lammps/examples/snap/in.fnum
2022-01-04 14:02:29 -07:00

62 lines
1.3 KiB
Plaintext

# Demonstrate pair style base on sna/grid
# Check numerical forces
variable nrep index 3
variable a index 3.0
variable ngrid index 2
variable del index 0.1
variable fdelta index 0.0001
units metal
atom_modify map yes
# generate the box and atom positions using a BCC lattice
variable nx equal ${nrep}
variable ny equal ${nrep}
variable nz equal ${nrep}
boundary p p p
lattice custom $a &
a1 1 0 0 &
a2 0 1 0 &
a3 0 0 1 &
basis 0 0 0 &
basis 0.5 0.5 0.5 &
# origin 0.25 0.25 0.25
# origin 0.25e-3 0.25e-3 0.25e-3
region box block 0 ${nx} 0 ${ny} 0 ${nz}
create_box 1 box
create_atoms 1 box
mass 1 180.88
displace_atoms all random ${del} ${del} ${del} 12345
# define grid compute and atom compute
group snapgroup type 1
variable twojmax equal 2
variable rcutfac equal 4.67637
variable rfac0 equal 0.99363
variable rmin0 equal 0
variable wj equal 1
variable radelem equal 0.5
variable bzero equal 0
variable quad equal 0
variable switch equal 1
pair_style sna/grid grid ${ngrid} ${ngrid} ${ngrid} &
${rcutfac} ${rfac0} ${twojmax} ${radelem} &
${wj} rmin0 ${rmin0} bzeroflag ${bzero} &
quadraticflag ${quad} switchflag ${switch}
pair_coeff * * Al
fix fnum all numdiff 1 ${fdelta}
variable ferrsq atom (fx-f_fnum[1])^2+(fy-f_fnum[2])^2+(fz-f_fnum[3])^2
compute faverrsq all reduce ave v_ferrsq
thermo_style custom c_faverrsq
run 0