CompPhysVienna / n2p2

n2p2 - A Neural Network Potential Package
https://compphysvienna.github.io/n2p2/
GNU General Public License v3.0
217 stars 82 forks source link

Segmentation Fault while using lammps #104

Closed vsumaria closed 3 years ago

vsumaria commented 3 years ago

The question I have a trained potential and am trying to use the potential to do some MD simulations. The training and validation process is working correctly. But when I use the potential for any structure (even for minimization), I am getting segmentation fault.

What did you already try? Since segmentation fault is generally related to memory issues, I have tried to increase the memory while running the job, but i still am getting the same error. I tried to use a small structure (thinking that memory usage might reduce), but still have the same issue.
The Element mapping string gets read, and the code stops.

(I have attached here the input.nn, scaling.data, weight files and the laamps input files here. The structure is a simple Pt bulk structure (in the data.static file) and the pot.mod file contains the pair_style and pair_coeff lines)

scaling.data.txt in.txt input.nn.txt weights.006.data.txt weights.008.data.txt weights.078.data.txt data.static.txt pot.mod.txt

vsumaria commented 3 years ago

Ok, having debugged this a little, I understand where the error is coming from. The potential is trained on 3 atom types - Pt, C, O; and I am using the potential to optimize a simple bulk Pt system. I think the way I am reading the files for lammps is causing the issue.

I tried to use the same input files for a structure with all the three elements and it worked correctly. What might be going wrong when using just one element system?

singraber commented 3 years ago

There was indeed a bug as the code should have shown an error like this in your setup:

ERROR: LAMMPS type "2" not present, there are only 1 types defined.

instead of just segfaulting. However, on top of that small bug, a setup like yours, where there are less LAMMPS types than there are NNP elements was not considered yet and therefore the code would have exited with the above error anyway. However, since I think that there should be no problem in such a setup, I have modified the code in the latest commit to make it more permissive. So it should work now with your files, please report if that fixed it for you!