ERROR: Fix gcmc cannot exchange individual atoms belonging to a molecule (src/MC/fix_gcmc.cpp:507)

Dear LAMMPS experts,

I am trying to insert Li atoms inside my simulation box which contains oxygen molecule and zeolite templated carbon structure. However, I am getting below error,

“ERROR: Fix gcmc cannot exchange individual atoms belonging to a molecule (src/MC/fix_gcmc.cpp:507)”

Could you please guide me how to fix this error? I have attached input script below;

-------------------- Init Section -----------------------

units real
boundary p p p
atom_style full
#bond_style harmonic
#angle_style harmonic
#dihedral_style harmonic
pair_style lj/cut/coul/long 12.8
kspace_style ewald 1e-05
kspace_modify gewald 1e5

-------------------- Atom Definition Section ------------

region cathode block 0.545001 35.961001 -4.785577 25.885579 -7.220522 21.696521
#replicate 2 2 2

group ztc molecule 1
group carbon type 1
group O2 molecule 2 3
group o1 type 2
group o2 type 3

molecule lithium #offset 1 0 0 0 0

group Li type 4

set group carbon charge 0
#set group O2 charge -1

pair_coeff * * 0.0000 0.0000 # no LJ interaction between structure and adsorbed atoms
#pair_coeff 1 1 0.1871 3.000 # C-C(C) LJ
pair_coeff 1 3 0.087148348 3.3755 # C1(MOF)-X(O2) LJ
pair_coeff 2 3 0.072331662 3.3200 # O(O2)-O(O2) LJ
pair_coeff 1 4 0.871 2.000 # C-Li(Li) LJ
pair_coeff 4 4 0.871 1.900 # Li-Li(Li) LJ
pair_coeff 2 4 0.871 1.900 # Li-o2(o2) LJ
pair_coeff 3 4 0.871 1.900 # Li-o2(o2) LJ

-------------------- Settings Section -------------------

compute_modify thermo_temp dynamic yes
neighbor 2 bin
neigh_modify every 1 delay 0 check no one 100000 page 5000000
neigh_modify exclude group carbon carbon
variable Liad equal (atoms-1526)
#variable o2ad equal (atoms-1488-v_Liad)

-------------------- Run Section ------------------------

fix 1 all rigid single force 1 off off off torque 1 off off off
#fix 2 o2 rigid single force 1 off off off torque 1 off off off
#fix 3 o2 rigid single force 1 off off off torque 1 off off off
#fix 1 Li rigid single force 1 off off off torque 1 off off off
#fix 2 Li deposit 38 1 10 12456 mol lithium region cathode

fix fxgc Li gcmc 1 1 1 1 124356789 100.0 -0.5 0.5 group Li pressure 100 full_energy
#fix fxgc o2 gcmc 10 100 100 2 124356789 77.0 -0.5 0.5 pressure 100000 full_energy

thermo 10
thermo_style custom step epair etotal temp press atoms v_Liad #v_o2ad evdwl ecoul emol density

dump 2 all custom 5 FAU_186C_Li*.lammpstrj id type x y z

run 500

write_data FAU_LiO21.end

As indicated by the error message, LAMMPS will refuse to exchange individual atoms with a molecule ID != 0, as that is usually an indication that this atom is part of a molecule with bonded interactions and the gcmc code has no provisions for breaking bonds and updating topology data accordingly.

This is a heuristic check, so manually setting the molecule ID for such atoms to 0 will bypass the check.
However, the restrictions from above still apply and when trying to add/remove atoms that have bonds you will create an inconsistent topology which will lead to errors about lost bond atoms at the next neighbor list update.

Thank You. It’s working now.


can you tell me how it is done?

How what is done?

actually I want to study the adsorption of H2S and NH3 using gcmc simulation in lammps with a Cof structure and I am not able to add the H2S molecule in the input file for lammps? Can you help.

Not based on such a vague description. What have you tried exactly? and what are the specific issues?

In addition, please start a new discussion topic with a new subject line since your request has nothing to do with this discussion thread.

It is considered very bad style to “hijack” an existing discussion for a completely different topic.