Read_data command

Hello LAMMPS users,

When using the read_data command is there a quick way to prevent LAMMPS from traversing the bond topology of your network (i.e. looking for 1-2, 1-3, 1-4 neighbors)?

So far I have tried commenting lines 510-513 form the read_data.cpp file but that leads to segmentation faults. (I use Dec 9th, 2014 LAMMPS version)

Additionally I thought that I could use neigh_modify to turn off the pair interactions but LAMMPS will not let me execute this command before the simulation box has been defined (i.e. the read_data command has been used).

Any help is appreciated.

-Thanks!

John

Hello LAMMPS users,

When using the read_data command is there a quick way to prevent LAMMPS from traversing the bond topology of your network (i.e. looking for 1-2, 1-3, 1-4 neighbors)?

What for?

So far I have tried commenting lines 510-513 form the read_data.cpp file but that leads to segmentation faults. (I use Dec 9th, 2014 LAMMPS version)

Additionally I thought that I could use neigh_modify to turn off the pair interactions but LAMMPS will not let me execute this command before the simulation box has been defined (i.e. the read_data command has been used).

Why is this a problem?

Axel

LAMMPS only does that operation if you are using an atom
style with bonds, and you define them in your data file.

If you don’t want that, then you should likely use a trimmed
data file and a different atom style.

Steve

Thank you for your responses,

Axel,

In regard to your first question, the system which I am simulating has a large number of 1-4 pairs and due to this I run out of memory.
Since for this particular scenario I do not really need the list of 1-4 neighbors (or 1-3 neighbors for that matter) I was wondering if there was a way of omitting the memory allocation step for 1-4 neighbors. I have also tried setting the coefficients in the special_bonds command to zero however this does not seem to prevent the initial memory allocation for the 1-4 neighbor list (i.e. “special_bonds lj 1. 0. 0.”). Additionally, this is not a molecular dynamics model, it is a larger mesoscale model (for which I use DPD pair style).

In terms of your second comment, I was reading the thread “Re: [lammps-users] Too many 1-4 neighbors in Bond potential leads to computer out of memory. How to fix it?” and in there it was suggested that the pair potential be turned off.

Steve,

I do need the bonds because otherwise I don’t think my simulations make much sense without them. Additionally, I have to define them in the data file because I do not think that its practical to create the bonds outside of the data file using LAMMPS directives (it might not even be possible).

What exactly do you mean when you say a “trimmed” data file?

Thanks!

John

Thank you for your responses,

Axel,

In regard to your first question, the system which I am simulating has a large number of 1-4 pairs and due to this I run out of memory.

This is a highly unlikely scenario. It is much more likely, that something else is wrong. Difficult to say, though, with no tangible information about your setup.

Since for this particular scenario I do not really need the list of 1-4 neighbors (or 1-3 neighbors for that matter) I was wondering if there was a way of omitting the memory allocation step for 1-4 neighbors. I have also tried setting the coefficients in the special_bonds command to zero however this does not seem to prevent the initial memory allocation for the 1-4 neighbor list (i.e. “special_bonds lj 1. 0. 0.”). Additionally, this is not a molecular dynamics model, it is a larger mesoscale model (for which I use DPD pair style).

The memory used by the special neighbors determination feature is generally small compared to the non-bonded neighbors. If you need to save ram, that is where I would look first.

Also, how much memory are we talking about? Under normal circumstances your simulation would run intolerably slow before running out of ram, and that would then require running in parallel, which in turn allows to distribute the memory requirements across multiple parallel nodes.

In terms of your second comment, I was reading the thread “Re: [lammps-users] Too many 1-4 neighbors in Bond potential leads to computer out of memory. How to fix it?” and in there it was suggested that the pair potential be turned off.

I cannot really comment on this. I write a lot of responses and do not memorize everything I write by subject line and paragraph. I am certain, that you are taking this out of context, because your conclusion makes no sense for the model you (very vaguely) describe.

Axel

Hi Axel,

I can show you the LAMMPS output during the crash if that helps. I use 64 gb of memory with 48 processors.

LAMMPS (15 Dec 2014)
Reading data file …
orthogonal box = (-300 -300 -300) to (300 300 300)
3 by 4 by 4 MPI processor grid
reading atoms …
2500000 atoms
scanning bonds …
9 = max bonds/atom
reading bonds …
21202020 bonds
Finding 1-2 1-3 1-4 neighbors …
18 = max # of 1-2 neighbors
306 = max # of 1-3 neighbors
5508 = max # of 1-4 neighbors
ERROR on proc 21: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 21
ERROR on proc 22: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 22
ERROR on proc 25: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 25
ERROR on proc 26: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 26

Hi Axel,

I can show you the LAMMPS output during the crash if that helps. I use 64 gb of memory with 48 processors.

LAMMPS (15 Dec 2014)
Reading data file …
orthogonal box = (-300 -300 -300) to (300 300 300)
3 by 4 by 4 MPI processor grid
reading atoms …
2500000 atoms
scanning bonds …
9 = max bonds/atom
reading bonds …
21202020 bonds
Finding 1-2 1-3 1-4 neighbors …
18 = max # of 1-2 neighbors
306 = max # of 1-3 neighbors
5508 = max # of 1-4 neighbors
ERROR on proc 21: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 21
ERROR on proc 22: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 22
ERROR on proc 25: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 25
ERROR on proc 26: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 26

===================================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= EXIT CODE: 1
= CLEANING UP REMAINING PROCESSES
= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES

Here is also the input script which I am using: (Essentially I have a rectangular piece of material in which I control the deformation by altering the bond lengths

I think the straightforward solution for your system would be to make the bond interactions implicit in a custom written pair style similar to what’s done in peridynamics. That would require some serious programming, though. Having 9 bonds per atom is far beyond the typical assumptions that lammps makes.

This output means you have an unusual system:

Finding 1-2 1-3 1-4 neighbors …
18 = max # of 1-2 neighbors
306 = max # of 1-3 neighbors
5508 = max # of 1-4 neighbors

This will induce allocation of a 2d array
that is # of local atoms by 5508, which is
huge. Hence your memory problem.

Assuming you don’t want to compute angles or dihedrals,
or exclude the corresponding 1-3 and 1-4 interactions
from the neighbor list, I think you can use the special_bonds
command to set the 1-3 and 1-4 weighting factors to 1.0 (full weight)
before the read_data command. Then it should not attempt
to compute the list of 1-3 and 1-4 neighbors. I’m not
on a machine where I can try it, but please see if that works.

By a “trimmed” data file, I meant delete the portions, if they
are there, that enumerate the angles and dihedrals. I presume
you want to be using atom_style bond, and not atom_style molecular.

Steve

Hi Steve,

This output means you have an unusual system:

Finding 1-2 1-3 1-4 neighbors …
18 = max # of 1-2 neighbors
306 = max # of 1-3 neighbors
5508 = max # of 1-4 neighbors

This will induce allocation of a 2d array
that is # of local atoms by 5508, which is
huge. Hence your memory problem.

Assuming you don’t want to compute angles or dihedrals,
or exclude the corresponding 1-3 and 1-4 interactions
from the neighbor list, I think you can use the special_bonds

I assume you meant set the 1-3 and 1-4 coefficients to 0 since setting them to 1 would achieve the opposite effect of what I am trying to do. In any case I tried both scenarios and I end up with the same memory issue. I also tried it with the bond style (versus molecular) and that does not work either.

command to set the 1-3 and 1-4 weighting factors to 1.0 (full weight)
before the read_data command. Then it should not attempt
to compute the list of 1-3 and 1-4 neighbors. I’m not
on a machine where I can try it, but please see if that works.

By a “trimmed” data file, I meant delete the portions, if they

are there, that enumerate the angles and dihedrals. I presume
you want to be using atom_style bond, and not atom_style molecular.

Ah okay, my data files are already in this format. I do not specify (or write to the data file) anything about angles or dihedrals.

Thanks,

John

Hi Steve,

This output means you have an unusual system:

Finding 1-2 1-3 1-4 neighbors …
18 = max # of 1-2 neighbors
306 = max # of 1-3 neighbors
5508 = max # of 1-4 neighbors

This will induce allocation of a 2d array
that is # of local atoms by 5508, which is
huge. Hence your memory problem.

Assuming you don’t want to compute angles or dihedrals,
or exclude the corresponding 1-3 and 1-4 interactions
from the neighbor list, I think you can use the special_bonds

I assume you meant set the 1-3 and 1-4 coefficients to 0 since setting them to 1 would achieve the opposite effect of what I am trying to do. In any case I tried both scenarios and I end up with the same memory issue. I also tried it with the bond style (versus molecular) and that does not work either.

I believe that the code estimating the memory requirements for the special neighbors lists in lammps doesn’t account for this unusual setup. But your understanding of the logic is not quite right. When lammps processes special neighbors it considers three cases: 0.0, 1.0 and all other factors. For 0.0 the pair is removed from the neighborlist, for 1.0 no special treatment is applied and for all others the neighbor index is modified to encode whether a pair is a 1-2, 1-3, or 1-4 neighbor pair. So, steve’s suggestion did have some merit, and the factor would have to be 1.0. If you would set it to 0.0 your model would exclude pairs that must not be excluded.

Nevertheless, since your bond topology is determined by geometry, it should be possible to determine and maintain it as part of the pair potential.

As Axel said, set the 1-3 and 1-4 weights to 1.0. I think that
avoids creating lists of 1-3 and 1-4 pairs in the special lists
and will avoid your memory issue. It will also insure that 1-3
and 1-4 pairwise interactions are actually computed, which
I assume is what you want. If you really want to exclude
5800 1-4 interactions for each atom, then you have no choice
but to have those 1-4 pairs in a list somewhere, which is why
your memory is exploding.

Steve

Hi Steve,

I did try setting the 1-3 and 1-4 coefficients to 1.0. however that still produces the same error.

The output file is shown below:

LAMMPS (9 Dec 2014)
Reading data file …
orthogonal box = (-300 -300 -300) to (300 300 300)
3 by 4 by 4 MPI processor grid
reading atoms …
2500000 atoms
scanning bonds …
9 = max bonds/atom
reading bonds …
21202020 bonds
Finding 1-2 1-3 1-4 neighbors …
18 = max # of 1-2 neighbors
306 = max # of 1-3 neighbors
5508 = max # of 1-4 neighbors
ERROR on proc 25: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 25
ERROR on proc 21: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 21
ERROR on proc 22: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
ERROR on proc 26: Failed to allocate -14148493568 bytes for array special:buf (…/memory.cpp:45)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 26
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 22

If you look at the in.chain and data.chain files in the bench dir,

they do what I am advocating. These lines in the input
script:

atom_style bond
special_bonds fene # 1-2,1-3,1-4 = 0.0 1.0 1.0
read_data data.chain

produce this output:

Finding 1-2 1-3 1-4 neighbors …
2 = max # of 1-2 neighbors
2 = max # of special neighbors

As you can see no 1-3 or 1-4 neighbors are checked for,
and no memory to store them is allocated.

What is different about your problem?

Steve

What is different about your problem?

It might be this line:

special_bonds lj 1.0. 1.0. 1.0.

Try:

special/bonds lj/coul 1.0 1.0 1.0

Steve

Steve,

Yea using “special/bonds lj/coul 1.0 1.0 1.0” works really well. Why is it that this works but “special_bonds lj 1.0. 1.0. 1.0.” doesn’t?

Thank you for the help!

John

Because the check in the code that creates the lists of

1-2, 1-3, 1-4 neighbors is only skipping 1-3 and 1-4 if
both the LJ and Coul coeffs are 1.0. The default in
the special_bonds command is for both to be 0.0.
So if you only set LJ, the Coul one is still 0.0.

Steve

Steve,

Ah okay, I did not know about this. Thank you for clearing this up.

-John