Simulating bulk fluid between two walls

Another option is to perform a small miracle and part the water (through fix addforce and atom-style variable) :slight_smile:. After the parting you just need do displace all atoms, so that the vacuum is at the edge of the simulation box. Reset image flags, change boundary conditions to non-periodic and you have your system.

Input file based on the one by @akohlmey

units		real	
atom_style	full

read_data	data.spce extra/atom/types 1

pair_style	lj/cut/coul/cut 12.0

mass 3 12.011

pair_coeff	1 1 0.15535 3.166
pair_coeff	* 2 0.0000 0.0000	
pair_coeff      3 3 0.05 3.20723   # carbon-like atom as placeholder
bond_style	harmonic
angle_style	harmonic

bond_coeff	1 1000.00 1.000
angle_coeff	1 100.0 109.47

special_bonds   lj/coul 0.0 0.0 1.0

neighbor        2.0 bin

group water type 1 2
group wall type 3

fix		1 water shake 0.0001 20 0 b 1 a 1
fix		2 water nve

variable    d equal 10

variable    wall   atom (((z-20)>0)-((z-20)<0))*(abs(z-20)<ramp(0,$d/2))*mass*abs(z-20)*100

fix     addforce all addforce 0 0 v_wall

thermo 10

dump 1 all atom 50 walls.lammpstrj

timestep	0.1
thermo 50 

fix             4 water langevin 300.0 300.0 5.0 645734
fix             5 all deform 100 z delta -$(v_d/2) $(v_d/2)
run 2000
unfix           5
variable    wall   atom (((z-20)>0)-((z-20)<0))*(abs(z-20)<$d/2)*mass*abs(z-20)/5 #make the wall softer
run 2000
write_data data.walls

test

3 Likes