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