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

Comparing trunk/OOPSE-4/src/UseTheForce/EAM_FF.cpp (file contents):
Revision 2093 by gezelter, Wed Mar 9 14:25:51 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 40 | Line 40
40   */
41  
42   #include "UseTheForce/EAM_FF.hpp"
43 + #include "UseTheForce/DarkSide/eam_interface.h"
44   #include "UseTheForce/DarkSide/lj_interface.h"
45   #include "UseTheForce/DarkSide/sticky_interface.h"
46   #include "UseTheForce/ForceFieldFactory.hpp"
47   #include "io/DirectionalAtomTypesSectionParser.hpp"
48   #include "io/AtomTypesSectionParser.hpp"
49   #include "io/LennardJonesAtomTypesSectionParser.hpp"
50 < #include "io/ElectrostaticAtomTypesSectionParser.hpp"
50 > #include "io/ChargeAtomTypesSectionParser.hpp"
51 > #include "io/MultipoleAtomTypesSectionParser.hpp"
52   #include "io/EAMAtomTypesSectionParser.hpp"
53   #include "io/StickyAtomTypesSectionParser.hpp"
54   #include "io/BondTypesSectionParser.hpp"
# Line 56 | Line 58 | EAM_FF::EAM_FF(){
58   #include "utils/simError.h"
59   namespace oopse {
60      
61 < EAM_FF::EAM_FF(){
61 >  EAM_FF::EAM_FF(){
62  
63      //set default force field filename
64      setForceFieldFileName("EAM.frc");
# Line 74 | Line 76 | EAM_FF::EAM_FF(){
76      spMan_.push_back(new DirectionalAtomTypesSectionParser());
77      spMan_.push_back(new AtomTypesSectionParser());
78      spMan_.push_back(new LennardJonesAtomTypesSectionParser());
79 <    spMan_.push_back(new ElectrostaticAtomTypesSectionParser());
79 >    spMan_.push_back(new ChargeAtomTypesSectionParser());
80 >    spMan_.push_back(new MultipoleAtomTypesSectionParser());
81      spMan_.push_back(new EAMAtomTypesSectionParser());
82      spMan_.push_back(new StickyAtomTypesSectionParser());
83      spMan_.push_back(new BondTypesSectionParser());
84      spMan_.push_back(new BendTypesSectionParser());
85      spMan_.push_back(new TorsionTypesSectionParser());
86      
87 < }
87 >  }
88  
89 < void EAM_FF::parse(const std::string& filename) {
89 >  void EAM_FF::parse(const std::string& filename) {
90      ifstrstream* ffStream;
91      ffStream = openForceFieldFile(filename);
92  
# Line 93 | Line 96 | void EAM_FF::parse(const std::string& filename) {
96      AtomType* at;
97  
98      for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) {
99 <        at->makeFortranAtomType();
99 >      at->makeFortranAtomType();
100      }
101  
102      for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) {
103 <        at->complete();
103 >      at->complete();
104      }
102    
103 }
105  
106 +    delete ffStream;
107 +  }
108  
109 < double EAM_FF::getRcutFromAtomType(AtomType* at){
109 >
110 >  double EAM_FF::getRcutFromAtomType(AtomType* at){
111      double rcut = 0.0;    
112      if (at->isEAM()) {
113 <        GenericData* data = at->getPropertyByName("EAM");
114 <        if (data != NULL) {
115 <            EAMParamGenericData* eamData = dynamic_cast<EAMParamGenericData*>(data);
113 >      GenericData* data = at->getPropertyByName("EAM");
114 >      if (data != NULL) {
115 >        EAMParamGenericData* eamData = dynamic_cast<EAMParamGenericData*>(data);
116  
117 <            if (eamData != NULL) {
117 >        if (eamData != NULL) {
118  
119 <                EAMParam& eamParam = eamData->getData();
120 <                rcut =  eamParam.rcut;
121 <            } else {
122 <                    sprintf( painCave.errMsg,
123 <                           "Can not cast GenericData to EAMParam\n");
124 <                    painCave.severity = OOPSE_ERROR;
125 <                    painCave.isFatal = 1;
126 <                    simError();          
127 <            }
128 <        } else {
129 <            sprintf( painCave.errMsg, "Can not find EAM Parameters\n");
130 <            painCave.severity = OOPSE_ERROR;
131 <            painCave.isFatal = 1;
132 <            simError();          
133 <        }
119 >          EAMParam& eamParam = eamData->getData();
120 >          rcut =  eamParam.rcut;
121 >        } else {
122 >          sprintf( painCave.errMsg,
123 >                   "Can not cast GenericData to EAMParam\n");
124 >          painCave.severity = OOPSE_ERROR;
125 >          painCave.isFatal = 1;
126 >          simError();          
127 >        }
128 >      } else {
129 >        sprintf( painCave.errMsg, "Can not find EAM Parameters\n");
130 >        painCave.severity = OOPSE_ERROR;
131 >        painCave.isFatal = 1;
132 >        simError();          
133 >      }
134      }    else {
135 <        rcut = ForceField::getRcutFromAtomType(at);
135 >      rcut = ForceField::getRcutFromAtomType(at);
136      }
137    
138      return rcut;    
139 < }
139 >  }
140  
141 +  EAM_FF::~EAM_FF(){
142 +    // We need to clean up the fortran side so we don't have bad things happen if
143 +    // we try to create a second EAM force field.
144 +    destroyEAMTypes();
145 +  }
146   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines