diff --git a/src/gridtools/FindContourSurface.cpp b/src/gridtools/FindContourSurface.cpp index cc10f077a37cfa300c62a8ca7e0d25115753ef44..d4c891f330933b363da8529fef4cf6bcada7d303 100644 --- a/src/gridtools/FindContourSurface.cpp +++ b/src/gridtools/FindContourSurface.cpp @@ -130,7 +130,6 @@ void FindContourSurface::prepareForAveraging(){ direction.resize( ingrid->getDimension(), 0 ); direction[dir_n] = 0.999999999*ingrid->getGridSpacing()[dir_n]; } - firsttime=false; } void FindContourSurface::finishAveraging(){ @@ -157,6 +156,7 @@ void FindContourSurface::finishAveraging(){ } ingrid->activateThesePoints( active ); } + firsttime=false; } void FindContourSurface::compute( const unsigned& current, MultiValue& myvals ) const { @@ -196,19 +196,10 @@ void FindContourSurface::compute( const unsigned& current, MultiValue& myvals ) // Check if the minimum is bracketed if( val1*val2<0 ){ ingrid->getGridPointCoordinates( shiftn, point ); findContour( direction, point ); - for(unsigned j=0;j<gdirs.size();++j) myvals.setValue( 1+gdirs[j], point[gdirs[j]] ); - if( firsttime ){ - if( nfound>1 ) error("in first frame found more than one location of dividing surface"); - minp=point[dir_n]; - } else if( nfound==0 ){ - minp=point[dir_n]; minv=std::fabs( point[dir_n] - mygrid->getGridElement( i, 0 ) ); - } else { - double tmp = std::fabs( point[dir_n] - mygrid->getGridElement( i, 0 ) ); - if( tmp<minv ){ minv=tmp; minp=point[dir_n]; } - } - nfound++; + minp=point[dir_n]; nfound++; } + // This moves us on to the next point shiftn += ingrid->getStride()[dir_n]; } diff --git a/src/gridtools/GridVessel.cpp b/src/gridtools/GridVessel.cpp index dfd383189a3390feffb4497f48262e897f33d26a..496bb1f68d1960368d33ea028957e550cd05d386 100644 --- a/src/gridtools/GridVessel.cpp +++ b/src/gridtools/GridVessel.cpp @@ -37,13 +37,16 @@ GridVessel::GridVessel( const vesselbase::VesselOptions& da ): AveragingVessel(da), bounds_set(false), cube_units(1.0), -noderiv(false) +noderiv(false), +npoints(0) { std::vector<std::string> compnames; parseVector("COMPONENTS",compnames); std::vector<std::string> coordnames; parseVector("COORDINATES",coordnames); dimension=coordnames.size(); std::vector<std::string> spbc( dimension ); parseVector("PBC",spbc); - str_min.resize( dimension); str_max.resize( dimension ); + str_min.resize( dimension); str_max.resize( dimension ); stride.resize( dimension ); + max.resize( dimension ); dx.resize( dimension ); nbin.resize( dimension ); min.resize( dimension ); + unsigned n=0; nper=compnames.size()*( 1 + coordnames.size() ); arg_names.resize( coordnames.size() + compnames.size()*( 1 + coordnames.size() ) ); @@ -77,8 +80,6 @@ void GridVessel::setBounds( const std::vector<std::string>& smin, const std::vec plumed_assert( (spacing.size()==dimension || binsin.size()==dimension) ); npoints=1; bounds_set=true; - stride.resize( dimension ); max.resize( dimension ); - dx.resize( dimension ); nbin.resize( dimension ); min.resize( dimension ); for(unsigned i=0;i<dimension;++i){ str_min[i]=smin[i]; str_max[i]=smax[i]; Tools::convert( str_min[i], min[i] ); diff --git a/src/multicolvar/MultiColvarDensity.cpp b/src/multicolvar/MultiColvarDensity.cpp index 148004d9e79d6a846193043630e03fed94370a09..1fd2312b0f9024cdbda48631872ff45dbdbee302 100644 --- a/src/multicolvar/MultiColvarDensity.cpp +++ b/src/multicolvar/MultiColvarDensity.cpp @@ -178,7 +178,7 @@ ActionWithGrid(ao) parseVector("NBINS",nbins); parseVector("SPACING",gspacing); if( nbins.size()!=directions.size() && gspacing.size()!=directions.size() ) error("NBINS or SPACING must be set"); - confined.resize( directions.size() ); cmin.resize( directions.size() ); cmax.resize( directions.size() ); + confined.resize( directions.size() ); cmin.resize( directions.size(), 0 ); cmax.resize( directions.size(), 0 ); for(unsigned i=0;i<directions.size();++i){ if( directions[i]==0 ){ bool tflag; parseFlag("XREDUCED",tflag); confined[i]=tflag; diff --git a/src/vesselbase/ActionWithAveraging.cpp b/src/vesselbase/ActionWithAveraging.cpp index 372bb272cf9a0ab8872ef682ef6e24550c03f4d1..d103a8ffda890cb38187570d5ffbd8a7cf4f6a25 100644 --- a/src/vesselbase/ActionWithAveraging.cpp +++ b/src/vesselbase/ActionWithAveraging.cpp @@ -52,7 +52,7 @@ clearstride(0) parse("CLEAR",clearstride); if( clearstride>0 ){ if( clearstride%getStride()!=0 ) error("CLEAR parameter must be a multiple of STRIDE"); - log.printf(" clearing grid every %d steps \n",clearstride); + log.printf(" clearing grid every %u steps \n",clearstride); } } if( keywords.exists("LOGWEIGHTS") ){