Calculating surface tension in a water/vapour interface

Dear all,

I am attempting to run a coarse grained liquid/vapour simulation to find the effects of varying different paramaters on lammps on the surface tension. I have attached my script below:

------------ Create simulation box ----------------

units real
atom_style sphere
boundary p s p

lattice sc 3.1
region box block -10 10 -20 20 -10 10
create_box 1 box
region atoms block -2.5 2.5 -2.5 2.5 -2.5 2.5
region puddle block -10 10 -2.5 2.5 -10 10

-------------- Create Atom type 1 ----------------------

lattice sc 3.1
create_atoms 1 region puddle ratio 1.0 1234

------------------ Setup potential (Force field) -----------------

pair_style lj/cut 3.5
pair_coeff 1 1 10.0 2.3

gives good surface tension with values of 10.0 and 2.35

#----------------- Units --------------------------
variable A_in_m equal 1e-10 # Angstrom in meter
variable atm_in_Pa equal 101325 # note: 1 Pa = 1 N/m^2
variable N_in_mN equal 1e3 # Newton in milliNewton
variable convFac equal {A_in_m}*{atm_in_Pa}*${N_in_mN}

----------------- Paramaeteres ---------------------

thermo 2000
timestep 0.01
neighbor 3.5 bin
neigh_modify every 1 delay 0 check yes
group cold type 1

variable Ne equal 10
variable Nr equal 500
#variable Nf equal 100

------------------ Give velocity and fix commands ------------------

velocity all create 230 1234 # dist gaussian rot yes
fix 1 all nve/sphere
fix 2 all momentum 1 linear 1 1 1
fix temp all langevin 230 230 1000 1234 omega yes zero yes

fix 4 all npt temp 273.0 273.0 100 iso 1.0 1.0 1000 # works well at temp 100 press 1000

fix 3 all nvt temp 273.0 273.0 100.0

fix 4 cold gravity 100.0 vector 0 1 0

fix PAve all ave/time {Ne} {Nr} 1000 c_totT

fix totT all ave/time {Ne} {Nr} 1000 c_rotT

---------------- Density ---------------------

set group cold density 1.0

------- Pressure, temperature, tensor and surface tension ---------------

compute T all temp
compute P all pressure T

variable xPress equal c_thermo_press[1]
variable yPress equal c_thermo_press[2]
variable zPress equal c_thermo_press[3]

variable st equal 0.5lz(v_zPress-0.5*(v_xPress+v_yPress))*${convFac}

fix st all ave/time 1 2000 2000 v_st
#fix st all ave/time 10 100 100 v_st
#fix 3 st all ave/time c_myTemp c_thermo_temp file temp.profile

#------------------ Output --------------------
thermo_style custom step f_st temp press etotal
thermo_modify lost warn
dump trj all atom 2000 testcgoneatom.lammpstrj
run 2000000

However, upon running my simulation, the surface tension i get always seems to be negative. A negative number between zero and negative 30.

This is what the interface looks like on onvito

image

I am very unsure why i am getting a negative surface tension and would really love some help from anyone.

Kind regards,

Zakaria

Just to clarify, the lines in bold in the input script are not being used for the simulation. They have a #before them which doesn’t show up when I paste my script here.

to get correct typesetting of input files, you should bracket them in triple backquote (```) sections (similar to python docstrings). Like this:

# 3d Lennard-Jones melt

units           lj
atom_style      atomic

lattice         fcc 0.8442
region          box block 0 10 0 10 0 10
create_box      1 box
create_atoms    1 box
mass            1 1.0

velocity        all create 3.0 87287 loop geom

pair_style      lj/cut 2.5
pair_coeff      1 1 1.0 1.0 2.5

neighbor        0.3 bin
neigh_modify    every 20 delay 0 check no

fix             1 all nve

#dump           id all atom 50 dump.melt
#dump           2 all image 25 image.*.jpg type type &
#               axes yes 0.8 0.02 view 60 -30
#dump_modify    2 pad 3

#dump           3 all movie 25 movie.mpg type type &
#               axes yes 0.8 0.02 view 60 -30
#dump_modify    3 pad 3

thermo          50
run             250

Ah yes I see. Thank you my friend! I will keep this in mind for any later posts I make :slight_smile:

Unless you edit your existing post, it is not likely to get constructive suggestions in this topic, since it is not possible to properly assess it or reproduce it.

Yes, i am going to delete this post, I noticed some errors in my code that my supervisor told me about. Thank you for the advice akohlmey, take care my friend.

Hmm it seems as though i cannot delete nor edit the post. But thank you for telling me how to properly post on this forum, i will make a better post soon.

1 Like