40 |
|
*/ |
41 |
|
|
42 |
|
#include "types/DirectionalAtomType.hpp" |
43 |
< |
#include "UseTheForce/DarkSide/dipole_interface.h" |
43 |
> |
#include "UseTheForce/DarkSide/electrostatic_interface.h" |
44 |
|
#include "UseTheForce/DarkSide/sticky_interface.h" |
45 |
|
#include "utils/simError.h" |
46 |
|
namespace oopse { |
55 |
|
|
56 |
|
//setup dipole atom type in fortran side |
57 |
|
if (isDipole()) { |
58 |
< |
data = getPropertyByName("Dipole"); |
59 |
< |
if (data != NULL) { |
60 |
< |
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
61 |
< |
|
62 |
< |
if (doubleData != NULL) { |
63 |
< |
double dipole = doubleData->getData(); |
64 |
< |
|
65 |
< |
newDipoleType(&atp.ident, &dipole, &isError); |
66 |
< |
if (isError != 0) { |
67 |
< |
sprintf( painCave.errMsg, |
68 |
< |
"Fortran rejected newDipoleType\n"); |
69 |
< |
painCave.severity = OOPSE_ERROR; |
70 |
< |
painCave.isFatal = 1; |
71 |
< |
simError(); |
72 |
< |
} |
73 |
< |
|
74 |
< |
} else { |
75 |
< |
sprintf( painCave.errMsg, |
76 |
< |
"Can not cast GenericData to DoubleGenericData\n"); |
77 |
< |
painCave.severity = OOPSE_ERROR; |
78 |
< |
painCave.isFatal = 1; |
79 |
< |
simError(); |
80 |
< |
} |
81 |
< |
} else { |
82 |
< |
sprintf( painCave.errMsg, "Can not find Dipole Parameters\n"); |
58 |
> |
data = getPropertyByName("Dipole"); |
59 |
> |
if (data != NULL) { |
60 |
> |
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
61 |
> |
|
62 |
> |
if (doubleData != NULL) { |
63 |
> |
double dipole = doubleData->getData(); |
64 |
> |
|
65 |
> |
setDipoleMoment(&atp.ident, &dipole, &isError); |
66 |
> |
if (isError != 0) { |
67 |
> |
sprintf( painCave.errMsg, |
68 |
> |
"Fortran rejected setDipoleMoment\n"); |
69 |
|
painCave.severity = OOPSE_ERROR; |
70 |
|
painCave.isFatal = 1; |
71 |
|
simError(); |
72 |
+ |
} |
73 |
+ |
|
74 |
+ |
} else { |
75 |
+ |
sprintf( painCave.errMsg, |
76 |
+ |
"Can not cast GenericData to DoubleGenericData\n"); |
77 |
+ |
painCave.severity = OOPSE_ERROR; |
78 |
+ |
painCave.isFatal = 1; |
79 |
+ |
simError(); |
80 |
|
} |
81 |
+ |
} else { |
82 |
+ |
sprintf( painCave.errMsg, "Can not find Dipole Parameters\n"); |
83 |
+ |
painCave.severity = OOPSE_ERROR; |
84 |
+ |
painCave.isFatal = 1; |
85 |
+ |
simError(); |
86 |
+ |
} |
87 |
|
} |
88 |
< |
|
88 |
> |
|
89 |
|
//setup quadrupole atom type in fortran side |
90 |
|
if (isQuadrupole()) { |
91 |
< |
data = getPropertyByName("Quadrupole"); |
92 |
< |
if (data != NULL) { |
93 |
< |
Vector3dGenericData* vector3dData= dynamic_cast<Vector3dGenericData*>(data); |
94 |
< |
|
95 |
< |
if (vector3dData != NULL) { |
96 |
< |
Vector3d diagElem= vector3dData->getData(); |
97 |
< |
Mat3x3d Q; |
98 |
< |
Q(0, 0) = diagElem[0]; |
99 |
< |
Q(1, 1) = diagElem[1]; |
100 |
< |
Q(2, 2) = diagElem[2]; |
101 |
< |
|
102 |
< |
//newQuadrupoleType(&atp.ident, Q->getArrayPointer, &isError); |
103 |
< |
if (isError != 0) { |
104 |
< |
sprintf( painCave.errMsg, |
105 |
< |
"Fortran rejected newQuadrupoleType\n"); |
106 |
< |
painCave.severity = OOPSE_ERROR; |
107 |
< |
painCave.isFatal = 1; |
108 |
< |
simError(); |
109 |
< |
} |
110 |
< |
|
111 |
< |
} else { |
112 |
< |
sprintf( painCave.errMsg, |
113 |
< |
"Can not cast GenericData to Vector3dGenericData\n"); |
114 |
< |
painCave.severity = OOPSE_ERROR; |
115 |
< |
painCave.isFatal = 1; |
116 |
< |
simError(); |
117 |
< |
} |
118 |
< |
} else { |
119 |
< |
sprintf( painCave.errMsg, "Can not find Quadrupole Parameters\n"); |
91 |
> |
data = getPropertyByName("Quadrupole"); |
92 |
> |
if (data != NULL) { |
93 |
> |
Vector3dGenericData* vector3dData= dynamic_cast<Vector3dGenericData*>(data); |
94 |
> |
|
95 |
> |
// BROKEN: cartesian quadrupoles have the following properties |
96 |
> |
// They are symmetric and traceless: |
97 |
> |
// Qxy = Qyx Qxx + Qyy + Qzz = 0 |
98 |
> |
// Qxz = Qzx |
99 |
> |
// Qyz = Qzy |
100 |
> |
|
101 |
> |
if (vector3dData != NULL) { |
102 |
> |
Vector3d diagElem= vector3dData->getData(); |
103 |
> |
Mat3x3d Q; |
104 |
> |
Q(0, 0) = diagElem[0]; |
105 |
> |
Q(1, 1) = diagElem[1]; |
106 |
> |
Q(2, 2) = diagElem[2]; |
107 |
> |
|
108 |
> |
setCartesianQuadrupole(&atp.ident, Q.getArrayPointer(), &isError); |
109 |
> |
if (isError != 0) { |
110 |
> |
sprintf( painCave.errMsg, |
111 |
> |
"Fortran rejected setCartesianQuadrupole\n"); |
112 |
|
painCave.severity = OOPSE_ERROR; |
113 |
|
painCave.isFatal = 1; |
114 |
|
simError(); |
115 |
+ |
} |
116 |
+ |
|
117 |
+ |
} else { |
118 |
+ |
sprintf( painCave.errMsg, |
119 |
+ |
"Can not cast GenericData to Vector3dGenericData\n"); |
120 |
+ |
painCave.severity = OOPSE_ERROR; |
121 |
+ |
painCave.isFatal = 1; |
122 |
+ |
simError(); |
123 |
|
} |
124 |
< |
|
124 |
> |
} else { |
125 |
> |
sprintf( painCave.errMsg, "Can not find Quadrupole Parameters\n"); |
126 |
> |
painCave.severity = OOPSE_ERROR; |
127 |
> |
painCave.isFatal = 1; |
128 |
> |
simError(); |
129 |
> |
} |
130 |
> |
|
131 |
|
} |
132 |
|
|
133 |
|
//setup sticky atom type in fortran side |