deepmodeling / deepmd-kit

A deep learning package for many-body potential energy representation and molecular dynamics
https://docs.deepmodeling.com/projects/deepmd/
GNU Lesser General Public License v3.0
1.45k stars 499 forks source link

Specify pair style double times leads to memory leak #370

Closed NewSigma closed 3 years ago

NewSigma commented 3 years ago

https://github.com/deepmodeling/deepmd-kit/blob/2111ebb82d4401fbfcbff92691c417db4d961f89/source/lmp/pair_nnp.cpp#L455

If we specify the pair style double times, nnp_inter will be initialized double times too, which is not allowed and will lead to memory leak in release mode. It seems that pairs provided by lammps can be specified several times safely.

Let me know if I'm wrong. Thank you.

amcadmus commented 3 years ago

Thanks a lot for reporting the issue! we will fix it asap.