How to use fix gcmc

Dear users,

I have learned lammps for days but I am still very confused about the command “fix gcmc”. I have the following questions (Qs). Thanks for your answers in advance.

Q1: In the manual, it reads “if used with the fix nvt command…” What does this mean? Does “fix gcmc” has to be used in a combination with “fix nvt”? Yes or No?

Q2: The format for “fix gcmc” is “fix ID group-ID gcmc N X M type seed T mu displace keyword values …” where we have “N = invoke this fix every N steps”. If “fix gcmc” can be used independently, is it still of “muVT” ensemble? If used independently, we have to set N=0, correct?

Q3: “fix gcmc” can be used with “fix nVt”, this is clearly stated in the manual. Is it also OK to use within a combination with “fix npT”?

Q4: For a homogeneous system (e.g. H2 in bulk), I guess, the answer for Q3 is NO. Because V and n can fluctuate for “npt” and “muVT”, respectively, for homogeneous system it may result in a continuely increase of n. For this you can imagine that when do simulations in “npt”, the volume of system may increase a little, then when turn to “muVT”, the n (e.g. the number of H2 molecules) may increase a little due to the relatively larger volume, then again V increases, n increases…and comes no end.

Q5: In a word, I believe, althoug not 100% sure, a combination of “fix gcmc” and “fix npt” can not be applied to a homogeneous system (or single component system). But I believe this combination can be applied to a multi-component system, if only the number of molecules (or atoms) of parts of components is kept constant and only the rest of components are allowed to exchange with the reservoir. If this is true, can I directly use this combination without any modification to lammps code?

Q6: Currently it seems for “fix gcmc”, only one type of component is allowed to exchange. Is it possible to deal with a system with more than one component needed to exchanged (e.g. a systems including H2, O2 and CO2)?

Q7 When explaining how to add the inserted atoms/molecules into group/group-ID. The manual reads " E.g. if type = 2, and the file specifies atom types 1,2,3, then the inserted molecule will have atom types 3,4,5." Here I am totally confused that why the specified atoms have types of 1,2,3, but then they become 3,4,5 after insertion?

Q8 Let’s take a system of originally 100 H2 molecules (i.e. for the initial state there are 100 H2, but more H2 may be inserted) as an example. Only the H2 with exchange type can be inserted, but all H2 including the originally 100 H2 and those newly inserted can be deleted. Is this correct? But it seems the atom type of the originally 100 H2 differs with those newly inserted H2 although they are esentially the same H2. I can not understand how the atom type is set or changed here.

Q9: It reads “Note that very lengthy simulations involving insertions/deletions of billions of gas molecules may run out of atom or molecule IDs and trigger an error”. I can not understand why the IDs can be run out of.

I have too many questions, partially because I am new to lammps and partially because of my English language. Anyway, thanks a lot for your reply in advance.

Best wishes,

Yongbiao

I can answer some of these (I think), for the rest someone else will have to jump in.

Q1: Fix GCMC just attempts every now and then to insert atoms or molecules in some specified region and accepts this insertion with a Metropolis Monte Carlo-criterion. It does not do any sort of time integration of your atoms, and nothing in your system will actually move. This is probably not what you want. If you however combine fix GCMC with a time integration method and a thermostat (like fix nvt or a combination of fix nve and fix langevin) then you can simulate something like a grand-canonical ensemble, because the thermostat keeps the temperature of the system constant and fix gcmc will tend to keep the chemical potential of your system constant.

Q2: No. If there is no thermostat then the temperature of your system will in principle not be constant, so the system will not be muVT.

Q3/4/5: I am really not sure. I don’t think such a combination makes sense from a physical point of view.

Q6: It might be possible to work around this with multiple fix gcmc commands, but I do not know how correct this will be.

Q7/8: No idea.

Q9: I think LAMMPS just keeps incrementing the ID of new atoms that are inserted. After a while, the atom ID it will use for new atoms will be larger than what fits in a (32 or 64 bits) int. For 32 bits, this number is about 2 billion.

1 Like

Here are some more answers.

Dear users,

     I have learned lammps for days but I am still very confused about the
command "fix gcmc". I have the following questions (Qs). Thanks for your
answers in advance.

Q1: In the manual, it reads "if used with the fix nvt command....." What
does this mean? Does "fix gcmc" has to be used in a combination with "fix
nvt"? Yes or No?

You can use fix gcmc by itself to run a pure Monte Carlo simulation
with atom insertions, deletions and also displacements of x,y,z
coordinates. You can also combine fix gcmc with other types of fix,
like nve, nvt,...It is up to you. In all cases, you have to pay
attention to whether or not the simulation makes any sense.

Q2: The format for "fix gcmc" is "fix ID group-ID gcmc N X M type seed T mu
displace keyword values ..." where we have "N = invoke this fix every N
steps". If "fix gcmc" can be used independently, is it still of "muVT"
ensemble? If used independently, we have to set N=0, correct?

n=0 makes never makes sense. In the absence of any other fixes, a
better choice would be N=1. In this case, each LAMMPS timestep would
correspond to a single block of Monte Carlo moves.

Q3: "fix gcmc" can be used with "fix nVt", this is clearly stated in the
manual. Is it also OK to use within a combination with "fix npT"?

You can do this. You just have to recognize, as you do below, that mu,
p, and T are
all intensive properties, so the extent of the system is
unconstrained, unless another
conserved extensive component is present, such as another atom type.

Q4: For a homogeneous system (e.g. H2 in bulk), I guess, the answer for Q3
is NO. Because V and n can fluctuate for "npt" and "muVT", respectively, for
homogeneous system it may result in a continuely increase of n. For this you
can imagine that when do simulations in "npt", the volume of system may
increase a little, then when turn to "muVT", the n (e.g. the number of H2
molecules) may increase a little due to the relatively larger volume, then
again V increases, n increases...and comes no end.

Yes.

Q5: In a word, I believe, althoug not 100% sure, a combination of "fix gcmc"
and "fix npt" can not be applied to a homogeneous system (or single
component system). But I believe this combination can be applied to a
multi-component system, if only the number of molecules (or atoms) of parts
of components is kept constant and only the rest of components are allowed
to exchange with the reservoir. If this is true, can I directly use this
combination without any modification to lammps code?

Yes.

Q6: Currently it seems for "fix gcmc", only one type of component is allowed
to exchange. Is it possible to deal with a system with more than one
component needed to exchanged (e.g. a systems including H2, O2 and CO2)?

I have not tested this, but think you can achieve this in the current
code by creating multiple fixes.

Q7 When explaining how to add the inserted atoms/molecules into
group/group-ID. The manual reads " E.g. if type = 2, and the file specifies
atom types 1,2,3, then the inserted molecule will have atom types 3,4,5."
Here I am totally confused that why the specified atoms have types of 1,2,3,
but then they become 3,4,5 after insertion?

3 = 1+2
4 = 2+2
5 = 3+2

In words, for molecule insertion, the type keyword specifies a type
offset, not a type.

Q8 Let's take a system of originally 100 H2 molecules (i.e. for the initial
state there are 100 H2, but more H2 may be inserted) as an example. Only the
H2 with exchange type can be inserted, but all H2 including the originally
100 H2 and those newly inserted can be deleted. Is this correct? But it
seems the atom type of the originally 100 H2 differs with those newly
inserted H2 although they are esentially the same H2. I can not understand
how the atom type is set or changed here.

You seem to be confusing exchange type and exchange group. These two
words have similar meanings in
normal english, but in LAMMPS they mean two very different things.
type is the type of an atom,
which defines how it contributes to the potential energy, its mass,
and some other things. group
is a way of controlling which subset of atoms the fix operates on.
This is what is true:
"This fix cannot be used to perform MC insertions of gas atoms or
molecules other than the exchanged type, but MC deletions,
translations, and rotations can be performed on any atom/molecule in
the fix group."

Q9: It reads "Note that very lengthy simulations involving
insertions/deletions of billions of gas molecules may run out of atom or
molecule IDs and trigger an error". I can not understand why the IDs can be
run out of.

Don't worry about it.

1 Like