



C









C
      SUBROUTINE REC001 (POINTR,IAA,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       POINTR, IAA, IAT, IERR, GVFPOS, WRITEN
      REAL          R1, R2
      LOGICAL       GVFIBN, GVFFOP, XYZNUL, ISOPEN







      IF (NBINDB.LE.0) THEN
         CALL GVSTT6 ('?M3673')
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF
      IF (.NOT.GVFIBN(IAA,1,NUMAAF)) THEN
         CALL GVSTT6 ('?M3674')
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF
      IF (.NOT.GVFFOP(IU100)) THEN
         CALL GVSTTI ('?NEWE721',IU100)
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF
      INQUIRE (IU100,OPENED=ISOPEN,NAME=LINE)








































      IERR=0
      WRITEN=0
      CALL GVSRT0 (RECRD,280)
      LASTOK=GVFIBN(RESTYP(IAA),1,20)



      DO 5 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (XYZNUL(IAT)) THEN
            CALL GVSTT6 ('?M3948')
            CALL SHOIAA (IAA)
            GOTO 6
         END IF
 5    CONTINUE
 6    CONTINUE



      DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
         IF (PROTON(IAT)) GOTO 10



         RECRD((PINIAA(IAT)-1)*20+1) =XCOORD(IAT)
         RECRD((PINIAA(IAT)-1)*20+2) =YCOORD(IAT)
         RECRD((PINIAA(IAT)-1)*20+3) =ZCOORD(IAT)
         RECRD((PINIAA(IAT)-1)*20+11)=ALTX(IAT)
         RECRD((PINIAA(IAT)-1)*20+12)=ALTY(IAT)
         RECRD((PINIAA(IAT)-1)*20+13)=ALTZ(IAT)



         RECRD((PINIAA(IAT)-1)*20+5) =XBFACT(IAT)
         RECRD((PINIAA(IAT)-1)*20+6) =WEIGHT(IAT)
         RECRD((PINIAA(IAT)-1)*20+15)=ALTXBF(IAT)
         RECRD((PINIAA(IAT)-1)*20+16)=ALTWGT(IAT)



         IF (ALTATM(IAT).EQ.' ') THEN
            R1=0.0
         ELSE
            R1=FLOAT(GVFPOS(CHADEF,ALTATM(IAT)))
            IF (R1.LT.0.9) THEN
               CALL GVST6C ('?M3677',ALTATM(IAT),.TRUE.)
            END IF
         END IF
         IF (ALALAT(IAT).EQ.' ') THEN
            R2=0.0
         ELSE
            R2=FLOAT(GVFPOS(CHADEF,ALALAT(IAT)))
            IF (R2.LT.0.9) THEN
               CALL GVST6C ('?M3677',ALALAT(IAT),.TRUE.)
            END IF
         END IF
         RECRD((PINIAA(IAT)-1)*20+18)=R1
         RECRD((PINIAA(IAT)-1)*20+19)=R2



         IF (ABS(XCOORD(IAT)).LE.0.1.AND.
     +       ABS(YCOORD(IAT)).LE.0.1.AND.
     +       ABS(ZCOORD(IAT)).LE.0.1) ISATOK(IAT)=.FALSE.
         IF (ISATOK(IAT)) THEN
            RECRD((PINIAA(IAT)-1)*20+7)=1
         ELSE
            RECRD((PINIAA(IAT)-1)*20+7)=0
         END IF



         LASTOK=LASTOK.AND.ISATOK(IAT)
         WRITEN=WRITEN+1
 10   CONTINUE



      CALL GVSSTX (NUMCH4,NUMNAM(IAA))
      CALL GVSSTX (NUMAA4,ONESA3(IAA))
      IF (ISSHIT(IAA)) RECRD(180)=1.0
      IF (LASTOK) RECRD(200)=1.0
      RECRD(240)=WRITEN



      WRITE (IU100,REC=POINTR,ERR=996) RECRD

      GOTO 998



 996  CONTINUE
      CALL GVSTTE ('?M3675')
      IERR=1
      CALL GVSKIL



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE REC002 (POINTR,IAA,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       POINTR, IAA, IAT, IATREC, IERR, I1, I2
      REAL          WIFVDW
      LOGICAL       GVFIBN, GVFFOP







      IF (NBINDB.LE.0) THEN
         CALL GVSTT6 ('?M3673')
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF
      IF (.NOT.GVFIBN(IAA,1,NUMAAF)) THEN
         CALL GVSTT6 ('?M3674')
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF
      IF (.NOT.GVFFOP(IU100)) THEN
         CALL GVSTTI ('?NEWE721',IU100)
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF



      IERR=0



      READ (IU100,REC=POINTR,ERR=996) RECRD



      DO 10 IAT=PNTAAS(IAA),PNTAAS(IAA)+HATPRA(RESTYP(IAA))-1



         IATREC=IAT-PNTAAS(IAA)+1



         XCOORD(IAT)=RECRD(20*(IATREC-1)+1)
         YCOORD(IAT)=RECRD(20*(IATREC-1)+2)
         ZCOORD(IAT)=RECRD(20*(IATREC-1)+3)
         ALTX(IAT)  =RECRD(20*(IATREC-1)+11)
         ALTY(IAT)  =RECRD(20*(IATREC-1)+12)
         ALTZ(IAT)  =RECRD(20*(IATREC-1)+13)



         XBFACT(IAT)=RECRD(20*(IATREC-1)+5)
         WEIGHT(IAT)=RECRD(20*(IATREC-1)+6)
         ALTXBF(IAT)=RECRD(20*(IATREC-1)+15)
         ALTWGT(IAT)=RECRD(20*(IATREC-1)+16)



         I1=NINT(RECRD(20*(IATREC-1)+18))
         I2=NINT(RECRD(20*(IATREC-1)+19))
         ALTATM(IAT)=' '
         IF (I1.NE.0) THEN
            IF (GVFIBN(I1,1,36)) THEN
               ALTATM(IAT)=CHADEF(I1:I1)
            ELSE
               CALL GVSTTI ('?M3677',I1)
            END IF
         END IF
         ALALAT(IAT)=' '
         IF (I2.NE.0) THEN
            IF (GVFIBN(I2,1,36)) THEN
               ALALAT(IAT)=CHADEF(I2:I2)
            ELSE
               CALL GVSTTI ('?M3677',I2)
            END IF
         END IF



         ISATOK(IAT)=RECRD(20*(IATREC-1)+7).GT.0.5
         VDWRAD(IAT)=WIFVDW(ONESAT(IAT))
         ACCESS(IAT)=RECRD(20*(IATREC-1)+4)
         IF (WIFPAR(79).EQ.1) THEN
            ACCESS(IAT)=ACCESS(IAT)*((VDWRAD(IAT)+(WIFPAR(29)
     +       /100.0))**2)/(VDWRAD(IAT)**2)
         END IF
         SUMACC(IAA)=SUMACC(IAA)+ACCESS(IAT)
         ATCOLR(IAT)=0
 10   CONTINUE



      ISSHIT(IAA)=RECRD(180).GT.0.5
      LASTOK=RECRD(200).GT.0.5
      CALL GVSSTX (NUMNAM(IAA),NUMCH4)
      GOTO 998



 996  CONTINUE
      CALL GVSTTE ('?M3671')
      IERR=1



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE REC003 (POINTR,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       POINTR,  IERR







      IF (NBINDB.LE.0) THEN
         CALL GVSTT6 ('?M3673')
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF



      IERR=0



      READ (IU100,REC=POINTR,ERR=996) RECRD
      LASTOK=RECRD(200).GT.0.5
      GOTO 998



 996  CONTINUE
      CALL GVSTTE ('?M3671')
      IERR=1
      CALL GVSKIL
      GOTO 998



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE REC003A (POINTR,IERR)




















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       POINTR,  IERR







      IF (NBINDB.LE.0) THEN
         CALL GVSTT6 ('?M3673')
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF



      IERR=0



      READ (IU100,REC=POINTR,ERR=996) RECRD2
      LASTOK=RECRD2(200).GT.0.1
      GOTO 998



 996  CONTINUE
      CALL GVSTTE ('?M3671')
      IERR=1
      CALL GVSKIL
      GOTO 998



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE REC004 (X,Y,Z,NIAT,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, IATREC, NIAT
      REAL          X, Y, Z







      IERR=0



      IATREC=20*(NIAT-1)
      X=RECRD(IATREC+1)
      Y=RECRD(IATREC+2)
      Z=RECRD(IATREC+3)





      RETURN
      END   
      SUBROUTINE REC005 (X,Y,Z,OK,NIAT,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, IATREC, NIAT
      REAL          X, Y, Z
      LOGICAL       OK







      IERR=0



      IATREC=20*(NIAT-1)
      X=RECRD(IATREC+1)
      Y=RECRD(IATREC+2)
      Z=RECRD(IATREC+3)



      OK=RECRD(IATREC+7).EQ.1





      RETURN
      END   
      SUBROUTINE REC006 (CHI1,POINTR,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, POINTR
      REAL          CHI1, GVFRTD







      IERR=0



      READ (IU100,REC=POINTR,ERR=996) RECRD



      CHI1=GVFRTD(RECRD(80))
      GOTO 998



 996  CONTINUE
      CALL GVSTTE ('?M3671')
      IERR=1
      CALL GVSKIL
      GOTO 998



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE REC007 (POINTR,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       POINTR, IERR







      IF (NBINDB.LE.0) THEN
         CALL GVSTT6 ('?M3673')
         IERR=1
         GOTO 998
      END IF



      IERR=0



      WRITE (IU100,REC=POINTR,ERR=996) RECRD
      GOTO 998



 996  CONTINUE
      CALL GVSTTE ('?M3675')
      IERR=1
      CALL GVSKIL
      GOTO 998



  998 CONTINUE


      RETURN
      END   

      SUBROUTINE REC009 (POINTR,THISAA,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       POINTR, IERR, IAATYP, INDAA3
      LOGICAL       GVFFOP
      CHARACTER*4   THISAA







      IF (NBINDB.LE.0) THEN
         CALL GVSTT6 ('?M3673')
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF
      IF (.NOT.GVFFOP(IU100)) THEN
         CALL GVSTTB ('Database not open in REC009')
         IERR=1
         GOTO 998
      END IF



      IERR=0




      READ (IU100,REC=POINTR,ERR=996) RECRD
      CALL GVSSTX (THISAA,NUMAA4)
      IAATYP=INDAA3(THISAA)
      IF (IAATYP.EQ.0) THEN
         CALL TOP011 (THISAA,IERR)
         IF (IERR.EQ.0) IAATYP=INDAA3(THISAA)
      END IF
      GOTO 998



 996  CONTINUE
      CALL GVSTTE ('?M3671')
      IERR=1
      CALL GVSKIL
      GOTO 998



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE REC010 (IUNIT,ISEQ,IAA)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       IUNIT, ISEQ, IAA, IERR, I1, I2, IAT, POINTR, IAATYP, 
     +              INDAA3, HAPRA
      REAL          X1, Y1, Z1, X2, Y2, Z2, B1, W1, B2, W2, ACC
      LOGICAL       GVFFOP, GVFIBN, ISHITL, ISOK
      CHARACTER*1   ALT1, ALT2







      IF (NBINDB.LE.0) THEN
         CALL GVSTT6 ('?M3673')
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF
      IF (.NOT.GVFFOP(IU100)) THEN
         CALL GVSTTI ('?NEWE721',IU100)
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF



      IERR=0
      POINTR=INDPNT(ISEQ)+IAA



      READ (IU100,REC=POINTR,ERR=999) RECRD
      CALL GVSNLU (IUNIT,1)
      CALL C1234567 ('REC010')



      ISHITL=RECRD(180).GT.0.5
      LASTOK=RECRD(200).GT.0.5
      IAATYP=INDAA3(NUMAA4)
      IF (GVFIBN(IAATYP,1,20)) THEN
         HAPRA=HATPRA(IAATYP)
      ELSE
         HAPRA=-1
      END IF
      CALL C1234567 ('REC010')
      CALL C1234567 ('REC010') 
      CALL GVSCTB (BIGLIN,132)
      WRITE (BIGLIN,1000,ERR=999) ISEQ,NAMFIL(ISEQ),FILCNM(ISEQ),IAA,
     + NUMAA4,NUMCH4,HAPRA,LASTOK,ISHITL
 1000 FORMAT ('Seq:',I4,1X,A4,'_',A1,' Aa:',I4,1X,A4,' (',A4,') ',
     + I3,1X,L1,1X,L1)
      CALL GVSTTU (IUNIT,BIGLIN)



      IF (HAPRA.LT.0) GOTO 998
      DO 10 IAT=1,HAPRA



         X1=RECRD(20*(IAT-1)+1)
         Y1=RECRD(20*(IAT-1)+2)
         Z1=RECRD(20*(IAT-1)+3)
         X2=RECRD(20*(IAT-1)+11)
         Y2=RECRD(20*(IAT-1)+12)
         Z2=RECRD(20*(IAT-1)+13)



         B1=RECRD(20*(IAT-1)+5)
         W1=RECRD(20*(IAT-1)+6)
         B2=RECRD(20*(IAT-1)+15)
         W2=RECRD(20*(IAT-1)+16)



         I1=NINT(RECRD(20*(IAT-1)+18))
         I2=NINT(RECRD(20*(IAT-1)+19))
         ALT1=' '
         IF (I1.NE.0) THEN
            IF (GVFIBN(I1,1,36)) THEN
               ALT1=CHADEF(I1:I1)
            ELSE
               CALL GVSTTI ('?M3677',I1)
            END IF
         END IF
         ALT2=' '
         IF (I2.NE.0) THEN
            IF (GVFIBN(I2,1,36)) THEN
               ALT2=CHADEF(I2:I2)
            ELSE
               CALL GVSTTI ('?M3677',I2)
            END IF
         END IF



         ISOK=RECRD(20*(IAT-1)+7).GT.0.5
         ACC=RECRD(20*(IAT-1)+4)
         WRITE (6,1010,ERR=999) IAT,MUTROW4(IAT,IAATYP)(1:4),
     +    ISOK,ACC, ALT1,X1,Y1,Z1,W1,B1, ALT2,X2,Y2,Z2,W2,B2
 10   CONTINUE
 1010 FORMAT (I3,1X,A4,1X,L1,F5.1,2(1X,A1,3F8.2,2F6.1,2X))
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('REC010')



  998 CONTINUE


      RETURN
      END   
      SUBROUTINE REC050

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       ISEQ, IAA











      DO 100 ISEQ=1,NBINDB
         CALL GVSTTI ('?WORKON',ISEQ)
         DO 90 IAA=1,NAAFIL(ISEQ)
            CALL REC010 (6,ISEQ,IAA)




































 90      CONTINUE
         CALL GVSCOD (' ')
 100  CONTINUE





      RETURN
      END   
