1 subroutine read_control
8 include 'COMMON.IOUNITS'
10 include 'COMMON.SBRIDGE'
11 include 'COMMON.CONTROL'
12 include 'COMMON.CLUSTER'
13 include 'COMMON.CHAIN'
14 include 'COMMON.HEADER'
15 include 'COMMON.FFIELD'
17 character*320 controlcard,ucase
23 read (INP,'(a80)') titel
24 call card_concat(controlcard)
26 call readi(controlcard,'NRES',nres,0)
27 call readi(controlcard,'RESCALE',rescale_mode,2)
28 call readi(controlcard,'PDBOUT',outpdb,0)
29 call readi(controlcard,'MOL2OUT',outmol2,0)
30 refstr=(index(controlcard,'REFSTR').gt.0)
31 write (iout,*) "REFSTR",refstr
32 pdbref=(index(controlcard,'PDBREF').gt.0)
33 iscode=index(controlcard,'ONE_LETTER')
34 tree=(index(controlcard,'MAKE_TREE').gt.0)
35 min_var=(index(controlcard,'MINVAR').gt.0)
36 plot_tree=(index(controlcard,'PLOT_TREE').gt.0)
37 punch_dist=(index(controlcard,'PUNCH_DIST').gt.0)
38 call readi(controlcard,'NCUT',ncut,1)
39 call readi(controlcard,'NSTART',nstart,0)
40 call readi(controlcard,'NEND',nend,0)
41 call reada(controlcard,'ECUT',ecut,10.0d0)
42 call reada(controlcard,'PROB',prob_limit,0.99d0)
43 write (iout,*) "Probability limit",prob_limit
44 lgrp=(index(controlcard,'LGRP').gt.0)
45 caonly=(index(controlcard,'CA_ONLY').gt.0)
46 print_dist=(index(controlcard,'PRINT_DIST').gt.0)
47 call multreada(controlcard,'CUTOFF',rcutoff,ncut,-1.0d0)
48 call readi(controlcard,'IOPT',iopt,2)
49 lside = index(controlcard,"SIDE").gt.0
50 efree = index(controlcard,"EFREE").gt.0
51 call readi(controlcard,'NTEMP',nT,1)
52 write (iout,*) "nT",nT
53 call multreada(controlcard,'TEMPER',beta_h,nT,300.0d0)
54 write (iout,*) "nT",nT
55 write (iout,*) 'beta_h',(beta_h(i),i=1,nT)
57 beta_h(i)=1.0d0/(1.987D-3*beta_h(i))
59 write (iout,*) 'beta_h',(beta_h(i),i=1,nT)
60 lprint_cart=index(controlcard,"PRINT_CART") .gt.0
61 lprint_int=index(controlcard,"PRINT_INT") .gt.0
62 with_dihed_constr = index(controlcard,"WITH_DIHED_CONSTR").gt.0
63 call readi(controlcard,'CONSTR_DIST',constr_dist,0)
64 write (iout,*) "with_dihed_constr ",with_dihed_constr,
65 & " CONSTR_DIST",constr_dist
70 c--------------------------------------------------------------------------
73 C Read molecular data.
77 include 'COMMON.IOUNITS'
80 include 'COMMON.INTERACT'
81 include 'COMMON.LOCAL'
82 include 'COMMON.NAMES'
83 include 'COMMON.CHAIN'
84 include 'COMMON.FFIELD'
85 include 'COMMON.SBRIDGE'
86 include 'COMMON.HEADER'
87 include 'COMMON.CONTROL'
88 include 'COMMON.CONTACTS'
89 include 'COMMON.TIME1'
90 include 'COMMON.TORCNSTR'
94 character*4 sequence(maxres)
95 character*800 weightcard
97 double precision x(maxvar)
98 integer itype_pdb(maxres)
104 C Read weights of the subsequent energy terms.
105 call card_concat(weightcard)
106 call reada(weightcard,'WSC',wsc,1.0d0)
107 call reada(weightcard,'WLONG',wsc,wsc)
108 call reada(weightcard,'WSCP',wscp,1.0d0)
109 call reada(weightcard,'WELEC',welec,1.0D0)
110 call reada(weightcard,'WVDWPP',wvdwpp,welec)
111 call reada(weightcard,'WEL_LOC',wel_loc,1.0D0)
112 call reada(weightcard,'WCORR4',wcorr4,0.0D0)
113 call reada(weightcard,'WCORR5',wcorr5,0.0D0)
114 call reada(weightcard,'WCORR6',wcorr6,0.0D0)
115 call reada(weightcard,'WTURN3',wturn3,1.0D0)
116 call reada(weightcard,'WTURN4',wturn4,1.0D0)
117 call reada(weightcard,'WTURN6',wturn6,1.0D0)
118 call reada(weightcard,'WSTRAIN',wstrain,1.0D0)
119 call reada(weightcard,'WBOND',wbond,1.0D0)
120 call reada(weightcard,'WTOR',wtor,1.0D0)
121 call reada(weightcard,'WTORD',wtor_d,1.0D0)
122 call reada(weightcard,'WANG',wang,1.0D0)
123 call reada(weightcard,'WSCLOC',wscloc,1.0D0)
124 call reada(weightcard,'SCAL14',scal14,0.4D0)
125 call reada(weightcard,'SCALSCP',scalscp,1.0d0)
126 call reada(weightcard,'CUTOFF',cutoff_corr,7.0d0)
127 call reada(weightcard,'DELT_CORR',delt_corr,0.5d0)
128 call reada(weightcard,'WSCCOR',wsccor,1.0D0)
129 if (index(weightcard,'SOFT').gt.0) ipot=6
130 C 12/1/95 Added weight for the multi-body term WCORR
131 call reada(weightcard,'WCORRH',wcorr,1.0D0)
132 if (wcorr4.gt.0.0d0) wcorr=wcorr4
151 write (iout,10) wsc,wscp,welec,wvdwpp,wbond,wang,wscloc,wtor,
152 & wtor_d,wstrain,wel_loc,wcorr,wcorr5,wcorr6,wturn3,
153 & wturn4,wturn6,wsccor
154 10 format (/'Energy-term weights (unscaled):'//
155 & 'WSCC= ',f10.6,' (SC-SC)'/
156 & 'WSCP= ',f10.6,' (SC-p)'/
157 & 'WELEC= ',f10.6,' (p-p electr)'/
158 & 'WVDWPP= ',f10.6,' (p-p VDW)'/
159 & 'WBOND= ',f10.6,' (stretching)'/
160 & 'WANG= ',f10.6,' (bending)'/
161 & 'WSCLOC= ',f10.6,' (SC local)'/
162 & 'WTOR= ',f10.6,' (torsional)'/
163 & 'WTORD= ',f10.6,' (double torsional)'/
164 & 'WSTRAIN=',f10.6,' (SS bridges & dist. cnstr.)'/
165 & 'WEL_LOC=',f10.6,' (multi-body 3-rd order)'/
166 & 'WCORR4= ',f10.6,' (multi-body 4th order)'/
167 & 'WCORR5= ',f10.6,' (multi-body 5th order)'/
168 & 'WCORR6= ',f10.6,' (multi-body 6th order)'/
169 & 'WTURN3= ',f10.6,' (turns, 3rd order)'/
170 & 'WTURN4= ',f10.6,' (turns, 4th order)'/
171 & 'WTURN6= ',f10.6,' (turns, 6th order)'/
172 & 'WSCCOR= ',f10.6,' (SC-backbone torsinal correalations)')
173 if (wcorr4.gt.0.0d0) then
174 write (iout,'(/2a/)') 'Local-electrostatic type correlation ',
175 & 'between contact pairs of peptide groups'
176 write (iout,'(2(a,f5.3/))')
177 & 'Cutoff on 4-6th order correlation terms: ',cutoff_corr,
178 & 'Range of quenching the correlation terms:',2*delt_corr
179 else if (wcorr.gt.0.0d0) then
180 write (iout,'(/2a/)') 'Hydrogen-bonding correlation ',
181 & 'between contact pairs of peptide groups'
183 write (iout,'(a,f8.3)')
184 & 'Scaling factor of 1,4 SC-p interactions:',scal14
185 write (iout,'(a,f8.3)')
186 & 'General scaling factor of SC-p interactions:',scalscp
187 r0_corr=cutoff_corr-delt_corr
189 aad(i,1)=scalscp*aad(i,1)
190 aad(i,2)=scalscp*aad(i,2)
191 bad(i,1)=scalscp*bad(i,1)
192 bad(i,2)=scalscp*bad(i,2)
196 print *,'indpdb=',indpdb,' pdbref=',pdbref
198 C Read sequence if not taken from the pdb file.
199 if (iscode.gt.0) then
200 read (inp,'(80a1)') (sequence(i)(1:1),i=1,nres)
202 read (inp,'(20(1x,a3))') (sequence(i),i=1,nres)
204 C Convert sequence to numeric code
206 itype(i)=rescode(i,sequence(i),iscode)
209 print '(20i4)',(itype(i),i=1,nres)
213 if (itype(i).eq.21 .or. itype(i+1).eq.21) then
215 if (itype(i).eq.21) then
219 else if (itype(i+1).ne.20) then
221 else if (itype(i).ne.20) then
228 write (iout,*) "ITEL"
230 write (iout,*) i,itype(i),itel(i)
233 print *,'Call Read_Bridge.'
235 if (with_dihed_constr) then
237 read (inp,*) ndih_constr
238 if (ndih_constr.gt.0) then
240 write (iout,*) 'FTORS',ftors
241 read (inp,*) (idih_constr(i),phi0(i),drange(i),i=1,ndih_constr)
243 & 'There are',ndih_constr,' constraints on phi angles.'
245 write (iout,'(i5,2f8.3)') idih_constr(i),phi0(i),drange(i)
248 phi0(i)=deg2rad*phi0(i)
249 drange(i)=deg2rad*drange(i)
256 print *,'NNT=',NNT,' NCT=',NCT
257 if (itype(1).eq.21) nnt=2
258 if (itype(nres).eq.21) nct=nct-1
259 if (nstart.lt.nnt) nstart=nnt
260 if (nend.gt.nct .or. nend.eq.0) nend=nct
261 write (iout,*) "nstart",nstart," nend",nend
264 c read(inp,'(a)') pdbfile
265 c write (iout,'(2a)') 'PDB data will be read from file ',pdbfile
266 c open(ipdbin,file=pdbfile,status='old',err=33)
268 c 33 write (iout,'(a)') 'Error opening PDB file.'
271 c print *,'Begin reading pdb data'
273 c print *,'Finished reading pdb data'
274 c write (iout,'(a,i3,a,i3)')'nsup=',nsup,' nstart_sup=',nstart_sup
276 c itype_pdb(i)=itype(i)
279 c write (iout,'(a,i3)') 'nsup=',nsup
281 c if (nsup.le.(nct-nnt+1)) then
282 c do i=0,nct-nnt+1-nsup
283 c if (seq_comp(itype(nnt+i),itype_pdb(nstart_sup),nsup)) then
289 c & 'Error - sequences to be superposed do not match.'
292 c do i=0,nsup-(nct-nnt+1)
293 c if (seq_comp(itype(nnt),itype_pdb(nstart_sup+i),nct-nnt+1))
295 c nstart_sup=nstart_sup+i
301 c & 'Error - sequences to be superposed do not match.'
304 c write (iout,*) 'nsup=',nsup,' nstart_sup=',nstart_sup,
305 c & ' nstart_seq=',nstart_seq
309 write (iout,*) "molread: REFSTR",refstr
311 if (.not.pdbref) then
312 call read_angles(inp,*38)
314 38 write (iout,'(a)') 'Error reading reference structure.'
316 call mp_stopall(Error_Msg)
318 stop 'Error reading reference structure'
330 call contact(.true.,ncont_ref,icont_ref)
332 c Read distance restraints
333 if (constr_dist.gt.0) then
334 call read_dist_constr
339 c-----------------------------------------------------------------------------
340 logical function seq_comp(itypea,itypeb,length)
342 integer length,itypea(length),itypeb(length)
345 if (itypea(i).ne.itypeb(i)) then
353 c-----------------------------------------------------------------------------
354 subroutine read_bridge
355 C Read information about disulfide bridges.
358 include 'COMMON.IOUNITS'
361 include 'COMMON.INTERACT'
362 include 'COMMON.LOCAL'
363 include 'COMMON.NAMES'
364 include 'COMMON.CHAIN'
365 include 'COMMON.FFIELD'
366 include 'COMMON.SBRIDGE'
367 include 'COMMON.HEADER'
368 include 'COMMON.CONTROL'
369 include 'COMMON.TIME1'
371 include 'COMMON.INFO'
374 C Read bridging residues.
375 read (inp,*) ns,(iss(i),i=1,ns)
377 C Check whether the specified bridging residues are cystines.
379 if (itype(iss(i)).ne.1) then
380 write (iout,'(2a,i3,a)')
381 & 'Do you REALLY think that the residue ',restyp(iss(i)),i,
382 & ' can form a disulfide bridge?!!!'
383 write (*,'(2a,i3,a)')
384 & 'Do you REALLY think that the residue ',restyp(iss(i)),i,
385 & ' can form a disulfide bridge?!!!'
387 call mp_stopall(error_msg)
393 C Read preformed bridges.
395 read (inp,*) nss,(ihpb(i),jhpb(i),i=1,nss)
398 C Check if the residues involved in bridges are in the specified list of
402 if (ihpb(i).eq.ihpb(j).or.ihpb(i).eq.jhpb(j)
403 & .or.jhpb(i).eq.ihpb(j).or.jhpb(i).eq.jhpb(j)) then
404 write (iout,'(a,i3,a)') 'Disulfide pair',i,
405 & ' contains residues present in other pairs.'
406 write (*,'(a,i3,a)') 'Disulfide pair',i,
407 & ' contains residues present in other pairs.'
409 call mp_stopall(error_msg)
416 if (ihpb(i).eq.iss(j)) goto 10
418 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
421 if (jhpb(i).eq.iss(j)) goto 20
423 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
436 c----------------------------------------------------------------------------
437 subroutine read_angles(kanal,*)
442 include 'COMMON.CHAIN'
443 include 'COMMON.IOUNITS'
445 read (kanal,*,err=10,end=10) (theta(i),i=3,nres)
446 read (kanal,*,err=10,end=10) (phi(i),i=4,nres)
447 read (kanal,*,err=10,end=10) (alph(i),i=2,nres-1)
448 read (kanal,*,err=10,end=10) (omeg(i),i=2,nres-1)
450 theta(i)=deg2rad*theta(i)
451 phi(i)=deg2rad*phi(i)
452 alph(i)=deg2rad*alph(i)
453 omeg(i)=deg2rad*omeg(i)
458 c----------------------------------------------------------------------------
459 subroutine reada(rekord,lancuch,wartosc,default)
461 character*(*) rekord,lancuch
462 double precision wartosc,default
465 iread=index(rekord,lancuch)
470 iread=iread+ilen(lancuch)+1
471 read (rekord(iread:),*) wartosc
474 c----------------------------------------------------------------------------
475 subroutine multreada(rekord,lancuch,tablica,dim,default)
478 double precision tablica(dim),default
479 character*(*) rekord,lancuch
485 iread=index(rekord,lancuch)
486 if (iread.eq.0) return
487 iread=iread+ilen(lancuch)+1
488 read (rekord(iread:),*,end=10,err=10) (tablica(i),i=1,dim)
491 c----------------------------------------------------------------------------
492 subroutine readi(rekord,lancuch,wartosc,default)
494 character*(*) rekord,lancuch
495 integer wartosc,default
498 iread=index(rekord,lancuch)
503 iread=iread+ilen(lancuch)+1
504 read (rekord(iread:),*) wartosc
507 c----------------------------------------------------------------------------
508 subroutine multreadi(rekord,lancuch,tablica,dim,default)
511 integer tablica(dim),default
512 character*(*) rekord,lancuch
519 iread=index(rekord,lancuch(:ilen(lancuch))//"=")
520 if (iread.eq.0) return
521 iread=iread+ilen(lancuch)+1
522 read (rekord(iread:),*,end=10,err=10) (tablica(i),i=1,dim)
525 c----------------------------------------------------------------------------
526 subroutine card_concat(card)
528 include 'COMMON.IOUNITS'
530 character*80 karta,ucase
532 read (inp,'(a)') karta
535 do while (karta(80:80).eq.'&')
536 card=card(:ilen(card)+1)//karta(:79)
537 read (inp,'(a)') karta
540 card=card(:ilen(card)+1)//karta
543 c----------------------------------------------------------------------------
552 include 'COMMON.IOUNITS'
553 include 'COMMON.CONTROL'
554 integer lenpre,lenpot,ilen
556 character*16 cformat,cprint
558 integer lenint,lenout
559 call getenv('INPUT',prefix)
560 call getenv('OUTPUT',prefout)
561 call getenv('INTIN',prefintin)
562 call getenv('COORD',cformat)
563 call getenv('PRINTCOOR',cprint)
564 call getenv('SCRATCHDIR',scratchdir)
567 if (index(ucase(cformat),'CX').gt.0) then
574 lenint=ilen(prefintin)
575 C Get the names and open the input files
576 open (inp,file=prefix(:ilen(prefix))//'.inp',status='old')
578 write (liczba,'(bz,i3.3)') me
579 outname=prefout(:lenout)//'_clust.out_'//liczba
581 outname=prefout(:lenout)//'_clust.out'
584 intinname=prefintin(:lenint)//'.bx'
585 else if (from_cx) then
586 intinname=prefintin(:lenint)//'.cx'
588 intinname=prefintin(:lenint)//'.int'
590 rmsname=prefintin(:lenint)//'.rms'
591 open (jplot,file=prefout(:ilen(prefout))//'.tex',
593 open (jrms,file=rmsname,status='unknown')
594 open(iout,file=outname,status='unknown')
595 C Get parameter filenames and open the parameter files.
596 call getenv('BONDPAR',bondname)
597 open (ibond,file=bondname,status='old')
598 call getenv('THETPAR',thetname)
599 open (ithep,file=thetname,status='old')
600 call getenv('ROTPAR',rotname)
601 open (irotam,file=rotname,status='old')
602 call getenv('TORPAR',torname)
603 open (itorp,file=torname,status='old')
604 call getenv('TORDPAR',tordname)
605 open (itordp,file=tordname,status='old')
606 call getenv('FOURIER',fouriername)
607 open (ifourier,file=fouriername,status='old')
608 call getenv('ELEPAR',elename)
609 open (ielep,file=elename,status='old')
610 call getenv('SIDEPAR',sidename)
611 open (isidep,file=sidename,status='old')
612 call getenv('SIDEP',sidepname)
613 open (isidep1,file=sidepname,status="old")
614 call getenv('SCCORPAR',sccorname)
615 open (isccor,file=sccorname,status="old")
618 C 8/9/01 In the newest version SCp interaction constants are read from a file
619 C Use -DOLDSCP to use hard-coded constants instead.
621 call getenv('SCPPAR',scpname)
622 open (iscpp,file=scpname,status='old')
626 c-------------------------------------------------------------------------------
627 subroutine read_dist_constr
628 implicit real*8 (a-h,o-z)
630 include 'COMMON.CONTROL'
631 include 'COMMON.CHAIN'
632 include 'COMMON.IOUNITS'
633 include 'COMMON.SBRIDGE'
634 integer ifrag_(2,100),ipair_(2,100)
635 double precision wfrag_(100),wpair_(100)
636 character*500 controlcard
637 c write (iout,*) "Calling read_dist_constr"
638 c write (iout,*) "nres",nres," nstart_sup",nstart_sup," nsup",nsup
639 call card_concat(controlcard)
641 c write (iout,'(a)') controlcard
642 call readi(controlcard,"NFRAG",nfrag_,0)
643 call readi(controlcard,"NPAIR",npair_,0)
644 call readi(controlcard,"NDIST",ndist_,0)
645 call reada(controlcard,'DIST_CUT',dist_cut,5.0d0)
646 call multreadi(controlcard,"IFRAG",ifrag_(1,1),2*nfrag_,0)
647 call multreadi(controlcard,"IPAIR",ipair_(1,1),2*npair_,0)
648 call multreada(controlcard,"WFRAG",wfrag_(1),nfrag_,0.0d0)
649 call multreada(controlcard,"WPAIR",wpair_(1),npair_,0.0d0)
650 write (iout,*) "NFRAG",nfrag_," NPAIR",npair_," NDIST",ndist_
651 write (iout,*) "IFRAG"
653 write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
655 write (iout,*) "IPAIR"
657 write (iout,*) i,ipair_(1,i),ipair_(2,i),wpair_(i)
660 if (.not.refstr .and. nfrag_.gt.0) then
662 & "ERROR: no reference structure to compute distance restraints"
664 & "Restraints must be specified explicitly (NDIST=number)"
667 if (nfrag_.lt.2 .and. npair_.gt.0) then
668 write (iout,*) "ERROR: Less than 2 fragments specified",
669 & " but distance restraints between pairs requested"
674 if (ifrag_(1,i).lt.nstart_sup) ifrag_(1,i)=nstart_sup
675 if (ifrag_(2,i).gt.nstart_sup+nsup-1)
676 & ifrag_(2,i)=nstart_sup+nsup-1
677 c write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
679 if (wfrag_(i).gt.0.0d0) then
680 do j=ifrag_(1,i),ifrag_(2,i)-1
682 write (iout,*) "j",j," k",k
684 if (constr_dist.eq.1) then
689 forcon(nhpb)=wfrag_(i)
690 else if (constr_dist.eq.2) then
691 if (ddjk.le.dist_cut) then
696 forcon(nhpb)=wfrag_(i)
703 forcon(nhpb)=wfrag_(i)*dexp(-0.5d0*(ddjk/dist_cut)**2)
705 write (iout,'(a,3i5,f8.2,1pe12.2)') "+dist.constr ",
706 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
712 if (wpair_(i).gt.0.0d0) then
720 do j=ifrag_(1,ii),ifrag_(2,ii)
721 do k=ifrag_(1,jj),ifrag_(2,jj)
725 forcon(nhpb)=wpair_(i)
727 write (iout,'(a,3i5,f8.2,f10.1)') "+dist.constr ",
728 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
734 read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),dhpb(i),dhpb1(i),
735 & ibecarb(i),forcon(nhpb+1)
736 if (forcon(nhpb+1).gt.0.0d0) then
738 if (ibecarb(i).gt.0) then
742 if (dhpb(nhpb).eq.0.0d0)
743 & dhpb(nhpb)=dist(ihpb(nhpb),jhpb(nhpb))
747 write (iout,'(a,3i5,2f8.2,i2,f10.1)') "+dist.constr ",
748 & i,ihpb(i),jhpb(i),dhpb(i),dhpb1(i),ibecarb(i),forcon(i)