40 |
|
*/ |
41 |
|
|
42 |
|
#include "primitives/DirectionalAtom.hpp" |
43 |
< |
|
43 |
> |
#include "utils/simError.h" |
44 |
|
namespace oopse { |
45 |
|
|
46 |
|
DirectionalAtom::DirectionalAtom(DirectionalAtomType* dAtomType) |
49 |
|
if (dAtomType->isMultipole()) { |
50 |
|
electroBodyFrame_ = dAtomType->getElectroBodyFrame(); |
51 |
|
} |
52 |
+ |
|
53 |
+ |
//check if one of the diagonal inertia tensor of this directional atom is zero |
54 |
+ |
int nLinearAxis = 0; |
55 |
+ |
Mat3x3d inertiaTensor = getI(); |
56 |
+ |
for (int i = 0; i < 3; i++) { |
57 |
+ |
if (fabs(inertiaTensor(i, i)) < oopse::epsilon) { |
58 |
+ |
linear_ = true; |
59 |
+ |
linearAxis_ = i; |
60 |
+ |
++ nLinearAxis; |
61 |
+ |
} |
62 |
+ |
} |
63 |
+ |
|
64 |
+ |
if (nLinearAxis > 1) { |
65 |
+ |
sprintf( painCave.errMsg, |
66 |
+ |
"Directional Atom error.\n" |
67 |
+ |
"\tOOPSE found more than one axis in this directional atom with a vanishing \n" |
68 |
+ |
"\tmoment of inertia."); |
69 |
+ |
painCave.isFatal = 1; |
70 |
+ |
simError(); |
71 |
+ |
} |
72 |
+ |
|
73 |
|
} |
74 |
|
|
75 |
|
Mat3x3d DirectionalAtom::getI() { |