SSAGESproject / SSAGES

Software Suite for Advanced General Ensemble Simulations
GNU General Public License v3.0
81 stars 28 forks source link

How can I use the neighbor list in lammps? #26

Closed wxsongsh closed 3 years ago

wxsongsh commented 3 years ago

Dear SSAGES Developers,

I want to add a new CV in the SSAGES, which will be combined with LAMMPS. I need the neighbor_list that has been created by LAMMPS. But I do not know how to call the related functions in the LAMMPS.

In the hooks/lammps/fix_ssages.cpp file, it successfully calls the LAMMPS functions, such as "auto n = atom->nlocal;". Using the template AngleCV.h file, could you give me an example how add a line " auto n = atom->nlocal;" correctly?

Hope hearing from you soon.

Thank you very much.

mquevill commented 3 years ago

The CVs that are included in SSAGES must work with any engine we support. Since the neighbor list is not a property that SSAGES gets from the MD engine, it cannot be used in CVs. The CVs and Methods are not aware of any engine-specific data, so it would be nearly impossible to get info directly from LAMMPS within the CV. Furthermore, neighbor lists are not well-standardized, so it might be difficult to properly import them into SSAGES in a standardized way across all engines.

[Ideas on an implementation] That being said, you could implement your own LAMMPS-specific neighbor list functionality. All information passed between LAMMPS and SSAGES is done through the snapshot functionality. You could add a field to the Snapshot that would somehow save the neighbor list (creating a snapshot_->SetNeighborList() and implementing it in hooks/lammps/fix_ssages.cpp), and then you could access it within the CV with snapshot.GetNeighborList(). I am not aware of the format of atom->nlocal, but as long as you are sticking with LAMMPS's format, this should help you get started.

wxsongsh commented 3 years ago

Thanks. It is hard to set up the neighbor list. I try to build it by myself.