I have modified the link cells class to ensure it works even if you are not running a simulation with PBC.
Please note that to use the link cell class, you need to use the functions below:
#include "tools/LinkCells.h"
// Declare a link cells object
LinkCells linkcells;
// Create a link cells object
linkcells(comm)
// Set the link cell cutoff
linkcells.setCutoff( nl_cut );
// Allocate each atom in a list to its appropriate cell
std::vector<Vector> ltmp_pos; // Vector of atomic positions
std::vector<unsigned> indices; // index to use for each of the atoms -- index in colvar NOT index in MD code.
linkcells.buildCellLists( ltmp_pos, indices, getPbc() );
// Retrieve the atoms in the cells that are needed
unsigned ncells_required;
std::vector<unsigned> indices( 1+ablocks.size() )
std::vector<unsigned> cells_required( linkcells.getNumberOfCells() );
linkcells.addRequiredCells( linkcells.findMyCell( pos ), ncells_required, cells_required );
// Now get the indices of the atoms in the link cells positions
unsigned natoms=1; indices[0]=pTaskList[i];
linkcells.retrieveAtomsInCells( ncells_required, cells_required, natoms, indices );
I've copy and pasted these commands from the class where I use stuff. It dawns on me that how you use the interface in that second bunch of calls is less clear than it could be. It perhaps be worth writing a wrapper around all that stuff.
Target release
I would like my code to appear in release 2.10
Type of contribution
[x] changes to code or doc authored by PLUMED developers, or additions of code in the core or within the default modules
[ ] changes to a module not authored by you
[ ] new module contribution or edit of a module authored by you
Copyright
[x] I agree to transfer the copyright of the code I have written to the PLUMED developers or to the author of the code I am modifying.
[ ] the module I added or modified contains a COPYRIGHT file with the correct license information. Code should be released under an open source license. I also used the command cd src && ./header.sh mymodulename in order to make sure the headers of the module are correct.
Tests
[x] I added a new regtest or modified an existing regtest to validate my changes.
[x] I verified that all regtests are passed successfully on GitHub Actions.
Description
I have modified the link cells class to ensure it works even if you are not running a simulation with PBC.
Please note that to use the link cell class, you need to use the functions below:
I've copy and pasted these commands from the class where I use stuff. It dawns on me that how you use the interface in that second bunch of calls is less clear than it could be. It perhaps be worth writing a wrapper around all that stuff.
Target release
I would like my code to appear in release 2.10
Type of contribution
Copyright
COPYRIGHT
file with the correct license information. Code should be released under an open source license. I also used the commandcd src && ./header.sh mymodulename
in order to make sure the headers of the module are correct.Tests