From ee4ff73dc9c26f11e41835fb727a1c541a348729 Mon Sep 17 00:00:00 2001 From: Giovanni Bussi <giovanni.bussi@gmail.com> Date: Mon, 17 Dec 2012 09:02:25 +0100 Subject: [PATCH] Fixed namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I replaced all the "using namespace PLMD" statements with explicit namespace PLMD{ …… }. This is more clear and simplify the syntax for defining operators --- src/bias/Bias.cpp | 9 ++++++--- src/cltools/SimpleMD.cpp | 1 - src/core/Action.cpp | 3 ++- src/core/ActionPilot.cpp | 3 ++- src/core/ActionRegister.cpp | 7 ++++--- src/core/ActionSet.cpp | 3 ++- src/core/ActionSetup.cpp | 3 ++- src/core/ActionWithArguments.cpp | 3 ++- src/core/ActionWithValue.cpp | 3 ++- src/core/Atoms.cpp | 1 - src/core/CLTool.cpp | 3 ++- src/core/CLToolMain.cpp | 3 ++- src/core/CLToolRegister.cpp | 7 ++++--- src/core/Colvar.cpp | 3 ++- src/core/FlexibleBin.cpp | 4 +++- src/core/GREX.cpp | 4 +++- src/core/MDAtoms.cpp | 1 - src/core/PlumedMain.cpp | 4 +++- src/core/PlumedMainInitializer.cpp | 3 ++- src/core/Value.cpp | 10 ++++++---- src/function/Function.cpp | 6 ++++-- src/generic/DumpAtoms.cpp | 1 - src/generic/WholeMolecules.cpp | 1 - src/multicolvar/MultiColvar.cpp | 6 ++++-- src/multicolvar/MultiColvar.h | 2 -- src/multicolvar/SecondaryStructureRMSD.cpp | 3 ++- src/tools/Angle.cpp | 3 ++- src/tools/Citations.cpp | 5 +++-- src/tools/DLLoader.cpp | 3 ++- src/tools/DRMSD.cpp | 3 ++- src/tools/Grid.cpp | 3 ++- src/tools/HistogramBead.cpp | 3 ++- src/tools/Kearsley.cpp | 3 ++- src/tools/Keywords.cpp | 3 ++- src/tools/LatticeReduction.cpp | 3 ++- src/tools/NeighborList.cpp | 3 ++- src/tools/OptimalAlignment.cpp | 3 ++- src/tools/Pbc.cpp | 3 ++- src/tools/PlumedCommunicator.cpp | 1 - src/tools/RMSD.cpp | 3 ++- src/tools/Random.cpp | 3 ++- src/tools/Stopwatch.cpp | 7 +++---- src/tools/SwitchingFunction.cpp | 4 +++- src/tools/Tools.cpp | 4 +++- src/tools/Torsion.cpp | 4 +++- 45 files changed, 100 insertions(+), 61 deletions(-) diff --git a/src/bias/Bias.cpp b/src/bias/Bias.cpp index 218998b11..ea1526bbf 100644 --- a/src/bias/Bias.cpp +++ b/src/bias/Bias.cpp @@ -21,9 +21,9 @@ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ #include "Bias.h" -using namespace PLMD; -using namespace PLMD::bias; -using namespace std; + +namespace PLMD{ +namespace bias{ Bias::Bias(const ActionOptions&ao): Action(ao), @@ -49,4 +49,7 @@ void Bias::apply(){ } } +} +} + diff --git a/src/cltools/SimpleMD.cpp b/src/cltools/SimpleMD.cpp index 6788549d4..f5d9b36ac 100644 --- a/src/cltools/SimpleMD.cpp +++ b/src/cltools/SimpleMD.cpp @@ -30,7 +30,6 @@ #include <vector> using namespace std; -using namespace PLMD; namespace PLMD{ namespace cltools{ diff --git a/src/core/Action.cpp b/src/core/Action.cpp index d31212dd8..13088fab7 100644 --- a/src/core/Action.cpp +++ b/src/core/Action.cpp @@ -28,7 +28,7 @@ #include "ActionSet.h" #include <iostream> -using namespace PLMD; +namespace PLMD{ Keywords ActionOptions::emptyKeys; @@ -214,4 +214,5 @@ void Action::calculateFromPDB( const PDB& pdb ){ } +} diff --git a/src/core/ActionPilot.cpp b/src/core/ActionPilot.cpp index 7d10b9315..161247ca3 100644 --- a/src/core/ActionPilot.cpp +++ b/src/core/ActionPilot.cpp @@ -21,8 +21,8 @@ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ #include "ActionPilot.h" -using namespace PLMD; using namespace std; +namespace PLMD{ void ActionPilot::registerKeywords(Keywords& keys){ } @@ -42,5 +42,6 @@ bool ActionPilot::onStep()const{ int ActionPilot::getStride()const{ return stride; } +} diff --git a/src/core/ActionRegister.cpp b/src/core/ActionRegister.cpp index 7c5532d4a..c69cbd53e 100644 --- a/src/core/ActionRegister.cpp +++ b/src/core/ActionRegister.cpp @@ -27,7 +27,7 @@ using namespace std; -using namespace PLMD; +namespace PLMD{ ActionRegister::~ActionRegister(){ if(m.size()>0){ @@ -37,7 +37,7 @@ ActionRegister::~ActionRegister(){ } } -ActionRegister& PLMD::actionRegister(){ +ActionRegister& actionRegister(){ static ActionRegister ans; return ans; } @@ -106,7 +106,7 @@ bool ActionRegister::printTemplate( const std::string& action, bool include_opti } } -std::ostream & PLMD::operator<<(std::ostream &log,const ActionRegister&ar){ +std::ostream & operator<<(std::ostream &log,const ActionRegister&ar){ vector<string> s; for(ActionRegister::const_mIterator it=ar.m.begin();it!=ar.m.end();++it) s.push_back((*it).first); @@ -125,3 +125,4 @@ std::ostream & PLMD::operator<<(std::ostream &log,const ActionRegister&ar){ } +} diff --git a/src/core/ActionSet.cpp b/src/core/ActionSet.cpp index 8f39a3aa1..d1e2f62b3 100644 --- a/src/core/ActionSet.cpp +++ b/src/core/ActionSet.cpp @@ -22,7 +22,7 @@ #include "ActionSet.h" using namespace std; -using namespace PLMD; +namespace PLMD{ ActionSet::ActionSet(PlumedMain&p): plumed(p){ @@ -48,3 +48,4 @@ std::string ActionSet::getLabelList() const{ } +} diff --git a/src/core/ActionSetup.cpp b/src/core/ActionSetup.cpp index 52118174b..f7a333f17 100644 --- a/src/core/ActionSetup.cpp +++ b/src/core/ActionSetup.cpp @@ -24,7 +24,7 @@ #include "ActionSet.h" #include "tools/PlumedException.h" -using namespace PLMD; +namespace PLMD{ ActionSetup::ActionSetup(const ActionOptions&ao): Action(ao) @@ -42,3 +42,4 @@ void ActionSetup::registerKeywords( Keywords& keys ){ keys.remove("LABEL"); } +} diff --git a/src/core/ActionWithArguments.cpp b/src/core/ActionWithArguments.cpp index b948ea69f..039c37f41 100644 --- a/src/core/ActionWithArguments.cpp +++ b/src/core/ActionWithArguments.cpp @@ -25,7 +25,7 @@ #include "ActionSet.h" using namespace std; -using namespace PLMD; +namespace PLMD{ void ActionWithArguments::registerKeywords(Keywords& keys){ keys.reserve("compulsory","ARG","the input for this action is the output from one or more other actions. The particular output that you used is referenced using that action of interests label. If the label appears on its own then the value of the relevant Action is taken. If * or *.* appears the information from all arguments is taken. Some actions have multi-component outputs, each component of the output has a specific label so for instance an action labelled dist may have three componets x, y and z. To take just the x component you should use dist.x, if you wish to take all three components then use dist.*"); @@ -183,3 +183,4 @@ double ActionWithArguments::getProjection(unsigned i,unsigned j)const{ +} diff --git a/src/core/ActionWithValue.cpp b/src/core/ActionWithValue.cpp index 92f4b28a3..d09f53b3e 100644 --- a/src/core/ActionWithValue.cpp +++ b/src/core/ActionWithValue.cpp @@ -23,7 +23,7 @@ #include "tools/PlumedException.h" using namespace std; -using namespace PLMD; +namespace PLMD{ void ActionWithValue::registerKeywords(Keywords& keys){ keys.addFlag("NUMERICAL_DERIVATIVES", false, "calculate the derivatives for these quantities numerically"); @@ -185,3 +185,4 @@ void ActionWithValue::mergeFieldDerivatives( const std::vector<double>& derivati } } } +} diff --git a/src/core/Atoms.cpp b/src/core/Atoms.cpp index 794ca399e..9ecb186fe 100644 --- a/src/core/Atoms.cpp +++ b/src/core/Atoms.cpp @@ -26,7 +26,6 @@ #include <algorithm> #include <string> -using namespace PLMD; using namespace std; namespace PLMD { diff --git a/src/core/CLTool.cpp b/src/core/CLTool.cpp index 405d2ce6a..27fcee23d 100644 --- a/src/core/CLTool.cpp +++ b/src/core/CLTool.cpp @@ -21,7 +21,7 @@ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ #include "CLTool.h" -using namespace PLMD; +namespace PLMD{ Keywords CLToolOptions::emptyKeys; @@ -185,3 +185,4 @@ bool CLTool::readInputFile( int argc, char**argv, FILE* in, FILE*out ){ setRemainingToDefault(out); return true; } +} diff --git a/src/core/CLToolMain.cpp b/src/core/CLToolMain.cpp index 9dbb4e1f0..228fff374 100644 --- a/src/core/CLToolMain.cpp +++ b/src/core/CLToolMain.cpp @@ -34,7 +34,7 @@ #include <algorithm> using namespace std; -using namespace PLMD; +namespace PLMD{ CLToolMain::CLToolMain(): argc(0), @@ -231,3 +231,4 @@ int CLToolMain::run(int argc, char **argv,FILE*in,FILE*out,PlumedCommunicator& p return 1; } +} diff --git a/src/core/CLToolRegister.cpp b/src/core/CLToolRegister.cpp index 7e2ca1173..56ccbeadf 100644 --- a/src/core/CLToolRegister.cpp +++ b/src/core/CLToolRegister.cpp @@ -27,7 +27,7 @@ using namespace std; -using namespace PLMD; +namespace PLMD{ CLToolRegister::~CLToolRegister(){ if(m.size()>0){ @@ -37,7 +37,7 @@ CLToolRegister::~CLToolRegister(){ } } -CLToolRegister& PLMD::cltoolRegister(){ +CLToolRegister& cltoolRegister(){ static CLToolRegister ans; return ans; } @@ -77,7 +77,7 @@ CLTool* CLToolRegister::create(const CLToolOptions&ao){ } -std::ostream & PLMD::operator<<(std::ostream &log,const CLToolRegister&ar){ +std::ostream & operator<<(std::ostream &log,const CLToolRegister&ar){ vector<string> s(ar.list()); for(unsigned i=0;i<s.size();i++) log<<" "<<s[i]<<"\n"; if(ar.disabled.size()>0){ @@ -111,3 +111,4 @@ vector<string> CLToolRegister::list()const{ +} diff --git a/src/core/Colvar.cpp b/src/core/Colvar.cpp index 33cf38032..6c3a7c5c2 100644 --- a/src/core/Colvar.cpp +++ b/src/core/Colvar.cpp @@ -24,7 +24,7 @@ #include <string> using namespace std; -using namespace PLMD; +namespace PLMD{ Colvar::Colvar(const ActionOptions&ao): Action(ao), @@ -97,3 +97,4 @@ void Colvar::setBoxDerivativesNoPbc(Value* v){ v->getDerivative(3*i+2))); setBoxDerivatives(v,virial); } +} diff --git a/src/core/FlexibleBin.cpp b/src/core/FlexibleBin.cpp index 4c9b037a2..d277128c1 100644 --- a/src/core/FlexibleBin.cpp +++ b/src/core/FlexibleBin.cpp @@ -27,7 +27,7 @@ #include "tools/Matrix.h" using namespace std; -using namespace PLMD; +namespace PLMD{ FlexibleBin::FlexibleBin(int type, ActionWithArguments *paction, double const &d ):type(type),paction(paction),sigma(d){ @@ -157,3 +157,5 @@ vector<double> FlexibleBin::getInverseMatrix() const{ return uppervec; } + +} diff --git a/src/core/GREX.cpp b/src/core/GREX.cpp index 9abf4d60e..0ce18bc78 100644 --- a/src/core/GREX.cpp +++ b/src/core/GREX.cpp @@ -27,7 +27,7 @@ #include <sstream> using namespace std; -using namespace PLMD; +namespace PLMD{ GREX::GREX(PlumedMain&p): initialized(false), @@ -156,3 +156,5 @@ void GREX::calculate(){ } intracomm.Bcast(&foreignDeltaBias,1,0); } + +} diff --git a/src/core/MDAtoms.cpp b/src/core/MDAtoms.cpp index 018529454..431c94633 100644 --- a/src/core/MDAtoms.cpp +++ b/src/core/MDAtoms.cpp @@ -25,7 +25,6 @@ #include "tools/Tools.h" #include "tools/PlumedException.h" -using namespace PLMD; using namespace std; namespace PLMD { diff --git a/src/core/PlumedMain.cpp b/src/core/PlumedMain.cpp index 94fd95110..f9f573ab2 100644 --- a/src/core/PlumedMain.cpp +++ b/src/core/PlumedMain.cpp @@ -43,9 +43,10 @@ #include "tools/Citations.h" #include "ExchangePatterns.h" -using namespace PLMD; using namespace std; +namespace PLMD{ + PlumedMain::PlumedMain(): comm(*new PlumedCommunicator), dlloader(*new DLLoader), @@ -625,6 +626,7 @@ void PlumedMain::runJobsAtEndOfCalculation(){ } } +} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/PlumedMainInitializer.cpp b/src/core/PlumedMainInitializer.cpp index 67aca0d74..d554ee0ff 100644 --- a/src/core/PlumedMainInitializer.cpp +++ b/src/core/PlumedMainInitializer.cpp @@ -23,8 +23,8 @@ #include "tools/PlumedException.h" #include <cstdlib> -using namespace PLMD; using namespace std; +namespace PLMD{ // !!!!!!!!!!!!!!!!!!!!!! DANGER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11 // THE FOLLOWING ARE UTILITIES WHICH ARE NECESSARY FOR DYNAMIC LOADING OF THE PLUMED KERNEL: @@ -78,3 +78,4 @@ static class PlumedMainInitializer{ } +} diff --git a/src/core/Value.cpp b/src/core/Value.cpp index 32a771186..e1940025c 100644 --- a/src/core/Value.cpp +++ b/src/core/Value.cpp @@ -28,7 +28,7 @@ #include "Atoms.h" #include "PlumedMain.h" -using namespace PLMD; +namespace PLMD{ Value::Value(): action(NULL), @@ -152,7 +152,7 @@ ActionWithValue* Value::getPntrToAction(){ return action; } -void PLMD::copy( const Value& val1, Value& val2 ){ +void copy( const Value& val1, Value& val2 ){ unsigned nder=val1.getNumberOfDerivatives(); if( nder!=val2.getNumberOfDerivatives() ){ val2.resizeDerivatives( nder ); } val2.clearDerivatives(); @@ -160,7 +160,7 @@ void PLMD::copy( const Value& val1, Value& val2 ){ val2.set( val1.get() ); } -void PLMD::copy( const Value& val1, Value* val2 ){ +void copy( const Value& val1, Value* val2 ){ unsigned nder=val1.getNumberOfDerivatives(); if( nder!=val2->getNumberOfDerivatives() ){ val2->resizeDerivatives( nder ); } val2->clearDerivatives(); @@ -168,12 +168,14 @@ void PLMD::copy( const Value& val1, Value* val2 ){ val2->set( val1.get() ); } -void PLMD::add( const Value& val1, Value* val2 ){ +void add( const Value& val1, Value* val2 ){ plumed_assert( val1.getNumberOfDerivatives()==val2->getNumberOfDerivatives() ); for(unsigned i=0;i<val1.getNumberOfDerivatives();++i) val2->addDerivative( i, val1.getDerivative(i) ); val2->set( val1.get() + val2->get() ); } +} + diff --git a/src/function/Function.cpp b/src/function/Function.cpp index 8612cc6d3..27e25d7a2 100644 --- a/src/function/Function.cpp +++ b/src/function/Function.cpp @@ -21,9 +21,9 @@ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ #include "Function.h" -using namespace PLMD; -using namespace PLMD::function; using namespace std; +namespace PLMD{ +namespace function{ void Function::registerKeywords(Keywords& keys){ Action::registerKeywords(keys); @@ -78,3 +78,5 @@ void Function::apply(){ getPntrToArgument(i)->addForce(f[i]); } } +} +} diff --git a/src/generic/DumpAtoms.cpp b/src/generic/DumpAtoms.cpp index 77f33b1f6..4f8de0581 100644 --- a/src/generic/DumpAtoms.cpp +++ b/src/generic/DumpAtoms.cpp @@ -29,7 +29,6 @@ #include "tools/Units.h" #include <cstdio> -using namespace PLMD; using namespace std; namespace PLMD diff --git a/src/generic/WholeMolecules.cpp b/src/generic/WholeMolecules.cpp index d7d4f9e0a..3c6ec29d8 100644 --- a/src/generic/WholeMolecules.cpp +++ b/src/generic/WholeMolecules.cpp @@ -34,7 +34,6 @@ #include <string> using namespace std; -using namespace PLMD; namespace PLMD { namespace generic{ diff --git a/src/multicolvar/MultiColvar.cpp b/src/multicolvar/MultiColvar.cpp index 366c399a2..6b7c3c129 100644 --- a/src/multicolvar/MultiColvar.cpp +++ b/src/multicolvar/MultiColvar.cpp @@ -29,8 +29,8 @@ #include <string> using namespace std; -using namespace PLMD; -using namespace PLMD::multicolvar; +namespace PLMD{ +namespace multicolvar{ void MultiColvar::registerKeywords( Keywords& keys ){ Action::registerKeywords( keys ); @@ -467,3 +467,5 @@ void MultiColvar::apply(){ } } } +} +} diff --git a/src/multicolvar/MultiColvar.h b/src/multicolvar/MultiColvar.h index a82f45a0a..02cd5632d 100644 --- a/src/multicolvar/MultiColvar.h +++ b/src/multicolvar/MultiColvar.h @@ -32,8 +32,6 @@ namespace PLMD { namespace multicolvar { -class MultiColvar; - /** \ingroup INHERIT This is the abstract base class to use for creating distributions of colvars and functions diff --git a/src/multicolvar/SecondaryStructureRMSD.cpp b/src/multicolvar/SecondaryStructureRMSD.cpp index 8520ec7a9..c8b08dd4e 100644 --- a/src/multicolvar/SecondaryStructureRMSD.cpp +++ b/src/multicolvar/SecondaryStructureRMSD.cpp @@ -25,9 +25,9 @@ #include "tools/RMSD.h" #include "tools/DRMSD.h" -using namespace PLMD::multicolvar; namespace PLMD { +namespace multicolvar{ void SecondaryStructureRMSD::registerKeywords( Keywords& keys ){ MultiColvar::registerKeywords( keys ); @@ -146,3 +146,4 @@ bool SecondaryStructureRMSD::usingRMSD() const { } } +} diff --git a/src/tools/Angle.cpp b/src/tools/Angle.cpp index 64900ec43..afbf1f9a3 100644 --- a/src/tools/Angle.cpp +++ b/src/tools/Angle.cpp @@ -23,7 +23,7 @@ #include "Tools.h" #include <cmath> -using namespace PLMD; +namespace PLMD{ double Angle::compute(const Vector& v1,const Vector& v2)const{ return std::acos(dotProduct(v1,v2)/(v1.modulo()*v2.modulo())); @@ -65,3 +65,4 @@ double Angle::compute(const Vector& v1,const Vector& v2,Vector& d1,Vector& d2)co return std::acos(dpnn); } +} diff --git a/src/tools/Citations.cpp b/src/tools/Citations.cpp index aebf931c9..2618ec39d 100644 --- a/src/tools/Citations.cpp +++ b/src/tools/Citations.cpp @@ -25,7 +25,7 @@ #include <iostream> using namespace std; -using namespace PLMD; +namespace PLMD{ std::string Citations::cite(const std::string & item){ unsigned i; @@ -38,10 +38,11 @@ std::string Citations::cite(const std::string & item){ return ret; } -std::ostream & PLMD::operator<<(std::ostream &log,const Citations&cit){ +std::ostream & operator<<(std::ostream &log,const Citations&cit){ for(unsigned i=0;i<cit.items.size();++i) log<<" ["<<i+1<<"] "<<cit.items[i]<<"\n"; return log; } +} diff --git a/src/tools/DLLoader.cpp b/src/tools/DLLoader.cpp index a614d8cd5..59ab3b081 100644 --- a/src/tools/DLLoader.cpp +++ b/src/tools/DLLoader.cpp @@ -26,7 +26,7 @@ #include <dlfcn.h> #endif -using namespace PLMD; +namespace PLMD{ bool DLLoader::installed(){ #ifdef __PLUMED_HAS_DLOPEN @@ -81,3 +81,4 @@ DLLoader&DLLoader::operator=(const DLLoader&dl){ +} diff --git a/src/tools/DRMSD.cpp b/src/tools/DRMSD.cpp index 89cc38c18..6897052b7 100644 --- a/src/tools/DRMSD.cpp +++ b/src/tools/DRMSD.cpp @@ -25,7 +25,7 @@ #include <cmath> using namespace std; -using namespace PLMD; +namespace PLMD{ void DRMSD::setFromPDB(const PDB&pdb, double lbound, double ubound){ setReference(pdb.getPositions(), lbound, ubound); @@ -90,3 +90,4 @@ double DRMSD::calculate(const std::vector<Vector> & positions, const Pbc& pbc, } +} diff --git a/src/tools/Grid.cpp b/src/tools/Grid.cpp index b787859a7..6561e20d3 100644 --- a/src/tools/Grid.cpp +++ b/src/tools/Grid.cpp @@ -33,7 +33,7 @@ #include "KernelFunctions.h" using namespace std; -using namespace PLMD; +namespace PLMD{ Grid::Grid(const std::string& funcl, std::vector<Value*> args, const vector<std::string> & gmin, const vector<std::string> & gmax, const vector<unsigned> & nbin, bool dospline, bool usederiv, bool doclear){ @@ -622,3 +622,4 @@ void SparseGrid::writeToFile(PlumedOFile& ofile){ ofile.printField(); } } +} diff --git a/src/tools/HistogramBead.cpp b/src/tools/HistogramBead.cpp index 9bfadc723..267a8abe3 100644 --- a/src/tools/HistogramBead.cpp +++ b/src/tools/HistogramBead.cpp @@ -25,7 +25,7 @@ #include "Tools.h" #include "Keywords.h" -using namespace PLMD; +namespace PLMD{ //+PLUMEDOC INTERNAL histogrambead /* @@ -188,3 +188,4 @@ double HistogramBead::calculate( double x, double& df ) const { return f; } +} diff --git a/src/tools/Kearsley.cpp b/src/tools/Kearsley.cpp index bf3e589c2..d3dd55712 100644 --- a/src/tools/Kearsley.cpp +++ b/src/tools/Kearsley.cpp @@ -30,7 +30,7 @@ #include "Random.h" using namespace std; -using namespace PLMD; +namespace PLMD{ // put some notes @@ -874,3 +874,4 @@ for(l=0;l<3;l++){ exit(0); } +} diff --git a/src/tools/Keywords.cpp b/src/tools/Keywords.cpp index 171e98433..186b219a5 100644 --- a/src/tools/Keywords.cpp +++ b/src/tools/Keywords.cpp @@ -24,7 +24,7 @@ #include "Tools.h" #include <iostream> -using namespace PLMD; +namespace PLMD{ Keywords::KeyType::KeyType( const std::string& type ){ if( type=="compulsory" ){ @@ -489,3 +489,4 @@ void Keywords::destroyData(){ booldefs.clear(); numdefs.clear(); atomtags.clear(); } +} diff --git a/src/tools/LatticeReduction.cpp b/src/tools/LatticeReduction.cpp index 28c785f74..70b548f5c 100644 --- a/src/tools/LatticeReduction.cpp +++ b/src/tools/LatticeReduction.cpp @@ -22,7 +22,7 @@ #include "PlumedException.h" #include "LatticeReduction.h" -using namespace PLMD; +namespace PLMD{ void LatticeReduction::sort(Vector v[3]){ for(int i=0;i<3;i++) for(int j=i+1;j<3;j++) if(modulo2(v[i])>modulo2(v[j])){ @@ -189,3 +189,4 @@ bool LatticeReduction::isReduced(const Tensor&t){ return true; } +} diff --git a/src/tools/NeighborList.cpp b/src/tools/NeighborList.cpp index ebfc18a02..6e87131a2 100644 --- a/src/tools/NeighborList.cpp +++ b/src/tools/NeighborList.cpp @@ -27,7 +27,7 @@ #include "Tools.h" #include "NeighborList.h" -using namespace PLMD; +namespace PLMD{ using namespace std; NeighborList::NeighborList(const vector<AtomNumber>& list0, const vector<AtomNumber>& list1, @@ -194,3 +194,4 @@ vector<unsigned> NeighborList::getNeighbors(unsigned index) { return neighbors; } +} diff --git a/src/tools/OptimalAlignment.cpp b/src/tools/OptimalAlignment.cpp index 245a08571..f3ffe5876 100644 --- a/src/tools/OptimalAlignment.cpp +++ b/src/tools/OptimalAlignment.cpp @@ -28,7 +28,7 @@ #include "Random.h" using namespace std; -using namespace PLMD; +namespace PLMD{ OptimalAlignment::OptimalAlignment( const std::vector<double> & align, const std::vector<double> & displace, const std::vector<Vector> & p0, const std::vector<Vector> & p1 , Log &log ) :log(log){ @@ -392,3 +392,4 @@ double OptimalAlignment::weightedFindiffTest( bool rmsd){ +} diff --git a/src/tools/Pbc.cpp b/src/tools/Pbc.cpp index e39655fe8..382b059f5 100644 --- a/src/tools/Pbc.cpp +++ b/src/tools/Pbc.cpp @@ -24,7 +24,7 @@ #include "PlumedException.h" #include "LatticeReduction.h" -using namespace PLMD; +namespace PLMD{ Pbc::Pbc(): type(unset) @@ -138,3 +138,4 @@ const Tensor& Pbc::getInvBox()const{ +} diff --git a/src/tools/PlumedCommunicator.cpp b/src/tools/PlumedCommunicator.cpp index f9a54102b..e08ae20d3 100644 --- a/src/tools/PlumedCommunicator.cpp +++ b/src/tools/PlumedCommunicator.cpp @@ -24,7 +24,6 @@ #include "PlumedException.h" using namespace std; -using namespace PLMD; namespace PLMD{ diff --git a/src/tools/RMSD.cpp b/src/tools/RMSD.cpp index 108ac893e..599962c10 100644 --- a/src/tools/RMSD.cpp +++ b/src/tools/RMSD.cpp @@ -28,7 +28,7 @@ #include <iostream> using namespace std; -using namespace PLMD; +namespace PLMD{ RMSD::RMSD(const RMSD & oldrmsd): alignmentMethod(oldrmsd.alignmentMethod), @@ -158,3 +158,4 @@ double RMSD::simpleAlignment(const std::vector<double> & align, } return ret; } +} diff --git a/src/tools/Random.cpp b/src/tools/Random.cpp index 9cc9363b6..ad7a54b3d 100644 --- a/src/tools/Random.cpp +++ b/src/tools/Random.cpp @@ -25,7 +25,7 @@ #include <sstream> #include <iostream> -using namespace PLMD; +namespace PLMD{ const double Random::fact=5.9604644775390625e-8; /* 1 / 2^24 */ const double Random::EPS=3.0e-16; @@ -145,3 +145,4 @@ double Random::Gaussian(){ return v2*fac; } +} diff --git a/src/tools/Stopwatch.cpp b/src/tools/Stopwatch.cpp index 2f6815ab6..57d92745d 100644 --- a/src/tools/Stopwatch.cpp +++ b/src/tools/Stopwatch.cpp @@ -42,18 +42,15 @@ clock_gettime (#define __CLOCK_GETTIME): #include <sys/time.h> #endif -using namespace PLMD; using namespace std; -// this is needed for friend operators namespace PLMD{ +// this is needed for friend operators std::ostream& operator<<(std::ostream&os,const Stopwatch&sw){ return sw.log(os); } -} - Stopwatch::Time::operator double()const{ return sec+0.000000001*nsec; } @@ -158,6 +155,8 @@ std::ostream& Stopwatch::log(std::ostream&os)const{ return os; } +} + diff --git a/src/tools/SwitchingFunction.cpp b/src/tools/SwitchingFunction.cpp index d4b12b2b7..68cc1dc91 100644 --- a/src/tools/SwitchingFunction.cpp +++ b/src/tools/SwitchingFunction.cpp @@ -26,7 +26,7 @@ #include <limits> using namespace std; -using namespace PLMD; +namespace PLMD{ //+PLUMEDOC INTERNAL switchingfunction /* @@ -213,5 +213,7 @@ void SwitchingFunction::printKeywords( Log& log ) const { skeys.print(log); } +} + diff --git a/src/tools/Tools.cpp b/src/tools/Tools.cpp index 1393b49b5..0a5c20b22 100644 --- a/src/tools/Tools.cpp +++ b/src/tools/Tools.cpp @@ -27,8 +27,8 @@ #include <cstring> #include <dirent.h> -using namespace PLMD; using namespace std; +namespace PLMD{ bool Tools::convert(const string & str,int & t){ istringstream istr(str.c_str()); @@ -257,3 +257,5 @@ void Tools::stripLeadingAndTrailingBlanks( std::string& str ){ std::size_t last=str.find_last_not_of(' '); if( first<last ) str=str.substr(first,last+1); } + +} diff --git a/src/tools/Torsion.cpp b/src/tools/Torsion.cpp index 426deca00..dd7a6ecf5 100644 --- a/src/tools/Torsion.cpp +++ b/src/tools/Torsion.cpp @@ -25,7 +25,7 @@ #include <cmath> #include <iostream> -using namespace PLMD; +namespace PLMD{ double Torsion::compute(const Vector& v1,const Vector& v2,const Vector& v3)const{ const Vector nv2(v2*(1.0/v2.modulo())); @@ -81,5 +81,7 @@ double Torsion::compute(const Vector& v1,const Vector& v2,const Vector& v3,Vecto return torsion; } +} + -- GitLab