Enable fp-exceptions
[alexxy/gromacs.git] / src / gromacs / mdlib / constr.cpp
index 46e093cbb28d839f626260be650a77d0f39daef4..ad36ec2a7f985326dde9158ed5bb105e7ace03d6 100644 (file)
@@ -533,9 +533,15 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner,
         /* Combine virial and error info of the other threads */
         for (i = 1; i < nth; i++)
         {
-            m_add(vir_r_m_dr, constr->vir_r_m_dr_th[i], vir_r_m_dr);
             settle_error = constr->settle_error[i];
         }
+        if (vir != NULL)
+        {
+            for (i = 1; i < nth; i++)
+            {
+                m_add(vir_r_m_dr, constr->vir_r_m_dr_th[i], vir_r_m_dr);
+            }
+        }
 
         if (econq == econqCoord && settle_error >= 0)
         {