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 |
42 |
|
#include "types/DirectionalAtomType.hpp" |
43 |
|
#include "UseTheForce/DarkSide/electrostatic_interface.h" |
44 |
|
#include "UseTheForce/DarkSide/sticky_interface.h" |
45 |
+ |
#include "UseTheForce/DarkSide/gb_interface.h" |
46 |
|
#include "utils/simError.h" |
47 |
|
namespace oopse { |
48 |
|
|
49 |
< |
void DirectionalAtomType::complete() { |
49 |
> |
void DirectionalAtomType::complete() { |
50 |
|
|
51 |
|
// |
52 |
|
AtomType::complete(); |
86 |
|
simError(); |
87 |
|
} |
88 |
|
} |
89 |
+ |
|
90 |
+ |
if (isSplitDipole()) { |
91 |
+ |
data = getPropertyByName("SplitDipoleDistance"); |
92 |
+ |
if (data != NULL) { |
93 |
+ |
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
94 |
+ |
|
95 |
+ |
if (doubleData != NULL) { |
96 |
+ |
double splitDipoleDistance = doubleData->getData(); |
97 |
+ |
|
98 |
+ |
setSplitDipoleDistance(&atp.ident, &splitDipoleDistance, &isError); |
99 |
+ |
if (isError != 0) { |
100 |
+ |
sprintf( painCave.errMsg, |
101 |
+ |
"Fortran rejected setSplitDipoleDistance\n"); |
102 |
+ |
painCave.severity = OOPSE_ERROR; |
103 |
+ |
painCave.isFatal = 1; |
104 |
+ |
simError(); |
105 |
+ |
} |
106 |
+ |
|
107 |
+ |
} else { |
108 |
+ |
sprintf( painCave.errMsg, |
109 |
+ |
"Can not cast GenericData to DoubleGenericData\n"); |
110 |
+ |
painCave.severity = OOPSE_ERROR; |
111 |
+ |
painCave.isFatal = 1; |
112 |
+ |
simError(); |
113 |
+ |
} |
114 |
+ |
} else { |
115 |
+ |
sprintf( painCave.errMsg, "Can not find SplitDipole distance parameter\n"); |
116 |
+ |
painCave.severity = OOPSE_ERROR; |
117 |
+ |
painCave.isFatal = 1; |
118 |
+ |
simError(); |
119 |
+ |
} |
120 |
+ |
} |
121 |
|
|
122 |
|
//setup quadrupole atom type in fortran side |
123 |
|
if (isQuadrupole()) { |
124 |
< |
data = getPropertyByName("Quadrupole"); |
124 |
> |
data = getPropertyByName("QuadrupoleMoments"); |
125 |
|
if (data != NULL) { |
126 |
|
Vector3dGenericData* vector3dData= dynamic_cast<Vector3dGenericData*>(data); |
127 |
|
|
128 |
< |
// BROKEN: cartesian quadrupoles have the following properties |
129 |
< |
// They are symmetric and traceless: |
130 |
< |
// Qxy = Qyx Qxx + Qyy + Qzz = 0 |
131 |
< |
// Qxz = Qzx |
132 |
< |
// Qyz = Qzy |
128 |
> |
// Quadrupoles in OOPSE are set as the diagonal elements |
129 |
> |
// of the diagonalized traceless quadrupole moment tensor. |
130 |
> |
// The column vectors of the unitary matrix that diagonalizes |
131 |
> |
// the quadrupole moment tensor become the eFrame (or the |
132 |
> |
// electrostatic version of the body-fixed frame. |
133 |
|
|
134 |
|
if (vector3dData != NULL) { |
135 |
|
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]; |
136 |
|
|
137 |
< |
setCartesianQuadrupole(&atp.ident, Q.getArrayPointer(), &isError); |
137 |
> |
setQuadrupoleMoments(&atp.ident, diagElem.getArrayPointer(), |
138 |
> |
&isError); |
139 |
|
if (isError != 0) { |
140 |
|
sprintf( painCave.errMsg, |
141 |
< |
"Fortran rejected setCartesianQuadrupole\n"); |
141 |
> |
"Fortran rejected setQuadrupoleMoments\n"); |
142 |
|
painCave.severity = OOPSE_ERROR; |
143 |
|
painCave.isFatal = 1; |
144 |
|
simError(); |
152 |
|
simError(); |
153 |
|
} |
154 |
|
} else { |
155 |
< |
sprintf( painCave.errMsg, "Can not find Quadrupole Parameters\n"); |
155 |
> |
sprintf( painCave.errMsg, "Can not find QuadrupoleMoments\n"); |
156 |
|
painCave.severity = OOPSE_ERROR; |
157 |
|
painCave.isFatal = 1; |
158 |
|
simError(); |
161 |
|
} |
162 |
|
|
163 |
|
//setup sticky atom type in fortran side |
164 |
< |
if (isSticky()) { |
165 |
< |
data = getPropertyByName("Sticky"); |
164 |
> |
if (isSticky() || isStickyPower()) { |
165 |
> |
data = getPropertyByName("Sticky"); |
166 |
> |
if (data != NULL) { |
167 |
> |
StickyParamGenericData* stickyData = dynamic_cast<StickyParamGenericData*>(data); |
168 |
> |
|
169 |
> |
if (stickyData != NULL) { |
170 |
> |
StickyParam stickyParam = stickyData->getData(); |
171 |
> |
|
172 |
> |
newStickyType(&atp.ident,&stickyParam.w0, &stickyParam.v0, |
173 |
> |
&stickyParam.v0p, &stickyParam.rl, &stickyParam.ru, |
174 |
> |
&stickyParam.rlp, &stickyParam.rup, &isError); |
175 |
> |
if (isError != 0) { |
176 |
> |
sprintf( painCave.errMsg, |
177 |
> |
"Fortran rejected newLJtype\n"); |
178 |
> |
painCave.severity = OOPSE_ERROR; |
179 |
> |
painCave.isFatal = 1; |
180 |
> |
simError(); |
181 |
> |
} |
182 |
> |
|
183 |
> |
} else { |
184 |
> |
sprintf( painCave.errMsg, |
185 |
> |
"Can not cast GenericData to StickyParam\n"); |
186 |
> |
painCave.severity = OOPSE_ERROR; |
187 |
> |
painCave.isFatal = 1; |
188 |
> |
simError(); |
189 |
> |
} |
190 |
> |
} else { |
191 |
> |
sprintf( painCave.errMsg, "Can not find Parameters for Sticky\n"); |
192 |
> |
painCave.severity = OOPSE_ERROR; |
193 |
> |
painCave.isFatal = 1; |
194 |
> |
simError(); |
195 |
> |
} |
196 |
> |
} |
197 |
> |
|
198 |
> |
//setup GayBerne type in fortran side |
199 |
> |
if (isGayBerne()) { |
200 |
> |
data = getPropertyByName("GayBerne"); |
201 |
|
if (data != NULL) { |
202 |
< |
StickyParamGenericData* stickyData = dynamic_cast<StickyParamGenericData*>(data); |
202 |
> |
GayBerneParamGenericData* gayBerneData = dynamic_cast<GayBerneParamGenericData*>(data); |
203 |
|
|
204 |
< |
if (stickyData != NULL) { |
205 |
< |
StickyParam stickyParam = stickyData->getData(); |
204 |
> |
if (gayBerneData != NULL) { |
205 |
> |
GayBerneParam gayBerneParam = gayBerneData->getData(); |
206 |
|
|
207 |
< |
/**@todo change fortran interface */ |
208 |
< |
//makeStickyType(&atp.ident, &stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl, |
209 |
< |
// &stickyParam.ru, &stickyParam.rlp, &stickyParam.rup); |
210 |
< |
newStickyType(&atp.ident,&stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl, |
211 |
< |
&stickyParam.ru, &stickyParam.rlp, &stickyParam.rup, &isError); |
207 |
> |
newGayBerneType(&atp.ident, |
208 |
> |
&gayBerneParam.GB_sigma, |
209 |
> |
&gayBerneParam.GB_l2b_ratio, |
210 |
> |
&gayBerneParam.GB_eps, |
211 |
> |
&gayBerneParam.GB_eps_ratio, |
212 |
> |
&gayBerneParam.GB_mu, |
213 |
> |
&gayBerneParam.GB_nu, &isError); |
214 |
> |
|
215 |
|
if (isError != 0) { |
216 |
|
sprintf( painCave.errMsg, |
217 |
< |
"Fortran rejected newLJtype\n"); |
217 |
> |
"Fortran rejected newGayBerneType\n"); |
218 |
|
painCave.severity = OOPSE_ERROR; |
219 |
|
painCave.isFatal = 1; |
220 |
|
simError(); |
221 |
|
} |
222 |
|
|
223 |
< |
} else { |
223 |
> |
} |
224 |
> |
|
225 |
> |
else { |
226 |
|
sprintf( painCave.errMsg, |
227 |
< |
"Can not cast GenericData to StickyParam\n"); |
227 |
> |
"Can not cast GenericData to GayBerneParam\n"); |
228 |
|
painCave.severity = OOPSE_ERROR; |
229 |
|
painCave.isFatal = 1; |
230 |
|
simError(); |
231 |
|
} |
232 |
< |
} else { |
233 |
< |
sprintf( painCave.errMsg, "Can not find Parameters for Sticky\n"); |
234 |
< |
painCave.severity = OOPSE_ERROR; |
235 |
< |
painCave.isFatal = 1; |
236 |
< |
simError(); |
232 |
> |
} |
233 |
> |
else { |
234 |
> |
sprintf( painCave.errMsg, "Can not find Parameters for GayBerne\n"); |
235 |
> |
painCave.severity = OOPSE_ERROR; |
236 |
> |
painCave.isFatal = 1; |
237 |
> |
simError(); |
238 |
|
} |
239 |
|
} |
169 |
– |
|
170 |
– |
//setup GayBerne type in fortran side |
171 |
– |
|
240 |
|
} |
241 |
+ |
|
242 |
|
|
243 |
|
|
244 |
|
} //end namespace oopse |