ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/io/BondTypesSectionParser.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-4/src/io/BondTypesSectionParser.cpp (file contents):
Revision 1790 by tim, Mon Nov 29 15:50:05 2004 UTC vs.
Revision 1800 by tim, Tue Nov 30 04:14:43 2004 UTC

# Line 29 | Line 29
29   #include "types/CubicBondType.hpp"
30   #include "types/QuarticBondType.hpp"
31   #include "types/PolynomialBondType.hpp"
32 <
32 > #include "UseTheForce/ForceField.hpp"
33   namespace oopse {
34  
35   BondTypesSectionParser::BondTypesSectionParser() {
36      setSectionName("BondTypes");
37 +
38 +    stringToEnumMap_["Fixed"] =  btFixed;                
39 +    stringToEnumMap_["Harmonic"] =  btHarmonic;                                
40 +    stringToEnumMap_["Cubic"] = btCubic;
41 +    stringToEnumMap_["Quartic"] = btQuartic;
42 +    stringToEnumMap_["Polynomial"] = btPolynomial;
43   }
44  
45   void BondTypesSectionParser::parseLine(ForceField& ff,const std::string& line, int lineNo){
# Line 53 | Line 59 | void BondTypesSectionParser::parseLine(ForceField& ff,
59      
60      at1 = tokenizer.nextToken();
61      at2 = tokenizer.nextToken();
62 <    bt = tokenizer.nextToken();
62 >    BondTypeEnum bt = getTorsionTypeEnum(tokenizer.nextToken());
63      b0 = tokenizer.nextTokenAsDouble();
64      nTokens -= 4;
65  
66      //switch is a maintain nightmare
67      switch(bt) {
68 <        case "Fixed" :
68 >        case btFixed :
69              bondType = new FixedBondType();
70              break;
71              
72 <        case "Harmonic" :
72 >        case btHarmonic :
73              if (nTokens < 1) {
74  
75              } else {
# Line 74 | Line 80 | void BondTypesSectionParser::parseLine(ForceField& ff,
80  
81              break;
82  
83 <        case "Cubic" :
83 >        case btCubic :
84              if (nTokens < 4) {
85  
86              } else {
# Line 88 | Line 94 | void BondTypesSectionParser::parseLine(ForceField& ff,
94              }
95              break;
96              
97 <        case "Quartic" :
97 >        case btQuartic :
98              if (nTokens < 5) {
99  
100              } else {
# Line 104 | Line 110 | void BondTypesSectionParser::parseLine(ForceField& ff,
110              }
111              break;
112  
113 <        case "Polynomial" :
113 >        case btPolynomial :
114              if (nTokens < 2 || nTokens % 2 != 0) {
115  
116              } else {
# Line 132 | Line 138 | void BondTypesSectionParser::parseLine(ForceField& ff,
138  
139   }
140  
141 + BondTypeEnum BondTypesSectionParser::getTorsionTypeEnum(const std::string& str) {
142 +    std::map<std::string, BondTypeEnum>::iterator i;
143 +    i = stringToEnumMap_.find(str);
144 +
145 +    return i == stringToEnumMap_.end() ? TorsionTypesSectionParser::ttUnknown : i->second;
146 + }
147 +
148   } //end namespace oopse
149  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines