```********>Bugfix 54:
Author: John Chodera
Date: 11/02/2005

Programs: sander

Description: When ntt=2 is set, the velocities are not randomly chosen from
a Maxwell-Boltzmann distribution at a time consistent with the
postions, but rather at a time a half-step off.  This generally
(always?) leads to a temperature that is higher than the one
desired.   This patch makes the algorithm more consistent with
what is intended for velocity resetting.

Fix: Apply the following patch to amber8/src/sander/runmd.f

------------------------------------------------------------------------------
*** runmd.f	2005/02/10 22:07:42	7.260
--- runmd.f	2005/11/02 17:47:28
***************
*** 964,969 ****
--- 964,988 ----
#endif
if (ibelly > 0) call bellyf(nr,ix(ibellygp),v)
end if
+
+       ! At this point in the code, the velocities lag the positions
+       ! by half a timestep.  If we intend for the velocities to be drawn
+       ! from a Maxwell distribution at the timepoint where the positions and
+       ! velocities are synchronized, we have to correct these newly
+       ! redrawn velocities by backing them up half a step using the
+       ! current force.
+       ! Note that this fix only works for Newtonian dynamics.
+       if( gammai == 0.d0 ) then
+          i3 = 3*(istart-1)
+          do j=istart,iend
+             wfac = winv(j) * dt5
+             v(i3+1) = v(i3+1) - f(i3+1)*wfac
+             v(i3+2) = v(i3+2) - f(i3+2)*wfac
+             v(i3+3) = v(i3+3) - f(i3+3)*wfac
+             i3 = i3+3
+          end do
+       end if
+
# ifdef MPI
call trace_mpi('mpi_bcast',3*natom,'MPI_DOUBLE_PRECISION',0)
call mpi_bcast(v, 3*natom, MPI_DOUBLE_PRECISION, &
-------------------------------------------------------------------------------
Temporary workarounds: none

```