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 15, 2024
1 parent 5bc572d commit 5e562d7
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/core/ActionWithMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const ActionWithMatrix* ActionWithMatrix::getFirstMatrixInChain() const {

void ActionWithMatrix::setupMatrixStore() {
for(int i=0; i<getNumberOfComponents(); ++i) {
Value* myval=getPntrToComponent(i);
Value* myval=getPntrToComponent(i);
if( myval->getRank()!=2 || myval->hasDerivatives() || !myval->valueIsStored() ) continue;
myval->reshapeMatrixStore( getNumberOfColumns() );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/ActionWithVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ void ActionWithVector::runTask( const unsigned& current, MultiValue& myvals ) co
for(unsigned i=0; i<getNumberOfComponents(); ++i) {
const Value* myval = getConstPntrToComponent(i);
if( am || myval->hasDerivatives() || !myval->valueIsStored() ) continue;
Value* myv = const_cast<Value*>( myval );
Value* myv = const_cast<Value*>( myval );
if( getName()=="RMSD_VECTOR" && myv->getRank()==2 ) continue;
myv->set( current, myvals.get( myval->getPositionInStream() ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/ActionWithVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class ActionWithVector:
const ActionWithVector* getFirstActionInChain() const ;
ActionWithVector* getFirstActionInChain();
/// Get the list of tasks that are active
virtual std::vector<unsigned>& getListOfActiveTasks( ActionWithVector* action );
virtual std::vector<unsigned>& getListOfActiveTasks( ActionWithVector* action );
/// This is overridden in ActionWithMatrix
virtual void getAllActionLabelsInMatrixChain( std::vector<std::string>& matchain ) const {}
/// Get the number of derivatives in the stream
Expand Down
12 changes: 6 additions & 6 deletions src/crystdistrib/QuaternionBondProductMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ std::vector<unsigned>& QuaternionBondProductMatrix::getListOfActiveTasks( Action
Value* myarg = getPntrToArgument(4); unsigned base=0;
unsigned nrows = myarg->getShape()[0];
for(unsigned i=0; i<nrows; ++i) {
unsigned ncols = myarg->getRowLength(i);
for(unsigned j=0; j<ncols; ++j) active_tasks.push_back(base+j);
base += myarg->getNumberOfColumns();
unsigned ncols = myarg->getRowLength(i);
for(unsigned j=0; j<ncols; ++j) active_tasks.push_back(base+j);
base += myarg->getNumberOfColumns();
}
return active_tasks;
}
Expand All @@ -144,11 +144,11 @@ void QuaternionBondProductMatrix::performTask( const unsigned& taskno, MultiValu
//[dit/dw1 dit/di1 dit/dj1 dit/dk1] etc, and dqt[1] is w.r.t the vector-turned-quaternion called bond

// Retrieve the quaternion
for(unsigned i=0; i<4; ++i) quat[i] = getPntrToArgument(i)->get(index1);
for(unsigned i=0; i<4; ++i) quat[i] = getPntrToArgument(i)->get(index1);

// Retrieve the components of the matrix
double weight = getPntrToArgument(4)->get(taskno, false );
for(unsigned i=1; i<4; ++i) bond[i] = getPntrToArgument(4+i)->get(taskno, false );
for(unsigned i=1; i<4; ++i) bond[i] = getPntrToArgument(4+i)->get(taskno, false );

// calculate normalization factor
bond[0]=0.0;
Expand Down Expand Up @@ -328,7 +328,7 @@ void QuaternionBondProductMatrix::calculate() {
// Copy bookeeping arrays from input matrices to output matrices
for(unsigned i=0; i<4; ++i) getPntrToComponent(i)->copyBookeepingArrayFromArgument( getPntrToArgument(4+i) );
runAllTasks();
}
}

}
}
2 changes: 1 addition & 1 deletion src/function/Custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void Custom::registerKeywords(Keywords& keys) {

void Custom::read( ActionWithArguments* action ) {
// Read in the variables
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();
std::vector<std::string> var; parseVector(action,"VAR",var); parse(action,"FUNC",func);
if(var.size()==0) {
Expand Down
72 changes: 36 additions & 36 deletions src/function/FunctionOfMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ std::vector<unsigned> FunctionOfMatrix<T>::getValueShapeFromArguments() {

template <class T>
unsigned FunctionOfMatrix<T>::getNumberOfDerivatives() {
unsigned nder=0, argstart = myfunc.getArgStart();
unsigned nder=0, argstart = myfunc.getArgStart();
unsigned nargs = getNumberOfArguments(); if( getNumberOfMasks()>0 ) nargs = nargs - getNumberOfMasks();
for(unsigned i=argstart; i<nargs; ++i) nder += getPntrToArgument(i)->getNumberOfStoredValues();
return nder;
Expand All @@ -175,7 +175,7 @@ void FunctionOfMatrix<T>::prepare() {
}
for(unsigned i=0; i<getNumberOfComponents(); ++i) {
Value* myval = getPntrToComponent(i);
if( myval->getRank()==2 && (myval->getShape()[0]!=shape[0] || myval->getShape()[1]!=shape[1]) ) myval->setShape(shape);
if( myval->getRank()==2 && (myval->getShape()[0]!=shape[0] || myval->getShape()[1]!=shape[1]) ) myval->setShape(shape);
}
ActionWithVector::prepare(); active_tasks.resize(0);
}
Expand All @@ -184,7 +184,7 @@ template <class T>
Value* FunctionOfMatrix<T>::getPntrToFirstMatrixArgument() const {
unsigned argstart=myfunc.getArgStart();
for(unsigned i=argstart; i<getNumberOfArguments(); ++i) {
if( getPntrToArgument(i)->getRank()==2 ) return getPntrToArgument(i);
if( getPntrToArgument(i)->getRank()==2 ) return getPntrToArgument(i);
}
plumed_merror("could not find matrix argument");
return NULL;
Expand All @@ -195,29 +195,29 @@ std::vector<unsigned>& FunctionOfMatrix<T>::getListOfActiveTasks( ActionWithVect
if( active_tasks.size()>0 ) return active_tasks;

Value* myarg = NULL;
if( getNumberOfMasks()>0 ) myarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
if( getNumberOfMasks()>0 ) myarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
else myarg = getPntrToFirstMatrixArgument();

unsigned base=0; unsigned nrows = myarg->getShape()[0];
for(unsigned i=0; i<nrows; ++i) {
unsigned ncols = myarg->getRowLength(i);
for(unsigned j=0; j<ncols; ++j) active_tasks.push_back(base+j);
base += myarg->getNumberOfColumns();
unsigned ncols = myarg->getRowLength(i);
for(unsigned j=0; j<ncols; ++j) active_tasks.push_back(base+j);
base += myarg->getNumberOfColumns();
}
if( getNumberOfMasks()>0 && doNotCalculateDerivatives() ) return active_tasks;
// All the matrices input have to have the same sparsity pattern.
// I can do everything I want to do with this limitation. If
// I can do everything I want to do with this limitation. If
// anyone wants to make this smarter in the future they can
#ifndef DNDEBUG
unsigned argstart=myfunc.getArgStart();
for(unsigned k=argstart; k<getNumberOfArguments(); ++k) {
if( getPntrToArgument(k)->getRank()!=2 ) continue ;
for(unsigned i=0; i<nrows; ++i) {
unsigned ncols = myarg->getRowLength(i);
if( getNumberOfMasks()>0 && ncols==0 ) continue;
plumed_massert( ncols==getPntrToArgument(k)->getRowLength(i), "failing in " + getLabel() );
for(unsigned j=0; j<ncols; ++j) plumed_assert( myarg->getRowIndex(i,j)==getPntrToArgument(k)->getRowIndex(i,j) );
}
if( getPntrToArgument(k)->getRank()!=2 ) continue ;
for(unsigned i=0; i<nrows; ++i) {
unsigned ncols = myarg->getRowLength(i);
if( getNumberOfMasks()>0 && ncols==0 ) continue;
plumed_massert( ncols==getPntrToArgument(k)->getRowLength(i), "failing in " + getLabel() );
for(unsigned j=0; j<ncols; ++j) plumed_assert( myarg->getRowIndex(i,j)==getPntrToArgument(k)->getRowIndex(i,j) );
}
}
#endif
return active_tasks;
Expand All @@ -230,23 +230,23 @@ void FunctionOfMatrix<T>::performTask( const unsigned& taskno, MultiValue& myval

// Retrieve the arguments
if( getNumberOfMasks()>0 ) {
Value* maskarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
unsigned index1 = std::floor( taskno / maskarg->getNumberOfColumns() );
unsigned index2 = taskno - index1*maskarg->getNumberOfColumns();
unsigned tind2 = maskarg->getRowIndex( index1, index2 );
unsigned maskncol = maskarg->getRowLength(index1);
for(unsigned i=argstart; i<nargs; ++i) {
if( getPntrToArgument(i)->getRank()==2 && getPntrToArgument(i)->getRowLength(index1)>maskncol ) args[i-argstart]=getPntrToArgument(i)->get( index1*getPntrToArgument(i)->getShape()[1] + tind2 );
else if( getPntrToArgument(i)->getRank()==2 ) {
plumed_dbg_assert( maskncol==getPntrToArgument(i)->getRowLength(index1) );
args[i-argstart]=getPntrToArgument(i)->get( taskno, false );
} else args[i-argstart] = getPntrToArgument(i)->get();
}
Value* maskarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
unsigned index1 = std::floor( taskno / maskarg->getNumberOfColumns() );
unsigned index2 = taskno - index1*maskarg->getNumberOfColumns();
unsigned tind2 = maskarg->getRowIndex( index1, index2 );
unsigned maskncol = maskarg->getRowLength(index1);
for(unsigned i=argstart; i<nargs; ++i) {
if( getPntrToArgument(i)->getRank()==2 && getPntrToArgument(i)->getRowLength(index1)>maskncol ) args[i-argstart]=getPntrToArgument(i)->get( index1*getPntrToArgument(i)->getShape()[1] + tind2 );
else if( getPntrToArgument(i)->getRank()==2 ) {
plumed_dbg_assert( maskncol==getPntrToArgument(i)->getRowLength(index1) );
args[i-argstart]=getPntrToArgument(i)->get( taskno, false );
} else args[i-argstart] = getPntrToArgument(i)->get();
}
} else {
for(unsigned i=argstart; i<nargs; ++i) {
if( getPntrToArgument(i)->getRank()==2 ) args[i-argstart]=getPntrToArgument(i)->get( taskno, false );
else args[i-argstart] = getPntrToArgument(i)->get();
}
for(unsigned i=argstart; i<nargs; ++i) {
if( getPntrToArgument(i)->getRank()==2 ) args[i-argstart]=getPntrToArgument(i)->get( taskno, false );
else args[i-argstart] = getPntrToArgument(i)->get();
}
}
// Calculate the function and its derivatives
std::vector<double> vals( getNumberOfComponents() ); Matrix<double> derivatives( getNumberOfComponents(), nargs-argstart );
Expand Down Expand Up @@ -276,13 +276,13 @@ void FunctionOfMatrix<T>::performTask( const unsigned& taskno, MultiValue& myval

template <class T>
void FunctionOfMatrix<T>::calculate() {
Value* myarg = NULL;
if( getNumberOfMasks()>0 ) myarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
else myarg = getPntrToFirstMatrixArgument();
Value* myarg = NULL;
if( getNumberOfMasks()>0 ) myarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
else myarg = getPntrToFirstMatrixArgument();
// Copy bookeeping arrays from input matrices to output matrices
for(unsigned i=0; i<getNumberOfComponents(); ++i) {
if( getPntrToComponent(i)->getRank()==2 ) getPntrToComponent(i)->copyBookeepingArrayFromArgument( myarg );
else getPntrToComponent(i)->resizeDerivatives( getNumberOfDerivatives() );
if( getPntrToComponent(i)->getRank()==2 ) getPntrToComponent(i)->copyBookeepingArrayFromArgument( myarg );
else getPntrToComponent(i)->resizeDerivatives( getNumberOfDerivatives() );
}
runAllTasks();
}
Expand Down
2 changes: 1 addition & 1 deletion src/matrixtools/MatrixTimesVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ MatrixTimesVector::MatrixTimesVector(const ActionOptions&ao):
}

unsigned MatrixTimesVector::getNumberOfDerivatives() {
unsigned nderivatives=0;
unsigned nderivatives=0;
for(unsigned i=0; i<getNumberOfArguments(); ++i) nderivatives += getPntrToArgument(i)->getNumberOfStoredValues();
return nderivatives;
}
Expand Down

1 comment on commit 5e562d7

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