ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/primitives/Bond.hpp
(Generate patch)

Comparing trunk/src/primitives/Bond.hpp (file contents):
Revision 246 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
Revision 1309 by gezelter, Tue Oct 21 18:23:31 2008 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 54 | Line 54 | namespace oopse {
54   #include "types/BondType.hpp"
55  
56   namespace oopse {
57 +  
58 +  class Bond {
59 +  public:
60 +    Bond(Atom* atom1, Atom* atom2, BondType* bt) : atom1_(atom1),
61 +                                                   atom2_(atom2),
62 +                                                   bondType_(bt) {}
63 +    virtual ~Bond() {}
64 +    void calcForce() {
65 +      RealType len;
66 +      RealType dvdr;
67 +      Vector3d r12;
68 +      Vector3d force;
69 +      
70 +      r12 = atom2_->getPos() - atom1_->getPos();
71 +      len = r12.length();            
72 +      bondType_->calcForce(len,  potential_, dvdr);
73 +      
74 +      force = r12 * (-dvdr / len);
75  
76 < class Bond {
77 <    public:
78 <        Bond(Atom* atom1, Atom* atom2, BondType* bt) : atom1_(atom1), atom2_(atom2), bondType_(bt) {}
79 <
80 <        void calcForce() {
81 <            double len;
82 <            double dvdr;
83 <            Vector3d r12;
84 <            Vector3d force;
85 <
86 <            r12 = atom2_->getPos() - atom1_->getPos();
87 <            len = r12.length();            
88 <            bondType_->calcForce(len,  potential_, dvdr);
89 <
90 <            force = r12 * (-dvdr / len);
91 <            
92 <            atom1_->addFrc(-force);
93 <            atom2_->addFrc(force);
94 <       }
95 <        
96 <        double getPotential() {
97 <            return potential_;
98 <        }
99 <
100 <        Atom* getAtomA() {
101 <            return atom1_;
102 <        }
103 <
104 <        Atom* getAtomB() {
105 <            return atom2_;
88 <        }
89 <
90 <        BondType* getBondType() {
91 <            return bondType_;
92 <        }
93 <        
94 <    private:
95 <        double potential_;
96 <        Atom* atom1_;
97 <        Atom* atom2_;        
98 <        BondType* bondType_; /**< bond type */
99 <
100 < };    
101 <
102 <
103 <
76 >      atom1_->addFrc(-force);
77 >      atom2_->addFrc(force);
78 >    
79 >      atom1_->addParticlePot(potential_);
80 >      atom2_->addParticlePot(potential_);
81 >    }
82 >    
83 >    RealType getPotential() {
84 >      return potential_;
85 >    }
86 >    
87 >    Atom* getAtomA() {
88 >      return atom1_;
89 >    }
90 >    
91 >    Atom* getAtomB() {
92 >      return atom2_;
93 >    }
94 >    
95 >    BondType* getBondType() {
96 >      return bondType_;
97 >    }
98 >    
99 >  private:
100 >    RealType potential_;
101 >    Atom* atom1_;
102 >    Atom* atom2_;        
103 >    BondType* bondType_; /**< bond type */
104 >    
105 >  };    
106   } //end namespace oopse
107   #endif //PRIMITIVES_BOND_HPP

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines