1 |
gezelter |
2094 |
/* |
2 |
gezelter |
1930 |
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
|
* |
4 |
|
|
* The University of Notre Dame grants you ("Licensee") a |
5 |
|
|
* non-exclusive, royalty free, license to use, modify and |
6 |
|
|
* redistribute this software in source and binary code form, provided |
7 |
|
|
* that the following conditions are met: |
8 |
|
|
* |
9 |
|
|
* 1. Acknowledgement of the program authors must be made in any |
10 |
|
|
* publication of scientific results based in part on use of the |
11 |
|
|
* program. An acceptable form of acknowledgement is citation of |
12 |
|
|
* the article in which the program was described (Matthew |
13 |
|
|
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
|
|
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
|
|
* Parallel Simulation Engine for Molecular Dynamics," |
16 |
|
|
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
|
|
* |
18 |
|
|
* 2. Redistributions of source code must retain the above copyright |
19 |
|
|
* notice, this list of conditions and the following disclaimer. |
20 |
|
|
* |
21 |
|
|
* 3. Redistributions in binary form must reproduce the above copyright |
22 |
|
|
* notice, this list of conditions and the following disclaimer in the |
23 |
|
|
* documentation and/or other materials provided with the |
24 |
|
|
* distribution. |
25 |
|
|
* |
26 |
|
|
* This software is provided "AS IS," without a warranty of any |
27 |
|
|
* kind. All express or implied conditions, representations and |
28 |
|
|
* warranties, including any implied warranty of merchantability, |
29 |
|
|
* fitness for a particular purpose or non-infringement, are hereby |
30 |
|
|
* excluded. The University of Notre Dame and its licensors shall not |
31 |
|
|
* be liable for any damages suffered by licensee as a result of |
32 |
|
|
* using, modifying or distributing the software or its |
33 |
|
|
* derivatives. In no event will the University of Notre Dame or its |
34 |
|
|
* licensors be liable for any lost revenue, profit or data, or for |
35 |
|
|
* direct, indirect, special, consequential, incidental or punitive |
36 |
|
|
* damages, however caused and regardless of the theory of liability, |
37 |
|
|
* arising out of the use of or inability to use software, even if the |
38 |
|
|
* University of Notre Dame has been advised of the possibility of |
39 |
|
|
* such damages. |
40 |
|
|
*/ |
41 |
|
|
|
42 |
|
|
#include "types/DirectionalAtomType.hpp" |
43 |
gezelter |
2089 |
#include "UseTheForce/DarkSide/electrostatic_interface.h" |
44 |
gezelter |
1930 |
#include "UseTheForce/DarkSide/sticky_interface.h" |
45 |
kdaily |
2226 |
#include "UseTheForce/DarkSide/gb_interface.h" |
46 |
gezelter |
1930 |
#include "utils/simError.h" |
47 |
|
|
namespace oopse { |
48 |
|
|
|
49 |
gezelter |
2094 |
void DirectionalAtomType::complete() { |
50 |
gezelter |
1930 |
|
51 |
|
|
// |
52 |
|
|
AtomType::complete(); |
53 |
|
|
|
54 |
|
|
int isError = 0; |
55 |
|
|
GenericData* data; |
56 |
|
|
|
57 |
|
|
//setup dipole atom type in fortran side |
58 |
|
|
if (isDipole()) { |
59 |
gezelter |
2089 |
data = getPropertyByName("Dipole"); |
60 |
|
|
if (data != NULL) { |
61 |
|
|
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
62 |
|
|
|
63 |
|
|
if (doubleData != NULL) { |
64 |
tim |
2759 |
RealType dipole = doubleData->getData(); |
65 |
gezelter |
2089 |
|
66 |
|
|
setDipoleMoment(&atp.ident, &dipole, &isError); |
67 |
|
|
if (isError != 0) { |
68 |
|
|
sprintf( painCave.errMsg, |
69 |
|
|
"Fortran rejected setDipoleMoment\n"); |
70 |
gezelter |
1930 |
painCave.severity = OOPSE_ERROR; |
71 |
|
|
painCave.isFatal = 1; |
72 |
|
|
simError(); |
73 |
gezelter |
2089 |
} |
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 |
gezelter |
1930 |
} |
82 |
gezelter |
2089 |
} else { |
83 |
|
|
sprintf( painCave.errMsg, "Can not find Dipole Parameters\n"); |
84 |
|
|
painCave.severity = OOPSE_ERROR; |
85 |
|
|
painCave.isFatal = 1; |
86 |
|
|
simError(); |
87 |
|
|
} |
88 |
gezelter |
1930 |
} |
89 |
gezelter |
2094 |
|
90 |
|
|
if (isSplitDipole()) { |
91 |
|
|
data = getPropertyByName("SplitDipoleDistance"); |
92 |
|
|
if (data != NULL) { |
93 |
|
|
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
94 |
|
|
|
95 |
|
|
if (doubleData != NULL) { |
96 |
tim |
2759 |
RealType splitDipoleDistance = doubleData->getData(); |
97 |
gezelter |
2094 |
|
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 |
gezelter |
2089 |
|
122 |
gezelter |
1930 |
//setup quadrupole atom type in fortran side |
123 |
|
|
if (isQuadrupole()) { |
124 |
gezelter |
2094 |
data = getPropertyByName("QuadrupoleMoments"); |
125 |
gezelter |
2089 |
if (data != NULL) { |
126 |
|
|
Vector3dGenericData* vector3dData= dynamic_cast<Vector3dGenericData*>(data); |
127 |
|
|
|
128 |
gezelter |
2094 |
// 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 |
gezelter |
2089 |
|
134 |
|
|
if (vector3dData != NULL) { |
135 |
|
|
Vector3d diagElem= vector3dData->getData(); |
136 |
|
|
|
137 |
gezelter |
2094 |
setQuadrupoleMoments(&atp.ident, diagElem.getArrayPointer(), |
138 |
|
|
&isError); |
139 |
gezelter |
2089 |
if (isError != 0) { |
140 |
|
|
sprintf( painCave.errMsg, |
141 |
gezelter |
2094 |
"Fortran rejected setQuadrupoleMoments\n"); |
142 |
gezelter |
1930 |
painCave.severity = OOPSE_ERROR; |
143 |
|
|
painCave.isFatal = 1; |
144 |
|
|
simError(); |
145 |
gezelter |
2089 |
} |
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 |
gezelter |
1930 |
} |
154 |
gezelter |
2089 |
} else { |
155 |
gezelter |
2094 |
sprintf( painCave.errMsg, "Can not find QuadrupoleMoments\n"); |
156 |
gezelter |
2089 |
painCave.severity = OOPSE_ERROR; |
157 |
|
|
painCave.isFatal = 1; |
158 |
|
|
simError(); |
159 |
|
|
} |
160 |
|
|
|
161 |
gezelter |
1930 |
} |
162 |
|
|
|
163 |
|
|
//setup sticky atom type in fortran side |
164 |
chuckv |
2228 |
if (isSticky() || isStickyPower()) { |
165 |
gezelter |
2094 |
data = getPropertyByName("Sticky"); |
166 |
|
|
if (data != NULL) { |
167 |
|
|
StickyParamGenericData* stickyData = dynamic_cast<StickyParamGenericData*>(data); |
168 |
gezelter |
1930 |
|
169 |
gezelter |
2094 |
if (stickyData != NULL) { |
170 |
|
|
StickyParam stickyParam = stickyData->getData(); |
171 |
gezelter |
1930 |
|
172 |
chuckv |
2228 |
newStickyType(&atp.ident,&stickyParam.w0, &stickyParam.v0, |
173 |
|
|
&stickyParam.v0p, &stickyParam.rl, &stickyParam.ru, |
174 |
|
|
&stickyParam.rlp, &stickyParam.rup, &isError); |
175 |
gezelter |
2094 |
if (isError != 0) { |
176 |
|
|
sprintf( painCave.errMsg, |
177 |
|
|
"Fortran rejected newLJtype\n"); |
178 |
gezelter |
1930 |
painCave.severity = OOPSE_ERROR; |
179 |
|
|
painCave.isFatal = 1; |
180 |
|
|
simError(); |
181 |
gezelter |
2094 |
} |
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 |
gezelter |
2787 |
} |
197 |
gezelter |
1930 |
|
198 |
gezelter |
2787 |
//setup GayBerne type in fortran side |
199 |
kdaily |
2226 |
if (isGayBerne()) { |
200 |
|
|
data = getPropertyByName("GayBerne"); |
201 |
|
|
if (data != NULL) { |
202 |
|
|
GayBerneParamGenericData* gayBerneData = dynamic_cast<GayBerneParamGenericData*>(data); |
203 |
gezelter |
1930 |
|
204 |
kdaily |
2226 |
if (gayBerneData != NULL) { |
205 |
gezelter |
2787 |
GayBerneParam gayBerneParam = gayBerneData->getData(); |
206 |
|
|
|
207 |
|
|
newGayBerneType(&atp.ident, |
208 |
|
|
&gayBerneParam.GB_d, |
209 |
|
|
&gayBerneParam.GB_l, |
210 |
|
|
&gayBerneParam.GB_eps, |
211 |
gezelter |
2375 |
&gayBerneParam.GB_eps_ratio, |
212 |
gezelter |
2787 |
&gayBerneParam.GB_dw, |
213 |
|
|
&isError); |
214 |
gezelter |
2375 |
|
215 |
kdaily |
2226 |
if (isError != 0) { |
216 |
|
|
sprintf( painCave.errMsg, |
217 |
gezelter |
2375 |
"Fortran rejected newGayBerneType\n"); |
218 |
kdaily |
2226 |
painCave.severity = OOPSE_ERROR; |
219 |
|
|
painCave.isFatal = 1; |
220 |
|
|
simError(); |
221 |
|
|
} |
222 |
|
|
|
223 |
|
|
} |
224 |
|
|
|
225 |
|
|
else { |
226 |
|
|
sprintf( painCave.errMsg, |
227 |
|
|
"Can not cast GenericData to GayBerneParam\n"); |
228 |
|
|
painCave.severity = OOPSE_ERROR; |
229 |
|
|
painCave.isFatal = 1; |
230 |
|
|
simError(); |
231 |
|
|
} |
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 |
|
|
} |
240 |
|
|
} |
241 |
|
|
|
242 |
|
|
|
243 |
|
|
|
244 |
gezelter |
1930 |
} //end namespace oopse |