Skip to content

Commit

Permalink
Merge branch 'v2.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanniBussi committed Jul 24, 2024
2 parents a24a72a + 89b46b8 commit 95e959f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES/v2.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ Changes from version 2.8 which are relevant for users:
## Version 2.9.2 (tba)
- Patch for GROMACS 2023 updated to the latest version
- new patch for GROMACS 2024
- Small optimization of \ref COORDINATION and related collective variables (\issue{1096}).

13 changes: 9 additions & 4 deletions src/colvar/CoordinationBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,21 @@ void CoordinationBase::calculate()
const unsigned nn=nl->size();
if(nt*stride*10>nn) nt=1;

const unsigned elementsPerRank = std::ceil(double(nn)/stride);
const unsigned int start= rank*elementsPerRank;
const unsigned int end = ((start + elementsPerRank)< nn)?(start + elementsPerRank): nn;

#pragma omp parallel num_threads(nt)
{
std::vector<Vector> omp_deriv(getPositions().size());
Tensor omp_virial;

#pragma omp for reduction(+:ncoord) nowait
for(unsigned int i=rank; i<nn; i+=stride) {
for(unsigned int i=start; i<end; ++i) {

Vector distance;
unsigned i0=nl->getClosePair(i).first;
unsigned i1=nl->getClosePair(i).second;
const unsigned i0=nl->getClosePair(i).first;
const unsigned i1=nl->getClosePair(i).second;

if(getAbsoluteIndex(i0)==getAbsoluteIndex(i1)) continue;

Expand Down Expand Up @@ -187,7 +191,8 @@ void CoordinationBase::calculate()
}
#pragma omp critical
if(nt>1) {
for(unsigned i=0; i<getPositions().size(); i++) deriv[i]+=omp_deriv[i];
for(unsigned i=0; i<getPositions().size(); i++)
deriv[i]+=omp_deriv[i];
virial+=omp_virial;
}
}
Expand Down

1 comment on commit 95e959f

@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/COORDINATIONNUMBER.tmp
Found broken examples in automatic/DFSCLUSTERING.tmp
Found broken examples in automatic/DISTANCE_FROM_CONTOUR.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/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/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_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.