Merge branch 'homology' of mmka.chem.univ.gda.pl:unres into homology
[unres.git] / source / unres / src_CSA / diff12.f
1 cccccccccccccccccccccccccccccccccc
2       subroutine get_diff12(aarray,barray,diff)
3       implicit real*8 (a-h,o-z)
4       include 'DIMENSIONS'
5       include 'COMMON.CSA'
6       include 'COMMON.BANK'
7       include 'COMMON.CHAIN'
8       include 'COMMON.GEO'
9       include 'COMMON.INTERACT'
10       include 'COMMON.VAR'
11       dimension aarray(mxang,maxres,mxch),
12      & barray(mxang,maxres,mxch)
13       real x1(maxres),y1(maxres),z1(maxres)
14       integer n_1(maxres),L1
15       real x2(maxres),y2(maxres),z2(maxres)
16       integer n_2(maxres),L2
17       real TM,Rcomm
18       integer Lcomm
19
20
21       IF(tm_score) THEN
22
23       do k=1,numch
24        do j=2,nres-1
25         theta(j+1)=barray(1,j,k)
26         phi(j+2)=barray(2,j,k)
27         alph(j)=barray(3,j,k)
28         omeg(j)=barray(4,j,k)
29        enddo
30       enddo
31       call chainbuild
32       L1=0
33       do i=nnt,nct
34         L1=L1+1
35          n_1(L1)=L1
36          x1(L1)=c(1,i)
37          y1(L1)=c(2,i)
38          z1(L1)=c(3,i)
39       enddo
40
41       do k=1,numch
42        do j=2,nres-1
43         theta(j+1)=aarray(1,j,k)
44         phi(j+2)=aarray(2,j,k)
45         alph(j)=aarray(3,j,k)
46         omeg(j)=aarray(4,j,k)
47        enddo
48       enddo
49       call chainbuild
50       L2=0
51       do i=nnt,nct
52         L2=L2+1
53          n_2(L2)=L2
54          x2(L2)=c(1,i)
55          y2(L2)=c(2,i)
56          z2(L2)=c(3,i)
57       enddo
58
59       call TMscore(L1,x1,y1,z1,n_1,L2,x2,y2,z2,n_2,TM,Rcomm,Lcomm)
60       diff=1.0d0-TM
61
62 cd      write(*,*)'TMscore=',TM,diff
63 cd      write(*,*)'Number of residues in common=',Lcomm
64 cd      write(*,*)'RMSD of the common residues=',Rcomm
65
66       ELSE
67       diff=0.d0
68       do k=1,numch
69        do j=2,nres-1
70 c       do i=1,4
71 c        do i=1,2
72         do i=1,ndiff
73          dif=rad2deg*dabs(aarray(i,j,k)-barray(i,j,k))
74          if(dif.gt.180.) dif=360.-dif
75          if (dif.gt.diffcut) diff=diff+dif
76         enddo
77        enddo
78       enddo
79       ENDIF
80       return
81       end
82 ccccccccccccccccccccccccccccccccccccccccccccccccc