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 1787 by gezelter, Wed Aug 29 18:13:11 2012 UTC vs.
Revision 1814 by gezelter, Tue Nov 27 21:13:48 2012 UTC

# Line 746 | Line 746 | namespace OpenMD {
746      // Obtain all of the required radial function values from the
747      // spline structures:
748      
749 <    if (a_is_Charge && b_is_Charge) {
750 <      v01 = v01s->getValueAt( *(idat.rij) );
749 >    // needed for fields (and forces):
750 >    if (a_is_Charge || b_is_Charge) {
751        v02 = v02s->getValueAt( *(idat.rij) );
752      }
753 <    if ((a_is_Charge && b_is_Dipole) || (b_is_Charge && a_is_Dipole)) {
754 <      v11 = v11s->getValueAt( *(idat.rij) );
753 >    if (a_is_Dipole || b_is_Dipole) {
754        v12 = v12s->getValueAt( *(idat.rij) );
755        v13 = v13s->getValueAt( *(idat.rij) );
756      }
757 <    if ((a_is_Charge && b_is_Quadrupole) ||
758 <        (b_is_Charge && a_is_Quadrupole) ||
759 <        (a_is_Dipole && b_is_Dipole)) {
757 >    if (a_is_Quadrupole || b_is_Quadrupole) {
758 >      v23 = v23s->getValueAt( *(idat.rij) );
759 >      v24 = v24s->getValueAt( *(idat.rij) );
760 >    }
761 >
762 >    // needed for potentials (and torques):
763 >    if (a_is_Charge && b_is_Charge) {
764 >      v01 = v01s->getValueAt( *(idat.rij) );
765 >    }
766 >    if ((a_is_Charge && b_is_Dipole) || (b_is_Charge && a_is_Dipole)) {
767 >      v11 = v11s->getValueAt( *(idat.rij) );
768 >    }
769 >    if ((a_is_Charge && b_is_Quadrupole) || (b_is_Charge && a_is_Quadrupole)) {
770 >      v21 = v21s->getValueAt( *(idat.rij) );
771 >      v22 = v22s->getValueAt( *(idat.rij) );
772 >    } else if (a_is_Dipole && b_is_Dipole) {
773        v21 = v21s->getValueAt( *(idat.rij) );
774        v22 = v22s->getValueAt( *(idat.rij) );
775        v23 = v23s->getValueAt( *(idat.rij) );
# Line 941 | Line 953 | namespace OpenMD {
953          F  -= pref * (DadDb * rhat + rdDb * D_a + rdDa * D_b)*v23;
954          F  -= pref * (rdDa * rdDb) * v24 * rhat;
955          Ta += pref * ( v21 * DaxDb - v22 * rdDb * rxDa);
956 <        Tb += pref * (-v21 * DaxDb + v22 * rdDa * rxDb);
956 >        Tb += pref * (-v21 * DaxDb - v22 * rdDa * rxDb);
957  
958          // Even if we excluded this pair from direct interactions, we
959          // still have the reaction-field-mediated dipole-dipole
# Line 995 | Line 1007 | namespace OpenMD {
1007          F  += pref * (rdDb * rdQar * rhat * v35);
1008          Ta += pref * ((-2.0*cross(DbdQa, rhat) + 2.0*DbxQar)*v31
1009                        + 2.0*rdDb*rxQar*v32);
1010 <        Tb += pref * ((trQa*rxDb + 2.0 * DbxQar)*v31 + rxDb*rdQar*v32);
1010 >        Tb += pref * ((trQa*rxDb - 2.0 * DbxQar)*v31 + rxDb*rdQar*v32);
1011        }
1012        if (b_is_Quadrupole) {
1013          pref = pre44_ * *(idat.electroMult);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines