ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/io/LennardJonesAtomTypesSectionParser.cpp
(Generate patch)

Comparing trunk/OOPSE-2.0/src/io/LennardJonesAtomTypesSectionParser.cpp (file contents):
Revision 1930 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
Revision 2062 by tim, Fri Feb 25 21:22:00 2005 UTC

# Line 42 | Line 42 | namespace oopse {
42   #include "io/LennardJonesAtomTypesSectionParser.hpp"
43   #include "types/AtomType.hpp"
44   #include "UseTheForce/ForceField.hpp"
45 + #include "utils/simError.h"
46   namespace oopse {
47  
48   LennardJonesAtomTypesSectionParser::LennardJonesAtomTypesSectionParser() {
# Line 52 | Line 53 | void LennardJonesAtomTypesSectionParser::parseLine(For
53      StringTokenizer tokenizer(line);
54      int nTokens = tokenizer.countTokens();    
55  
56 <    //in AtomTypeSection, a line at least contains 2 tokens
57 <    //atomTypeName and mass
56 >    //in LennardJonesAtomTypesSectionParser, a line at least contains 3 tokens
57 >    //atomTypeName, epsilon and sigma
58      if (nTokens < 3)  {
59 <                      
59 >        sprintf(painCave.errMsg, "LennardJonesAtomTypesSectionParser Error: Not enough tokens at line %d\n",
60 >                lineNo);
61 >        painCave.isFatal = 1;
62 >        simError();                    
63      } else {
64  
65          std::string atomTypeName = tokenizer.nextToken();    
# Line 65 | Line 69 | void LennardJonesAtomTypesSectionParser::parseLine(For
69              LJParam ljParam;                        
70              ljParam.epsilon = tokenizer.nextTokenAsDouble();
71              ljParam.sigma = tokenizer.nextTokenAsDouble();
72 +            ljParam.soft_pot = 0;
73 +
74 +            if (tokenizer.hasMoreTokens()) {
75 +                std::string pot_type = tokenizer.nextToken();
76 +                if (pot_type == "soft") {
77 +                    ljParam.soft_pot = 1;
78 +                }
79 +            }
80 +            
81              atomType->addProperty(new LJParamGenericData("LennardJones", ljParam));
82              atomType->setLennardJones();
83 +        }else {
84 +            sprintf(painCave.errMsg, "LennardJonesAtomTypesSectionParser Error: Atom Type [%s] is not created yet\n", atomTypeName.c_str());
85 +            painCave.isFatal = 1;
86 +            simError();    
87          }
88                        
89      }    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines