CHECK v.3.2-->                                                          CREA001
C      Subroutine CreatH(mcaaat, atomin, chnsz, chnct, seqlen)          CREA002
      Subroutine CreatH(mcaaat, atomin, chnsz, chnct)                   CREA001
CHECK v.3.2<--                                                          CREA002
c                                                                       CREA003
c     Procedure to create hydrogen atoms. These are deemed to be        CREA004
c     one angstrom from the nitrogen atom and angled so that N-H        CREA005
c     is parallel to C=O before. By taking the vector from O to C       CREA006
c     the N-H bond is generated on the other side of C-N to the O.      CREA007
c                                                                       CREA008
      INCLUDE 'sstruc.par'                                              CREA009
                                                                        CREA010
CHECK v.3.2-->                                                          CREA011
C      integer chnsz(maxchn), chnct, seqlen                             CREA012
      integer chnsz(maxchn), chnct                                      CREA013
CHECK v.3.2<--                                                          CREA014
      real    mcaaat(ncoord,mnchna,maxres)                              CREA015
      logical atomin(mnchna,maxres)                                     CREA016
c                                                                       CREA017
c     local variables                                                   CREA018
c                                                                       CREA019
      Integer nxres, i, chnst, nxchn                                    CREA020
      Real    atvec(ncoord), colen                                      CREA021
c                                                                       CREA022
      chnst = 0                                                         CREA023
      do 2000, nxchn = 1, chnct                                         CREA024
      do 1900, nxres = chnst + 2, chnst + chnsz(nxchn)                  CREA025
      If (atomin(nmain,nxres) .and. atomin(carb,nxres-1) .and.          CREA026
     &   atomin(oxyg,nxres-1)) then                                     CREA027
         Colen = 0.0                                                    CREA028
         do 300 i = 1,ncoord                                            CREA029
         atvec(i) = mcaaat(i,carb,nxres-1) - mcaaat(i,oxyg,nxres-1)     CREA030
         colen = colen + atvec(i) ** 2                                  CREA031
  300    continue                                                       CREA032
         colen = sqrt(colen)                                            CREA033
         do 500 i = 1, ncoord                                           CREA034
         atvec(i) = atvec(i) / colen                                    CREA035
  500    continue                                                       CREA036
         do 700 i = 1, ncoord                                           CREA037
         mcaaat(i,nhyd,nxres) = mcaaat(i,nmain,nxres) + atvec(i)        CREA038
  700    continue                                                       CREA039
         atomin(nhyd,nxres) = .true.                                    CREA040
      else                                                              CREA041
         write(errfi,1100) nxres                                        CREA042
 1100    format('hydrogen atom not generated for residue ',i4)          CREA043
         atomin(nhyd,nxres) = .false.                                   CREA044
      end if                                                            CREA045
 1900 continue                                                          CREA046
      chnst = chnst + chnsz(nxchn)                                      CREA047
 2000 continue                                                          CREA048
      END                                                               CREA049
