A few issues with fix gcmc

LAMMPS users and developers,

These questions/comments are mostly for Paul Crozier, who wrote the fix gcmc code.

First of all, very nice work with this code. This is my first experience with using it and I think a lot of people will find it to be useful.

I’m attempting to use fix gcmc to insert hexane molecules into a spherical void space in the center of a box of water. I ran a separate simulation of pure water at 298 K and 1 atm, and once that equilibrated I wrote a code to remove a sphere of water molecules from the center of the simulation box.

Attached is a lammps data file (equilibrated-cavity.txt) of this system. I also placed a single hexane molecule in the center of the box, which I use as my “model molecule” for attempted insertions. I’ve encountered a few issues while trying to run these simulations.

Issue 1: When I try to run the simulation in parallel (even with just two cores), the simulation crashes with the error message: “ERROR: Fix gcmc incorrect number of atoms per molecule”. This error does not occur when running in serial. From looking at the source code it looks like there is a very minor syntax error that’s causing this problem. On line 1018 of fix_gcmc.cpp the second to last argument in MPI_Allreduce is MPI_MAX. I’m fairly confident this should be MPI_SUM instead, as the total number of atoms in the model molecule should just be the sum of model molecule atoms on each processor.

Issue 2: This one happens in serial or parallel. The documentation for fix gcmc states: “The user must supply a model molecule in the data file to use as a template for exchanges, and that molecule’s number must be given in the fix GCMC command as the type of the exchanged gas. The model molecule can then be immediately deleted using the delete_atoms command.”

When I try deleting the model molecule immediately (see the 3rd to last line in my attached input) I get the error message: “ERROR: Fix gcmc could not find any atoms in the user-supplied template molecule”. This doesn’t seem to work because the fix is not initialized until the first run statement is issued, so when LAMMPS tries to build the model molecule template the atoms are already gone.

Similarly, if I issue two run statements following fix gcmc, I get the same error message at the beginning of the second “run 100”. This seems to happen as a result of the original hexane molecule (model molecule) being deleted from the simulation during the first “run 100”.

Is there any way around these issues, or am I using the commands incorrectly? It seems like it should be possible to load the model molecule into memory the very first time fix gcmc is invoked, and then not again. Ideally this could even be done before the first run statement so the model molecule could be deleted immediately following the fix gcmc as suggested in the documentation.

Note that the chemical potential I’m using is somewhat arbitrary at this point, and also that I’m using the most recent version of LAMMPS from the Git server.

Thanks for your time and input.

All the best,

William French

equilibrated-cavity.txt (325 KB)

in.lammps (1.53 KB)