Wrong number of dihedrals after create_bonds single/dihedral

Dear all,

I would like to create bonds between different molecules to model some chemical process. I chose the set of commands "create_bonds single bond" (angle/dihedrals) because it allows me to precisely select atoms. I’m working with LAMMPS 11 Aug 2017 on Debian 4.9.65-3 (2017-12-03) x86_64.

I just created a simple test case to (hopefully) clearly explain the situation (input files are attached). The simulation box contains 2 chains with four particles each. I want to connect particles 2 and 6. I use a single FF type for each kind of interaction.

The relevant part of my input file (in.system) is

# 1---2---3---4
# |
# 5---6---7---8

lmp.tar.gz (1.23 KB)


thanks for the complete and detailed report with an illustrative and complete example. it makes tracking down the issue extremely straightforward. i wish more people would do it the same way.

what you are seeing is clearly a bug and it can be addressed in a straightforward way with the attached patch.
please give it a try. it should be included in the next LAMMPS patch.


create_bonds_accounting_bugfix.diff.gz (321 Bytes)


I just applied your patch and now, dihedral count works perfectly.

Thank you for your help and your kind words (I also do some code development and always appreciate help from users :wink: )