Skip to content
Snippets Groups Projects
Commit c88c6bfd authored by Gareth Tribello's avatar Gareth Tribello
Browse files

Fix of problem with FindContourSurface in rt-wcsurface2

parent 0624bf76
No related branches found
No related tags found
No related merge requests found
......@@ -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];
}
......
......@@ -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] );
......
......@@ -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;
......
......@@ -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") ){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment