Skip to content

Commit

Permalink
Fix of bug introduced after merge of master
Browse files Browse the repository at this point in the history
  • Loading branch information
Gareth Aneurin Tribello authored and Gareth Aneurin Tribello committed Jan 27, 2025
1 parent 80fa551 commit 975ccdd
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions src/tools/LinkCells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,28 @@ void LinkCells::buildCellLists( const std::vector<Vector>& pos, const std::vecto
// Create an orthorhombic box around the atomic positions that encompasses every atomic position if there are no pbc
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) {
Vector minp, maxp; minp = maxp = pos[0]; Tensor fake_box; fake_box.zero();
Vector minp, maxp;
minp = maxp = pos[0];
for(unsigned k=0; k<3; ++k) {
for(unsigned i=1; i<pos.size(); ++i) {
if( pos[i][k]>maxp[k] ) maxp[k] = pos[i][k];
if( pos[i][k]<minp[k] ) minp[k] = pos[i][k];
if( pos[i][k]>maxp[k] ) {
maxp[k] = pos[i][k];
}
if( pos[i][k]<minp[k] ) {
minp[k] = pos[i][k];
}
}
box[k][k] = link_cutoff*( 1 + std::ceil( (maxp[k] - minp[k])/link_cutoff ) );
origin[k] = ( minp[k] + maxp[k] ) / 2;
}
mypbc.setBox( fake_box ); nopbc=true;
nopbc=true;
// Setup the pbc object by copying it from action if the Pbc were set
} else {
auto determinant = box.determinant(); nopbc=false;
} else {
auto determinant = box.determinant();
nopbc=false;
plumed_assert(determinant > epsilon) <<"Cell lists cannot be built when passing a box with null volume. Volume is "<<determinant;
}
mypbc.setBox( box );

// Setup the lists
if( pos.size()!=allcells.size() ) {
Expand Down Expand Up @@ -194,12 +201,18 @@ void LinkCells::retrieveAtomsInCells( const unsigned& ncells_required,
}

std::array<unsigned,3> LinkCells::findMyCell( const Vector& pos ) const {
std::array<unsigned,3> celn; Vector mypos = pos;
if( nopbc ) mypos = pos - origin;
std::array<unsigned,3> celn;
Vector mypos = pos;
if( nopbc ) {
mypos = pos - origin;
}
Vector fpos=mypbc.realToScaled( pos );
for(unsigned j=0; j<3; ++j) {
if( nopbc ) celn[j] = std::floor( fpos[j] * ncells[j] );
else celn[j] = std::floor( ( Tools::pbc(fpos[j]) + 0.5 ) * ncells[j] );
if( nopbc ) {
celn[j] = std::floor( fpos[j] * ncells[j] );
} else {
celn[j] = std::floor( ( Tools::pbc(fpos[j]) + 0.5 ) * ncells[j] );
}
plumed_assert( celn[j]>=0 && celn[j]<ncells[j] ); // Check that atom is in box
}
return celn;
Expand Down

1 comment on commit 975ccdd

@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/ANGLES.tmp
Found broken examples in automatic/ANN.tmp
Found broken examples in automatic/CAVITY.tmp
Found broken examples in automatic/CLASSICAL_MDS.tmp
Found broken examples in automatic/CLUSTER_DIAMETER.tmp
Found broken examples in automatic/CLUSTER_DISTRIBUTION.tmp
Found broken examples in automatic/CLUSTER_PROPERTIES.tmp
Found broken examples in automatic/CONSTANT.tmp
Found broken examples in automatic/CONTACT_MATRIX.tmp
Found broken examples in automatic/CONTACT_MATRIX_PROPER.tmp
Found broken examples in automatic/CONVERT_TO_FES.tmp
Found broken examples in automatic/COORDINATIONNUMBER.tmp
Found broken examples in automatic/DFSCLUSTERING.tmp
Found broken examples in automatic/DISTANCE_FROM_CONTOUR.tmp
Found broken examples in automatic/DUMPCUBE.tmp
Found broken examples in automatic/DUMPGRID.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/FIND_CONTOUR.tmp
Found broken examples in automatic/FIND_CONTOUR_SURFACE.tmp
Found broken examples in automatic/FIND_SPHERICAL_CONTOUR.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/GPROPERTYMAP.tmp
Found broken examples in automatic/HBOND_MATRIX.tmp
Found broken examples in automatic/HISTOGRAM.tmp
Found broken examples in automatic/INCLUDE.tmp
Found broken examples in automatic/INCYLINDER.tmp
Found broken examples in automatic/INENVELOPE.tmp
Found broken examples in automatic/INTERPOLATE_GRID.tmp
Found broken examples in automatic/LOCAL_AVERAGE.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/METATENSOR.tmp
Found broken examples in automatic/MULTICOLVARDENS.tmp
Found broken examples in automatic/OUTPUT_CLUSTER.tmp
Found broken examples in automatic/PAMM.tmp
Found broken examples in automatic/PCA.tmp
Found broken examples in automatic/PCAVARS.tmp
Found broken examples in automatic/PIV.tmp
Found broken examples in automatic/PLUMED.tmp
Found broken examples in automatic/PYCVINTERFACE.tmp
Found broken examples in automatic/PYTHONFUNCTION.tmp
Found broken examples in automatic/Q3.tmp
Found broken examples in automatic/Q4.tmp
Found broken examples in automatic/Q6.tmp
Found broken examples in automatic/QUATERNION.tmp
Found broken examples in automatic/REWEIGHT_BIAS.tmp
Found broken examples in automatic/REWEIGHT_METAD.tmp
Found broken examples in automatic/SIZESHAPE_POSITION_LINEAR_PROJ.tmp
Found broken examples in automatic/SIZESHAPE_POSITION_MAHA_DIST.tmp
Found broken examples in automatic/SPRINT.tmp
Found broken examples in automatic/TETRAHEDRALPORE.tmp
Found broken examples in automatic/TORSIONS.tmp
Found broken examples in automatic/WHAM_HISTOGRAM.tmp
Found broken examples in automatic/WHAM_WEIGHTS.tmp
Found broken examples in AnalysisPP.md
Found broken examples in CollectiveVariablesPP.md
Found broken examples in MiscelaneousPP.md

Please sign in to comment.