source: contacts.f@ bd2278d

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

Reformatting comments and continuation marks.

Fortran 90 and higher use ! to mark comments no matter where they are in the
code. The only valid continuation marker is &.
I also added the SMMP.kdevelop.filelist to the repository to make it easier
to use kdevelop.

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

  • Property mode set to 100644
File size: 4.7 KB
Line 
1! **************************************************************
2!
3! This file contains the subroutines: contacts,c_alfa,c_cont
4!
5! Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,
6! Shura Hayryan, Chin-Ku
7! Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann,
8! Jan H. Meinke, Sandipan Mohanty
9!
10! **************************************************************
11
12 subroutine contacts(ncn,nham2,dham)
13
14! ..............................................................
15!
16! CALCULATES NUMBER OF CONTACTS IN GIVEN CONFORMATION, NUMBER OF
17! CONTACTS WHICH ARE THE SAME IN GIVEN AND REFERENCE ONFORMATION,
18! AND THE HAMMING DISTANCE BETWEEN GIVEN CONFORMATION AND THE
19! REFERENCE CONFORMATIONa
20!
21! CALLS: c_cont
22! ..............................................................
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
57! *********************************
58 subroutine c_alfa(nmol,ncode)
59
60! ......................................................
61! Calculates the indices of C-alpha atoms and
62! stores in the array ind_alf(mxrs)
63!
64! Usage: call c_alfa(nmol,ncode)
65!
66! nmol - index of the molecule
67! ncode ---> not in use in the current version
68!
69! OUTPUT: ind_alf(mxrs)
70!
71! CALLS: none
72! ......................................................
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
79! 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
91! **********************************
92 subroutine c_cont (nmol,ncode)
93
94!..............................................................
95! Calculates the matrix of contacts between aminoacid residues
96! of the molecule "nmol" according to L.Mirny and E.Domany,
97! PROTEINS:Structure, Function, and Genetics 26:391-410 (1996)
98!
99! Two residues are in contact if their C_alpha atoms are
100! closer than 8.5 Angstrem
101!
102! Usage: call c_cont(nmol,ncode)
103!
104! Where nmol is the index of the molecule (always 1, in the
105! current version of SMM)
106! ncode ---> not in use in the current version
107!
108! IMPORTANT: Before the first call of this subroutine "c_alfa"
109! must be called to calculate the inices of C_alpha atoms.
110! (ONLY ONCE)
111!
112! OUTPUT: The output of this routine is the contact matrix
113! ijcont(mxrs,mxrs)
114!
115! ijcont(i,j)=0---> residues i and j are not in contact
116! ijcont(i,j)=1---> ---------''----- are in contact
117! ijcont(i,j)=2---> residues i and j are adjacent
118!
119! NOTE: Adjacent residues are always in contact (and therefore not
120! counted)
121!
122! Here "mxrs" is the maximum number of residues for SMM
123! Obviously, this subroutine calculates only NxN part
124! of that matrix, N -is the number of res. in "nmol"
125!
126! CALLS: none
127!..............................................................
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
148! 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
160! 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.