| 70 |
|
|
| 71 |
|
SimInfo::SimInfo(ForceField* ff, Globals* simParams) : |
| 72 |
|
forceField_(ff), simParams_(simParams), |
| 73 |
< |
ndf_(0), fdf_local(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0), |
| 73 |
> |
nAtoms_(0), nBonds_(0), nBends_(0), nTorsions_(0), nInversions_(0), |
| 74 |
> |
nRigidBodies_(0), nIntegrableObjects_(0), nCutoffGroups_(0), |
| 75 |
> |
nConstraints_(0), nFluctuatingCharges_(0), |
| 76 |
|
nGlobalMols_(0), nGlobalAtoms_(0), nGlobalCutoffGroups_(0), |
| 77 |
|
nGlobalIntegrableObjects_(0), nGlobalRigidBodies_(0), |
| 78 |
|
nGlobalFluctuatingCharges_(0), nGlobalBonds_(0), nGlobalBends_(0), |
| 79 |
< |
nGlobalTorsions_(0), nGlobalInversions_(0), nAtoms_(0), nBonds_(0), |
| 80 |
< |
nBends_(0), nTorsions_(0), nInversions_(0), nRigidBodies_(0), |
| 81 |
< |
nIntegrableObjects_(0), nCutoffGroups_(0), nConstraints_(0), |
| 82 |
< |
nFluctuatingCharges_(0), sman_(NULL), topologyDone_(false), |
| 83 |
< |
calcBoxDipole_(false), useAtomicVirial_(true) { |
| 79 |
> |
nGlobalTorsions_(0), nGlobalInversions_(0), nGlobalConstraints_(0), |
| 80 |
> |
hasNGlobalConstraints_(false), |
| 81 |
> |
ndf_(0), fdf_local(0), ndfRaw_(0), ndfTrans_(0), nZconstraint_(0), |
| 82 |
> |
sman_(NULL), topologyDone_(false), calcBoxDipole_(false), |
| 83 |
> |
calcBoxQuadrupole_(false), useAtomicVirial_(true) { |
| 84 |
|
|
| 85 |
|
MoleculeStamp* molStamp; |
| 86 |
|
int nMolWithSameStamp; |
| 286 |
|
MPI_Allreduce(&ndf_local, &ndf_, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
| 287 |
|
MPI_Allreduce(&nfq_local, &nGlobalFluctuatingCharges_, 1, |
| 288 |
|
MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
| 287 |
– |
// MPI::COMM_WORLD.Allreduce(&ndf_local, &ndf_, 1, MPI::INT,MPI::SUM); |
| 288 |
– |
// MPI::COMM_WORLD.Allreduce(&nfq_local, &nGlobalFluctuatingCharges_, 1, |
| 289 |
– |
// MPI::INT, MPI::SUM); |
| 289 |
|
#else |
| 290 |
|
ndf_ = ndf_local; |
| 291 |
|
nGlobalFluctuatingCharges_ = nfq_local; |
| 300 |
|
int SimInfo::getFdf() { |
| 301 |
|
#ifdef IS_MPI |
| 302 |
|
MPI_Allreduce(&fdf_local, &fdf_, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
| 304 |
– |
// MPI::COMM_WORLD.Allreduce(&fdf_local, &fdf_, 1, MPI::INT, MPI::SUM); |
| 303 |
|
#else |
| 304 |
|
fdf_ = fdf_local; |
| 305 |
|
#endif |
| 356 |
|
|
| 357 |
|
#ifdef IS_MPI |
| 358 |
|
MPI_Allreduce(&ndfRaw_local, &ndfRaw_, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
| 361 |
– |
// MPI::COMM_WORLD.Allreduce(&ndfRaw_local, &ndfRaw_, 1, MPI::INT, MPI::SUM); |
| 359 |
|
#else |
| 360 |
|
ndfRaw_ = ndfRaw_local; |
| 361 |
|
#endif |
| 366 |
|
|
| 367 |
|
ndfTrans_local = 3 * nIntegrableObjects_ - nConstraints_; |
| 368 |
|
|
| 372 |
– |
|
| 369 |
|
#ifdef IS_MPI |
| 370 |
< |
MPI_Allreduce(&ndfTrans_local, &ndfTrans_, 1, |
| 371 |
< |
MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
| 376 |
< |
// MPI::COMM_WORLD.Allreduce(&ndfTrans_local, &ndfTrans_, 1, |
| 377 |
< |
// MPI::INT, MPI::SUM); |
| 370 |
> |
MPI_Allreduce(&ndfTrans_local, &ndfTrans_, 1, MPI_INT, MPI_SUM, |
| 371 |
> |
MPI_COMM_WORLD); |
| 372 |
|
#else |
| 373 |
|
ndfTrans_ = ndfTrans_local; |
| 374 |
|
#endif |
| 375 |
|
|
| 376 |
|
ndfTrans_ = ndfTrans_ - 3 - nZconstraint_; |
| 383 |
– |
|
| 377 |
|
} |
| 378 |
|
|
| 379 |
|
void SimInfo::addInteractionPairs(Molecule* mol) { |
| 710 |
|
*/ |
| 711 |
|
void SimInfo::update() { |
| 712 |
|
setupSimVariables(); |
| 713 |
+ |
calcNConstraints(); |
| 714 |
|
calcNdf(); |
| 715 |
|
calcNdfRaw(); |
| 716 |
|
calcNdfTrans(); |
| 752 |
|
|
| 753 |
|
int nproc; |
| 754 |
|
MPI_Comm_size( MPI_COMM_WORLD, &nproc); |
| 761 |
– |
// int nproc = MPI::COMM_WORLD.Get_size(); |
| 755 |
|
|
| 756 |
|
// we need arrays to hold the counts and displacement vectors for |
| 757 |
|
// all processors |
| 761 |
|
// fill the counts array |
| 762 |
|
MPI_Allgather(&count_local, 1, MPI_INT, &counts[0], |
| 763 |
|
1, MPI_INT, MPI_COMM_WORLD); |
| 771 |
– |
// MPI::COMM_WORLD.Allgather(&count_local, 1, MPI::INT, &counts[0], |
| 772 |
– |
// 1, MPI::INT); |
| 764 |
|
|
| 765 |
|
// use the processor counts to compute the displacement array |
| 766 |
|
disps[0] = 0; |
| 777 |
|
MPI_Allgatherv(&foundTypes[0], count_local, MPI_INT, |
| 778 |
|
&ftGlobal[0], &counts[0], &disps[0], |
| 779 |
|
MPI_INT, MPI_COMM_WORLD); |
| 789 |
– |
// MPI::COMM_WORLD.Allgatherv(&foundTypes[0], count_local, MPI::INT, |
| 790 |
– |
// &ftGlobal[0], &counts[0], &disps[0], |
| 791 |
– |
// MPI::INT); |
| 780 |
|
|
| 781 |
|
vector<int>::iterator j; |
| 782 |
|
|
| 822 |
|
if ( simParams_->haveAccumulateBoxDipole() ) |
| 823 |
|
if ( simParams_->getAccumulateBoxDipole() ) { |
| 824 |
|
calcBoxDipole_ = true; |
| 825 |
+ |
} |
| 826 |
+ |
// we only call setAccumulateBoxQuadrupole if the accumulateBoxQuadrupole |
| 827 |
+ |
// parameter is true |
| 828 |
+ |
calcBoxQuadrupole_ = false; |
| 829 |
+ |
if ( simParams_->haveAccumulateBoxQuadrupole() ) |
| 830 |
+ |
if ( simParams_->getAccumulateBoxQuadrupole() ) { |
| 831 |
+ |
calcBoxQuadrupole_ = true; |
| 832 |
|
} |
| 833 |
|
|
| 834 |
|
set<AtomType*>::iterator i; |
| 852 |
|
temp = usesDirectional; |
| 853 |
|
MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
| 854 |
|
usesDirectionalAtoms_ = (temp == 0) ? false : true; |
| 860 |
– |
|
| 861 |
– |
// MPI::COMM_WORLD.Allreduce(&temp, &usesDirectionalAtoms_, 1, MPI::BOOL, |
| 862 |
– |
// MPI::LOR); |
| 855 |
|
|
| 856 |
|
temp = usesMetallic; |
| 857 |
|
MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
| 858 |
|
usesMetallicAtoms_ = (temp == 0) ? false : true; |
| 859 |
|
|
| 868 |
– |
// MPI::COMM_WORLD.Allreduce(&temp, &usesMetallicAtoms_, 1, MPI::BOOL, |
| 869 |
– |
// MPI::LOR); |
| 870 |
– |
|
| 860 |
|
temp = usesElectrostatic; |
| 861 |
|
MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
| 862 |
|
usesElectrostaticAtoms_ = (temp == 0) ? false : true; |
| 863 |
|
|
| 875 |
– |
// MPI::COMM_WORLD.Allreduce(&temp, &usesElectrostaticAtoms_, 1, MPI::BOOL, |
| 876 |
– |
// MPI::LOR); |
| 877 |
– |
|
| 864 |
|
temp = usesFluctuatingCharges; |
| 865 |
|
MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
| 866 |
|
usesFluctuatingCharges_ = (temp == 0) ? false : true; |
| 881 |
– |
|
| 882 |
– |
// MPI::COMM_WORLD.Allreduce(&temp, &usesFluctuatingCharges_, 1, MPI::BOOL, |
| 883 |
– |
// MPI::LOR); |
| 884 |
– |
|
| 867 |
|
#else |
| 868 |
|
|
| 869 |
|
usesDirectionalAtoms_ = usesDirectional; |
| 1078 |
|
IOIndexToIntegrableObject= v; |
| 1079 |
|
} |
| 1080 |
|
|
| 1081 |
< |
int SimInfo::getNGlobalConstraints() { |
| 1100 |
< |
int nGlobalConstraints; |
| 1081 |
> |
void SimInfo::calcNConstraints() { |
| 1082 |
|
#ifdef IS_MPI |
| 1083 |
< |
MPI_Allreduce(&nConstraints_, &nGlobalConstraints, 1, |
| 1084 |
< |
MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
| 1104 |
< |
// MPI::COMM_WORLD.Allreduce(&nConstraints_, &nGlobalConstraints, 1, |
| 1105 |
< |
// MPI::INT, MPI::SUM); |
| 1083 |
> |
MPI_Allreduce(&nConstraints_, &nGlobalConstraints_, 1, |
| 1084 |
> |
MPI_INT, MPI_SUM, MPI_COMM_WORLD); |
| 1085 |
|
#else |
| 1086 |
< |
nGlobalConstraints = nConstraints_; |
| 1086 |
> |
nGlobalConstraints_ = nConstraints_; |
| 1087 |
|
#endif |
| 1109 |
– |
return nGlobalConstraints; |
| 1088 |
|
} |
| 1089 |
|
|
| 1090 |
|
}//end namespace OpenMD |