Question about fix wall/reflect and kspace_modify slab

Dear all, I have some questions about the setting of the wall when the periodic boundary condition is p p f, I want to know when using kspace_ When modifying slab, can “fix wall / reflect Zhi edge” be set? If not, can “fix wall / reflect Zhi constant (lower than the boundary value in Z direction)” and “fix oneway” be set to act as a rebound wall?
In addition, when there are water molecules in the system, the position of an atom in the water molecule rebounds after passing through the reflection wall, which may cause errors in the constrained fix shake command. Can this be avoided?

Technically, yes, but that would be a biiiig misttake™. When using the slab correction, your box gets enlarged by the provided factor (typically 3.0), but the system is treated internally as if it is periodic. Thus the Coulomb interaction between the periodic images still exists and is only somewhat weakened by the expansion of the box. In addition the residual dipole for the system is computed and then a Poisson solver applied that computes the strength of the dipole-dipole interaction between the periodic images and the result subtracted from the periodic system result. This is not perfect, since there are higher-order terms (dipole-quadrupole, quadrupole-quadrupole, and so on), but they decay faster. But for the Poisson solver to produce correct results, no charged particle must enter the added vacuum space from the slab modification.

Thus a) you should set up your initial system, so that no atom can cross periodic boundaries and run with a cutoff coulomb at that time. There should already be a sufficient gap between periodic images and you can use fix oneway or fix wall/harmonic to widen the gap and make certain no atom travels across the boundary during initial equilibration/minimization. b) if needed you should already expand the box in z direction so that the system is comfortably contained and the atoms rarely - if at all - come into contact with the containment fix. c) you need to make sure that all image flags in z-direction are zero or reset to zero. d) when you apply the slab modification and switch to long-range electrostatics to prepare for production calculation, any containment should be done on the basis of the original cell dimensions and never enter into the extra, internally added space. Only then you will get accurate results. This also means, that your box will be likely quite a bit large than you expect and that will increase the computational cost.

Thanks for your reply! But I am still puzzled, why not use “fix wall / reliable constant” to prevent atoms from crossing the initial boundary Z , but “fix oneway” or “fix wall / harmonic”. What is the difference between these commands?

There is no such command in LAMMPS.

I’m sorry for the wrong letter. I mean ‘fix wall/reflect constant

As I already explained at great length. Atoms must not come anywhere near the boundary even for the original dimensions. This means that this has to be taken under consideration when setting up the systems.

I also mentioned that while you have to use boundary p p f, internally the computation is done with boundary p p p. Certain wall fixes are ill-defined with periodic boundaries, i.e. an atom is on both sides of the wall due to the periodicity at the same time.

I got it, thanks! :grinning: