54 |
|
#include <vector> |
55 |
|
|
56 |
|
#include "types/TorsionType.hpp" |
57 |
+ |
#include "types/PolynomialTorsionType.hpp" |
58 |
|
namespace oopse { |
59 |
|
|
60 |
|
struct CharmmTorsionParameter { |
61 |
< |
double kchi; |
61 |
> |
RealType kchi; |
62 |
|
int n; |
63 |
< |
double delta; |
63 |
> |
RealType delta; |
64 |
|
}; |
65 |
|
|
66 |
< |
class SamePeriodicityFunctor { |
66 |
> |
class LessThanPeriodicityFunctor { |
67 |
|
public: |
68 |
< |
SamePeriodicityFunctor(int n) : n_(n) {} |
69 |
< |
bool operator()(CharmmTorsionParameter p) { |
69 |
< |
return p.n == n_; |
68 |
> |
bool operator()(const CharmmTorsionParameter& p1, const CharmmTorsionParameter& p2) { |
69 |
> |
return p1.n < p2.n; |
70 |
|
} |
71 |
– |
|
72 |
– |
private: |
73 |
– |
int n_; |
71 |
|
}; |
72 |
|
/** |
73 |
|
* @class CharmmTorsionType CharmmTorsionType.hpp "types/CharmmTorsionType.hpp" |
74 |
|
*/ |
75 |
|
class CharmmTorsionType : public TorsionType{ |
76 |
|
public: |
77 |
+ |
CharmmTorsionType(std::vector<CharmmTorsionParameter>& parameters); |
78 |
+ |
|
79 |
+ |
virtual void calcForce(RealType cosPhi, RealType& V, RealType& dVdCosPhi) { torsionType_->calcForce(cosPhi, V, dVdCosPhi);} |
80 |
|
|
81 |
< |
void setCharmmTorsionParameter(CharmmTorsionParameter param) { |
82 |
< |
|
83 |
< |
assert(param.n >= 0 && param.n < 6); |
84 |
< |
|
85 |
< |
std::vector<CharmmTorsionParameter>::iterator i ; |
86 |
< |
i = std::find_if(parameter_.begin(), parameter_.end(), SamePeriodicityFunctor(param.n)); |
87 |
< |
|
88 |
< |
if (i != parameter_.end()) { |
89 |
< |
std::cerr << "a parameter set with " << param.n <<" is already there" << std::endl; |
90 |
< |
} else { |
91 |
< |
parameter_.push_back(param); |
92 |
< |
} |
93 |
< |
} |
94 |
< |
|
95 |
< |
void setCharmmTorsionParameter(double kchi, int n, double delta) { |
96 |
< |
CharmmTorsionParameter param; |
97 |
< |
param.kchi = kchi; |
98 |
< |
param.n = n; |
99 |
< |
param.delta = delta; |
100 |
< |
setCharmmTorsionParameter(param); |
101 |
< |
} |
102 |
< |
|
103 |
< |
virtual void calcForce(double cosPhi, double sinPhi, double& V, double& dVdPhi); |
104 |
< |
|
105 |
< |
private: |
106 |
< |
std::vector<CharmmTorsionParameter> parameter_; |
81 |
> |
private: |
82 |
> |
PolynomialTorsionType* torsionType_; |
83 |
|
}; |
84 |
|
|
85 |
|
} //end namespace oopse |