ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/devel_omp/src/parallel/ForceMatrixDecomposition.cpp
(Generate patch)

Comparing branches/devel_omp/src/parallel/ForceMatrixDecomposition.cpp (file contents):
Revision 1599 by mciznick, Fri Jul 29 19:03:36 2011 UTC vs.
Revision 1608 by mciznick, Tue Aug 9 01:58:56 2011 UTC

# Line 989 | Line 989 | void ForceMatrixDecomposition::addForceToAtomRow(int a
989   #else
990          snap_->atomData.force[atom1] += fg;
991   #endif
992 + }
993 +
994 + void ForceMatrixDecomposition::addForceToAtomRowOMP(int atom1, Vector3d fg) {
995 +        #pragma omp critical
996 +        {
997 +                snap_->atomData.force[atom1] += fg;
998 +        }
999   }
1000  
1001   void ForceMatrixDecomposition::addForceToAtomColumn(int atom2, Vector3d fg) {
# Line 999 | Line 1006 | void ForceMatrixDecomposition::addForceToAtomColumn(in
1006   #endif
1007   }
1008  
1009 + void ForceMatrixDecomposition::addForceToAtomColumnOMP(int atom2, Vector3d fg) {
1010 +        #pragma omp critical
1011 +        {
1012 +                snap_->atomData.force[atom2] += fg;
1013 +        }
1014 + }
1015 +
1016   // filling interaction blocks with pointers
1017   void ForceMatrixDecomposition::fillInteractionData(InteractionData &idat, int atom1, int atom2) {
1018 +
1019 +        idat.excluded = excludeAtomPair(atom1, atom2);
1020 +
1021 + #ifdef IS_MPI
1022 +        idat.atypes = make_pair( atypesRow[atom1], atypesCol[atom2]);
1023 +        //idat.atypes = make_pair( ff_->getAtomType(identsRow[atom1]),
1024 +        //                         ff_->getAtomType(identsCol[atom2]) );
1025 +
1026 +        if (storageLayout_ & DataStorage::dslAmat)
1027 +        {
1028 +                idat.A1 = &(atomRowData.aMat[atom1]);
1029 +                idat.A2 = &(atomColData.aMat[atom2]);
1030 +        }
1031 +
1032 +        if (storageLayout_ & DataStorage::dslElectroFrame)
1033 +        {
1034 +                idat.eFrame1 = &(atomRowData.electroFrame[atom1]);
1035 +                idat.eFrame2 = &(atomColData.electroFrame[atom2]);
1036 +        }
1037 +
1038 +        if (storageLayout_ & DataStorage::dslTorque)
1039 +        {
1040 +                idat.t1 = &(atomRowData.torque[atom1]);
1041 +                idat.t2 = &(atomColData.torque[atom2]);
1042 +        }
1043 +
1044 +        if (storageLayout_ & DataStorage::dslDensity)
1045 +        {
1046 +                idat.rho1 = &(atomRowData.density[atom1]);
1047 +                idat.rho2 = &(atomColData.density[atom2]);
1048 +        }
1049 +
1050 +        if (storageLayout_ & DataStorage::dslFunctional)
1051 +        {
1052 +                idat.frho1 = &(atomRowData.functional[atom1]);
1053 +                idat.frho2 = &(atomColData.functional[atom2]);
1054 +        }
1055 +
1056 +        if (storageLayout_ & DataStorage::dslFunctionalDerivative)
1057 +        {
1058 +                idat.dfrho1 = &(atomRowData.functionalDerivative[atom1]);
1059 +                idat.dfrho2 = &(atomColData.functionalDerivative[atom2]);
1060 +        }
1061 +
1062 +        if (storageLayout_ & DataStorage::dslParticlePot)
1063 +        {
1064 +                idat.particlePot1 = &(atomRowData.particlePot[atom1]);
1065 +                idat.particlePot2 = &(atomColData.particlePot[atom2]);
1066 +        }
1067 +
1068 +        if (storageLayout_ & DataStorage::dslSkippedCharge)
1069 +        {
1070 +                idat.skippedCharge1 = &(atomRowData.skippedCharge[atom1]);
1071 +                idat.skippedCharge2 = &(atomColData.skippedCharge[atom2]);
1072 +        }
1073 +
1074 + #else
1075 +
1076 +        idat.atypes = make_pair(atypesLocal[atom1], atypesLocal[atom2]);
1077 +        //idat.atypes = make_pair( ff_->getAtomType(idents[atom1]),
1078 +        //                         ff_->getAtomType(idents[atom2]) );
1079 +
1080 +        if (storageLayout_ & DataStorage::dslAmat)
1081 +        {
1082 +                idat.A1 = &(snap_->atomData.aMat[atom1]);
1083 +                idat.A2 = &(snap_->atomData.aMat[atom2]);
1084 +        }
1085 +
1086 +        if (storageLayout_ & DataStorage::dslElectroFrame)
1087 +        {
1088 +                idat.eFrame1 = &(snap_->atomData.electroFrame[atom1]);
1089 +                idat.eFrame2 = &(snap_->atomData.electroFrame[atom2]);
1090 +        }
1091 +
1092 +        if (storageLayout_ & DataStorage::dslTorque)
1093 +        {
1094 +                idat.t1 = &(snap_->atomData.torque[atom1]);
1095 +                idat.t2 = &(snap_->atomData.torque[atom2]);
1096 +        }
1097 +
1098 +        if (storageLayout_ & DataStorage::dslDensity)
1099 +        {
1100 +                idat.rho1 = &(snap_->atomData.density[atom1]);
1101 +                idat.rho2 = &(snap_->atomData.density[atom2]);
1102 +        }
1103 +
1104 +        if (storageLayout_ & DataStorage::dslFunctional)
1105 +        {
1106 +                idat.frho1 = &(snap_->atomData.functional[atom1]);
1107 +                idat.frho2 = &(snap_->atomData.functional[atom2]);
1108 +        }
1109  
1110 +        if (storageLayout_ & DataStorage::dslFunctionalDerivative)
1111 +        {
1112 +                idat.dfrho1 = &(snap_->atomData.functionalDerivative[atom1]);
1113 +                idat.dfrho2 = &(snap_->atomData.functionalDerivative[atom2]);
1114 +        }
1115 +
1116 +        if (storageLayout_ & DataStorage::dslParticlePot)
1117 +        {
1118 +                idat.particlePot1 = &(snap_->atomData.particlePot[atom1]);
1119 +                idat.particlePot2 = &(snap_->atomData.particlePot[atom2]);
1120 +        }
1121 +
1122 +        if (storageLayout_ & DataStorage::dslSkippedCharge)
1123 +        {
1124 +                idat.skippedCharge1 = &(snap_->atomData.skippedCharge[atom1]);
1125 +                idat.skippedCharge2 = &(snap_->atomData.skippedCharge[atom2]);
1126 +        }
1127 + #endif
1128 + }
1129 +
1130 + // filling interaction blocks with pointers
1131 + void ForceMatrixDecomposition::fillInteractionDataOMP(InteractionDataPrv &idat, int atom1, int atom2) {
1132 +
1133          idat.excluded = excludeAtomPair(atom1, atom2);
1134  
1135   #ifdef IS_MPI
# Line 1126 | Line 1254 | void ForceMatrixDecomposition::unpackInteractionData(I
1254          snap_->atomData.force[atom1] += *(idat.f1);
1255          snap_->atomData.force[atom2] -= *(idat.f1);
1256   #endif
1257 +
1258 + }
1259 +
1260 + void ForceMatrixDecomposition::unpackInteractionDataOMP(InteractionDataPrv &idat, int atom1, int atom2) {
1261 + #pragma omp critical
1262 +        {
1263 +                pairwisePot += idat.pot;
1264  
1265 +                snap_->atomData.force[atom1] += idat.f1;
1266 +                snap_->atomData.force[atom2] -= idat.f1;
1267 +        }
1268   }
1269  
1270   void ForceMatrixDecomposition::reorderGroupCutoffs(vector<int> &order) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines