# | Line 52 | Line 52 | |
---|---|---|
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") | |
# | Line 121 | Line 108 | Globals::Globals(){ | |
108 | DefineOptionalParameter(SurfaceTension, "surfaceTension"); | |
109 | DefineOptionalParameter(PrintPressureTensor, "printPressureTensor"); | |
110 | DefineOptionalParameter(ElectrostaticSummationMethod, "electrostaticSummationMethod"); | |
111 | + | DefineOptionalParameter(ElectrostaticScreeningMethod, "electrostaticScreeningMethod"); |
112 | DefineOptionalParameter(CutoffPolicy, "cutoffPolicy"); | |
113 | < | DefineOptionalParameter(StatFileFormat, "statFileFormat"); |
126 | < | |
113 | > | DefineOptionalParameter(SwitchingFunctionType, "switchingFunctionType"); |
114 | DefineOptionalParameterWithDefaultValue(MixingRule, "mixingRule", "standard"); | |
115 | DefineOptionalParameterWithDefaultValue(UsePeriodicBoundaryConditions, "usePeriodicBoundaryConditions", true); | |
116 | DefineOptionalParameterWithDefaultValue(UseInitalTime, "useInitialTime", false); | |
# | Line 134 | Line 121 | Globals::Globals(){ | |
121 | DefineOptionalParameterWithDefaultValue(ThermIntDistSpringConst, "thermIntDistSpringConst", 6.0); | |
122 | DefineOptionalParameterWithDefaultValue(ThermIntThetaSpringConst, "thermIntThetaSpringConst", 7.5); | |
123 | DefineOptionalParameterWithDefaultValue(ThermIntOmegaSpringConst, "thermIntOmegaSpringConst", 13.5); | |
124 | < | DefineOptionalParameterWithDefaultValue(DampingAlpha, "dampingAlpha", 1.5); |
124 | > | DefineOptionalParameterWithDefaultValue(DampingAlpha, "dampingAlpha", 0.2); |
125 | DefineOptionalParameterWithDefaultValue(CompressDumpFile, "compressDumpFile", 0); | |
126 | + | DefineOptionalParameterWithDefaultValue(OutputForceVector, "outputForceVector", 0); |
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 | + | |
147 | int Globals::globalAssign( event* the_event ){ | |
148 | char errorMessage[65535]; | |
149 | int key; | |
# | Line 338 | Line 342 | char* Globals::checkMe( void ){ | |
342 | CheckParameter(ForceField, isNotEmpty()); | |
343 | CheckParameter(NComponents,isPositive()); | |
344 | CheckParameter(TargetTemp, isPositive()); | |
345 | < | CheckParameter(Ensemble, isEqualIgnoreCase(std::string("NVE")) || isEqualIgnoreCase(std::string("NVT")) || |
342 | < | isEqualIgnoreCase(std::string("NPTi")) || isEqualIgnoreCase(std::string("NPTf"))|| |
343 | < | isEqualIgnoreCase(std::string("NPTxyz")) ); |
344 | < | |
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()); | |
# | Line 385 | Line 386 | char* Globals::checkMe( void ){ | |
386 | CheckParameter(ThermIntThetaSpringConst, isPositive()); | |
387 | CheckParameter(ThermIntOmegaSpringConst, isPositive()); | |
388 | CheckParameter(SurfaceTension, isPositive()); | |
389 | < | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase(std::string("NONE")) || isEqualIgnoreCase(std::string("UNDAMPED_WOLF")) || isEqualIgnoreCase(std::string("DAMPED_WOLF")) || isEqualIgnoreCase(std::string("REACTION_FIELD")) ); |
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()); | |
396 | CheckParameter(ThermIntDistSpringConst, isPositive()); | |
397 | CheckParameter(ThermIntThetaSpringConst, isPositive()); | |
398 | CheckParameter(ThermIntOmegaSpringConst, isPositive()); | |
399 | < | CheckParameter(DampingAlpha,isPositive()); |
399 | > | CheckParameter(DampingAlpha,isNonNegative()); |
400 | CheckParameter(SkinThickness, isPositive()); | |
401 | ||
402 | //@todo memory leak |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |