      Subroutine disulf(seqbcd, dsdsts, scangs, scaaat, scatin, atomin, DISU001
     &                  mcaaat, seqcod, dsdef, dspart,  astruc, seqlen) DISU002
c                                                                       DISU003
c     read the author file and extract any author definitions of        DISU004
c     disulphide bridges. check for possible bridges on a distance      DISU005
c     criterion as well.                                                DISU006
c                                                                       DISU007
      include 'sstruc.par'                                              DISU008
      character seqbcd(maxres)*6, dsdef(maxres)*1                       DISU009
      real      scangs(nsdang,maxres), dsdsts(3,maxres),                DISU010
     &          scaaat(ncoord,sdchna,maxres),                           DISU011
     &          mcaaat(ncoord,mnchna,maxres)                            DISU012
      integer   dspart(maxres), seqcod(maxres), seqlen                  DISU013
      logical   astruc, scatin(sdchna,maxres), atomin(mnchna,maxres)    DISU014
      real      atdist                                                  DISU015
      integer   respl                                                   DISU016
                                                                        DISU017
      character autdef*1, disdef*1                                      DISU018
      parameter (autdef = 'A', disdef = 'D')                            DISU019
      integer   nxdist, nxres, pos1, pos2, errset, partpl, nxcys        DISU020
      real      partds, ssdist                                          DISU021
      logical   cystyp, xney                                            DISU022
      character autrec*80, code1*6, code2*6, typefl*1                   DISU023
                                                                        DISU024
      do 100, nxres = 1, seqlen                                         DISU025
      dsdef(nxres) = space                                              DISU026
      dspart(nxres) = 0                                                 DISU027
      do 100, nxdist = 1, 3                                             DISU028
      dsdsts(nxdist,nxres) = 0.0                                        DISU029
  100 continue                                                          DISU030
                                                                        DISU031
      If (astruc) then                                                  DISU032
         rewind(unit=authfi)                                            DISU033
         pos1 = 0                                                       DISU034
  200    continue                                                       DISU035
         if (pos1 .lt. 0) pos1 = 0                                      DISU036
         read (authfi,'(A)', end = 2000) autrec                         DISU037
         if (autrec(1:keylen) .ne. dsfkey) go to 200                    DISU038
         read(autrec,400) code1(1:1), code1(2:6), code2(1:1), code2(2:6)DISU039
CHECK v.2.1.4-->                                                        DISU040
C  400    format(15x,a1,x,a5,7x,a1,x,a5)                                DISU041
  400    format(15x,a1,1x,a5,7x,a1,1x,a5)                               DISU042
CHECK v.2.1.4<--                                                        DISU043
         pos1 = respl(seqbcd, code1, pos1, seqlen)                      DISU044
         errset = 0                                                     DISU045
         if (pos1 .gt. 0) pos2 = respl(seqbcd, code2, pos1, seqlen)     DISU046
         If (pos1 .gt. 0 .and. pos2 .gt. 0) then                        DISU047
            if (Cystyp(seqcod(pos1)) .and. cystyp(seqcod(pos2))) then   DISU048
               typefl = autdef                                          DISU049
               call dsset(pos1, pos2, dsdsts, scangs, scaaat, scatin,   DISU050
CHECK v.3.2-->                                                          DISU051
C     +                    atomin, mcaaat, dsdef, dspart, typefl, seqlenDISU052
     &                    atomin, mcaaat, dsdef, dspart, typefl)        DISU053
CHECK v.3.2<--                                                          DISU054
            else                                                        DISU055
               errset = 1                                               DISU056
            end if                                                      DISU057
         else                                                           DISU058
            errset = 1                                                  DISU059
         end if                                                         DISU060
         If (errset .eq. 1) then                                        DISU061
            write(errfi,'(A)') 'error in SSBOND record'                 DISU062
            write(errfi,'(A)') autrec                                   DISU063
         end if                                                         DISU064
         go to 200                                                      DISU065
                                                                        DISU066
 2000    continue                                                       DISU067
         close(unit = authfi)                                           DISU068
      end if                                                            DISU069
                                                                        DISU070
      nxres = 1                                                         DISU071
 2500 continue                                                          DISU072
      if (cystyp(seqcod(nxres))) then                                   DISU073
         if (scatin(sgamma,nxres)) then                                 DISU074
            partpl = 0                                                  DISU075
            partds = 0.0                                                DISU076
            do 3000, nxcys = nxres + 1, seqlen                          DISU077
            if (cystyp(seqcod(nxcys))) then                             DISU078
               if (scatin(sgamma,nxcys)) then                           DISU079
                  ssdist = atdist(scaaat(1,sgamma,nxres),               DISU080
     &                     scaaat(1,sgamma,nxcys))                      DISU081
                  if (ssdist .lt. sssep) then                           DISU082
                     if (xney(partds, 0.0)) then                        DISU083
                        if (partds .lt. ssdist) then                    DISU084
                           Write(errfi,2700) nxres, nxcys, ssdist       DISU085
                        else                                            DISU086
                           Write(errfi,2700) nxres, partpl, partds      DISU087
 2700                      format('multifurcation of disulphides ',     DISU088
CHECK v.3.2-->                                                          DISU089
C     +                            I4, x, i4, x, f3.1)                  DISU090
     &                            I4, 1x, i4, 1x, f3.1)                 DISU091
CHECK v.3.2<--                                                          DISU092
                           partpl = nxcys                               DISU093
                           partds = ssdist                              DISU094
                        end if                                          DISU095
                     else                                               DISU096
                        partpl = nxcys                                  DISU097
                        partds = ssdist                                 DISU098
                     end if                                             DISU099
                  end if                                                DISU100
               end if                                                   DISU101
            end if                                                      DISU102
 3000       continue                                                    DISU103
            if (partpl .ne. 0) then                                     DISU104
               typefl = disdef                                          DISU105
               call dsset(nxres, partpl, dsdsts, scangs, scaaat, scatin,DISU106
CHECK v.3.2-->                                                          DISU107
C     +                    atomin, mcaaat, dsdef, dspart, typefl, seqlenDISU108
     &                    atomin, mcaaat, dsdef, dspart, typefl)        DISU109
CHECK v.3.2<--                                                          DISU110
            end if                                                      DISU111
         end if                                                         DISU112
      end if                                                            DISU113
      nxres = nxres + 1                                                 DISU114
      if (nxres .le. seqlen) go to 2500                                 DISU115
      END                                                               DISU116
