source: contacts.f@ e40e335

Last change on this file since e40e335 was e40e335, checked in by baerbaer <baerbaer@…>, 16 years ago

Initial import to BerliOS corresponding to 3.0.4

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/smmp/trunk@1 26dc1dd8-5c4e-0410-9ffe-d298b4865968

  • Property mode set to 100644
File size: 4.7 KB
Line 
1c **************************************************************
2c
3c This file contains the subroutines: contacts,c_alfa,c_cont
4c
5c Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,
6c Shura Hayryan, Chin-Ku
7c Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann,
8c Jan H. Meinke, Sandipan Mohanty
9c
10c **************************************************************
11
12 subroutine contacts(ncn,nham2,dham)
13
14c ..............................................................
15c
16c CALCULATES NUMBER OF CONTACTS IN GIVEN CONFORMATION, NUMBER OF
17c CONTACTS WHICH ARE THE SAME IN GIVEN AND REFERENCE ONFORMATION,
18c AND THE HAMMING DISTANCE BETWEEN GIVEN CONFORMATION AND THE
19c REFERENCE CONFORMATIONa
20c
21c CALLS: c_cont
22c ..............................................................
23
24 include 'INCL.H'
25
26!f2py integer, intent(out) :: ncn, nham2
27!f2py double precistion, intent(out) :: dham
28
29 call c_cont(1,ncode)
30
31 ncn=0
32 nham=0
33 nham2=0
34 nresi=irsml2(1)-irsml1(1)+1
35 do i=1,nresi
36 do j=nresi,i+3,-1
37
38 if (ijcont(i,j).eq.1) then
39 ncn=ncn+1
40 if (iref(i,j).eq.1) nham2 = nham2+1
41 end if
42
43 nham = nham + abs(ijcont(i,j)-iref(i,j))
44 end do
45 end do
46
47 if (ncn.ne.0.and.nci.ne.0) then
48 dham = float(nham)/float(ncn)/float(nci)
49 else
50 dham = 1.0
51 end if
52
53 return
54 end
55
56
57c *********************************
58 subroutine c_alfa(nmol,ncode)
59
60c ......................................................
61c Calculates the indices of C-alpha atoms and
62c stores in the array ind_alf(mxrs)
63c
64c Usage: call c_alfa(nmol,ncode)
65c
66c nmol - index of the molecule
67c ncode ---> not in use in the current version
68c
69c OUTPUT: ind_alf(mxrs)
70c
71c CALLS: none
72c ......................................................
73
74 include 'INCL.H'
75
76 do n_res=irsml1(nmol),irsml2(nmol) ! Over res.
77 do ia=iatrs1(n_res),iatrs2(n_res) ! Over the atoms of res.
78
79c Check for C_alpha atoms
80
81 if (nmat(ia)(1:2).eq.'ca') then
82 ind_alf(n_res)=ia
83 endif
84
85 enddo ! Over the atoms of res.
86 enddo ! Over the res.
87
88 return
89 end
90
91c **********************************
92 subroutine c_cont (nmol,ncode)
93
94c..............................................................
95c Calculates the matrix of contacts between aminoacid residues
96c of the molecule "nmol" according to L.Mirny and E.Domany,
97c PROTEINS:Structure, Function, and Genetics 26:391-410 (1996)
98c
99c Two residues are in contact if their C_alpha atoms are
100c closer than 8.5 Angstrem
101c
102c Usage: call c_cont(nmol,ncode)
103c
104c Where nmol is the index of the molecule (always 1, in the
105c current version of SMM)
106c ncode ---> not in use in the current version
107c
108c IMPORTANT: Before the first call of this subroutine "c_alfa"
109c must be called to calculate the inices of C_alpha atoms.
110c (ONLY ONCE)
111c
112c OUTPUT: The output of this routine is the contact matrix
113c ijcont(mxrs,mxrs)
114c
115c ijcont(i,j)=0---> residues i and j are not in contact
116c ijcont(i,j)=1---> ---------''----- are in contact
117c ijcont(i,j)=2---> residues i and j are adjacent
118c
119c NOTE: Adjacent residues are always in contact (and therefore not
120c counted)
121c
122c Here "mxrs" is the maximum number of residues for SMM
123c Obviously, this subroutine calculates only NxN part
124c of that matrix, N -is the number of res. in "nmol"
125c
126c CALLS: none
127c..............................................................
128
129 include 'INCL.H'
130
131 rcut=8.5 ! Domany
132
133
134 do nr_i=irsml1(nmol),irsml2(nmol) ! Over res. i
135
136 ijcont(nr_i,nr_i)=2
137 if(nr_i+1.le.irsml2(nmol)) then
138 ijcont(nr_i,nr_i+1)=2
139 ijcont(nr_i+1,nr_i)=2
140 if(nr_i+2.le.irsml2(nmol)) then
141 ijcont(nr_i,nr_i+2)=2
142 ijcont(nr_i+2,nr_i)=2
143 end if
144 end if
145
146 do nr_j=nr_i+3,irsml2(nmol) ! Over res. j
147
148c write(*,'(2i3)'),nr_i,nr_j
149
150 ic=0
151
152 ialf=ind_alf(nr_i)
153 jalf=ind_alf(nr_j)
154
155 rij2=(xat(ialf)-xat(jalf))**2
156 # +(yat(ialf)-yat(jalf))**2
157 # + (zat(ialf)-zat(jalf))**2
158 if(sqrt(rij2).lt.rcut) ic=1
159
160c write(*,'(2i3)'),nr_i,nr_j
161
162 ijcont(nr_i,nr_j)=ic
163 ijcont(nr_j,nr_i)=ic ! The matrix is symmetrical
164
165 end do ! Over res. j
166 end do ! Over res. i
167
168 return
169 end
170
Note: See TracBrowser for help on using the repository browser.