Skip to content

fix gcmc does not work correctly with MACE/MLIAP #1519

Description

@egor-demidov

Summary

When attempting to run a GCMC simulation with MACE potential implemented via pair_style mliap, deletion of molecules is strongly favored over insertion. Upon investigation, it was revealed that fix gcmc does not delete atoms from the system when attempting a deletion, but rather it adds them to an "exclusion group" to calculate the potential energy of the system without them. Only if deletion is accepted do the atoms actually get deleted. While this approach works for regular pair_styles, the exclusion group is ignored when running gcmc with pair_style mliap. The apparent potential energy of the system without with or without the proposed deletion is the same. Since a molecule also has it internal potential energy $E_{\rm intra}$, the potential energy change of deletion $\Delta E$ becomes:

$$E_{\rm before} = E_{\rm after}$$ $$\Delta E = E_{\rm after} - E_{\rm before} + E_{\rm intra}$$ $$\Delta E = E_{\rm intra}$$

Because $E_{\rm intra}$ is typically a highly negative value, deletion of molecules becomes unphysically favorable over insertion.

Expected Behavior

If molecules in the box are interacting with each other, the potential energy change of deletion $\Delta E$ should be equal to the potential energy cost of breaking the interactions. If the interactions are attractive, $\Delta E>0$. If they are repulsive, $\Delta E<0$. If the molecules do not interact and the substance is an ideal gas, $\Delta E=0$.

LAMMPS Version and Platform

22 Jul 2025 - Update 4
Linux "Ubuntu 24.04.4 LTS" 6.17.0-35-generic x86_64

Full output from lmp -h is attached in lammps_version.txt

Steps to Reproduce

Path source file "src/MC/fix_gcmc.cpp" to modify the method FixGCMC::attempt_molecule_deletion_full() to output energy before and after each attempted deletion to a text file "gcmc_delete_debug.dat" (fix_gcmc.patch / fix_gcmc.cpp). Run a very short GCMC simulation trying to insert water molecules into a box with ~50 exchange attempts. Check "gcmc_delete_debug.dat" to see that Eafter is equal to Ebefore for each attempted deletion. An example input script and its corresponding output are attached in bug-preproduction.tar.gz. The potential used in this example can be downloaded from MACE foundation model repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions