Skip to content

Commit

Permalink
Ran astyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Gareth Aneurin Tribello authored and Gareth Aneurin Tribello committed Aug 1, 2024
1 parent fd50ad4 commit 6492e55
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/colvar/RMSDVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void RMSDVector::gatherStoredValue( const unsigned& valindex, const unsigned& co
const unsigned& bufstart, std::vector<double>& buffer ) const {
if( getConstPntrToComponent(valindex)->getRank()==1 ) { ActionWithVector::gatherStoredValue( valindex, code, myvals, bufstart, buffer ); return; }
const std::vector<Vector>& direction( myvals.getConstFirstAtomDerivativeVector()[1] );
unsigned natoms = direction.size(); unsigned vindex = 3*code*natoms; Value* myval = const_cast<Value*>( getConstPntrToComponent(valindex) );
unsigned natoms = direction.size(); unsigned vindex = 3*code*natoms; Value* myval = const_cast<Value*>( getConstPntrToComponent(valindex) );
for(unsigned i=0; i<natoms; ++i) {
for(unsigned j=0; j<3; ++j ) myval->set(vindex + j*natoms + i, direction[i][j] );
}
Expand Down
16 changes: 8 additions & 8 deletions src/core/ActionWithMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ void ActionWithMatrix::updateAllNeighbourLists() {
void ActionWithMatrix::clearBookeepingBeforeTask( const unsigned& task_index ) const {
// Reset the bookeeping elements for storage
for(unsigned i=0; i<getNumberOfComponents(); ++i) {
Value* myval = const_cast<Value*>( getConstPntrToComponent(i) ); unsigned ncols = myval->getNumberOfColumns();
if( myval->getRank()!=2 || myval->hasDerivatives() || !myval->valueIsStored() || ncols>=myval->getShape()[1] ) continue;
myval->matrix_bookeeping[task_index*(1+ncols)]=0;
Value* myval = const_cast<Value*>( getConstPntrToComponent(i) ); unsigned ncols = myval->getNumberOfColumns();
if( myval->getRank()!=2 || myval->hasDerivatives() || !myval->valueIsStored() || ncols>=myval->getShape()[1] ) continue;
myval->matrix_bookeeping[task_index*(1+ncols)]=0;

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High

Multiplication result may overflow 'unsigned int' before it is converted to 'size_type'.
}
if( matrix_to_do_after ) matrix_to_do_after->clearBookeepingBeforeTask( task_index );
}
Expand Down Expand Up @@ -171,11 +171,11 @@ void ActionWithMatrix::runTask( const std::string& controller, const unsigned& c
}
double finalval = myvals.get( myval->getPositionInStream() );
if( fabs(finalval)>0 ) {
Value* myv = const_cast<Value*>( myval );
if( ncols<myval->getShape()[1] ) {
myv->set( current*ncols + myval->matrix_bookeeping[current*(1+ncols)], finalval );
myv->matrix_bookeeping[current*(1+ncols)]++; myv->matrix_bookeeping[current*(1+ncols)+myval->matrix_bookeeping[current*(1+ncols)]] = col_stash_index;
} else myv->set( current*myval->getShape()[1] + col_stash_index, finalval );
Value* myv = const_cast<Value*>( myval );
if( ncols<myval->getShape()[1] ) {
myv->set( current*ncols + myval->matrix_bookeeping[current*(1+ncols)], finalval );

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High

Multiplication result may overflow 'unsigned int' before it is converted to 'size_type'.
myv->matrix_bookeeping[current*(1+ncols)]++; myv->matrix_bookeeping[current*(1+ncols)+myval->matrix_bookeeping[current*(1+ncols)]] = col_stash_index;

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High

Multiplication result may overflow 'unsigned int' before it is converted to 'size_type'.

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High

Multiplication result may overflow 'unsigned int' before it is converted to 'size_type'.
} else myv->set( current*myval->getShape()[1] + col_stash_index, finalval );
}
}
}
Expand Down
46 changes: 23 additions & 23 deletions src/core/ActionWithVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,11 @@ bool ActionWithVector::doNotCalculateDerivatives() const {

void ActionWithVector::clearMatrixBookeeping() {
for(unsigned i=0; i<getNumberOfComponents(); ++i) {
Value* myval = getPntrToComponent(i); if( !myval->storedata ) continue;
if( myval->getRank()==2 && myval->getNumberOfColumns()<myval->getShape()[1] ) {
std::fill(myval->matrix_bookeeping.begin(), myval->matrix_bookeeping.end(), 0);
}
myval->set(0);
Value* myval = getPntrToComponent(i); if( !myval->storedata ) continue;
if( myval->getRank()==2 && myval->getNumberOfColumns()<myval->getShape()[1] ) {
std::fill(myval->matrix_bookeeping.begin(), myval->matrix_bookeeping.end(), 0);
}
myval->set(0);
}
}

Expand Down Expand Up @@ -533,19 +533,19 @@ void ActionWithVector::runAllTasks() {
}

// MPI Gather everything
if( !serial ) {
if( buffer.size()>0 ) comm.Sum( buffer );
gatherProcesses();
if( !serial ) {
if( buffer.size()>0 ) comm.Sum( buffer );
gatherProcesses();
}
finishComputations( buffer ); forwardPass=false;
}

void ActionWithVector::gatherProcesses() {
for(unsigned i=0; i<getNumberOfComponents(); ++i) {
Value* myval = getPntrToComponent(i);
if( myval->storedata && !myval->hasDeriv ) {
comm.Sum( myval->data ); if( myval->getRank()==2 && myval->getNumberOfColumns()<myval->getShape()[1] ) comm.Sum( myval->matrix_bookeeping );
}
Value* myval = getPntrToComponent(i);
if( myval->storedata && !myval->hasDeriv ) {
comm.Sum( myval->data ); if( myval->getRank()==2 && myval->getNumberOfColumns()<myval->getShape()[1] ) comm.Sum( myval->matrix_bookeeping );
}
}
if( action_to_do_after ) action_to_do_after->gatherProcesses();
}
Expand Down Expand Up @@ -595,9 +595,9 @@ void ActionWithVector::getNumberOfStreamedQuantities( const std::string& headstr
}

void ActionWithVector::getSizeOfBuffer( const unsigned& nactive_tasks, unsigned& bufsize ) {
for(int i=0; i<getNumberOfComponents(); ++i) {
getPntrToComponent(i)->bufstart=bufsize;
if( getPntrToComponent(i)->hasDerivatives() || getPntrToComponent(i)->getRank()==0 ) bufsize += getPntrToComponent(i)->data.size();
for(int i=0; i<getNumberOfComponents(); ++i) {
getPntrToComponent(i)->bufstart=bufsize;
if( getPntrToComponent(i)->hasDerivatives() || getPntrToComponent(i)->getRank()==0 ) bufsize += getPntrToComponent(i)->data.size();
}
if( action_to_do_after ) action_to_do_after->getSizeOfBuffer( nactive_tasks, bufsize );
}
Expand Down Expand Up @@ -640,9 +640,9 @@ bool ActionWithVector::getNumberOfStoredValues( Value* startat, unsigned& nvals,
void ActionWithVector::runTask( const unsigned& current, MultiValue& myvals ) const {
myvals.setTaskIndex(current); myvals.vector_call=true; performTask( current, myvals );
for(unsigned i=0; i<getNumberOfComponents(); ++i) {
const Value* myval = getConstPntrToComponent(i);
if( myval->getRank()!=1 || myval->hasDerivatives() || !myval->valueIsStored() ) continue;
Value* myv = const_cast<Value*>( myval ); myv->set( current, myvals.get( myval->getPositionInStream() ) );
const Value* myval = getConstPntrToComponent(i);
if( myval->getRank()!=1 || myval->hasDerivatives() || !myval->valueIsStored() ) continue;
Value* myv = const_cast<Value*>( myval ); myv->set( current, myvals.get( myval->getPositionInStream() ) );
}
if( action_to_do_after ) action_to_do_after->runTask( current, myvals );
}
Expand Down Expand Up @@ -672,7 +672,7 @@ void ActionWithVector::finishComputations( const std::vector<double>& buf ) {
// This gathers vectors and grids at the end of the calculation
unsigned bufstart = getPntrToComponent(i)->bufstart;
if( (getPntrToComponent(i)->getRank()>0 && getPntrToComponent(i)->hasDerivatives()) ) {
unsigned sz_v = getPntrToComponent(i)->data.size(); getPntrToComponent(i)->data.assign( getPntrToComponent(i)->data.size(), 0 );
unsigned sz_v = getPntrToComponent(i)->data.size(); getPntrToComponent(i)->data.assign( getPntrToComponent(i)->data.size(), 0 );
for(unsigned j=0; j<sz_v; ++j) {
plumed_dbg_assert( bufstart+j<buf.size() );
getPntrToComponent(i)->add( j, buf[bufstart+j] );
Expand Down Expand Up @@ -722,10 +722,10 @@ bool ActionWithVector::checkForForces() {
// Recover the number of derivatives we require (this should be equal to the number of forces)
unsigned nderiv=0; getNumberOfStreamedDerivatives( nderiv, NULL );
if( !action_to_do_after && arg_deriv_starts.size()>0 ) {
nderiv = 0;
for(unsigned i=0; i<getNumberOfArguments(); ++i) {
arg_deriv_starts[i] = nderiv; nderiv += getPntrToArgument(i)->getNumberOfStoredValues();
}
nderiv = 0;
for(unsigned i=0; i<getNumberOfArguments(); ++i) {
arg_deriv_starts[i] = nderiv; nderiv += getPntrToArgument(i)->getNumberOfStoredValues();
}
}
if( forcesForApply.size()!=nderiv ) forcesForApply.resize( nderiv );
// Clear force buffer
Expand Down
2 changes: 1 addition & 1 deletion src/matrixtools/Voronoi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void Voronoi::gatherStoredValue( const unsigned& valindex, const unsigned& code,
if( value<minmax ) { minmax = value; nv = i; }
}
Value* myval = const_cast<Value*>( getConstPntrToComponent(0) );
myval->set( code*arg0->getShape()[1] + nv, 1 );
myval->set( code*arg0->getShape()[1] + nv, 1 );
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/MultiValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void MultiValue::resize( const size_t& nvals, const size_t& nder, const size_t&
if( values.size()==nvals && nderivatives==nder && matrix_row_nderivatives.size()==nmat && nmatrix_cols==maxcol ) return;
values.resize(nvals); nderivatives=nder; derivatives.resize( nvals*nder );
hasderiv.resize(nvals*nder,false); nactive.resize(nvals); active_list.resize(nvals*nder);
nmatrix_cols=maxcol; matrix_force_stash.resize(nmat*nder,0);
nmatrix_cols=maxcol; matrix_force_stash.resize(nmat*nder,0);
matrix_row_nderivatives.resize(nmat,0); matrix_row_derivative_indices.resize(nmat); atLeastOneSet=false;
for(unsigned i=0; i<nmat; ++i) matrix_row_derivative_indices[i].resize( nder );
}
Expand Down

1 comment on commit 6492e55

@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.