[e40e335] | 1 | c **************************************************************
|
---|
| 2 | c
|
---|
| 3 | c This file contains the subroutines: outpdb
|
---|
| 4 | c
|
---|
| 5 | c Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,
|
---|
| 6 | c Shura Hayryan, Chin-Ku
|
---|
| 7 | c Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann,
|
---|
| 8 | c Jan H. Meinke, Sandipan Mohanty
|
---|
| 9 | c
|
---|
| 10 | c **************************************************************
|
---|
| 11 |
|
---|
| 12 | subroutine outpdb(nml,fileName)
|
---|
| 13 |
|
---|
| 14 | c ..............................................
|
---|
| 15 | c PURPOSE: write coordinates of molecule 'nml'
|
---|
| 16 | c in PDB-format (with specialities for hydrogens)
|
---|
| 17 | c
|
---|
| 18 | c INPUT: nml - number of molecule
|
---|
| 19 | c
|
---|
| 20 | c npdb - unit of output-file
|
---|
| 21 | c
|
---|
| 22 | c CALLS: toupst,iendst
|
---|
| 23 | c ..............................................
|
---|
| 24 |
|
---|
| 25 | include 'INCL.H'
|
---|
| 26 |
|
---|
| 27 | dimension ibd(4)
|
---|
| 28 | character chid,cdin,res*3,atnm*5,linty*6,linout*80
|
---|
| 29 | character*(*) fileName
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 | cdin=' ' !!! residue insert code
|
---|
| 33 | occ=one !!! occupancy
|
---|
| 34 | bva=zero !!! B-value
|
---|
| 35 |
|
---|
| 36 | i0 = ichar('0')
|
---|
| 37 | i9 = ichar('9')
|
---|
| 38 |
|
---|
| 39 | if (nml.lt.0.or.nml.gt.ntlml) then
|
---|
| 40 | write(*,*) ' outpdb> No such molecule #',nml,' !'
|
---|
| 41 | return
|
---|
| 42 | elseif (nml.gt.0) then
|
---|
| 43 | im1 = nml
|
---|
| 44 | im2 = nml
|
---|
| 45 | else
|
---|
| 46 | im1 = 1
|
---|
| 47 | im2 = ntlml
|
---|
| 48 | endif
|
---|
| 49 |
|
---|
| 50 | if (ibegst(fileName).gt.0) then
|
---|
| 51 | iout = 99
|
---|
| 52 | open(iout, file=fileName, status='unknown')
|
---|
| 53 | else
|
---|
| 54 | iout = 6
|
---|
| 55 | endif
|
---|
| 56 |
|
---|
| 57 | iat=0
|
---|
| 58 |
|
---|
| 59 | do iml = im1,im2
|
---|
| 60 |
|
---|
| 61 | if (ntlml.eq.1) then
|
---|
| 62 | chid=' '
|
---|
| 63 | else
|
---|
| 64 | chid = char(64 + iml)
|
---|
| 65 | endif
|
---|
| 66 |
|
---|
| 67 | irs=0
|
---|
| 68 | ifirs=irsml1(iml)
|
---|
| 69 | ifiat=iatrs1(ifirs)
|
---|
| 70 |
|
---|
| 71 | do nrs=ifirs,irsml2(iml)
|
---|
| 72 |
|
---|
| 73 | irs=irs+1
|
---|
| 74 | res(1:)=seq(nrs)(1:3)
|
---|
| 75 |
|
---|
| 76 | if (res.ne.'ace'.and.res.ne.'nme') then
|
---|
| 77 | linty = 'ATOM '
|
---|
| 78 | else
|
---|
| 79 | linty = 'HETATM'
|
---|
| 80 | endif
|
---|
| 81 |
|
---|
| 82 | do i=iatrs1(nrs),iatrs2(nrs)
|
---|
| 83 | iat=iat+1
|
---|
| 84 |
|
---|
| 85 | atnm=' '
|
---|
| 86 | atnm(2:5)=nmat(i)
|
---|
| 87 |
|
---|
| 88 | if (atnm(2:2).eq.'h') then ! hydrogens by PDB convention
|
---|
| 89 |
|
---|
| 90 | j = iendst(atnm)
|
---|
| 91 | if (ichar(atnm(j:j)).ge.i0.and.
|
---|
| 92 | # ichar(atnm(j:j)).le.i9) then
|
---|
| 93 | atnm(1:1)=atnm(j:j)
|
---|
| 94 | atnm(j:j)=' '
|
---|
| 95 | endif
|
---|
| 96 |
|
---|
| 97 | endif
|
---|
| 98 |
|
---|
| 99 | call toupst(atnm)
|
---|
| 100 | call toupst(res)
|
---|
| 101 |
|
---|
| 102 | linout = ' '
|
---|
| 103 | write (linout,1) linty,iat,atnm,res(1:3),chid,irs,cdin,
|
---|
| 104 | # xat(i),yat(i),zat(i),occ,bva
|
---|
| 105 | write(iout,'(a80)') linout
|
---|
| 106 |
|
---|
| 107 | enddo ! atoms
|
---|
| 108 | enddo ! residues
|
---|
| 109 |
|
---|
| 110 | iat = iat + 1
|
---|
| 111 | linout = ' '
|
---|
| 112 | write(linout,2) 'TER ',iat,res(1:3),chid
|
---|
| 113 | write(iout,'(a80)') linout
|
---|
| 114 |
|
---|
| 115 | enddo ! molecules
|
---|
| 116 |
|
---|
| 117 | c ______________________________________ connectivity
|
---|
| 118 | c ( only bonds i-j with i<j)
|
---|
| 119 |
|
---|
| 120 | do iml = im1,im2
|
---|
| 121 |
|
---|
| 122 | ifirs=irsml1(iml)
|
---|
| 123 |
|
---|
| 124 | if (nml.gt.0) then
|
---|
| 125 | iat = iatrs1(ifirs) - 1
|
---|
| 126 | else
|
---|
| 127 | iat = 1 - iml
|
---|
| 128 | endif
|
---|
| 129 |
|
---|
| 130 | do nrs=ifirs,irsml2(iml)
|
---|
| 131 | nfi=iatrs1(nrs)
|
---|
| 132 |
|
---|
| 133 | do i=nfi,iatrs2(nrs)
|
---|
| 134 |
|
---|
| 135 | if (nbdat(i).gt.0) then
|
---|
| 136 | if (nrs.eq.ifirs.and.i.eq.nfi) then
|
---|
| 137 | ibd(1)=iowat(i)
|
---|
| 138 | ibd(2)=ibdat(1,i)
|
---|
| 139 | ibd(3)=ibdat(2,i)
|
---|
| 140 | ibd(4)=ibdat(3,i)
|
---|
| 141 | jj=4
|
---|
| 142 | else
|
---|
| 143 | ibd(1)=ibdat(1,i)
|
---|
| 144 | ibd(2)=ibdat(2,i)
|
---|
| 145 | ibd(3)=ibdat(3,i)
|
---|
| 146 | jj=3
|
---|
| 147 | endif
|
---|
| 148 | nbd=0
|
---|
| 149 | do j=1,jj
|
---|
| 150 | if (ibd(j).gt.i) then
|
---|
| 151 | nbd=nbd+1
|
---|
| 152 | ibd(nbd)=ibd(j)
|
---|
| 153 | endif
|
---|
| 154 | enddo
|
---|
| 155 |
|
---|
| 156 | if (nbd.gt.0) then
|
---|
| 157 | linout = ' '
|
---|
| 158 | write (linout,3) 'CONECT',(i-iat),((ibd(j)-iat),j=1,nbd)
|
---|
| 159 | write(iout,'(a80)') linout
|
---|
| 160 | endif
|
---|
| 161 |
|
---|
| 162 | endif ! bonds
|
---|
| 163 |
|
---|
| 164 | enddo ! atoms
|
---|
| 165 | enddo ! residues
|
---|
| 166 |
|
---|
| 167 | enddo ! molecules
|
---|
| 168 |
|
---|
| 169 | linout = ' '
|
---|
| 170 | write (linout,'(a3)') 'END'
|
---|
| 171 | write(iout,'(a80)') linout
|
---|
| 172 |
|
---|
| 173 | close(iout)
|
---|
| 174 |
|
---|
| 175 | 1 format (a6,i5,1x,a5,a3,1x,a1,i4,a1,3x,3f8.3,2(1x,f5.2))
|
---|
| 176 | 2 format (a6,i5,6x,a3,1x,a1)
|
---|
| 177 | 3 format (a6,5i5)
|
---|
| 178 |
|
---|
| 179 | return
|
---|
| 180 | end
|
---|