ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/brains/ForceField.cpp
(Generate patch)

Comparing trunk/src/UseTheForce/ForceField.cpp (file contents):
Revision 1194 by chuckv, Fri Jul 6 18:15:03 2007 UTC vs.
Revision 1195 by cpuglis, Thu Dec 6 20:04:02 2007 UTC

# Line 78 | Line 78 | namespace oopse {
78      return atomTypeCont_.find(keys);
79    }
80  
81 <  BondType* ForceField::getBondType(const std::string &at1, const std::string &at2) {
81 >  BondType* ForceField::getBondType(const std::string &at1,
82 >                                    const std::string &at2) {
83      std::vector<std::string> keys;
84      keys.push_back(at1);
85      keys.push_back(at2);    
# Line 91 | Line 92 | namespace oopse {
92        //if no exact match found, try wild card match
93        return bondTypeCont_.find(keys, wildCardAtomTypeName_);
94      }
94
95    }
96  
97 <  BendType* ForceField::getBendType(const std::string &at1, const std::string &at2,
97 >  BendType* ForceField::getBendType(const std::string &at1,
98 >                                    const std::string &at2,
99                                      const std::string &at3) {
100      std::vector<std::string> keys;
101      keys.push_back(at1);
# Line 111 | Line 112 | namespace oopse {
112      }
113    }
114  
115 <  TorsionType* ForceField::getTorsionType(const std::string &at1, const std::string &at2,
116 <                                          const std::string &at3, const std::string &at4) {
115 >  TorsionType* ForceField::getTorsionType(const std::string &at1,
116 >                                          const std::string &at2,
117 >                                          const std::string &at3,
118 >                                          const std::string &at4) {
119      std::vector<std::string> keys;
120      keys.push_back(at1);
121      keys.push_back(at2);    
# Line 128 | Line 131 | namespace oopse {
131      }
132      
133      return torsionTypeCont_.find(keys, wildCardAtomTypeName_);
131
134    }
135  
136    NonBondedInteractionType* ForceField::getNonBondedInteractionType(const std::string &at1, const std::string &at2) {
137      std::vector<std::string> keys;
138      keys.push_back(at1);
139      keys.push_back(at2);    
140 <
140 >    
141      //try exact match first
142      NonBondedInteractionType* nbiType = nonBondedInteractionTypeCont_.find(keys);
143      if (nbiType) {
# Line 143 | Line 145 | namespace oopse {
145      } else {
146        //if no exact match found, try wild card match
147        return nonBondedInteractionTypeCont_.find(keys, wildCardAtomTypeName_);
148 <    }
147 <
148 >    }    
149    }
150 <
151 <  BondType* ForceField::getExactBondType(const std::string &at1, const std::string &at2){
150 >  
151 >  BondType* ForceField::getExactBondType(const std::string &at1,
152 >                                         const std::string &at2){
153      std::vector<std::string> keys;
154      keys.push_back(at1);
155      keys.push_back(at2);    
156      return bondTypeCont_.find(keys);
157    }
158 <
159 <  BendType* ForceField::getExactBendType(const std::string &at1, const std::string &at2,
158 >  
159 >  BendType* ForceField::getExactBendType(const std::string &at1,
160 >                                         const std::string &at2,
161                                           const std::string &at3){
162      std::vector<std::string> keys;
163      keys.push_back(at1);
# Line 162 | Line 165 | namespace oopse {
165      keys.push_back(at3);    
166      return bendTypeCont_.find(keys);
167    }
168 <
169 <  TorsionType* ForceField::getExactTorsionType(const std::string &at1, const std::string &at2,
170 <                                               const std::string &at3, const std::string &at4){
168 >  
169 >  TorsionType* ForceField::getExactTorsionType(const std::string &at1,
170 >                                               const std::string &at2,
171 >                                               const std::string &at3,
172 >                                               const std::string &at4){
173      std::vector<std::string> keys;
174      keys.push_back(at1);
175      keys.push_back(at2);    
# Line 187 | Line 192 | namespace oopse {
192      return atomTypeCont_.add(keys, atomType);
193    }
194  
195 <  bool ForceField::addBondType(const std::string &at1, const std::string &at2, BondType* bondType) {
195 >  bool ForceField::addBondType(const std::string &at1, const std::string &at2,
196 >                               BondType* bondType) {
197      std::vector<std::string> keys;
198      keys.push_back(at1);
199      keys.push_back(at2);    
200 <    return bondTypeCont_.add(keys, bondType);
195 <
200 >    return bondTypeCont_.add(keys, bondType);    
201    }
202 <
202 >  
203    bool ForceField::addBendType(const std::string &at1, const std::string &at2,
204                                 const std::string &at3, BendType* bendType) {
205      std::vector<std::string> keys;
# Line 203 | Line 208 | namespace oopse {
208      keys.push_back(at3);    
209      return bendTypeCont_.add(keys, bendType);
210    }
211 <
212 <  bool ForceField::addTorsionType(const std::string &at1, const std::string &at2,
213 <                                  const std::string &at3, const std::string &at4, TorsionType* torsionType) {
211 >  
212 >  bool ForceField::addTorsionType(const std::string &at1,
213 >                                  const std::string &at2,
214 >                                  const std::string &at3,
215 >                                  const std::string &at4,
216 >                                  TorsionType* torsionType) {
217      std::vector<std::string> keys;
218      keys.push_back(at1);
219      keys.push_back(at2);    
# Line 214 | Line 222 | namespace oopse {
222      return torsionTypeCont_.add(keys, torsionType);
223    }
224  
225 <  bool ForceField::addNonBondedInteractionType(const std::string &at1, const std::string &at2, NonBondedInteractionType* nbiType) {
225 >  bool ForceField::addNonBondedInteractionType(const std::string &at1,
226 >                                               const std::string &at2,
227 >                                               NonBondedInteractionType* nbiType) {
228      std::vector<std::string> keys;
229      keys.push_back(at1);
230      keys.push_back(at2);    
231      return nonBondedInteractionTypeCont_.add(keys, nbiType);
222
232    }
233 <
233 >  
234    RealType ForceField::getRcutFromAtomType(AtomType* at) {
235      /**@todo */
236      GenericData* data;
237      RealType rcut = 0.0;
238 <
238 >    
239      if (at->isLennardJones()) {
240        data = at->getPropertyByName("LennardJones");
241        if (data != NULL) {
242          LJParamGenericData* ljData = dynamic_cast<LJParamGenericData*>(data);
243 <
243 >        
244          if (ljData != NULL) {
245            LJParam ljParam = ljData->getData();
246 <
246 >          
247            //by default use 2.5*sigma as cutoff radius
248            rcut = 2.5 * ljParam.sigma;
249 <                
249 >          
250          } else {
251            sprintf( painCave.errMsg,
252                     "Can not cast GenericData to LJParam\n");
# Line 252 | Line 261 | namespace oopse {
261          simError();          
262        }
263      }
255
264      return rcut;    
265    }
266 +  
267  
259
268    ifstrstream* ForceField::openForceFieldFile(const std::string& filename) {
269      std::string forceFieldFilename(filename);
270      ifstrstream* ffStream = new ifstrstream();
# Line 283 | Line 291 | namespace oopse {
291          simError();
292        }
293      }  
286
294      return ffStream;
288
295    }
296  
297    void ForceField::setFortranForceOptions(){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines