ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/types/HarmonicBondType.hpp
Revision: 1756
Committed: Thu Nov 18 23:26:27 2004 UTC (19 years, 9 months ago) by tim
File size: 731 byte(s)
Log Message:
adding DUFF parser

File Contents

# User Rev Content
1 gezelter 1743 #ifndef TYPES_HARMONICBONDTYPE_HPP
2     #define TYPES_HARMONICBONDTYPE_HPP
3    
4     #include "types/BondType.hpp"
5    
6     namespace oopse {
7     /**
8     * @class HarmonicBondType
9     *
10     * HarmonicBondType is the basic OOPSE bond type.
11 tim 1756 * Formula is V = 0.5* k(r -r0)^2
12 gezelter 1743 */
13     class HarmonicBondType : public BondType {
14    
15     public:
16    
17 tim 1746 HarmonicBondType(double myR0, double myK) : BondType(myR0) {
18 gezelter 1743 k = myK;
19     }
20    
21     void setForceConstant(double myK) {k = myK; }
22    
23     double getForceConstant() {return k;}
24    
25 tim 1748 virtual void calcForce(double r, double& V, double& dVdr) {
26 gezelter 1743 double dr;
27    
28     dr = r - r0;
29    
30     V = 0.5 * k * dr * dr;
31     dVdr = k * dr;
32     }
33    
34     private:
35    
36     double k;
37    
38     };
39     }
40     #endif