| 50 |  | #include "io/mpiBASS.h" | 
| 51 |  | #endif // is_mpi | 
| 52 |  |  | 
| 53 | + | #include "io/ParamConstraint.hpp" | 
| 54 |  |  | 
| 55 |  | #define DefineParameter(NAME,KEYWORD)                              \ | 
| 56 |  | NAME.setKeyword(KEYWORD);                  \ | 
| 63 |  | #define DefineOptionalParameterWithDefaultValue(NAME,KEYWORD, DEFAULTVALUE)                              \ | 
| 64 |  | NAME.setKeyword(KEYWORD); NAME.setOptional(true); NAME.setDefaultValue(DEFAULTVALUE);                      \ | 
| 65 |  | parameters_.insert(std::make_pair(std::string(KEYWORD),  &NAME)); | 
| 66 | + |  | 
| 67 | + | #define CheckParameter(NAME, CONSTRAINT)                              \ | 
| 68 | + | if (!NAME.empty()) { if (!(CONSTRAINT)(NAME.getData())) std::cout <<"Error in parsing " << NAME.getKeyword() << " : "<< (CONSTRAINT).getConstraintDescription() << std::endl; } | 
| 69 | + |  | 
| 70 |  |  | 
| 71 |  | Globals::Globals(){ | 
| 72 |  |  | 
| 132 |  | DefineOptionalParameterWithDefaultValue(OrthoBoxTolerance, "orthoBoxTolerance", 1E-6); | 
| 133 |  | DefineOptionalParameterWithDefaultValue(UseSolidThermInt, "useSolidThermInt", false); | 
| 134 |  | DefineOptionalParameterWithDefaultValue(UseLiquidThermInt, "useLiquidThermInt", false); | 
| 135 | + | DefineOptionalParameterWithDefaultValue(ThermIntDistSpringConst, "thermIntDistSpringConst", 6.0); | 
| 136 | + | DefineOptionalParameterWithDefaultValue(ThermIntThetaSpringConst, "thermIntThetaSpringConst", 7.5); | 
| 137 | + | DefineOptionalParameterWithDefaultValue(ThermIntOmegaSpringConst, "thermIntOmegaSpringConst", 13.5); | 
| 138 |  | DefineOptionalParameterWithDefaultValue(DampingAlpha, "dampingAlpha", 1.5); | 
| 139 |  | DefineOptionalParameterWithDefaultValue(CompressDumpFile, "compressDumpFile", 0); | 
| 140 |  | DefineOptionalParameterWithDefaultValue(SkinThickness, "skinThickness", 1.0); | 
| 330 |  | } | 
| 331 |  | } | 
| 332 |  |  | 
| 333 | + | CheckParameter(ForceField, isNotEmpty()); | 
| 334 | + | CheckParameter(NComponents,isPositive()); | 
| 335 | + | CheckParameter(TargetTemp, isPositive()); | 
| 336 | + | CheckParameter(Ensemble, isEqualIgnoreCase(std::string("NVE")) || isEqualIgnoreCase(std::string("NVT")) || | 
| 337 | + | isEqualIgnoreCase(std::string("NPTi")) || isEqualIgnoreCase(std::string("NPTf"))|| | 
| 338 | + | isEqualIgnoreCase(std::string("NPTxyz")) ); | 
| 339 | + |  | 
| 340 | + | CheckParameter(Dt, isPositive()); | 
| 341 | + | CheckParameter(RunTime, isPositive()); | 
| 342 | + | CheckParameter(InitialConfig, isNotEmpty()); | 
| 343 | + | CheckParameter(FinalConfig, isNotEmpty()); | 
| 344 | + | CheckParameter(NMol, isPositive()); | 
| 345 | + | CheckParameter(Density, isPositive()); | 
| 346 | + | CheckParameter(Box, isPositive()); | 
| 347 | + | CheckParameter(BoxX, isPositive()); | 
| 348 | + | CheckParameter(BoxY, isPositive()); | 
| 349 | + | CheckParameter(BoxZ, isPositive()); | 
| 350 | + | CheckParameter(SampleTime, isNonNegative()); | 
| 351 | + | CheckParameter(ResetTime, isNonNegative()); | 
| 352 | + | CheckParameter(StatusTime, isNonNegative()); | 
| 353 | + | CheckParameter(CutoffRadius, isPositive()); | 
| 354 | + | CheckParameter(SwitchingRadius, isNonNegative()); | 
| 355 | + | CheckParameter(Dielectric, isPositive()); | 
| 356 | + | CheckParameter(ThermalTime,  isNonNegative()); | 
| 357 | + | CheckParameter(TargetPressure,  isPositive()); | 
| 358 | + | CheckParameter(TauThermostat, isPositive()); | 
| 359 | + | CheckParameter(TauBarostat, isPositive()); | 
| 360 | + | CheckParameter(ZconsTime, isPositive()); | 
| 361 | + | CheckParameter(NZconstraints, isPositive()); | 
| 362 | + | CheckParameter(ZconsTol, isPositive()); | 
| 363 | + | //CheckParameter(ZconsForcePolicy,); | 
| 364 | + | CheckParameter(Seed, isPositive()); | 
| 365 | + | CheckParameter(Minimizer, isEqualIgnoreCase(std::string("SD")) || isEqualIgnoreCase(std::string("CG"))); | 
| 366 | + | CheckParameter(MinimizerMaxIter, isPositive()); | 
| 367 | + | CheckParameter(MinimizerWriteFrq, isPositive()); | 
| 368 | + | CheckParameter(MinimizerStepSize, isPositive()); | 
| 369 | + | CheckParameter(MinimizerFTol, isPositive()); | 
| 370 | + | CheckParameter(MinimizerGTol, isPositive()); | 
| 371 | + | CheckParameter(MinimizerLSTol, isPositive()); | 
| 372 | + | CheckParameter(MinimizerLSMaxIter, isPositive()); | 
| 373 | + | CheckParameter(ZconsGap, isPositive()); | 
| 374 | + | CheckParameter(ZconsFixtime, isPositive()); | 
| 375 | + | CheckParameter(ThermodynamicIntegrationLambda, isPositive()); | 
| 376 | + | CheckParameter(ThermodynamicIntegrationK, isPositive()); | 
| 377 | + | CheckParameter(ForceFieldVariant, isNotEmpty()); | 
| 378 | + | CheckParameter(ForceFieldFileName, isNotEmpty()); | 
| 379 | + | CheckParameter(ThermIntDistSpringConst, isPositive()); | 
| 380 | + | CheckParameter(ThermIntThetaSpringConst, isPositive()); | 
| 381 | + | CheckParameter(ThermIntOmegaSpringConst, isPositive()); | 
| 382 | + | CheckParameter(SurfaceTension, isPositive()); | 
| 383 | + | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase(std::string("NONE")) || isEqualIgnoreCase(std::string("UNDAMPED_WOLF")) || isEqualIgnoreCase(std::string("DAMPED_WOLF")) || isEqualIgnoreCase(std::string("REACTION_FIELD")) ); | 
| 384 | + | CheckParameter(CutoffPolicy, isEqualIgnoreCase(std::string("MIX")) || isEqualIgnoreCase(std::string("MAX")) || isEqualIgnoreCase(std::string("TRADITIONAL"))); | 
| 385 | + | //CheckParameter(StatFileFormat,); | 
| 386 | + | //CheckParameter(MixingRule,); | 
| 387 | + | CheckParameter(OrthoBoxTolerance, isPositive()); | 
| 388 | + | CheckParameter(ThermIntDistSpringConst, isPositive()); | 
| 389 | + | CheckParameter(ThermIntThetaSpringConst, isPositive()); | 
| 390 | + | CheckParameter(ThermIntOmegaSpringConst, isPositive()); | 
| 391 | + | CheckParameter(DampingAlpha,isPositive()); | 
| 392 | + | CheckParameter(SkinThickness, isPositive()); | 
| 393 | + |  | 
| 394 |  | //@todo memory leak | 
| 395 |  | if( have_err ) | 
| 396 |  | return strdup( err.c_str() ); |