AMBER Archive (2002)Subject: Re: Bug in reading binary restart file with BOX parameters
From: David A. Case (case_at_scripps.edu)
Date: Wed Oct 16 2002 - 10:27:51 CDT
On Wed, Oct 16, 2002, Vlad wrote:
>
> There are bugs in sander-7 (which migrated there from sander-6)
> when program tries to read BINARY restart file with BOX
> parameters.....
Thanks for the report. From this you can (correctly) assume that very
few people use binary restart files. This is an example of the problems
that can arise when there are a gazillion options in a program...something
gets added for the common case, but not for the uncommon one...
Scott: can you look into preparaing a patch for this? thanks...dac
>
> 1) getcor.f
>
> One needs to change
> ++++++++++++++++++++++++++++++++++++
> c
> c READ(lun,end=1020,err=1020) a,b,c,alpha,beta,gamma
> do 102 i=1,6
> ifld(i)=3
> fvar(i)=0.0d0
> 102 continue
> ifld(7)=0
> ihol(1)=0
> call rfree(ifld,ihol,ivar,fvar,lun,6)
> if((fvar(4).ne.0).or.(fvar(5).ne.0).or.(fvar(6).ne.0))
> then
> alpha=fvar(4)
> beta=fvar(5)
> gamma=fvar(6)
> else
> c -- defaults:
> alpha=90.0d0
> beta=90.0d0
> gamma=90.0d0
> endif
> a=fvar(1)
> b=fvar(2)
> c=fvar(3)
> box(1) = a
> box(2) = b
> box(3) = c
> ++++++++++++++++++++++++++++++++++++
>
> into:
>
> ++++++++++++++++++++++++++++++++++++
> c
> READ(lun,end=1020,err=1020) a,b,c,alpha,beta,gamma
> c do 102 i=1,6
> c ifld(i)=3
> c fvar(i)=0.0d0
> c 102 continue
> c ifld(7)=0
> c ihol(1)=0
> c call rfree(ifld,ihol,ivar,fvar,lun,6)
> c if((fvar(4).ne.0).or.(fvar(5).ne.0).or.(fvar(6).ne.0)) then
> c alpha=fvar(4)
> c beta=fvar(5)
> c gamma=fvar(6)
> c else
> c -- defaults:
> c alpha=90.0d0
> c beta=90.0d0
> c gamma=90.0d0
> c endif
> c a=fvar(1)
> c b=fvar(2)
> c c=fvar(3)
> box(1) = a
> box(2) = b
> box(3) = c
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> 2) Subroutine peek_ewald_inpcrd in file ew_setup.f
>
> One possible solution is
>
> a) to add
> ++++++++++++++++++++++++++
> #include "md.h"
> integer ITITL(20)
> ++++++++++++++++++++++++++
> at the top of the subroutine; and
>
> b)to modify
> +++++++++++++++++++++++++++++++++++++++
> call amopen(9,inpcrd,'O','F','R')
> read(9,'(a)') line
> c
> read(9,'(a)') line
> if( line(6:6).eq.' ' ) then ! this is an old, i5 file
> READ(line,'(i5,e15.7)') NATOM,TT
> else ! assume a new, i6 file
> READ(line,'(i6,e15.7)') NATOM,TT
> end if
> c
> if ( natom .le. 2 )then
> write(6,*)'peek_ewald_inpcrd: ',
> $ ' Cannot Deduce box info from inpcrd. Too few atoms'
> return
> endif
> ic = 0
> do i = 1,9999999
> read(9,9028,end=81)x1,x2,x3,x4,x5,x6
> ic = ic+1
> enddo
> +++++++++++++++++++++++++++++++++++++
>
> into
>
> +++++++++++++++++++++++++++++++++++++
> IF (NTX.EQ.1 .OR. NTX.EQ.5 .OR. NTX.EQ.7 .OR. NTX.EQ.9)
> then
> call amopen(9,inpcrd,'O','F','R')
> read(9,'(a)') line
> c
> read(9,'(a)') line
> if( line(6:6).eq.' ' ) then ! this is an old, i5 file
> READ(line,'(i5,e15.7)') NATOM,TT
> else ! assume a new, i6 file
> READ(line,'(i6,e15.7)') NATOM,TT
> end if
> c
> if ( natom .le. 2 )then
> write(6,*)'peek_ewald_inpcrd: ',
> $ ' Cannot Deduce box info from inpcrd. Too few
> atoms'
> return
> endif
> ic = 0
> do i = 1,9999999
> read(9,9028,end=81)x1,x2,x3,x4,x5,x6
> ic = ic+1
> enddo
>
> else ! Unformatted input
> call amopen(9,inpcrd,'O','U','R')
> read(9) ititl
> read(9) natom
> if ( natom .le. 2 )then
> write(6,*)'peek_ewald_inpcrd: ',
> $ ' Cannot Deduce box info from inpcrd. Too few atoms'
> return
> endif
> ic = natom/2 + mod(natom,2) + 1
> do i = 1,9999999
> read(9,end=81)x1,x2,x3,x4,x5,x6
> enddo
> endif
> ++++++++++++++++++++++++++++++++++
>
> Dr. V Vasilyev
> ANU, Canberra
>
--
==================================================================
David A. Case | e-mail: case_at_scripps.edu
Dept. of Molecular Biology, TPC15 | fax: +1-858-784-8896
The Scripps Research Institute | phone: +1-858-784-9768
10550 N. Torrey Pines Rd. | home page:
La Jolla CA 92037 USA | http://www.scripps.edu/case
==================================================================
|