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

Comparing trunk/OOPSE-3.0/src/io/AtomTypesSectionParser.cpp (file contents):
Revision 1957 by tim, Tue Jan 25 17:45:23 2005 UTC vs.
Revision 2204 by gezelter, Fri Apr 15 22:04:00 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 | AtomTypesSectionParser::AtomTypesSectionParser() {
45   #include "utils/simError.h"
46   namespace oopse {
47  
48 < AtomTypesSectionParser::AtomTypesSectionParser() {
48 >  AtomTypesSectionParser::AtomTypesSectionParser() {
49      setSectionName("AtomTypes");
50 < }
50 >  }
51  
52 < void AtomTypesSectionParser::parseLine(ForceField& ff,const std::string& line, int lineNo){
52 >  void AtomTypesSectionParser::parseLine(ForceField& ff,const std::string& line, int lineNo){
53      StringTokenizer tokenizer(line);
54      int nTokens = tokenizer.countTokens();    
55  
56      //in AtomTypeSection, a line at least contains 2 tokens
57      //atomTypeName and mass
58      if (nTokens < 2)  {
59 <        sprintf(painCave.errMsg, "AtomTypesSectionParser Error: Not enough tokens at line %d\n",
60 <                lineNo);
61 <        painCave.isFatal = 1;
62 <        simError();
59 >      sprintf(painCave.errMsg, "AtomTypesSectionParser Error: Not enough tokens at line %d\n",
60 >              lineNo);
61 >      painCave.isFatal = 1;
62 >      simError();
63              
64      } else {
65  
66 <        std::string atomTypeName = tokenizer.nextToken();    
67 <        AtomType* atomType = ff.getAtomType(atomTypeName);
66 >      std::string atomTypeName = tokenizer.nextToken();    
67 >      AtomType* atomType = ff.getAtomType(atomTypeName);
68  
69 <        if (atomType == NULL) {
70 <            atomType = new AtomType();
71 <            int ident = ff.getNAtomType() + 1;
72 <            atomType->setIdent(ident);
73 <            atomType->setName(atomTypeName);
74 <            ff.addAtomType(atomTypeName, atomType);
75 <        }
69 >      if (atomType == NULL) {
70 >        atomType = new AtomType();
71 >        int ident = ff.getNAtomType() + 1;
72 >        atomType->setIdent(ident);
73 >        atomType->setName(atomTypeName);
74 >        ff.addAtomType(atomTypeName, atomType);
75 >      }
76          
77 <        double mass = tokenizer.nextTokenAsDouble();              
78 <        atomType->setMass(mass);
77 >      double mass = tokenizer.nextTokenAsDouble();              
78 >      atomType->setMass(mass);
79                
80      }    
81  
82  
83 < }
83 >  }
84  
85   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines