Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link cells without PBC #1100

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Link cells without PBC #1100

wants to merge 2 commits into from

Conversation

gtribello
Copy link
Member

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:

#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
  • 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
  • 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
  • I added a new regtest or modified an existing regtest to validate my changes.
  • I verified that all regtests are passed successfully on GitHub Actions.

@gtribello gtribello requested a review from GiovanniBussi July 24, 2024 09:32
@gtribello
Copy link
Member Author

@GiovanniBussi there are regtests for this specific class in adjmat/rt-link and adjmat/rt-link-nopbc :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants