--- trunk/OOPSE-2.0/src/io/StickyAtomTypesSectionParser.cpp 2005/01/25 17:45:23 1957 +++ trunk/OOPSE-2.0/src/io/StickyAtomTypesSectionParser.cpp 2005/04/15 22:04:00 2204 @@ -1,4 +1,4 @@ - /* +/* * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. * * The University of Notre Dame grants you ("Licensee") a @@ -46,60 +46,60 @@ StickyAtomTypesSectionParser::StickyAtomTypesSectionPa #include "utils/simError.h" namespace oopse { -StickyAtomTypesSectionParser::StickyAtomTypesSectionParser() { + StickyAtomTypesSectionParser::StickyAtomTypesSectionParser() { setSectionName("StickyAtomTypes"); -} + } -void StickyAtomTypesSectionParser::parseLine(ForceField& ff,const std::string& line, int lineNo){ + void StickyAtomTypesSectionParser::parseLine(ForceField& ff,const std::string& line, int lineNo){ StringTokenizer tokenizer(line); int nTokens = tokenizer.countTokens(); //in AtomTypeSection, a line at least contains 8 tokens //atomTypeName and 7 different sticky parameters if (nTokens < 8) { - sprintf(painCave.errMsg, "StickyAtomTypesSectionParser Error: Not enough tokens at line %d\n", - lineNo); - painCave.isFatal = 1; - simError(); + sprintf(painCave.errMsg, "StickyAtomTypesSectionParser Error: Not enough tokens at line %d\n", + lineNo); + painCave.isFatal = 1; + simError(); } else { - std::string atomTypeName = tokenizer.nextToken(); - AtomType* atomType = ff.getAtomType(atomTypeName); + std::string atomTypeName = tokenizer.nextToken(); + AtomType* atomType = ff.getAtomType(atomTypeName); - if (atomType != NULL) { - DirectionalAtomType* dAtomType = dynamic_cast(atomType); + if (atomType != NULL) { + DirectionalAtomType* dAtomType = dynamic_cast(atomType); - if (dAtomType != NULL) { - StickyParam sticky; - sticky.w0 = tokenizer.nextTokenAsDouble(); - sticky.v0 = tokenizer.nextTokenAsDouble(); - sticky.v0p = tokenizer.nextTokenAsDouble(); - sticky.rl = tokenizer.nextTokenAsDouble(); - sticky.ru = tokenizer.nextTokenAsDouble(); - sticky.rlp = tokenizer.nextTokenAsDouble(); - sticky.rup = tokenizer.nextTokenAsDouble(); + if (dAtomType != NULL) { + StickyParam sticky; + sticky.w0 = tokenizer.nextTokenAsDouble(); + sticky.v0 = tokenizer.nextTokenAsDouble(); + sticky.v0p = tokenizer.nextTokenAsDouble(); + sticky.rl = tokenizer.nextTokenAsDouble(); + sticky.ru = tokenizer.nextTokenAsDouble(); + sticky.rlp = tokenizer.nextTokenAsDouble(); + sticky.rup = tokenizer.nextTokenAsDouble(); - dAtomType->addProperty(new StickyParamGenericData("Sticky", sticky)); - dAtomType->setSticky(); - } else { - sprintf(painCave.errMsg, "StickyAtomTypesSectionParser Error: Not enough tokens at line %d\n", - lineNo); - painCave.isFatal = 1; - simError(); - std::cerr << "StickyAtomTypesSectionParser Warning:" << std::endl; - } - } else { - sprintf(painCave.errMsg, "StickyAtomTypesSectionParser Error: Can not find matched AtomType %s\n", - atomTypeName.c_str()); - painCave.isFatal = 1; - simError(); + dAtomType->addProperty(new StickyParamGenericData("Sticky", sticky)); + dAtomType->setSticky(); + } else { + sprintf(painCave.errMsg, "StickyAtomTypesSectionParser Error: Not enough tokens at line %d\n", + lineNo); + painCave.isFatal = 1; + simError(); + std::cerr << "StickyAtomTypesSectionParser Warning:" << std::endl; + } + } else { + sprintf(painCave.errMsg, "StickyAtomTypesSectionParser Error: Can not find matched AtomType %s\n", + atomTypeName.c_str()); + painCave.isFatal = 1; + simError(); - } + } } -} + } } //end namespace oopse