1 subroutine read_control
7 include 'COMMON.IOUNITS'
9 include 'COMMON.THREAD'
10 include 'COMMON.SBRIDGE'
11 include 'COMMON.CONTROL'
12 include 'COMMON.CLUSTER'
13 include 'COMMON.CHAIN'
14 include 'COMMON.HEADER'
15 character*320 controlcard,ucase
20 read (INP,'(a80)') titel
21 call card_concat(controlcard)
23 C Set up the time limit (caution! The time must be input in minutes!)
24 call reada(controlcard,'TIMLIM',timlim,60.0D0)
25 write (iout,'(a,f10.1)') 'Time limit (min):',timlim
32 call readi(controlcard,'NRES',nres,0)
33 call reada(controlcard,'TEMP',betaT,298.0d0)
34 write (iout,*) "temperature",betaT
35 betaT=1.0d0/(betaT*1.987D-3)
36 write (iout,*) "betaT",betaT
37 call readi(controlcard,'PDBOUT',outpdb,0)
38 call readi(controlcard,'MOL2OUT',outmol2,0)
39 refstr=(index(controlcard,'REFSTR').gt.0)
40 pdbref=(index(controlcard,'PDBREF').gt.0)
41 iscode=index(controlcard,'ONE_LETTER')
42 tree=(index(controlcard,'MAKE_TREE').gt.0)
43 min_var=(index(controlcard,'MINVAR').gt.0)
44 plot_tree=(index(controlcard,'PLOT_TREE').gt.0)
45 punch_dist=(index(controlcard,'PUNCH_DIST').gt.0)
46 call readi(controlcard,'NCUT',ncut,1)
47 call reada(controlcard,'ECUT',ecut,10.0d0)
48 lgrp=(index(controlcard,'LGRP').gt.0)
49 caonly=(index(controlcard,'CA_ONLY').gt.0)
50 print_dist=(index(controlcard,'PRINT_DIST').gt.0)
51 print *,"print_dist",print_dist
52 call multreada(controlcard,'CUTOFF',rcutoff,ncut,-1.0d0)
53 call readi(controlcard,'IOPT',iopt,2)
55 lside = index(controlcard,"SIDE").gt.0
56 efree = index(controlcard,"EFREE").gt.0
58 call readi(controlcard,'ISTART',is,1)
60 call readi(controlcard,'IEND',ie,10000000)
62 call readi(controlcard,'ISAMPL',isampl,1)
63 print *,"isampl",isampl
64 call reada(controlcard,'TS',ts,1.0d10)
65 call reada(controlcard,'TE',te,1.0d10)
66 print *,"is",is," ie",ie
70 c--------------------------------------------------------------------------
73 C Read molecular data.
76 include 'COMMON.IOUNITS'
79 include 'COMMON.INTERACT'
80 include 'COMMON.LOCAL'
81 include 'COMMON.NAMES'
82 include 'COMMON.CHAIN'
83 include 'COMMON.FFIELD'
84 include 'COMMON.SBRIDGE'
85 include 'COMMON.HEADER'
86 include 'COMMON.CONTROL'
87 include 'COMMON.DBASE'
88 include 'COMMON.THREAD'
89 include 'COMMON.CONTACTS'
90 include 'COMMON.TIME1'
94 character*4 sequence(maxres)
96 double precision x(maxvar)
98 dimension itype_pdb(maxres)
103 if (indpdb.gt.0 .or. pdbref) then
104 read(inp,'(a)') pdbfile
105 write (iout,'(2a)') 'PDB data will be read from file ',pdbfile
106 open(ipdbin,file=pdbfile,status='old',err=33)
108 33 write (iout,'(a)') 'Error opening PDB file.'
111 print *,'Begin reading pdb data'
113 print *,'Finished reading pdb data'
114 write (iout,'(a,i3,a,i3)')'nsup=',nsup,' nstart_sup=',nstart_sup
116 itype_pdb(i)=itype(i)
120 if (indpdb.eq.0) then
121 C Read sequence if not taken from the pdb file.
122 if (iscode.gt.0) then
123 read (inp,'(80a1)') (sequence(i)(1:1),i=1,nres)
125 read (inp,'(20(1x,a3))') (sequence(i),i=1,nres)
127 C Convert sequence to numeric code
129 itype(i)=rescode(i,sequence(i),iscode)
133 print '(20i4)',(itype(i),i=1,nres)
135 if (itype(i).ne.20) then
141 print *,'Call Read_Bridge.'
145 print *,'NNT=',NNT,' NCT=',NCT
146 if (itype(1).eq.21) nnt=2
147 if (itype(nres).eq.21) nct=nct-1
149 write (iout,'(a,i3)') 'nsup=',nsup
151 if (nsup.le.(nct-nnt+1)) then
152 do i=0,nct-nnt+1-nsup
153 if (seq_comp(itype(nnt+i),itype_pdb(nstart_sup),nsup)) then
159 & 'Error - sequences to be superposed do not match.'
162 do i=0,nsup-(nct-nnt+1)
163 if (seq_comp(itype(nnt),itype_pdb(nstart_sup+i),nct-nnt+1))
165 nstart_sup=nstart_sup+i
171 & 'Error - sequences to be superposed do not match.'
174 write (iout,*) 'nsup=',nsup,' nstart_sup=',nstart_sup,
175 & ' nstart_seq=',nstart_seq
178 if (.not.pdbref) then
179 call read_angles(inp,*38)
181 38 write (iout,'(a)') 'Error reading reference structure.'
183 call mp_stopall(Error_Msg)
185 stop 'Error reading reference structure'
197 call contact(.true.,ncont_ref,icont_ref)
201 c-----------------------------------------------------------------------------
202 logical function seq_comp(itypea,itypeb,length)
204 integer length,itypea(length),itypeb(length)
207 if (itypea(i).ne.itypeb(i)) then
215 c-----------------------------------------------------------------------------
216 subroutine read_bridge
217 C Read information about disulfide bridges.
219 include 'COMMON.IOUNITS'
222 include 'COMMON.INTERACT'
223 include 'COMMON.LOCAL'
224 include 'COMMON.NAMES'
225 include 'COMMON.CHAIN'
226 include 'COMMON.FFIELD'
227 include 'COMMON.SBRIDGE'
228 include 'COMMON.HEADER'
229 include 'COMMON.CONTROL'
230 include 'COMMON.DBASE'
231 include 'COMMON.THREAD'
232 include 'COMMON.TIME1'
234 include 'COMMON.INFO'
236 C Read bridging residues.
237 read (inp,*) ns,(iss(i),i=1,ns)
239 C Check whether the specified bridging residues are cystines.
241 if (itype(iss(i)).ne.1) then
242 write (iout,'(2a,i3,a)')
243 & 'Do you REALLY think that the residue ',restyp(iss(i)),i,
244 & ' can form a disulfide bridge?!!!'
245 write (*,'(2a,i3,a)')
246 & 'Do you REALLY think that the residue ',restyp(iss(i)),i,
247 & ' can form a disulfide bridge?!!!'
249 call mp_stopall(error_msg)
255 C Read preformed bridges.
257 read (inp,*) nss,(ihpb(i),jhpb(i),i=1,nss)
260 C Check if the residues involved in bridges are in the specified list of
264 if (ihpb(i).eq.ihpb(j).or.ihpb(i).eq.jhpb(j)
265 & .or.jhpb(i).eq.ihpb(j).or.jhpb(i).eq.jhpb(j)) then
266 write (iout,'(a,i3,a)') 'Disulfide pair',i,
267 & ' contains residues present in other pairs.'
268 write (*,'(a,i3,a)') 'Disulfide pair',i,
269 & ' contains residues present in other pairs.'
271 call mp_stopall(error_msg)
278 if (ihpb(i).eq.iss(j)) goto 10
280 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
283 if (jhpb(i).eq.iss(j)) goto 20
285 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
298 c----------------------------------------------------------------------------
299 subroutine read_angles(kanal,*)
303 include 'COMMON.CHAIN'
304 include 'COMMON.IOUNITS'
305 read (kanal,*,err=10,end=10) (theta(i),i=3,nres)
306 read (kanal,*,err=10,end=10) (phi(i),i=4,nres)
307 read (kanal,*,err=10,end=10) (alph(i),i=2,nres-1)
308 read (kanal,*,err=10,end=10) (omeg(i),i=2,nres-1)
310 theta(i)=deg2rad*theta(i)
311 phi(i)=deg2rad*phi(i)
312 alph(i)=deg2rad*alph(i)
313 omeg(i)=deg2rad*omeg(i)
318 c----------------------------------------------------------------------------
319 subroutine reada(rekord,lancuch,wartosc,default)
321 character*(*) rekord,lancuch
322 double precision wartosc,default
325 iread=index(rekord,lancuch)
330 iread=iread+ilen(lancuch)+1
331 read (rekord(iread:),*) wartosc
334 c----------------------------------------------------------------------------
335 subroutine multreada(rekord,lancuch,tablica,dim,default)
338 double precision tablica(dim),default
339 character*(*) rekord,lancuch
345 iread=index(rekord,lancuch)
346 if (iread.eq.0) return
347 iread=iread+ilen(lancuch)+1
348 read (rekord(iread:),*,end=10,err=10) (tablica(i),i=1,dim)
351 c----------------------------------------------------------------------------
352 subroutine readi(rekord,lancuch,wartosc,default)
354 character*(*) rekord,lancuch
355 integer wartosc,default
358 iread=index(rekord,lancuch)
363 iread=iread+ilen(lancuch)+1
364 read (rekord(iread:),*) wartosc
367 c----------------------------------------------------------------------------
368 subroutine split_string(rekord,tablica,dim,nsub)
370 integer dim,nsub,i,ii,ll,kk
371 character*(*) tablica(dim)
382 C Find the start of term name
384 do while (ii.le.ll .and. rekord(ii:ii).eq." ")
387 C Parse the name into TABLICA(i) until blank found
388 do while (ii.le.ll .and. rekord(ii:ii).ne." ")
390 tablica(i)(kk:kk)=rekord(ii:ii)
393 if (kk.gt.0) nsub=nsub+1
398 c----------------------------------------------------------------------------
399 subroutine card_concat(card)
401 include 'COMMON.IOUNITS'
403 character*80 karta,ucase
405 read (inp,'(a)') karta
408 do while (karta(80:80).eq.'&')
409 card=card(:ilen(card)+1)//karta(:79)
410 read (inp,'(a)') karta
413 card=card(:ilen(card)+1)//karta
416 c----------------------------------------------------------------------------
419 include 'COMMON.IOUNITS'
420 include 'COMMON.CONTROL'
421 integer lenpre,lenpot,ilen
423 character*16 cfrom_pdb,cprint
425 call getenv('INPUT',prefix)
426 call getenv('OUTPUT',prefout)
427 call getenv('INTIN',prefintin)
428 call getenv('PDB',cfrom_pdb)
429 call getenv('PRINTCOOR',cprint)
430 from_cart = index(ucase(cfrom_pdb),'CART').gt.0
431 from_cx = index(ucase(cfrom_pdb),'CX').gt.0
432 lprint_cart = index(ucase(cprint),'CART').gt.0
433 lprint_int = index(ucase(cprint),'INT').gt.0
434 c if (.not.lprint_cart .and. .not.lprint_int) lprint_int=.true.
437 lenint=ilen(prefintin)
438 C Get the names and open the input files
439 open (inp,file=prefix(:ilen(prefix))//'.inp',status='old')
440 outname=prefout(:lenout)//'_clust.out'
442 intinname=prefintin(:lenint)//'.x'
443 else if (from_cx) then
444 write (iout,*) "cx files: ",prefintin(:ilen(prefintin))
445 call split_string(prefintin,cxfiles(1),maxfiles,nfiles)
446 write (iout,*) "nfiles",nfiles
447 write (iout,*) "Split cxfiles"
449 cxfiles(i)=cxfiles(i)(:ilen(cxfiles(i)))//'.cx'
450 write (iout,*) cxfiles(i)(:ilen(cxfiles(i)))
453 intinname=prefintin(:lenint)//'.int'
455 if (lprint_cart) then
456 if (.not. from_cx) then
457 intname=prefintin(:lenint)//'_clust'//'.x'
459 intname=cxfiles(1)(:ilen(cxfiles(1)))//'_clust'//'.x'
461 else if (lprint_int) then
462 if (.not. from_cx) then
463 intname=prefintin(:lenint)//'_clust'//'.int'
465 intname=cxfiles(1)(:ilen(cxfiles(1)))//'_clust'//'.int'
468 rmsname=prefintin(:lenint)//'.rms'
469 statinname=prefintin(:lenint)//'.stat'
471 statoutname=prefintin(:lenint)//'_clust.stat'
472 open (jplot,file=prefout(:ilen(prefout))//'.tex',
474 print *,'unit',jplot,' opened'
475 if (.not. from_cx) open (intin,file=intinname,status='old')
476 print *,'unit',intin,' opened'
477 open (jrms,file=rmsname,status='unknown')
478 open (jstatin,file=statinname,status='unknown')
479 open (jstatout,file=statoutname,status='unknown')
481 open(iout,file=outname,status='unknown')
482 print *,'unit',iout,' opened'
483 open(igeom,file=intname,status='unknown',position='append')
484 print *,'unit',igeom,' opened'
486 open(iout,file=outname,status='unknown')
487 open(igeom,file=intname,status='unknown',access='append')
489 open(iout,file=outname,status='unknown')
490 open(igeom,file=intname,status='unknown',position='append')