Fluid in nanochannels-how to apply horizontal forces

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 mytemp87287rotyesdistgaussianfixmynvtfluidnvttemp {mytemp} ${mytemp} 0.1

################################################################################
###press control
velocity upper set 0 0 0 units box
variable force equal - mypress∗lx∗ly/count(upper)fixaveforceupperaveforce00 {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

In order to change an existing input file for your purposes, you first need understand what it does and that requires you to study the documentation and understand each individual command in the input file.

You already see an example to compute a 1d-profile for stress or density, it should be straightforward to do the same for velocity.

To apply a force, you can use the fix addforce command.

Thanks much for you reply. I’m a beginner user, just would like to know how I have to run this files? which command. it is about ion bombardment. Thanks much.

pair_zbl.cpp (11.5 KB)
pair_zbl.h (2.1 KB)

In the future, please post new questions as a new topic.

Those files are C++ source code and these two files seem to be old versions of a pair style that is part of LAMMPS. C++ source needs to be compiled into the executable, but if you have a recent version of LAMMPS they are already included.

The manual has information about the syntax.