| 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; } | 
| 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 |  |  | 
| 70 | – |  | 
| 70 |  | Globals::Globals(){ | 
| 71 |  |  | 
| 72 |  | DefineParameter(ForceField, "forceField") | 
| 121 |  | DefineOptionalParameter(SurfaceTension, "surfaceTension"); | 
| 122 |  | DefineOptionalParameter(PrintPressureTensor, "printPressureTensor"); | 
| 123 |  | DefineOptionalParameter(ElectrostaticSummationMethod, "electrostaticSummationMethod"); | 
| 124 | + | DefineOptionalParameter(ElectrostaticScreeningMethod, "electrostaticScreeningMethod"); | 
| 125 |  | DefineOptionalParameter(CutoffPolicy, "cutoffPolicy"); | 
| 126 | – | DefineOptionalParameter(StatFileFormat, "statFileFormat"); | 
| 126 |  |  | 
| 127 |  | DefineOptionalParameterWithDefaultValue(MixingRule, "mixingRule", "standard"); | 
| 128 |  | DefineOptionalParameterWithDefaultValue(UsePeriodicBoundaryConditions, "usePeriodicBoundaryConditions", true); | 
| 134 |  | DefineOptionalParameterWithDefaultValue(ThermIntDistSpringConst, "thermIntDistSpringConst", 6.0); | 
| 135 |  | DefineOptionalParameterWithDefaultValue(ThermIntThetaSpringConst, "thermIntThetaSpringConst", 7.5); | 
| 136 |  | DefineOptionalParameterWithDefaultValue(ThermIntOmegaSpringConst, "thermIntOmegaSpringConst", 13.5); | 
| 137 | < | DefineOptionalParameterWithDefaultValue(DampingAlpha, "dampingAlpha", 1.5); | 
| 137 | > | DefineOptionalParameterWithDefaultValue(DampingAlpha, "dampingAlpha", 0.2); | 
| 138 |  | DefineOptionalParameterWithDefaultValue(CompressDumpFile, "compressDumpFile", 0); | 
| 139 | + | DefineOptionalParameterWithDefaultValue(DumpForceVector, "dumpForceVector", 0); | 
| 140 |  | DefineOptionalParameterWithDefaultValue(SkinThickness, "skinThickness", 1.0); | 
| 141 | + | DefineOptionalParameterWithDefaultValue(StatFileFormat, "statFileFormat", "TIME|TOTAL_ENERGY|POTENTIAL_ENERGY|KINETIC_ENERGY|TEMPERATURE|PRESSURE|VOLUME|CONSERVED_QUANTITY"); | 
| 142 | + |  | 
| 143 |  |  | 
| 144 |  | } | 
| 145 |  |  | 
| 146 |  | int Globals::globalAssign( event* the_event ){ | 
| 147 | < |  | 
| 147 | > | char errorMessage[65535]; | 
| 148 |  | int key; | 
| 147 | – | int token; | 
| 149 |  | interface_assign_type the_type =  the_event->evt.asmt.asmt_type; | 
| 150 |  | char* lhs = the_event->evt.asmt.lhs; | 
| 151 |  | std::string keyword(lhs); | 
| 152 |  |  | 
| 153 | < | bool result; | 
| 153 | > | bool result = false; | 
| 154 |  |  | 
| 155 | < |  | 
| 155 | > | /**@todo fix memory leak */ | 
| 156 |  | ParamMap::iterator i =parameters_.find(keyword); | 
| 157 |  | if (i != parameters_.end()) { | 
| 158 |  | if( the_type == STRING ){ | 
| 159 |  | result = i->second->setData(std::string(the_event->evt.asmt.rhs.sval)); | 
| 160 |  | if (!result ) { | 
| 161 | < | sprintf(the_event->err_msg, "Error in parsing meta-data file!\n\t%s must be a string.\n", keyword.c_str() ); | 
| 161 | > | sprintf(errorMessage, "Error in parsing %s: expect %s, but get a string \"%s\".\n", keyword.c_str(), i->second->getParamType().c_str(), the_event->evt.asmt.rhs.sval); | 
| 162 | > | the_event->err_msg = strdup(errorMessage); | 
| 163 |  | } | 
| 164 |  | } else if( the_type == DOUBLE ){ | 
| 165 |  | result = i->second->setData(the_event->evt.asmt.rhs.dval); | 
| 166 |  | if (!result ) | 
| 167 | < | sprintf(the_event->err_msg, "Error in parsing meta-data file!\n\t%s must be a double.\n", keyword.c_str() ); | 
| 167 | > | sprintf(errorMessage, "Error in parsing %s: expect %s, but get a double %f.\n", keyword.c_str(), i->second->getParamType().c_str(), the_event->evt.asmt.rhs.dval ); | 
| 168 | > | the_event->err_msg = strdup(errorMessage); | 
| 169 |  | } | 
| 170 |  | else if (the_type == INT ){ | 
| 171 |  | result = i->second->setData(the_event->evt.asmt.rhs.ival); | 
| 172 |  | if (!result ) | 
| 173 | < | sprintf(the_event->err_msg,  "Error in parsing meta-data file!\n\t%s must be an int.\n", keyword.c_str() ); | 
| 173 | > | sprintf(errorMessage,  "Error in parsing %s: expect %s, but get an int %d.\n", keyword.c_str(), i->second->getParamType().c_str(), the_event->evt.asmt.rhs.ival ); | 
| 174 | > | the_event->err_msg = strdup(errorMessage); | 
| 175 |  |  | 
| 176 |  | } else { | 
| 177 | < |  | 
| 177 | > | sprintf(errorMessage,  "Internal error of parser\n"); | 
| 178 | > | the_event->err_msg = strdup(errorMessage); | 
| 179 |  | } | 
| 180 | + | } else { | 
| 181 | + | sprintf(errorMessage,  "%s is an unrecognized keyword\n", keyword.c_str() ); | 
| 182 | + | the_event->err_msg = strdup(errorMessage); | 
| 183 |  | } | 
| 184 |  |  | 
| 185 |  | if (keyword == "nComponents" && getNComponents() > 0) { | 
| 344 |  | CheckParameter(Ensemble, isEqualIgnoreCase(std::string("NVE")) || isEqualIgnoreCase(std::string("NVT")) || | 
| 345 |  | isEqualIgnoreCase(std::string("NPTi")) || isEqualIgnoreCase(std::string("NPTf"))|| | 
| 346 |  | isEqualIgnoreCase(std::string("NPTxyz")) ); | 
| 339 | – |  | 
| 347 |  | CheckParameter(Dt, isPositive()); | 
| 348 |  | CheckParameter(RunTime, isPositive()); | 
| 349 |  | CheckParameter(InitialConfig, isNotEmpty()); | 
| 387 |  | CheckParameter(ThermIntThetaSpringConst, isPositive()); | 
| 388 |  | CheckParameter(ThermIntOmegaSpringConst, isPositive()); | 
| 389 |  | CheckParameter(SurfaceTension, isPositive()); | 
| 390 | < | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase(std::string("NONE")) || isEqualIgnoreCase(std::string("UNDAMPED_WOLF")) || isEqualIgnoreCase(std::string("DAMPED_WOLF")) || isEqualIgnoreCase(std::string("REACTION_FIELD")) ); | 
| 390 | > | CheckParameter(ElectrostaticSummationMethod, isEqualIgnoreCase(std::string("NONE")) || isEqualIgnoreCase(std::string("SHIFTED_POTENTIAL")) || isEqualIgnoreCase(std::string("SHIFTED_FORCE"))  || isEqualIgnoreCase(std::string("REACTION_FIELD"))); | 
| 391 | > | CheckParameter(ElectrostaticScreeningMethod, isEqualIgnoreCase(std::string("UNDAMPED")) || isEqualIgnoreCase(std::string("DAMPED"))); | 
| 392 |  | CheckParameter(CutoffPolicy, isEqualIgnoreCase(std::string("MIX")) || isEqualIgnoreCase(std::string("MAX")) || isEqualIgnoreCase(std::string("TRADITIONAL"))); | 
| 393 |  | //CheckParameter(StatFileFormat,); | 
| 394 |  | //CheckParameter(MixingRule,); | 
| 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 |