| 52 |  |  | 
| 53 |  | #include "io/ParamConstraint.hpp" | 
| 54 |  |  | 
| 55 | < | #define DefineParameter(NAME,KEYWORD)                              \ | 
| 56 | < | NAME.setKeyword(KEYWORD);                  \ | 
| 57 | < | parameters_.insert(std::make_pair(std::string(KEYWORD),  &NAME)); | 
| 55 | > | using namespace oopse; | 
| 56 |  |  | 
| 59 | – | #define DefineOptionalParameter(NAME,KEYWORD)                              \ | 
| 60 | – | NAME.setKeyword(KEYWORD); NAME.setOptional(true);                    \ | 
| 61 | – | parameters_.insert(std::make_pair(std::string(KEYWORD),  &NAME)); | 
| 62 | – |  | 
| 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())) { sprintf(painCave.errMsg,"Error in checking %s : should be %s\n",NAME.getKeyword().c_str(),(CONSTRAINT).getConstraintDescription().c_str()); painCave.isFatal = 1; painCave.severity = OOPSE_ERROR; simError();} } | 
| 69 | – |  | 
| 57 |  | Globals::Globals(){ | 
| 58 |  |  | 
| 59 |  | DefineParameter(ForceField, "forceField") | 
| 127 |  | DefineOptionalParameterWithDefaultValue(SkinThickness, "skinThickness", 1.0); | 
| 128 |  | DefineOptionalParameterWithDefaultValue(StatFileFormat, "statFileFormat", "TIME|TOTAL_ENERGY|POTENTIAL_ENERGY|KINETIC_ENERGY|TEMPERATURE|PRESSURE|VOLUME|CONSERVED_QUANTITY"); | 
| 129 |  |  | 
| 130 | + |  | 
| 131 | + | } | 
| 132 | + |  | 
| 133 | + | Globals::~Globals(){ | 
| 134 | + | int i; | 
| 135 | + | if( components != NULL ){ | 
| 136 | + | for( i=0; i< getNComponents(); i++ ) delete components[i]; | 
| 137 | + | delete[] components; | 
| 138 | + | } | 
| 139 | + |  | 
| 140 | + | if( zConstraints != NULL ){ | 
| 141 | + | for( i=0; i< getNZconstraints(); i++ ) delete zConstraints[i]; | 
| 142 | + | delete[] zConstraints; | 
| 143 | + | } | 
| 144 |  |  | 
| 145 |  | } | 
| 146 |  |  | 
| 342 |  | CheckParameter(ForceField, isNotEmpty()); | 
| 343 |  | CheckParameter(NComponents,isPositive()); | 
| 344 |  | CheckParameter(TargetTemp, isPositive()); | 
| 345 | < | CheckParameter(Ensemble, isEqualIgnoreCase(std::string("NVE")) || | 
| 345 | < | isEqualIgnoreCase(std::string("NVT")) || | 
| 346 | < | isEqualIgnoreCase(std::string("NPTi")) || | 
| 347 | < | isEqualIgnoreCase(std::string("NPTf")) || | 
| 348 | < | isEqualIgnoreCase(std::string("NPTxyz")) ); | 
| 345 | > | CheckParameter(Ensemble, isEqualIgnoreCase(std::string("NVE")) || isEqualIgnoreCase(std::string("NVT")) || isEqualIgnoreCase(std::string("NPTi")) || isEqualIgnoreCase(std::string("NPTf")) || isEqualIgnoreCase(std::string("NPTxyz")) ); | 
| 346 |  | CheckParameter(Dt, isPositive()); | 
| 347 |  | CheckParameter(RunTime, isPositive()); | 
| 348 |  | CheckParameter(InitialConfig, isNotEmpty()); | 
| 368 |  | CheckParameter(ZconsTol, isPositive()); | 
| 369 |  | //CheckParameter(ZconsForcePolicy,); | 
| 370 |  | CheckParameter(Seed, isPositive()); | 
| 371 | < | CheckParameter(Minimizer, isEqualIgnoreCase(std::string("SD")) || | 
| 375 | < | isEqualIgnoreCase(std::string("CG"))); | 
| 371 | > | CheckParameter(Minimizer, isEqualIgnoreCase(std::string("SD")) || isEqualIgnoreCase(std::string("CG"))); | 
| 372 |  | CheckParameter(MinimizerMaxIter, isPositive()); | 
| 373 |  | CheckParameter(MinimizerWriteFrq, isPositive()); | 
| 374 |  | CheckParameter(MinimizerStepSize, isPositive()); | 
| 386 |  | CheckParameter(ThermIntThetaSpringConst, isPositive()); | 
| 387 |  | CheckParameter(ThermIntOmegaSpringConst, isPositive()); | 
| 388 |  | CheckParameter(SurfaceTension, isPositive()); | 
| 389 | < | CheckParameter(ElectrostaticSummationMethod, | 
| 390 | < | isEqualIgnoreCase(std::string("NONE")) || | 
| 391 | < | isEqualIgnoreCase(std::string("SHIFTED_POTENTIAL")) || | 
| 392 | < | isEqualIgnoreCase(std::string("SHIFTED_FORCE")) || | 
| 397 | < | isEqualIgnoreCase(std::string("REACTION_FIELD"))); | 
| 398 | < | CheckParameter(ElectrostaticScreeningMethod, | 
| 399 | < | isEqualIgnoreCase(std::string("UNDAMPED")) || | 
| 400 | < | isEqualIgnoreCase(std::string("DAMPED"))); | 
| 401 | < | CheckParameter(CutoffPolicy, isEqualIgnoreCase(std::string("MIX")) || | 
| 402 | < | isEqualIgnoreCase(std::string("MAX")) || | 
| 403 | < | isEqualIgnoreCase(std::string("TRADITIONAL"))); | 
| 404 | < | CheckParameter(SwitchingFunctionType, | 
| 405 | < | isEqualIgnoreCase(std::string("CUBIC")) || | 
| 406 | < | isEqualIgnoreCase(std::string("FIFTH_ORDER_POLYNOMIAL"))); | 
| 389 | > | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase(std::string("NONE")) || isEqualIgnoreCase(std::string("SHIFTED_POTENTIAL")) || isEqualIgnoreCase(std::string("SHIFTED_FORCE")) || isEqualIgnoreCase(std::string("REACTION_FIELD"))); | 
| 390 | > | CheckParameter(ElectrostaticScreeningMethod, isEqualIgnoreCase(std::string("UNDAMPED")) || isEqualIgnoreCase(std::string("DAMPED"))); | 
| 391 | > | CheckParameter(CutoffPolicy, isEqualIgnoreCase(std::string("MIX")) || isEqualIgnoreCase(std::string("MAX")) || isEqualIgnoreCase(std::string("TRADITIONAL"))); | 
| 392 | > | CheckParameter(SwitchingFunctionType, isEqualIgnoreCase(std::string("CUBIC")) || isEqualIgnoreCase(std::string("FIFTH_ORDER_POLYNOMIAL"))); | 
| 393 |  | //CheckParameter(StatFileFormat,); | 
| 394 |  | //CheckParameter(MixingRule,); | 
| 395 |  | CheckParameter(OrthoBoxTolerance, isPositive()); |