60 |
|
|
61 |
|
public: |
62 |
|
|
63 |
< |
CubicBondType(double r0, double k3, double k2, double k1, double k0) |
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 |
|
|
67 |
< |
void setForceConstant(double k3, double k2, double k1, double k0) { |
67 |
> |
void setForceConstant(RealType k3, RealType k2, RealType k1, RealType k0) { |
68 |
|
k3_ = k3; |
69 |
|
k2_ = k2; |
70 |
|
k1_ = k1; |
72 |
|
|
73 |
|
} |
74 |
|
|
75 |
< |
void getForceConstant(double& k3, double& k2, double& k1, double& k0) { |
75 |
> |
void getForceConstant(RealType& k3, RealType& k2, RealType& k1, RealType& k0) { |
76 |
|
k3 = k3_; |
77 |
|
k2 = k2_; |
78 |
|
k1 = k1_; |
79 |
|
k0 = k0_; |
80 |
|
} |
81 |
|
|
82 |
< |
virtual void calcForce(double r, double& V, double& dVdr) { |
83 |
< |
double dr = r- r0; |
84 |
< |
double dr2 = dr * dr; |
85 |
< |
double dr3 = dr2 * dr; |
82 |
> |
virtual void calcForce(RealType r, RealType& V, RealType& dVdr) { |
83 |
> |
RealType dr = r- r0; |
84 |
> |
RealType dr2 = dr * dr; |
85 |
> |
RealType dr3 = dr2 * dr; |
86 |
|
|
87 |
|
V =k0_ + k1_ * dr + k2_*dr2 + k3_*dr3; |
88 |
|
dVdr = k1_ + 2.0*k2_ * dr + 3.0 * k3_*dr2; |
90 |
|
|
91 |
|
private: |
92 |
|
|
93 |
< |
double k3_; |
94 |
< |
double k2_; |
95 |
< |
double k1_; |
96 |
< |
double k0_; |
93 |
> |
RealType k3_; |
94 |
> |
RealType k2_; |
95 |
> |
RealType k1_; |
96 |
> |
RealType k0_; |
97 |
|
|
98 |
|
}; |
99 |
|
|