How to determine extra/dihedral/per/atom (bond, angle, improper) value when using create_box

I have been trying to use the molecule command to import a template for populating a lattice. However, I am confused with the extra/dihedral/per/atom option for the create_box command. How is the value for extra/dihedral/per/atom determined? Is there a systematic way to determine what it should be? As I understand it, this option determines the maximum number of dihedrals a single atom will appear in. I understand that if you are going to be making new bonds, angles…… then you should set this number to the maximum number of dihedrals a single atom could potentially form. For my case, I am reading in a molecule template that defines all of the necessary dihedral connections. I initially thought I would not need to use the extra/dihedral option since the file is defining all of the dihedrals. This clearly was not correct as my simulation failed. I decided to dig into the code a little to figure out exactly what value was causing the code to crash and the dihedral number was somewhere in the middle of the max number of dihedrals for a single atom and zero. So, what sets the initial number of dihedrals that I need to allocate extras on top of?

Here is my dihedral connectivity:

Dihedrals

1 1 6 2 1 4
2 2 15 2 1 4
3 3 2 1 4 3
4 4 2 1 4 8
5 5 6 2 1 5
6 1 15 2 1 5
7 1 4 1 2 6
8 5 5 1 2 6
9 2 4 1 2 15
10 1 5 1 2 15
11 3 1 2 15 3
12 4 1 2 15 16
13 6 1 4 3 7
14 7 8 4 3 7
15 8 1 4 3 15
16 9 8 4 3 15
17 8 4 3 15 2
18 9 4 3 15 16
19 3 2 1 4 3
20 10 5 1 4 3
21 6 1 4 3 7
22 8 1 4 3 15
23 4 2 1 4 8
24 11 5 1 4 8
25 12 1 4 8 9
26 12 1 4 8 10
27 13 1 4 8 11
28 12 1 4 8 9
29 14 3 4 8 9
30 12 1 4 8 10
31 14 3 4 8 10
32 13 1 4 8 11
33 15 3 4 8 11
34 16 4 8 11 12
35 16 4 8 11 13
36 16 4 8 11 14
37 16 4 8 11 12
38 17 9 8 11 12
39 17 10 8 11 12
40 16 4 8 11 13
41 17 9 8 11 13
42 17 10 8 11 13
43 16 4 8 11 14
44 17 9 8 11 14
45 17 10 8 11 14
46 3 1 2 15 3
47 10 6 2 15 3
48 8 2 15 3 4
49 6 2 15 3 7
50 4 1 2 15 16
51 11 6 2 15 16
52 12 2 15 16 17
53 12 2 15 16 18
54 12 2 15 16 19
55 12 2 15 16 17
56 14 3 15 16 17
57 12 2 15 16 18
58 14 3 15 16 18
59 12 2 15 16 19
60 14 3 15 16 19

And here is my call for the create_box that actually works:

create_box 8 BOX bond/types 9 angle/types 9 dihedral/types 17 improper/types 19 extra/bond/per/atom 3 extra/angle/per/atom 3 extra/dihedral/per/atom 1**5 extra/improper/per/atom 12 extra/special/per/atom 3

If I set extra/dihedral/per/atom to 14 it fails. However, I am not sure why 15 works. Atom 4 is listed in far more than 15 dihedrals. So, again my question, is there a systematic way to determine what the value of extra/dihedral/per/atom should be?

Thank you in advance,
Don

Donald K. Ward
Sandia National Laboratory
Livermore, CA 94550
(925) 294-6747
[email protected]…3…

I have been trying to use the molecule command to import a template for
populating a lattice. However, I am confused with the
extra/dihedral/per/atom option for the create_box command. How is the value
for extra/dihedral/per/atom determined? Is there a systematic way to

you make an educated guess and then add a safety margin. :wink:
you don't have to hit the mark perfectly, only you cannot be too
small, and much too large a value would waste memory and may result in
lower performance (but not by a lot). you can definitely make an
estimate for the maximum, when you know the maximum number of bonds
per atom. that is typically 4 for common polymeric systems. then you
would have maximally 4 extra bonds, 4*4=16 extra angles and 4*4*4=64
extra dihedrals. with newton bond on, these numbers would be smaller,
since each bond/angle/dihedral/improper is only stored once (instead
of 2x, 3x, or 4x respectively).

the easiest way would be to build a data file with a maximally
branched example structure and then just empirically take note of the
numbers that LAMMPS finds.

[...]

determine what it should be? As I understand it, this option determines the
maximum number of dihedrals a single atom will appear in. I understand that
if you are going to be making new bonds, angles…… then you should set this
number to the maximum number of dihedrals a single atom could potentially
form. For my case, I am reading in a molecule template that defines all of
the necessary dihedral connections. I initially thought I would not need to
use the extra/dihedral option since the file is defining all of the
dihedrals. This clearly was not correct as my simulation failed. I decided

no. LAMMPS needs to allocate storage for all possible topology data by
time the box is created. these arrays cannot be changed after that
without a full reset.

[...]

If I set extra/dihedral/per/atom to 14 it fails. However, I am not sure why
15 works. Atom 4 is listed in far more than 15 dihedrals. So, again my
question, is there a systematic way to determine what the value of
extra/dihedral/per/atom should be?

with newton on and maximally 4 bonds per atom, you should not have
more than 32 dihedrals per atom. please remember that with newton on
on (the default) a dihedral is stored only once (at the atom that is
listed as 2nd in the connectivity) instead of four times.

please keep in mind that you also need to reserve space for
exclusions. that would be at a theoretical maximum of 84 for the 4
bonds/per/atom case.

this all can be rationalized with a little back-of-the-envelope
consideration and doesn't have to be exact for as long as you are
large enough.

axel.

Thanks Axel,
I had a feeling that I was missing something with the dihedral count. The key was knowing that the dihedrals are stored for the atom listed 2nd in the connectivity.
Thanks again.
Don

If newton bond is on (default) then it is the count of dihedrals
owned by the 2nd atom in the dihedral. If newton bond off,
an atom will own a (copy of) any dihedral it appears in.

Steve