Merge "Merge release-5-0 into master"
authorDavid van der Spoel <spoel@xray.bmc.uu.se>
Sat, 7 Jun 2014 19:51:18 +0000 (21:51 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 7 Jun 2014 19:51:18 +0000 (21:51 +0200)
1  2 
src/programs/mdrun/md.cpp

index f46196400351f2e01c8251bd330d85ccc28d443e,56a2c725c7f3334407f628bb1f52d08c114d25ac..88c78dc9be381fbf3cde0db6ae2127b585800d4f
@@@ -46,6 -46,7 +46,6 @@@
  #include "mdebin.h"
  #include "nrnb.h"
  #include "calcmu.h"
 -#include "index.h"
  #include "vsite.h"
  #include "update.h"
  #include "ns.h"
@@@ -1108,7 -1109,7 +1108,7 @@@ double do_md(FILE *fplog, t_commrec *cr
              bUpdateDoLR = (fr->bTwinRange && do_per_step(step, ir->nstcalclr));
  
              update_coords(fplog, step, ir, mdatoms, state, fr->bMolPBC,
-                           f, bUpdateDoLR, fr->f_twin, fcd,
+                           f, bUpdateDoLR, fr->f_twin, bCalcVir ? &fr->vir_twin_constr : NULL, fcd,
                            ekind, M, upd, bInitStep, etrtVELOCITY1,
                            cr, nrnb, constr, &top->idef);
  
                                         cr, nrnb, wcycle, upd, constr,
                                         TRUE, bCalcVir, vetanew);
  
+                     if (bCalcVir && bUpdateDoLR && ir->nstcalclr > 1)
+                     {
+                         /* Correct the virial for multiple time stepping */
+                         m_sub(shake_vir, fr->vir_twin_constr, shake_vir);
+                     }
                      if (!bOK)
                      {
                          gmx_fatal(FARGS, "Constraint error: Shake, Lincs or Settle could not solve the constrains");
  
                      /* velocity half-step update */
                      update_coords(fplog, step, ir, mdatoms, state, fr->bMolPBC, f,
-                                   bUpdateDoLR, fr->f_twin, fcd,
+                                   bUpdateDoLR, fr->f_twin, bCalcVir ? &fr->vir_twin_constr : NULL, fcd,
                                    ekind, M, upd, FALSE, etrtVELOCITY2,
                                    cr, nrnb, constr, &top->idef);
                  }
                  bUpdateDoLR = (fr->bTwinRange && do_per_step(step, ir->nstcalclr));
  
                  update_coords(fplog, step, ir, mdatoms, state, fr->bMolPBC, f,
-                               bUpdateDoLR, fr->f_twin, fcd,
+                               bUpdateDoLR, fr->f_twin, bCalcVir ? &fr->vir_twin_constr : NULL, fcd,
                                ekind, M, upd, bInitStep, etrtPOSITION, cr, nrnb, constr, &top->idef);
                  wallcycle_stop(wcycle, ewcUPDATE);
  
                                     cr, nrnb, wcycle, upd, constr,
                                     FALSE, bCalcVir, state->veta);
  
+                 if (bCalcVir && bUpdateDoLR && ir->nstcalclr > 1)
+                 {
+                     /* Correct the virial for multiple time stepping */
+                     m_sub(shake_vir, fr->vir_twin_constr, shake_vir);
+                 }
                  if (ir->eI == eiVVAK)
                  {
                      /* erase F_EKIN and F_TEMP here? */
                      bUpdateDoLR = (fr->bTwinRange && do_per_step(step, ir->nstcalclr));
  
                      update_coords(fplog, step, ir, mdatoms, state, fr->bMolPBC, f,
-                                   bUpdateDoLR, fr->f_twin, fcd,
+                                   bUpdateDoLR, fr->f_twin, bCalcVir ? &fr->vir_twin_constr : NULL, fcd,
                                    ekind, M, upd, bInitStep, etrtPOSITION, cr, nrnb, constr, &top->idef);
                      wallcycle_stop(wcycle, ewcUPDATE);