ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/primitives/Bond.hpp
(Generate patch)

Comparing branches/new_design/OOPSE-3.0/src/primitives/Bond.hpp (file contents):
Revision 1694 by tim, Mon Nov 1 21:40:42 2004 UTC vs.
Revision 1803 by tim, Tue Nov 30 17:54:22 2004 UTC

# Line 34 | Line 34 | namespace oopse {
34   #ifndef PRIMITIVES_BOND_HPP
35   #define PRIMITIVES_BOND_HPP
36  
37 + #include "primitives/Atom.hpp"
38 + #include "types/BondType.hpp"
39 +
40   namespace oopse {
41  
42   class Bond {
43      public:
44 <        Bond(Atom* atom1, Atom* atom2, BondType* bt);
44 >        Bond(Atom* atom1, Atom* atom2, BondType* bt) : atom1_(atom1), atom2_(atom2), bondType_(bt) {}
45  
46          void calcForce() {
47              double len;
48 <            double totalForce;
48 >            double dvdr;
49              Vector3d r12;
50              Vector3d force;
51  
52 <            r12 = atom2->getPos() - atom1->getPos();
52 >            r12 = atom2_->getPos() - atom1_->getPos();
53              len = r12.length();            
54 <            bondType_->calcForce(len, totalForce, potential);
54 >            bondType_->calcForce(len,  potential_, dvdr);
55  
56 <            force = r12 * (-totalForce / len);
56 >            force = r12 * (-dvdr / len);
57              
58 <            atom1->addFrc(force);
59 <            atom1->addFrc(-force);
58 >            atom1_->addFrc(force);
59 >            atom2_->addFrc(-force);
60         }
61          
62          double getPotential() {
63 <            return potential;
63 >            return potential_;
64          }
65  
66 +        Atom* getAtomA() {
67 +            return atom1_;
68 +        }
69 +
70 +        Atom* getAtomB() {
71 +            return atom2_;
72 +        }
73 +
74 +        BondType* getBondType() {
75 +            return bondType_;
76 +        }
77      private:
78 +        
79          BondType* bondType_; /**< bond type */
80 <        Atom* atom1;
81 <        Atom* atom2;
82 <        double potential;
80 >        Atom* atom1_;
81 >        Atom* atom2_;
82 >        double potential_;
83   };    
84  
85  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines