1 |
< |
/* |
1 |
> |
/* |
2 |
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
|
* The University of Notre Dame grants you ("Licensee") a |
55 |
|
|
56 |
|
namespace oopse { |
57 |
|
|
58 |
< |
class Bond { |
59 |
< |
public: |
60 |
< |
Bond(Atom* atom1, Atom* atom2, BondType* bt) : atom1_(atom1), atom2_(atom2), bondType_(bt) {} |
61 |
< |
virtual ~Bond() {} |
62 |
< |
void calcForce() { |
63 |
< |
double len; |
64 |
< |
double dvdr; |
65 |
< |
Vector3d r12; |
66 |
< |
Vector3d force; |
58 |
> |
class Bond { |
59 |
> |
public: |
60 |
> |
Bond(Atom* atom1, Atom* atom2, BondType* bt) : atom1_(atom1), atom2_(atom2), bondType_(bt) {} |
61 |
> |
virtual ~Bond() {} |
62 |
> |
void calcForce() { |
63 |
> |
RealType len; |
64 |
> |
RealType dvdr; |
65 |
> |
Vector3d r12; |
66 |
> |
Vector3d force; |
67 |
|
|
68 |
< |
r12 = atom2_->getPos() - atom1_->getPos(); |
69 |
< |
len = r12.length(); |
70 |
< |
bondType_->calcForce(len, potential_, dvdr); |
68 |
> |
r12 = atom2_->getPos() - atom1_->getPos(); |
69 |
> |
len = r12.length(); |
70 |
> |
bondType_->calcForce(len, potential_, dvdr); |
71 |
|
|
72 |
< |
force = r12 * (-dvdr / len); |
72 |
> |
force = r12 * (-dvdr / len); |
73 |
|
|
74 |
< |
atom1_->addFrc(-force); |
75 |
< |
atom2_->addFrc(force); |
76 |
< |
} |
74 |
> |
atom1_->addFrc(-force); |
75 |
> |
atom2_->addFrc(force); |
76 |
> |
} |
77 |
|
|
78 |
< |
double getPotential() { |
79 |
< |
return potential_; |
80 |
< |
} |
78 |
> |
RealType getPotential() { |
79 |
> |
return potential_; |
80 |
> |
} |
81 |
|
|
82 |
< |
Atom* getAtomA() { |
83 |
< |
return atom1_; |
84 |
< |
} |
82 |
> |
Atom* getAtomA() { |
83 |
> |
return atom1_; |
84 |
> |
} |
85 |
|
|
86 |
< |
Atom* getAtomB() { |
87 |
< |
return atom2_; |
88 |
< |
} |
86 |
> |
Atom* getAtomB() { |
87 |
> |
return atom2_; |
88 |
> |
} |
89 |
|
|
90 |
< |
BondType* getBondType() { |
91 |
< |
return bondType_; |
92 |
< |
} |
90 |
> |
BondType* getBondType() { |
91 |
> |
return bondType_; |
92 |
> |
} |
93 |
|
|
94 |
< |
private: |
95 |
< |
double potential_; |
96 |
< |
Atom* atom1_; |
97 |
< |
Atom* atom2_; |
98 |
< |
BondType* bondType_; /**< bond type */ |
94 |
> |
private: |
95 |
> |
RealType potential_; |
96 |
> |
Atom* atom1_; |
97 |
> |
Atom* atom2_; |
98 |
> |
BondType* bondType_; /**< bond type */ |
99 |
|
|
100 |
< |
}; |
100 |
> |
}; |
101 |
|
|
102 |
|
|
103 |
|
|