5 implicit real*8 (a-h,o-z)
7 include 'DIMENSIONS.ZSCOPT'
8 include 'DIMENSIONS.FREE'
9 include 'COMMON.IOUNITS'
12 c include 'include_unres/COMMON.VAR'
13 include 'COMMON.INTERACT'
14 include 'COMMON.LOCAL'
15 include 'COMMON.NAMES'
16 include 'COMMON.CHAIN'
17 include 'COMMON.FFIELD'
18 include 'COMMON.SBRIDGE'
19 include 'COMMON.TORCNSTR'
20 include 'COMMON.CONTROL'
21 character*4 sequence(maxres)
23 double precision x(maxvar)
24 character*320 controlcard,ucase
25 dimension itype_pdb(maxres)
27 call card_concat(controlcard,.true.)
28 call reada(controlcard,'SCAL14',scal14,0.4d0)
29 call reada(controlcard,'SCALSCP',scalscp,1.0d0)
30 call reada(controlcard,'CUTOFF',cutoff_corr,7.0d0)
31 call reada(controlcard,'DELT_CORR',delt_corr,0.5d0)
33 call reada(controlcard,'WDFAD',wdfa_dist,0.0d0)
34 call reada(controlcard,'WDFAT',wdfa_tor,0.0d0)
35 call reada(controlcard,'WDFAN',wdfa_nei,0.0d0)
36 call reada(controlcard,'WDFAB',wdfa_beta,0.0d0)
37 write (iout,*) "wdfa_dist",wdfa_dist," wdfa_tor",wdfa_tor,
38 & " wdfa_nei",wdfa_nei," wdfa_beta",wdfa_beta
39 r0_corr=cutoff_corr-delt_corr
40 call readi(controlcard,"NRES",nres,0)
41 iscode=index(controlcard,"ONE_LETTER")
43 write (iout,*) "Error: no residues in molecule"
46 if (nres.gt.maxres) then
47 write (iout,*) "Error: too many residues",nres,maxres
49 write(iout,*) 'nres=',nres
50 C Read sequence of the protein
52 read (inp,'(80a1)') (sequence(i)(1:1),i=1,nres)
54 read (inp,'(20(1x,a3))') (sequence(i),i=1,nres)
56 C Convert sequence to numeric code
58 itype(i)=rescode(i,sequence(i),iscode)
60 if (itype(2).eq.10.and.itype(1).eq.ntyp1) then
62 & "Glycine is the first full residue, initial dummy deleted"
68 if (itype(nres-1).eq.10.and.itype(nres).eq.ntyp1) then
70 & "Glycine is the last full residue, terminal dummy deleted"
73 write (iout,*) "Numeric code:"
74 write (iout,'(20i4)') (itype(i),i=1,nres)
77 if (itype(i).eq.21 .or. itype(i+1).eq.21) then
79 if (itype(i).eq.21) then
83 else if (itype(i+1).ne.20) then
85 else if (itype(i).ne.20) then
94 if (with_dihed_constr) then
96 read (inp,*) ndih_constr
97 if (ndih_constr.gt.0) then
99 write (iout,*) 'FTORS',ftors
100 read (inp,*) (idih_constr(i),phi0(i),drange(i),i=1,ndih_constr)
102 & 'There are',ndih_constr,' constraints on phi angles.'
104 write (iout,'(i5,2f8.3)') idih_constr(i),phi0(i),drange(i)
107 phi0(i)=deg2rad*phi0(i)
108 drange(i)=deg2rad*drange(i)
116 if (itype(1).eq.21) nnt=2
117 if (itype(nres).eq.21) nct=nct-1
118 write(iout,*) 'NNT=',NNT,' NCT=',NCT
120 C Juyong:READ init_vars
121 C Initialize variables!
122 C Juyong:READ read_info
123 C READ fragment information!!
124 C both routines should be in dfa.F file!!
126 if (.not. (wdfa_dist.eq.0.0 .and. wdfa_tor.eq.0.0 .and.
127 & wdfa_nei.eq.0.0 .and. wdfa_beta.eq.0.0)) then
128 write (iout,*) "Calling init_dfa_vars"
131 write (iout,*) 'init_dfa_vars finished!'
134 write (iout,*) 'read_dfa_info finished!'
138 c Read distance restraints
139 if (constr_dist.gt.0) then
140 if (refstr) call read_ref_structure(*11)
141 call read_dist_constr
145 if (constr_homology.gt.0) then
146 c write (iout,*) "About to call read_constr_homology"
148 call read_constr_homology
149 c write (iout,*) "Exit read_constr_homology"
151 if (indpdb.gt.0 .or. pdbref) then
155 cref(j,i)=crefjlee(j,i)
160 write (iout,*) "Array C"
162 write (iout,'(i5,3f8.3,5x,3f8.3)') i,(c(j,i),j=1,3),
163 & (c(j,i+nres),j=1,3)
165 write (iout,*) "Array Cref"
167 write (iout,'(i5,3f8.3,5x,3f8.3)') i,(cref(j,i),j=1,3),
168 & (cref(j,i+nres),j=1,3)
172 call int_from_cart1(.false.)
173 call sc_loc_geom(.false.)
177 write (iout,*) i," phiref",phiref(i)," thetaref",thetaref(i)
181 dc(j,i)=c(j,i+1)-c(j,i)
182 dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
187 dc(j,i+nres)=c(j,i+nres)-c(j,i)
188 dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
200 write (iout,'(/a,i3,a)') 'The chain contains',ns,
201 & ' disulfide-bridging cysteines.'
202 write (iout,'(20i4)') (iss(i),i=1,ns)
203 write (iout,'(/a/)') 'Pre-formed links are:'
209 write (iout,'(2a,i3,3a,i3,a,3f10.3)')
210 & restyp(it1),'(',i1,') -- ',restyp(it2),'(',i2,')',
211 & dhpb(i),ebr,forcon(i)
216 11 stop "Error reading reference structure"
218 c-----------------------------------------------------------------------------
219 logical function seq_comp(itypea,itypeb,length)
221 integer length,itypea(length),itypeb(length)
224 if (itypea(i).ne.itypeb(i)) then
232 c-----------------------------------------------------------------------------
233 subroutine read_bridge
234 C Read information about disulfide bridges.
235 implicit real*8 (a-h,o-z)
237 include 'DIMENSIONS.ZSCOPT'
238 include 'COMMON.IOUNITS'
241 include 'COMMON.INTERACT'
242 include 'COMMON.NAMES'
243 include 'COMMON.CHAIN'
244 include 'COMMON.FFIELD'
245 include 'COMMON.SBRIDGE'
246 C Read bridging residues.
247 read (inp,*) ns,(iss(i),i=1,ns)
249 write (iout,*) 'ns=',ns,' iss:',(iss(i),i=1,ns)
250 C Check whether the specified bridging residues are cystines.
252 if (itype(iss(i)).ne.1) then
253 write (iout,'(2a,i3,a)')
254 & 'Do you REALLY think that the residue ',restyp(iss(i)),i,
255 & ' can form a disulfide bridge?!!!'
256 write (*,'(2a,i3,a)')
257 & 'Do you REALLY think that the residue ',restyp(iss(i)),i,
258 & ' can form a disulfide bridge?!!!'
262 C Read preformed bridges.
264 read (inp,*) nss,(ihpb(i),jhpb(i),i=1,nss)
265 write (iout,*) 'nss=',nss,' ihpb,jhpb: ',(ihpb(i),jhpb(i),i=1,nss)
268 C Check if the residues involved in bridges are in the specified list of
272 if (ihpb(i).eq.ihpb(j).or.ihpb(i).eq.jhpb(j)
273 & .or.jhpb(i).eq.ihpb(j).or.jhpb(i).eq.jhpb(j)) then
274 write (iout,'(a,i3,a)') 'Disulfide pair',i,
275 & ' contains residues present in other pairs.'
276 write (*,'(a,i3,a)') 'Disulfide pair',i,
277 & ' contains residues present in other pairs.'
282 if (ihpb(i).eq.iss(j)) goto 10
284 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
287 if (jhpb(i).eq.iss(j)) goto 20
289 write (iout,'(a,i3,a)') 'Pair',i,' contains unknown cystine.'
300 if (ns.gt.0.and.dyn_ss) then
301 C /06/28/2013 Adasko:ns is number of Cysteins bonded also called half of
304 C /06/28/2013 Adasko: nss number of full SS bonds
307 forcon(i-nss)=forcon(i)
314 dyn_ss_mask(iss(i))=.true.
315 C /06/28/2013 Adasko: dyn_ss_mask which Cysteins can form disulfidebond
316 c write(iout,*) i,iss(i),dyn_ss_mask(iss(i)),"ATU"
321 c------------------------------------------------------------------------------
322 subroutine read_angles(kanal,iscor,energ,iprot,*)
323 implicit real*8 (a-h,o-z)
325 include 'DIMENSIONS.ZSCOPT'
326 include 'COMMON.INTERACT'
327 include 'COMMON.SBRIDGE'
330 include 'COMMON.CHAIN'
331 include 'COMMON.IOUNITS'
333 read(kanal,'(a80)',end=10,err=10) lineh
334 read(lineh(:5),*,err=8) ic
335 read(lineh(6:),*,err=8) energ
338 print *,'error, assuming e=1d10',lineh
342 read(lineh(18:),*,end=10,err=10) nss
344 read (lineh(20:),*,end=10,err=10)
345 & (IHPB(I),JHPB(I),I=1,NSS),iscor
347 read (lineh(20:),*,end=10,err=10) (IHPB(I),JHPB(I),I=1,8)
348 read (kanal,*,end=10,err=10) (IHPB(I),JHPB(I),
351 c print *,"energy",energ," iscor",iscor
352 read (kanal,*,err=10,end=10) (theta(i),i=3,nres)
353 read (kanal,*,err=10,end=10) (phi(i),i=4,nres)
354 read (kanal,*,err=10,end=10) (alph(i),i=2,nres-1)
355 read (kanal,*,err=10,end=10) (omeg(i),i=2,nres-1)
357 theta(i)=deg2rad*theta(i)
358 phi(i)=deg2rad*phi(i)
359 alph(i)=deg2rad*alph(i)
360 omeg(i)=deg2rad*omeg(i)
365 c-------------------------------------------------------------------------------
366 subroutine read_dist_constr
367 implicit real*8 (a-h,o-z)
369 include 'COMMON.CONTROL'
370 include 'COMMON.CHAIN'
371 include 'COMMON.IOUNITS'
372 include 'COMMON.SBRIDGE'
373 integer ifrag_(2,100),ipair_(2,100)
374 double precision wfrag_(100),wpair_(100)
375 character*500 controlcard
376 logical normalize,next
378 double precision xlink(4,0:4) /
380 & 0.0d0,0.0d0,0.0d0,0.0d0, ! default, no xlink potential
381 & 0.00305218d0,9.46638d0,4.68901d0,4.74347d0, ! ZL
382 & 0.00214928d0,12.7517d0,0.00375009d0,6.13477d0, ! ADH
383 & 0.00184547d0,11.2678d0,0.00140292d0,7.00868d0, ! PDH
384 & 0.000161786d0,6.29273d0,4.40993d0,7.13956d0 / ! DSS
385 write (iout,*) "Calling read_dist_constr"
386 c write (iout,*) "nres",nres," nstart_sup",nstart_sup," nsup",nsup
392 call card_concat(controlcard,.true.)
393 next = index(controlcard,"NEXT").gt.0
394 call readi(controlcard,"RESTR_TYPE",restr_type,constr_dist)
395 write (iout,*) "restr_type",restr_type
396 call readi(controlcard,"NFRAG",nfrag_,0)
397 call readi(controlcard,"NFRAG",nfrag_,0)
398 call readi(controlcard,"NPAIR",npair_,0)
399 call readi(controlcard,"NDIST",ndist_,0)
400 call reada(controlcard,'DIST_CUT',dist_cut,5.0d0)
401 if (restr_type.eq.10)
402 & call reada(controlcard,'WBOLTZD',wboltzd,0.591d0)
403 call multreadi(controlcard,"IFRAG",ifrag_(1,1),2*nfrag_,0)
404 call multreadi(controlcard,"IPAIR",ipair_(1,1),2*npair_,0)
405 call multreada(controlcard,"WFRAG",wfrag_(1),nfrag_,0.0d0)
406 call multreada(controlcard,"WPAIR",wpair_(1),npair_,0.0d0)
407 normalize = index(controlcard,"NORMALIZE").gt.0
408 write (iout,*) "WBOLTZD",wboltzd
409 c write (iout,*) "NFRAG",nfrag_," NPAIR",npair_," NDIST",ndist_
410 c write (iout,*) "IFRAG"
412 c write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
414 c write (iout,*) "IPAIR"
416 c write (iout,*) i,ipair_(1,i),ipair_(2,i),wpair_(i)
418 if (nfrag_.gt.0) then
420 read(inp,'(a)') pdbfile
422 & "Distance restraints will be constructed from structure ",pdbfile
423 open(ipdbin,file=pdbfile,status='old',err=11)
429 if (ifrag_(1,i).lt.nstart_sup) ifrag_(1,i)=nstart_sup
430 if (ifrag_(2,i).gt.nstart_sup+nsup-1)
431 & ifrag_(2,i)=nstart_sup+nsup-1
432 c write (iout,*) i,ifrag_(1,i),ifrag_(2,i),wfrag_(i)
434 if (wfrag_(i).eq.0.0d0) cycle
435 do j=ifrag_(1,i),ifrag_(2,i)-1
437 c write (iout,*) "j",j," k",k
439 if (restr_type.eq.1) then
445 forcon(nhpb)=wfrag_(i)
446 else if (constr_dist.eq.2) then
447 if (ddjk.le.dist_cut) then
453 forcon(nhpb)=wfrag_(i)
455 else if (restr_type.eq.3) then
461 forcon(nhpb)=wfrag_(i)*dexp(-0.5d0*(ddjk/dist_cut)**2)
463 write (iout,'(a,3i5,f8.2,1pe12.2)') "+dist.restr ",
464 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
469 if (wpair_(i).eq.0.0d0) cycle
477 do j=ifrag_(1,ii),ifrag_(2,ii)
478 do k=ifrag_(1,jj),ifrag_(2,jj)
479 if (restr_type.eq.1) then
485 forcon(nhpb)=wfrag_(i)
486 else if (constr_dist.eq.2) then
487 if (ddjk.le.dist_cut) then
493 forcon(nhpb)=wfrag_(i)
495 else if (restr_type.eq.3) then
501 forcon(nhpb)=wfrag_(i)*dexp(-0.5d0*(ddjk/dist_cut)**2)
503 write (iout,'(a,3i5,f8.2,f10.1)') "+dist.restr ",
504 & nhpb,ihpb(nhpb),jhpb(nhpb),dhpb(nhpb),forcon(nhpb)
510 write (iout,*) "Distance restraints as read from input"
512 if (restr_type.eq.11) then
513 read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),dhpb(nhpb+1),
514 & dhpb1(nhpb+1),ibecarb(i),forcon(nhpb+1),fordepth(nhpb+1)
515 c fordepth(nhpb+1)=fordepth(nhpb+1)/forcon(nhpb+1)
516 if (forcon(nhpb+1).le.0.0d0.or.fordepth(nhpb+1).le.0.0d0)cycle
519 write (iout,'(a,4i5,2f8.2,2f10.5,i5)') "+dist.restr ",
520 & nhpb,ihpb(nhpb),jhpb(nhpb),ibecarb(nhpb),dhpb(nhpb),
521 & dhpb1(nhpb),forcon(nhpb),fordepth(nhpb),irestr_type(nhpb)
522 if (ibecarb(nhpb).gt.0) then
523 ihpb(nhpb)=ihpb(nhpb)+nres
524 jhpb(nhpb)=jhpb(nhpb)+nres
526 else if (constr_dist.eq.10) then
527 c Cross-lonk Markov-like potential
528 call card_concat(controlcard,.true.)
529 call readi(controlcard,"ILINK",ihpb(nhpb+1),0)
530 call readi(controlcard,"JLINK",jhpb(nhpb+1),0)
532 if (index(controlcard,"BETA").gt.0) ibecarb(nhpb+1)=1
533 if (ihpb(nhpb+1).eq.0 .or. jhpb(nhpb+1).eq.0) cycle
534 if (index(controlcard,"ZL").gt.0) then
536 else if (index(controlcard,"ADH").gt.0) then
538 else if (index(controlcard,"PDH").gt.0) then
540 else if (index(controlcard,"DSS").gt.0) then
545 call reada(controlcard,"AXLINK",dhpb(nhpb+1),
546 & xlink(1,link_type))
547 call reada(controlcard,"BXLINK",dhpb1(nhpb+1),
548 & xlink(2,link_type))
549 call reada(controlcard,"CXLINK",fordepth(nhpb+1),
550 & xlink(3,link_type))
551 call reada(controlcard,"SIGMA",forcon(nhpb+1),
552 & xlink(4,link_type))
553 call reada(controlcard,"SCORE",xlscore(nhpb+1),1.0d0)
554 c read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),ibecarb(nhpb+1),
555 c & dhpb(nhpb+1),dhpb1(nhpb+1),forcon(nhpb+1),fordepth(nhpb+1)
556 if (forcon(nhpb+1).le.0.0d0 .or.
557 & (dhpb(nhpb+1).eq.0 .and. dhpb1(nhpb+1).eq.0)) cycle
560 if (ibecarb(nhpb).gt.0) then
561 ihpb(nhpb)=ihpb(nhpb)+nres
562 jhpb(nhpb)=jhpb(nhpb)+nres
564 write (iout,'(a,4i5,2f8.2,3f10.5,i5)') "+dist.restr ",
565 & nhpb,ihpb(nhpb),jhpb(nhpb),ibecarb(nhpb),dhpb(nhpb),
566 & dhpb1(nhpb),forcon(nhpb),fordepth(nhpb),xlscore(nhpb),
570 read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),dhpb(nhpb+1),
571 & dhpb1(nhpb+1),ibecarb(nhpb+1),forcon(nhpb+1)
572 if (forcon(nhpb+1).gt.0.0d0) then
574 if (dhpb1(nhpb).eq.0.0d0) then
579 if (ibecarb(nhpb).gt.0) then
580 ihpb(nhpb)=ihpb(nhpb)+nres
581 jhpb(nhpb)=jhpb(nhpb)+nres
583 if (dhpb(nhpb).eq.0.0d0)
584 & dhpb(nhpb)=dist(ihpb(nhpb),jhpb(nhpb))
586 write (iout,'(a,4i5,f8.2,f10.1)') "+dist.restr ",
587 & nhpb,ihpb(nhpb),jhpb(nhpb),ibecarb(i),dhpb(nhpb),forcon(nhpb)
589 C read (inp,*) ihpb(nhpb+1),jhpb(nhpb+1),forcon(nhpb+1)
590 C if (forcon(nhpb+1).gt.0.0d0) then
592 C dhpb(nhpb)=dist(ihpb(nhpb),jhpb(nhpb))
600 if (irestr_type(i).eq.11.and.fordepth(i).gt.fordepthmax)
601 & fordepthmax=fordepth(i)
604 if (irestr_type(i).eq.11) fordepth(i)=fordepth(i)/fordepthmax
607 if (nhpb.gt.nss) then
608 write (iout,'(/a,i5,a/4a5,2a8,3a10,a5)')
609 & "The following",nhpb-nss,
610 & " distance restraints have been imposed:",
611 & " Nr"," res1"," res2"," beta"," d1"," d2"," k"," V",
614 write (iout,'(4i5,2f8.2,3f10.5,i5)')i-nss,ihpb(i),jhpb(i),
615 & ibecarb(i),dhpb(i),dhpb1(i),forcon(i),fordepth(i),xlscore(i),
623 11 write (iout,*)"read_dist_restr: error reading reference structure"
626 c====-------------------------------------------------------------------
627 subroutine read_constr_homology
630 include 'DIMENSIONS.ZSCOPT'
631 include 'DIMENSIONS.FREE'
635 include 'COMMON.SETUP'
636 include 'COMMON.CONTROL'
637 include 'COMMON.CHAIN'
638 include 'COMMON.IOUNITS'
640 include 'COMMON.INTERACT'
641 include 'COMMON.NAMES'
642 include 'COMMON.HOMRESTR'
647 c include 'include_unres/COMMON.VAR'
650 c double precision odl_temp,sigma_odl_temp,waga_theta,waga_d,
652 c common /przechowalnia/ odl_temp(maxres,maxres,max_template),
653 c & sigma_odl_temp(maxres,maxres,max_template)
655 character*24 model_ki_dist, model_ki_angle
656 character*500 controlcard
657 integer ki, i, j, k, l, ii_in_use(maxdim),i_tmp,idomain_tmp
658 integer idomain(max_template,maxres)
659 logical lprn /.true./
662 logical unres_pdb,liiflag
664 c FP - Nov. 2014 Temporary specifications for new vars
666 double precision rescore_tmp,x12,y12,z12,rescore2_tmp
667 double precision, dimension (max_template,maxres) :: rescore
668 double precision, dimension (max_template,maxres) :: rescore2
669 character*24 tpl_k_rescore
670 c -----------------------------------------------------------------
671 c Reading multiple PDB ref structures and calculation of retraints
672 c not using pre-computed ones stored in files model_ki_{dist,angle}
674 c -----------------------------------------------------------------
677 c Alternative: reading from input
678 call card_concat(controlcard,.true.)
679 call reada(controlcard,"HOMOL_DIST",waga_dist,1.0d0)
680 call reada(controlcard,"HOMOL_ANGLE",waga_angle,1.0d0)
681 call reada(controlcard,"HOMOL_THETA",waga_theta,1.0d0) ! new
682 call reada(controlcard,"HOMOL_SCD",waga_d,1.0d0) ! new
683 call reada(controlcard,'DIST_CUT',dist_cut,5.0d0) ! for diff ways of calc sigma
684 call reada(controlcard,'DIST2_CUT',dist2_cut,9999.0d0)
685 call readi(controlcard,"HOMOL_NSET",homol_nset,1)
686 read2sigma=(index(controlcard,'READ2SIGMA').gt.0)
687 call readi(controlcard,"IHSET",ihset,1)
688 if (homol_nset.gt.1)then
689 call card_concat(controlcard,.true.)
690 read(controlcard,*) (waga_homology(i),i=1,homol_nset)
691 if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0) then
692 write(iout,*) "iset homology_weight "
694 c write(iout,*) i,waga_homology(i)
697 iset=mod(kolor,homol_nset)+1
702 c write(iout,*) "waga_homology(",iset,")",waga_homology(iset)
704 cd write (iout,*) "nnt",nnt," nct",nct
716 c Reading HM global scores (prob not required)
719 do k=1,constr_homology
723 c open (4,file="HMscore")
724 c do k=1,constr_homology
725 c read (4,*,end=521) hmscore_tmp
726 c hmscore(k)=hmscore_tmp ! Another transformation can be used
727 c write(*,*) "Model", k, ":", hmscore(k)
738 c write(iout,*) "waga_theta",waga_theta,"waga_d",waga_d
740 if (read_homol_frag) then
741 call read_klapaucjusz
744 do k=1,constr_homology
746 read(inp,'(a)') pdbfile
747 c Next stament causes error upon compilation (?)
748 c if(me.eq.king.or. .not. out1file)
749 c write (iout,'(2a)') 'PDB data will be read from file ',
750 c & pdbfile(:ilen(pdbfile))
751 write (iout,'(a,5x,a)') 'HOMOL: Opening PDB file',
752 & pdbfile(:ilen(pdbfile))
753 open(ipdbin,file=pdbfile,status='old',err=33)
755 33 write (iout,'(a,5x,a)') 'Error opening PDB file',
756 & pdbfile(:ilen(pdbfile))
759 c print *,'Begin reading pdb data'
761 c Files containing res sim or local scores (former containing sigmas)
764 write(kic2,'(bz,i2.2)') k
766 tpl_k_rescore="template"//kic2//".sco"
777 write (iout,'(i5,3f8.3,5x,3f8.3)') i,(crefjlee(j,i),j=1,3),
778 & (crefjlee(j,i+nres),j=1,3)
781 write (iout,*) "read_constr_homology: after reading pdb file"
785 c Distance restraints
788 C Copy the coordinates from reference coordinates (?)
792 c write (iout,*) "c(",j,i,") =",c(j,i)
796 c From read_dist_constr (commented out 25/11/2014 <-> res sim)
798 c write(iout,*) "tpl_k_rescore - ",tpl_k_rescore
799 open (ientin,file=tpl_k_rescore,status='old')
800 if (nnt.gt.1) rescore(k,1)=0.0d0
801 do irec=nnt,nct ! loop for reading res sim
803 read (ientin,*,end=1401) i_tmp,rescore2_tmp,rescore_tmp,
806 idomain(k,i_tmp)=idomain_tmp
807 rescore(k,i_tmp)=rescore_tmp
808 rescore2(k,i_tmp)=rescore2_tmp
809 write(iout,'(a7,i5,2f10.5,i5)') "rescore",
810 & i_tmp,rescore2_tmp,rescore_tmp,
814 read (ientin,*,end=1401) rescore_tmp
816 c rescore(k,irec)=rescore_tmp+1.0d0 ! to avoid 0 values
817 rescore(k,irec)=0.5d0*(rescore_tmp+0.5d0) ! alt transf to reduce scores
818 c write(iout,*) "rescore(",k,irec,") =",rescore(k,irec)
823 if (waga_dist.ne.0.0d0) then
831 distal=dsqrt(x12*x12+y12*y12+z12*z12)
832 c write (iout,*) k,i,j,distal,dist2_cut
834 if (idomain(k,i).eq.idomain(k,j).and.idomain(k,i).ne.0
835 & .and. distal.le.dist2_cut ) then
841 c write (iout,*) "k",k
842 c write (iout,*) "i",i," j",j," constr_homology",
850 sigma_odl(k,ii)=sigma_odl(k,ii)+rescore2(k,ik)
852 sigma_odl(k,ii)=sigma_odl(k,ii)/(j-i+1)
853 if (odl(k,ii).gt.dist_cut) sigma_odl(k,ii) =
854 & sigma_odl(k,ii)*dexp(0.5d0*(odl(k,ii)/dist_cut)**2-0.5d0)
856 if (odl(k,ii).le.dist_cut) then
857 sigma_odl(k,ii)=rescore(k,i)+rescore(k,j)
860 sigma_odl(k,ii)=(rescore(k,i)+rescore(k,j))*
861 & dexp(0.5d0*(odl(k,ii)/dist_cut)**2)
863 sigma_odl(k,ii)=(rescore(k,i)+rescore(k,j))*
864 & dexp(0.5d0*(odl(k,ii)/dist_cut)**2-0.5d0)
868 sigma_odl(k,ii)=1.0d0/(sigma_odl(k,ii)*sigma_odl(k,ii))
878 c Theta, dihedral and SC retraints
880 if (waga_angle.gt.0.0d0) then
881 c open (ientin,file=tpl_k_sigma_dih,status='old')
882 c do irec=1,maxres-3 ! loop for reading sigma_dih
883 c read (ientin,*,end=1402) i,j,ki,l,sigma_dih(k,i+nnt-1) ! j,ki,l what for?
884 c if (i+nnt-1.gt.lim_dih) lim_dih=i+nnt-1 ! right?
885 c sigma_dih(k,i+nnt-1)=sigma_dih(k,i+nnt-1)* ! not inverse because of use of res. similarity
886 c & sigma_dih(k,i+nnt-1)
891 if (idomain(k,i).eq.0) then
895 dih(k,i)=phiref(i) ! right?
896 c read (ientin,*) sigma_dih(k,i) ! original variant
897 c write (iout,*) "dih(",k,i,") =",dih(k,i)
898 c write(iout,*) "rescore(",k,i,") =",rescore(k,i),
899 c & "rescore(",k,i-1,") =",rescore(k,i-1),
900 c & "rescore(",k,i-2,") =",rescore(k,i-2),
901 c & "rescore(",k,i-3,") =",rescore(k,i-3)
903 sigma_dih(k,i)=(rescore(k,i)+rescore(k,i-1)+
904 & rescore(k,i-2)+rescore(k,i-3))/4.0
905 c if (read2sigma) sigma_dih(k,i)=sigma_dih(k,i)/4.0
906 c write (iout,*) "Raw sigmas for dihedral angle restraints"
907 c write (iout,'(i5,10(2f8.2,4x))') i,sigma_dih(k,i)
908 c sigma_dih(k,i)=hmscore(k)*rescore(k,i)*rescore(k,i-1)*
909 c rescore(k,i-2)*rescore(k,i-3) ! right expression ?
910 c Instead of res sim other local measure of b/b str reliability possible
911 if (sigma_dih(k,i).ne.0)
912 & sigma_dih(k,i)=1.0d0/(sigma_dih(k,i)*sigma_dih(k,i))
913 c sigma_dih(k,i)=sigma_dih(k,i)*sigma_dih(k,i)
918 if (waga_theta.gt.0.0d0) then
919 c open (ientin,file=tpl_k_sigma_theta,status='old')
920 c do irec=1,maxres-2 ! loop for reading sigma_theta, right bounds?
921 c read (ientin,*,end=1403) i,j,ki,sigma_theta(k,i+nnt-1) ! j,ki what for?
922 c sigma_theta(k,i+nnt-1)=sigma_theta(k,i+nnt-1)* ! not inverse because of use of res. similarity
923 c & sigma_theta(k,i+nnt-1)
928 do i = nnt+2,nct ! right? without parallel.
929 c do i = i=1,nres ! alternative for bounds acc to readpdb?
930 c do i=ithet_start,ithet_end ! with FG parallel.
931 if (idomain(k,i).eq.0) then
935 thetatpl(k,i)=thetaref(i)
936 c write (iout,*) "thetatpl(",k,i,") =",thetatpl(k,i)
937 c write(iout,*) "rescore(",k,i,") =",rescore(k,i),
938 c & "rescore(",k,i-1,") =",rescore(k,i-1),
939 c & "rescore(",k,i-2,") =",rescore(k,i-2)
940 c read (ientin,*) sigma_theta(k,i) ! 1st variant
941 sigma_theta(k,i)=(rescore(k,i)+rescore(k,i-1)+
942 & rescore(k,i-2))/3.0
943 c if (read2sigma) sigma_theta(k,i)=sigma_theta(k,i)/3.0
944 if (sigma_theta(k,i).ne.0)
945 & sigma_theta(k,i)=1.0d0/(sigma_theta(k,i)*sigma_theta(k,i))
947 c sigma_theta(k,i)=hmscore(k)*rescore(k,i)*rescore(k,i-1)*
948 c rescore(k,i-2) ! right expression ?
949 c sigma_theta(k,i)=sigma_theta(k,i)*sigma_theta(k,i)
953 if (waga_d.gt.0.0d0) then
954 c open (ientin,file=tpl_k_sigma_d,status='old')
955 c do irec=1,maxres-1 ! loop for reading sigma_theta, right bounds?
956 c read (ientin,*,end=1404) i,j,sigma_d(k,i+nnt-1) ! j,ki what for?
957 c sigma_d(k,i+nnt-1)=sigma_d(k,i+nnt-1)* ! not inverse because of use of res. similarity
958 c & sigma_d(k,i+nnt-1)
962 do i = nnt,nct ! right? without parallel.
963 c do i=2,nres-1 ! alternative for bounds acc to readpdb?
964 c do i=loc_start,loc_end ! with FG parallel.
965 if (itype(i).eq.10) cycle
966 if (idomain(k,i).eq.0 ) then
973 c write (iout,*) "xxtpl(",k,i,") =",xxtpl(k,i)
974 c write (iout,*) "yytpl(",k,i,") =",yytpl(k,i)
975 c write (iout,*) "zztpl(",k,i,") =",zztpl(k,i)
976 c write(iout,*) "rescore(",k,i,") =",rescore(k,i)
977 sigma_d(k,i)=rescore(k,i) ! right expression ?
978 if (sigma_d(k,i).ne.0)
979 & sigma_d(k,i)=1.0d0/(sigma_d(k,i)*sigma_d(k,i))
981 c sigma_d(k,i)=hmscore(k)*rescore(k,i) ! right expression ?
982 c sigma_d(k,i)=sigma_d(k,i)*sigma_d(k,i)
983 c read (ientin,*) sigma_d(k,i) ! 1st variant
988 c remove distance restraints not used in any model from the list
989 c shift data in all arrays
991 if (waga_dist.ne.0.0d0) then
997 if (ii_in_use(ii).eq.0.and.liiflag) then
1001 if (ii_in_use(ii).ne.0.and..not.liiflag.or.
1002 & .not.liiflag.and.ii.eq.lim_odl) then
1003 if (ii.eq.lim_odl) then
1004 iishift=ii-iistart+1
1009 do ki=iistart,lim_odl-iishift
1010 ires_homo(ki)=ires_homo(ki+iishift)
1011 jres_homo(ki)=jres_homo(ki+iishift)
1012 ii_in_use(ki)=ii_in_use(ki+iishift)
1013 do k=1,constr_homology
1014 odl(k,ki)=odl(k,ki+iishift)
1015 sigma_odl(k,ki)=sigma_odl(k,ki+iishift)
1016 l_homo(k,ki)=l_homo(k,ki+iishift)
1020 lim_odl=lim_odl-iishift
1026 endif ! .not. klapaucjusz
1028 if (constr_homology.gt.0) call homology_partition
1029 if (constr_homology.gt.0) call init_int_table
1030 cd write (iout,*) "homology_partition: lim_theta= ",lim_theta,
1031 cd & "lim_xx=",lim_xx
1032 c write (iout,*) "ithet_start =",ithet_start,"ithet_end =",ithet_end
1033 c write (iout,*) "loc_start =",loc_start,"loc_end =",loc_end
1037 if (.not.lprn) return
1038 cd write(iout,*) "waga_theta",waga_theta,"waga_d",waga_d
1039 if(me.eq.king .or. .not. out1file .and. fg_rank.eq.0) then
1040 write (iout,*) "Distance restraints from templates"
1042 write(iout,'(3i5,100(2f8.2,1x,l1,4x))')
1043 & ii,ires_homo(ii),jres_homo(ii),
1044 & (odl(ki,ii),1.0d0/dsqrt(sigma_odl(ki,ii)),l_homo(ki,ii),
1045 & ki=1,constr_homology)
1047 write (iout,*) "Dihedral angle restraints from templates"
1049 write (iout,'(i5,a4,100(2f8.2,4x))') i,restyp(itype(i)),
1050 & (rad2deg*dih(ki,i),
1051 & rad2deg/dsqrt(sigma_dih(ki,i)),ki=1,constr_homology)
1053 write (iout,*) "Virtual-bond angle restraints from templates"
1055 write (iout,'(i5,a4,100(2f8.2,4x))') i,restyp(itype(i)),
1056 & (rad2deg*thetatpl(ki,i),
1057 & rad2deg/dsqrt(sigma_theta(ki,i)),ki=1,constr_homology)
1059 write (iout,*) "SC restraints from templates"
1061 write(iout,'(i5,100(4f8.2,4x))') i,
1062 & (xxtpl(ki,i),yytpl(ki,i),zztpl(ki,i),
1063 & 1.0d0/dsqrt(sigma_d(ki,i)),ki=1,constr_homology)
1066 c -----------------------------------------------------------------
1069 c----------------------------------------------------------------------
1070 subroutine read_klapaucjusz
1072 include 'DIMENSIONS'
1073 include 'DIMENSIONS.ZSCOPT'
1074 include 'DIMENSIONS.FREE'
1078 include 'COMMON.SETUP'
1079 include 'COMMON.CONTROL'
1080 include 'COMMON.CHAIN'
1081 include 'COMMON.IOUNITS'
1082 include 'COMMON.GEO'
1083 include 'COMMON.INTERACT'
1084 include 'COMMON.NAMES'
1085 include 'COMMON.HOMRESTR'
1086 character*256 fragfile
1087 integer ninclust(maxclust),inclust(max_template,maxclust),
1088 & nresclust(maxclust),iresclust(maxres,maxclust)
1091 character*24 model_ki_dist, model_ki_angle
1092 character*500 controlcard
1093 integer ki, i, j, k, l, ii_in_use(maxdim),i_tmp,idomain_tmp
1094 integer idomain(max_template,maxres)
1095 logical lprn /.true./
1098 logical unres_pdb,liiflag
1101 double precision rescore_tmp,x12,y12,z12,rescore2_tmp
1102 double precision, dimension (max_template,maxres) :: rescore
1103 double precision, dimension (max_template,maxres) :: rescore2
1104 character*24 tpl_k_rescore
1107 c For new homol impl
1109 include 'COMMON.VAR'
1111 double precision chomo(3,maxres2+2,max_template)
1112 call getenv("FRAGFILE",fragfile)
1113 open(ientin,file=fragfile,status="old",err=10)
1114 read(ientin,*) constr_homology,nclust
1120 do k=1,constr_homology
1121 read(ientin,'(a)') pdbfile
1122 write (iout,'(a,5x,a)') 'KLAPAUCJUSZ: Opening PDB file',
1123 & pdbfile(:ilen(pdbfile))
1124 open(ipdbin,file=pdbfile,status='old',err=33)
1126 33 write (iout,'(a,5x,a)') 'Error opening PDB file',
1127 & pdbfile(:ilen(pdbfile))
1144 read(ientin,*) ninclust(i),nresclust(i)
1145 read(ientin,*) (inclust(k,i),k=1,ninclust(i))
1146 read(ientin,*) (iresclust(k,i),k=1,nresclust(i))
1149 c Loop over clusters
1152 do ll = 1,ninclust(l)
1160 idomain(k,iresclust(i,l)+1) = 1
1162 idomain(k,iresclust(i,l)) = 1
1166 c Distance restraints
1169 C Copy the coordinates from reference coordinates (?)
1173 c write (iout,*) "c(",j,i,") =",c(j,i)
1176 call int_from_cart(.true.,.false.)
1177 call sc_loc_geom(.false.)
1179 thetaref(i)=theta(i)
1182 if (waga_dist.ne.0.0d0) then
1190 distal=dsqrt(x12*x12+y12*y12+z12*z12)
1191 c write (iout,*) k,i,j,distal,dist2_cut
1193 if (idomain(k,i).eq.idomain(k,j).and.idomain(k,i).ne.0
1194 & .and. distal.le.dist2_cut ) then
1200 c write (iout,*) "k",k
1201 c write (iout,*) "i",i," j",j," constr_homology",
1206 if (read2sigma) then
1209 sigma_odl(k,ii)=sigma_odl(k,ii)+rescore2(k,ik)
1211 sigma_odl(k,ii)=sigma_odl(k,ii)/(j-i+1)
1212 if (odl(k,ii).gt.dist_cut) sigma_odl(k,ii) =
1213 & sigma_odl(k,ii)*dexp(0.5d0*(odl(k,ii)/dist_cut)**2-0.5d0)
1215 if (odl(k,ii).le.dist_cut) then
1216 sigma_odl(k,ii)=rescore(k,i)+rescore(k,j)
1219 sigma_odl(k,ii)=(rescore(k,i)+rescore(k,j))*
1220 & dexp(0.5d0*(odl(k,ii)/dist_cut)**2)
1222 sigma_odl(k,ii)=(rescore(k,i)+rescore(k,j))*
1223 & dexp(0.5d0*(odl(k,ii)/dist_cut)**2-0.5d0)
1227 sigma_odl(k,ii)=1.0d0/(sigma_odl(k,ii)*sigma_odl(k,ii))
1230 c l_homo(k,ii)=.false.
1237 c Theta, dihedral and SC retraints
1239 if (waga_angle.gt.0.0d0) then
1241 if (idomain(k,i).eq.0) then
1242 c sigma_dih(k,i)=0.0
1246 sigma_dih(k,i)=(rescore(k,i)+rescore(k,i-1)+
1247 & rescore(k,i-2)+rescore(k,i-3))/4.0
1248 c write (iout,*) "k",k," l",l," i",i," rescore",rescore(k,i),
1249 c & " sigma_dihed",sigma_dih(k,i)
1250 if (sigma_dih(k,i).ne.0)
1251 & sigma_dih(k,i)=1.0d0/(sigma_dih(k,i)*sigma_dih(k,i))
1256 if (waga_theta.gt.0.0d0) then
1258 if (idomain(k,i).eq.0) then
1259 c sigma_theta(k,i)=0.0
1262 thetatpl(k,i)=thetaref(i)
1263 sigma_theta(k,i)=(rescore(k,i)+rescore(k,i-1)+
1264 & rescore(k,i-2))/3.0
1265 if (sigma_theta(k,i).ne.0)
1266 & sigma_theta(k,i)=1.0d0/(sigma_theta(k,i)*sigma_theta(k,i))
1270 if (waga_d.gt.0.0d0) then
1272 if (itype(i).eq.10) cycle
1273 if (idomain(k,i).eq.0 ) then
1280 sigma_d(k,i)=rescore(k,i)
1281 if (sigma_d(k,i).ne.0)
1282 & sigma_d(k,i)=1.0d0/(sigma_d(k,i)*sigma_d(k,i))
1283 if (i-nnt+1.gt.lim_xx) lim_xx=i-nnt+1
1289 c remove distance restraints not used in any model from the list
1290 c shift data in all arrays
1292 if (waga_dist.ne.0.0d0) then
1298 if (ii_in_use(ii).eq.0.and.liiflag) then
1302 if (ii_in_use(ii).ne.0.and..not.liiflag.or.
1303 & .not.liiflag.and.ii.eq.lim_odl) then
1304 if (ii.eq.lim_odl) then
1305 iishift=ii-iistart+1
1310 do ki=iistart,lim_odl-iishift
1311 ires_homo(ki)=ires_homo(ki+iishift)
1312 jres_homo(ki)=jres_homo(ki+iishift)
1313 ii_in_use(ki)=ii_in_use(ki+iishift)
1314 do k=1,constr_homology
1315 odl(k,ki)=odl(k,ki+iishift)
1316 sigma_odl(k,ki)=sigma_odl(k,ki+iishift)
1317 l_homo(k,ki)=l_homo(k,ki+iishift)
1321 lim_odl=lim_odl-iishift
1328 10 stop "Error infragment file"
1330 c----------------------------------------------------------------------