# Fluid in nanochannels simulation

Hi, I’m a beginner user of lammps. I’m running this case as show here. It runs well. I would like to know how I could do this:

• Without applying the vertical force p, apply horizontal forces to fluid atoms and obtain
the averaged vx as a function of z

Not sure how to modify the code for this. Any help will be greatly appreciated. Thanks

https://yaweiliu.github.io/research_notes/notes/20210308_A%20mechanical%20approach%20to%20control%20pressure%20in%20LAMMPS%20simulations.html

# LJ fluid

units lj
atom_style atomic
boundary p p s

variable mytemp equal 0.8
variable mypress equal 0.5

lattice fcc 0.8
region box block -5 5 -5 5 0 20
create_box 3 box
create_atoms 1 box
mass * 1.0

pair_style lj/cut 1.5
pair_coeff * * 1.0 1.0 2.5
timestep 0.001

#wall
region upper block INF INF INF INF 32 INF units box
set region upper type 2
region lower block INF INF INF INF INF 2 units box
set region lower type 3

group fluid type 1
group upper type 2
group lower type 3

compute fluid_temp fluid temp/com
velocity fluid create {mytemp} 87287 rot yes dist gaussian fix mynvt fluid nvt temp {mytemp} \${mytemp} 0.1

################################################################################
###press control
velocity upper set 0 0 0 units box
variable force equal -{mypress}*lx*ly/count(upper) fix aveforce upper aveforce 0 0 {force}
fix upper_nve upper nve
################################################################################

thermo_style custom step atoms c_fluid_temp lz
thermo_modify flush yes
thermo 1000

dump all_xyz all xyz 100000 result_atoms.xyz

#eq
run 500000

#pro.
compute stress fluid stress/atom NULL ke pair
compute cc01 fluid chunk/atom bin/1d z center 1 units box
fix press fluid ave/chunk 100 1000 100000 cc01 density/number c_stress[1] c_stress[2] c_stress[3] ave running overwrite file press.log