Skip to content

Commit

Permalink
multicolvar: removed namespace std
Browse files Browse the repository at this point in the history
  • Loading branch information
carlocamilloni committed Nov 18, 2020
1 parent 220b95d commit ae3edb1
Show file tree
Hide file tree
Showing 17 changed files with 16 additions and 51 deletions.
6 changes: 2 additions & 4 deletions src/multicolvar/AlphaBeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down Expand Up @@ -185,8 +183,8 @@ double AlphaBeta::compute( const unsigned& tindex, AtomValuePack& myatoms ) cons
Vector dd0,dd1,dd2;
PLMD::Torsion t;
const double value = t.compute(d0,d1,d2,dd0,dd1,dd2);
const double svalue = -0.5*coefficient[tindex]*sin(value-target[tindex]);
const double cvalue = coefficient[tindex]*(1.+cos(value-target[tindex]));
const double svalue = -0.5*coefficient[tindex]*std::sin(value-target[tindex]);
const double cvalue = coefficient[tindex]*(1.+std::cos(value-target[tindex]));

dd0 *= svalue;
dd1 *= svalue;
Expand Down
2 changes: 0 additions & 2 deletions src/multicolvar/Angles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down
2 changes: 0 additions & 2 deletions src/multicolvar/Bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down
2 changes: 0 additions & 2 deletions src/multicolvar/CenterOfMultiColvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include "BridgedMultiColvarFunction.h"
#include "vesselbase/StoreDataVessel.h"

using namespace std;

//+PLUMEDOC VATOM CENTER_OF_MULTICOLVAR
/*
Calculate a a weighted average position based on the value of some multicolvar.
Expand Down
6 changes: 2 additions & 4 deletions src/multicolvar/CoordinationNumbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down Expand Up @@ -142,7 +140,7 @@ CoordinationNumbers::CoordinationNumbers(const ActionOptions&ao):
parse("R_POWER", r_power);
if(r_power > 0) {
log.printf(" Multiplying switching function by r^%d\n", r_power);
double offset = switchingFunction.calculate(rcut*0.9999, rcut2) * pow(rcut*0.9999, r_power);
double offset = switchingFunction.calculate(rcut*0.9999, rcut2) * std::pow(rcut*0.9999, r_power);
log.printf(" You will have a discontinuous jump of %f to 0 near the cutoff of your switching function. "
"Consider setting D_MAX or reducing R_POWER if this is large\n", offset);
}
Expand All @@ -168,7 +166,7 @@ double CoordinationNumbers::compute( const unsigned& tindex, AtomValuePack& myat

sw = switchingFunction.calculateSqr( d2, dfunc );
if(r_power > 0) {
d = sqrt(d2); raised = pow( d, r_power - 1 );
d = std::sqrt(d2); raised = std::pow( d, r_power - 1 );
accumulateSymmetryFunction( 1, i, sw * raised * d,
(dfunc * d * raised + sw * r_power * raised / d) * distance,
(-dfunc * d * raised - sw * r_power * raised / d) * Tensor(distance, distance),
Expand Down
2 changes: 0 additions & 2 deletions src/multicolvar/Density.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down
6 changes: 2 additions & 4 deletions src/multicolvar/DihedralCorrelation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down Expand Up @@ -146,9 +144,9 @@ double DihedralCorrelation::compute( const unsigned& tindex, AtomValuePack& myat

// Calculate value
const double diff = phi2 - phi1;
const double value = 0.5*(1.+cos(diff));
const double value = 0.5*(1.+std::cos(diff));
// Derivatives wrt phi1
const double dval = 0.5*sin(diff);
const double dval = 0.5*std::sin(diff);
dd10 *= dval;
dd11 *= dval;
dd12 *= dval;
Expand Down
2 changes: 0 additions & 2 deletions src/multicolvar/Distances.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down
8 changes: 3 additions & 5 deletions src/multicolvar/DumpMultiColvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
#include "vesselbase/ActionWithInputVessel.h"
#include "vesselbase/StoreDataVessel.h"

using namespace std;

namespace PLMD
{
namespace multicolvar {
Expand Down Expand Up @@ -113,19 +111,19 @@ DumpMultiColvar::DumpMultiColvar(const ActionOptions&ao):
if( atom.size()>1 ) error("should only be one atom specified");
if( atom.size()==1 ) log.printf(" origin is at position of atom : %d\n",atom[0].serial() );

string file; parse("FILE",file);
std::string file; parse("FILE",file);
if(file.length()==0) error("name out output file was not specified");
std::string type=Tools::extension(file);
log<<" file name "<<file<<"\n";
if(type!="xyz") error("can only print xyz file type with DUMPMULTICOLVAR");

fmt_xyz="%f";

string precision; parse("PRECISION",precision);
std::string precision; parse("PRECISION",precision);
if(precision.length()>0) {
int p; Tools::convert(precision,p);
log<<" with precision "<<p<<"\n";
string a,b;
std::string a,b;
Tools::convert(p+5,a);
Tools::convert(p,b);
fmt_xyz="%"+a+"."+b+"f";
Expand Down
4 changes: 1 addition & 3 deletions src/multicolvar/InPlaneDistances.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down Expand Up @@ -134,7 +132,7 @@ double InPlaneDistances::compute( const unsigned& tindex, AtomValuePack& myatoms
Vector normal=getSeparation( myatoms.getPosition(1), myatoms.getPosition(2) );
Vector dir=getSeparation( myatoms.getPosition(1), myatoms.getPosition(0) );
PLMD::Angle a; Vector ddij, ddik; double angle=a.compute(normal,dir,ddij,ddik);
double sangle=sin(angle), cangle=cos(angle);
double sangle=std::sin(angle), cangle=std::cos(angle);
double dd=dir.modulo(), invdd=1.0/dd, val=dd*sangle;

addAtomDerivatives( 1, 0, dd*cangle*ddik + sangle*invdd*dir, myatoms );
Expand Down
6 changes: 2 additions & 4 deletions src/multicolvar/MultiColvarBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
#include <string>
#include <limits>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down Expand Up @@ -410,11 +408,11 @@ void MultiColvarBase::setupMultiColvarBase( const std::vector<AtomNumber>& atoms
if( allthirdblockintasks ) {
decoder.resize(2); plumed_assert( ablocks.size()==3 );
// Check if number of atoms is too large
if( pow( double(nblock), 2.0 )>std::numeric_limits<unsigned>::max() ) error("number of atoms in groups is too big for PLUMED to handle");
if( std::pow( double(nblock), 2.0 )>std::numeric_limits<unsigned>::max() ) error("number of atoms in groups is too big for PLUMED to handle");
} else {
decoder.resize( ablocks.size() );
// Check if number of atoms is too large
if( pow( double(nblock), double(ablocks.size()) )>std::numeric_limits<unsigned>::max() ) error("number of atoms in groups is too big for PLUMED to handle");
if( std::pow( double(nblock), double(ablocks.size()) )>std::numeric_limits<unsigned>::max() ) error("number of atoms in groups is too big for PLUMED to handle");
}
unsigned code=1; for(unsigned i=0; i<decoder.size(); ++i) { decoder[decoder.size()-1-i]=code; code *= nblock; }
} else if( !usespecies ) {
Expand Down
11 changes: 4 additions & 7 deletions src/multicolvar/MultiColvarDensity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
#include "MultiColvarBase.h"
#include "gridtools/ActionWithGrid.h"

using namespace std;

namespace PLMD
{
namespace PLMD {
namespace multicolvar {

//+PLUMEDOC GRIDCALC MULTICOLVARDENS
Expand Down Expand Up @@ -186,23 +183,23 @@ MultiColvarDensity::MultiColvarDensity(const ActionOptions&ao):
if( confined[i] ) {
cmin[i]=cmax[i]=0.0; parse("XLOWER",cmin[i]); parse("XUPPER",cmax[i]);
if( fractional ) error("XREDUCED is incompatible with FRACTIONAL");
if( fabs(cmin[i]-cmax[i])<epsilon ) error("range set for x axis makes no sense");
if( std::abs(cmin[i]-cmax[i])<epsilon ) error("range set for x axis makes no sense");
log.printf(" confining calculation in x direction to between %f and %f \n",cmin[i],cmax[i]);
}
} else if( directions[i]==1 ) {
bool tflag; parseFlag("YREDUCED",tflag); confined[i]=tflag;
if( confined[i] ) {
cmin[i]=cmax[i]=0.0; parse("YLOWER",cmin[i]); parse("YUPPER",cmax[i]);
if( fractional ) error("YREDUCED is incompatible with FRACTIONAL");
if( fabs(cmin[i]-cmax[i])<epsilon ) error("range set for y axis makes no sense");
if( std::abs(cmin[i]-cmax[i])<epsilon ) error("range set for y axis makes no sense");
log.printf(" confining calculation in y direction to between %f and %f \n",cmin[i],cmax[i]);
}
} else if( directions[i]==2 ) {
bool tflag; parseFlag("ZREDUCED",tflag); confined[i]=tflag;
if( confined[i] ) {
cmin[i]=cmax[i]=0.0; parse("ZLOWER",cmin[i]); parse("ZUPPER",cmax[i]);
if( fractional ) error("ZREDUCED is incompatible with FRACTIONAL");
if( fabs(cmin[i]-cmax[i])<epsilon ) error("range set for z axis search makes no sense");
if( std::abs(cmin[i]-cmax[i])<epsilon ) error("range set for z axis search makes no sense");
log.printf(" confining calculation in z direction to between %f and %f \n",cmin[i],cmax[i]);
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/multicolvar/Torsions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down
2 changes: 0 additions & 2 deletions src/multicolvar/XAngle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down
2 changes: 0 additions & 2 deletions src/multicolvar/XDistances.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down
2 changes: 0 additions & 2 deletions src/multicolvar/XYDistances.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down
2 changes: 0 additions & 2 deletions src/multicolvar/XYTorsion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <string>
#include <cmath>

using namespace std;

namespace PLMD {
namespace multicolvar {

Expand Down

1 comment on commit ae3edb1

@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/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/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/INCLUDE.tmp
Found broken examples in automatic/MAZE_MEMETIC_SAMPLING.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_RANDOM_WALK.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.