source: outpdb.f

Last change on this file was 38d77eb, checked in by baerbaer <baerbaer@…>, 14 years ago

Redirected standard out to logString.

SMMP produced a lot of log messages. This became an issue when run in massively
parallel environments. I replaced all writes to standard out to a write to logString.
The next step is to pass this string to a function that writes the messages to a log
file according to their importance and the chosen log level.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/smmp/trunk@34 26dc1dd8-5c4e-0410-9ffe-d298b4865968

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