********> bugfix.38 Correction Author: David A. Pearlman Correction Date: 4/02/92 Programs: SANDER Severity: serious Problem: When running a restrained MD simulation with SANDER where the following conditions are met: 1) The user has requested that the final restraint violations will be written to a LISTOUT file. 2) The total MD simulation is being run in multiple "segments" (NRUN > 1); then the final restraint violations in the requested LISTOUT file will not correspond to the violations on the final step of the simulation. They will be the violations on the final step of the first segment of the MD trajectory (i.e. the NSTLIMth step on the NRUN=1 leg). The actual final deviations will appear in whatever file is assigned by default to unit 33 on the host computer. The behavior if a default unit 33 file already exists will be system dependent. This problem will only arise if NRUN>1 and a file redirection statement LISTOUT=filename (filename.NE.POUT) has been provided. This bug affects only the values in the LISTOUT file. The trajectory, any stored/restart coordinates, and any deviation information printed in the standard formatted output file will be correct. Affects: The restraint violation values in the requested LISTOUT file will be incorrect. If a LISTOUT=POUT command was given (print deviations in the formatted standard output file), the deviations will be correct. Cause: To avoid losing part of the restraint violations file during a system crash, the file is closed after it is written, at the end of every NSTLIM steps (thus forcing the write buffer to be cleared to disc). But because of an improperly constructed IF-BLOCK of code, the file was not being re-opened on subsequent writes. Fix: Make the following changes; see 0README for an explanation of the diff format. ***To routine NDVPRT in src/sander/ndvprt.f: ------------------------------------------------------------------------- *** OLD ndvprt.f --- NEW ndvprt.f *************** *** 126,132 C user-defined redirection). C IUSE = IOUT - IF (ITIMES.EQ.0) THEN IF (IREDIR(2).EQ.0) THEN RETURN ELSE --- 126,131 ----- C user-defined redirection). C IUSE = IOUT IF (IREDIR(2).EQ.0) THEN RETURN ELSE *************** *** 140,146 ELSE IF ((IREDIR(1).EQ.IREDIR(2) .AND. * REDIR(1)(1:IREDIR(1)).EQ.REDIR(2)(1:IREDIR(2))) * .OR. ITIMES.GT.0) THEN ! CALL OPNMRG(REDIR(2)(1:IREDIR(2)),ISCOPN,1,IOUT,IERR) IF (IERR.EQ.1) RETURN ELSE CALL OPNMRG(REDIR(2)(1:IREDIR(2)),ISCOPN,0,IOUT,IERR) --- 139,145 ----- ELSE IF ((IREDIR(1).EQ.IREDIR(2) .AND. * REDIR(1)(1:IREDIR(1)).EQ.REDIR(2)(1:IREDIR(2))) * .OR. ITIMES.GT.0) THEN ! CALL OPNMRG(REDIR(2)(1:IREDIR(2)),ISCOPN,2,IOUT,IERR) IF (IERR.EQ.1) RETURN ELSE CALL OPNMRG(REDIR(2)(1:IREDIR(2)),ISCOPN,0,IOUT,IERR) *************** *** 147,153 IF (IERR.EQ.1) RETURN END IF END IF - END IF C WRITE(IOUT,9020) REDIR(2)(1:IREDIR(2)) IUSE = ISCOPN --- 146,151 ----- IF (IERR.EQ.1) RETURN END IF END IF C WRITE(IOUT,9020) REDIR(2)(1:IREDIR(2)) IUSE = ISCOPN ------------------------------------------------------------------------- Temporary workarounds: Depending on the system, you may be able to recover the final restraint violations in the file which is assigned by default to unit 33. Routines affected: SANDER Routine NDVPRT in .../amber4/sander/ndvprt.f