subroutine conf_compar(jcon,ib,iprot,nn,iscor,sbin,lprn) implicit none include 'DIMENSIONS' include 'DIMENSIONS.ZSCOPT' #ifdef MPI include "mpif.h" integer IERROR,ERRCODE,kolor,key,comm include "COMMON.MPI" #endif include 'DIMENSIONS.COMPAR' include 'COMMON.IOUNITS' include 'COMMON.COMPAR' include 'COMMON.CHAIN' include 'COMMON.INTERACT' include 'COMMON.VAR' include 'COMMON.PEPTCONT' include 'COMMON.CONTACTS1' include 'COMMON.HEADER' include 'COMMON.CLASSES' include 'COMMON.GEO' include 'COMMON.ENERGIES' logical lprn,lprn1,lprn2,lsig_match integer ncont_frag(mmaxfrag), & icont_frag(2,maxcont,mmaxfrag),ncontsc, & icontsc(1,maxcont),nsccont_frag(mmaxfrag), & isccont_frag(2,maxcont,mmaxfrag) integer jcon,ib,iprot,iscor,nn,lat integer i,j,k,ik,kk,ind,icant,ncnat,nsec_match,nsec_nomatch, & ishif1,ishif2, & nc_match,ncon_match,ishif,iclass_con,ishifft_con,iclass_rms, & iclass_q,ishifft_rms,ishiff,idig,iex,im integer isecstr(maxres) integer itemp(maxfrag) double precision rmscalc,rms,rmsnat,qwolynes double precision sig_frag(maxfrag) character*4 liczba character*64 sbin lprn1=lprn .and. print_contact lprn2=lprn .and. print_secondary c print *,"Enter conf_compar",jcon call angnorm12(rmsang,iprot) rmsang=rmsang*rad2deg c if (lprn) then c write (liczba,'(bz,i4.4)') jcon c open(ipdb,file=prefintin(:ilen(prefintin))//liczba//".pdb") c call pdbout(energy(jcon),titel) c write(iout,*) "Protein",iprot," conformation",jcon, c & " nlevel",nlevel(iprot) c endif c if (lprn) then c write (iout,*) "CONF_COMPAR: Complete reference structure" c do i=1,nres c write(iout,'(i4,3f10.5)') i,(cref(j,i,iprot),j=1,3) c enddo c endif c Level 1: check secondary and supersecondary structure call elecont(lprn2,ncont,icont,nnt,nct) call secondary2(lprn1,.false.,ncont,icont,isecstr,iprot) call contact(lprn2,ncontsc,icontsc,nnt,nct) if (lprn) write(iout,*) "Assigning electrostatic contacts" call contacts_between_fragments(lprn,3,ncont,icont,ncont_frag, & icont_frag,mask_p(1,ib,iprot),ib,iprot) if (lprn) write(iout,*) "Assigning sidechain contacts" call contacts_between_fragments(lprn,3,ncontsc,icontsc, & nsccont_frag,isccont_frag,mask_sc(1,ib,iprot),ib,iprot) do i=1,nlevel(iprot) do j=1,isnfrag(nlevel(iprot)+1,iprot) iclass1(j,i)=0 enddo enddo do j=1,nfrag(1,iprot) ind = icant(j,j) if (lprn) then write (iout,'(80(1h=))') write (iout,*) "Level",1," fragment",j write (iout,'(80(1h=))') endif rmsfrag(j,1)=rmscalc(0,1,j,jcon,ib,iprot,lprn) c Compare electrostatic contacts in the current conf with that in the native c structure. if (lprn) write (iout,*) & "Comparing electrostatic contact map and local structure", & " conformation",jcon," protein",iprot ncnat=ncont_frag_ref(ind,ib,iprot) c write (iout,*) "before match_contact:",nc_fragm(j,1,ib,iprot), c & nc_req_setf(j,1,ib,iprot) call match_secondary(j,isecstr,nsec_match,nsec_nomatch, & sig_frag(j),ib,iprot,lprn) if (lprn) write (iout,*) "Fragment",j," nsec_match", & nsec_match," nsec_nomatch",nsec_nomatch, & " length",len_frag(j,1,ib,iprot)," min_len", & frac_sec(ib,iprot)*len_frag(j,1,ib,iprot)," sig_frag", & sig_frag(j) if (nsec_match.ge.frac_sec(ib,iprot)*len_frag(j,1,ib,iprot)) & then iclass1(j,1)=1 if (lprn) write (iout,*) "Fragment",j, & " has correct secondary structure" else if (nsec_nomatch.ge. & frac_sec(ib,iprot)*len_frag(j,1,ib,iprot)/2) then iclass1(j,1)=4 if (lprn) write (iout,*) "Fragment",j, & " has wrong secondary structure" else iclass1(j,1)=0 if (lprn) write (iout,*) "Fragment",j, & " has grossly incorrect secondary structure" endif if (ielecont(j,1,ib,iprot).gt.0) then call match_contact(ishif1,ishif2,nc_match,ncon_match, & ncont_frag_ref(ind,ib,iprot), & icont_frag_ref(1,1,ind,ib,iprot), & ncont_frag(ind),icont_frag(1,1,ind), & j,n_shift(1,j,1,ib,iprot),n_shift(2,j,1,ib,iprot), & nc_fragm(j,1,ib,iprot),nc_req_setf(j,1,ib,iprot), & istruct(j,ib,iprot),.true.,ib,iprot,lprn) else if (isccont(j,1,ib,iprot).gt.0) then call match_contact(ishif1,ishif2,nc_match,ncon_match, & nsccont_frag_ref(ind,ib,iprot), & isccont_frag_ref(1,1,ind,ib,iprot), & nsccont_frag(ind),isccont_frag(1,1,ind),j, & n_shift(1,j,1,ib,iprot),n_shift(2,j,1,ib,iprot), & nc_fragm(j,1,ib,iprot), & nc_req_setf(j,1,ib,iprot),istruct(j,ib,iprot),.true.,ib, & iprot,lprn) else if (iloc(j,ib,iprot).gt.0) then call match_contact(ishif1,ishif2,nc_match,ncon_match, & 0,icont_frag_ref(1,1,ind,ib,iprot),ncont_frag(ind), & icont_frag(1,1,ind),j,n_shift(1,j,1,ib,iprot), & n_shift(2,j,1,ib,iprot),nc_fragm(j,1,ib,iprot), & 0,istruct(j,ib,iprot),.true.,ib,iprot,lprn) else ishif=0 nc_match=1 endif qfrag(j,1)=qwolynes(1,j,ib,iprot) if (iqwol(j,1,ib,iprot).gt.0) then if (qfrag(j,1).le.qcutfrag(j,1,ib,iprot)) then iclass_q = 2 else iclass_q = 0 endif else iclass_q = 2 endif lsig_match=isig_match(j,ib,iprot).eq.0 .or. sig_frag(j).gt.0.0d0 if (lprn) write (iout,*) "ishif1",ishif1," ishif2",ishif2 ishif=ishif1 if (iabs(ishif2).gt.iabs(ishif1)) ishif=ishif2 if (lprn) write (iout,*) "Ishift",ishif," nc_match",nc_match c write (iout,*) iprot,j," irms",irms(j,1,ib,iprot) if (irms(j,1,ib,iprot).gt.0) then if (rmsfrag(j,1).le.rmscutfrag(1,j,1,ib,iprot)) then iclass_rms=2 ishifft_rms=0 else ishiff=0 rms=1.0d2 iclass_rms=0 do while (rms.gt.rmscutfrag(1,j,1,ib,iprot) .and. & ishiff.lt.n_shift(1,j,1,ib,iprot)) ishiff=ishiff+1 rms=rmscalc(-ishiff,1,j,jcon,ib,iprot,lprn) c write(iout,*)"jcon,i,j,ishiff",jcon,i,j,-ishiff, c & " rms",rms," rmscut",rmscutfrag(1,j,1,ib,iprot) if (lprn) write (iout,*) "rms",rmsfrag(j,1) if (rms.gt.rmscutfrag(1,j,1,ib,iprot)) then rms=rmscalc(ishiff,1,j,jcon,ib,iprot,lprn) c write (iout,*) "jcon,1,j,ishiff",jcon,1,j,ishiff, c & " rms",rms endif if (lprn) write (iout,*) "rms",rmsfrag(j,1) enddo c write (iout,*) "After loop: rms",rms, c & " rmscut",rmscutfrag(1,j,1,ib,iprot) c write (iout,*) "iclass_rms",iclass_rms if (rms.le.rmscutfrag(1,j,1,ib,iprot)) then ishifft_rms=ishiff rmsfrag(j,1)=rms iclass_rms=1 endif c write (iout,*) "iclass_rms",iclass_rms endif c write (iout,*) "ishif",ishif if (iabs(ishifft_rms).gt.iabs(ishif)) ishif=ishifft_rms else iclass_rms=1 endif c write (iout,*) "ishif",ishif," iclass",iclass1(j,1), c & " iclass_rms",iclass_rms if (iclass1(j,1).ne.4 .and. nc_match.gt.0 .and. & iclass_rms.gt.0 .and. iclass_q.gt.0 .and. lsig_match) then if (ishif.eq.0) then iclass1(j,1)=iclass1(j,1)+6 else iclass1(j,1)=iclass1(j,1)+2 endif endif ncont_nat(1,j,1)=nc_match ncont_nat(2,j,1)=ncon_match ishifft(j,1)=ishif enddo c Next levels: Check arrangements of elementary fragments. do i=2,nlevel(iprot) do j=1,nfrag(i,iprot) if (i .eq. 2) ind = icant(ipiece(1,j,i,ib,iprot), & ipiece(2,j,i,ib,iprot)) if (lprn) then write (iout,'(80(1h=))') write (iout,*) "Level",i," fragment",j write (iout,'(80(1h=))') endif c If an elementary fragment doesn't exist, don't check higher hierarchy levels. c 3/4/03 AL No, we consider the existence of a composite fragment even if c the corresponding elementary fragments are incomplete. c c do k=1,npiece(j,i,ib,iprot) c ik=ipiece(k,j,i,ib,iprot) c if (iclass1(ik,1).eq.0) then c iclass1(j,i)=0 c goto 12 c endif c enddo if (i.eq.2 .and. ielecont(j,i,ib,iprot).gt.0) then iclass_con=0 ishifft_con=0 if (lprn) write (iout,*) & "Comparing electrostatic contact map: fragments", & ipiece(1,j,i,ib,iprot),ipiece(2,j,i,ib,iprot)," ind",ind call match_contact(ishif1,ishif2,nc_match,ncon_match, & ncont_frag_ref(ind,ib,iprot), & icont_frag_ref(1,1,ind,ib,iprot), & ncont_frag(ind),icont_frag(1,1,ind), & j,n_shift(1,j,i,ib,iprot),n_shift(2,j,i,ib,iprot), & nc_fragm(j,i,ib,iprot), & nc_req_setf(j,i,ib,iprot),2,.false.,ib,iprot,lprn) ishif=ishif1 if (iabs(ishif2).gt.iabs(ishif1)) ishif=ishif2 if (nc_match.gt.0) then if (ishif.eq.0) then iclass_con=2 else iclass_con=1 endif endif ncont_nat(1,j,i)=nc_match ncont_nat(2,j,i)=ncon_match ishifft_con=ishif else if (i.eq.2 .and. isccont(j,i,ib,iprot).gt.0) then iclass_con=0 ishifft_con=0 if (lprn) write (iout,*) & "Comparing sidechain contact map: fragments", & ipiece(1,j,i,ib,iprot),ipiece(2,j,i,ib,iprot)," ind",ind call match_contact(ishif1,ishif2,nc_match,ncon_match, & nsccont_frag_ref(ind,ib,iprot), & isccont_frag_ref(1,1,ind,ib,iprot), & nsccont_frag(ind),isccont_frag(1,1,ind), & j,n_shift(1,j,i,ib,iprot),n_shift(2,j,i,ib,iprot), & nc_fragm(j,i,ib,iprot), & nc_req_setf(j,i,ib,iprot),2,.false.,ib,iprot,lprn) ishif=ishif1 if (iabs(ishif2).gt.iabs(ishif1)) ishif=ishif2 if (nc_match.gt.0) then if (ishif.eq.0) then iclass_con=2 else iclass_con=1 endif endif ncont_nat(1,j,i)=nc_match ncont_nat(2,j,i)=ncon_match ishifft_con=ishif else if (i.eq.2) then iclass_con=2 ishifft_con=0 endif if (i.eq.2) then qfrag(j,2)=qwolynes(2,j,ib,iprot) if (iqwol(j,i,ib,iprot).gt.0) then if (qfrag(j,2).le.qcutfrag(j,2,ib,iprot)) then iclass_q = 2 else iclass_q = 0 endif else iclass_q = 2 endif else iclass_q = 2 endif if (irms(j,i,ib,iprot).gt.0) then iclass_rms=0 ishifft_rms=0 if (lprn) write (iout,*) & "Comparing rms: fragments", & (ipiece(k,j,i,ib,iprot),k=1,npiece(j,i,ib,iprot)) rmsfrag(j,i)=rmscalc(0,i,j,jcon,ib,iprot,lprn) if (lprn) write (iout,*) "rms",rmsfrag(j,i), & " rmscut",rmscutfrag(1,j,i,ib,iprot) if (rmsfrag(j,i).le.rmscutfrag(1,j,i,ib,iprot)) then iclass_rms=2 ishifft_rms=0 else ishif=0 rms=1.0d2 do while (rms.gt.rmscutfrag(1,j,i,ib,iprot) .and. & ishif.lt.n_shift(1,j,i,ib,iprot)) ishif=ishif+1 rms=rmscalc(-ishif,i,j,jcon,ib,iprot,lprn) if (lprn) write (iout,*) "rms",rms, & " rmscut",rmscutfrag(1,j,i,ib,iprot) c print *,"jcon,i,j,ishif",jcon,i,j,-ishif," rms",rms if (rms.gt.rmscutfrag(1,j,i,ib,iprot)) then rms=rmscalc(ishif,i,j,jcon,ib,iprot,lprn) c print *,"jcon,i,j,ishif",jcon,i,j,ishif," rms",rms endif if (lprn) write (iout,*) "rms",rms, & " rmscut",rmscutfrag(1,j,i,ib,iprot) enddo if (rms.le.rmscutfrag(1,j,i,ib,iprot)) then ishifft_rms=ishif rmsfrag(j,i)=rms iclass_rms=1 endif endif endif if (irms(j,i,ib,iprot).eq.0 .and. ielecont(j,i,ib,iprot).eq.0 & .and. isccont(j,i,ib,iprot).eq.0 & .and. iqwol(j,i,ib,iprot).eq.0) then write (iout,*) "Error: no measure of comparison specified:", & " level",i," part",j stop endif if (lprn) & write (iout,*) "iclass_con",iclass_con," iclass_rms",iclass_rms if (i.eq.2) then iclass1(j,i) = min0(iclass_con,iclass_rms,iclass_q) ishifft(j,i)= max0(ishifft_con,ishifft_rms) else if (i.gt.2) then iclass1(j,i) = iclass_rms ishifft(j,i)= ishifft_rms endif 12 continue enddo enddo rms_nat=rmsnat(jcon,iprot) qnat=qwolynes(0,0,ib,iprot) if (lprn) write (iout,*) "rmsnat",rms_nat," qnat",qnat C Compute the structural class iscor=0 do i=1,nlevel(iprot) IF (I.EQ.1) THEN do j=1,nfrag(i,iprot) itemp(j)=iclass1(j,i) enddo do kk=-1,1 do j=1,nfrag(i,iprot) idig = 2*isnfrag(nlevel(iprot)+1,iprot)-2*isnfrag(i,iprot) & -kk*nfrag(i,iprot)-j iex = 2**idig im=mod(itemp(j),2) itemp(j)=itemp(j)/2 c write (iout,*) "i",i," j",j," idig",idig," iex",iex, c & " iclass",iclass1(j,i)," im",im if (.not.binary(iprot)) iscor=iscor+im*iex write (sbin(nn-idig:nn-idig),'(i1)') im enddo enddo ELSE do j=1,nfrag(i,iprot) idig = 2*isnfrag(nlevel(iprot)+1,iprot)-2*isnfrag(i,iprot)-j iex = 2**idig if (iclass1(j,i).gt.0) then im=1 else im=0 endif c write (iout,*) "i",i," j",j," idig",idig," iex",iex, c & " iclass",iclass1(j,i)," im",im if (.not. binary(iprot)) iscor=iscor+im*iex write (sbin(nn-idig:nn-idig),'(i1)') im enddo do j=1,nfrag(i,iprot) idig = 2*isnfrag(nlevel(iprot)+1,iprot)-2*isnfrag(i,iprot) & -nfrag(i,iprot)-j iex = 2**idig if (iclass1(j,i).gt.1) then im=1 else im=0 endif c write (iout,*) "i",i," j",j," idig",idig," iex",iex, c & " iclass",iclass1(j,i)," im",im write (sbin(nn-idig:nn-idig),'(i1)') im if (.not. binary(iprot)) iscor=iscor+im*iex enddo ENDIF enddo if (lprn) then write (iout,'(i5,$)') jcon do i=1,nlevel(iprot) write (iout,'(i5,$)') i if (i.eq.1) then do j=1,nfrag(i,iprot) write (iout,'(2i4,f6.2,i3,$)') ncont_nat(1,j,i), & ncont_nat(2,j,i),rmsfrag(j,i),ishifft(j,i) enddo else do j=1,nfrag(i,iprot) write (iout,'(f6.2,i3,$)') rmsfrag(j,i),ishifft(j,i) enddo endif write (iout,'(" ",$)') do j=1,nfrag(i,iprot) write (iout,'(i1,$)') iclass1(j,i) enddo enddo if (binary(iprot)) then write (iout,'(" ",$)') do j=1,nlevel(iprot) write (iout,'(100(i1,$))')(iclass1(k,j),k=1, & nfrag(j,iprot),iprot) if (j.lt.nlevel(iprot)) write(iout,'(".",$)') enddo write (iout,'(f6.2)') rms_nat else write (iout,'(i10,f6.2)') iscor,rms_nat endif endif if (print_class) then write(istat,'(i5,2f10.2,f8.3,2f6.3,$)') & jcon,eini(jcon,iprot),entfac(jcon,iprot), & rms_nat,qnat,rmsang/(nct-nnt-2) do j=1,nlevel(iprot) write(istat,'(1x,20(i3,$))') & (ncont_nat(1,k,j),k=1,nfrag(j,iprot)) if (j.eq.1) write (istat,'(1x,f4.1,$)') & (sig_frag(k),k=1,nfrag(j,iprot)) if (j.lt.3) then write (istat,'(1x,20(f5.1,f5.2,$))') & (rmsfrag(k,j),qfrag(k,j),k=1,nfrag(j,iprot)) else write(istat,'(1x,20(f5.1,$))') & (rmsfrag(k,j),k=1,nfrag(j,iprot)) endif write(istat,'(1x,20(i1,$))') & (iclass1(k,j),k=1,nfrag(j,iprot)) enddo if (binary(iprot)) then write (istat,'(" ",$)') do j=1,nlevel(iprot) write (istat,'(100(i1,$))')(iclass1(k,j), & k=1,nfrag(j,iprot)) if (j.lt.nlevel(iprot)) write(istat,'(".",$)') enddo write (istat,'(i10,i3)') iscore(jcon,0,iprot),ib else write (istat,'(2i10,i3)') iscor,iscore(jcon,0,iprot),ib endif endif RETURN END