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 |
50 |
|
#include "UseTheForce/DarkSide/atype_interface.h" |
51 |
|
#include "UseTheForce/DarkSide/lj_interface.h" |
52 |
|
#include "UseTheForce/DarkSide/eam_interface.h" |
53 |
< |
#include "UseTheForce/DarkSide/charge_interface.h" |
53 |
> |
#include "UseTheForce/DarkSide/electrostatic_interface.h" |
54 |
|
namespace oopse { |
55 |
|
AtomType::AtomType(){ |
56 |
|
|
65 |
|
atp.is_LennardJones = 0; |
66 |
|
atp.is_Charge = 0; |
67 |
|
atp.is_Dipole = 0; |
68 |
+ |
atp.is_SplitDipole = 0; |
69 |
|
atp.is_Quadrupole = 0; |
70 |
|
atp.is_Sticky = 0; |
71 |
|
atp.is_GayBerne = 0; |
97 |
|
} |
98 |
|
|
99 |
|
status = 0; |
100 |
+ |
|
101 |
+ |
|
102 |
+ |
std::cout << "Calling makeAtype with atp.ident = " << atp.ident << "\n"; |
103 |
|
|
104 |
|
makeAtype(&atp, &status); |
105 |
|
|
113 |
|
} |
114 |
|
|
115 |
|
|
116 |
< |
void AtomType::complete() { |
116 |
> |
void AtomType::complete() { |
117 |
|
int isError; |
118 |
|
GenericData* data; |
119 |
|
|
120 |
|
//notify a new LJtype atom type is created |
121 |
|
if (isLennardJones()) { |
122 |
< |
data = getPropertyByName("LennardJones"); |
123 |
< |
if (data != NULL) { |
124 |
< |
LJParamGenericData* ljData = dynamic_cast<LJParamGenericData*>(data); |
122 |
> |
data = getPropertyByName("LennardJones"); |
123 |
> |
if (data != NULL) { |
124 |
> |
LJParamGenericData* ljData = dynamic_cast<LJParamGenericData*>(data); |
125 |
|
|
126 |
< |
if (ljData != NULL) { |
127 |
< |
LJParam ljParam = ljData->getData(); |
126 |
> |
if (ljData != NULL) { |
127 |
> |
LJParam ljParam = ljData->getData(); |
128 |
|
|
129 |
< |
newLJtype(&atp.ident, &ljParam.sigma, &ljParam.epsilon, &ljParam.soft_pot, &isError); |
129 |
> |
newLJtype(&atp.ident, &ljParam.sigma, &ljParam.epsilon, &ljParam.soft_pot, &isError); |
130 |
|
|
131 |
< |
if (isError != 0) { |
132 |
< |
sprintf( painCave.errMsg, |
133 |
< |
"Fortran rejected newLJtype\n"); |
134 |
< |
painCave.severity = OOPSE_ERROR; |
135 |
< |
painCave.isFatal = 1; |
136 |
< |
simError(); |
137 |
< |
} |
131 |
> |
if (isError != 0) { |
132 |
> |
sprintf( painCave.errMsg, |
133 |
> |
"Fortran rejected newLJtype\n"); |
134 |
> |
painCave.severity = OOPSE_ERROR; |
135 |
> |
painCave.isFatal = 1; |
136 |
> |
simError(); |
137 |
> |
} |
138 |
|
|
139 |
< |
} else { |
140 |
< |
sprintf( painCave.errMsg, |
141 |
< |
"Can not cast GenericData to LJParam\n"); |
142 |
< |
painCave.severity = OOPSE_ERROR; |
143 |
< |
painCave.isFatal = 1; |
144 |
< |
simError(); |
145 |
< |
} |
146 |
< |
} else { |
147 |
< |
sprintf( painCave.errMsg, "Can not find Parameters for LennardJones\n"); |
148 |
< |
painCave.severity = OOPSE_ERROR; |
149 |
< |
painCave.isFatal = 1; |
150 |
< |
simError(); |
151 |
< |
} |
139 |
> |
} else { |
140 |
> |
sprintf( painCave.errMsg, |
141 |
> |
"Can not cast GenericData to LJParam\n"); |
142 |
> |
painCave.severity = OOPSE_ERROR; |
143 |
> |
painCave.isFatal = 1; |
144 |
> |
simError(); |
145 |
> |
} |
146 |
> |
} else { |
147 |
> |
sprintf( painCave.errMsg, "Can not find Parameters for LennardJones\n"); |
148 |
> |
painCave.severity = OOPSE_ERROR; |
149 |
> |
painCave.isFatal = 1; |
150 |
> |
simError(); |
151 |
> |
} |
152 |
|
} |
153 |
|
|
154 |
+ |
if (isElectrostatic()) { |
155 |
+ |
newElectrostaticType(&atp, &isError); |
156 |
+ |
if (isError != 0) { |
157 |
+ |
sprintf( painCave.errMsg, |
158 |
+ |
"Fortran rejected newElectrostaticType\n"); |
159 |
+ |
painCave.severity = OOPSE_ERROR; |
160 |
+ |
painCave.isFatal = 1; |
161 |
+ |
simError(); |
162 |
+ |
} |
163 |
+ |
} |
164 |
+ |
|
165 |
|
if (isCharge()) { |
166 |
< |
data = getPropertyByName("Charge"); |
167 |
< |
if (data != NULL) { |
168 |
< |
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
166 |
> |
data = getPropertyByName("Charge"); |
167 |
> |
if (data != NULL) { |
168 |
> |
DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data); |
169 |
|
|
170 |
< |
if (doubleData != NULL) { |
171 |
< |
double charge = doubleData->getData(); |
172 |
< |
newChargeType(&atp.ident, &charge, &isError); |
173 |
< |
|
174 |
< |
if (isError != 0) { |
175 |
< |
sprintf( painCave.errMsg, |
176 |
< |
"Fortran rejected newChargeType\n"); |
177 |
< |
painCave.severity = OOPSE_ERROR; |
178 |
< |
painCave.isFatal = 1; |
179 |
< |
simError(); |
180 |
< |
} |
181 |
< |
} else { |
182 |
< |
sprintf( painCave.errMsg, |
183 |
< |
"Can not cast GenericData to DoubleGenericData\n"); |
184 |
< |
painCave.severity = OOPSE_ERROR; |
185 |
< |
painCave.isFatal = 1; |
186 |
< |
simError(); |
187 |
< |
} |
188 |
< |
} else { |
189 |
< |
sprintf( painCave.errMsg, "Can not find Charge Parameters\n"); |
190 |
< |
painCave.severity = OOPSE_ERROR; |
191 |
< |
painCave.isFatal = 1; |
192 |
< |
simError(); |
193 |
< |
} |
170 |
> |
if (doubleData != NULL) { |
171 |
> |
double charge = doubleData->getData(); |
172 |
> |
setCharge(&atp.ident, &charge, &isError); |
173 |
> |
|
174 |
> |
if (isError != 0) { |
175 |
> |
sprintf( painCave.errMsg, |
176 |
> |
"Fortran rejected setCharge\n"); |
177 |
> |
painCave.severity = OOPSE_ERROR; |
178 |
> |
painCave.isFatal = 1; |
179 |
> |
simError(); |
180 |
> |
} |
181 |
> |
} else { |
182 |
> |
sprintf( painCave.errMsg, |
183 |
> |
"Can not cast GenericData to DoubleGenericData\n"); |
184 |
> |
painCave.severity = OOPSE_ERROR; |
185 |
> |
painCave.isFatal = 1; |
186 |
> |
simError(); |
187 |
> |
} |
188 |
> |
} else { |
189 |
> |
sprintf( painCave.errMsg, "Can not find Charge Parameters\n"); |
190 |
> |
painCave.severity = OOPSE_ERROR; |
191 |
> |
painCave.isFatal = 1; |
192 |
> |
simError(); |
193 |
> |
} |
194 |
|
} |
195 |
|
|
196 |
|
if (isEAM()) { |
197 |
< |
data = getPropertyByName("EAM"); |
198 |
< |
if (data != NULL) { |
199 |
< |
EAMParamGenericData* eamData = dynamic_cast<EAMParamGenericData*>(data); |
197 |
> |
data = getPropertyByName("EAM"); |
198 |
> |
if (data != NULL) { |
199 |
> |
EAMParamGenericData* eamData = dynamic_cast<EAMParamGenericData*>(data); |
200 |
|
|
201 |
< |
if (eamData != NULL) { |
201 |
> |
if (eamData != NULL) { |
202 |
|
|
203 |
< |
EAMParam eamParam = eamData->getData(); |
203 |
> |
EAMParam eamParam = eamData->getData(); |
204 |
|
|
205 |
|
|
206 |
< |
newEAMtype(&eamParam.latticeConstant, &eamParam.nrho, &eamParam.drho, &eamParam.nr, &eamParam.dr, &eamParam.rcut, |
207 |
< |
&eamParam.rvals[0], &eamParam.rhovals[0], &eamParam.Frhovals[0], &atp.ident, &isError ); |
206 |
> |
newEAMtype(&eamParam.latticeConstant, &eamParam.nrho, &eamParam.drho, &eamParam.nr, &eamParam.dr, &eamParam.rcut, |
207 |
> |
&eamParam.rvals[0], &eamParam.rhovals[0], &eamParam.Frhovals[0], &atp.ident, &isError ); |
208 |
|
|
209 |
< |
if (isError != 0) { |
210 |
< |
sprintf( painCave.errMsg, |
211 |
< |
"Fortran rejected newEAMtype\n"); |
212 |
< |
painCave.severity = OOPSE_ERROR; |
213 |
< |
painCave.isFatal = 1; |
214 |
< |
simError(); |
215 |
< |
} |
216 |
< |
} else { |
217 |
< |
sprintf( painCave.errMsg, |
218 |
< |
"Can not cast GenericData to EAMParam\n"); |
219 |
< |
painCave.severity = OOPSE_ERROR; |
220 |
< |
painCave.isFatal = 1; |
221 |
< |
simError(); |
222 |
< |
} |
223 |
< |
} else { |
224 |
< |
sprintf( painCave.errMsg, "Can not find EAM Parameters\n"); |
225 |
< |
painCave.severity = OOPSE_ERROR; |
226 |
< |
painCave.isFatal = 1; |
227 |
< |
simError(); |
228 |
< |
} |
209 |
> |
if (isError != 0) { |
210 |
> |
sprintf( painCave.errMsg, |
211 |
> |
"Fortran rejected newEAMtype\n"); |
212 |
> |
painCave.severity = OOPSE_ERROR; |
213 |
> |
painCave.isFatal = 1; |
214 |
> |
simError(); |
215 |
> |
} |
216 |
> |
} else { |
217 |
> |
sprintf( painCave.errMsg, |
218 |
> |
"Can not cast GenericData to EAMParam\n"); |
219 |
> |
painCave.severity = OOPSE_ERROR; |
220 |
> |
painCave.isFatal = 1; |
221 |
> |
simError(); |
222 |
> |
} |
223 |
> |
} else { |
224 |
> |
sprintf( painCave.errMsg, "Can not find EAM Parameters\n"); |
225 |
> |
painCave.severity = OOPSE_ERROR; |
226 |
> |
painCave.isFatal = 1; |
227 |
> |
simError(); |
228 |
> |
} |
229 |
|
} |
230 |
|
|
231 |
|
|
232 |
< |
} |
232 |
> |
} |
233 |
|
|
234 |
< |
void AtomType::addProperty(GenericData* genData) { |
234 |
> |
void AtomType::addProperty(GenericData* genData) { |
235 |
|
properties_.addProperty(genData); |
236 |
< |
} |
236 |
> |
} |
237 |
|
|
238 |
< |
void AtomType::removeProperty(const std::string& propName) { |
238 |
> |
void AtomType::removeProperty(const std::string& propName) { |
239 |
|
properties_.removeProperty(propName); |
240 |
< |
} |
240 |
> |
} |
241 |
|
|
242 |
< |
void AtomType::clearProperties() { |
242 |
> |
void AtomType::clearProperties() { |
243 |
|
properties_.clearProperties(); |
244 |
< |
} |
244 |
> |
} |
245 |
|
|
246 |
< |
std::vector<std::string> AtomType::getPropertyNames() { |
246 |
> |
std::vector<std::string> AtomType::getPropertyNames() { |
247 |
|
return properties_.getPropertyNames(); |
248 |
< |
} |
248 |
> |
} |
249 |
|
|
250 |
< |
std::vector<GenericData*> AtomType::getProperties() { |
250 |
> |
std::vector<GenericData*> AtomType::getProperties() { |
251 |
|
return properties_.getProperties(); |
252 |
< |
} |
252 |
> |
} |
253 |
|
|
254 |
< |
GenericData* AtomType::getPropertyByName(const std::string& propName) { |
254 |
> |
GenericData* AtomType::getPropertyByName(const std::string& propName) { |
255 |
|
return properties_.getPropertyByName(propName); |
256 |
< |
} |
256 |
> |
} |
257 |
|
} |