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

Comparing trunk/OOPSE-4/src/types/CubicBondType.hpp (file contents):
Revision 3172 by tim, Wed May 17 21:51:42 2006 UTC vs.
Revision 3173 by gezelter, Fri Jul 13 18:10:52 2007 UTC

# Line 57 | Line 57 | namespace oopse {
57     * @todo document
58     */
59    class CubicBondType : public BondType {
60 <
60 >    
61    public:
62 <
63 <    CubicBondType(RealType r0, RealType k3, RealType k2, RealType k1, RealType k0)
64 <      : BondType(r0), k3_(k3), k2_(k2),  k1_(k1), k0_(k0){
65 <      }
66 <
62 >    
63 >    CubicBondType(RealType r0, RealType k3, RealType k2, RealType k1,
64 >                  RealType k0) : BondType(r0), k3_(k3), k2_(k2), k1_(k1),
65 >                                 k0_(k0){
66 >    }
67 >    
68      void setForceConstant(RealType k3, RealType k2, RealType k1, RealType k0) {
69        k3_ = k3;
70        k2_ = k2;
71        k1_ = k1;
72        k0_ = k0;
73 <
73 >      
74      }
75  
76 <    void getForceConstant(RealType& k3, RealType& k2, RealType& k1, RealType& k0) {
76 >    void getForceConstant(RealType& k3, RealType& k2, RealType& k1,
77 >                          RealType& k0) {
78        k3 = k3_;
79 <      k2  = k2_;
79 >      k2 = k2_;
80        k1 = k1_;
81        k0 = k0_;
82      }
83 <
83 >    
84      virtual void calcForce(RealType r, RealType& V, RealType& dVdr) {
85        RealType dr =  r- r0;
86        RealType dr2 = dr * dr;
87        RealType dr3 = dr2 * dr;
88 <            
88 >      
89        V =k0_ + k1_ * dr + k2_*dr2 + k3_*dr3;
90        dVdr = k1_ + 2.0*k2_ * dr + 3.0 * k3_*dr2;            
91      }
92 <        
92 >    
93    private:
94 <
94 >    
95      RealType k3_;
96      RealType k2_;
97      RealType k1_;
98      RealType k0_;
99 <
99 >    
100    };
101 <
101 >  
102   }//end namespace oopse
103   #endif //TYPES_CUBICBONDTYPE_HPP

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines