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 |
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 "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(); |
56 |
|
|
57 |
|
//setup dipole atom type in fortran side |
58 |
|
if (isDipole()) { |
59 |
< |
data = getPropertyByName("Dipole"); |
60 |
< |
if (data != NULL) { |
61 |
< |
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
62 |
< |
|
63 |
< |
if (doubleData != NULL) { |
64 |
< |
double dipole = doubleData->getData(); |
65 |
< |
|
66 |
< |
newDipoleType(&atp.ident, &dipole, &isError); |
67 |
< |
if (isError != 0) { |
68 |
< |
sprintf( painCave.errMsg, |
69 |
< |
"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"); |
59 |
> |
data = getPropertyByName("Dipole"); |
60 |
> |
if (data != NULL) { |
61 |
> |
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
62 |
> |
|
63 |
> |
if (doubleData != NULL) { |
64 |
> |
double dipole = doubleData->getData(); |
65 |
> |
|
66 |
> |
setDipoleMoment(&atp.ident, &dipole, &isError); |
67 |
> |
if (isError != 0) { |
68 |
> |
sprintf( painCave.errMsg, |
69 |
> |
"Fortran rejected setDipoleMoment\n"); |
70 |
|
painCave.severity = OOPSE_ERROR; |
71 |
|
painCave.isFatal = 1; |
72 |
|
simError(); |
73 |
+ |
} |
74 |
+ |
|
75 |
+ |
} else { |
76 |
+ |
sprintf( painCave.errMsg, |
77 |
+ |
"Can not cast GenericData to DoubleGenericData\n"); |
78 |
+ |
painCave.severity = OOPSE_ERROR; |
79 |
+ |
painCave.isFatal = 1; |
80 |
+ |
simError(); |
81 |
|
} |
82 |
+ |
} else { |
83 |
+ |
sprintf( painCave.errMsg, "Can not find Dipole Parameters\n"); |
84 |
+ |
painCave.severity = OOPSE_ERROR; |
85 |
+ |
painCave.isFatal = 1; |
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"); |
125 |
< |
if (data != NULL) { |
126 |
< |
Vector3dGenericData* vector3dData= dynamic_cast<Vector3dGenericData*>(data); |
127 |
< |
|
128 |
< |
if (vector3dData != NULL) { |
129 |
< |
Vector3d diagElem= vector3dData->getData(); |
130 |
< |
Mat3x3d Q; |
131 |
< |
Q(0, 0) = diagElem[0]; |
132 |
< |
Q(1, 1) = diagElem[1]; |
133 |
< |
Q(2, 2) = diagElem[2]; |
134 |
< |
|
135 |
< |
//newQuadrupoleType(&atp.ident, Q->getArrayPointer, &isError); |
136 |
< |
if (isError != 0) { |
137 |
< |
sprintf( painCave.errMsg, |
138 |
< |
"Fortran rejected newQuadrupoleType\n"); |
139 |
< |
painCave.severity = OOPSE_ERROR; |
140 |
< |
painCave.isFatal = 1; |
141 |
< |
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"); |
124 |
> |
data = getPropertyByName("QuadrupoleMoments"); |
125 |
> |
if (data != NULL) { |
126 |
> |
Vector3dGenericData* vector3dData= dynamic_cast<Vector3dGenericData*>(data); |
127 |
> |
|
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(); |
136 |
> |
|
137 |
> |
setQuadrupoleMoments(&atp.ident, diagElem.getArrayPointer(), |
138 |
> |
&isError); |
139 |
> |
if (isError != 0) { |
140 |
> |
sprintf( painCave.errMsg, |
141 |
> |
"Fortran rejected setQuadrupoleMoments\n"); |
142 |
|
painCave.severity = OOPSE_ERROR; |
143 |
|
painCave.isFatal = 1; |
144 |
|
simError(); |
145 |
+ |
} |
146 |
+ |
|
147 |
+ |
} else { |
148 |
+ |
sprintf( painCave.errMsg, |
149 |
+ |
"Can not cast GenericData to Vector3dGenericData\n"); |
150 |
+ |
painCave.severity = OOPSE_ERROR; |
151 |
+ |
painCave.isFatal = 1; |
152 |
+ |
simError(); |
153 |
|
} |
154 |
< |
|
154 |
> |
} else { |
155 |
> |
sprintf( painCave.errMsg, "Can not find QuadrupoleMoments\n"); |
156 |
> |
painCave.severity = OOPSE_ERROR; |
157 |
> |
painCave.isFatal = 1; |
158 |
> |
simError(); |
159 |
> |
} |
160 |
> |
|
161 |
|
} |
162 |
|
|
163 |
|
//setup sticky atom type in fortran side |
164 |
|
if (isSticky()) { |
165 |
< |
data = getPropertyByName("Sticky"); |
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, &stickyParam.v0p, &stickyParam.rl, |
173 |
> |
&stickyParam.ru, &stickyParam.rlp, &stickyParam.rup, &isError); |
174 |
> |
if (isError != 0) { |
175 |
> |
sprintf( painCave.errMsg, |
176 |
> |
"Fortran rejected newLJtype\n"); |
177 |
> |
painCave.severity = OOPSE_ERROR; |
178 |
> |
painCave.isFatal = 1; |
179 |
> |
simError(); |
180 |
> |
} |
181 |
> |
|
182 |
> |
} else { |
183 |
> |
sprintf( painCave.errMsg, |
184 |
> |
"Can not cast GenericData to StickyParam\n"); |
185 |
> |
painCave.severity = OOPSE_ERROR; |
186 |
> |
painCave.isFatal = 1; |
187 |
> |
simError(); |
188 |
> |
} |
189 |
> |
} else { |
190 |
> |
sprintf( painCave.errMsg, "Can not find Parameters for Sticky\n"); |
191 |
> |
painCave.severity = OOPSE_ERROR; |
192 |
> |
painCave.isFatal = 1; |
193 |
> |
simError(); |
194 |
> |
} |
195 |
> |
} |
196 |
> |
|
197 |
> |
//setup GayBerne type in fortran side |
198 |
> |
if (isGayBerne()) { |
199 |
> |
data = getPropertyByName("GayBerne"); |
200 |
|
if (data != NULL) { |
201 |
< |
StickyParamGenericData* stickyData = dynamic_cast<StickyParamGenericData*>(data); |
201 |
> |
GayBerneParamGenericData* gayBerneData = dynamic_cast<GayBerneParamGenericData*>(data); |
202 |
|
|
203 |
< |
if (stickyData != NULL) { |
204 |
< |
StickyParam stickyParam = stickyData->getData(); |
203 |
> |
if (gayBerneData != NULL) { |
204 |
> |
GayBerneParam gayBerneParam = gayBerneData->getData(); |
205 |
|
|
206 |
|
/**@todo change fortran interface */ |
207 |
< |
//makeStickyType(&atp.ident, &stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl, |
208 |
< |
// &stickyParam.ru, &stickyParam.rlp, &stickyParam.rup); |
209 |
< |
newStickyType(&atp.ident,&stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl, |
210 |
< |
&stickyParam.ru, &stickyParam.rlp, &stickyParam.rup, &isError); |
207 |
> |
//makeGayBerneType(&atp.ident, &gayBerneParam.w0, &gayBerneParam.v0, &gayBerneParam.v0p, &gayBerneParam.rl, |
208 |
> |
// &gayBerneParam.ru, &gayBerneParam.rlp, &gayBerneParam.rup); |
209 |
> |
newGayBerneType(&gayBerneParam.GB_sigma, &gayBerneParam.GB_12b_ratio, &gayBerneParam.GB_eps, |
210 |
> |
&gayBerneParam.GB_eps_ratio, &gayBerneParam.GB_mu, &gayBerneParam.GB_nu); |
211 |
|
if (isError != 0) { |
212 |
|
sprintf( painCave.errMsg, |
213 |
< |
"Fortran rejected newLJtype\n"); |
213 |
> |
"Fortran rejected newGayBernetype\n"); |
214 |
|
painCave.severity = OOPSE_ERROR; |
215 |
|
painCave.isFatal = 1; |
216 |
|
simError(); |
217 |
|
} |
218 |
|
|
219 |
< |
} else { |
219 |
> |
} |
220 |
> |
|
221 |
> |
else { |
222 |
|
sprintf( painCave.errMsg, |
223 |
< |
"Can not cast GenericData to StickyParam\n"); |
223 |
> |
"Can not cast GenericData to GayBerneParam\n"); |
224 |
|
painCave.severity = OOPSE_ERROR; |
225 |
|
painCave.isFatal = 1; |
226 |
|
simError(); |
227 |
|
} |
228 |
< |
} else { |
229 |
< |
sprintf( painCave.errMsg, "Can not find Parameters for Sticky\n"); |
230 |
< |
painCave.severity = OOPSE_ERROR; |
231 |
< |
painCave.isFatal = 1; |
232 |
< |
simError(); |
228 |
> |
} |
229 |
> |
else { |
230 |
> |
sprintf( painCave.errMsg, "Can not find Parameters for GayBerne\n"); |
231 |
> |
painCave.severity = OOPSE_ERROR; |
232 |
> |
painCave.isFatal = 1; |
233 |
> |
simError(); |
234 |
|
} |
235 |
|
} |
163 |
– |
|
164 |
– |
//setup GayBerne type in fortran side |
165 |
– |
|
236 |
|
} |
237 |
+ |
|
238 |
|
|
239 |
|
|
240 |
|
} //end namespace oopse |