ERROR fix gcmc region extends outside simulation box

Hello everyone,

I am currently using the stable version of LAMMPS as of August 2, 2023.In the previous version of LAMMPS, the ‘region’ keyword was not required when using the fix gcmc command to insert atoms throughout the box. However, I have encountered an issue when trying to use the fix gcmc without specifying the region keyword in the current version of LAMMPS. The error message “Fix gcmc region extends outside simulation box” is displayed. Even when I use fix gcmc and NVT, it still gives the same error, and the region must be defined in fix gcmc. I’d like to clarify that the shape of my simulation box is that of a cube.

I was wondering if someone could provide some assistance regarding this error. I am not sure if it is a bug or if I am doing something incorrectly.

When running a hybrid simulation with GCMC including region keyword (region regionGCMC block EDGE EDGE EDGE EDGE EDGE EDGE) and NPT and using two separate run commands, a similar error “Fix gcmc region extends outside simulation box” occurs due to changes in the simulation box dimensions after the start second run. I appreciate any help or suggestions you can provide. Thank you.

Best regards,

It still isn’t required. Please see the three examples in the examples/mc folder. Neither uses the “region” keyword of fix gcmc.

Thank you, Axel.

I successfully ran the LAMMPS MC examples without any issues. However, upon adding the adsorbent (read data) to the system, the code fails to execute correctly with LAMMPS (2 Aug 2023 - Update 1) and throws an error. The error message “Fix gcmc region extends outside simulation box ” is displayed.

Interestingly, the identical code runs without any problem on version 23 Jun 2022 and older. Consequently, I believe the new version of LAMMPS might have a bug in fix gcmc.

Could you please review the attached files?
C2H6.txt (259 Bytes)
in.GCMC-kerogen-illite.txt (4.4 KB) (1.2 MB)

Your observations and conclusions make sense. Please try the following change to the source: must do region check only when region is active · lammps/lammps@530f487 · GitHub

To explain, the region versus box check was moved from the constructor to the “init()” function as the box may change in between. However, the check whether there was an active region was omitted which leads to the unexpected behavior.

1 Like

Thank you, Axel. I’ve implemented the changes, but regrettably, it’s still showing the same error as before

I have run your inputs and they don’t fail anymore for me. So there likely is some mistake or oversight on your side.

You can try downloading a snapshot of the upcoming next update to the stable release from: and compile a LAMMPS executable from that.

1 Like