Question about wall/region nvt / npt

Hello everyone,

I hope you are doing well.

I have a question about the fix wall/region command. I’m trying to relax a structure inside a defined region. It works fine using NVT as the volume is constant. However, when I switch to NPT it run over several timesteps then it crashes with the error "Particle outside surface of region used in fix wall/region.

  • Step Temp Press Lx Ly Lz Xy Xz Yz Density Volume TotEng PotEng KinEng
  •  13076   312.15051     -5486.3817      31.9408        30.838084      13.993684     -20.219102      0.70377       -6.209558       1.6067338      13783.682     -104939.77     -105684.14      744.36909    
    
  •  14000   290.21135      113.98669      31.703113      30.902174      13.522385     -20.178216      0.52299338    -6.4725066      1.6717253      13247.815     -105303.37     -105995.42      692.05193    
    
  •  15000   363.89392      1171.5557      31.277114      30.742115      13.34434      -20.476121      0.5868681     -6.5435673      1.7260431      12830.912     -105165.46     -106033.22      867.75893    
    
  •  16000   332.86332      934.56792      31.074355      30.319699      13.3856       -20.994433      0.70336296    -6.4887415      1.75608        12611.445     -105504.07     -106297.83      793.76185    
    

ERROR on proc 8: Particle outside surface of region used in fix wall/region (src/fix_wall_region.cpp:308)
Last command: run 10000

I was wondering if the fix wall/region command supports volume changes or not. Do you have any ideas on how I can simulate a confined system under NPT?

My lammps version : LAMMPS (21 Nov 2023)

Thank you.

I suspect that the problem you are facing results from the rescaling of coordinates from fix npt.
But before discussing this a question: what is the point of using fix npt, when you have a confined system?

Thank you for your reply ,
I am trying to transform a periodic system into a non-periodic system confined in water. Initially, I relaxed the periodic system using NVT and NPT ensembles, which worked fine. However, due to the complexity of using a classical forcefield and the image flag, it becomes quite complicated to merge the relaxed system with water.

Therefore, my idea is to make initially 2 systems, relax the first system using wall/region constraints to avoid the image flag issue, and then relax the water around it.

It is still not clear to me what you are trying to achieve. Can you provide some simple sketches outlining what your system(s) are supposed to be like at the individual steps?

Since this is not a bulk system, there is no reason to use NPT on this. The atoms are bounded by the confinement potential and that doesn’t change. By default fix npt will scale all positions when it scales the box (see the “dilate” keyword) which is giving you the problem. But you don’t want to adjust the box around the central system anyway.

Once that system is relaxed, you can then add the water to the inverse of the confinement region (e.g. with a molecule file and create_atoms random using the overlap keyword with a suitable value. Then define two groups, water and inner, and then relax that system alternating between using fix setforce 0 0 0 on the water system or the included system. This can initially be done with fix nvt as well and only when the interface between the two subsystems has sufficiently “healed” you could switch to fix npt and possibly remove fix setforce altogether.

Thank you very much, it make sens rightnow :slight_smile: