Lammps gcmc general question

Hello!

I am a new user to Lammps, and I’d like to ask about the ‘gcmc’ option in Lammps.
Currently, I am investigating adding new molecules to my system. From a gcmc code I am currently using, when the code decides to add a molecule, it first randomly recommends the location of the molecule and runs a check if it is within a certain radius of existing molecules and recommends a new location if this physical constraint is not fulfilled. I have an issue when I insert the molecules - finding the configuration at equilibrium at given chemical potential somehow.

I would like to understand if this molecule insertion method is similar to what Lammps does for inserting new molecules, or Lammps has somewhat more efficient way to insert the molecules other than this ?

Thank you for your help in advance!

Molecule insertions with fix gcmc in LAMMPS are not inefficient. The fix was not designed to be efficient at that. It was designed to be rarely invoked on a sparse system with only short range interactions and atoms and not only do insertions/deletions but also displacements. Support for (small) molecules and long-range electrostatic (= very inefficient) was added later. The basic assumption is that you are mostly running a (parallel) MD simulation and occasionally have a GCMC step done to speed slow processes up.

1 Like

I appreciate for your fast response.

I’d like to learn a bit more on how the insertion/deletion GCMC works for LAMMPS. For instance, when looking at addition of molecules the GCMC code I run on python randomly adds by first drawing from a normal distribution randomly and then testing whether the random value passes a probability threshold. This threshold is initially set by the user but is updated with each iteration of energy calculation from the previous structure.

I’d like to know when LAMMPS decides to have a GCMC step (take addition of a molecule for example), does LAMMPS randomly select a location to add the molecule or does LAMMPS decide the addition location using deterministic methods (e.g., use previous structure’s energy to determine the location of the molecule to be added)?

What do you need to know that for?

Hi Dr. Kohlmeyer,

Thank you for the response again!

I am currently doing gcmc in dft for water molecules. I was considering using Lammps as an alternative way when I insert the water molecules.

I saw in the forum that lammps does gcmc in effective way, and was wondering if this is coming from the parallerization or other deterministic methods when it inserts the molecule.

I don’t know what you saw, but you may be misinterpreting what is efficient.

The only case where fix gcmc is rather efficient is when you only have a short range interaction (like Lennard-Jones without charges), since it can then compute only the local energy differences instead of (re-)computing the total energy of the entire system and comparing “before” and “after”.

As for choosing a position, all I see in the source code is just using uniform random numbers within the defined insertion region and no optimizations for choosing an optimized location.

If you need information at that level of detail, you are better off reading the source code instead of having me read it for you (I am not in the mood for telling scary bedtime stories :wink:). Just start by looking for functions that have names starting with attempt_.

1 Like

I appreciate your help and explanataion. I have better picture of the gcmc in lammps thanks to you now.

Thank you for taking time to respond to my inquiries!