CHECK v.3.2-->                                                          SWAP001
C      subroutine swap (aacod, nxres, scaaat, scocc, scthrm, scatin,    SWAP002
C     +                 nold, totswp)                                   SWAP003
      subroutine swap (aacod, nxres, scaaat, scocc, scthrm,             SWAP001
CHECK v.3.4-->                                                          SWAP002
C     +                 nold, totswp)                                   SWAP003
     &                 nold, totswp,NMR)                                SWAP004
CHECK v.3.4<--                                                          SWAP005
CHECK v.3.2<--                                                          SWAP006
c     subroutine to swap round side chain coordinates for misnamed      SWAP007
c     residues and record the original atom corresponding to the        SWAP008
c     coords                                                            SWAP009
c                                                                       SWAP010
      include 'brkcln.par'                                              SWAP011
c                                                                       SWAP012
      real    scaaat(ncoord,sdchna,maxres), scocc(sdchna,maxres),       SWAP013
     &        scthrm(sdchna,maxres), dumaat(ncoord), dumocc, dumthm     SWAP014
c                                                                       SWAP015
CHECK v.3.2-->                                                          SWAP016
C      logical scatin(sdchna,maxres)                                    SWAP017
CHECK v.3.2<--                                                          SWAP018
CHECK v.3.4-->                                                          SWAP019
      LOGICAL       NMR                                                 SWAP020
CHECK v.3.4<--                                                          SWAP021
c                                                                       SWAP022
      integer sswap(2,sideaa), aacod, nold(sdchna,maxres), i, j,        SWAP023
     &        nside, nxres, totswp(sideaa)                              SWAP024
c                                                                       SWAP025
      data sswap(1, 1) / 0 /                                            SWAP026
      data sswap(1, 2) / 0 /                                            SWAP027
      data sswap(1, 3) / 0 /                                            SWAP028
      data sswap(1, 4) / 3 /                                            SWAP029
      data sswap(1, 5) / 4 /                                            SWAP030
      data sswap(1, 6) / 3 /                                            SWAP031
      data sswap(1, 7) / 0 /                                            SWAP032
      data sswap(1, 8) / 0 /                                            SWAP033
      data sswap(1, 9) / 2 /                                            SWAP034
      data sswap(1, 10) / 0 /                                           SWAP035
      data sswap(1, 11) / 0 /                                           SWAP036
      data sswap(1, 12) / 3 /                                           SWAP037
      data sswap(1, 13) / 0 /                                           SWAP038
      data sswap(1, 14) / 0 /                                           SWAP039
      data sswap(1, 15) / 0 /                                           SWAP040
      data sswap(1, 16) / 0 /                                           SWAP041
      data sswap(1, 17) / 0 /                                           SWAP042
      data sswap(1, 18) / 6 /                                           SWAP043
      data sswap(1, 19) / 0 /                                           SWAP044
      data sswap(1, 20) / 2 /                                           SWAP045
      data sswap(1, 21) / 0 /                                           SWAP046
      data sswap(1, 22) / 2 /                                           SWAP047
      data sswap(1, 23) / 0 /                                           SWAP048
      data sswap(1, 24) / 0 /                                           SWAP049
      data sswap(1, 25) / 3 /                                           SWAP050
      data sswap(1, 26) / 0 /                                           SWAP051
      data sswap(1, 27) / 0 /                                           SWAP052
      data sswap(1, 28) / 0 /                                           SWAP053
      data sswap(1, 29) / 0 /                                           SWAP054
      data sswap(1, 30) / 0 /                                           SWAP055
      data sswap(1, 31) / 3 /                                           SWAP056
      data sswap(1, 32) / 0 /                                           SWAP057
      data sswap(1, 33) / 0 /                                           SWAP058
      data sswap(1, 34) / 0 /                                           SWAP059
      data sswap(1, 35) / 3 /                                           SWAP060
      data sswap(1, 36) / 0 /                                           SWAP061
      data sswap(1, 37) / 0 /                                           SWAP062
      data sswap(1, 38) / 0 /                                           SWAP063
      data sswap(1, 39) / 3 /                                           SWAP064
      data sswap(1, 40) / 0 /                                           SWAP065
      data sswap(1, 41) / 3 /                                           SWAP066
      data sswap(1, 42) / 3 /                                           SWAP067
      data sswap(1, 43) / 0 /                                           SWAP068
      data sswap(1, 44) / 0 /                                           SWAP069
      data sswap(1, 45) / 2 /                                           SWAP070
      data sswap(1, 46) / 2 /                                           SWAP071
      data sswap(1, 47) / 3 /                                           SWAP072
      data sswap(1, 48) / 0 /                                           SWAP073
      data sswap(1, 49) / 0 /                                           SWAP074
      data sswap(1, 50) / 3 /                                           SWAP075
      data sswap(2, 1) / 0 /                                            SWAP076
      data sswap(2, 2) / 0 /                                            SWAP077
      data sswap(2, 3) / 0 /                                            SWAP078
      data sswap(2, 4) / 0 /                                            SWAP079
      data sswap(2, 5) / 0 /                                            SWAP080
      data sswap(2, 6) / 5 /                                            SWAP081
      data sswap(2, 7) / 0 /                                            SWAP082
      data sswap(2, 8) / 0 /                                            SWAP083
      data sswap(2, 9) / 0 /                                            SWAP084
      data sswap(2, 10) / 0 /                                           SWAP085
      data sswap(2, 11) / 0 /                                           SWAP086
      data sswap(2, 12) / 0 /                                           SWAP087
      data sswap(2, 13) / 0 /                                           SWAP088
      data sswap(2, 14) / 0 /                                           SWAP089
      data sswap(2, 15) / 0 /                                           SWAP090
      data sswap(2, 16) / 0 /                                           SWAP091
      data sswap(2, 17) / 0 /                                           SWAP092
      data sswap(2, 18) / 0 /                                           SWAP093
      data sswap(2, 19) / 0 /                                           SWAP094
      data sswap(2, 20) / 0 /                                           SWAP095
      data sswap(2, 21) / 0 /                                           SWAP096
      data sswap(2, 22) / 0 /                                           SWAP097
      data sswap(2, 23) / 0 /                                           SWAP098
      data sswap(2, 24) / 0 /                                           SWAP099
      data sswap(2, 25) / 5 /                                           SWAP100
      data sswap(2, 26) / 0 /                                           SWAP101
      data sswap(2, 27) / 0 /                                           SWAP102
      data sswap(2, 28) / 0 /                                           SWAP103
      data sswap(2, 29) / 0 /                                           SWAP104
      data sswap(2, 30) / 0 /                                           SWAP105
      data sswap(2, 31) / 5 /                                           SWAP106
      data sswap(2, 32) / 0 /                                           SWAP107
      data sswap(2, 33) / 0 /                                           SWAP108
      data sswap(2, 34) / 0 /                                           SWAP109
      data sswap(2, 35) / 5 /                                           SWAP110
      data sswap(2, 36) / 0 /                                           SWAP111
      data sswap(2, 37) / 0 /                                           SWAP112
      data sswap(2, 38) / 0 /                                           SWAP113
      data sswap(2, 39) / 5 /                                           SWAP114
      data sswap(2, 40) / 0 /                                           SWAP115
      data sswap(2, 41) / 0 /                                           SWAP116
      data sswap(2, 42) / 5 /                                           SWAP117
      data sswap(2, 43) / 0 /                                           SWAP118
      data sswap(2, 44) / 0 /                                           SWAP119
      data sswap(2, 45) / 0 /                                           SWAP120
      data sswap(2, 46) / 0 /                                           SWAP121
      data sswap(2, 47) / 5 /                                           SWAP122
      data sswap(2, 48) / 0 /                                           SWAP123
      data sswap(2, 49) / 0 /                                           SWAP124
      data sswap(2, 50) / 5 /                                           SWAP125
c                                                                       SWAP126
          do 100 i = 1, 2                                               SWAP127
              if (sswap(i,aacod) .ne. 0) then                           SWAP128
                 nside = sswap(i,aacod)                                 SWAP129
CHECK v.3.4-->                                                          SWAP130
      IF (.NOT.NMR) THEN                                                SWAP131
CHECK v.3.4<--                                                          SWAP132
                 do 10 j = 1, ncoord                                    SWAP133
                     dumaat(j) = scaaat(j,nside,nxres)                  SWAP134
                     scaaat(j,nside,nxres) = scaaat(j,nside+1,nxres)    SWAP135
                     scaaat(j,nside+1,nxres) = dumaat(j)                SWAP136
   10            continue                                               SWAP137
                 dumocc = scocc(nside,nxres)                            SWAP138
                 scocc(nside,nxres) = scocc(nside+1,nxres)              SWAP139
                 scocc(nside+1,nxres) = dumocc                          SWAP140
                 dumthm = scthrm(nside,nxres)                           SWAP141
                 scthrm(nside,nxres) = scthrm(nside+1,nxres)            SWAP142
                 scthrm(nside+1,nxres) = dumthm                         SWAP143
CHECK v.3.4-->                                                          SWAP144
      ENDIF                                                             SWAP145
CHECK v.3.4<--                                                          SWAP146
                 nold(nside,nxres) = nside + 1                          SWAP147
                 nold(nside+1,nxres) = nside                            SWAP148
              end if                                                    SWAP149
  100     continue                                                      SWAP150
      totswp(aacod) = totswp(aacod) + 1                                 SWAP151
      end                                                               SWAP152
