Apply hydrostatic pressure to two layers of MoS

Hello, I would like to ask how to apply hydrostatic pressure to two layers of MoS2 using LAMMPs? Because the z direction is an noneriodic boundary, it cannot be directly controlled with the NPT ensemble. But I try to use Fix AddForce to control pressure in the Z direction and NPT to control pressure in the XY direction, which is easy to buckle during dynamic relaxation.


There is no question here? We cannot provide advice without you telling us first what exactly the problem is and how to reproduce it.

Please do a literature search. I remember this has been done before but I can’t remember which paper.

Dear Axel,
I’ m sorry to not declare my problem. I create a model with two layer MoS2, and I want to control the pressure in all directions. But in z-direction, the bounday is non-periodic. Thus, I try to use “fix control” to control the position of the wall/harmonic to control the pressure in z-direction. I have two questions:

  1. I try to set two harmonic walls. One is above the model, and the other one is under the model. I try to change the position of the upper wall to control the pressure, but I received the error: Particle on or inside fix wall surface (…/fix_wall_harmonic.cpp:74). My input script and model are uploaded, and I want to know how to solve the error.
    2.Except for this method to control in nonperiodic boundary, are there any other methods?
    Looking forward to your reply, thanks a lot. (98.2 KB)

Your original post said you were using fix addforce. So which is it now?

You are probably not placing the walls correctly, or are using bad parameters for fix control or both. Like all other advanced features in a software, you have to build your input in stages and figure out how to do each step individually. That means, first you should be able to run your simulation with immobile walls and figure out suitable settings for location and parameters so that it can run reliably. Then you have to figure out a good objective parameter to couple to. Then you have to figure out how to couple that to the modifiable setting. This is all very systems specific, so it requires quite a bit of careful work to sort this out. Don’t expect somebody to jump on it by you simply stating “I tried, it crashes, how to fix it?”.

For starters, pressure is not a well defined entity for a non-periodic system. Basically your system is infinitely large in the open dimension, so the computed pressure would always be zero. While LAMMPS uses the box volume to compute a “pressure”, that volume is an arbitrary choice (you can change the box dimensions in the non-periodic direction to any size and still have the same forces) and thus “pressure” as computed by compute pressure is as arbitrary. Thus your question is not well posed: how can you “control” something that is essentially arbitrary?

Dear Axel,
Thanks for your advice, I will try again.

Well yes, if you move a wall back and forth using fix control you are bound to have an occurrence of the wall moving back over a particle it was meant to be excluding, and then you get this error, because fix wall does not expect a particle to have enough force to get past the wall (and in some cases, like fix wall/lj, the force then becomes undefined).

But why are you using non-periodic boundary conditions? What sort of real-life confinement are you trying to model? Do you expect a nanoconfined fluid model to successfully predict the properties of an experimental bulk fluid? (Spoiler: it can’t.)

Dear Tee,
I try to study the mechanical properties of MoS2 in different layers under different hydrostatic pressures, so the z direction needs to be nonperiodic to control the difference in the number of layers, and then the pressure needs to be controlled in the nonperiodic direction (z-direction).
Thanks a lot!

But why can’t you have a periodic structure with 4 layers of MoS2 and another periodic structure with 8 layers of MoS2? What does the z-periodicity have to do with the number of layers?

Dear Tee,

If there are 2 layers in z-direction with periodic boundary, can we consider this model is a 2-layer model? Shouldn’t periodic boundaries be considered infinite layers? In my understanding, a model with periodic boundaries should be considered a bulk structure rather than a 2-layer structure.

In other words, in 2 layer MoS2, each layer is subjected to two layers of van der Waals forces. And in 4 layer MoS2, each layer is subjected to two layers of van der Waals forces, too. Are there any difference between them?

Thanks again.

The problem with your approach is that you are adding a confinement on top of the interactions. If you go from two layers with an open boundary to four layers, to eight and so on, you can extrapolate to the bulk. But by adding a confinement, you are adding an arbitrary parameter to this that is adjusted based on an ill-defined property (pressure computed from a stress*volume formulation in a badly defined volume). That cancels all the benefits and begs the question: what is it that you can learn from such calculations? I don’t see anything of value.

Thanks a lot! I’ ll think about it again.