--- trunk/src/nonbonded/Electrostatic.cpp 2013/08/19 13:12:00 1929 +++ trunk/src/nonbonded/Electrostatic.cpp 2013/08/23 15:59:23 1933 @@ -766,7 +766,6 @@ namespace OpenMD { // Excluded potential that is still computed for fluctuating charges excluded_Pot= 0.0; - // some variables we'll need independent of electrostatic type: ri = 1.0 / *(idat.rij); @@ -887,19 +886,19 @@ namespace OpenMD { Ea += pre14_ * (trQb * rhat * dv21 + 2.0 * Qbr * v22or + rdQbr * rhat * (dv22 - 2.0*v22or)); } - - if ((a_is_Fluctuating || b_is_Fluctuating) - && (idat.excluded || idat.sameRegion)) { + + + if ((a_is_Fluctuating || b_is_Fluctuating) && idat.excluded) { J = Jij[FQtids[idat.atid1]][FQtids[idat.atid2]]; } - + if (a_is_Charge) { if (b_is_Charge) { pref = pre11_ * *(idat.electroMult); U += C_a * C_b * pref * v01; F += C_a * C_b * pref * dv01 * rhat; - + // If this is an excluded pair, there are still indirect // interactions via the reaction field we must worry about: @@ -908,24 +907,21 @@ namespace OpenMD { indirect_Pot += rfContrib; indirect_F += rfContrib * 2.0 * ri * rhat; } - + // Fluctuating charge forces are handled via Coulomb integrals - // for excluded pairs (i.e. those connected via bonds), atoms - // within the same region (for metals) and with the standard - // charge-charge interaction otherwise. + // for excluded pairs (i.e. those connected via bonds) and + // with the standard charge-charge interaction otherwise. - if (idat.excluded || idat.sameRegion) { + if (idat.excluded) { if (a_is_Fluctuating || b_is_Fluctuating) { coulInt = J->getValueAt( *(idat.rij) ); - if (a_is_Fluctuating) dUdCa += coulInt * C_b; - if (b_is_Fluctuating) dUdCb += coulInt * C_a; - if (idat.excluded) - excluded_Pot += C_a * C_b * coulInt; - } + if (a_is_Fluctuating) dUdCa += C_b * coulInt; + if (b_is_Fluctuating) dUdCb += C_a * coulInt; + } } else { if (a_is_Fluctuating) dUdCa += C_b * pref * v01; if (b_is_Fluctuating) dUdCb += C_a * pref * v01; - } + } } if (b_is_Dipole) { @@ -991,7 +987,6 @@ namespace OpenMD { F -= pref * (rdDa * rdDb) * (dv22 - 2.0*v22or) * rhat; Ta += pref * ( v21 * DaxDb - v22 * rdDb * rxDa); Tb += pref * (-v21 * DaxDb - v22 * rdDa * rxDb); - // Even if we excluded this pair from direct interactions, we // still have the reaction-field-mediated dipole-dipole // interaction: @@ -1051,7 +1046,7 @@ namespace OpenMD { trQaQb = QaQb.trace(); rQaQb = rhat * QaQb; QaQbr = QaQb * rhat; - QaxQb = cross(Q_a, Q_b); + QaxQb = mCross(Q_a, Q_b); rQaQbr = dot(rQa, Qbr); rQaxQbr = cross(rQa, Qbr); @@ -1082,7 +1077,6 @@ namespace OpenMD { // + 4.0 * cross(rhat, QbQar) Tb += pref * 2.0 * cross(rhat,Qbr) * rdQar * v43; - } } @@ -1443,9 +1437,8 @@ namespace OpenMD { dks[i] = dk * skr[i]; } if (data.is_Quadrupole) { - Q = atom->getQuadrupole(); - Q *= mPoleConverter; - Qk = Q * kVec; + Q = atom->getQuadrupole() * mPoleConverter; + Qk = Q * kVec; qk = dot(kVec, Qk); qxk[i] = cross(kVec, Qk); qkc[i] = qk * ckr[i]; @@ -1506,7 +1499,7 @@ namespace OpenMD { RealType qtrq1 = AK[kk]*(skr[i]*(ckcs-dkss-qkcs) -ckr[i]*(ckss+dkcs-qkss)); RealType qtrq2 = 2.0*AK[kk]*(ckr[i]*(ckcs-dkss-qkcs) - +skr[i]*(ckss+dkcs-qkss)); + +skr[i]*(ckss+dkcs-qkss)); atom->addFrc( 4.0 * rvol * qfrc * kVec );