"fix npt" to get suitable length

I prepare to study swelling behavior of organic matter on clay surface by LAMMPS. As I don’t know the proper size of the box when there is organic matter on the clay surface, So I decided to use NPT to obtain the size of the box in the Z direction under 1 bar.
The system is a three-dimensional periodic boundary, large vacuum area in Z direction, I hope that through the “fix npt” command, the box size will be compressed from the vacuum area to the appropriate size. However, I found that the “fix npt” command can only compress a small part of the box, which obviously does not reach the appropriate size. When I reduce the height of the vacuum area in the initial model, “fix npt” still plays a very small role. Can the “fix npt” command not meet my requirements?
Input file and output file are attached.
Initial.data (1.8 MB)
Input.in (2.3 KB)
nohup.out (78.3 KB)

Your procedure seems correct, and should indeed gives the correct box volume. Two things I would try:

  • If the initial vacuum area is less than 1nm in depth, does the vacuum area properly shrinks ?
  • What if you increase the pressure to, let’s say, 100 atm?


Thanks for reply!

  1. But what I want to get is a suitable volume, so I don’t know how high the vacuum area should be set; I have tried to reduce the height of the vacuum area, but after the reduction, the “fix npt” still reduces the size in the Z direction by about 0.2nm, which is the same as the previous “fix npt” reduction box, Moreover, the size change was completed in the first few steps of the simulation, and then the size remained basically unchanged during the simulation process. I don’t know whether this is a normal phenomenon.
  2. Not yet

Two comments:

  • If you want to create a periodic, layered setup, why do you start with a very large amount of vacuum? You just need to spend a lot of extra time to shrink the box. If you do want the space in Z, then there is no point in using fix npt.
  • A big problem with your setup is that are immobilizing the atoms in the MMT group. Immobilizing atoms and variable cell simulations cause a twofold problem: 1) if you keep the default settings (dilate all) then those atom positions are scaled when the cell is scaled, if not those layers will not move and thus the impact of the system between the layers to the geometry of the immobile layers is zero 2) despite immobilizing those atoms you still have contributions to the stress/pressure and since this subsystem cannot relax its pressure/stress contributions may be unphysical.

Bottom line, your simulation setup is unsuitable for what you want to study. From my perspective it is rather difficult to make this work properly without having a force field, where you do not need to immobilize atoms.

One possible approach to get closer to your goal could be to make the two layers individual rigid bodies, use fix rigid/npt on them (and fix nvt on the rest) and let them move only in z-direction, but also use neigh_modify exclude to exclude all force (and virial!) contributions from the intra-layer interactions
(it won’t be complete because of kspace).

I just have a few other questions :pensive:.

What does this mean? Does this mean that the MMT should be mobilizing? MMT is not necessarily fixed in my simulation.

If MMT is mobilizing, does it not need to remove the influence (force) of Intra-layer atoms on pressure?

It was in all the inputs I saw. If you don’t need to immobilize it, why do you?

This is a good question for you to figure out by yourself. The answer is rather obvious, so you will learn from it.

According to my understanding, the calculation of system pressure under NPT is based on the Virial theorem, in which the calculation of force stage includes the interaction between atoms. Therefore, when MMT can move, its interaction with other atoms should be considered

But I still don’t know why when the initial model Z dimension is different, the final dimension under NPT is also different. Is it local minimization in the NPT process? How to determine whether the dimension in Z direction obtained under NPT is the most appropriate (relative to the target pressure)?

Different from what? Please understand that I cannot read minds and thus it is required that you provide sufficient context and ask more precise questions even if that requires repeating what you wrote a few posts ago in the discussion.

Prerequisite for reliable results is that all input is correct and meaningful (the GI-GO principle appled, i.e. “garbage in, garbage out”). So have you run an input without keeping the MMT group immobile?

p.s.: I am getting tired of being confronted with new questions, without having my questions to you answered.

1 Like

What I mean is the different heights in the Z direction in the initial model.

I have run the input without the MMT group immobile. As I said above, when I use the initial model with different heights in the Z direction (because I don’t know the most appropriate height in the Z direction at 1bar, I use different heights, such as 3nm, 3.2nm and 3.5nm), they can reach a stable state according to the set 1bar after passing through the NPT, but the final output dimensions in the Z direction are different, so I don’t know which is the most appropriate.

I’m really sorry for not making it clear before.

You are running dynamics with variable cell and thus the pressure and box dimensions will always fluctuate and therefore you cannot expect identical results. You would have to average over a sufficiently long period when the system is in equilibrium to get a meaningful average.

On top of that, you are using kspace and for the sake of efficiency and assuming that box dimensions won’t change much, some of the time consuming initialization of kspace is not repeated when the box dimensions changes. The consequence of that is that the accuracy/convergence of the kspace forces will change when the box changes.
I just noticed that your kspace convergence is very low with 1.0e-4. That is sufficient for getting reasonably converged forces because with the force computation there is a lot of error cancellation, but for converged stresses, you need a tighter convergence.

Bottom line: for reliable results all details must be proper and there are many. Sometimes not all of them matter, sometimes they do. Sometimes the impact of incorrect settings or parameters is not immediately evident. Please also keep in mind, that you were missing force field support from some atom type(s) in your system and ignored the corresponding error, so your force field parameters are incomplete.

1 Like