libAtoms / matscipy

Materials science with Python at the atomic-scale
http://libatoms.github.io/matscipy/
GNU Lesser General Public License v2.1
188 stars 55 forks source link

Calling neighborlist in C++ #246

Closed CheukHinHoJerry closed 4 months ago

CheukHinHoJerry commented 4 months ago

Thank you for the nice package. Is there an example (or is it possible) on how to call the neighborlist (as in Python) in C++? Would be more very nice since I need a fast neighborlist in certain C++ code.

pastewka commented 4 months ago

The neighbor list is closely tied to the Python C-API, which makes disentangling it for use with pure C/C++ difficult.

We have a pure C++ implementation (that we use mainly for teaching) here: https://pastewka.github.io/MolecularDynamics/_project/milestone06.html - Note that this implementation does not support periodic boundaries, which in our teaching code are implemented by copying a ghost region of atoms (which is identical to how, e.g. LAMMPS does it).

The individual files are:

The code is MIT-licensed. Feel free to use and reuse.

pastewka commented 4 months ago

PS: We have full C++ MD code, but that is not public (because of teaching). I'd be happy to share the full repository with you if interesting.

CheukHinHoJerry commented 4 months ago

Thank you very much for pointing out the references! I think I have happy with what I have access to right now. I will close the issue.