Skip to content

Commit

Permalink
Merge pull request #1179 from Iximiel/v2.9-astyle
Browse files Browse the repository at this point in the history
Proposing: removing lines with more than one statements. for 2.9
  • Loading branch information
carlocamilloni authored Jan 17, 2025
2 parents 017b9ef + 6062dd6 commit c86000e
Show file tree
Hide file tree
Showing 567 changed files with 26,864 additions and 13,058 deletions.
14 changes: 13 additions & 1 deletion .astyle.options
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
-n --indent=spaces=2 --keep-one-line-statements --keep-one-line-blocks
# long options can be written without the preceding '--'
suffix=none #equivalent to "-n"
style=attach
add-braces
indent=spaces=2
break-one-line-headers

# old options
#suffix=none
#indent=spaces=2
#keep-one-line-statements
#keep-one-line-blocks
# end old options
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# .git-blame-ignore-revs
# https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
# new astyle applied to v2.9.3
2cd41d16623b7a062b2a716eaf5c91a741cc19ea
66 changes: 47 additions & 19 deletions src/adjmat/ActionWithInputMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,38 @@ void ActionWithInputMatrix::registerKeywords( Keywords& keys ) {
ActionWithInputMatrix::ActionWithInputMatrix(const ActionOptions& ao):
Action(ao),
MultiColvarBase(ao),
mymatrix(NULL)
{
mymatrix(NULL) {
matsums=true;
if( keywords.exists("MATRIX") ) {
std::vector<AtomNumber> fake_atoms;
if( !parseMultiColvarAtomList("MATRIX",-1,fake_atoms ) ) error("unable to interpret input matrix");
if( mybasemulticolvars.size()!=1 ) error("should be exactly one matrix input");
if( !parseMultiColvarAtomList("MATRIX",-1,fake_atoms ) ) {
error("unable to interpret input matrix");
}
if( mybasemulticolvars.size()!=1 ) {
error("should be exactly one matrix input");
}

// Retrieve the adjacency matrix of interest
for(unsigned i=0; i<mybasemulticolvars[0]->getNumberOfVessels(); ++i) {
mymatrix = dynamic_cast<AdjacencyMatrixVessel*>( mybasemulticolvars[0]->getPntrToVessel(i) );
if( mymatrix ) break ;
if( mymatrix ) {
break ;
}
}
if( !mymatrix ) {
error( mybasemulticolvars[0]->getLabel() + " does not calculate an adjacency matrix");
}
if( !mymatrix ) error( mybasemulticolvars[0]->getLabel() + " does not calculate an adjacency matrix");

atom_lab.resize(0); unsigned nnodes; // Delete all the atom labels that have been created
if( mymatrix->undirectedGraph() ) nnodes = (mymatrix->function)->ablocks[0].size();
else nnodes = (mymatrix->function)->ablocks[0].size() + (mymatrix->function)->ablocks[1].size();
for(unsigned i=0; i<nnodes; ++i) atom_lab.push_back( std::pair<unsigned,unsigned>( 1, i ) );
atom_lab.resize(0);
unsigned nnodes; // Delete all the atom labels that have been created
if( mymatrix->undirectedGraph() ) {
nnodes = (mymatrix->function)->ablocks[0].size();
} else {
nnodes = (mymatrix->function)->ablocks[0].size() + (mymatrix->function)->ablocks[1].size();
}
for(unsigned i=0; i<nnodes; ++i) {
atom_lab.push_back( std::pair<unsigned,unsigned>( 1, i ) );
}
}
}

Expand All @@ -77,7 +90,9 @@ AtomNumber ActionWithInputMatrix::getAbsoluteIndexOfCentralAtom(const unsigned&
}

double ActionWithInputMatrix::retrieveConnectionValue( const unsigned& i, const unsigned& j, std::vector<double>& vals ) const {
if( !mymatrix->matrixElementIsActive( i, j ) ) return 0;
if( !mymatrix->matrixElementIsActive( i, j ) ) {
return 0;
}
unsigned myelem = mymatrix->getStoreIndexFromMatrixIndices( i, j );

// unsigned vi; double df;
Expand All @@ -87,18 +102,24 @@ double ActionWithInputMatrix::retrieveConnectionValue( const unsigned& i, const

void ActionWithInputMatrix::getInputData( const unsigned& ind, const bool& normed, const multicolvar::AtomValuePack& myatoms, std::vector<double>& orient0 ) const {
if( (mymatrix->function)->mybasemulticolvars.size()==0 ) {
std::vector<double> tvals( mymatrix->getNumberOfComponents() ); orient0.assign(orient0.size(),0);
std::vector<double> tvals( mymatrix->getNumberOfComponents() );
orient0.assign(orient0.size(),0);
for(unsigned i=0; i<mymatrix->getNumberOfColumns(); ++i) {
if( mymatrix->undirectedGraph() && ind==i ) continue;
if( mymatrix->undirectedGraph() && ind==i ) {
continue;
}
orient0[1]+=retrieveConnectionValue( ind, i, tvals );
}
orient0[0]=1.0; return;
orient0[0]=1.0;
return;
}
(mymatrix->function)->getInputData( ind, normed, myatoms, orient0 );
}

void ActionWithInputMatrix::addConnectionDerivatives( const unsigned& i, const unsigned& j, MultiValue& myvals, MultiValue& myvout ) const {
if( !mymatrix->matrixElementIsActive( i, j ) ) return;
if( !mymatrix->matrixElementIsActive( i, j ) ) {
return;
}
unsigned myelem = mymatrix->getStoreIndexFromMatrixIndices( i, j );
// Get derivatives and add
mymatrix->retrieveDerivatives( myelem, false, myvals );
Expand All @@ -117,22 +138,29 @@ MultiValue& ActionWithInputMatrix::getInputDerivatives( const unsigned& ind, con
myder.clearAll();
MultiValue myvals( (mymatrix->function)->getNumberOfQuantities(), (mymatrix->function)->getNumberOfDerivatives() );
for(unsigned i=0; i<mymatrix->getNumberOfColumns(); ++i) {
if( mymatrix->undirectedGraph() && ind==i ) continue;
if( mymatrix->undirectedGraph() && ind==i ) {
continue;
}
addConnectionDerivatives( ind, i, myvals, myder );
}
myder.updateDynamicList(); return myder;
myder.updateDynamicList();
return myder;
}
return (mymatrix->function)->getInputDerivatives( ind, normed, myatoms );
}

unsigned ActionWithInputMatrix::getNumberOfNodeTypes() const {
unsigned size = (mymatrix->function)->mybasemulticolvars.size();
if( size==0 ) return 1;
if( size==0 ) {
return 1;
}
return size;
}

unsigned ActionWithInputMatrix::getNumberOfQuantities() const {
if( (mymatrix->function)->mybasemulticolvars.size()==0 ) return 2;
if( (mymatrix->function)->mybasemulticolvars.size()==0 ) {
return 2;
}
return (mymatrix->function)->mybasemulticolvars[0]->getNumberOfQuantities();
}

Expand Down
8 changes: 6 additions & 2 deletions src/adjmat/ActionWithInputMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ class ActionWithInputMatrix : public multicolvar::MultiColvarBase {
unsigned getNumberOfDerivatives() override;
/// Get the number of rows/cols in the adjacency matrix vessel
virtual unsigned getNumberOfNodes() const;
bool isPeriodic() override { return false; }
bool isPeriodic() override {
return false;
}
unsigned getNumberOfQuantities() const override;
///
AtomNumber getAbsoluteIndexOfCentralAtom(const unsigned& i) const override;
/// No loop over tasks for ActionWithInputMatrix
double compute( const unsigned& tindex, multicolvar::AtomValuePack& myatoms ) const override { plumed_error(); }
double compute( const unsigned& tindex, multicolvar::AtomValuePack& myatoms ) const override {
plumed_error();
}
///
Vector getPositionOfAtomForLinkCells( const unsigned& iatom ) const override;
};
Expand Down
Loading

1 comment on commit c86000e

@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/a-masterclass-22-09.txt
Found broken examples in automatic/a-masterclass-22-11.txt
Found broken examples in automatic/a-masterclass-22-12.txt
Found broken examples in automatic/performance-optimization.txt
Found broken examples in automatic/a-trieste-6.txt
Found broken examples in automatic/munster.txt
Found broken examples in automatic/ANN.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/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/INCLUDE.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/PIV.tmp
Found broken examples in automatic/PLUMED.tmp
Found broken examples in MiscelaneousPP.md

Please sign in to comment.