24 |
|
*/ |
25 |
|
|
26 |
|
/** |
27 |
< |
* @file BendType.hpp |
27 |
> |
* @file QuadraticBondType.hpp |
28 |
|
* @author tlin |
29 |
|
* @date 11/01/2004 |
30 |
|
* @version 1.0 |
31 |
|
*/ |
32 |
|
|
33 |
< |
#ifndef TYPES_QUADRATICBENDTYPE_HPP |
34 |
< |
#define TYPES_QUADRATICBENDTYPE_HPP |
33 |
> |
#ifndef TYPES_QUADRATICBONDTYPE_HPP |
34 |
> |
#define TYPES_QUADRATICBONDTYPE_HPP |
35 |
|
|
36 |
< |
#include "types/BendType.hpp" |
36 |
> |
#include "types/BondType.hpp" |
37 |
|
|
38 |
|
namespace oopse { |
39 |
|
/** |
40 |
< |
* @class QuadraticBendType |
40 |
> |
* @class QuadraticBondType |
41 |
|
* @todo document |
42 |
|
*/ |
43 |
< |
class QuadraticBendType : public BendType { |
43 |
> |
class QuadraticBondType : public BondType { |
44 |
|
|
45 |
|
public: |
46 |
|
|
47 |
< |
QuadraticBendType(double theta, double k2, double k3, double k4) |
48 |
< |
: BendType(theta), k2_(k2), k3_(k3) { |
47 |
> |
|
48 |
> |
QuadraticBondType(double r0, double k4, double k3, double k2, double k1, double k0) |
49 |
> |
: BondType(r0), k4_(k4), k3_(k3), k2_(k2), k1_(k1), k0_(k0){ |
50 |
|
} |
51 |
|
|
52 |
< |
void setForceConstant(double k2, double k3, double k4) { |
52 |
< |
k2_ = k2; |
53 |
< |
k3_ = k3; |
52 |
> |
void setForceConstant(double k4, double k3, double k2, double k1, double k0) { |
53 |
|
k4_ = k4; |
54 |
+ |
k3_ = k3; |
55 |
+ |
k2_ = k2; |
56 |
+ |
k1_ = k1; |
57 |
+ |
k0_ = k0; |
58 |
+ |
|
59 |
|
} |
60 |
|
|
61 |
< |
void getForceConstant(double& k2, double& k3, double& k4) { |
58 |
< |
k2 = k2_; |
59 |
< |
k3 = k3_; |
61 |
> |
void getForceConstant(double& k4, double& k3, double& k2, double& k1, double& k0) { |
62 |
|
k4 = k4_; |
63 |
+ |
k3 = k3_; |
64 |
+ |
k2 = k2_; |
65 |
+ |
k1 = k1_; |
66 |
+ |
k0 = k0_ |
67 |
|
} |
68 |
|
|
69 |
< |
virtual void calcForce(double theta, double& V, double& dVdelta) { |
70 |
< |
double delta = theta- theta0_; |
71 |
< |
double delta2 = delta * delta; |
72 |
< |
double delta3 = delta2 * delta; |
73 |
< |
double delta4 = delta3 * delta; |
69 |
> |
virtual void calcForce(double r, double& V, double& dVdr) { |
70 |
> |
double dr = r- r0; |
71 |
> |
double dr2 = dr * dr; |
72 |
> |
double dr3 = dr2 * dr; |
73 |
> |
double dr4 = dr3 * dr; |
74 |
|
|
75 |
< |
V = 0.5 * (k2_*delta2 + k3_*delta3 + k4_*delta4); |
76 |
< |
dVdelta = k2_ * delta + 1.5 * k3_*delta2 + 2.0 * k4_ *delta3; |
77 |
< |
} |
75 |
> |
V =k0_ + k1_ * dr + k2_*dr2 + k3_*dr3 + k4_*dr4; |
76 |
> |
dVdr = k1_ + 2.0*k2_ * dr + 3.0 * k3_*dr2 + 4.0*k4_*dr3; |
77 |
> |
} |
78 |
|
|
79 |
|
private: |
74 |
– |
|
75 |
– |
double k2_; |
76 |
– |
double k3_; |
80 |
|
double k4_; |
81 |
+ |
double k3_; |
82 |
+ |
double k2_; |
83 |
+ |
double k1_; |
84 |
+ |
double k0_; |
85 |
|
|
86 |
|
}; |
87 |
|
|
88 |
|
}//end namespace oopse |
89 |
< |
#endif //TYPES_QUADRATICBENDTYPE_HPP |
89 |
> |
#endif //TYPES_QUADRATICBONDTYPE_HPP |