799 |
|
} |
800 |
|
|
801 |
|
//calculate mass ratio of cutoff group |
802 |
< |
std::vector<double> mfact; |
802 |
> |
std::vector<RealType> mfact; |
803 |
|
SimInfo::MoleculeIterator mi; |
804 |
|
Molecule* mol; |
805 |
|
Molecule::CutoffGroupIterator ci; |
806 |
|
CutoffGroup* cg; |
807 |
|
Molecule::AtomIterator ai; |
808 |
|
Atom* atom; |
809 |
< |
double totalMass; |
809 |
> |
RealType totalMass; |
810 |
|
|
811 |
|
//to avoid memory reallocation, reserve enough space for mfact |
812 |
|
mfact.reserve(getNCutoffGroups()); |
966 |
|
notifyFortranCutoffPolicy(&cp); |
967 |
|
|
968 |
|
// Check the Skin Thickness for neighborlists |
969 |
< |
double skin; |
969 |
> |
RealType skin; |
970 |
|
if (simParams_->haveSkinThickness()) { |
971 |
|
skin = simParams_->getSkinThickness(); |
972 |
|
notifyFortranSkinThickness(&skin); |
1056 |
|
int errorOut; |
1057 |
|
int esm = NONE; |
1058 |
|
int sm = UNDAMPED; |
1059 |
< |
double alphaVal; |
1060 |
< |
double dielectric; |
1059 |
> |
RealType alphaVal; |
1060 |
> |
RealType dielectric; |
1061 |
|
|
1062 |
|
errorOut = isError; |
1063 |
|
alphaVal = simParams_->getDampingAlpha(); |
1217 |
|
Molecule* mol; |
1218 |
|
|
1219 |
|
Vector3d comVel(0.0); |
1220 |
< |
double totalMass = 0.0; |
1220 |
> |
RealType totalMass = 0.0; |
1221 |
|
|
1222 |
|
|
1223 |
|
for (mol = beginMolecule(i); mol != NULL; mol = nextMolecule(i)) { |
1224 |
< |
double mass = mol->getMass(); |
1224 |
> |
RealType mass = mol->getMass(); |
1225 |
|
totalMass += mass; |
1226 |
|
comVel += mass * mol->getComVel(); |
1227 |
|
} |
1228 |
|
|
1229 |
|
#ifdef IS_MPI |
1230 |
< |
double tmpMass = totalMass; |
1230 |
> |
RealType tmpMass = totalMass; |
1231 |
|
Vector3d tmpComVel(comVel); |
1232 |
< |
MPI_Allreduce(&tmpMass,&totalMass,1,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
1233 |
< |
MPI_Allreduce(tmpComVel.getArrayPointer(), comVel.getArrayPointer(),3,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
1232 |
> |
MPI_Allreduce(&tmpMass,&totalMass,1,MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); |
1233 |
> |
MPI_Allreduce(tmpComVel.getArrayPointer(), comVel.getArrayPointer(),3,MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); |
1234 |
|
#endif |
1235 |
|
|
1236 |
|
comVel /= totalMass; |
1243 |
|
Molecule* mol; |
1244 |
|
|
1245 |
|
Vector3d com(0.0); |
1246 |
< |
double totalMass = 0.0; |
1246 |
> |
RealType totalMass = 0.0; |
1247 |
|
|
1248 |
|
for (mol = beginMolecule(i); mol != NULL; mol = nextMolecule(i)) { |
1249 |
< |
double mass = mol->getMass(); |
1249 |
> |
RealType mass = mol->getMass(); |
1250 |
|
totalMass += mass; |
1251 |
|
com += mass * mol->getCom(); |
1252 |
|
} |
1253 |
|
|
1254 |
|
#ifdef IS_MPI |
1255 |
< |
double tmpMass = totalMass; |
1255 |
> |
RealType tmpMass = totalMass; |
1256 |
|
Vector3d tmpCom(com); |
1257 |
< |
MPI_Allreduce(&tmpMass,&totalMass,1,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
1258 |
< |
MPI_Allreduce(tmpCom.getArrayPointer(), com.getArrayPointer(),3,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
1257 |
> |
MPI_Allreduce(&tmpMass,&totalMass,1,MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); |
1258 |
> |
MPI_Allreduce(tmpCom.getArrayPointer(), com.getArrayPointer(),3,MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); |
1259 |
|
#endif |
1260 |
|
|
1261 |
|
com /= totalMass; |
1279 |
|
Molecule* mol; |
1280 |
|
|
1281 |
|
|
1282 |
< |
double totalMass = 0.0; |
1282 |
> |
RealType totalMass = 0.0; |
1283 |
|
|
1284 |
|
|
1285 |
|
for (mol = beginMolecule(i); mol != NULL; mol = nextMolecule(i)) { |
1286 |
< |
double mass = mol->getMass(); |
1286 |
> |
RealType mass = mol->getMass(); |
1287 |
|
totalMass += mass; |
1288 |
|
com += mass * mol->getCom(); |
1289 |
|
comVel += mass * mol->getComVel(); |
1290 |
|
} |
1291 |
|
|
1292 |
|
#ifdef IS_MPI |
1293 |
< |
double tmpMass = totalMass; |
1293 |
> |
RealType tmpMass = totalMass; |
1294 |
|
Vector3d tmpCom(com); |
1295 |
|
Vector3d tmpComVel(comVel); |
1296 |
< |
MPI_Allreduce(&tmpMass,&totalMass,1,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
1297 |
< |
MPI_Allreduce(tmpCom.getArrayPointer(), com.getArrayPointer(),3,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
1298 |
< |
MPI_Allreduce(tmpComVel.getArrayPointer(), comVel.getArrayPointer(),3,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
1296 |
> |
MPI_Allreduce(&tmpMass,&totalMass,1,MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); |
1297 |
> |
MPI_Allreduce(tmpCom.getArrayPointer(), com.getArrayPointer(),3,MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); |
1298 |
> |
MPI_Allreduce(tmpComVel.getArrayPointer(), comVel.getArrayPointer(),3,MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); |
1299 |
|
#endif |
1300 |
|
|
1301 |
|
com /= totalMass; |
1314 |
|
void SimInfo::getInertiaTensor(Mat3x3d &inertiaTensor, Vector3d &angularMomentum){ |
1315 |
|
|
1316 |
|
|
1317 |
< |
double xx = 0.0; |
1318 |
< |
double yy = 0.0; |
1319 |
< |
double zz = 0.0; |
1320 |
< |
double xy = 0.0; |
1321 |
< |
double xz = 0.0; |
1322 |
< |
double yz = 0.0; |
1317 |
> |
RealType xx = 0.0; |
1318 |
> |
RealType yy = 0.0; |
1319 |
> |
RealType zz = 0.0; |
1320 |
> |
RealType xy = 0.0; |
1321 |
> |
RealType xz = 0.0; |
1322 |
> |
RealType yz = 0.0; |
1323 |
|
Vector3d com(0.0); |
1324 |
|
Vector3d comVel(0.0); |
1325 |
|
|
1331 |
|
Vector3d thisq(0.0); |
1332 |
|
Vector3d thisv(0.0); |
1333 |
|
|
1334 |
< |
double thisMass = 0.0; |
1334 |
> |
RealType thisMass = 0.0; |
1335 |
|
|
1336 |
|
|
1337 |
|
|
1369 |
|
#ifdef IS_MPI |
1370 |
|
Mat3x3d tmpI(inertiaTensor); |
1371 |
|
Vector3d tmpAngMom; |
1372 |
< |
MPI_Allreduce(tmpI.getArrayPointer(), inertiaTensor.getArrayPointer(),9,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
1373 |
< |
MPI_Allreduce(tmpAngMom.getArrayPointer(), angularMomentum.getArrayPointer(),3,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
1372 |
> |
MPI_Allreduce(tmpI.getArrayPointer(), inertiaTensor.getArrayPointer(),9,MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); |
1373 |
> |
MPI_Allreduce(tmpAngMom.getArrayPointer(), angularMomentum.getArrayPointer(),3,MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); |
1374 |
|
#endif |
1375 |
|
|
1376 |
|
return; |
1391 |
|
Vector3d thisr(0.0); |
1392 |
|
Vector3d thisp(0.0); |
1393 |
|
|
1394 |
< |
double thisMass; |
1394 |
> |
RealType thisMass; |
1395 |
|
|
1396 |
|
for (mol = beginMolecule(i); mol != NULL; mol = nextMolecule(i)) { |
1397 |
|
thisMass = mol->getMass(); |
1404 |
|
|
1405 |
|
#ifdef IS_MPI |
1406 |
|
Vector3d tmpAngMom; |
1407 |
< |
MPI_Allreduce(tmpAngMom.getArrayPointer(), angularMomentum.getArrayPointer(),3,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
1407 |
> |
MPI_Allreduce(tmpAngMom.getArrayPointer(), angularMomentum.getArrayPointer(),3,MPI_REALTYPE,MPI_SUM, MPI_COMM_WORLD); |
1408 |
|
#endif |
1409 |
|
|
1410 |
|
return angularMomentum; |