How to add vacuum layer in my model?

Hi dear LAMMPS users,

Recently, I try to add a vacuum layer in my model in z direction. As
shown in the diagram below, the vaccum layer is on top of the molecule
that I am chiefly concerned with. And the xyz are all periodic
boundary conditions because I want to use kspace in my simulation, the
vacuum layer added here is for the sake of avoiding the molecule
influenced by the other molecule in z direction.

Diagram 1:

1 Like

Hi dear LAMMPS users,

Recently, I try to add a vacuum layer in my model in z direction. As
shown in the diagram below, the vaccum layer is on top of the molecule
that I am chiefly concerned with. And the xyz are all periodic
boundary conditions because I want to use kspace in my simulation, the
vacuum layer added here is for the sake of avoiding the molecule
influenced by the other molecule in z direction.

Diagram 1:
********************
> vacuum layer |
********************
> molecule |
*********************

In order to achieve this, I have tried to add a wall/reflect between
the vacuum layer and molecule. But the periodic boundary condition
cannot use with wall/reflect. Then I found this method to achieve this
in the manual. The script is as follows:

boundary p p f
kspace_modify slab 3.0 #which converts ppf to ppp, increase the size
of z dimentions to 3 times.
fix zwall all wall/reflect zlo EDGE zhi EDGE units box #add wall
between vacuum layer and molecule

To find out whether this method can achieve what I want, I change
kspace_modify slab 3 to kspace_modify slab 1.001 in order to decrease
the thickness of vacuum layer, I found that the molecule will not
influenced by the other molecule in z direction. So I was wonderning
whether this method can achieve what I want or is there some other
alternative method. Thanks for your advisement

no, this is incorrect. for the dipole solver to be properly converged,
you must have *at least* a vacuum space of the size of the change
density distribution added on *both* sides.

fix wall/reflect cannot work with this for technical reasons that have
been discussed in the past many times on this list, but you can set up
two zones using fix oneway for the same effect.

so your final system would be something like this:

********************
> fix oneway zone |
********************
> vacuum layer |
********************
> molecule |
> molecule |
> molecule |
> molecule |
*********************
> vacuum layer |
********************
> fix oneway zone ||
*********************

and you would still use kspace modify slab 3.0

the vacuum doesn't have to be very large, and same for the fix oneway
zones (it just has to be certain that no atom or molecule is moving
fast enough so it can pass it by accident)

axel.

Thanks, Axel

I am really appreciate for your kindly help. It really helps me a lot.
But I still have some questions.
My simulation is mainly about studying the process of potassium
stearate adsorpting on the Carbon surface. The molecule domain is as
follows,
and for carbon surface, it doesn't move during simulation and the
force on Carbon atoms is zero (through fix setforce 0 0 0).

Thanks, Axel

I am really appreciate for your kindly help. It really helps me a lot.
But I still have some questions.
My simulation is mainly about studying the process of potassium
stearate adsorpting on the Carbon surface. The molecule domain is as
follows,
and for carbon surface, it doesn't move during simulation and the
force on Carbon atoms is zero (through fix setforce 0 0 0).
*************************************
> potassium stearate |
*************************************
> Carbon surface |
> >
*************************************
During the simulation, I noticed that the potassium stearate molecules
will move torward Carbon surface because of adsorption, and carbon
atoms stay static.
So I was wonderning could I make my final model like this (diagram 2)
according to your help.

Diagram 2:
*************************************
> fix oneway zone | --> prevent the potassium
stearate moving across this zone
*************************************
> vacuum layer |
*************************************
> potassium stearate |
*************************************
> Carbon surface |
> >
*************************************
> vacuum layer |
*************************************
And my questions are as follows:

(1) In this diagram,as you can see I don't create the fix oneway zone
below the carbon surface because the carbon surface would not move
down and the potassium stearate would not move below the carbon
surface too. But I still create one vacuum layer below the carbon
surface for the dipole solver to be properly converged. I was
wondering is that correct or I must create a fix oneway zone below the
carbon surface.

your approach is sufficient. if no atoms can move toward the box
boundary in that part of the box, then you do not need a reflective
zone there.

(2) The second question is about the method for creating the vacuum
layer. I create my simulation box from read_data command, and the size
of simulation box is generated automatically from msi2lmp.exe. So can
I simply increase the size of z direction to create the vacuum layer
in the data file. For example like this below:

data_file:
0 60 xlo xhi ---> the xlo and xhi don’t chage
0 60 ylo yhi ---> the ylo and yhi don’t chage
0 50 zlo zhi ---> change to this: -5 60 zlo zhi (5A
for the thickness of vacuum layer; 5A for the thickness of fix oneway
zone, because zlo only have one vacuum layer, its value is -5. But the
zhi is 60 cause it has two layer )

I was wonderng can I create the vacuum layer in this method.

yes.

(3) According to your help, I have changed my script like this:

# Initialization
units real
boundary p p f
atom_style full
log log.DLC

# style
bond_style harmonic
angle_style harmonic
dihedral_style opls
improper_style cvff
pair_style lj/cut/coul/long 12 12
kspace_style ewald 1.0e-5

using kspace_style pppm instead of ewald may be faster.

axel.