# what to do with the example codes

Dear all:

I am learning lammps2011, and I tried to rerun the viscosity calculation for Ar using the example codes from lammps manual. I got following error message:

Total # of neighbors = 46304
Ave neighs/atom = 180.875
Neighbor list builds = 1668
Dangerous builds = 0
variable v equal (v_va+v_vb+v_vc)/3.0
variable ndens equal count(all)/vol
#print “average viscosity: \$v [Pa.s/ @ T K, {ndens} /A^3”
print “value of v is :” \$v
ERROR: Non digit character between brackets in variable

Here is the input codes:

# Sample LAMMPS input script for viscosity of liquid Ar

units real
variable T equal 86.4956
variable V equal vol
variable dt equal 4.0
variable p equal 400 # correlation length
variable s equal 5 # sample interval
variable d equal \$p*\$s # dump interval

# convert from LAMMPS real units to SI

variable kB equal 1.3806504e-23 # [J/K/ Boltzmann
variable atm2Pa equal 101325.0
variable A2m equal 1.0e-10
variable fs2s equal 1.0e-15
variable convert equal {atm2Pa}*{atm2Pa}{fs2s}*{A2m}{A2m}*{A2m}

# setup problem

dimension 3
boundary p p p
lattice fcc 5.376 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
region box block 0 4 0 4 0 4
create_box 1 box
create_atoms 1 box
mass 1 39.948
pair_style lj/cut 13.0
pair_coeff * * 0.2381 3.405
timestep \${dt}
thermo \$d

# equilibration and thermalization

velocity all create \$T 102486 mom yes rot yes dist gaussian
fix NVT all nvt temp \$T \$T 10 drag 0.2
run 8000

# viscosity calculation, switch to NVE if desired

#unfix NVT
#fix NVE all nve

reset_timestep 0
variable pxy equal pxy
variable pxz equal pxz
variable pyz equal pyz
fix SS all ave/correlate \$s \$p d & v_pxy v_pxz v_pyz type auto file S0St.dat ave running variable scale equal {convert}/(\${kB}\$T)\$V*s*{dt}
variable scale equal {convert}/({kB}\$T)\$V*s*{dt}
variable v11 equal trap(f_SS[3/){scale} variable v22 equal trap(f_SS[4/)*{scale}
variable v33 equal trap(f_SS[5/)
\${scale}
thermo_style custom step temp press v_pxy v_pxz v_pyz v_v11 v_v22 v_v33
run 100000
variable v equal (v_v11+v_v22+v_v33)/3.0
variable ndens equal count(all)/vol
print “average viscosity: \$v [Pa.s/ @ T K, {ndens} /A^3”

I know the error is related to v_v11, v_v22, and v_v33 after debugging. Then how to fix it? Thanks a lot.

Laura

2011/8/26 zhangliqun <[email protected]...>:

Dear all:

I am learning lammps2011, and I tried to rerun the viscosity calculation for
Ar using the example codes from lammps manual. I got following error
message:

Total # of neighbors = 46304
Ave neighs/atom = 180.875
Neighbor list builds = 1668
Dangerous builds = 0
variable v equal (v_va+v_vb+v_vc)/3.0
variable ndens equal count(all)/vol
#print "average viscosity: \$v [Pa.s/ @ T K, {ndens} /A^3"
print "value of v is :" \$v
ERROR: Non digit character between brackets in variable

[...]

variable v11 equal trap(f_SS[3/)*\{scale\} variable v22 equal trap\(f\_SS\[4/\)\*{scale}
variable v33 equal trap(f_SS[5/)*\${scale}

the problem is obviously in these three lines.
what does the '/' do where a ']' should be???

cheers,
axel.