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

Comparing trunk/OOPSE-2.0/src/io/AtomTypesSectionParser.cpp (file contents):
Revision 1957 by tim, Tue Jan 25 17:45:23 2005 UTC vs.
Revision 2257 by tim, Mon Jun 13 18:25:30 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);
79 <              
77 >      double mass = tokenizer.nextTokenAsDouble();              
78 >      atomType->setMass(mass);
79 >      if (tokenizer.hasMoreTokens()) {
80 >          double nelectron = tokenizer.nextTokenAsDouble();
81 >          atomType->addProperty(new DoubleGenericData("nelectron", nelectron));
82 >      }              
83      }    
84  
85  
86 < }
86 >  }
87  
88   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines