Skip to content

Commit

Permalink
Added code to link cell to ensure all atoms are put in a single link …
Browse files Browse the repository at this point in the history
…cell if there are no pbcs
  • Loading branch information
Gareth Aneurin Tribello authored and Gareth Aneurin Tribello committed Jan 20, 2025
1 parent 7f895fb commit c49e339
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/tools/LinkCells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ void LinkCells::buildCellLists( const std::vector<Vector>& pos, const std::vecto
plumed_assert( cutoffwasset && pos.size()==indices.size() );

// Must be able to check that pbcs are not nonsensical in some way?? -- GAT

double determinant = pbc.getBox().determinant();

plumed_assert(determinant > epsilon) <<"Cell lists cannot be built when passing a box with null volume. Volume is "<<determinant;

auto box = pbc.getBox();
if(box(0,0)==0.0 && box(0,1)==0.0 && box(0,2)==0.0 && box(1,0)==0.0 && box(1,1)==0.0 && box(1,2)==0.0 && box(2,0)==0.0 && box(2,1)==0 && box(2,2)==0) {
box(0,0) = box(1,1) = box(2,2) = 1e200;
} else {
auto determinant = box.determinant();
plumed_assert(determinant > epsilon) <<"Cell lists cannot be built when passing a box with null volume. Volume is "<<determinant;
}
// Setup the pbc object by copying it from action
mypbc.setBox( pbc.getBox() );
mypbc.setBox( box );

// Setup the lists
if( pos.size()!=allcells.size() ) {
Expand Down Expand Up @@ -91,9 +93,7 @@ void LinkCells::buildCellLists( const std::vector<Vector>& pos, const std::vecto
lcell_starts.resize( ncellstot );
}
// Clear nlcells
for(unsigned i=0; i<ncellstot; ++i) {
lcell_tots[i]=0;
}
lcell_tots.assign( lcell_tots.size(), 0 );
// Clear allcells
allcells.assign( allcells.size(), 0 );

Expand Down

1 comment on commit c49e339

@PlumedBot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found broken examples in automatic/a-masterclass-22-09.txt
Found broken examples in automatic/a-masterclass-22-11.txt
Found broken examples in automatic/a-masterclass-22-12.txt
Found broken examples in automatic/performance-optimization.txt
Found broken examples in automatic/a-trieste-6.txt
Found broken examples in automatic/munster.txt
Found broken examples in automatic/ANN.tmp
Found broken examples in automatic/EDS.tmp
Found broken examples in automatic/EMMI.tmp
Found broken examples in automatic/ENVIRONMENTSIMILARITY.tmp
Found broken examples in automatic/FOURIER_TRANSFORM.tmp
Found broken examples in automatic/FUNCPATHGENERAL.tmp
Found broken examples in automatic/FUNCPATHMSD.tmp
Found broken examples in automatic/FUNNEL.tmp
Found broken examples in automatic/FUNNEL_PS.tmp
Found broken examples in automatic/GHBFIX.tmp
Found broken examples in automatic/INCLUDE.tmp
Found broken examples in automatic/MAZE_OPTIMIZER_BIAS.tmp
Found broken examples in automatic/MAZE_RANDOM_ACCELERATION_MD.tmp
Found broken examples in automatic/MAZE_SIMULATED_ANNEALING.tmp
Found broken examples in automatic/MAZE_STEERED_MD.tmp
Found broken examples in automatic/PIV.tmp
Found broken examples in automatic/PLUMED.tmp
Found broken examples in MiscelaneousPP.md

Please sign in to comment.