********>bugfix 15 Author: Daniel R. Roe Date: 02/09/2009 Programs: sander Description: Adds ability to write formatted REMD trajectories by adding replica temperature variable to trajectory file. Modifies bintraj.f Usage: Save this file in your $AMBERHOME directory and then apply this patch file to your amber 10 distribution as follows: cd $AMBERHOME patch -p0 -N -r patch_rejects < bugfix ------------------------------------------------------------------------------ --- src/sander/bintraj.f 2008-07-16 10:22:58.000000000 -0400 +++ src/sander/bintraj.f 2008-09-02 17:14:47.000000000 -0400 @@ -10,7 +10,7 @@ integer :: crd_ncid, vel_ncid, oldMode, cmode, atomCnt integer :: FrameDimID,SpatialDimID, AtomDimID, LabelDimID, Cell_spatialDimID, Cell_angularDimID - integer :: CoordVarID, Cell_lengthVarID, Cell_angleVarID, SpatialVarID, VelocVarID + integer :: CoordVarID, Cell_lengthVarID, Cell_angleVarID, SpatialVarID, VelocVarID, TempVarID integer :: Cell_spatialVarID, Cell_angularVarID, crd_TimeVarID, vel_TimeVarID integer :: crd_frame, vel_frame @@ -23,6 +23,9 @@ #ifdef BINTRAJ use netcdf +# ifdef MPI + use remd, only: rem +# endif implicit none @@ -52,6 +55,15 @@ call checkerror(nf90_put_att(crd_ncid, CoordVarID, "units", & "angstrom"), "define coordinates units") end if +# ifdef MPI + ! For remd define replica temperature + if (rem>0) then + call checkerror(nf90_def_var(crd_ncid,"temp0",nf90_double, & + (/ FrameDimID /), TempVarID), "define temp0") + call checkerror(nf90_put_att(crd_ncid, TempVarID, "units", & + "kelvin"), "define temp0 units") + endif +# endif ! Define unit cell data for periodic simulations if (ntb > 0 ) then if (crd_file_exists) then @@ -163,6 +175,9 @@ subroutine write_binary_traj(r,istart,n,unit) use netcdf use nblist, only: a,b,c,alpha,beta,gamma +# ifdef MPI + use remd, only: rem,mytargettemp +# endif implicit none # include "files.h" @@ -181,6 +196,14 @@ call checkerror(nf90_put_var(crd_ncid,CoordVarID, r(istart:n), & start = (/ 1, 1, crd_frame /),count = (/ 3, (n-istart+1)/3, 1 /)), & 'write atom coords') +# ifdef MPI + ! If this is a replica run write temp0 + if (rem>0) then + call checkerror(nf90_put_var(crd_ncid,TempVarID,mytargettemp, & + start = (/ crd_frame /) ), & + 'write replica mytargettemp') + endif +# endif end if case (MDVEL_UNIT) call checkerror(nf90_put_var(vel_ncid,VelocVarID, r(istart:n), &