30 |
|
DirectionalAtom::DirectionalAtom(DirectionalAtomType* dAtomType) |
31 |
|
: Atom(dAtomType){ |
32 |
|
objType_= otDAtom; |
33 |
+ |
if (dAtomType->isMultipole()) { |
34 |
+ |
electroBodyFrame_ = dAtomType->getElectroBodyFrame(); |
35 |
+ |
} |
36 |
|
} |
37 |
|
|
38 |
|
Mat3x3d DirectionalAtom::getI() { |
41 |
|
|
42 |
|
void DirectionalAtom::setPrevA(const RotMat3x3d& a) { |
43 |
|
((snapshotMan_->getPrevSnapshot())->*storage_).aMat[localIndex_] = a; |
44 |
< |
((snapshotMan_->getPrevSnapshot())->*storage_).unitVector[localIndex_] = a.inverse() * sU_.getColum(2); |
44 |
> |
if (atomType_->isMultipole()) { |
45 |
> |
((snapshotMan_->getPrevSnapshot())->*storage_).electroFrame[localIndex_] = a.transpose() * electroBodyFrame_; |
46 |
> |
} |
47 |
|
} |
48 |
|
|
49 |
|
|
50 |
|
void DirectionalAtom::setA(const RotMat3x3d& a) { |
51 |
|
((snapshotMan_->getCurrentSnapshot())->*storage_).aMat[localIndex_] = a; |
52 |
< |
((snapshotMan_->getCurrentSnapshot())->*storage_).unitVector[localIndex_] = a.inverse() * sU_.getColum(2); |
52 |
> |
|
53 |
> |
if (atomType_->isMultipole()) { |
54 |
> |
((snapshotMan_->getCurrentSnapshot())->*storage_).electroFrame[localIndex_] = a.transpose() * electroBodyFrame_; |
55 |
> |
} |
56 |
|
} |
57 |
|
|
58 |
|
void DirectionalAtom::setA(const RotMat3x3d& a, int snapshotNo) { |
59 |
|
((snapshotMan_->getSnapshot(snapshotNo))->*storage_).aMat[localIndex_] = a; |
60 |
< |
((snapshotMan_->getSnapshot(snapshotNo))->*storage_).unitVector[localIndex_] = a.inverse() * sU_.getColum(2); |
60 |
> |
|
61 |
> |
if (atomType_->isMultipole()) { |
62 |
> |
((snapshotMan_->getSnapshot(snapshotNo))->*storage_).electroFrame[localIndex_] = a.transpose() * electroBodyFrame_; |
63 |
> |
} |
64 |
|
} |
65 |
|
|
66 |
|
void DirectionalAtom::rotateBy(const RotMat3x3d& m) { |
67 |
|
setA(m *getA()); |
68 |
|
} |
69 |
|
|
59 |
– |
void DirectionalAtom::setUnitFrameFromEuler(double phi, double theta, double psi) { |
60 |
– |
sU_.setupRotMat(phi,theta,psi); |
61 |
– |
} |
62 |
– |
|
70 |
|
std::vector<double> DirectionalAtom::getGrad() { |
71 |
< |
vector<double> grad(6, 0.0); |
71 |
> |
std::vector<double> grad(6, 0.0); |
72 |
|
Vector3d force; |
73 |
|
Vector3d torque; |
74 |
|
Vector3d myEuler; |