51 |
|
#include "UseTheForce/DarkSide/lj_interface.h" |
52 |
|
#include "UseTheForce/DarkSide/eam_interface.h" |
53 |
|
#include "UseTheForce/DarkSide/electrostatic_interface.h" |
54 |
+ |
#include "UseTheForce/DarkSide/suttonchen_interface.h" |
55 |
|
namespace oopse { |
56 |
|
AtomType::AtomType(){ |
57 |
|
|
69 |
|
atp.is_SplitDipole = 0; |
70 |
|
atp.is_Quadrupole = 0; |
71 |
|
atp.is_Sticky = 0; |
72 |
+ |
atp.is_StickyPower = 0; |
73 |
|
atp.is_GayBerne = 0; |
74 |
|
atp.is_EAM = 0; |
75 |
|
atp.is_Shape = 0; |
76 |
|
atp.is_FLARB = 0; |
77 |
+ |
atp.is_SC = 0; |
78 |
+ |
atp.is_MEAM = 0; |
79 |
|
} |
80 |
|
|
81 |
|
void AtomType::makeFortranAtomType() { |
101 |
|
} |
102 |
|
|
103 |
|
status = 0; |
104 |
< |
|
104 |
> |
|
105 |
|
makeAtype(&atp, &status); |
106 |
|
|
107 |
|
if (status != 0) { |
114 |
|
} |
115 |
|
|
116 |
|
|
117 |
< |
void AtomType::complete() { |
117 |
> |
void AtomType::complete() { |
118 |
|
int isError; |
119 |
|
GenericData* data; |
120 |
|
|
121 |
|
//notify a new LJtype atom type is created |
122 |
|
if (isLennardJones()) { |
123 |
< |
data = getPropertyByName("LennardJones"); |
124 |
< |
if (data != NULL) { |
125 |
< |
LJParamGenericData* ljData = dynamic_cast<LJParamGenericData*>(data); |
123 |
> |
data = getPropertyByName("LennardJones"); |
124 |
> |
if (data != NULL) { |
125 |
> |
LJParamGenericData* ljData = dynamic_cast<LJParamGenericData*>(data); |
126 |
|
|
127 |
< |
if (ljData != NULL) { |
128 |
< |
LJParam ljParam = ljData->getData(); |
127 |
> |
if (ljData != NULL) { |
128 |
> |
LJParam ljParam = ljData->getData(); |
129 |
|
|
130 |
< |
newLJtype(&atp.ident, &ljParam.sigma, &ljParam.epsilon, &ljParam.soft_pot, &isError); |
130 |
> |
newLJtype(&atp.ident, &ljParam.sigma, &ljParam.epsilon, &ljParam.soft_pot, |
131 |
> |
&isError); |
132 |
|
|
133 |
< |
if (isError != 0) { |
134 |
< |
sprintf( painCave.errMsg, |
135 |
< |
"Fortran rejected newLJtype\n"); |
136 |
< |
painCave.severity = OOPSE_ERROR; |
137 |
< |
painCave.isFatal = 1; |
138 |
< |
simError(); |
139 |
< |
} |
133 |
> |
if (isError != 0) { |
134 |
> |
sprintf( painCave.errMsg, |
135 |
> |
"Fortran rejected newLJtype\n"); |
136 |
> |
painCave.severity = OOPSE_ERROR; |
137 |
> |
painCave.isFatal = 1; |
138 |
> |
simError(); |
139 |
> |
} |
140 |
|
|
141 |
< |
} else { |
142 |
< |
sprintf( painCave.errMsg, |
143 |
< |
"Can not cast GenericData to LJParam\n"); |
144 |
< |
painCave.severity = OOPSE_ERROR; |
145 |
< |
painCave.isFatal = 1; |
146 |
< |
simError(); |
147 |
< |
} |
148 |
< |
} else { |
149 |
< |
sprintf( painCave.errMsg, "Can not find Parameters for LennardJones\n"); |
150 |
< |
painCave.severity = OOPSE_ERROR; |
151 |
< |
painCave.isFatal = 1; |
152 |
< |
simError(); |
153 |
< |
} |
141 |
> |
} else { |
142 |
> |
sprintf( painCave.errMsg, |
143 |
> |
"Can not cast GenericData to LJParam\n"); |
144 |
> |
painCave.severity = OOPSE_ERROR; |
145 |
> |
painCave.isFatal = 1; |
146 |
> |
simError(); |
147 |
> |
} |
148 |
> |
} else { |
149 |
> |
sprintf( painCave.errMsg, "Can not find Parameters for LennardJones\n"); |
150 |
> |
painCave.severity = OOPSE_ERROR; |
151 |
> |
painCave.isFatal = 1; |
152 |
> |
simError(); |
153 |
> |
} |
154 |
|
} |
155 |
|
|
156 |
|
if (isElectrostatic()) { |
165 |
|
} |
166 |
|
|
167 |
|
if (isCharge()) { |
168 |
< |
data = getPropertyByName("Charge"); |
169 |
< |
if (data != NULL) { |
170 |
< |
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
168 |
> |
data = getPropertyByName("Charge"); |
169 |
> |
if (data != NULL) { |
170 |
> |
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
171 |
|
|
172 |
< |
if (doubleData != NULL) { |
173 |
< |
double charge = doubleData->getData(); |
174 |
< |
setCharge(&atp.ident, &charge, &isError); |
172 |
> |
if (doubleData != NULL) { |
173 |
> |
RealType charge = doubleData->getData(); |
174 |
> |
setCharge(&atp.ident, &charge, &isError); |
175 |
|
|
176 |
< |
if (isError != 0) { |
177 |
< |
sprintf( painCave.errMsg, |
178 |
< |
"Fortran rejected setCharge\n"); |
179 |
< |
painCave.severity = OOPSE_ERROR; |
180 |
< |
painCave.isFatal = 1; |
181 |
< |
simError(); |
182 |
< |
} |
183 |
< |
} else { |
184 |
< |
sprintf( painCave.errMsg, |
185 |
< |
"Can not cast GenericData to DoubleGenericData\n"); |
186 |
< |
painCave.severity = OOPSE_ERROR; |
187 |
< |
painCave.isFatal = 1; |
188 |
< |
simError(); |
189 |
< |
} |
190 |
< |
} else { |
191 |
< |
sprintf( painCave.errMsg, "Can not find Charge Parameters\n"); |
192 |
< |
painCave.severity = OOPSE_ERROR; |
193 |
< |
painCave.isFatal = 1; |
194 |
< |
simError(); |
195 |
< |
} |
176 |
> |
if (isError != 0) { |
177 |
> |
sprintf( painCave.errMsg, |
178 |
> |
"Fortran rejected setCharge\n"); |
179 |
> |
painCave.severity = OOPSE_ERROR; |
180 |
> |
painCave.isFatal = 1; |
181 |
> |
simError(); |
182 |
> |
} |
183 |
> |
} else { |
184 |
> |
sprintf( painCave.errMsg, |
185 |
> |
"Can not cast GenericData to DoubleGenericData\n"); |
186 |
> |
painCave.severity = OOPSE_ERROR; |
187 |
> |
painCave.isFatal = 1; |
188 |
> |
simError(); |
189 |
> |
} |
190 |
> |
} else { |
191 |
> |
sprintf( painCave.errMsg, "Can not find Charge Parameters\n"); |
192 |
> |
painCave.severity = OOPSE_ERROR; |
193 |
> |
painCave.isFatal = 1; |
194 |
> |
simError(); |
195 |
> |
} |
196 |
|
} |
197 |
|
|
198 |
|
if (isEAM()) { |
199 |
< |
data = getPropertyByName("EAM"); |
200 |
< |
if (data != NULL) { |
201 |
< |
EAMParamGenericData* eamData = dynamic_cast<EAMParamGenericData*>(data); |
199 |
> |
data = getPropertyByName("EAM"); |
200 |
> |
if (data != NULL) { |
201 |
> |
EAMParamGenericData* eamData = dynamic_cast<EAMParamGenericData*>(data); |
202 |
|
|
203 |
< |
if (eamData != NULL) { |
203 |
> |
if (eamData != NULL) { |
204 |
|
|
205 |
< |
EAMParam eamParam = eamData->getData(); |
205 |
> |
EAMParam eamParam = eamData->getData(); |
206 |
|
|
207 |
|
|
208 |
< |
newEAMtype(&eamParam.latticeConstant, &eamParam.nrho, &eamParam.drho, &eamParam.nr, &eamParam.dr, &eamParam.rcut, |
209 |
< |
&eamParam.rvals[0], &eamParam.rhovals[0], &eamParam.Frhovals[0], &atp.ident, &isError ); |
208 |
> |
newEAMtype(&eamParam.latticeConstant, &eamParam.nrho, &eamParam.drho, |
209 |
> |
&eamParam.nr, &eamParam.dr, &eamParam.rcut, &eamParam.rvals[0], |
210 |
> |
&eamParam.rhovals[0], &eamParam.Frhovals[0], &atp.ident, |
211 |
> |
&isError ); |
212 |
|
|
213 |
< |
if (isError != 0) { |
214 |
< |
sprintf( painCave.errMsg, |
215 |
< |
"Fortran rejected newEAMtype\n"); |
216 |
< |
painCave.severity = OOPSE_ERROR; |
217 |
< |
painCave.isFatal = 1; |
218 |
< |
simError(); |
219 |
< |
} |
220 |
< |
} else { |
221 |
< |
sprintf( painCave.errMsg, |
222 |
< |
"Can not cast GenericData to EAMParam\n"); |
223 |
< |
painCave.severity = OOPSE_ERROR; |
224 |
< |
painCave.isFatal = 1; |
225 |
< |
simError(); |
226 |
< |
} |
227 |
< |
} else { |
228 |
< |
sprintf( painCave.errMsg, "Can not find EAM Parameters\n"); |
213 |
> |
if (isError != 0) { |
214 |
> |
sprintf( painCave.errMsg, |
215 |
> |
"Fortran rejected newEAMtype\n"); |
216 |
> |
painCave.severity = OOPSE_ERROR; |
217 |
> |
painCave.isFatal = 1; |
218 |
> |
simError(); |
219 |
> |
} |
220 |
> |
} else { |
221 |
> |
sprintf( painCave.errMsg, |
222 |
> |
"Can not cast GenericData to EAMParam\n"); |
223 |
> |
painCave.severity = OOPSE_ERROR; |
224 |
> |
painCave.isFatal = 1; |
225 |
> |
simError(); |
226 |
> |
} |
227 |
> |
} else { |
228 |
> |
sprintf( painCave.errMsg, "Can not find EAM Parameters\n"); |
229 |
> |
painCave.severity = OOPSE_ERROR; |
230 |
> |
painCave.isFatal = 1; |
231 |
> |
simError(); |
232 |
> |
} |
233 |
> |
} |
234 |
> |
|
235 |
> |
|
236 |
> |
if (isSC()) { |
237 |
> |
data = getPropertyByName("SC"); |
238 |
> |
if (data != NULL) { |
239 |
> |
SCParamGenericData* SCData = dynamic_cast<SCParamGenericData*>(data); |
240 |
> |
|
241 |
> |
if (SCData != NULL) { |
242 |
> |
|
243 |
> |
SCParam scParam = SCData->getData(); |
244 |
> |
|
245 |
> |
|
246 |
> |
newSCtype(&atp.ident, &scParam.c, &scParam.m, |
247 |
> |
&scParam.n, &scParam.alpha, &scParam.epsilon, |
248 |
> |
&isError ); |
249 |
> |
|
250 |
> |
if (isError != 0) { |
251 |
> |
sprintf( painCave.errMsg, |
252 |
> |
"Fortran rejected newSCtype\n"); |
253 |
|
painCave.severity = OOPSE_ERROR; |
254 |
|
painCave.isFatal = 1; |
255 |
|
simError(); |
256 |
+ |
} |
257 |
+ |
} else { |
258 |
+ |
sprintf( painCave.errMsg, |
259 |
+ |
"Can not cast GenericData to SCParam\n"); |
260 |
+ |
painCave.severity = OOPSE_ERROR; |
261 |
+ |
painCave.isFatal = 1; |
262 |
+ |
simError(); |
263 |
|
} |
264 |
+ |
} else { |
265 |
+ |
sprintf( painCave.errMsg, "Can not find SC Parameters\n"); |
266 |
+ |
painCave.severity = OOPSE_ERROR; |
267 |
+ |
painCave.isFatal = 1; |
268 |
+ |
simError(); |
269 |
+ |
} |
270 |
|
} |
227 |
– |
|
271 |
|
|
272 |
< |
} |
272 |
> |
|
273 |
> |
|
274 |
> |
} |
275 |
|
|
276 |
< |
void AtomType::addProperty(GenericData* genData) { |
276 |
> |
void AtomType::addProperty(GenericData* genData) { |
277 |
|
properties_.addProperty(genData); |
278 |
< |
} |
278 |
> |
} |
279 |
|
|
280 |
< |
void AtomType::removeProperty(const std::string& propName) { |
280 |
> |
void AtomType::removeProperty(const std::string& propName) { |
281 |
|
properties_.removeProperty(propName); |
282 |
< |
} |
282 |
> |
} |
283 |
|
|
284 |
< |
void AtomType::clearProperties() { |
284 |
> |
void AtomType::clearProperties() { |
285 |
|
properties_.clearProperties(); |
286 |
< |
} |
286 |
> |
} |
287 |
|
|
288 |
< |
std::vector<std::string> AtomType::getPropertyNames() { |
288 |
> |
std::vector<std::string> AtomType::getPropertyNames() { |
289 |
|
return properties_.getPropertyNames(); |
290 |
< |
} |
290 |
> |
} |
291 |
|
|
292 |
< |
std::vector<GenericData*> AtomType::getProperties() { |
292 |
> |
std::vector<GenericData*> AtomType::getProperties() { |
293 |
|
return properties_.getProperties(); |
294 |
< |
} |
294 |
> |
} |
295 |
|
|
296 |
< |
GenericData* AtomType::getPropertyByName(const std::string& propName) { |
296 |
> |
GenericData* AtomType::getPropertyByName(const std::string& propName) { |
297 |
|
return properties_.getPropertyByName(propName); |
298 |
< |
} |
298 |
> |
} |
299 |
|
} |