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

Comparing trunk/OOPSE-4/src/io/DirectionalAtomTypesSectionParser.cpp (file contents):
Revision 1957 by tim, Tue Jan 25 17:45:23 2005 UTC vs.
Revision 2209 by chrisfen, Mon Apr 18 03:50:23 2005 UTC

# Line 1 | Line 1
1 < /*
1 > /*
2   * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3   *
4   * The University of Notre Dame grants you ("Licensee") a
# Line 45 | Line 45 | DirectionalAtomTypesSectionParser::DirectionalAtomType
45   #include "utils/simError.h"
46   namespace oopse {
47  
48 < DirectionalAtomTypesSectionParser::DirectionalAtomTypesSectionParser() {
48 >  DirectionalAtomTypesSectionParser::DirectionalAtomTypesSectionParser() {
49      setSectionName("DirectionalAtomTypes");
50 < }
50 >  }
51  
52 < void DirectionalAtomTypesSectionParser::parseLine(ForceField& ff,const std::string& line, int lineNo){
52 >  void DirectionalAtomTypesSectionParser::parseLine(ForceField& ff,
53 >                                                    const std::string& line,
54 >                                                    int lineNo){
55      StringTokenizer tokenizer(line);
56      int nTokens = tokenizer.countTokens();    
57  
58      //in AtomTypeSection, a line at least contains 2 tokens
59      //atomTypeName and mass
60      if (nTokens < 4)  {
61 <        sprintf(painCave.errMsg, "DirectionalAtomTypesSectionParser Error: Not enough tokens at line %d\n",
62 <                lineNo);
63 <        painCave.isFatal = 1;
64 <        simError();
61 >      sprintf(painCave.errMsg,
62 >              "DirectionalAtomTypesSectionParser Error: Not enough tokens at line %d\n",
63 >              lineNo);
64 >      painCave.isFatal = 1;
65 >      simError();
66                    
67      } else {
68  
69 <        std::string atomTypeName = tokenizer.nextToken();    
70 <        AtomType* atomType = ff.getAtomType(atomTypeName);
71 <        DirectionalAtomType* dAtomType;
72 <        if (atomType == NULL) {
73 <            dAtomType = new DirectionalAtomType();
74 <            int ident = ff.getNAtomType() + 1;
75 <            dAtomType->setIdent(ident);
76 <            dAtomType->setName(atomTypeName);
77 <            ff.addAtomType(atomTypeName, dAtomType);
78 <        } else {
79 <            dAtomType = dynamic_cast<DirectionalAtomType*>(atomType);
80 <            if (dAtomType == NULL) {
81 <                sprintf(painCave.errMsg,"DirectionalAtomTypesSectionParser:: Can not cast to DirectionalAtomType");
82 <                painCave.isFatal = 1;
83 <                simError();
84 <            }
69 >      std::string atomTypeName = tokenizer.nextToken();    
70 >      AtomType* atomType = ff.getAtomType(atomTypeName);
71 >      DirectionalAtomType* dAtomType;
72 >      if (atomType == NULL) {
73 >        dAtomType = new DirectionalAtomType();
74 >        int ident = ff.getNAtomType() + 1;
75 >        dAtomType->setIdent(ident);
76 >        dAtomType->setName(atomTypeName);
77 >        ff.addAtomType(atomTypeName, dAtomType);
78 >      } else {
79 >        dAtomType = dynamic_cast<DirectionalAtomType*>(atomType);
80 >        if (dAtomType == NULL) {
81 >          sprintf(painCave.errMsg,
82 >                  "DirectionalAtomTypesSectionParser:: Can not cast to DirectionalAtomType");
83 >          painCave.isFatal = 1;
84 >          simError();
85          }
86 <
87 <        double Ixx = tokenizer.nextTokenAsDouble();
88 <        double Iyy = tokenizer.nextTokenAsDouble();
89 <        double Izz = tokenizer.nextTokenAsDouble();            
90 <        Mat3x3d inertialMat;
91 <        inertialMat(0, 0) = Ixx;
92 <        inertialMat(1, 1) = Iyy;
93 <        inertialMat(2, 2) = Izz;        
94 <        dAtomType->setI(inertialMat);            
86 >      }
87 >      
88 >      double Ixx = tokenizer.nextTokenAsDouble();
89 >      double Iyy = tokenizer.nextTokenAsDouble();
90 >      double Izz = tokenizer.nextTokenAsDouble();            
91 >      Mat3x3d inertialMat;
92 >      inertialMat(0, 0) = Ixx;
93 >      inertialMat(1, 1) = Iyy;
94 >      inertialMat(2, 2) = Izz;        
95 >      dAtomType->setI(inertialMat);            
96                        
97      }    
98  
99 < }
99 >  }
100  
101   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines