         c = c * a;
         s12 = s12 * a;
         Scalar a11 = c*sb1*s1;
-        Scalar a22 = -sb2 * (2.0f*c0*s12 - c*(s1+s2));
+        Scalar a22 = -sb2 * (Scalar(2.0)*c0*s12 - c*(s1+s2));
         Scalar a33 = c*sb3*s2;
         Scalar a12 = -r12c1*(c1mag*c*s1 + c2mag*s12);
         Scalar a13 = -rb1*rb3*s12;

        // and accumlate the energy/virial

        // compute 1/4 of the energy, 1/4 for each atom in the dihedral
        Scalar dihedral_eng = V*Scalar(1.0f/4.0f);

        // compute 1/4 of the virial, 1/4 for each atom in the dihedral
        // symmetrized version of virial tensor

        dcbm = box.minImage(dcbm);

        // c0 calculation
        Scalar sb1 = Scalar(1.0) / (dab.x*dab.x + dab.y*dab.y + dab.z*dab.z);
        Scalar sb2 = Scalar(1.0) / (dcb.x*dcb.x + dcb.y*dcb.y + dcb.z*dcb.z);
        Scalar sb3 = Scalar(1.0) / (ddc.x*ddc.x + ddc.y*ddc.y + ddc.z*ddc.z);

        Scalar rb1 = sqrt(sb1);
        Scalar rb3 = sqrt(sb3);
