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 Sep 8, 2024
1 parent 85bd330 commit 14c8511
Show file tree
Hide file tree
Showing 10 changed files with 175 additions and 175 deletions.
2 changes: 1 addition & 1 deletion src/cltools/ShowGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ int ShowGraph::main(FILE* in, FILE*out,Communicator& pc) {
ActionWithVector* avv=dynamic_cast<ActionWithVector*>(a);
ActionWithArguments* aaa=dynamic_cast<ActionWithArguments*>(a);
if( avv ) {
for(const auto & v : aaa->getArguments() ) v->addForce();
for(const auto & v : aaa->getArguments() ) v->addForce();
} else a->apply();
bool hasforce=false;
for(int i=0; i<av->getNumberOfComponents(); ++i) {
Expand Down
68 changes: 34 additions & 34 deletions src/core/ActionWithVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ActionWithVector::ActionWithVector(const ActionOptions&ao):
if( av->getPntrToArgument(i)!=mask[j] ) error("the masks in subsequent actions do not match");
j++;
}
}
}
if( getNumberOfArguments()>0 && getPntrToArgument(0)->hasDerivatives() ) error("input for mask should be vector or matrix");
else if( mask[0]->getRank()==2 ) {
if( mask.size()>1 ) error("MASK should only have one argument");
Expand Down Expand Up @@ -438,38 +438,38 @@ void ActionWithVector::prepare() {
int ActionWithVector::checkTaskIsActive( const unsigned& itask ) const {
unsigned nargs = getNumberOfArguments();
if( nargs==0 ) {
return 1;
return 1;
} else if( nmask>0 ) {
for(unsigned j=nargs-nmask; j<nargs; ++j) {
Value* myarg = getPntrToArgument(j);
if( myarg->getRank()==1 && !myarg->hasDerivatives() ) {
if( fabs(myarg->get(itask))>0 ) return 1;
} else if( myarg->getRank()==2 && !myarg->hasDerivatives() ) {
unsigned ncol = myarg->getRowLength(itask);
unsigned base = itask*myarg->getNumberOfColumns();
for(unsigned k=0; k<ncol; ++k) {
if( fabs(myarg->get(base+k,false))>0 ) return 1;
}
} else plumed_merror("only matrices and vectors should be used as masks");
}
for(unsigned j=nargs-nmask; j<nargs; ++j) {
Value* myarg = getPntrToArgument(j);
if( myarg->getRank()==1 && !myarg->hasDerivatives() ) {
if( fabs(myarg->get(itask))>0 ) return 1;
} else if( myarg->getRank()==2 && !myarg->hasDerivatives() ) {
unsigned ncol = myarg->getRowLength(itask);
unsigned base = itask*myarg->getNumberOfColumns();
for(unsigned k=0; k<ncol; ++k) {
if( fabs(myarg->get(base+k,false))>0 ) return 1;
}
} else plumed_merror("only matrices and vectors should be used as masks");
}
} else {
for(unsigned i=0; i<nargs; ++i) {
if( getName()=="OUTER_PRODUCT" && i>0 ) return -1;

Value* myarg = getPntrToArgument(i);
if( myarg->getRank()==0 ) continue;
else if( myarg->getRank()==1 && !myarg->hasDerivatives() ) {
if( fabs(myarg->get(itask))>0 ) return 1;
} else if( myarg->getRank()==2 && !myarg->hasDerivatives() ) {
unsigned ncol = myarg->getRowLength(itask);
unsigned base = itask*myarg->getNumberOfColumns();
for(unsigned k=0; k<ncol; ++k) {
if( fabs(myarg->get(base+k,false))>0 ) return 1;
}
} else if( myarg->getRank()>0 ) {
return 1;
} else plumed_merror("should not be in action " + getName() );
}
for(unsigned i=0; i<nargs; ++i) {
if( getName()=="OUTER_PRODUCT" && i>0 ) return -1;

Value* myarg = getPntrToArgument(i);
if( myarg->getRank()==0 ) continue;
else if( myarg->getRank()==1 && !myarg->hasDerivatives() ) {
if( fabs(myarg->get(itask))>0 ) return 1;
} else if( myarg->getRank()==2 && !myarg->hasDerivatives() ) {
unsigned ncol = myarg->getRowLength(itask);
unsigned base = itask*myarg->getNumberOfColumns();
for(unsigned k=0; k<ncol; ++k) {
if( fabs(myarg->get(base+k,false))>0 ) return 1;
}
} else if( myarg->getRank()>0 ) {
return 1;
} else plumed_merror("should not be in action " + getName() );
}
}
return -1;
}
Expand Down Expand Up @@ -798,10 +798,10 @@ bool ActionWithVector::checkForForces() {
// Get the number of tasks
std::vector<unsigned> force_tasks;
if( getenvChainForbidden()==Option::yes ) {
std::vector<unsigned> & partialTaskList( getListOfActiveTasks( this ) );
for(unsigned i=0; i<partialTaskList.size(); ++i) force_tasks.push_back( partialTaskList[i] );
std::vector<unsigned> & partialTaskList( getListOfActiveTasks( this ) );
for(unsigned i=0; i<partialTaskList.size(); ++i) force_tasks.push_back( partialTaskList[i] );
} else {
getForceTasks( force_tasks ); Tools::removeDuplicates(force_tasks);
getForceTasks( force_tasks ); Tools::removeDuplicates(force_tasks);
}
unsigned nf_tasks=force_tasks.size();
if( nf_tasks==0 ) return false;
Expand Down
40 changes: 20 additions & 20 deletions src/crystdistrib/QuaternionBondProductMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,28 +370,28 @@ void QuaternionBondProductMatrix::runEndOfRowJobs( const unsigned& ival, const s
for(unsigned k=0; k<4; ++k) { matrix_indices[nmat_ind] = arg_deriv_starts[k] + ival; nmat_ind++; }

if( actionInChain() ) {
// Loop over row of matrix
for(unsigned n=4; n<8; ++n) {
bool found=false;
for(unsigned k=4; k<n; ++k) {
if( arg_deriv_starts[k]==arg_deriv_starts[n] ) { found=true; break; }
}
if( found ) continue;
unsigned istrn = getPntrToArgument(n)->getPositionInMatrixStash();
std::vector<unsigned>& imat_indices( myvals.getMatrixRowDerivativeIndices( istrn ) );
for(unsigned k=0; k<myvals.getNumberOfMatrixRowDerivatives( istrn ); ++k) matrix_indices[nmat_ind + k] = arg_deriv_starts[n] + imat_indices[k];
nmat_ind += myvals.getNumberOfMatrixRowDerivatives( getPntrToArgument(4)->getPositionInMatrixStash() );
// Loop over row of matrix
for(unsigned n=4; n<8; ++n) {
bool found=false;
for(unsigned k=4; k<n; ++k) {
if( arg_deriv_starts[k]==arg_deriv_starts[n] ) { found=true; break; }
}
if( found ) continue;
unsigned istrn = getPntrToArgument(n)->getPositionInMatrixStash();
std::vector<unsigned>& imat_indices( myvals.getMatrixRowDerivativeIndices( istrn ) );
for(unsigned k=0; k<myvals.getNumberOfMatrixRowDerivatives( istrn ); ++k) matrix_indices[nmat_ind + k] = arg_deriv_starts[n] + imat_indices[k];
nmat_ind += myvals.getNumberOfMatrixRowDerivatives( getPntrToArgument(4)->getPositionInMatrixStash() );
}
} else {
unsigned base=0; for(unsigned k=0; k<4; ++k) base += getPntrToArgument(k)->getNumberOfStoredValues();
for(unsigned n=4; n<8; ++n) {
unsigned coltot = ival*getPntrToArgument(n)->getNumberOfColumns();
for(unsigned k=1; k<indices.size(); ++k) {
unsigned ind2=indices[k]; if( ind2>=getPntrToArgument(0)->getShape()[0] ) ind2 = ind2 - getPntrToArgument(0)->getShape()[0];
matrix_indices[nmat_ind] = base + coltot + ind2; nmat_ind++;
}
base += getPntrToArgument(n)->getNumberOfStoredValues();
}
unsigned base=0; for(unsigned k=0; k<4; ++k) base += getPntrToArgument(k)->getNumberOfStoredValues();
for(unsigned n=4; n<8; ++n) {
unsigned coltot = ival*getPntrToArgument(n)->getNumberOfColumns();
for(unsigned k=1; k<indices.size(); ++k) {
unsigned ind2=indices[k]; if( ind2>=getPntrToArgument(0)->getShape()[0] ) ind2 = ind2 - getPntrToArgument(0)->getShape()[0];
matrix_indices[nmat_ind] = base + coltot + ind2; nmat_ind++;
}
base += getPntrToArgument(n)->getNumberOfStoredValues();
}
}
myvals.setNumberOfMatrixRowDerivatives( nmat, nmat_ind );
}
Expand Down
2 changes: 1 addition & 1 deletion src/function/Combine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void Combine::registerKeywords(Keywords& keys) {
}

void Combine::read( ActionWithArguments* action ) {
unsigned nargs = action->getNumberOfArguments(); ActionWithVector* av=dynamic_cast<ActionWithVector*>(action);
unsigned nargs = action->getNumberOfArguments(); ActionWithVector* av=dynamic_cast<ActionWithVector*>(action);
if(av && av->getNumberOfMasks()>0) nargs = nargs - av->getNumberOfMasks();
coefficients.resize( nargs ); parameters.resize( nargs ); powers.resize( nargs );
parseVector(action,"COEFFICIENTS",coefficients);
Expand Down
24 changes: 12 additions & 12 deletions src/function/FunctionOfMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ template <class T>
void FunctionOfMatrix<T>::setupForTask( const unsigned& task_index, std::vector<unsigned>& indices, MultiValue& myvals ) const {
unsigned basemat;
for(unsigned i=0; i<getNumberOfArguments(); ++i) {
if( getPntrToArgument(i)->getRank()==2 ) { basemat=i; break; }
if( getPntrToArgument(i)->getRank()==2 ) { basemat=i; break; }
}
unsigned start_n = getPntrToArgument(basemat)->getShape()[0], size_v = getPntrToArgument(basemat)->getShape()[1];
if( getNumberOfMasks()>0 ) {
Expand All @@ -241,16 +241,16 @@ void FunctionOfMatrix<T>::setupForTask( const unsigned& task_index, std::vector<
if( indices.size()!=size_v+1 ) indices.resize( size_v+1 );
for(unsigned i=0; i<size_v; ++i) indices[i+1] = start_n + getPntrToArgument(maskarg)->getRowIndex(task_index, i);
myvals.setSplitIndex( size_v + 1 ); return;
}
}
unsigned maskarg=0; size_v = size_v+1;
for(unsigned i=0; i<getNumberOfArguments(); ++i) {
if( getPntrToArgument(i)->getRank()!=2 ) continue ;
unsigned ss = getPntrToArgument(i)->getRowLength(task_index);
if( ss<size_v ) { maskarg=i; size_v = ss; }
if( getPntrToArgument(i)->getRank()!=2 ) continue ;
unsigned ss = getPntrToArgument(i)->getRowLength(task_index);
if( ss<size_v ) { maskarg=i; size_v = ss; }
}
if( indices.size()!=size_v+1 ) indices.resize( size_v+1 );
for(unsigned i=0; i<size_v; ++i) indices[i+1] = start_n + getPntrToArgument(maskarg)->getRowIndex(task_index, i);
myvals.setSplitIndex( size_v + 1 );
myvals.setSplitIndex( size_v + 1 );
}

template <class T>
Expand Down Expand Up @@ -343,7 +343,7 @@ void FunctionOfMatrix<T>::performTask( const std::string& controller, const unsi
if( getPntrToArgument(j)->getRank()==2 ) {
for(int i=0; i<getNumberOfComponents(); ++i) {
unsigned ostrn=getConstPntrToComponent(i)->getPositionInStream();
unsigned myind = base + getPntrToArgument(j)->getIndexInStore( index1*getPntrToArgument(j)->getShape()[1] + ind2 );
unsigned myind = base + getPntrToArgument(j)->getIndexInStore( index1*getPntrToArgument(j)->getShape()[1] + ind2 );
myvals.addDerivative( ostrn, myind, derivatives(i,j) );
myvals.updateIndex( ostrn, myind );
}
Expand Down Expand Up @@ -419,13 +419,13 @@ void FunctionOfMatrix<T>::runEndOfRowJobs( const unsigned& ind, const std::vecto
if( mat_indices.size()<nderivatives ) mat_indices.resize( nderivatives ); unsigned matderbase = 0;
for(unsigned i=argstart; i<getNumberOfArguments(); ++i) {
if( getPntrToArgument(i)->getRank()==0 ) {
mat_indices[ntot_mat] = matderbase; ntot_mat++;
mat_indices[ntot_mat] = matderbase; ntot_mat++;
} else {
unsigned ss = getPntrToArgument(i)->getRowLength(ind); unsigned tbase = matderbase + getPntrToArgument(i)->getNumberOfColumns()*myvals.getTaskIndex();
for(unsigned k=0; k<ss; ++k) mat_indices[ntot_mat + k] = tbase + k;
ntot_mat += ss;
unsigned ss = getPntrToArgument(i)->getRowLength(ind); unsigned tbase = matderbase + getPntrToArgument(i)->getNumberOfColumns()*myvals.getTaskIndex();
for(unsigned k=0; k<ss; ++k) mat_indices[ntot_mat + k] = tbase + k;
ntot_mat += ss;
}
matderbase += getPntrToArgument(i)->getNumberOfStoredValues();
matderbase += getPntrToArgument(i)->getNumberOfStoredValues();
}
myvals.setNumberOfMatrixRowDerivatives( nmat, ntot_mat );
}
Expand Down
8 changes: 4 additions & 4 deletions src/gridtools/KDE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,11 @@ int KDE::checkTaskIsActive( const unsigned& itask ) const {
if( hasheight && getPntrToArgument(gridobject.getDimension())->getRank()>0
&& fabs(getPntrToArgument(gridobject.getDimension())->get(itask))<epsilon ) return -1;
return 1;
}
}
for(unsigned i=0; i<num_neigh; ++i) {
if( itask==neighbors[i] ) return 1;
}
return -1;
if( itask==neighbors[i] ) return 1;
}
return -1;
}

int KDE::checkTaskStatus( const unsigned& taskno, int& flag ) const {
Expand Down
Loading

1 comment on commit 14c8511

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