Dear all,
In order to check if I understand what LAMMPS does, I have calculated the surface tension of my system (periodic liquid with two surfaces along z-direction) in two different ways.
First, I have done it directly in the input script using the stess tensor as:
fix 2 all temp/rescale 100 235.0 235.0 10.0 1.0
compute my_pres all pressure 2_temp
variable my_gamma equal lz*(c_my_pres[3]-(c_my_pres[1]+c_my_pres[2])/2.0)/3.0/2.0 # [bars * Angstroems] = [10^{-5} N/m]
This has yielded at the MD-step #10 the value 2068.2295x10^{-5} N/m.
Second, I have output the particle coordinates, velocities and forces using the dump command,
and calculated the surface tension as
gamma = SUM_over_all_particles ( m*(vzvz - (vxvx + vyvy)/2.) + (zfz - (xfx + yfy)/2.) ) / (32lx*ly)
and the result was -0.099977427, which is different from the first version and looks strange because it is negative.
An elementary c++ program that read the dump file and computes the gamma is attached below together with the compiled executable and the trial dump file. The executable is called surface_tension and needs two command line argument as an input (the first argument is the name of the dump file and the second argument the time step for which the surface tension should be computed).
I have check very carefully many time all the units conversion and my elementary c++ code and have not found an error.
This is why I assume I am doing something wrong with LAMMPS.
I would appreciate very much any clue regarding why this two analogical way of computation of the surface tension yield different results.
The version of LAMMPS that I use is dated by April 2, 2014.
Thank you!
Anton
surface_tension.cpp (1.77 KB)
surface_tension (15.3 KB)
dumpfile (164 KB)
in.nodd (903 Bytes)
data.Hg.dp.N1000.lxlz.d13.69.relaxed (49.3 KB)