Fix gcmc with multiple molecules

Have you tried offsetting the atom types with toff ?

I doubt the error is due to the atom types ( I may be wrong)

Are you trying to insert the molecules in to an LJ system or system that has no bonds/angles…?


Everything that you have told us so far seems correct. This message:

3 atoms with 4 types

simply means that the largest atom type in the CO2 molecule file is 4, which is correct. The error message you are getting is indicating that you have not requested or preallocated sufficient storage for the data contained in one or both of your molecule files. If you can’t figure out what this is, or if you can’t show us that the error message itself is somehow incorrect, we can’t help you. If you find yourself overwhelmed by the complexity, here is a simple alternative.

Construct a data file with 1 molecule of each type and use that as your initial state. Then LAMMPS will do all the hard work for you.


Dear Arun, no, I have not tried to use toff, but as Aidan mentioned, choosing types 3 and 4 for Co2 is correct. My system have bonds and angles (I attached my files to this email).

Thanks Aidan for useful comments. I actually was able to solve this error for one molecule. I could use fix gcmc with CO2 and CH4 separately, but when I want to use fix gcmc for both molecules in one simulation I get the error. I understand that it is related to create_box command and I did not allocate enough storage. Lets look what I did.
I ran successfully fix gcmc simulation with CO2 molecule and the following create_box command I used without any error:

create_box 2 total bond/types 1 angle/types 1 extra/bond/per/atom 2 extra/angle/per/atom 1 extra/special/per/atom 2

I also ran successfully fix gcmc simulation with CH4 molecule and the following create_box command I used without any error:

create_box 2 total bond/types 2 angle/types 3 dihedral/types 4 extra/bond/per/atom 4 extra/angle/per/atom 6 extra/special/per/atom 4

Now for both molecules at the same time, I use sum of previous values as,

create_box 4 total bond/types 3 angle/types 4 dihedral/types 4 extra/bond/per/atom 6 extra/angle/per/atom 7 extra/special/per/atom 6

But I get the error: ERROR: Molecule toplogy/atom exceeds system topology/atom (…/molecule.cpp:1379)

I also attached my files in case needed.

Thanks in advance!

log.lammps (839 Bytes)

in.graphitcode (1.84 KB) (411 Bytes) (569 Bytes)

See the note on the molecule command doc page about exactly

this error and how to fix it.


You seem to be making multiple mistakes, and this error is just the first mistake that LAMMPS notices. For example, in your script, you have not defined any coefficients for pair, bond, etc. I have already suggested an alternative approach that will allow you to avoid a lot of the complexity (construct two molecules in a data file and use the read_data command).


Thank you all for your help. I used the Aidan approach and it is working now. By the way, I forgot to put the interaction coefficients in files attached.