ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/nonbonded/Electrostatic.cpp
(Generate patch)

Comparing branches/development/src/nonbonded/Electrostatic.cpp (file contents):
Revision 1821 by gezelter, Mon Jan 7 20:05:43 2013 UTC vs.
Revision 1822 by gezelter, Tue Jan 8 15:29:03 2013 UTC

# Line 695 | Line 695 | namespace OpenMD {
695      RealType DadDb, trQaQb, DadQbr, DbdQar;       // Cross-interaction scalars
696      RealType rQaQbr;
697      Vector3d DaxDb, DadQb, DbdQa, DaxQbr, DbxQar; // Cross-interaction vectors
698 <    Vector3d rQaQb, QaQbr, QaxQb, QbxQa, rQaxQbr, QbQar, rQbxQar;
699 <    Mat3x3d  QaQb, QbQa;                          // Cross-interaction matrices
698 >    Vector3d rQaQb, QaQbr, QaxQb, rQaxQbr;
699 >    Mat3x3d  QaQb;                                // Cross-interaction matrices
700  
701      RealType U(0.0);  // Potential
702      Vector3d F(0.0);  // Force
# Line 793 | Line 793 | namespace OpenMD {
793        v46 = v46s->getValueAt( *(idat.rij) );
794      }
795  
796
796      // calculate the single-site contributions (fields, etc).
797      
798      if (a_is_Charge) {
# Line 1011 | Line 1010 | namespace OpenMD {
1010          Tb += pref * ((trQa*rxDb - 2.0 * DbxQar)*v31 + rxDb*rdQar*v32);
1011        }
1012        if (b_is_Quadrupole) {
1013 <        pref = pre44_ * *(idat.electroMult);
1013 >        pref = pre44_ * *(idat.electroMult);  // yes
1014          QaQb = Q_a * Q_b;
1016        QbQa = Q_b * Q_a;
1015          trQaQb = QaQb.trace();
1016          rQaQb = rhat * QaQb;
1017 <        QbQar = QbQa * rhat;
1020 <        QaQbr = QaQb * rhat;        
1017 >        QaQbr = QaQb * rhat;
1018          QaxQb = cross(Q_a, Q_b);
1022        QbxQa = cross(Q_b, Q_a);
1019          rQaQbr = dot(rQa, Qbr);
1020          rQaxQbr = cross(rQa, Qbr);
1025        //rQbxQar = cross(rQb, Qar);
1026
1027
1028        // First part of potential and associated forces:
1029        // U += pref * (trQa * trQb) * v41;
1030        // F += pref * rhat * (trQa * trQb) * v44;
1031        // Ta += 0.0;
1032        // Tb += 0.0;
1033
1034        // cerr << "Aa:\n";
1035        // cerr << *(idat.A1)  << "\n\n";
1036
1037        // cerr << "Ab:\n";
1038        // cerr << *(idat.A2)  << "\n\n";
1039
1040        // cerr << "Qa:\n";
1041        // cerr << Q_a << "\n\n";
1042        // cerr << "Qb:\n";
1043        // cerr << Q_b << "\n\n";
1044
1045        
1046        // Second part of potential and associated forces:
1047        // Probably suspect (particularly torques):
1048        // cerr << "trQaQb = " << trQaQb << "\n";
1049
1050        // U += pref * 2.0 * trQaQb * v41;
1051        // F += pref * rhat * (2.0 * trQaQb) * v44;
1052        // Ta += pref * (-4.0*QaxQb) * v41;
1053        // Tb += pref * (-4.0*QbxQa) * v41;
1054
1055        // cerr << "QaxQb = " << QaxQb << "\n";
1056        // cerr << "QbxQa = " << QbxQa << "\n";
1057
1058        // Third part of potential:
1059        // U += pref * (trQa * rdQbr) * v42;
1060        // F += pref * rhat * (trQa * rdQbr) * v45;
1061        // F += pref * 2.0 * (trQa * rQb) * v44;
1062        // Ta += 0.0;
1063        // Tb += pref * 2.0 * trQa * cross(rhat, Qbr) * v42;
1021          
1022          U  += pref * (trQa * trQb + 2.0 * trQaQb) * v41;
1023          U  += pref * (trQa * rdQbr + trQb * rdQar  + 4.0 * rQaQbr) * v42;
# Line 1083 | Line 1040 | namespace OpenMD {
1040  
1041          Tb += pref * (+ 4.0 * QaxQb * v41);
1042          Tb += pref * (- 2.0 * trQa * cross(rQb, rhat)
1043 <                      + 4.0 * cross(rhat, QbQar)
1043 >                      - 4.0 * cross(rQaQb, rhat)
1044                        + 4.0 * rQaxQbr) * v42;
1045 +        // Possible replacement for line 2 above:
1046 +        //             + 4.0 * cross(rhat, QbQar)
1047 +
1048          Tb += pref * 2.0 * cross(rhat,Qbr) * rdQar * v43;
1049  
1090        // Tb += pref * (+ 4.0 * QaxQb * v41);
1091        // Tb += pref * (- 2.0 * trQa * cross(rQb, rhat)
1092        //               - 4.0 * cross(rQaQb, rhat)
1093        //               + 4.0 * rQaxQbr) * v42;
1094        // Tb += pref * 2.0 * cross(rhat,Qbr) * rdQar * v43;
1095
1050          //  cerr << " tsum = " << Ta + Tb - cross(  *(idat.d) , F ) << "\n";
1051        }
1052      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines