| 27 |
|
|
| 28 |
|
namespace oopse { |
| 29 |
|
|
| 30 |
< |
DirectionalAtom::DirectionalAtom() : objType_(otDAtom), storage_(&Snapshot::atomData){ |
| 30 |
> |
DirectionalAtom::DirectionalAtom(DirectionalAtom* dAtomType) |
| 31 |
> |
: Atom(dAtomType), objType_(otDAtom), storage_(&Snapshot::atomData){ |
| 32 |
|
|
| 33 |
|
} |
| 34 |
|
|
| 35 |
|
Mat3x3d DirectionalAtom::getI() { |
| 36 |
< |
return inertiaTensor_; |
| 36 |
> |
return static_cast<DirectionalAtomType*>(getAtomType())->getI(); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
< |
void DirectionalAtom::setI(Mat3x3d& I) { |
| 40 |
< |
inertiaTensor_ = I; |
| 39 |
> |
void DirectionalAtom::setPrevA(const RotMat3x3d& a) { |
| 40 |
> |
(snapshotMan_->getPrevSnapshot())->storage_->aMat[localIndex_] = a; |
| 41 |
> |
(snapshotMan_->getPrevSnapshot())->storage_->unitVector[localIndex_] = a.inverse() * sU_.getColum(2); |
| 42 |
> |
} |
| 43 |
> |
|
| 44 |
> |
|
| 45 |
> |
void DirectionalAtom::setA(const RotMat3x3d& a) { |
| 46 |
> |
(snapshotMan_->getCurrentSnapshot())->storage_->aMat[localIndex_] = a; |
| 47 |
> |
(snapshotMan_->getCurrentSnapshot())->storage_->unitVector[localIndex_] = a.inverse() * sU_.getColum(2); |
| 48 |
|
} |
| 49 |
+ |
|
| 50 |
+ |
void DirectionalAtom::setA(const RotMat3x3d& a, int snapshotNo) { |
| 51 |
+ |
(snapshotMan_->getSnapshot(snapshotNo))->storage_->aMat[localIndex_] = a; |
| 52 |
+ |
(snapshotMan_->getSnapshot(snapshotNo))->storage_->unitVector[localIndex_] = a.inverse() * sU_.getColum(2); |
| 53 |
+ |
} |
| 54 |
|
|
| 55 |
+ |
void DirectionalAtom::rotateBy(const RotMat3x3d& m) { |
| 56 |
+ |
setA(m *getA()); |
| 57 |
+ |
} |
| 58 |
+ |
|
| 59 |
+ |
void DirectionalAtom::setUnitFrameFromEuler(double phi, double theta, double psi) { |
| 60 |
+ |
sU_.setupRotMat(phi,theta,psi); |
| 61 |
+ |
} |
| 62 |
+ |
|
| 63 |
|
std::vector<double> DirectionalAtom::getGrad() { |
| 64 |
|
vector<double> grad(6, 0.0); |
| 65 |
|
Vector3d force; |