Skip to content

Commit eeff0bf

Browse files
Merge branch 'v2.9'
2 parents e9bd5d4 + 300e1d9 commit eeff0bf

File tree

2 files changed

+13
-43
lines changed

2 files changed

+13
-43
lines changed

src/opes/ECVlinear.cpp

+6-21
Original file line numberDiff line numberDiff line change
@@ -122,26 +122,11 @@ ECVlinear::ECVlinear(const ActionOptions&ao)
122122
if(dimensionless)
123123
beta0_=1;
124124

125-
//workaround needed for intel compiler
126-
bool nan_support=true;
127-
const double my_nan_value=-42;
128-
if(!std::isnan(std::numeric_limits<double>::quiet_NaN()))
129-
{
130-
nan_support=false;
131-
log.printf(" +++ WARNING +++ do not set LAMBDA_MIN/MAX=%g, see https://github.com/plumed/plumed2/pull/990\n", my_nan_value);
132-
}
133-
auto isNone=[nan_support,my_nan_value](const double value)
134-
{
135-
if(nan_support)
136-
return std::isnan(value);
137-
else
138-
return value==my_nan_value;
139-
};
140-
141125
//parse lambda info
142126
parse("LAMBDA",lambda0_);
143-
double lambda_min=std::numeric_limits<double>::quiet_NaN();
144-
double lambda_max=std::numeric_limits<double>::quiet_NaN();
127+
const double myNone=std::numeric_limits<double>::lowest(); //quiet_NaN is not supported by some intel compiler
128+
double lambda_min=myNone;
129+
double lambda_max=myNone;
145130
parse("LAMBDA_MIN",lambda_min);
146131
parse("LAMBDA_MAX",lambda_max);
147132
unsigned lambda_steps=0;
@@ -156,7 +141,7 @@ ECVlinear::ECVlinear(const ActionOptions&ao)
156141
if(lambdas.size()>0)
157142
{
158143
plumed_massert(lambda_steps==0,"cannot set both LAMBDA_STEPS and LAMBDA_SET_ALL");
159-
plumed_massert(isNone(lambda_min) && isNone(lambda_max),"cannot set both LAMBDA_SET_ALL and LAMBDA_MIN/MAX");
144+
plumed_massert(lambda_min==myNone && lambda_max==myNone,"cannot set both LAMBDA_SET_ALL and LAMBDA_MIN/MAX");
160145
plumed_massert(lambdas.size()>=2,"set at least 2 lambdas with LAMBDA_SET_ALL");
161146
for(unsigned k=0; k<lambdas.size()-1; k++)
162147
plumed_massert(lambdas[k]<=lambdas[k+1],"LAMBDA_SET_ALL must be properly ordered");
@@ -168,12 +153,12 @@ ECVlinear::ECVlinear(const ActionOptions&ao)
168153
}
169154
else
170155
{ //get LAMBDA_MIN and LAMBDA_MAX
171-
if(isNone(lambda_min))
156+
if(lambda_min==myNone)
172157
{
173158
lambda_min=0;
174159
log.printf(" no LAMBDA_MIN provided, using LAMBDA_MIN = %g\n",lambda_min);
175160
}
176-
if(isNone(lambda_max))
161+
if(lambda_max==myNone)
177162
{
178163
lambda_max=1;
179164
log.printf(" no LAMBDA_MAX provided, using LAMBDA_MAX = %g\n",lambda_max);

src/opes/ECVmultiThermalBaric.cpp

+7-22
Original file line numberDiff line numberDiff line change
@@ -146,22 +146,6 @@ ECVmultiThermalBaric::ECVmultiThermalBaric(const ActionOptions&ao)
146146
const double kB=plumed.getAtoms().getKBoltzmann();
147147
const double temp0=kbt_/kB;
148148

149-
//workaround needed for intel compiler
150-
bool nan_support=true;
151-
const double my_nan_value=-42;
152-
if(!std::isnan(std::numeric_limits<double>::quiet_NaN()))
153-
{
154-
nan_support=false;
155-
log.printf(" +++ WARNING +++ do not set PRESSURE_MIN/MAX=%g, see https://github.com/plumed/plumed2/pull/990\n", my_nan_value);
156-
}
157-
auto isNone=[nan_support,my_nan_value](const double value)
158-
{
159-
if(nan_support)
160-
return std::isnan(value);
161-
else
162-
return value==my_nan_value;
163-
};
164-
165149
//parse temp range
166150
double temp_min=-1;
167151
double temp_max=-1;
@@ -175,8 +159,9 @@ ECVmultiThermalBaric::ECVmultiThermalBaric(const ActionOptions&ao)
175159
geom_spacing_=!geom_spacing_;
176160
//parse pressures
177161
parse("PRESSURE",pres0_);
178-
double pres_min=std::numeric_limits<double>::quiet_NaN(); //-1 might be a meaningful pressure
179-
double pres_max=std::numeric_limits<double>::quiet_NaN();
162+
const double myNone=std::numeric_limits<double>::lowest(); //quiet_NaN is not supported by some intel compiler
163+
double pres_min=myNone; //-1 might be a meaningful pressure
164+
double pres_max=myNone;
180165
parse("PRESSURE_MIN",pres_min);
181166
parse("PRESSURE_MAX",pres_max);
182167
unsigned pres_steps=0;
@@ -197,7 +182,7 @@ ECVmultiThermalBaric::ECVmultiThermalBaric(const ActionOptions&ao)
197182
plumed_massert(temp_steps==0,"cannot set both SET_ALL_TEMP_PRESSURE and TEMP_STEPS");
198183
plumed_massert(pres_steps==0,"cannot set both SET_ALL_TEMP_PRESSURE and PRESSURE_STEPS");
199184
plumed_massert(temp_min==-1 && temp_max==-1,"cannot set both SET_ALL_TEMP_PRESSURE and TEMP_MIN/MAX");
200-
plumed_massert(isNone(pres_min) && isNone(pres_max),"cannot set both SET_ALL_TEMP_PRESSURE and PRESSURE_MIN/MAX");
185+
plumed_massert(pres_min==myNone && pres_max==myNone,"cannot set both SET_ALL_TEMP_PRESSURE and PRESSURE_MIN/MAX");
201186
plumed_massert(cut_corner.size()==0,"cannot set both SET_ALL_TEMP_PRESSURE and CUT_CORNER");
202187
//setup the target temperature-pressure grid
203188
derECVs_beta_.resize(custom_lambdas_.size());
@@ -273,7 +258,7 @@ ECVmultiThermalBaric::ECVmultiThermalBaric(const ActionOptions&ao)
273258
if(pres_.size()>0)
274259
{
275260
plumed_massert(pres_steps==0,"cannot set both PRESSURE_STEPS and PRESSURE_SET_ALL");
276-
plumed_massert(isNone(pres_min) && isNone(pres_max),"cannot set both PRESSURE_SET_ALL and PRESSURE_MIN/MAX");
261+
plumed_massert(pres_min==myNone && pres_max==myNone,"cannot set both PRESSURE_SET_ALL and PRESSURE_MIN/MAX");
277262
plumed_massert(pres_.size()>=2,"set at least 2 pressures");
278263
for(unsigned kk=0; kk<pres_.size()-1; kk++)
279264
plumed_massert(pres_[kk]<=pres_[kk+1],"PRESSURE_SET_ALL must be properly ordered");
@@ -282,12 +267,12 @@ ECVmultiThermalBaric::ECVmultiThermalBaric(const ActionOptions&ao)
282267
}
283268
else
284269
{ //get PRESSURE_MIN and PRESSURE_MAX
285-
if(isNone(pres_min))
270+
if(pres_min==myNone)
286271
{
287272
pres_min=pres0_;
288273
log.printf(" no PRESSURE_MIN provided, using PRESSURE_MIN=PRESSURE\n");
289274
}
290-
if(isNone(pres_max))
275+
if(pres_max==myNone)
291276
{
292277
pres_max=pres0_;
293278
log.printf(" no PRESSURE_MAX provided, using PRESSURE_MAX=PRESSURE\n");

0 commit comments

Comments
 (0)