Molecule auto special bond generation overflow

Dear all!
I got Molecule auto special bond generation overflow error, but currently can not understand the reason. Most probably I can not see something obvious, but can you please help?

The datafile I use in molecule command is defined as follows:

# ch4 molecule

5 atoms
4 bonds
6 angles

Coords

1 4.21606368 4.00000008 3.70198744
2 4.76079152 3.99999976 4.65126952
3 4.91210072 4.00000016 2.85677296
4 3.555522   4.88196568 3.64498488
5 3.555522   3.11803432 3.64498528

Types

1 1
2 2
3 2
4 2
5 2

Bonds

1 1 1 2
2 1 1 3
3 1 1 4
4 1 1 5

Angles

1 1 2 1 3
1 1 2 1 4
1 1 2 1 5
1 1 3 1 4
1 1 3 1 5
1 1 4 1 5

The input script:

units             real
dimension         3
atom_style        full
boundary          p p p

region simulation_box block -50 50 -50 50 -50 50
create_box 2 simulation_box bond/types 1 angle/types 1 extra/bond/per/atom 4 extra/angle/per/atom 6

molecule CH4 ch4_mol.lmp

mass 1 12.011
mass 2 1.0078

pair_style lj/cut 7.0
pair_coeff 1 1 0.02 3.5
pair_coeff 2 2 0.015 3.5
pair_coeff 1 2 0.1 3.5

create_atoms 0 random 50 20000 simulation_box mol CH4 20000

group CH4_mol type 1 2
delete_atoms overlap 0.5 CH4_mol CH4_mol mol yes

Thank you in advance!

The obvious piece that is missing is reserving space for special atoms per atom alongside bonds per atom and angles per atom. When you have bonded interactions, LAMMPS needs to compile a list of special 1-2, 1-3, and 1-4 neighbors for each atom, so it can encode those properties into the neighbor list. Your create_box command, however, is missing this and hence the overflow error.

1 Like

Thank you! It solved the problem.

Hello! I have the same error in a similar scrip for C6H12, but in my case, my create_box has all the keywords:
region box block -50 50 -50 50 -50 50
create_box 2 box &
bond/types 2 &
angle/types 3 &
dihedral/types 3 &
extra/bond/per/atom 2 &
extra/angle/per/atom 1 &
extra/special/per/atom 2
Do you have any suggestions? I run the same molecule with data file and the output says 4 = max # of 1-2 neighbors, 6 = max # of 1-3 neighbors, 12 = max # of 1-4 neighbors, 15 = max # of special neighbors, so, based on the reply, I understood that these are the information not generated with molecule command. In this case, how can I fix the error? Thanks in advance!

The molecule command cannot create those, because the settings number of types and max number of per-atom properties is set when the box is created and then locked in. Thus the corresponding numbers have to be given with the create_box or read_data command. When all information is read from a data file, then LAMMPS can autogenerate those, because it reads the data file twice and in the first pass it counts how many are needed and then uses the optimum. Since this is per-atom data, this can consume quite a bit extra memory, if chosen too large. However, that kind of “waste” is much less of a problem these days, since computers have generally much more RAM available.

Bottom line, based on the number printed by the read_data command, you should set extra/special/per/atom to at least 15. Or more generally, setting extra/bond/per/atom to 5 and extra/angle/per/atom to 10 and /extra/special/per/atom to 30 should be rather safe for normal molecular compounds.

If you want the find out the optimal values: write out a data file for the entire system, then issue a clear command and read the data file back in and observe the optimal numbers.

1 Like