Skip to content

Commit 5e562d7

Browse files
Gareth Aneurin TribelloGareth Aneurin Tribello
Gareth Aneurin Tribello
authored and
Gareth Aneurin Tribello
committed
Ran astyle
1 parent 5bc572d commit 5e562d7

7 files changed

+47
-47
lines changed

src/core/ActionWithMatrix.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const ActionWithMatrix* ActionWithMatrix::getFirstMatrixInChain() const {
9191

9292
void ActionWithMatrix::setupMatrixStore() {
9393
for(int i=0; i<getNumberOfComponents(); ++i) {
94-
Value* myval=getPntrToComponent(i);
94+
Value* myval=getPntrToComponent(i);
9595
if( myval->getRank()!=2 || myval->hasDerivatives() || !myval->valueIsStored() ) continue;
9696
myval->reshapeMatrixStore( getNumberOfColumns() );
9797
}

src/core/ActionWithVector.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ void ActionWithVector::runTask( const unsigned& current, MultiValue& myvals ) co
729729
for(unsigned i=0; i<getNumberOfComponents(); ++i) {
730730
const Value* myval = getConstPntrToComponent(i);
731731
if( am || myval->hasDerivatives() || !myval->valueIsStored() ) continue;
732-
Value* myv = const_cast<Value*>( myval );
732+
Value* myv = const_cast<Value*>( myval );
733733
if( getName()=="RMSD_VECTOR" && myv->getRank()==2 ) continue;
734734
myv->set( current, myvals.get( myval->getPositionInStream() ) );
735735
}

src/core/ActionWithVector.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class ActionWithVector:
139139
const ActionWithVector* getFirstActionInChain() const ;
140140
ActionWithVector* getFirstActionInChain();
141141
/// Get the list of tasks that are active
142-
virtual std::vector<unsigned>& getListOfActiveTasks( ActionWithVector* action );
142+
virtual std::vector<unsigned>& getListOfActiveTasks( ActionWithVector* action );
143143
/// This is overridden in ActionWithMatrix
144144
virtual void getAllActionLabelsInMatrixChain( std::vector<std::string>& matchain ) const {}
145145
/// Get the number of derivatives in the stream

src/crystdistrib/QuaternionBondProductMatrix.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ std::vector<unsigned>& QuaternionBondProductMatrix::getListOfActiveTasks( Action
128128
Value* myarg = getPntrToArgument(4); unsigned base=0;
129129
unsigned nrows = myarg->getShape()[0];
130130
for(unsigned i=0; i<nrows; ++i) {
131-
unsigned ncols = myarg->getRowLength(i);
132-
for(unsigned j=0; j<ncols; ++j) active_tasks.push_back(base+j);
133-
base += myarg->getNumberOfColumns();
131+
unsigned ncols = myarg->getRowLength(i);
132+
for(unsigned j=0; j<ncols; ++j) active_tasks.push_back(base+j);
133+
base += myarg->getNumberOfColumns();
134134
}
135135
return active_tasks;
136136
}
@@ -144,11 +144,11 @@ void QuaternionBondProductMatrix::performTask( const unsigned& taskno, MultiValu
144144
//[dit/dw1 dit/di1 dit/dj1 dit/dk1] etc, and dqt[1] is w.r.t the vector-turned-quaternion called bond
145145

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

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

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

333333
}
334334
}

src/function/Custom.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ void Custom::registerKeywords(Keywords& keys) {
274274

275275
void Custom::read( ActionWithArguments* action ) {
276276
// Read in the variables
277-
unsigned nargs = action->getNumberOfArguments(); ActionWithVector* av=dynamic_cast<ActionWithVector*>(action);
277+
unsigned nargs = action->getNumberOfArguments(); ActionWithVector* av=dynamic_cast<ActionWithVector*>(action);
278278
if( av && av->getNumberOfMasks()>0 ) nargs = nargs - av->getNumberOfMasks();
279279
std::vector<std::string> var; parseVector(action,"VAR",var); parse(action,"FUNC",func);
280280
if(var.size()==0) {

src/function/FunctionOfMatrix.h

+36-36
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ std::vector<unsigned> FunctionOfMatrix<T>::getValueShapeFromArguments() {
157157

158158
template <class T>
159159
unsigned FunctionOfMatrix<T>::getNumberOfDerivatives() {
160-
unsigned nder=0, argstart = myfunc.getArgStart();
160+
unsigned nder=0, argstart = myfunc.getArgStart();
161161
unsigned nargs = getNumberOfArguments(); if( getNumberOfMasks()>0 ) nargs = nargs - getNumberOfMasks();
162162
for(unsigned i=argstart; i<nargs; ++i) nder += getPntrToArgument(i)->getNumberOfStoredValues();
163163
return nder;
@@ -175,7 +175,7 @@ void FunctionOfMatrix<T>::prepare() {
175175
}
176176
for(unsigned i=0; i<getNumberOfComponents(); ++i) {
177177
Value* myval = getPntrToComponent(i);
178-
if( myval->getRank()==2 && (myval->getShape()[0]!=shape[0] || myval->getShape()[1]!=shape[1]) ) myval->setShape(shape);
178+
if( myval->getRank()==2 && (myval->getShape()[0]!=shape[0] || myval->getShape()[1]!=shape[1]) ) myval->setShape(shape);
179179
}
180180
ActionWithVector::prepare(); active_tasks.resize(0);
181181
}
@@ -184,7 +184,7 @@ template <class T>
184184
Value* FunctionOfMatrix<T>::getPntrToFirstMatrixArgument() const {
185185
unsigned argstart=myfunc.getArgStart();
186186
for(unsigned i=argstart; i<getNumberOfArguments(); ++i) {
187-
if( getPntrToArgument(i)->getRank()==2 ) return getPntrToArgument(i);
187+
if( getPntrToArgument(i)->getRank()==2 ) return getPntrToArgument(i);
188188
}
189189
plumed_merror("could not find matrix argument");
190190
return NULL;
@@ -195,29 +195,29 @@ std::vector<unsigned>& FunctionOfMatrix<T>::getListOfActiveTasks( ActionWithVect
195195
if( active_tasks.size()>0 ) return active_tasks;
196196

197197
Value* myarg = NULL;
198-
if( getNumberOfMasks()>0 ) myarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
198+
if( getNumberOfMasks()>0 ) myarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
199199
else myarg = getPntrToFirstMatrixArgument();
200200

201201
unsigned base=0; unsigned nrows = myarg->getShape()[0];
202202
for(unsigned i=0; i<nrows; ++i) {
203-
unsigned ncols = myarg->getRowLength(i);
204-
for(unsigned j=0; j<ncols; ++j) active_tasks.push_back(base+j);
205-
base += myarg->getNumberOfColumns();
203+
unsigned ncols = myarg->getRowLength(i);
204+
for(unsigned j=0; j<ncols; ++j) active_tasks.push_back(base+j);
205+
base += myarg->getNumberOfColumns();
206206
}
207207
if( getNumberOfMasks()>0 && doNotCalculateDerivatives() ) return active_tasks;
208208
// All the matrices input have to have the same sparsity pattern.
209-
// I can do everything I want to do with this limitation. If
209+
// I can do everything I want to do with this limitation. If
210210
// anyone wants to make this smarter in the future they can
211211
#ifndef DNDEBUG
212212
unsigned argstart=myfunc.getArgStart();
213213
for(unsigned k=argstart; k<getNumberOfArguments(); ++k) {
214-
if( getPntrToArgument(k)->getRank()!=2 ) continue ;
215-
for(unsigned i=0; i<nrows; ++i) {
216-
unsigned ncols = myarg->getRowLength(i);
217-
if( getNumberOfMasks()>0 && ncols==0 ) continue;
218-
plumed_massert( ncols==getPntrToArgument(k)->getRowLength(i), "failing in " + getLabel() );
219-
for(unsigned j=0; j<ncols; ++j) plumed_assert( myarg->getRowIndex(i,j)==getPntrToArgument(k)->getRowIndex(i,j) );
220-
}
214+
if( getPntrToArgument(k)->getRank()!=2 ) continue ;
215+
for(unsigned i=0; i<nrows; ++i) {
216+
unsigned ncols = myarg->getRowLength(i);
217+
if( getNumberOfMasks()>0 && ncols==0 ) continue;
218+
plumed_massert( ncols==getPntrToArgument(k)->getRowLength(i), "failing in " + getLabel() );
219+
for(unsigned j=0; j<ncols; ++j) plumed_assert( myarg->getRowIndex(i,j)==getPntrToArgument(k)->getRowIndex(i,j) );
220+
}
221221
}
222222
#endif
223223
return active_tasks;
@@ -230,23 +230,23 @@ void FunctionOfMatrix<T>::performTask( const unsigned& taskno, MultiValue& myval
230230

231231
// Retrieve the arguments
232232
if( getNumberOfMasks()>0 ) {
233-
Value* maskarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
234-
unsigned index1 = std::floor( taskno / maskarg->getNumberOfColumns() );
235-
unsigned index2 = taskno - index1*maskarg->getNumberOfColumns();
236-
unsigned tind2 = maskarg->getRowIndex( index1, index2 );
237-
unsigned maskncol = maskarg->getRowLength(index1);
238-
for(unsigned i=argstart; i<nargs; ++i) {
239-
if( getPntrToArgument(i)->getRank()==2 && getPntrToArgument(i)->getRowLength(index1)>maskncol ) args[i-argstart]=getPntrToArgument(i)->get( index1*getPntrToArgument(i)->getShape()[1] + tind2 );
240-
else if( getPntrToArgument(i)->getRank()==2 ) {
241-
plumed_dbg_assert( maskncol==getPntrToArgument(i)->getRowLength(index1) );
242-
args[i-argstart]=getPntrToArgument(i)->get( taskno, false );
243-
} else args[i-argstart] = getPntrToArgument(i)->get();
244-
}
233+
Value* maskarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
234+
unsigned index1 = std::floor( taskno / maskarg->getNumberOfColumns() );
235+
unsigned index2 = taskno - index1*maskarg->getNumberOfColumns();
236+
unsigned tind2 = maskarg->getRowIndex( index1, index2 );
237+
unsigned maskncol = maskarg->getRowLength(index1);
238+
for(unsigned i=argstart; i<nargs; ++i) {
239+
if( getPntrToArgument(i)->getRank()==2 && getPntrToArgument(i)->getRowLength(index1)>maskncol ) args[i-argstart]=getPntrToArgument(i)->get( index1*getPntrToArgument(i)->getShape()[1] + tind2 );
240+
else if( getPntrToArgument(i)->getRank()==2 ) {
241+
plumed_dbg_assert( maskncol==getPntrToArgument(i)->getRowLength(index1) );
242+
args[i-argstart]=getPntrToArgument(i)->get( taskno, false );
243+
} else args[i-argstart] = getPntrToArgument(i)->get();
244+
}
245245
} else {
246-
for(unsigned i=argstart; i<nargs; ++i) {
247-
if( getPntrToArgument(i)->getRank()==2 ) args[i-argstart]=getPntrToArgument(i)->get( taskno, false );
248-
else args[i-argstart] = getPntrToArgument(i)->get();
249-
}
246+
for(unsigned i=argstart; i<nargs; ++i) {
247+
if( getPntrToArgument(i)->getRank()==2 ) args[i-argstart]=getPntrToArgument(i)->get( taskno, false );
248+
else args[i-argstart] = getPntrToArgument(i)->get();
249+
}
250250
}
251251
// Calculate the function and its derivatives
252252
std::vector<double> vals( getNumberOfComponents() ); Matrix<double> derivatives( getNumberOfComponents(), nargs-argstart );
@@ -276,13 +276,13 @@ void FunctionOfMatrix<T>::performTask( const unsigned& taskno, MultiValue& myval
276276

277277
template <class T>
278278
void FunctionOfMatrix<T>::calculate() {
279-
Value* myarg = NULL;
280-
if( getNumberOfMasks()>0 ) myarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
281-
else myarg = getPntrToFirstMatrixArgument();
279+
Value* myarg = NULL;
280+
if( getNumberOfMasks()>0 ) myarg = getPntrToArgument(getNumberOfArguments()-getNumberOfMasks());
281+
else myarg = getPntrToFirstMatrixArgument();
282282
// Copy bookeeping arrays from input matrices to output matrices
283283
for(unsigned i=0; i<getNumberOfComponents(); ++i) {
284-
if( getPntrToComponent(i)->getRank()==2 ) getPntrToComponent(i)->copyBookeepingArrayFromArgument( myarg );
285-
else getPntrToComponent(i)->resizeDerivatives( getNumberOfDerivatives() );
284+
if( getPntrToComponent(i)->getRank()==2 ) getPntrToComponent(i)->copyBookeepingArrayFromArgument( myarg );
285+
else getPntrToComponent(i)->resizeDerivatives( getNumberOfDerivatives() );
286286
}
287287
runAllTasks();
288288
}

src/matrixtools/MatrixTimesVector.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ MatrixTimesVector::MatrixTimesVector(const ActionOptions&ao):
145145
}
146146

147147
unsigned MatrixTimesVector::getNumberOfDerivatives() {
148-
unsigned nderivatives=0;
148+
unsigned nderivatives=0;
149149
for(unsigned i=0; i<getNumberOfArguments(); ++i) nderivatives += getPntrToArgument(i)->getNumberOfStoredValues();
150150
return nderivatives;
151151
}

0 commit comments

Comments
 (0)