2 !-----------------------------------------------------------------------------
5 use geometry_data, only:nres
7 use geometry, only:dist
8 use regularize_, only:fitsq
16 ! include "COMMON.MPI"
19 !-----------------------------------------------------------------------------
22 !-----------------------------------------------------------------------------
25 !-----------------------------------------------------------------------------
27 !-----------------------------------------------------------------------------
28 subroutine conf_compar(jcon,lprn,print_class)
29 ! implicit real*8 (a-h,o-z)
30 use energy_data, only:icont,ncont,nnt,nct,maxcont!,&
31 ! nsccont_frag_ref,isccont_frag_ref
35 ! include 'DIMENSIONS'
36 ! include 'DIMENSIONS.ZSCOPT'
37 ! include 'DIMENSIONS.COMPAR'
38 ! include 'DIMENSIONS.FREE'
39 ! include 'COMMON.CONTROL'
40 ! include 'COMMON.IOUNITS'
41 ! include 'COMMON.COMPAR'
42 ! include 'COMMON.CHAIN'
43 ! include 'COMMON.INTERACT'
44 ! include 'COMMON.VAR'
45 ! include 'COMMON.PEPTCONT'
46 ! include 'COMMON.CONTACTS1'
47 ! include 'COMMON.HEADER'
48 ! include 'COMMON.FREE'
49 ! include 'COMMON.ENERGIES'
51 ! include 'COMMON.MPI'
55 logical :: lprn,print_class
56 integer :: ncont_frag(mmaxfrag),&
57 icont_frag(2,maxcont,mmaxfrag),ncontsc,&
58 icontsc(1,maxcont),nsccont_frag(mmaxfrag),&
59 isccont_frag(2,maxcont,mmaxfrag)
60 integer :: isecstr(nres)
61 integer :: itemp(maxfrag)
62 character(len=4) :: liczba
63 real(kind=8) :: Epot,rms
64 integer :: jcon,i,j,ind,ncnat,nsec_match,ishift,ishif1,ishif2,&
65 nc_match,ncon_match,iclass_rms,ishifft_rms,ishiff,ishif
66 integer :: k,kk,iclass_con,iscor,ik,ishifft_con,idig,iex,im
67 ! print *,"Enter conf_compar",jcon
68 call angnorm12(rmsang)
69 ! Level 1: check secondary and supersecondary structure
70 call elecont(lprn,ncont,icont,nnt,nct)
72 write (iout,*) "elecont finished"
75 call secondary2(lprn,.false.,ncont,icont,isecstr)
77 write (iout,*) "secondary2 finished"
80 call contact(lprn,ncontsc,icontsc,nnt,nct)
82 write(iout,*) "Assigning electrostatic contacts"
85 call contacts_between_fragments(lprn,3,ncont,icont,ncont_frag,&
88 write(iout,*) "Assigning sidechain contacts"
91 call contacts_between_fragments(lprn,3,ncontsc,icontsc,&
92 nsccont_frag,isccont_frag)
94 write(iout,*) "--> After contacts_between_fragments"
98 do j=1,isnfrag(nlevel+1)
105 write (iout,'(80(1h=))')
106 write (iout,*) "Level",1," fragment",j
107 write (iout,'(80(1h=))')
110 rmsfrag(j,1)=rmscalc(0,1,j,jcon,lprn)
111 ! Compare electrostatic contacts in the current conf with that in the native
113 if (lprn) write (iout,*) &
114 "Comparing electrostatic contact map and local structure"
116 ncnat=ncont_frag_ref(ind)
117 ! write (iout,*) "before match_contact:",nc_fragm(j,1),
120 call match_secondary(j,isecstr,nsec_match,lprn)
121 if (lprn) write (iout,*) "Fragment",j," nsec_match",&
122 nsec_match," length",len_frag(j,1)," min_len",&
123 frac_sec*len_frag(j,1)
124 if (nsec_match.lt.frac_sec*len_frag(j,1)) then
126 if (lprn) write (iout,*) "Fragment",j,&
127 " has incorrect secondary structure"
130 if (lprn) write (iout,*) "Fragment",j,&
131 " has correct secondary structure"
133 if (ielecont(j,1).gt.0) then
134 call match_contact(ishif1,ishif2,nc_match,ncon_match,&
135 ncont_frag_ref(ind),icont_frag_ref(1,1,ind),&
136 ncont_frag(ind),icont_frag(1,1,ind),&
137 j,n_shift(1,j,1),n_shift(2,j,1),nc_fragm(j,1),&
138 nc_req_setf(j,1),istruct(j),.true.,lprn)
139 else if (isccont(j,1).gt.0) then
140 call match_contact(ishif1,ishif2,nc_match,ncon_match,&
141 nsccont_frag_ref(ind),isccont_frag_ref(1,1,ind),&
142 nsccont_frag(ind),isccont_frag(1,1,ind),&
143 j,n_shift(1,j,1),n_shift(2,j,1),nc_fragm(j,1),&
144 nc_req_setf(j,1),istruct(j),.true.,lprn)
145 else if (iloc(j).gt.0) then
146 ! write (iout,*) "n_shif",n_shift(1,j,1),n_shift(2,j,1)
147 call match_contact(ishif1,ishif2,nc_match,ncon_match,&
148 0,icont_frag_ref(1,1,ind),&
149 ncont_frag(ind),icont_frag(1,1,ind),&
150 j,n_shift(1,j,1),n_shift(2,j,1),nc_fragm(j,1),&
151 0,istruct(j),.true.,lprn)
152 ! write (iout,*) "n_shif",n_shift(1,j,1),n_shift(2,j,1)
157 if (lprn) write (iout,*) "ishif1",ishif1," ishif2",ishif2
159 qfrag(j,1)=qwolynes(1,j)
160 if (iabs(ishif2).gt.iabs(ishif1)) ishif=ishif2
161 if (lprn) write (iout,*) "ishift",ishif," nc_match",nc_match
162 ! write (iout,*) "j",j," ishif",ishif," rms",rmsfrag(j,1)
163 if (irms(j,1).gt.0) then
164 if (rmsfrag(j,1).le.rmscutfrag(1,j,1)) then
171 do while (rms.gt.rmscutfrag(1,j,1) .and. &
172 ishiff.lt.n_shift(1,j,1))
174 rms=rmscalc(-ishiff,1,j,jcon,lprn)
175 ! write(iout,*)"jcon,i,j,ishiff",jcon,i,j,-ishiff,
176 ! & " rms",rms," rmscut",rmscutfrag(1,j,1)
177 if (lprn) write (iout,*) "rms",rmsfrag(j,1)
178 if (rms.gt.rmscutfrag(1,j,1)) then
179 rms=rmscalc(ishiff,1,j,jcon,lprn)
180 ! write (iout,*) "jcon,1,j,ishiff",jcon,1,j,ishiff,
183 if (lprn) write (iout,*) "rms",rmsfrag(j,1)
185 ! write (iout,*) "After loop: rms",rms,
186 ! & " rmscut",rmscutfrag(1,j,1)
187 ! write (iout,*) "iclass_rms",iclass_rms
188 if (rms.le.rmscutfrag(1,j,1)) then
193 ! write (iout,*) "iclass_rms",iclass_rms
195 ! write (iout,*) "ishif",ishif
196 if (iabs(ishifft_rms).gt.iabs(ishif)) ishif=ishifft_rms
200 ! write (iout,*) "ishif",ishif," iclass",iclass(j,1),
201 ! & " iclass_rms",iclass_rms
202 if (nc_match.gt.0 .and. iclass_rms.gt.0) then
204 iclass(j,1)=iclass(j,1)+6
206 iclass(j,1)=iclass(j,1)+2
209 ncont_nat(1,j,1)=nc_match
210 ncont_nat(2,j,1)=ncon_match
212 ! write (iout,*) "iclass",iclass(j,1)
214 ! Next levels: Check arrangements of elementary fragments.
217 if (i .eq. 2) ind = icant(ipiece(1,j,i),ipiece(2,j,i))
219 write (iout,'(80(1h=))')
220 write (iout,*) "Level",i," fragment",j
221 write (iout,'(80(1h=))')
223 ! If an elementary fragment doesn't exist, don't check higher hierarchy levels.
226 if (iclass(ik,1).eq.0) then
231 if (i.eq.2 .and. ielecont(j,i).gt.0) then
234 if (lprn) write (iout,*) &
235 "Comparing electrostatic contact map: fragments",&
236 ipiece(1,j,i),ipiece(2,j,i)," ind",ind
237 call match_contact(ishif1,ishif2,nc_match,ncon_match,&
238 ncont_frag_ref(ind),icont_frag_ref(1,1,ind),&
239 ncont_frag(ind),icont_frag(1,1,ind),&
240 j,n_shift(1,j,i),n_shift(2,j,i),nc_fragm(j,i),&
241 nc_req_setf(j,i),2,.false.,lprn)
243 if (iabs(ishif2).gt.iabs(ishif1)) ishif=ishif2
244 if (nc_match.gt.0) then
251 ncont_nat(1,j,i)=nc_match
252 ncont_nat(2,j,i)=ncon_match
254 else if (i.eq.2 .and. isccont(j,i).gt.0) then
257 if (lprn) write (iout,*) &
258 "Comparing sidechain contact map: fragments",&
259 ipiece(1,j,i),ipiece(2,j,i)," ind",ind
260 call match_contact(ishif1,ishif2,nc_match,ncon_match,&
261 nsccont_frag_ref(ind),isccont_frag_ref(1,1,ind),&
262 nsccont_frag(ind),isccont_frag(1,1,ind),&
263 j,n_shift(1,j,i),n_shift(2,j,i),nc_fragm(j,i),&
264 nc_req_setf(j,i),2,.false.,lprn)
266 if (iabs(ishif2).gt.iabs(ishif1)) ishif=ishif2
267 if (nc_match.gt.0) then
274 ncont_nat(1,j,i)=nc_match
275 ncont_nat(2,j,i)=ncon_match
277 else if (i.eq.2) then
281 if (i.eq.2) qfrag(j,2)=qwolynes(2,j)
282 if (lprn) write (iout,*) &
283 "Comparing rms: fragments",&
284 (ipiece(k,j,i),k=1,npiece(j,i))
285 rmsfrag(j,i)=rmscalc(0,i,j,jcon,lprn)
286 if (irms(j,i).gt.0) then
289 if (lprn) write (iout,*) "rms",rmsfrag(j,i)
290 ! write (iout,*) "i",i," j",j," rmsfrag",rmsfrag(j,i),
291 ! & " rmscutfrag",rmscutfrag(1,j,i)
292 if (rmsfrag(j,i).le.rmscutfrag(1,j,i)) then
298 do while (rms.gt.rmscutfrag(1,j,i) .and. &
299 ishif.lt.n_shift(1,j,i))
301 rms=rmscalc(-ishif,i,j,jcon,lprn)
302 ! print *,"jcon,i,j,ishif",jcon,i,j,-ishif," rms",rms
303 if (lprn) write (iout,*) "rms",rmsfrag(j,i)
304 if (rms.gt.rmscutfrag(1,j,i)) then
305 rms=rmscalc(ishif,i,j,jcon,lprn)
306 ! print *,"jcon,i,j,ishif",jcon,i,j,ishif," rms",rms
308 if (lprn) write (iout,*) "rms",rms
310 if (rms.le.rmscutfrag(1,j,i)) then
317 if (irms(j,i).eq.0 .and. ielecont(j,i).eq.0 .and. &
318 isccont(j,i).eq.0 ) then
319 write (iout,*) "Error: no measure of comparison specified:",&
324 write (iout,*) "iclass_con",iclass_con," iclass_rms",iclass_rms
326 iclass(j,i) = min0(iclass_con,iclass_rms)
327 if (iabs(ishifft_rms).gt.iabs(ishifft_con)) then
328 ishifft(j,i)=ishifft_rms
330 ishifft(j,i)=ishifft_con
332 else if (i.gt.2) then
333 iclass(j,i) = iclass_rms
334 ishifft(j,i)= ishifft_rms
341 ! Compute the structural class
343 IF (.NOT. BINARY) THEN
351 idig = 2*isnfrag(nlevel+1)-2*isnfrag(i)-kk*nfrag(i)-j
355 ! write (iout,*) "i",i," j",j," idig",idig," iex",iex,
356 ! & " iclass",iclass(j,i)," im",im
362 idig = 2*isnfrag(nlevel+1)-2*isnfrag(i)-j
364 if (iclass(j,i).gt.0) then
369 ! write (iout,*) "i",i," j",j," idig",idig," iex",iex,
370 ! & " iclass",iclass(j,i)," im",im
374 idig = 2*isnfrag(nlevel+1)-2*isnfrag(i)-nfrag(i)-j
376 if (iclass(j,i).gt.1) then
381 ! write (iout,*) "i",i," j",j," idig",idig," iex",iex,
382 ! & " iclass",iclass(j,i)," im",im
389 if (print_class) then
391 write(istat,'(i6,$)') jcon+indstart(me)-1
392 write (istat,'(f10.2,$)') (potE(jcon,k),k=1,nParmSet),&
395 write(istat,'(i6,$)') jcon
396 write (istat,'(f10.2,$)') (potE(jcon,k),k=1,nParmSet),&
399 write (istat,'(f8.3,2f6.3,$)') &
400 rms_nat,qnat,rmsang/(nres-3)
402 write(istat,'(1x,$,20(i3,$))') &
403 (ncont_nat(1,k,j),k=1,nfrag(j))
405 write(istat,'(1x,$,20(f5.1,f5.2$))') &
406 (rmsfrag(k,j),qfrag(k,j),k=1,nfrag(j))
408 write(istat,'(1x,$,20(f5.1$))') &
409 (rmsfrag(k,j),k=1,nfrag(j))
411 write(istat,'(1x,$,20(i1,$))') &
412 (iclass(k,j),k=1,nfrag(j))
415 write (istat,'(" ",$)')
417 write (istat,'(100(i1,$))')(iclass(k,j),&
419 if (j.lt.nlevel) write(iout,'(".",$)')
423 write (istat,'(i10)') iscore
427 END subroutine conf_compar
428 !-----------------------------------------------------------------------------
430 !-----------------------------------------------------------------------------
431 subroutine add_angpair(ici,icj,nang_pair,iang_pair)
433 ! implicit real*8 (a-h,o-z)
434 ! include 'DIMENSIONS'
435 ! include 'COMMON.IOUNITS'
436 ! include 'COMMON.CHAIN'
437 integer :: ici,icj,nang_pair,iang_pair(2,nres)
438 integer :: i,ian1,ian2
439 ! write (iout,*) "add_angpair: ici",ici," icj",icj,
440 ! & " nang_pair",nang_pair
442 if (ian1.lt.4 .or. ian1.gt.nres) return
444 ! write (iout,*) "ian1",ian1," ian2",ian2
445 if (ian2.lt.4 .or. ian2.gt.nres) return
447 if (ian1.eq.iang_pair(1,i) .and. ian2.eq.iang_pair(2,i)) return
449 nang_pair=nang_pair+1
450 iang_pair(1,nang_pair)=ian1
451 iang_pair(2,nang_pair)=ian2
453 end subroutine add_angpair
454 !-------------------------------------------------------------------------
455 subroutine angnorm(jfrag,ishif1,ishif2,diffang_max,angn,fract,lprn)
457 use geometry_data, only:nstart_sup,nend_sup,phi,theta,&
459 ! implicit real*8 (a-h,o-z)
460 ! include 'DIMENSIONS'
461 ! include 'DIMENSIONS.ZSCOPT'
462 ! include 'DIMENSIONS.COMPAR'
463 ! include 'COMMON.IOUNITS'
464 ! include 'COMMON.VAR'
465 ! include 'COMMON.COMPAR'
466 ! include 'COMMON.CHAIN'
467 ! include 'COMMON.GEO'
468 real(kind=8) :: pinorm,deltang
470 integer :: jfrag,ishif1,ishif2,nn,npart,nn4,nne
471 real(kind=8) :: diffang_max,angn,fract,ff
472 integer :: i,j,nbeg,nend,ll,longest
473 if (lprn) write (iout,'(80(1h*))')
477 npart = npiece(jfrag,1)
479 nne = min0(nend_sup,nres)
480 if (lprn) write (iout,*) "nn4",nn4," nne",nne
482 nbeg = ifrag(1,i,jfrag) + 3 - ishif1
483 if (nbeg.lt.nn4) nbeg=nn4
484 nend = ifrag(2,i,jfrag) + 1 - ishif2
485 if (nend.gt.nne) nend=nne
486 if (nend.ge.nbeg) then
487 nn = nn + nend - nbeg + 1
488 if (lprn) write (iout,*) "i=",i," nbeg",nbeg," nend",nend,&
489 " nn",nn," ishift1",ishif1," ishift2",ishif2
490 if (lprn) write (iout,*) "angles"
494 ! deltang = pinorm(phi(j)-phi_ref(j+ishif1))
495 deltang=spherang(phi_ref(j+ishif1),theta_ref(j-1+ishif1),&
496 theta_ref(j+ishif1),phi(j),theta(j-1),theta(j))
497 if (dabs(deltang).gt.diffang_max) then
498 if (ll.gt.longest) longest = ll
503 if (ll.gt.longest) longest = ll
504 if (lprn) write (iout,'(i5,3f10.5)')j,rad2deg*phi(j),&
505 rad2deg*phi_ref(j+ishif1),rad2deg*deltang
506 angn=angn+dabs(deltang)
509 ff = dfloat(longest)/dfloat(nend - nbeg + 4)
510 if (lprn) write (iout,*)"segment",i," longest fragment within",&
511 diffang_max*rad2deg,":",longest," fraction",ff
512 if (ff.lt.fract) fract = ff
520 if (lprn) write (iout,*) "nn",nn," norm",rad2deg*angn,&
523 end subroutine angnorm
524 !-------------------------------------------------------------------------
525 subroutine angnorm2(jfrag,ishif1,ishif2,ncont,icont,lprn,&
526 diffang_max,anorm,fract)
528 use geometry_data, only:nstart_sup,nend_sup,phi,theta,&
530 ! implicit real*8 (a-h,o-z)
531 ! include 'DIMENSIONS'
532 ! include 'DIMENSIONS.ZSCOPT'
533 ! include 'DIMENSIONS.COMPAR'
534 ! include 'COMMON.IOUNITS'
535 ! include 'COMMON.VAR'
536 ! include 'COMMON.COMPAR'
537 ! include 'COMMON.CHAIN'
538 ! include 'COMMON.GEO'
539 integer :: ncont,icont(2,ncont),longest
540 real(kind=8) :: anorm,diffang_max,fract
541 integer :: npiece_c,ifrag_c(2,maxpiece),ishift_c(maxpiece)
542 real(kind=8) :: pinorm
544 integer :: jfrag,ishif1,ishif2
545 integer :: nn,nn4,nne,npart,i,j,jstart,jend,ic1,ic2,idi,iic
546 integer :: nbeg,nend,ll
547 real(kind=8) :: angn,ishifc,deltang,ff
549 if (lprn) write (iout,'(80(1h*))')
551 ! Determine the segments for which angles will be compared
554 nne = min0(nend_sup,nres)
555 if (lprn) write (iout,*) "nn4",nn4," nne",nne
556 npart=npiece(jfrag,1)
559 ! write (iout,*) "i",i," ifrag",ifrag(1,i,jfrag),ifrag(2,i,jfrag)
560 if (icont(1,ncont).lt.ifrag(1,i,jfrag) .or. &
561 icont(1,1).gt.ifrag(2,i,jfrag)) goto 11
563 do while (jstart.lt.ncont .and. &
564 icont(1,jstart).lt.ifrag(1,i,jfrag))
565 ! write (iout,*) "jstart",jstart," icont",icont(1,jstart),
566 ! & " ifrag",ifrag(1,i,jfrag)
569 ! write (iout,*) "jstart",jstart," icont",icont(1,jstart),
570 ! & " ifrag",ifrag(1,i,jfrag)
571 if (icont(1,jstart).lt.ifrag(1,i,jfrag)) goto 11
574 ifrag_c(1,npiece_c)=icont(1,jstart)
576 do while (jend.gt.1 .and. icont(1,jend).gt.ifrag(2,i,jfrag))
577 ! write (iout,*) "jend",jend," icont",icont(1,jend),
578 ! & " ifrag",ifrag(2,i,jfrag)
581 ! write (iout,*) "jend",jend," icont",icont(1,jend),
582 ! & " ifrag",ifrag(2,i,jfrag)
584 ifrag_c(2,npiece_c)=icont(1,jend)+1
585 ishift_c(npiece_c)=ishif1
586 ! write (iout,*) "1: i",i," jstart:",jstart," jend",jend,
587 ! & " ic1",ic1," ic2",ic2,
588 ! & " ifrag",ifrag(1,i,jfrag),ifrag(2,i,jfrag)
590 if (ncont.eq.1 .or. icont(2,ncont).gt.icont(2,1)) then
595 ! write (iout,*) "idi",idi
597 if (icont(2,1).gt.ifrag(2,i,jfrag) .or. &
598 icont(2,ncont).lt.ifrag(1,i,jfrag)) goto 12
600 do while (jstart.lt.ncont .and. &
601 icont(2,jstart).lt.ifrag(1,i,jfrag))
602 ! write (iout,*) "jstart",jstart," icont",icont(2,jstart),
603 ! & " ifrag",ifrag(1,i,jfrag)
606 ! write (iout,*) "jstart",jstart," icont",icont(2,jstart),
607 ! & " ifrag",ifrag(1,i,jfrag)
608 if (icont(2,jstart).lt.ifrag(1,i,jfrag)) goto 12
611 ifrag_c(2,npiece_c)=icont(2,jstart)+1
613 do while (jend.gt.1 .and. icont(2,jend).gt.ifrag(2,i,jfrag))
614 ! write (iout,*) "jend",jend," icont",icont(2,jend),
615 ! & " ifrag",ifrag(2,i,jfrag)
618 ! write (iout,*) "jend",jend," icont",icont(2,jend),
619 ! & " ifrag",ifrag(2,i,jfrag)
620 else if (idi.eq.-1) then
621 if (icont(2,ncont).gt.ifrag(2,i,jfrag) .or. &
622 icont(2,1).lt.ifrag(1,i,jfrag)) goto 12
624 do while (jstart.gt.ncont .and. &
625 icont(2,jstart).lt.ifrag(1,i,jfrag))
626 ! write (iout,*) "jstart",jstart," icont",icont(2,jstart),
627 ! & " ifrag",ifrag(1,i,jfrag)
630 ! write (iout,*) "jstart",jstart," icont",icont(2,jstart),
631 ! & " ifrag",ifrag(1,i,jfrag)
632 if (icont(2,jstart).lt.ifrag(1,i,jfrag)) goto 12
635 ifrag_c(2,npiece_c)=icont(2,jstart)+1
637 do while (jend.lt.ncont .and. &
638 icont(2,jend).gt.ifrag(2,i,jfrag))
639 ! write (iout,*) "jend",jend," icont",icont(2,jend),
640 ! & " ifrag",ifrag(2,i,jfrag)
643 ! write (iout,*) "jend",jend," icont",icont(2,jend),
644 ! & " ifrag",ifrag(2,i,jfrag)
652 ! write (iout,*) "2: i",i," ic1",ic1," ic2",ic2,
653 ! & " jstart:",jstart," jend",jend,
654 ! & " ifrag",ifrag(1,i,jfrag),ifrag(2,i,jfrag)
655 ifrag_c(1,npiece_c)=ic1
656 ifrag_c(2,npiece_c)=ic2+1
657 ishift_c(npiece_c)=ishif2
661 write (iout,*) "Before merge: npiece_c",npiece_c
663 write (iout,*) ifrag_c(1,i),ifrag_c(2,i),ishift_c(i)
667 ! Merge overlapping segments (e.g., avoid splitting helices)
670 do while (i .lt. npiece_c)
671 if (ishift_c(i).eq.ishift_c(i+1) .and. &
672 ifrag_c(2,i).gt.ifrag_c(1,i+1)) then
673 ifrag_c(2,i)=ifrag_c(2,i+1)
675 ishift_c(j)=ishift_c(j+1)
676 ifrag_c(1,j)=ifrag_c(1,j+1)
677 ifrag_c(2,j)=ifrag_c(2,j+1)
685 write (iout,*) "After merge: npiece_c",npiece_c
687 write (iout,*) ifrag_c(1,i),ifrag_c(2,i),ishift_c(i)
700 nbeg = ifrag_c(1,i) + 3 - ishifc
701 if (nbeg.lt.nn4) nbeg=nn4
702 nend = ifrag_c(2,i) - ishifc + 1
703 if (nend.gt.nne) nend=nne
704 if (nend.ge.nbeg) then
705 nn = nn + nend - nbeg + 1
706 if (lprn) write (iout,*) "i=",i," nbeg",nbeg," nend",nend,&
707 " nn",nn," ishifc",ishifc
708 if (lprn) write (iout,*) "angles"
712 ! deltang = pinorm(phi(j)-phi_ref(j+ishifc))
713 deltang=spherang(phi_ref(j+ishifc),theta_ref(j-1+ishifc),&
714 theta_ref(j+ishifc),phi(j),theta(j-1),theta(j))
715 if (dabs(deltang).gt.diffang_max) then
716 if (ll.gt.longest) longest = ll
721 if (ll.gt.longest) longest = ll
722 if (lprn) write (iout,'(i5,3f10.5)')j,rad2deg*phi(j),&
723 rad2deg*phi_ref(j+ishifc),rad2deg*deltang
724 angn=angn+dabs(deltang)
727 ff = dfloat(longest)/dfloat(nend - nbeg + 4)
728 if (lprn) write (iout,*)"segment",i," longest fragment within",&
729 diffang_max*rad2deg,":",longest," fraction",ff
730 if (ff.lt.fract) fract = ff
733 if (nn.gt.0) anorm = angn/nn
734 if (lprn) write (iout,*) "nn",nn," norm",anorm," fract:",fract
736 end subroutine angnorm2
737 !-------------------------------------------------------------------------
738 real(kind=8) function angnorm1(nang_pair,iang_pair,lprn)
740 use geometry_data, only:phi,theta,rad2deg
741 ! implicit real*8 (a-h,o-z)
742 ! include 'DIMENSIONS'
743 ! include 'DIMENSIONS.ZSCOPT'
744 ! include 'DIMENSIONS.COMPAR'
745 ! include 'COMMON.IOUNITS'
746 ! include 'COMMON.VAR'
747 ! include 'COMMON.COMPAR'
748 ! include 'COMMON.CHAIN'
749 ! include 'COMMON.GEO'
751 integer :: nang_pair,iang_pair(2,nres)
752 real(kind=8) :: pinorm
754 real(kind=8) :: angn,deltang
756 if (lprn) write (iout,'(80(1h*))')
757 if (lprn) write (iout,*) "nang_pair",nang_pair
758 if (lprn) write (iout,*) "angles"
762 ! deltang = pinorm(phi(ia1)-phi_ref(ia2))
763 deltang=spherang(phi_ref(ia2),theta_ref(ia2-1),&
764 theta_ref(ia2),phi(ia2),theta(ia2-1),theta(ia2))
765 if (lprn) write (iout,'(3i5,3f10.5)')j,ia1,ia2,rad2deg*phi(ia1),&
766 rad2deg*phi_ref(ia2),rad2deg*deltang
767 angn=angn+dabs(deltang)
770 write (iout,*)"nang_pair",nang_pair," angn",rad2deg*angn/nang_pair
771 angnorm1 = angn/nang_pair
773 end function angnorm1
774 !------------------------------------------------------------------------------
775 subroutine angnorm12(diff)
777 use geometry_data, only:phi,theta,nstart_sup,nend_sup
778 ! implicit real*8 (a-h,o-z)
779 ! include 'DIMENSIONS'
780 ! include 'DIMENSIONS.ZSCOPT'
781 ! include 'DIMENSIONS.COMPAR'
782 ! include 'COMMON.IOUNITS'
783 ! include 'COMMON.VAR'
784 ! include 'COMMON.COMPAR'
785 ! include 'COMMON.CHAIN'
786 ! include 'COMMON.GEO'
787 real(kind=8) :: pinorm,diff
791 nne = min0(nend_sup,nres)
793 ! diff = diff+rad2deg*dabs(pinorm(theta(j)-theta_ref(j)))
796 ! diff = diff+rad2deg*dabs(pinorm(phi(j)-phi_ref(j)))
797 diff=diff+spherang(phi_ref(j),theta_ref(j-1),&
798 theta_ref(j),phi(j),theta(j-1),theta(j))
801 end subroutine angnorm12
802 !--------------------------------------------------------------------------------
803 real(kind=8) function spherang(gam1,theta11,theta12,&
804 gam2,theta21,theta22)
806 use geometry, only:arcos
807 real(kind=8) :: gam1,theta11,theta12,gam2,theta21,theta22,&
808 x1,x2,xmed,f1,f2,fmed
809 real(kind=8) :: tolx=1.0d-4, tolf=1.0d-4
810 real(kind=8) :: sumcos
811 !el real(kind=8) :: pinorm,sumangp !arcos,
812 integer :: it,maxit=100
813 ! Calculate the difference of the angles of two superposed 4-redidue fragments
821 ! The fragment O'-C-C-P' is rotated by angle fi about the C-C axis
822 ! to achieve the minimum difference between the O'-C-O and P-C-P angles;
823 ! the sum of these angles is the difference returned by the function.
826 ! If thetas match, take the difference of gamma and exit.
827 if (dabs(theta11-theta12).lt.tolx &
828 .and. dabs(theta21-theta22).lt.tolx) then
829 spherang=dabs(pinorm(gam2-gam1))
832 ! If the gammas are the same, take the difference of thetas and exit.
834 x2=0.5d0*pinorm(gam2-gam1)
835 if (dabs(x2) .lt. tolx) then
836 spherang=dabs(theta11-theta21)+dabs(theta12-theta22)
838 else if (x2.lt.0.0d0) then
842 ! Else apply regula falsi method to compute optimum overlap of the terminal Calphas
843 f1=sumangp(gam1,theta11,theta12,gam2,theta21,theta22,x1)
844 f2=sumangp(gam1,theta11,theta12,gam2,theta21,theta22,x2)
846 xmed=x1-f1*(x2-x1)/(f2-f1)
847 fmed=sumangp(gam1,theta11,theta12,gam2,theta21,theta22,xmed)
848 ! write (*,*) 'it',it,' xmed ',xmed,' fmed ',fmed
849 if ( (dabs(xmed-x1).lt.tolx .or. dabs(x2-xmed).lt.tolx) &
850 .and. dabs(fmed).lt.tolf ) then
854 else if ( fmed*f1.lt.0.0d0 ) then
863 spherang=arcos(dcos(theta11)*dcos(theta12) &
864 +dsin(theta11)*dsin(theta12)*dcos(x1))+ &
865 arcos(dcos(theta21)*dcos(theta22)+ &
866 dsin(theta21)*dsin(theta22)*dcos(gam2-gam1+x1))
868 end function spherang
869 !--------------------------------------------------------------------------------
870 real(kind=8) function sumangp(gam1,theta11,theta12,gam2,&
873 real(kind=8) :: gam1,theta11,theta12,gam2,theta21,theta22,fi,&
874 cost11,cost12,cost21,cost22,sint11,sint12,sint21,sint22,cosd1,&
876 ! derivarive of the sum of the difference of the angles of a 4-residue fragment.
877 ! real(kind=8) :: arcos
886 cosd1=cost11*cost12+sint11*sint12*dcos(fi)
887 cosd2=cost21*cost22+sint21*sint22*dcos(gam2-gam1+fi)
888 sumangp=sint11*sint12*dsin(fi)/dsqrt(1.0d0-cosd1*cosd1) &
889 +sint21*sint22*dsin(gam2-gam1+fi)/dsqrt(1.0d0-cosd2*cosd2)
892 !-----------------------------------------------------------------------------
894 !-----------------------------------------------------------------------------
895 subroutine contact(lprint,ncont,icont,ist,ien)
898 use geometry_data, only:c,dc,dc_norm
899 use energy_data, only:itype,maxcont
901 ! include 'DIMENSIONS'
902 ! include 'DIMENSIONS.ZSCOPT'
903 ! include 'COMMON.CONTROL'
904 ! include 'COMMON.IOUNITS'
905 ! include 'COMMON.CHAIN'
906 ! include 'COMMON.INTERACT'
907 ! include 'COMMON.FFIELD'
908 ! include 'COMMON.NAMES'
909 ! include 'COMMON.CALC'
910 ! include 'COMMON.CONTPAR'
911 ! include 'COMMON.LOCAL'
912 integer :: ist,ien,kkk,iti,itj,itypi,itypj,i1,i2,it1,it2
913 real(kind=8) :: csc !el,dist
914 real(kind=8),dimension(maxcont) :: cscore,omt1,omt2,omt12,&
917 integer,dimension(2,maxcont) :: icont
918 real(kind=8) :: u,v,a(3),b(3),dla,dlb
929 write (iout,110) restyp(itype(i)),i,c(1,i),c(2,i),&
930 c(3,i),dc(1,nres+i),dc(2,nres+i),dc(3,nres+i),&
931 dc_norm(1,nres+i),dc_norm(2,nres+i),dc_norm(3,nres+i)
934 110 format (a,'(',i3,')',9f8.3)
937 if (iti.le.0 .or. iti.gt.ntyp) cycle
940 if (itj.le.0 .or. itj.gt.ntyp) cycle
943 xj = c(1,nres+j)-c(1,nres+i)
944 yj = c(2,nres+j)-c(2,nres+i)
945 zj = c(3,nres+j)-c(3,nres+i)
946 dxi = dc_norm(1,nres+i)
947 dyi = dc_norm(2,nres+i)
948 dzi = dc_norm(3,nres+i)
949 dxj = dc_norm(1,nres+j)
950 dyj = dc_norm(2,nres+j)
951 dzj = dc_norm(3,nres+j)
956 ! write (iout,*) (a(k),k=1,3),(b(k),k=1,3)
957 if (icomparfunc.eq.1) then
958 call contfunc(csc,iti,itj)
959 else if (icomparfunc.eq.2) then
960 call scdist(csc,iti,itj)
961 else if (icomparfunc.eq.3 .or. icomparfunc.eq.5) then
962 csc = dist(nres+i,nres+j)
963 else if (icomparfunc.eq.4) then
964 call odlodc(c(1,i),c(1,j),a,b,u,v,dla,dlb,csc)
966 write (*,*) "Error - Unknown sidechain contact function"
967 write (iout,*) "Error - Unknown sidechain contact function"
969 if (csc.lt.sc_cutoff(iti,itj)) then
970 ! write(iout,*) "i",i," j",j," dla",dla,dsc(iti),
971 ! & " dlb",dlb,dsc(itj)," csc",csc,sc_cutoff(iti,itj),
972 ! & dxi,dyi,dzi,dxi**2+dyi**2+dzi**2,
973 ! & dxj,dyj,dzj,dxj**2+dyj**2+dzj**2,om1,om2,om12,
975 ! write(iout,*)'egb',itypi,itypj,chi1,chi2,chip1,chip2,
976 ! & sig0ij,rij,rrij,om1,om2,om12,chiom1,chiom2,chiom12,
977 ! & chipom1,chipom2,chipom12,sig,eps2rt,rij_shift,e2,evdw,
986 ddsc(ncont)=1.0d0/rij
993 write (iout,'(a)') 'Contact map:'
999 write (iout,'(i3,2x,a,i4,2x,a,i4,5f8.3,3f10.5)') &
1000 i,restyp(it1),i1,restyp(it2),i2,cscore(i),&
1001 sc_cutoff(iabs(it1),iabs(it2)),ddsc(i),ddla(i),ddlb(i),&
1002 omt1(i),omt2(i),omt12(i)
1006 end subroutine contact
1008 !----------------------------------------------------------------------------
1009 subroutine contact(lprint,ncont,icont)
1011 use energy_data, only: nnt,nct,itype,ipot,maxcont,sigma,sigmaii
1012 ! include 'DIMENSIONS'
1013 ! include 'COMMON.IOUNITS'
1014 ! include 'COMMON.CHAIN'
1015 ! include 'COMMON.INTERACT'
1016 ! include 'COMMON.FFIELD'
1017 ! include 'COMMON.NAMES'
1018 real(kind=8) :: facont=1.569D0 ! facont = (2/(1-sqrt(1-1/4)))**(1/6)
1019 integer :: ncont,icont(2,maxcont)
1021 integer :: kkk,i,j,i1,i2,it1,it2,iti,itj
1022 real(kind=8) :: rcomp
1025 ! print *,'nnt=',nnt,' nct=',nct
1031 ! rcomp=sigmaii(iti,itj)+1.0D0
1032 rcomp=facont*sigmaii(iti,itj)
1034 ! rcomp=sigma(iti,itj)+1.0D0
1035 rcomp=facont*sigma(iti,itj)
1038 ! print *,'rcomp=',rcomp,' dist=',dist(nres+i,nres+j)
1039 if (dist(nres+i,nres+j).lt.rcomp) then
1047 write (iout,'(a)') 'Contact map:'
1053 write (iout,'(i3,2x,a,i4,2x,a,i4)') &
1054 i,restyp(it1),i1,restyp(it2),i2
1058 end subroutine contact
1060 !----------------------------------------------------------------------------
1061 real(kind=8) function contact_fract(ncont,ncont_ref,&
1064 use energy_data, only:maxcont
1066 ! include 'DIMENSIONS'
1067 ! include 'COMMON.IOUNITS'
1068 integer :: i,j,nmatch
1069 integer :: ncont,ncont_ref
1070 integer,dimension(2,maxcont) :: icont,icont_ref
1072 ! print *,'ncont=',ncont,' ncont_ref=',ncont_ref
1073 ! write (iout,'(20i4)') (icont_ref(1,i),i=1,ncont_ref)
1074 ! write (iout,'(20i4)') (icont_ref(2,i),i=1,ncont_ref)
1075 ! write (iout,'(20i4)') (icont(1,i),i=1,ncont)
1076 ! write (iout,'(20i4)') (icont(2,i),i=1,ncont)
1079 if (icont(1,i).eq.icont_ref(1,j) .and. &
1080 icont(2,i).eq.icont_ref(2,j)) nmatch=nmatch+1
1083 ! print *,' nmatch=',nmatch
1084 ! contact_fract=dfloat(nmatch)/dfloat(max0(ncont,ncont_ref))
1085 contact_fract=dfloat(nmatch)/dfloat(ncont_ref)
1087 end function contact_fract
1089 !------------------------------------------------------------------------------
1090 subroutine pept_cont(lprint,ncont,icont)
1092 use geometry_data, only:c
1093 use energy_data, only:maxcont,nnt,nct,itype
1095 ! include 'DIMENSIONS'
1096 ! include 'DIMENSIONS.ZSCOPT'
1097 ! include 'COMMON.IOUNITS'
1098 ! include 'COMMON.CHAIN'
1099 ! include 'COMMON.INTERACT'
1100 ! include 'COMMON.FFIELD'
1101 ! include 'COMMON.NAMES'
1102 integer :: ncont,icont(2,maxcont)
1103 integer :: i,j,k,kkk,i1,i2,it1,it2
1105 !el real(kind=8) :: dist
1106 real(kind=8) :: rcomp=5.5d0
1109 print *,'Entering pept_cont: nnt=',nnt,' nct=',nct
1112 c(k,2*nres+1)=0.5d0*(c(k,i)+c(k,i+1))
1116 c(k,2*nres+2)=0.5d0*(c(k,j)+c(k,j+1))
1118 if (dist(2*nres+1,2*nres+2).lt.rcomp) then
1126 write (iout,'(a)') 'PP contact map:'
1132 write (iout,'(i3,2x,a,i4,2x,a,i4)') &
1133 i,restyp(it1),i1,restyp(it2),i2
1137 end subroutine pept_cont
1138 !-----------------------------------------------------------------------------
1140 !-----------------------------------------------------------------------------
1141 subroutine contacts_between_fragments(lprint,is,ncont,icont,&
1142 ncont_interfrag,icont_interfrag)
1144 use energy_data, only:itype,maxcont
1145 ! include 'DIMENSIONS'
1146 ! include 'DIMENSIONS.ZSCOPT'
1147 ! include 'DIMENSIONS.COMPAR'
1148 ! include 'COMMON.INTERACT'
1149 ! include 'COMMON.COMPAR'
1150 ! include 'COMMON.IOUNITS'
1151 ! include 'COMMON.CHAIN'
1152 ! include 'COMMON.NAMES'
1153 integer :: icont(2,maxcont),ncont_interfrag(mmaxfrag),&
1154 icont_interfrag(2,maxcont,mmaxfrag)
1155 logical :: OK1,OK2,lprint
1156 integer :: is,ncont,i,j,ind,nc,k,ic1,ic2,l,i1,i2,it1,it2
1157 ! Determine the contacts that occur within a fragment and between fragments.
1162 ! write (iout,*) "i",i,(ifrag(1,k,i),ifrag(2,k,i)
1163 ! & ,k=1,npiece(i,1))
1164 ! write (iout,*) "j",j,(ifrag(1,k,j),ifrag(2,k,j)
1165 ! & ,k=1,npiece(j,1))
1166 ! write (iout,*) "ncont",ncont
1172 do while (.not.OK1 .and. l.lt.npiece(j,1))
1174 OK1=ic1.ge.ifrag(1,l,j)-is .and. &
1175 ic1.le.ifrag(2,l,j)+is
1179 do while (.not.OK2 .and. l.lt.npiece(i,1))
1181 OK2=ic2.ge.ifrag(1,l,i)-is .and. &
1182 ic2.le.ifrag(2,l,i)+is
1184 ! write(iout,*) "k",k," ic1",ic1," ic2",ic2," OK1",OK1,
1186 if (OK1.and.OK2) then
1188 icont_interfrag(1,nc,ind)=ic1
1189 icont_interfrag(2,nc,ind)=ic2
1190 ! write (iout,*) "nc",nc," ic1",ic1," ic2",ic2
1193 ncont_interfrag(ind)=nc
1194 ! do k=1,ncont_interfrag(ind)
1195 ! i1=icont_interfrag(1,k,ind)
1196 ! i2=icont_interfrag(2,k,ind)
1199 ! write (iout,'(i3,2x,a,i4,2x,a,i4)')
1200 ! & i,restyp(it1),i1,restyp(it2),i2
1205 write (iout,*) "Contacts within fragments:"
1207 write (iout,*) "Fragment",i," (",(ifrag(1,k,i),&
1208 ifrag(2,k,i),k=1,npiece(i,1)),")"
1210 do k=1,ncont_interfrag(ind)
1211 i1=icont_interfrag(1,k,ind)
1212 i2=icont_interfrag(2,k,ind)
1215 write (iout,'(i3,2x,a,i4,2x,a,i4)') &
1216 i,restyp(it1),i1,restyp(it2),i2
1220 write (iout,*) "Contacts between fragments:"
1224 write (iout,*) "Fragments",i," (",(ifrag(1,k,i),&
1225 ifrag(2,k,i),k=1,npiece(i,1)),") and",j," (",&
1226 (ifrag(1,k,j),ifrag(2,k,j),k=1,npiece(j,1)),")"
1227 write (iout,*) "Number of contacts",&
1228 ncont_interfrag(ind)
1230 do k=1,ncont_interfrag(ind)
1231 i1=icont_interfrag(1,k,ind)
1232 i2=icont_interfrag(2,k,ind)
1235 write (iout,'(i3,2x,a,i4,2x,a,i4)') &
1236 i,restyp(it1),i1,restyp(it2),i2
1242 end subroutine contacts_between_fragments
1243 !-----------------------------------------------------------------------------
1245 !-----------------------------------------------------------------------------
1246 subroutine contfunc(cscore,itypi,itypj)
1248 ! This subroutine calculates the contact function based on
1249 ! the Gay-Berne potential of interaction.
1252 ! implicit real*8 (a-h,o-z)
1253 ! include 'DIMENSIONS'
1254 ! include 'COMMON.CONTPAR'
1255 ! include 'COMMON.CALC'
1257 integer :: itypi,itypj
1258 real(kind=8) :: cscore,sig0ij,rrij,sig,rij_shift,evdw,e2
1260 sig0ij=sig_comp(itypi,itypj)
1261 chi1=chi_comp(itypi,itypj)
1262 chi2=chi_comp(itypj,itypi)
1264 chip1=chip_comp(itypi,itypj)
1265 chip2=chip_comp(itypj,itypi)
1267 rrij=1.0D0/(xj*xj+yj*yj+zj*zj)
1269 ! Calculate angle-dependent terms of the contact function
1273 om1=dxi*erij(1)+dyi*erij(2)+dzi*erij(3)
1274 om2=dxj*erij(1)+dyj*erij(2)+dzj*erij(3)
1275 om12=dxi*dxj+dyi*dyj+dzi*dzj
1277 ! print *,'egb',itypi,itypj,chi1,chi2,chip1,chip2,
1279 ! & rij,rrij,om1,om2,om12
1280 ! Calculate eps1(om12)
1281 faceps1=1.0D0-om12*chiom12
1282 faceps1_inv=1.0D0/faceps1
1283 eps1=dsqrt(faceps1_inv)
1284 ! Following variable is eps1*deps1/dom12
1285 eps1_om12=faceps1_inv*chiom12
1286 ! Calculate sigma(om1,om2,om12)
1290 facsig=om1*chiom1+om2*chiom2-2.0D0*om1om2*chiom12
1291 sigsq=1.0D0-facsig*faceps1_inv
1292 ! Calculate eps2 and its derivatives in om1, om2, and om12.
1295 chipom12=chip12*om12
1296 facp=1.0D0-om12*chipom12
1298 facp1=om1*chipom1+om2*chipom2-2.0D0*om1om2*chipom12
1299 ! Following variable is the square root of eps2
1300 eps2rt=1.0D0-facp1*facp_inv
1302 sig=sig0ij*dsqrt(sigsq)
1303 rij_shift=1.0D0/rij-sig+sig0ij
1304 if (rij_shift.le.0.0D0) then
1306 cscore = -dlog(evdw+1.0d-6)
1309 rij_shift=1.0D0/rij_shift
1310 e2=(rij_shift*sig0ij)**expon
1311 evdw=dabs(eps1*eps2rt**2*e2)
1312 if (evdw.gt.1.0d1) evdw = 1.0d1
1313 cscore = -dlog(evdw+1.0d-6)
1315 end subroutine contfunc
1316 !------------------------------------------------------------------------------
1317 subroutine scdist(cscore,itypi,itypj)
1319 ! This subroutine calculates the contact distance
1322 ! implicit real*8 (a-h,o-z)
1323 ! include 'DIMENSIONS'
1324 ! include 'COMMON.CONTPAR'
1325 ! include 'COMMON.CALC'
1326 integer :: itypi,itypj
1327 real(kind=8) :: cscore,rrij
1329 chi1=chi_comp(itypi,itypj)
1330 chi2=chi_comp(itypj,itypi)
1332 rrij=xj*xj+yj*yj+zj*zj
1334 ! Calculate angle-dependent terms of the contact function
1338 om1=dxi*erij(1)+dyi*erij(2)+dzi*erij(3)
1339 om2=dxj*erij(1)+dyj*erij(2)+dzj*erij(3)
1340 om12=dxi*dxj+dyi*dyj+dzi*dzj
1345 cscore=dsqrt(rrij+chi1**2+chi2**2+2*rij*(chiom2-chiom1)-2*chiom12)
1347 end subroutine scdist
1348 !------------------------------------------------------------------------------
1350 !------------------------------------------------------------------------------
1351 subroutine elecont(lprint,ncont,icont,ist,ien)
1353 use geometry_data, only:c
1354 use energy_data, only:maxcont,rpp,epp,itype,itel,vblinv,vblinv2
1356 ! include 'DIMENSIONS'
1357 ! include 'DIMENSIONS.ZSCOPT'
1358 ! include 'DIMENSIONS.COMPAR'
1359 ! include 'COMMON.IOUNITS'
1360 ! include 'COMMON.CHAIN'
1361 ! include 'COMMON.INTERACT'
1362 ! include 'COMMON.FFIELD'
1363 ! include 'COMMON.NAMES'
1364 ! include 'COMMON.LOCAL'
1366 integer :: i,j,k,ist,ien,iteli,itelj,ind,i1,i2,it1,it2,ic1,ic2
1367 real(kind=8) :: rri,xi,yi,zi,dxi,dyi,dzi,xmedi,ymedi,zmedi,&
1368 xj,yj,zj,dxj,dyj,dzj,aaa,bbb,ael6i,ael3i,rrmij,rmij,r3ij,r6ij,&
1369 vrmij,cosa,cosb,cosg,fac,ev1,ev2,fac3,fac4,evdwij,el1,el2,&
1371 real(kind=8),dimension(2,2) :: elpp6c=reshape((/-0.2379d0,&
1372 -0.2056d0,-0.2056d0,-0.0610d0/),shape(elpp6c))
1373 real(kind=8),dimension(2,2) :: elpp3c=reshape((/ 0.0503d0,&
1374 0.0000d0, 0.0000d0, 0.0692d0/),shape(elpp3c))
1375 real(kind=8),dimension(2,2) :: ael6c,ael3c,appc,bppc
1376 real(kind=8) :: elcutoff=-0.3d0
1377 real(kind=8) :: elecutoff_14=-0.5d0
1378 integer :: ncont,icont(2,maxcont)
1379 real(kind=8) :: econt(maxcont)
1381 ! Load the constants of peptide bond - peptide bond interactions.
1382 ! Type 1 - ordinary peptide bond, type 2 - alkylated peptide bond (e.g.
1383 ! proline) - determined by averaging ECEPP energy.
1387 ! data epp / 0.3045d0, 0.3649d0, 0.3649d0, 0.5743d0/
1388 ! data rpp / 4.5088d0, 4.5395d0, 4.5395d0, 4.4846d0/
1389 !el data (elpp6c) /-0.2379d0,-0.2056d0,-0.2056d0,-0.0610d0/
1390 !el data (elpp3c) / 0.0503d0, 0.0000d0, 0.0000d0, 0.0692d0/
1391 !el data (elcutoff) /-0.3d0/
1392 !el data (elecutoff_14) /-0.5d0/
1395 if (lprint) write (iout,'(a)') &
1396 "Constants of electrostatic interaction energy expression."
1400 appc(i,j)=epp(i,j)*rri*rri
1401 bppc(i,j)=-2.0*epp(i,j)*rri
1402 ael6c(i,j)=elpp6c(i,j)*4.2**6
1403 ael3c(i,j)=elpp3c(i,j)*4.2**3
1405 write (iout,'(2i2,4e15.4)') i,j,appc(i,j),bppc(i,j),ael6c(i,j),&
1424 if (j.eq.i+2 .and. itelj.eq.2) iteli=2
1425 if (iteli.eq.2 .and. itelj.eq.2 &
1426 .or.iteli.eq.0 .or.itelj.eq.0) goto 4
1427 aaa=appc(iteli,itelj)
1428 bbb=bppc(iteli,itelj)
1429 ael6i=ael6c(iteli,itelj)
1430 ael3i=ael3c(iteli,itelj)
1434 xj=c(1,j)+0.5*dxj-xmedi
1435 yj=c(2,j)+0.5*dyj-ymedi
1436 zj=c(3,j)+0.5*dzj-zmedi
1437 rrmij=1.0/(xj*xj+yj*yj+zj*zj)
1442 cosa=(dxi*dxj+dyi*dyj+dzi*dzj)*vblinv2
1443 cosb=(xj*dxi+yj*dyi+zj*dzi)*vrmij
1444 cosg=(xj*dxj+yj*dyj+zj*dzj)*vrmij
1445 fac=cosa-3.0*cosb*cosg
1451 el1=fac3*(4.0+fac*fac-3.0*(cosb*cosb+cosg*cosg))
1454 if (j.gt.i+2 .and. eesij.le.elcutoff .or. &
1455 j.eq.i+2 .and. eesij.le.elecutoff_14) then
1466 write (iout,*) 'Total average electrostatic energy: ',ees
1467 write (iout,*) 'VDW energy between peptide-group centers: ',evdw
1469 write (iout,*) 'Electrostatic contacts before pruning: '
1475 write (iout,'(i3,2x,a,i4,2x,a,i4,f10.5)') &
1476 i,restyp(it1),i1,restyp(it2),i2,econt(i)
1479 ! For given residues keep only the contacts with the greatest energy.
1481 do while (i.lt.ncont)
1487 do while (j.lt.ncont)
1489 if (ic1.eq.icont(1,j).and.iabs(icont(2,j)-ic2).le.2 .or. &
1490 ic2.eq.icont(2,j).and.iabs(icont(1,j)-ic1).le.2) then
1491 ! write (iout,*) "i",i," j",j," ic1",ic1," ic2",ic2,
1492 ! & " jc1",icont(1,j)," jc2",icont(2,j)," ncont",ncont
1493 if (econt(j).lt.ene .and. icont(2,j).ne.icont(1,j)+2) then
1494 if (ic1.eq.icont(1,j)) then
1496 if (k.ne.i .and. k.ne.j .and. icont(2,k).eq.icont(2,j)&
1497 .and. iabs(icont(1,k)-ic1).le.2 .and. &
1498 econt(k).lt.econt(j) ) goto 21
1500 else if (ic2.eq.icont(2,j) ) then
1502 if (k.ne.i .and. k.ne.j .and. icont(1,k).eq.icont(1,j)&
1503 .and. iabs(icont(2,k)-ic2).le.2 .and. &
1504 econt(k).lt.econt(j) ) goto 21
1507 ! Remove ith contact
1509 icont(1,k-1)=icont(1,k)
1510 icont(2,k-1)=icont(2,k)
1515 ! write (iout,*) "ncont",ncont
1517 ! write (iout,*) icont(1,k),icont(2,k)
1520 else if (econt(j).gt.ene .and. ic2.ne.ic1+2) &
1522 if (ic1.eq.icont(1,j)) then
1524 if (k.ne.i .and. k.ne.j .and. icont(2,k).eq.ic2 &
1525 .and. iabs(icont(1,k)-icont(1,j)).le.2 .and. &
1526 econt(k).lt.econt(i) ) goto 21
1528 else if (ic2.eq.icont(2,j) ) then
1530 if (k.ne.i .and. k.ne.j .and. icont(1,k).eq.ic1 &
1531 .and. iabs(icont(2,k)-icont(2,j)).le.2 .and. &
1532 econt(k).lt.econt(i) ) goto 21
1535 ! Remove jth contact
1537 icont(1,k-1)=icont(1,k)
1538 icont(2,k-1)=icont(2,k)
1542 ! write (iout,*) "ncont",ncont
1544 ! write (iout,*) icont(1,k),icont(2,k)
1555 write (iout,*) 'Electrostatic contacts after pruning: '
1561 write (iout,'(i3,2x,a,i4,2x,a,i4,f10.5)') &
1562 i,restyp(it1),i1,restyp(it2),i2,econt(i)
1566 end subroutine elecont
1567 !------------------------------------------------------------------------------
1569 !------------------------------------------------------------------------------
1570 subroutine match_contact(ishif1,ishif2,nc_match,nc_match1_max,&
1571 ncont_ref,icont_ref,ncont,icont,jfrag,n_shif1,n_shif2,&
1572 nc_frac,nc_req_set,istr,llocal,lprn)
1574 use energy_data, only:maxcont
1575 ! implicit real*8 (a-h,o-z)
1576 ! include 'DIMENSIONS'
1577 ! include 'COMMON.IOUNITS'
1578 integer :: ncont_ref,ncont,ishift,ishif2,nc_match
1579 integer,dimension(2,maxcont) :: icont_ref,icont !(2,maxcont)
1580 real(kind=8) :: nc_frac
1581 logical :: llocal,lprn
1582 integer :: ishif1,nc_match1_max,jfrag,n_shif1,n_shif2,&
1583 nc_req_set,istr,nc_match_max
1584 integer :: i,nc_req,nc_match1,is,js
1587 nc_match_max=nc_match_max+ &
1588 min0(icont_ref(2,i)-icont_ref(1,i)-1,3)
1592 else if (nc_req_set.eq.0) then
1593 nc_req=nc_match_max*nc_frac
1595 nc_req = dmin1(nc_match_max*nc_frac+0.5d0,&
1596 dfloat(nc_req_set)+1.0d-7)
1598 ! write (iout,*) "match_contact: nc_req:",nc_req
1599 ! write (iout,*) "nc_match_max",nc_match_max
1600 ! write (iout,*) "jfrag",jfrag," n_shif1",n_shif1,
1601 ! & " n_shif2",n_shif2
1602 ! Match current contact map against reference contact map; exit, if at least
1603 ! half of the contacts match
1604 call ncont_match(nc_match,nc_match1,0,0,ncont_ref,icont_ref,&
1605 ncont,icont,jfrag,llocal,lprn)
1606 nc_match1_max=nc_match1
1607 if (lprn .and. nc_match.gt.0) write (iout,*) &
1608 "Shift:",0,0," nc_match1",nc_match1,&
1609 " nc_match=",nc_match," req'd",nc_req
1610 if (nc_req.gt.0 .and. nc_match.ge.nc_req .or. &
1611 nc_req.eq.0 .and. nc_match.eq.1) then
1616 ! If sufficient matches are not found, try to shift contact maps up to three
1618 if (n_shif1.gt.0) then
1620 ! The following four tries help to find shifted beta-sheet patterns
1621 ! Shift "left" strand backward
1622 call ncont_match(nc_match,nc_match1,-is,0,ncont_ref,&
1623 icont_ref,ncont,icont,jfrag,llocal,lprn)
1624 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1625 if (lprn .and. nc_match.gt.0) write (iout,*) &
1626 "Shift:",-is,0," nc_match1",nc_match1,&
1627 " nc_match=",nc_match," req'd",nc_req
1628 if (nc_req.gt.0 .and. nc_match.ge.nc_req .or. &
1629 nc_req.eq.0 .and. nc_match.eq.1) then
1634 ! Shift "left" strand forward
1635 call ncont_match(nc_match,nc_match1,is,0,ncont_ref,&
1636 icont_ref,ncont,icont,jfrag,llocal,lprn)
1637 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1638 if (lprn .and. nc_match.gt.0) write (iout,*) &
1639 "Shift:",is,0," nc_match1",nc_match1,&
1640 " nc_match=",nc_match," req'd",nc_req
1641 if (nc_req.gt.0 .and. nc_match.ge.nc_req .or. &
1642 nc_req.eq.0 .and. nc_match.eq.1) then
1648 if (nc_req.eq.0) return
1649 ! Shift "right" strand backward
1651 call ncont_match(nc_match,nc_match1,0,-is,ncont_ref,&
1652 icont_ref,ncont,icont,jfrag,llocal,lprn)
1653 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1654 if (lprn .and. nc_match.gt.0) write (iout,*) &
1655 "Shift:",0,-is," nc_match1",nc_match1,&
1656 " nc_match=",nc_match," req'd",nc_req
1657 if (nc_match.ge.nc_req) then
1662 ! Shift "right" strand upward
1663 call ncont_match(nc_match,nc_match1,0,is,ncont_ref,&
1664 icont_ref,ncont,icont,jfrag,llocal,lprn)
1665 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1666 if (lprn .and. nc_match.gt.0) write (iout,*) &
1667 "Shift:",0,is," nc_match1",nc_match1,&
1668 " nc_match=",nc_match," req'd",nc_req
1669 if (nc_match.ge.nc_req) then
1675 ! Now try to shift both residues in contacts.
1679 call ncont_match(nc_match,nc_match1,-is,-js,ncont_ref,&
1680 icont_ref,ncont,icont,jfrag,llocal,lprn)
1681 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1682 if (lprn .and. nc_match.gt.0) write (iout,*) &
1683 "Shift:",-is,-js," nc_match1",nc_match1,&
1684 " nc_match=",nc_match," req'd",nc_req
1685 if (nc_match.ge.nc_req) then
1690 call ncont_match(nc_match,nc_match1,is,js,ncont_ref,&
1691 icont_ref,ncont,icont,jfrag,llocal,lprn)
1692 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1693 if (lprn .and. nc_match.gt.0) write (iout,*) &
1694 "Shift:",is,js," nc_match1",nc_match1,&
1695 " nc_match=",nc_match," req'd",nc_req
1696 if (nc_match.ge.nc_req) then
1702 call ncont_match(nc_match,nc_match1,-js,-is,ncont_ref,&
1703 icont_ref,ncont,icont,jfrag,llocal,lprn)
1704 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1705 if (lprn .and. nc_match.gt.0) write (iout,*) &
1706 "Shift:",-js,-is," nc_match1",nc_match1,&
1707 " nc_match=",nc_match," req'd",nc_req
1708 if (nc_match.ge.nc_req) then
1714 call ncont_match(nc_match,nc_match1,js,is,ncont_ref,&
1715 icont_ref,ncont,icont,jfrag,llocal,lprn)
1716 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1717 if (lprn .and. nc_match.gt.0) write (iout,*) &
1718 "Shift:",js,is," nc_match1",nc_match1,&
1719 " nc_match=",nc_match," req'd",nc_req
1720 if (nc_match.ge.nc_req) then
1727 if (is+js.le.n_shif1) then
1728 call ncont_match(nc_match,nc_match1,-is,js,ncont_ref,&
1729 icont_ref,ncont,icont,jfrag,llocal,lprn)
1730 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1731 if (lprn .and. nc_match.gt.0) write (iout,*) &
1732 "Shift:",-is,js," nc_match1",nc_match1,&
1733 " nc_match=",nc_match," req'd",nc_req
1734 if (nc_match.ge.nc_req) then
1740 call ncont_match(nc_match,nc_match1,js,-is,ncont_ref,&
1741 icont_ref,ncont,icont,jfrag,llocal,lprn)
1742 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1743 if (lprn .and. nc_match.gt.0) write (iout,*) &
1744 "Shift:",js,-is," nc_match1",nc_match1,&
1745 " nc_match=",nc_match," req'd",nc_req
1746 if (nc_match.ge.nc_req) then
1757 if (n_shif2.gt.0) then
1759 call ncont_match(nc_match,nc_match1,-is,-is,ncont_ref,&
1760 icont_ref,ncont,icont,jfrag,llocal,lprn)
1761 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1762 if (lprn .and. nc_match.gt.0) write (iout,*) &
1763 "Shift:",-is,-is," nc_match1",nc_match1,&
1764 " nc_match=",nc_match," req'd",nc_req
1765 if (nc_match.ge.nc_req) then
1770 call ncont_match(nc_match,nc_match1,is,is,ncont_ref,&
1771 icont_ref,ncont,icont,jfrag,llocal,lprn)
1772 if (nc_match1.gt.nc_match1_max) nc_match1_max=nc_match1
1773 if (lprn .and. nc_match.gt.0) write (iout,*) &
1774 "Shift:",is,is," nc_match1",nc_match1,&
1775 " nc_match=",nc_match," req'd",nc_req
1776 if (nc_match.ge.nc_req) then
1783 ! If this point is reached, the contact maps are different.
1788 end subroutine match_contact
1789 !-------------------------------------------------------------------------
1790 subroutine ncont_match(nc_match,nc_match1,ishif1,ishif2,&
1791 ncont_ref,icont_ref,ncont,icont,jfrag,llocal,lprn)
1793 use energy_data, only:nnt,nct,maxcont
1794 ! implicit real*8 (a-h,o-z)
1795 ! include 'DIMENSIONS'
1796 ! include 'DIMENSIONS.ZSCOPT'
1797 ! include 'DIMENSIONS.COMPAR'
1798 ! include 'COMMON.IOUNITS'
1799 ! include 'COMMON.INTERACT'
1800 ! include 'COMMON.GEO'
1801 ! include 'COMMON.COMPAR'
1802 logical :: llocal,lprn
1803 integer ncont_ref,ncont,ishift,ishif2,nang_pair
1804 integer,dimension(2,maxcont) :: icont_ref,icont,icont_match !(2,maxcont)
1805 integer,dimension(2,nres) :: iang_pair !(2,maxres)
1806 integer :: nc_match,nc_match1,ishif1,jfrag
1807 integer :: i,j,ic1,ic2
1808 real(kind=8) :: diffang,fract,rad2deg
1810 ! Compare the contact map against the reference contact map; they're stored
1811 ! in ICONT and ICONT_REF, respectively. The current contact map can be shifted.
1812 if (lprn) write (iout,'(80(1h*))')
1815 ! Check the local structure by comparing dihedral angles.
1816 ! write (iout,*) "ncont_match: ncont_ref",ncont_ref," llocal",llocal
1817 if (llocal .and. ncont_ref.eq.0) then
1818 ! If there are no contacts just compare the dihedral angles and exit.
1819 call angnorm(jfrag,ishif1,ishif2,ang_cut1(jfrag),diffang,fract,&
1821 if (lprn) write (iout,*) "diffang:",diffang*rad2deg,&
1822 " ang_cut:",ang_cut(jfrag)*rad2deg," fract",fract
1823 if (diffang.le.ang_cut(jfrag) .and. fract.ge.frac_min(jfrag)) &
1833 ic1=icont(1,i)+ishif1
1834 ic2=icont(2,i)+ishif2
1835 ! write (iout,*) "i",i," ic1",ic1," ic2",ic2
1836 if (ic1.lt.nnt .or. ic2.gt.nct) goto 10
1838 if (ic1.eq.icont_ref(1,j).and.ic2.eq.icont_ref(2,j)) then
1839 nc_match=nc_match+min0(icont_ref(2,j)-icont_ref(1,j)-1,3)
1840 nc_match1=nc_match1+1
1841 icont_match(1,nc_match1)=ic1
1842 icont_match(2,nc_match1)=ic2
1843 ! call add_angpair(icont(1,i),icont_ref(1,j),
1844 ! & nang_pair,iang_pair)
1845 ! call add_angpair(icont(2,i),icont_ref(2,j),
1846 ! & nang_pair,iang_pair)
1847 if (lprn) write (iout,*) "Contacts:",icont(1,i),icont(2,i),&
1848 " match",icont_ref(1,j),icont_ref(2,j),&
1849 " shifts",ishif1,ishif2
1856 write (iout,*) "nc_match",nc_match," nc_match1",nc_match1
1857 write (iout,*) "icont_match"
1859 write (iout,*) icont_match(1,i),icont_match(2,i)
1862 if (llocal .and. nc_match.gt.0) then
1863 call angnorm2(jfrag,ishif1,ishif2,nc_match1,icont_match,lprn,&
1864 ang_cut1(jfrag),diffang,fract)
1865 if (lprn) write (iout,*) "diffang:",diffang*rad2deg,&
1866 " ang_cut:",ang_cut(jfrag)*rad2deg,&
1867 " ang_cut1",ang_cut1(jfrag)*rad2deg
1868 if (diffang.gt.ang_cut(jfrag) &
1869 .or. fract.lt.frac_min(jfrag)) nc_match=0
1871 ! if (nc_match.gt.0) then
1872 ! diffang = angnorm1(nang_pair,iang_pair,lprn)
1873 ! if (diffang.gt.ang_cut(jfrag)) nc_match=0
1875 if (lprn) write (iout,*) "ishif1",ishif1," ishif2",ishif2,&
1876 " diffang",rad2deg*diffang," nc_match",nc_match
1878 end subroutine ncont_match
1879 !------------------------------------------------------------------------------
1880 subroutine match_secondary(jfrag,isecstr,nsec_match,lprn)
1881 ! This subroutine compares the secondary structure (isecstr) of fragment jfrag
1882 ! conformation considered to that of the reference conformation.
1883 ! Returns the number of equivalent residues (nsec_match).
1884 ! implicit real*8 (a-h,o-z)
1885 ! include 'DIMENSIONS'
1886 ! include 'DIMENSIONS.ZSCOPT'
1887 ! include 'DIMENSIONS.COMPAR'
1888 ! include 'COMMON.IOUNITS'
1889 ! include 'COMMON.CHAIN'
1890 ! include 'COMMON.PEPTCONT'
1891 ! include 'COMMON.COMPAR'
1893 integer :: isecstr(nres)
1894 integer :: jfrag,nsec_match,npart,i,j
1895 npart = npiece(jfrag,1)
1898 write (iout,*) "match_secondary jfrag",jfrag," ifrag",&
1899 (ifrag(1,i,jfrag),ifrag(2,i,jfrag),i=1,npart)
1900 write (iout,'(80i1)') (isec_ref(j),j=1,nres)
1901 write (iout,'(80i1)') (isecstr(j),j=1,nres)
1904 do j=ifrag(1,i,jfrag),ifrag(2,i,jfrag)
1905 ! The residue has equivalent conformational state to that of the reference
1907 ! a) the conformational states are equal or
1908 ! b) the reference state is a coil and that of the conformation considered
1910 ! c) the conformational state of the conformation considered is a strand
1911 ! and that of the reference conformation is a coil.
1912 ! 10/28/02 - case (b) deleted.
1913 if (isecstr(j).eq.isec_ref(j) .or. &
1914 ! & isecstr(j).eq.0 .and. isec_ref(j).eq.1 .or.
1915 isec_ref(j).eq.0 .and. isecstr(j).eq.1) &
1916 nsec_match=nsec_match+1
1920 end subroutine match_secondary
1921 !------------------------------------------------------------------------------
1923 !------------------------------------------------------------------------------
1924 subroutine odlodc(r1,r2,a,b,uu,vv,aa,bb,dd)
1926 use energy_data, only:ncont_ref,icont_ref!,nsccont_frag_ref,&
1928 ! implicit real*8 (a-h,o-z)
1929 real(kind=8),dimension(3) :: r1,r2,a,b,x,y
1930 real(kind=8) :: uu,vv,aa,bb,dd
1931 real(kind=8) :: ab,ar,br,det,dd1,dd2,dd3,dd4,dd5
1932 !el odl(u,v) = (r1(1)-r2(1))**2+(r1(2)-r2(2))**2+(r1(3)-r2(3))**2 &
1933 !el + 2*ar*u - 2*br*v - 2*ab*u*v + aa*u**2 + bb*v**2
1934 ! print *,"r1",(r1(i),i=1,3)
1935 ! print *,"r2",(r2(i),i=1,3)
1936 ! print *,"a",(a(i),i=1,3)
1937 ! print *,"b",(b(i),i=1,3)
1938 aa = a(1)**2+a(2)**2+a(3)**2
1939 bb = b(1)**2+b(2)**2+b(3)**2
1940 ab = a(1)*b(1)+a(2)*b(2)+a(3)*b(3)
1941 ar = a(1)*(r1(1)-r2(1))+a(2)*(r1(2)-r2(2))+a(3)*(r1(3)-r2(3))
1942 br = b(1)*(r1(1)-r2(1))+b(2)*(r1(2)-r2(2))+b(3)*(r1(3)-r2(3))
1944 ! print *,'aa',aa,' bb',bb,' ab',ab,' ar',ar,' br',br,' det',det
1945 uu = (-ar*bb+br*ab)/det
1946 vv = (br*aa-ar*ab)/det
1952 !el dd1 = odl(uu,vv)
1953 dd1 = odl(uu,vv,r1,r2,ar,br,ab,aa,bb)
1954 !el dd2 = odl(0.0d0,0.0d0)
1955 dd2 = odl(0.0d0,0.0d0,r1,r2,ar,br,ab,aa,bb)
1956 !el dd3 = odl(0.0d0,1.0d0)
1957 dd3 = odl(0.0d0,1.0d0,r1,r2,ar,br,ab,aa,bb)
1958 !el dd4 = odl(1.0d0,0.0d0)
1959 dd4 = odl(1.0d0,0.0d0,r1,r2,ar,br,ab,aa,bb)
1960 !el dd5 = odl(1.0d0,1.0d0)
1961 dd5 = odl(1.0d0,1.0d0,r1,r2,ar,br,ab,aa,bb)
1962 dd = dsqrt(dmin1(dd1,dd2,dd3,dd4,dd5))
1966 else if (dd.eq.dd3) then
1969 else if (dd.eq.dd4) then
1972 else if (dd.eq.dd5) then
1981 ! dd1 = (x(1)-y(1))**2+(x(2)-y(2))**2+(x(3)-y(3))**2
1985 ! write (8,*) uu,vv,dd,dd1
1988 end subroutine odlodc
1989 !------------------------------------------------------------------------------
1990 real(kind=8) function odl(u,v,r1,r2,ar,br,ab,aa,bb)
1992 real(kind=8),dimension(3) :: r1,r2
1993 real(kind=8) :: aa,bb,u,v,ar,br,ab
1995 odl = (r1(1)-r2(1))**2+(r1(2)-r2(2))**2+(r1(3)-r2(3))**2 &
1996 + 2*ar*u - 2*br*v - 2*ab*u*v + aa*u**2 + bb*v**2
1999 !------------------------------------------------------------------------------
2001 !------------------------------------------------------------------------------
2002 subroutine proc_cont
2004 use geometry_data, only:rad2deg
2005 use energy_data, only:ncont_ref,icont_ref!,nsccont_frag_ref,&
2007 ! implicit real*8 (a-h,o-z)
2008 ! include 'DIMENSIONS'
2009 ! include 'DIMENSIONS.ZSCOPT'
2010 ! include 'DIMENSIONS.COMPAR'
2011 ! include 'COMMON.IOUNITS'
2012 ! include 'COMMON.TIME1'
2013 ! include 'COMMON.SBRIDGE'
2014 ! include 'COMMON.CONTROL'
2015 ! include 'COMMON.COMPAR'
2016 ! include 'COMMON.CHAIN'
2017 ! include 'COMMON.HEADER'
2018 ! include 'COMMON.CONTACTS1'
2019 ! include 'COMMON.PEPTCONT'
2020 ! include 'COMMON.GEO'
2021 integer :: i,j,k,ind,len_cut,ndigit,length_frag
2023 write (iout,*) "proc_cont: nlevel",nlevel
2024 if (nlevel.lt.0) then
2025 write (iout,*) "call define_fragments"
2026 call define_fragments
2028 write (iout,*) "call secondary2"
2029 call secondary2(.true.,.false.,ncont_pept_ref,icont_pept_ref,&
2032 write (iout,'(80(1h=))')
2033 write (iout,*) "Electrostatic contacts"
2034 call contacts_between_fragments(.true.,0,ncont_pept_ref,&
2035 icont_pept_ref,ncont_frag_ref(1),icont_frag_ref(1,1,1))
2036 write (iout,'(80(1h=))')
2037 write (iout,*) "Side chain contacts"
2038 call contacts_between_fragments(.true.,0,ncont_ref,&
2039 icont_ref,nsccont_frag_ref(1),isccont_frag_ref(1,1,1))
2040 if (nlevel.lt.0) then
2044 if (istruct(i).le.1) then
2045 len_cut=max0(len_frag(i,1)*4/5,3)
2046 else if (istruct(i).eq.2 .or. istruct(i).eq.4) then
2047 len_cut=max0(len_frag(i,1)*2/5,3)
2049 write (iout,*) "i",i," istruct",istruct(i)," ncont_frag",&
2050 ncont_frag_ref(ind)," len_cut",len_cut,&
2051 " icont_single",icont_single," iloc_single",iloc_single
2053 if (iloc(i).gt.0) write (iout,*) &
2054 "Local structure used to compare structure of fragment",i,&
2056 if (istruct(i).ne.3 .and. istruct(i).ne.0 &
2057 .and. icont_single.gt.0 .and. &
2058 ncont_frag_ref(ind).ge.len_cut) then
2059 write (iout,*) "Electrostatic contacts used to compare",&
2060 " structure of fragment",i," to native."
2063 else if (icont_single.gt.0 .and. nsccont_frag_ref(ind) &
2065 write (iout,*) "Side chain contacts used to compare",&
2066 " structure of fragment",i," to native."
2070 write (iout,*) "Contacts not used to compare",&
2071 " structure of fragment",i," to native."
2076 if (irms_single.gt.0 .or. isccont(i,1).eq.0 &
2077 .and. ielecont(i,1).eq.0) then
2078 write (iout,*) "RMSD used to compare",&
2079 " structure of fragment",i," to native."
2082 write (iout,*) "RMSD not used to compare",&
2083 " structure of fragment",i," to native."
2088 if (nlevel.lt.-1) then
2091 if (nlevel.gt.3) nlevel=3
2092 if (nlevel.eq.3) then
2094 npiece(1,3)=nfrag(1)
2104 else if (nlevel.eq.-1) then
2109 isnfrag(i+1)=isnfrag(i)+nfrag(i)
2113 ndigit=ndigit+2*nfrag(i)
2115 write (iout,*) "ndigit",ndigit
2116 if (.not.binary .and. ndigit.gt.30) then
2117 write (iout,*) "Highest class too large; switching to",&
2118 " binary representation."
2121 write (iout,*) "isnfrag",(isnfrag(i),i=1,nlevel+1)
2122 write(iout,*) "rmscut_base_up",rmscut_base_up,&
2123 " rmscut_base_low",rmscut_base_low," rmsup_lim",rmsup_lim
2129 length_frag=length_frag+ifrag(2,k,j)-ifrag(1,k,j)+1
2133 length_frag=length_frag+len_frag(ipiece(k,j,i),1)
2136 len_frag(j,i)=length_frag
2137 rmscutfrag(1,j,i)=rmscut_base_up*length_frag
2138 rmscutfrag(2,j,i)=rmscut_base_low*length_frag
2139 if (rmscutfrag(1,j,i).lt.rmsup_lim) &
2140 rmscutfrag(1,j,i)=rmsup_lim
2141 if (rmscutfrag(1,j,i).gt.rmsupup_lim) &
2142 rmscutfrag(1,j,i)=rmsupup_lim
2145 write (iout,*) "Level",1," number of fragments:",nfrag(1)
2147 write (iout,*) npiece(j,1),(ifrag(1,k,j),ifrag(2,k,j),&
2148 k=1,npiece(j,1)),len_frag(j,1),rmscutfrag(1,j,1),&
2149 rmscutfrag(2,j,1),n_shift(1,j,1),n_shift(2,j,1),&
2150 ang_cut(j)*rad2deg,ang_cut1(j)*rad2deg,frac_min(j),&
2151 nc_fragm(j,1),nc_req_setf(j,1),istruct(j)
2154 write (iout,*) "Level",i," number of fragments:",nfrag(i)
2156 write (iout,*) npiece(j,i),(ipiece(k,j,i),&
2157 k=1,npiece(j,i)),len_frag(j,i),rmscutfrag(1,j,i),&
2158 rmscutfrag(2,j,i),n_shift(1,j,i),n_shift(2,j,i),&
2159 nc_fragm(j,i),nc_req_setf(j,i)
2163 end subroutine proc_cont
2164 !------------------------------------------------------------------------------
2166 !------------------------------------------------------------------------------
2167 subroutine define_pairs
2169 ! use energy_data, only:nsccont_frag_ref
2170 ! implicit real*8 (a-h,o-z)
2171 ! include 'DIMENSIONS'
2172 ! include 'DIMENSIONS.ZSCOPT'
2173 ! include 'DIMENSIONS.COMPAR'
2174 ! include 'COMMON.IOUNITS'
2175 ! include 'COMMON.TIME1'
2176 ! include 'COMMON.SBRIDGE'
2177 ! include 'COMMON.CONTROL'
2178 ! include 'COMMON.COMPAR'
2179 ! include 'COMMON.FRAG'
2180 ! include 'COMMON.CHAIN'
2181 ! include 'COMMON.HEADER'
2182 ! include 'COMMON.GEO'
2183 ! include 'COMMON.CONTACTS1'
2184 ! include 'COMMON.PEPTCONT'
2185 integer :: j,k,i,length_frag,ind,ll1,ll2,len_cut
2190 length_frag=length_frag+ifrag(2,k,j)-ifrag(1,k,j)+1
2192 len_frag(j,1)=length_frag
2193 write (iout,*) "Fragment",j," length",len_frag(j,1)
2199 if (istruct(i).le.1 .or. istruct(j).le.1) then
2200 if (istruct(i).le.1) then
2205 if (istruct(j).le.1) then
2210 len_cut=max0(min0(ll1*2/3,ll2*4/5),3)
2212 if (istruct(i).eq.2 .or. istruct(i).eq.4) then
2217 if (istruct(j).eq.2 .or. istruct(j).eq.4) then
2222 len_cut=max0(min0(ll1*4/5,ll2)*4/5,3)
2224 write (iout,*) "Fragments",i,j," structure",istruct(i),&
2225 istruct(j)," # contacts",&
2226 ncont_frag_ref(ind),nsccont_frag_ref(ind),&
2227 " lengths",len_frag(i,1),len_frag(j,1),&
2228 " ll1",ll1," ll2",ll2," len_cut",len_cut
2229 if ((istruct(i).eq.1 .or. istruct(j).eq.1) .and. &
2230 nsccont_frag_ref(ind).ge.len_cut ) then
2231 if (istruct(i).eq.1 .and. istruct(j).eq.1) then
2232 write (iout,*) "Adding pair of helices",i,j,&
2233 " based on SC contacts"
2235 write (iout,*) "Adding helix+strand/sheet pair",i,j,&
2236 " based on SC contacts"
2239 if (icont_pair.gt.0) then
2240 write (iout,*) "# SC contacts will be used",&
2242 isccont(nfrag(2),2)=1
2244 if (irms_pair.gt.0) then
2245 write (iout,*) "Fragment RMSD will be used",&
2249 npiece(nfrag(2),2)=2
2250 ipiece(1,nfrag(2),2)=i
2251 ipiece(2,nfrag(2),2)=j
2252 ielecont(nfrag(2),2)=0
2253 n_shift(1,nfrag(2),2)=nshift_pair
2254 n_shift(2,nfrag(2),2)=nshift_pair
2255 nc_fragm(nfrag(2),2)=ncfrac_pair
2256 nc_req_setf(nfrag(2),2)=ncreq_pair
2257 else if ((istruct(i).ge.2 .and. istruct(i).le.4) &
2258 .and. (istruct(j).ge.2 .and. istruct(i).le.4) &
2259 .and. ncont_frag_ref(ind).ge.len_cut ) then
2261 write (iout,*) "Adding pair strands/sheets",i,j,&
2262 " based on pp contacts"
2263 if (icont_pair.gt.0) then
2264 write (iout,*) "# pp contacts will be used",&
2266 ielecont(nfrag(2),2)=1
2268 if (irms_pair.gt.0) then
2269 write (iout,*) "Fragment RMSD will be used",&
2273 npiece(nfrag(2),2)=2
2274 ipiece(1,nfrag(2),2)=i
2275 ipiece(2,nfrag(2),2)=j
2276 ielecont(nfrag(2),2)=1
2277 isccont(nfrag(2),2)=0
2278 n_shift(1,nfrag(2),2)=nshift_pair
2279 n_shift(2,nfrag(2),2)=nshift_pair
2280 nc_fragm(nfrag(2),2)=ncfrac_bet
2281 nc_req_setf(nfrag(2),2)=ncreq_bet
2285 write (iout,*) "Pairs found"
2287 write (iout,*) ipiece(1,i,2),ipiece(2,i,2)
2290 end subroutine define_pairs
2291 !------------------------------------------------------------------------------
2293 !------------------------------------------------------------------------------
2294 INTEGER FUNCTION ICANT(I,J)
2303 !------------------------------------------------------------------------------
2305 !------------------------------------------------------------------------------
2306 subroutine imysort(n, m, mm, x, y, z, z1, z2, z3, z4, z5, z6)
2309 integer :: x(m,mm,n),y(n),z(n),z1(2,n),z6(n),xmin,xtemp
2310 real(kind=8) :: z2(n),z3(n),z4(n),z5(n)
2311 real(kind=8) :: xxtemp
2312 integer :: i,j,k,imax
2317 if (x(1,1,j).lt.xmin) then
2351 x(j,k,imax)=x(j,k,i)
2357 end subroutine imysort
2358 !------------------------------------------------------------------------------
2360 !-------------------------------------------------------------------------------
2361 real(kind=8) function qwolynes(ilevel,jfrag)
2363 use geometry_data, only:cref,nperm
2364 use control_data, only:symetr
2365 use energy_data, only:nnt,nct,itype
2367 ! include 'DIMENSIONS'
2368 ! include 'DIMENSIONS.ZSCOPT'
2369 ! include 'DIMENSIONS.COMPAR'
2370 ! include 'COMMON.IOUNITS'
2371 ! include 'COMMON.COMPAR'
2372 ! include 'COMMON.CHAIN'
2373 ! include 'COMMON.INTERACT'
2374 ! include 'COMMON.CONTROL'
2375 integer :: ilevel,jfrag,kkk
2376 integer :: i,j,jl,k,l,il,kl,nl,np,ip,kp
2378 real(kind=8),dimension(:),allocatable :: tempus !(maxperm)
2379 real(kind=8) :: maxiQ !dist,
2380 real(kind=8) :: qq,qqij,qqijCM,dij,d0ij,dijCM,d0ijCM
2381 logical :: lprn=.false.
2382 real(kind=8) :: x !el sigm
2383 !el sigm(x)=0.25d0*x
2389 ! write (iout,*) "QWolyes: " jfrag",jfrag,
2390 ! & " ilevel",ilevel
2391 allocate(tempus(nperm))
2394 if (ilevel.eq.0) then
2395 if (lprn) write (iout,*) "Q computed for whole molecule"
2406 d0ij=dsqrt((cref(1,jl,kkk)-cref(1,il,kkk))**2+ &
2407 (cref(2,jl,kkk)-cref(2,il,kkk))**2+ &
2408 (cref(3,jl,kkk)-cref(3,il,kkk))**2)
2410 qqij = dexp(-0.5d0*((dij-d0ij)/(sigm(d0ij)))**2)
2411 if (itype(il).ne.10 .or. itype(jl).ne.10) then
2414 (cref(1,jl+nres,kkk)-cref(1,il+nres,kkk))**2+ &
2415 (cref(2,jl+nres,kkk)-cref(2,il+nres,kkk))**2+ &
2416 (cref(3,jl+nres,kkk)-cref(3,il+nres,kkk))**2)
2417 dijCM=dist(il+nres,jl+nres)
2418 qqijCM = dexp(-0.5d0*((dijCM-d0ijCM)/(sigm(d0ijCM)))**2)
2422 write (iout,*) "il",il," jl",jl,&
2423 " itype",itype(il),itype(jl)
2424 write (iout,*)"d0ij",d0ij," dij",dij," d0ijCM",d0ijCM,&
2425 " dijCM",dijCM," qqij",qqij," qqijCM",qqijCM
2430 if (lprn) write (iout,*) "nl",nl," qq",qq
2431 else if (ilevel.eq.1) then
2432 if (lprn) write (iout,*) "Level",ilevel," fragment",jfrag
2434 ! write (iout,*) "nlist_frag",nlist_frag(jfrag)
2435 do i=2,nlist_frag(jfrag)
2437 il=list_frag(i,jfrag)
2438 jl=list_frag(j,jfrag)
2439 if (iabs(il-jl).gt.nsep) then
2447 d0ij=dsqrt((cref(1,jl,kkk)-cref(1,il,kkk))**2+ &
2448 (cref(2,jl,kkk)-cref(2,il,kkk))**2+ &
2449 (cref(3,jl,kkk)-cref(3,il,kkk))**2)
2451 qqij = dexp(-0.5d0*((dij-d0ij)/(sigm(d0ij)))**2)
2452 if (itype(il).ne.10 .or. itype(jl).ne.10) then
2455 (cref(1,jl+nres,kkk)-cref(1,il+nres,kkk))**2+ &
2456 (cref(2,jl+nres,kkk)-cref(2,il+nres,kkk))**2+ &
2457 (cref(3,jl+nres,kkk)-cref(3,il+nres,kkk))**2)
2458 dijCM=dist(il+nres,jl+nres)
2459 qqijCM = dexp(-0.5d0*((dijCM-d0ijCM)/(sigm(d0ijCM)))**2)
2463 write (iout,*) "i",i," j",j," il",il," jl",jl,&
2464 " itype",itype(il),itype(jl)
2465 write (iout,*)"d0ij",d0ij," dij",dij," d0ijCM",d0ijCM,&
2466 " dijCM",dijCM," qqij",qqij," qqijCM",qqijCM
2472 if (lprn) write (iout,*) "nl",nl," qq",qq
2473 else if (ilevel.eq.2) then
2474 np=npiece(jfrag,ilevel)
2477 ip=ipiece(i,jfrag,ilevel)
2478 do j=1,nlist_frag(ip)
2481 kp=ipiece(k,jfrag,ilevel)
2482 do l=1,nlist_frag(kp)
2484 if (iabs(kl-il).gt.nsep) then
2492 d0ij=dsqrt((cref(1,kl,kkk)-cref(1,il,kkk))**2+ &
2493 (cref(2,kl,kkk)-cref(2,il,kkk))**2+ &
2494 (cref(3,kl,kkk)-cref(3,il,kkk))**2)
2496 qqij = dexp(-0.5d0*((dij-d0ij)/(sigm(d0ij)))**2)
2497 if (itype(il).ne.10 .or. itype(kl).ne.10) then
2500 (cref(1,kl+nres,kkk)-cref(1,il+nres,kkk))**2+ &
2501 (cref(2,kl+nres,kkk)-cref(2,il+nres,kkk))**2+ &
2502 (cref(3,kl+nres,kkk)-cref(3,il+nres,kkk))**2)
2503 dijCM=dist(il+nres,kl+nres)
2504 qqijCM = dexp(-0.5d0*((dijCM-d0ijCM)/ &
2509 write (iout,*) "i",i," j",j," k",k," l",l," il",il,&
2510 " kl",kl," itype",itype(il),itype(kl)
2511 write (iout,*) " d0ij",d0ij," dij",dij," d0ijCM",&
2512 d0ijCM," dijCM",dijCM," qqij",qqij," qqijCM",qqijCM
2520 if (lprn) write (iout,*) "nl",nl," qq",qq
2522 write (iout,*)"Error: Q can be computed only for level 1 and 2."
2527 if (maxiQ.le.tempus(kkk)) maxiQ=tempus(kkk)
2529 qwolynes=1.0d0-maxiQ
2532 end function qwolynes
2533 !-------------------------------------------------------------------------------
2534 real(kind=8) function sigm(x)
2539 !-------------------------------------------------------------------------------
2540 subroutine fragment_list
2542 ! include 'DIMENSIONS'
2543 ! include 'DIMENSIONS.ZSCOPT'
2544 ! include 'DIMENSIONS.COMPAR'
2545 ! include 'COMMON.IOUNITS'
2546 ! include 'COMMON.COMPAR'
2547 logical :: lprn=.true.
2548 integer :: i,ilevel,j,k,jfrag
2551 do i=1,npiece(jfrag,1)
2552 if (lprn) write (iout,*) "jfrag=",jfrag,&
2553 "i=",i," fragment",ifrag(1,i,jfrag),&
2555 do j=ifrag(1,i,jfrag),ifrag(2,i,jfrag)
2556 do k=1,nlist_frag(jfrag)
2557 if (list_frag(k,jfrag).eq.j) goto 10
2559 nlist_frag(jfrag)=nlist_frag(jfrag)+1
2560 list_frag(nlist_frag(jfrag),jfrag)=j
2565 write (iout,*) "Fragment list"
2567 write (iout,*)"Fragment",j," list",(list_frag(k,j),&
2571 end subroutine fragment_list
2572 !-------------------------------------------------------------------------------
2573 real(kind=8) function rmscalc(ishif,i,j,jcon,lprn)
2576 use control_data, only:symetr
2577 use geometry_data, only:nperm
2578 ! implicit real*8 (a-h,o-z)
2579 ! include 'DIMENSIONS'
2580 ! include 'DIMENSIONS.ZSCOPT'
2581 ! include 'DIMENSIONS.COMPAR'
2582 ! include 'COMMON.IOUNITS'
2583 ! include 'COMMON.COMPAR'
2584 ! include 'COMMON.CHAIN'
2585 ! include 'COMMON.INTERACT'
2586 ! include 'COMMON.VAR'
2587 ! include 'COMMON.CONTROL'
2588 real(kind=8) :: przes(3),obrot(3,3)
2589 !el real(kind=8) :: creff(3,nres*2),cc(3,nres*2)
2590 !el logical :: iadded(nres)
2591 !el integer :: inumber(2,nres)
2592 !el common /ccc/ creff,cc,iadded,inumber
2595 integer :: ishif,i,j,jcon,idup,kkk,l,k,kk
2596 real(kind=8) :: rminrms,rms
2598 write (iout,*) "i",i," j",j," jcont",jcon," ishif",ishif
2599 write (iout,*) "npiece",npiece(j,i)
2602 ! write (iout,*) "symetr",symetr
2608 ! write (iout,*) "nperm",nperm
2615 ! write (iout,*) "kkk",kkk
2620 write (iout,*) "Level 1: j=",j,"k=",k," adding fragment",&
2621 ifrag(1,k,j),ifrag(2,k,j)
2624 call cprep(ifrag(1,k,j),ifrag(2,k,j),ishif,idup,kkk)
2625 ! write (iout,*) "Exit cprep"
2627 ! write (iout,*) "ii=",ii
2630 ! write (iout,*) "kk",kk," npiece",npiece(kk,1)
2633 write (iout,*) "Level",i,": j=",j,"k=",k," kk=",kk,&
2634 " l=",l," adding fragment",&
2635 ifrag(1,l,kk),ifrag(2,l,kk)
2638 call cprep(ifrag(1,l,kk),ifrag(2,l,kk),ishif,idup,kkk)
2639 ! write (iout,*) "After cprep"
2646 write (iout,*) "tuszukaj"
2649 write(iout,'(5i4,2(3f10.5,5x))') i,j,k,inumber(1,k),&
2650 inumber(2,k),(creff(l,k),l=1,3),(cc(l,k),l=1,3)
2657 call fitsq(rms,cc(1,1),creff(1,1),idup,przes,obrot,non_conv)
2659 print *,'Error: FITSQ non-convergent, jcon',jcon,i
2661 else if (rms.lt.-1.0d-6) then
2662 print *,'Error: rms^2 = ',rms,jcon,i
2664 else if (rms.ge.1.0d-6 .and. rms.lt.0) then
2667 ! write (iout,*) "rmsmin", rminrms, "rms", rms
2668 if (rms.le.rminrms) rminrms=rms
2670 rmscalc = dsqrt(rminrms)
2671 ! write (iout, *) "analysys", rmscalc,anatemp
2673 end function rmscalc
2674 !-------------------------------------------------------------------------
2675 subroutine cprep(if1,if2,ishif,idup,kwa)
2678 use control_data, only:symetr
2679 use geometry_data, only:nperm,cref,c
2680 ! implicit real*8 (a-h,o-z)
2681 ! include 'DIMENSIONS'
2682 ! include 'DIMENSIONS.ZSCOPT'
2683 ! include 'DIMENSIONS.COMPAR'
2684 ! include 'COMMON.CONTROL'
2685 ! include 'COMMON.IOUNITS'
2686 ! include 'COMMON.COMPAR'
2687 ! include 'COMMON.CHAIN'
2688 ! include 'COMMON.INTERACT'
2689 ! include 'COMMON.VAR'
2690 real(kind=8) :: przes(3),obrot(3,3)
2691 !el real(kind=8) :: creff(3,nres*2),cc(3,nres*2)
2692 !el logical :: iadded(nres)
2693 !el integer :: inumber(2,nres)
2694 integer :: iistrart,kwa,blar
2695 !el common /ccc/ creff,cc,iadded,inumber
2696 integer :: if1,if2,ishif,idup,kkk,l,m
2697 ! write (iout,*) "Calling cprep symetr",symetr," kwa",kwa
2702 ! write (iout,*) "nperm",nperm
2706 ! write (iout,*) "l",l," iadded",iadded(l)
2708 if (l+ishif.gt.1 .and. l+ishif.le.nres .and. .not.iadded(l)) &
2713 inumber(2,idup)=l+ishif
2715 creff(m,idup)=cref(m,l,kkk)
2716 cc(m,idup)=c(m,l+ishif)
2721 end subroutine cprep
2722 !-------------------------------------------------------------------------
2723 real(kind=8) function rmsnat(jcon)
2725 use control_data, only:symetr
2726 use geometry_data, only:nperm,cref,c
2727 use energy_data, only:itype
2728 ! implicit real*8 (a-h,o-z)
2729 ! include 'DIMENSIONS'
2730 ! include 'DIMENSIONS.ZSCOPT'
2731 ! include 'DIMENSIONS.COMPAR'
2732 ! include 'COMMON.IOUNITS'
2733 ! include 'COMMON.COMPAR'
2734 ! include 'COMMON.CHAIN'
2735 ! include 'COMMON.INTERACT'
2736 ! include 'COMMON.VAR'
2737 ! include 'COMMON.CONTROL'
2738 real(kind=8) :: przes(3),obrot(3,3),cc(3,2*nres),ccref(3,2*nres)
2740 integer :: ishif,i,j,resprzesun,jcon,kkk,nnsup
2741 real(kind=8) :: rminrms,rmsminsing,rms
2751 if (itype(i).ne.ntyp1) then
2755 ccref(j,nnsup)=cref(j,i,kkk)
2759 call fitsq(rms,cc(1,1),ccref(1,1),nnsup,przes,obrot,non_conv)
2761 print *,'Error: FITSQ non-convergent, jcon',jcon,i
2763 else if (rms.lt.-1.0d-6) then
2764 print *,'Error: rms^2 = ',rms,jcon,i
2766 else if (rms.ge.1.0d-6 .and. rms.lt.0) then
2769 if (rms.le.rminrms) rminrms=rms
2770 ! write (iout,*) "kkk",kkk," rmsnat",rms , rminrms
2772 rmsnat = dsqrt(rminrms)
2773 ! write (iout,*) "analysys",rmsnat, anatemp
2774 ! liczenie rmsdla pojedynczego lancucha
2777 !-------------------------------------------------------------------------------
2778 subroutine define_fragments
2780 use geometry_data, only:rad2deg
2781 use energy_data, only:itype
2782 use compare_data, only:nhfrag,nbfrag,bfrag,hfrag
2783 ! implicit real*8 (a-h,o-z)
2784 ! include 'DIMENSIONS'
2785 ! include 'DIMENSIONS.ZSCOPT'
2786 ! include 'DIMENSIONS.COMPAR'
2787 ! include 'COMMON.IOUNITS'
2788 ! include 'COMMON.TIME1'
2789 ! include 'COMMON.FRAG'
2790 ! include 'COMMON.SBRIDGE'
2791 ! include 'COMMON.CONTROL'
2792 ! include 'COMMON.COMPAR'
2793 ! include 'COMMON.CHAIN'
2794 ! include 'COMMON.HEADER'
2795 ! include 'COMMON.GEO'
2796 ! include 'COMMON.CONTACTS'
2797 ! include 'COMMON.PEPTCONT'
2798 ! include 'COMMON.INTERACT'
2799 ! include 'COMMON.NAMES'
2800 integer :: nstrand,istrand(2,nres/2)
2801 integer :: nhairp,ihairp(2,nres/5)
2802 character(len=16) :: strstr(4)=reshape((/'helix','hairpin',&
2803 'strand','strand pair'/),shape(strstr))
2804 integer :: j,i,ii,i1,i2,i3,i4,it1,it2,it3,it4
2806 write (iout,*) 'NC_FRAC_HEL',ncfrac_hel,' NC_REQ_HEL',ncreq_hel,&
2807 'NC_FRAC_BET',ncfrac_bet,' NC_REQ_BET',ncreq_bet,&
2808 'NC_FRAC_PAIR',ncfrac_pair,' NC_REQ_PAIR',ncreq_pair,&
2809 ' RMS_PAIR',irms_pair,' SPLIT_BET',isplit_bet
2810 write (iout,*) 'NSHIFT_HEL',nshift_hel,' NSHIFT_BET',nshift_bet,&
2811 ' NSHIFT_STRAND',nshift_strand,' NSHIFT_PAIR',nshift_pair
2812 write (iout,*) 'ANGCUT_HEL',angcut_hel*rad2deg,&
2813 ' MAXANG_HEL',angcut1_hel*rad2deg
2814 write (iout,*) 'ANGCUT_BET',angcut_bet*rad2deg,&
2815 ' MAXANG_BET',angcut1_bet*rad2deg
2816 write (iout,*) 'ANGCUT_STRAND',angcut_strand*rad2deg,&
2817 ' MAXANG_STRAND',angcut1_strand*rad2deg
2818 write (iout,*) 'FRAC_MIN',frac_min_set
2819 ! Find secondary structure elements (helices and beta-sheets)
2820 call secondary2(.true.,.false.,ncont_pept_ref,icont_pept_ref,&
2822 ! Define primary fragments. First include the helices.
2826 ! AL 12/23/03 - to avoid splitting helices into very small fragments
2827 if (merge_helices) then
2828 write (iout,*) "Before merging helices: nhfrag",nhfrag
2830 write (2,*) hfrag(1,i),hfrag(2,i)
2833 do while (i.lt.nhfrag)
2834 if (hfrag(1,i+1)-hfrag(2,i).le.1) then
2836 hfrag(2,i)=hfrag(2,i+1)
2838 hfrag(1,j)=hfrag(1,j+1)
2839 hfrag(2,j)=hfrag(2,j+1)
2844 write (iout,*) "After merging helices: nhfrag",nhfrag
2846 write (2,*) hfrag(1,i),hfrag(2,i)
2852 ifrag(1,1,i)=hfrag(1,i)
2853 ifrag(2,1,i)=hfrag(2,i)
2855 n_shift(2,i,1)=nshift_hel
2856 ang_cut(i)=angcut_hel
2857 ang_cut1(i)=angcut1_hel
2858 frac_min(i)=frac_min_set
2859 nc_fragm(i,1)=ncfrac_hel
2860 nc_req_setf(i,1)=ncreq_hel
2863 write (iout,*) "isplit_bet",isplit_bet
2864 if (isplit_bet.gt.1) then
2865 ! Split beta-sheets into strands and store strands as primary fragments.
2866 call split_beta(nbfrag,bfrag,nstrand,istrand,nhairp,ihairp)
2870 ifrag(1,1,ii)=istrand(1,i)
2871 ifrag(2,1,ii)=istrand(2,i)
2872 n_shift(1,ii,1)=nshift_strand
2873 n_shift(2,ii,1)=nshift_strand
2874 ang_cut(ii)=angcut_strand
2875 ang_cut1(ii)=angcut1_strand
2876 frac_min(ii)=frac_min_set
2881 nfrag(1)=nfrag(1)+nstrand
2882 else if (isplit_bet.eq.1) then
2883 ! Split only far beta-sheets; does not split hairpins.
2884 call find_and_remove_hairpins(nbfrag,bfrag,nhairp,ihairp)
2885 call split_beta(nbfrag,bfrag,nstrand,istrand,nhairp,ihairp)
2889 ifrag(1,1,ii)=ihairp(1,i)
2890 ifrag(2,1,ii)=ihairp(2,i)
2891 n_shift(1,ii,1)=nshift_bet
2892 n_shift(2,ii,1)=nshift_bet
2893 ang_cut(ii)=angcut_bet
2894 ang_cut1(ii)=angcut1_bet
2895 frac_min(ii)=frac_min_set
2896 nc_fragm(ii,1)=ncfrac_bet
2897 nc_req_setf(ii,1)=ncreq_bet
2900 nfrag(1)=nfrag(1)+nhairp
2904 ifrag(1,1,ii)=istrand(1,i)
2905 ifrag(2,1,ii)=istrand(2,i)
2906 n_shift(1,ii,1)=nshift_strand
2907 n_shift(2,ii,1)=nshift_strand
2908 ang_cut(ii)=angcut_strand
2909 ang_cut1(ii)=angcut1_strand
2910 frac_min(ii)=frac_min_set
2915 nfrag(1)=nfrag(1)+nstrand
2917 ! Do not split beta-sheets; each pair of strands is a primary element.
2918 call find_and_remove_hairpins(nbfrag,bfrag,nhairp,ihairp)
2922 ifrag(1,1,ii)=ihairp(1,i)
2923 ifrag(2,1,ii)=ihairp(2,i)
2924 n_shift(1,ii,1)=nshift_bet
2925 n_shift(2,ii,1)=nshift_bet
2926 ang_cut(ii)=angcut_bet
2927 ang_cut1(ii)=angcut1_bet
2928 frac_min(ii)=frac_min_set
2929 nc_fragm(ii,1)=ncfrac_bet
2930 nc_req_setf(ii,1)=ncreq_bet
2933 nfrag(1)=nfrag(1)+nhairp
2937 ifrag(1,1,ii)=bfrag(1,i)
2938 ifrag(2,1,ii)=bfrag(2,i)
2939 if (bfrag(3,i).lt.bfrag(4,i)) then
2940 ifrag(1,2,ii)=bfrag(3,i)
2941 ifrag(2,2,ii)=bfrag(4,i)
2943 ifrag(1,2,ii)=bfrag(4,i)
2944 ifrag(2,2,ii)=bfrag(3,i)
2946 n_shift(1,ii,1)=nshift_bet
2947 n_shift(2,ii,1)=nshift_bet
2948 ang_cut(ii)=angcut_bet
2949 ang_cut1(ii)=angcut1_bet
2950 frac_min(ii)=frac_min_set
2951 nc_fragm(ii,1)=ncfrac_bet
2952 nc_req_setf(ii,1)=ncreq_bet
2955 nfrag(1)=nfrag(1)+nbfrag
2957 write (iout,*) "The following primary fragments were found:"
2958 write (iout,*) "Helices:",nhfrag
2964 write (iout,'(i3,2x,a,i4,2x,a,i4)') &
2965 i,restyp(it1),i1,restyp(it2),i2
2967 write (iout,*) "Hairpins:",nhairp
2968 do i=nhfrag+1,nhfrag+nhairp
2973 write (iout,'(i3,2x,a,i4,2x,a,i4,2x)') &
2974 i,restyp(it1),i1,restyp(it2),i2
2976 write (iout,*) "Far strand pairs:",nbfrag
2977 do i=nhfrag+nhairp+1,nhfrag+nhairp+nbfrag
2986 write (iout,'(i3,2x,a,i4,2x,a,i4," and ",a,i4,2x,a,i4)') &
2987 i,restyp(it1),i1,restyp(it2),i2,&
2988 restyp(it3),i3,restyp(it4),i4
2990 write (iout,*) "Strands:",nstrand
2991 do i=nhfrag+nhairp+nbfrag+1,nfrag(1)
2996 write (iout,'(i3,2x,a,i4,2x,a,i4)') &
2997 i,restyp(it1),i1,restyp(it2),i2
2999 call imysort(nfrag(1),2,maxpiece,ifrag(1,1,1),npiece(1,1),&
3000 istruct(1),n_shift(1,1,1),ang_cut(1),ang_cut1(1),frac_min(1),&
3001 nc_fragm(1,1),nc_req_setf(1,1))
3002 write (iout,*) "Fragments after sorting:"
3008 write (iout,'(i3,2x,a,i4,2x,a,i4,$)') &
3009 i,restyp(it1),i1,restyp(it2),i2
3010 if (npiece(i,1).eq.1) then
3011 write (iout,'(2x,a)') strstr(istruct(i))
3017 write (iout,'(2x,a,i4,2x,a,i4,2x,a)') &
3018 restyp(it1),i1,restyp(it2),i2,strstr(istruct(i))
3022 end subroutine define_fragments
3023 !------------------------------------------------------------------------------
3024 subroutine find_and_remove_hairpins(nbfrag,bfrag,nhairp,ihairp)
3025 ! implicit real*8 (a-h,o-z)
3026 ! include 'DIMENSIONS'
3027 ! include 'DIMENSIONS.ZSCOPT'
3028 ! include 'DIMENSIONS.COMPAR'
3029 ! include 'COMMON.IOUNITS'
3030 integer :: nbfrag,bfrag(4,nres/3)
3031 integer :: nhairp,ihairp(2,nres/5)
3033 write (iout,*) "Entered find_and_remove_hairpins"
3034 write (iout,*) "nbfrag",nbfrag
3036 write (iout,*) i,(bfrag(k,i),k=1,4)
3040 do while (i.le.nbfrag)
3041 write (iout,*) "check hairpin:",i,(bfrag(j,i),j=1,4)
3042 if (bfrag(3,i).gt.bfrag(4,i) .and. bfrag(4,i)-bfrag(2,i).lt.5) &
3044 write (iout,*) "Found hairpin:",i,bfrag(1,i),bfrag(3,i)
3046 ihairp(1,nhairp)=bfrag(1,i)
3047 ihairp(2,nhairp)=bfrag(3,i)
3051 bfrag(k,j)=bfrag(k,j+1)
3058 write (iout,*) "After finding hairpins:"
3059 write (iout,*) "nhairp",nhairp
3061 write (iout,*) i,ihairp(1,i),ihairp(2,i)
3063 write (iout,*) "nbfrag",nbfrag
3065 write (iout,*) i,(bfrag(k,i),k=1,4)
3068 end subroutine find_and_remove_hairpins
3069 !------------------------------------------------------------------------------
3070 subroutine split_beta(nbfrag,bfrag,nstrand,istrand,nhairp,ihairp)
3071 ! implicit real*8 (a-h,o-z)
3072 ! include 'DIMENSIONS'
3073 ! include 'DIMENSIONS.ZSCOPT'
3074 ! include 'DIMENSIONS.COMPAR'
3075 ! include 'COMMON.IOUNITS'
3076 integer :: nbfrag,bfrag(4,nres/3)
3077 integer :: nstrand,istrand(2,nres/2)
3078 integer :: nhairp,ihairp(2,nres/5)
3081 write (iout,*) "Entered split_beta"
3082 write (iout,*) "nbfrag",nbfrag
3084 write (iout,*) i,(bfrag(k,i),k=1,4)
3088 write (iout,*) "calling add_strand:",i,bfrag(1,i),bfrag(2,i)
3089 call add_strand(nstrand,istrand,nhairp,ihairp,&
3090 bfrag(1,i),bfrag(2,i),found)
3091 if (bfrag(3,i).lt.bfrag(4,i)) then
3092 write (iout,*) "calling add_strand:",i,bfrag(3,i),bfrag(4,i)
3093 call add_strand(nstrand,istrand,nhairp,ihairp,&
3094 bfrag(3,i),bfrag(4,i),found)
3096 write (iout,*) "calling add_strand:",i,bfrag(4,i),bfrag(3,i)
3097 call add_strand(nstrand,istrand,nhairp,ihairp,&
3098 bfrag(4,i),bfrag(3,i),found)
3102 write (iout,*) "Strands found:",nstrand
3104 write (iout,*) i,istrand(1,i),istrand(2,i)
3107 end subroutine split_beta
3108 !------------------------------------------------------------------------------
3109 subroutine add_strand(nstrand,istrand,nhairp,ihairp,is1,is2,found)
3110 ! implicit real*8 (a-h,o-z)
3111 ! include 'DIMENSIONS'
3112 ! include 'DIMENSIONS.ZSCOPT'
3113 ! include 'DIMENSIONS.COMPAR'
3114 ! include 'COMMON.IOUNITS'
3115 integer :: nstrand,istrand(2,nres/2)
3116 integer :: nhairp,ihairp(2,nres/5)
3118 integer :: is1,is2,j,idelt
3121 idelt=(ihairp(2,j)-ihairp(1,j))/6
3122 if (is1.lt.ihairp(2,j)-idelt.and.is2.gt.ihairp(1,j)+idelt) then
3123 write (iout,*) "strand",is1,is2," is part of hairpin",&
3124 ihairp(1,j),ihairp(2,j)
3129 idelt=(istrand(2,j)-istrand(1,j))/3
3130 if (is1.lt.istrand(2,j)-idelt.and.is2.gt.istrand(1,j)+idelt) &
3132 ! The strand already exists in the array; update its ends if necessary.
3133 write (iout,*) "strand",is1,is2," found at position",j,&
3134 ":",istrand(1,j),istrand(2,j)
3135 istrand(1,j)=min0(istrand(1,j),is1)
3136 istrand(2,j)=max0(istrand(2,j),is2)
3140 ! The strand has not been found; add it to the array.
3141 write (iout,*) "strand",is1,is2," added to the array."
3144 istrand(1,nstrand)=is1
3145 istrand(2,nstrand)=is2
3147 end subroutine add_strand
3148 !------------------------------------------------------------------------------
3149 subroutine secondary2(lprint,lprint_sec,ncont,icont,isecstr)
3151 use geometry_data, only:anatemp,rad2deg,phi,nstart_sup,nend_sup
3152 use energy_data, only:itype,maxcont
3153 use compare_data, only:bfrag,hfrag,nbfrag,nhfrag
3154 use compare, only:freeres
3155 ! implicit real*8 (a-h,o-z)
3156 ! include 'DIMENSIONS'
3157 ! include 'DIMENSIONS.ZSCOPT'
3158 ! include 'COMMON.IOUNITS'
3159 ! include 'COMMON.FRAG'
3160 ! include 'COMMON.VAR'
3161 ! include 'COMMON.GEO'
3162 ! include 'COMMON.CHAIN'
3163 ! include 'COMMON.NAMES'
3164 ! include 'COMMON.INTERACT'
3165 integer :: ncont,icont(2,maxcont),isec(nres,4),nsec(nres),&
3167 logical :: lprint,lprint_sec,not_done !el,freeres
3168 integer :: i,j,ii1,jj1,i1,j1,ij,k,ien,ist
3169 integer :: nstrand,nbeta,nhelix,iii1,jjj1
3170 real(kind=8) :: p1,p2
3171 !rel external freeres
3172 character(len=1) :: csec(0:2)=reshape((/'-','E','H'/),shape(csec))
3174 write (iout,*) "entered secondary2",ncont
3175 write (iout,*) "nstart_sup",nstart_sup," nend_sup",nend_sup
3177 write (iout,*) icont(1,i),icont(2,i)
3191 ! finding parallel beta
3192 !d write (iout,*) '------- looking for parallel beta -----------'
3198 if (i1.ge.nstart_sup .and. i1.le.nend_sup &
3199 .and. j1.gt.nstart_sup .and. j1.le.nend_sup) then
3200 !d write (iout,*) "parallel",i1,j1
3201 if(j1-i1.gt.5 .and. freeres(i1,j1,nsec,isec)) then
3204 !d write (iout,*) i1,j1
3210 if (i1.eq.icont(1,j) .and. j1.eq.icont(2,j) .and. &
3211 freeres(i1,j1,nsec,isec)) goto 5
3215 !d write (iout,*) i1,j1,not_done
3219 if (i1-ii1.gt.1) then
3223 if(lprint)write(iout,'(a,i3,4i4)')'parallel beta',&
3227 bfrag(1,nbfrag)=ii1+1
3228 bfrag(2,nbfrag)=i1+1
3229 bfrag(3,nbfrag)=jj1+1
3230 bfrag(4,nbfrag)=min0(j1+1,nres)
3234 isec(ij,nsec(ij))=nbeta
3238 isec(ij,nsec(ij))=nbeta
3243 if (nbeta.le.9) then
3244 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
3245 "DefPropRes 'strand",nstrand,&
3246 "' 'num = ",ii1-1,"..",i1-1,"'"
3248 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
3249 "DefPropRes 'strand",nstrand,&
3250 "' 'num = ",ii1-1,"..",i1-1,"'"
3253 if (nbeta.le.9) then
3254 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
3255 "DefPropRes 'strand",nstrand,&
3256 "' 'num = ",jj1-1,"..",j1-1,"'"
3258 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
3259 "DefPropRes 'strand",nstrand,&
3260 "' 'num = ",jj1-1,"..",j1-1,"'"
3262 write(12,'(a8,4i4)') &
3263 "SetNeigh",ii1-1,i1-1,jj1-1,j1-1
3267 endif ! i1.ge.nstart_sup .and. i1.le.nend_sup .and. i2.gt.nstart_sup .and. i2.le.nend_sup
3270 ! finding antiparallel beta
3271 !d write (iout,*) '--------- looking for antiparallel beta ---------'
3276 if (freeres(i1,j1,nsec,isec)) then
3279 !d write (iout,*) i1,j1
3286 if (i1.eq.icont(1,j).and.j1.eq.icont(2,j) .and. &
3287 freeres(i1,j1,nsec,isec)) goto 6
3291 !d write (iout,*) i1,j1,not_done
3295 if (i1-ii1.gt.1) then
3299 bfrag(2,nbfrag)=min0(i1+1,nres)
3300 bfrag(3,nbfrag)=min0(jj1+1,nres)
3307 if (nsec(ij).le.2) then
3308 isec(ij,nsec(ij))=nbeta
3314 if (nsec(ij).le.2) then
3315 isec(ij,nsec(ij))=nbeta
3320 if (lprint_sec) then
3321 write (iout,'(a,i3,4i4)')'antiparallel beta',&
3322 nbeta,ii1-1,i1,jj1,j1-1
3324 if (nstrand.le.9) then
3325 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
3326 "DefPropRes 'strand",nstrand,&
3327 "' 'num = ",ii1-2,"..",i1-1,"'"
3329 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
3330 "DefPropRes 'strand",nstrand,&
3331 "' 'num = ",ii1-2,"..",i1-1,"'"
3334 if (nstrand.le.9) then
3335 write(12,'(a18,i1,a9,i3,a2,i3,a1)') &
3336 "DefPropRes 'strand",nstrand,&
3337 "' 'num = ",j1-2,"..",jj1-1,"'"
3339 write(12,'(a18,i2,a9,i3,a2,i3,a1)') &
3340 "DefPropRes 'strand",nstrand,&
3341 "' 'num = ",j1-2,"..",jj1-1,"'"
3343 write(12,'(a8,4i4)') &
3344 "SetNeigh",ii1-2,i1-1,jj1-1,j1-2
3350 !d write (iout,*) "After beta:",nbfrag
3352 !d write (iout,*) (bfrag(j,i),j=1,4)
3355 if (nstrand.gt.0.and.lprint_sec) then
3356 write(12,'(a27,$)') "DefPropRes 'sheet' 'strand1"
3359 write(12,'(a9,i1,$)') " | strand",i
3361 write(12,'(a9,i2,$)') " | strand",i
3364 write(12,'(a1)') "'"
3368 ! finding alpha or 310 helix
3374 p1=phi(i1+2)*rad2deg
3376 if (j1+2.le.nres) p2=phi(j1+2)*rad2deg
3379 if (j1.eq.i1+3 .and. &
3380 ((p1.ge.10.and.p1.le.80).or.i1.le.2).and. &
3381 ((p2.ge.10.and.p2.le.80).or.j1.le.2.or.j1.ge.nres-3) )then
3382 !d if (j1.eq.i1+3) write (iout,*) "found 1-4 ",i1,j1,p1,p2
3383 !o if (j1.eq.i1+4) write (iout,*) "found 1-5 ",i1,j1,p1,p2
3386 if (nsec(ii1).eq.0) then
3395 if (i1.eq.icont(1,j) .and. j1.eq.icont(2,j)) goto 10
3399 p1=phi(i1+2)*rad2deg
3400 p2=phi(j1+2)*rad2deg
3401 if (p1.lt.10.or.p1.gt.80.or.p2.lt.10.or.p2.gt.80) &
3404 !d write (iout,*) i1,j1,not_done,p1,p2
3407 if (j1-ii1.gt.4) then
3409 !d write (iout,*)'helix',nhelix,ii1,j1
3418 if (lprint_sec) then
3419 write (iout,'(a,i3,2i4)') "Helix",nhelix,ii1-1,j1-1
3420 if (nhelix.le.9) then
3421 write(12,'(a17,i1,a9,i3,a2,i3,a1)') &
3422 "DefPropRes 'helix",nhelix,&
3423 "' 'num = ",ii1-1,"..",j1-2,"'"
3425 write(12,'(a17,i2,a9,i3,a2,i3,a1)') &
3426 "DefPropRes 'helix",nhelix,&
3427 "' 'num = ",ii1-1,"..",j1-2,"'"
3434 if (nhelix.gt.0.and.lprint_sec) then
3435 write(12,'(a26,$)') "DefPropRes 'helix' 'helix1"
3437 if (nhelix.le.9) then
3438 write(12,'(a8,i1,$)') " | helix",i
3440 write(12,'(a8,i2,$)') " | helix",i
3443 write(12,'(a1)') "'"
3446 if (lprint_sec) then
3447 write(12,'(a37)') "DefPropRes 'coil' '! (helix | sheet)'"
3448 write(12,'(a20)') "XMacStand ribbon.mac"
3453 write(iout,*) 'UNRES seq:',anatemp
3455 write(iout,*) 'beta ',(bfrag(i,j),i=1,4)
3459 write(iout,*) 'helix ',(hfrag(i,j),i=1,2),anatemp
3465 do k=min0(bfrag(1,j),bfrag(2,j)),max0(bfrag(1,j),bfrag(2,j))
3468 do k=min0(bfrag(3,j),bfrag(4,j)),max0(bfrag(3,j),bfrag(4,j))
3473 do k=hfrag(1,j),hfrag(2,j)
3479 write (iout,*) "Secondary structure"
3484 write (iout,'(8(7x,i3))') (k,k=ist+9,ien,10)
3485 write (iout,'(80a1)') (onelet(itype(k)),k=ist,ien)
3486 write (iout,'(80a1)') (csec(isecstr(k)),k=ist,ien)
3491 end subroutine secondary2
3492 !-------------------------------------------------
3493 ! logical function freeres(i,j,nsec,isec)
3494 ! include 'DIMENSIONS'
3495 ! integer :: isec(nres,4),nsec(nres)
3496 ! integer :: i,j,k,l
3499 ! if (nsec(i).gt.1.or.nsec(j).gt.1) return
3502 ! if (isec(i,k).eq.isec(j,l)) return
3507 ! end function freeres
3508 !-------------------------------------------------
3509 subroutine alloc_compar_arrays(nfrg,nlev)
3511 use energy_data, only:maxcont
3513 integer :: nfrg,nlev
3515 !write(iout,*) "in alloc conpar arrays: nlevel=", nlevel," nfrag(1)=",nfrag(1)
3516 !------------------------
3519 allocate(nsccont_frag_ref(mmaxfrag)) !(mmaxfrag) !wham
3520 allocate(isccont_frag_ref(2,maxcont,mmaxfrag)) !(2,maxcont,mmaxfrag) !wham
3521 !------------------------
3524 allocate(rmsfrag(nfrg,nlev+1),nc_fragm(nfrg,nlev+1)) !(maxfrag,maxlevel)
3525 allocate(qfrag(nfrg,2)) !(maxfrag,2)
3526 allocate(rmscutfrag(2,nfrg,nlev+1)) !(2,maxfrag,maxlevel)
3527 allocate(ang_cut(nfrg),ang_cut1(nfrg),frac_min(nfrg)) !(maxfrag)
3528 allocate(nc_req_setf(nfrg,nlev+1),npiece(nfrg,nlev+1),&
3529 ielecont(nfrg,nlev+1),isccont(nfrg,nlev+1),irms(nfrg,nlev+1),&
3530 ishifft(nfrg,nlev+1),len_frag(nfrg,nlev+1)) !(maxfrag,maxlevel)
3531 allocate(ncont_nat(2,nfrg,nlev+1))
3532 allocate(n_shift(2,nfrg,nlev+1)) !(2,maxfrag,maxlevel)
3533 ! allocate(nfrag(nlev)) !(maxlevel)
3534 allocate(isnfrag(nlev+2)) !(maxlevel+1)
3535 allocate(ifrag(2,maxpiece,nfrg)) !(2,maxpiece,maxfrag)
3536 allocate(ipiece(maxpiece,nfrg,2:nlev+1)) !(maxpiece,maxfrag,2:maxlevel)
3537 allocate(istruct(nfrg),iloc(nfrg),nlist_frag(nfrg)) !(maxfrag)
3538 allocate(iclass(nlev*nfrg,nlev+1)) !(maxlevel*maxfrag,maxlevel)
3539 allocate(list_frag(nres,nfrg)) !(maxres,maxfrag)
3540 !------------------------
3543 ! integer,dimension(:,:),allocatable :: icont_pept_ref !(2,maxcont)
3544 allocate(ncont_frag_ref(mmaxfrag)) !(mmaxfrag)
3545 allocate(icont_frag_ref(2,maxcont,mmaxfrag)) !(2,maxcont,mmaxfrag)
3546 ! integer,dimension(:),allocatable :: isec_ref !(maxres)
3547 !------------------------
3548 ! module w_comm_local
3550 allocate(creff(3,2*nres),cc(3,2*nres)) !(3,nres*2)
3551 allocate(iadded(nres)) !(nres)
3552 allocate(inumber(2,nres)) !(2,nres)
3555 !-------------------------------------------------------------------------------
3556 end subroutine alloc_compar_arrays
3558 !-------------------------------------------------------------------------------
3559 end module conform_compar