source: contacts.f

Last change on this file was 38d77eb, checked in by baerbaer <baerbaer@…>, 14 years ago

Redirected standard out to logString.

SMMP produced a lot of log messages. This became an issue when run in massively
parallel environments. I replaced all writes to standard out to a write to logString.
The next step is to pass this string to a function that writes the messages to a log
file according to their importance and the chosen log level.

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

  • Property mode set to 100644
File size: 5.0 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 conformation,
18! and the hamming distance between given conformation and the
19! reference conformation.
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 integer ncn
29
30 integer nham2
31
32 double precision dham
33
34 integer i, j, nham, ncode, nresi
35
36 call c_cont(1,ncode)
37
38 ncn=0
39 nham=0
40 nham2=0
41 nresi=irsml2(1)-irsml1(1)+1
42 do i=1,nresi
43 do j=nresi,i+3,-1
44
45 if (ijcont(i,j).eq.1) then
46 ncn=ncn+1
47 if (iref(i,j).eq.1) nham2 = nham2+1
48 end if
49
50 nham = nham + abs(ijcont(i,j)-iref(i,j))
51 end do
52 end do
53
54 if (ncn.ne.0.and.nci.ne.0) then
55 dham = float(nham)/float(ncn)/float(nci)
56 else
57 dham = 1.0
58 end if
59
60 return
61 end
62
63
64! *********************************
65 subroutine c_alfa(nmol,ncode)
66
67! ......................................................
68! Calculates the indices of C-alpha atoms and
69! stores in the array ind_alf(mxrs)
70!
71! Usage: call c_alfa(nmol,ncode)
72!
73! nmol - index of the molecule
74! ncode ---> not in use in the current version
75!
76! OUTPUT: ind_alf(mxrs)
77!
78! CALLS: none
79! ......................................................
80
81 include 'INCL.H'
82 integer nmol
83
84 integer ncode, ia, n_res
85
86 do n_res=irsml1(nmol),irsml2(nmol) ! Over res.
87 do ia=iatrs1(n_res),iatrs2(n_res) ! Over the atoms of res.
88
89! Check for C_alpha atoms
90
91 if (nmat(ia)(1:2).eq.'ca') then
92 ind_alf(n_res)=ia
93 endif
94
95 enddo ! Over the atoms of res.
96 enddo ! Over the res.
97
98 return
99 end
100
101! **********************************
102 subroutine c_cont (nmol,ncode)
103
104!..............................................................
105! Calculates the matrix of contacts between aminoacid residues
106! of the molecule "nmol" according to L.Mirny and E.Domany,
107! PROTEINS:Structure, Function, and Genetics 26:391-410 (1996)
108!
109! Two residues are in contact if their C_alpha atoms are
110! closer than 8.5 Angstrem
111!
112! Usage: call c_cont(nmol,ncode)
113!
114! Where nmol is the index of the molecule (always 1, in the
115! current version of SMM)
116! ncode ---> not in use in the current version
117!
118! IMPORTANT: Before the first call of this subroutine "c_alfa"
119! must be called to calculate the inices of C_alpha atoms.
120! (ONLY ONCE)
121!
122! OUTPUT: The output of this routine is the contact matrix
123! ijcont(mxrs,mxrs)
124!
125! ijcont(i,j)=0---> residues i and j are not in contact
126! ijcont(i,j)=1---> ---------''----- are in contact
127! ijcont(i,j)=2---> residues i and j are adjacent
128!
129! NOTE: Adjacent residues are always in contact (and therefore not
130! counted)
131!
132! Here "mxrs" is the maximum number of residues for SMM
133! Obviously, this subroutine calculates only NxN part
134! of that matrix, N -is the number of res. in "nmol"
135!
136! CALLS: none
137!..............................................................
138
139 include 'INCL.H'
140 integer nmol
141
142 double precision rcut, rij2
143
144 integer ncode, ic, ialf, jalf, nr_j, nr_i
145
146 rcut=8.5 ! Domany
147
148
149 do nr_i=irsml1(nmol),irsml2(nmol) ! Over res. i
150
151 ijcont(nr_i,nr_i)=2
152 if(nr_i+1.le.irsml2(nmol)) then
153 ijcont(nr_i,nr_i+1)=2
154 ijcont(nr_i+1,nr_i)=2
155 if(nr_i+2.le.irsml2(nmol)) then
156 ijcont(nr_i,nr_i+2)=2
157 ijcont(nr_i+2,nr_i)=2
158 end if
159 end if
160
161 do nr_j=nr_i+3,irsml2(nmol) ! Over res. j
162
163! write (logString, '(2i3)'),nr_i,nr_j
164
165 ic=0
166
167 ialf=ind_alf(nr_i)
168 jalf=ind_alf(nr_j)
169
170 rij2=(xat(ialf)-xat(jalf))**2
171 & +(yat(ialf)-yat(jalf))**2
172 & + (zat(ialf)-zat(jalf))**2
173 if(sqrt(rij2).lt.rcut) ic=1
174
175! write (logString, '(2i3)'),nr_i,nr_j
176
177 ijcont(nr_i,nr_j)=ic
178 ijcont(nr_j,nr_i)=ic ! The matrix is symmetrical
179
180 end do ! Over res. j
181 end do ! Over res. i
182
183 return
184 end
185
Note: See TracBrowser for help on using the repository browser.