Add missing doc files
[jabaws.git] / binaries / src / ViennaRNA / doc / latex / gquad_8h_source.tex
1 \hypertarget{gquad_8h}{\section{gquad.\-h}
2 \label{gquad_8h}\index{/home/asherstnev/\-Projects/\-Java.\-projects/jabaws/secure-\/git/develop/binaries/src/\-Vienna\-R\-N\-A/\-H/gquad.\-h@{/home/asherstnev/\-Projects/\-Java.\-projects/jabaws/secure-\/git/develop/binaries/src/\-Vienna\-R\-N\-A/\-H/gquad.\-h}}
3 }
4
5 \begin{DoxyCode}
6 00001 \textcolor{preprocessor}{#ifndef \_\_VIENNA\_RNA\_PACKAGE\_GQUAD\_H\_\_}
7 00002 \textcolor{preprocessor}{}\textcolor{preprocessor}{#define \_\_VIENNA\_RNA\_PACKAGE\_GQUAD\_H\_\_}
8 00003 \textcolor{preprocessor}{}
9 00004 \textcolor{preprocessor}{#include "\hyperlink{data__structures_8h}{data\_structures.h}"}
10 00005 
11 00006 \textcolor{preprocessor}{#ifndef INLINE}
12 00007 \textcolor{preprocessor}{}\textcolor{preprocessor}{#ifdef \_\_GNUC\_\_}
13 00008 \textcolor{preprocessor}{}\textcolor{preprocessor}{# define INLINE inline}
14 00009 \textcolor{preprocessor}{}\textcolor{preprocessor}{#else}
15 00010 \textcolor{preprocessor}{}\textcolor{preprocessor}{# define INLINE}
16 00011 \textcolor{preprocessor}{}\textcolor{preprocessor}{#endif}
17 00012 \textcolor{preprocessor}{}\textcolor{preprocessor}{#endif}
18 00013 \textcolor{preprocessor}{}
19 00020 \textcolor{keywordtype}{int}         E\_gquad(\textcolor{keywordtype}{int} L,
20 00021                     \textcolor{keywordtype}{int} l[3],
21 00022                     \hyperlink{structparamT}{paramT} *P);
22 00023 
23 00024 FLT\_OR\_DBL exp\_E\_gquad( \textcolor{keywordtype}{int} L,
24 00025                         \textcolor{keywordtype}{int} l[3],
25 00026                         \hyperlink{structpf__paramT}{pf\_paramT} *pf);
26 00027 
27 00028 \textcolor{keywordtype}{int}         E\_gquad\_ali(\textcolor{keywordtype}{int} i,
28 00029                         \textcolor{keywordtype}{int} L,
29 00030                         \textcolor{keywordtype}{int} l[3],
30 00031                         \textcolor{keyword}{const} \textcolor{keywordtype}{short} **S,
31 00032                         \textcolor{keywordtype}{int} n\_seq,
32 00033                         \hyperlink{structparamT}{paramT} *P);
33 00034 
34 00035 
35 00036 \textcolor{keywordtype}{void}        E\_gquad\_ali\_en( \textcolor{keywordtype}{int} i,
36 00037                             \textcolor{keywordtype}{int} L,
37 00038                             \textcolor{keywordtype}{int} l[3],
38 00039                             \textcolor{keyword}{const} \textcolor{keywordtype}{short} **S,
39 00040                             \textcolor{keywordtype}{int} n\_seq,
40 00041                             \textcolor{keywordtype}{int} en[2],
41 00042                             \hyperlink{structparamT}{paramT} *P);
42 00043 
43 00060 \textcolor{keywordtype}{int}         *\hyperlink{gquad_8h_a8b0784c14fa1208d0aebbebdc1318b7a}{get\_gquad\_matrix}(\textcolor{keywordtype}{short} *S, \hyperlink{structparamT}{paramT} *P);
44 00061 
45 00062 \textcolor{keywordtype}{int}         *get\_gquad\_ali\_matrix(\textcolor{keywordtype}{short} *S\_cons,
46 00063                                   \textcolor{keywordtype}{short} **S,
47 00064                                   \textcolor{keywordtype}{int} n\_seq,
48 00065                                   \hyperlink{structparamT}{paramT} *P);
49 00066 
50 00067 FLT\_OR\_DBL  *get\_gquad\_pf\_matrix( \textcolor{keywordtype}{short} *S,
51 00068                                   FLT\_OR\_DBL *scale,
52 00069                                   \hyperlink{structpf__paramT}{pf\_paramT} *pf);
53 00070 
54 00071 \textcolor{keywordtype}{int}         **get\_gquad\_L\_matrix( \textcolor{keywordtype}{short} *S,
55 00072                                   \textcolor{keywordtype}{int} start,
56 00073                                   \textcolor{keywordtype}{int} maxdist,
57 00074                                   \textcolor{keywordtype}{int} **g,
58 00075                                   \hyperlink{structparamT}{paramT} *P);
59 00076 
60 00077 \textcolor{keywordtype}{void}        get\_gquad\_pattern\_mfe(\textcolor{keywordtype}{short} *S,
61 00078                                   \textcolor{keywordtype}{int} i,
62 00079                                   \textcolor{keywordtype}{int} j,
63 00080                                   \hyperlink{structparamT}{paramT} *P,
64 00081                                   \textcolor{keywordtype}{int} *L,
65 00082                                   \textcolor{keywordtype}{int} l[3]);
66 00083 
67 00084 \textcolor{keywordtype}{void}        get\_gquad\_pattern\_pf( \textcolor{keywordtype}{short} *S,
68 00085                                   \textcolor{keywordtype}{int} i,
69 00086                                   \textcolor{keywordtype}{int} j,
70 00087                                   \hyperlink{structpf__paramT}{pf\_paramT} *pf,
71 00088                                   \textcolor{keywordtype}{int} *L,
72 00089                                   \textcolor{keywordtype}{int} l[3]);
73 00090 
74 00091 \hyperlink{structplist}{plist}       *get\_plist\_gquad\_from\_pr( \textcolor{keywordtype}{short} *S,
75 00092                                       \textcolor{keywordtype}{int} gi,
76 00093                                       \textcolor{keywordtype}{int} gj,
77 00094                                       FLT\_OR\_DBL *G,
78 00095                                       FLT\_OR\_DBL *probs,
79 00096                                       FLT\_OR\_DBL *scale,
80 00097                                       \hyperlink{structpf__paramT}{pf\_paramT} *pf);
81 00098 \hyperlink{structplist}{plist}       *get\_plist\_gquad\_from\_pr\_max(\textcolor{keywordtype}{short} *S,
82 00099                                       \textcolor{keywordtype}{int} gi,
83 00100                                       \textcolor{keywordtype}{int} gj,
84 00101                                       FLT\_OR\_DBL *G,
85 00102                                       FLT\_OR\_DBL *probs,
86 00103                                       FLT\_OR\_DBL *scale,
87 00104                                       \textcolor{keywordtype}{int} *L,
88 00105                                       \textcolor{keywordtype}{int} l[3],
89 00106                                       \hyperlink{structpf__paramT}{pf\_paramT} *pf);
90 00107 
91 00108 \hyperlink{structplist}{plist}       *get\_plist\_gquad\_from\_db( \textcolor{keyword}{const} \textcolor{keywordtype}{char} *structure,
92 00109                                       \textcolor{keywordtype}{float} pr);
93 00110 
94 00121 \textcolor{keywordtype}{int}         \hyperlink{gquad_8h_ae41763215b9c64d2a7b67f0df8a28078}{parse\_gquad}(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *struc, \textcolor{keywordtype}{int} *L, \textcolor{keywordtype}{int} l[3]);
95 00122 
96 00123 
97 00124 
98 \hypertarget{gquad_8h_source_l00142}{}\hyperlink{gquad_8h_a54475a8eb898fa1e8af8ab5f5375f3be}{00142} INLINE  PRIVATE \textcolor{keywordtype}{int} \hyperlink{gquad_8h_a54475a8eb898fa1e8af8ab5f5375f3be}{backtrack\_GQuad\_IntLoop}(\textcolor{keywordtype}{int} c,
99 00143                                             \textcolor{keywordtype}{int} i,
100 00144                                             \textcolor{keywordtype}{int} j,
101 00145                                             \textcolor{keywordtype}{int} type,
102 00146                                             \textcolor{keywordtype}{short} *S,
103 00147                                             \textcolor{keywordtype}{int} *ggg,
104 00148                                             \textcolor{keywordtype}{int} *index,
105 00149                                             \textcolor{keywordtype}{int} *p,
106 00150                                             \textcolor{keywordtype}{int} *q,
107 00151                                             \hyperlink{structparamT}{paramT} *P)\{
108 00152 
109 00153   \textcolor{keywordtype}{int} energy, \hyperlink{fold__vars_8h_a72b511ed1201f7e23ec437e468790d74}{dangles}, k, l, maxl, minl, c0, l1;
110 00154   \textcolor{keywordtype}{short} si, sj;
111 00155 
112 00156   dangles = P->\hyperlink{structparamT_aeb912822ef912705bc202b14f9d71ad9}{model\_details}.\hyperlink{structmodel__detailsT_a89f9df217a4a7f4351a642655976376b}{dangles};
113 00157   si      = S[i + 1];
114 00158   sj      = S[j - 1];
115 00159   energy  = 0;
116 00160 
117 00161   \textcolor{keywordflow}{if}(dangles == 2)
118 00162     energy += P->mismatchI[type][si][sj];
119 00163 
120 00164   \textcolor{keywordflow}{if}(type > 2)
121 00165     energy += P->TerminalAU;
122 00166 
123 00167   k = i + 1;
124 00168   \textcolor{keywordflow}{if}(S[k] == 3)\{
125 00169     \textcolor{keywordflow}{if}(k < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE)\{
126 00170       minl  = j - i + k - \hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP} - 2;
127 00171       c0    = k + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
128 00172       minl  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(c0, minl);
129 00173       c0    = j - 3;
130 00174       maxl  = k + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
131 00175       maxl  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(c0, maxl);
132 00176       \textcolor{keywordflow}{for}(l = minl; l < maxl; l++)\{
133 00177         \textcolor{keywordflow}{if}(S[l] != 3) \textcolor{keywordflow}{continue};
134 00178         \textcolor{keywordflow}{if}(c == energy + ggg[index[l] + k] + P->internal\_loop[j - l - 1])\{
135 00179           *p = k; *q = l;
136 00180           \textcolor{keywordflow}{return} 1;
137 00181         \}
138 00182       \}
139 00183     \}
140 00184   \}
141 00185 
142 00186   \textcolor{keywordflow}{for}(k = i + 2;
143 00187       k < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE;
144 00188       k++)\{
145 00189     l1    = k - i - 1;
146 00190     \textcolor{keywordflow}{if}(l1>\hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP}) \textcolor{keywordflow}{break};
147 00191     \textcolor{keywordflow}{if}(S[k] != 3) \textcolor{keywordflow}{continue};
148 00192     minl  = j - i + k - \hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP} - 2;
149 00193     c0    = k + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
150 00194     minl  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(c0, minl);
151 00195     c0    = j - 1;
152 00196     maxl  = k + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
153 00197     maxl  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(c0, maxl);
154 00198     \textcolor{keywordflow}{for}(l = minl; l < maxl; l++)\{
155 00199       \textcolor{keywordflow}{if}(S[l] != 3) \textcolor{keywordflow}{continue};
156 00200       \textcolor{keywordflow}{if}(c == energy + ggg[index[l] + k] + P->internal\_loop[l1 + j - l - 1])\{
157 00201         *p = k; *q = l;
158 00202         \textcolor{keywordflow}{return} 1;
159 00203       \}
160 00204     \}
161 00205   \}
162 00206 
163 00207   l = j - 1;
164 00208   \textcolor{keywordflow}{if}(S[l] == 3)
165 00209     \textcolor{keywordflow}{for}(k = i + 4;
166 00210         k < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE;
167 00211         k++)\{
168 00212       l1    = k - i - 1;
169 00213       \textcolor{keywordflow}{if}(l1>\hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP}) \textcolor{keywordflow}{break};
170 00214       \textcolor{keywordflow}{if}(S[k] != 3) \textcolor{keywordflow}{continue};
171 00215       \textcolor{keywordflow}{if}(c == energy + ggg[index[l] + k] + P->internal\_loop[l1])\{
172 00216         *p = k; *q = l;
173 00217         \textcolor{keywordflow}{return} 1;
174 00218       \}
175 00219     \}
176 00220 
177 00221   \textcolor{keywordflow}{return} 0;
178 00222 \}
179 00223 
180 \hypertarget{gquad_8h_source_l00240}{}\hyperlink{gquad_8h_a118ec7289f1936bd810be7fe50b98212}{00240} INLINE  PRIVATE \textcolor{keywordtype}{int} \hyperlink{gquad_8h_a118ec7289f1936bd810be7fe50b98212}{backtrack\_GQuad\_IntLoop\_L}(\textcolor{keywordtype}{int} c,
181 00241                                               \textcolor{keywordtype}{int} i,
182 00242                                               \textcolor{keywordtype}{int} j,
183 00243                                               \textcolor{keywordtype}{int} type,
184 00244                                               \textcolor{keywordtype}{short} *S,
185 00245                                               \textcolor{keywordtype}{int} **ggg,
186 00246                                               \textcolor{keywordtype}{int} maxdist,
187 00247                                               \textcolor{keywordtype}{int} *p,
188 00248                                               \textcolor{keywordtype}{int} *q,
189 00249                                               \hyperlink{structparamT}{paramT} *P)\{
190 00250 
191 00251   \textcolor{keywordtype}{int} energy, \hyperlink{fold__vars_8h_a72b511ed1201f7e23ec437e468790d74}{dangles}, k, l, maxl, minl, c0, l1;
192 00252   \textcolor{keywordtype}{short} si, sj;
193 00253 
194 00254   dangles = P->\hyperlink{structparamT_aeb912822ef912705bc202b14f9d71ad9}{model\_details}.\hyperlink{structmodel__detailsT_a89f9df217a4a7f4351a642655976376b}{dangles};
195 00255   si      = S[i + 1];
196 00256   sj      = S[j - 1];
197 00257   energy  = 0;
198 00258 
199 00259   \textcolor{keywordflow}{if}(dangles == 2)
200 00260     energy += P->mismatchI[type][si][sj];
201 00261 
202 00262   \textcolor{keywordflow}{if}(type > 2)
203 00263     energy += P->TerminalAU;
204 00264 
205 00265   k = i + 1;
206 00266   \textcolor{keywordflow}{if}(S[k] == 3)\{
207 00267     \textcolor{keywordflow}{if}(k < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE)\{
208 00268       minl  = j - i + k - \hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP} - 2;
209 00269       c0    = k + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
210 00270       minl  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(c0, minl);
211 00271       c0    = j - 3;
212 00272       maxl  = k + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
213 00273       maxl  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(c0, maxl);
214 00274       \textcolor{keywordflow}{for}(l = minl; l < maxl; l++)\{
215 00275         \textcolor{keywordflow}{if}(S[l] != 3) \textcolor{keywordflow}{continue};
216 00276         \textcolor{keywordflow}{if}(c == energy + ggg[k][l - k] + P->internal\_loop[j - l - 1])\{
217 00277           *p = k; *q = l;
218 00278           \textcolor{keywordflow}{return} 1;
219 00279         \}
220 00280       \}
221 00281     \}
222 00282   \}
223 00283 
224 00284   \textcolor{keywordflow}{for}(k = i + 2;
225 00285       k < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE;
226 00286       k++)\{
227 00287     l1    = k - i - 1;
228 00288     \textcolor{keywordflow}{if}(l1>\hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP}) \textcolor{keywordflow}{break};
229 00289     \textcolor{keywordflow}{if}(S[k] != 3) \textcolor{keywordflow}{continue};
230 00290     minl  = j - i + k - \hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP} - 2;
231 00291     c0    = k + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
232 00292     minl  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(c0, minl);
233 00293     c0    = j - 1;
234 00294     maxl  = k + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
235 00295     maxl  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(c0, maxl);
236 00296     \textcolor{keywordflow}{for}(l = minl; l < maxl; l++)\{
237 00297       \textcolor{keywordflow}{if}(S[l] != 3) \textcolor{keywordflow}{continue};
238 00298       \textcolor{keywordflow}{if}(c == energy + ggg[k][l - k] + P->internal\_loop[l1 + j - l - 1])\{
239 00299         *p = k; *q = l;
240 00300         \textcolor{keywordflow}{return} 1;
241 00301       \}
242 00302     \}
243 00303   \}
244 00304 
245 00305   l = j - 1;
246 00306   \textcolor{keywordflow}{if}(S[l] == 3)
247 00307     \textcolor{keywordflow}{for}(k = i + 4;
248 00308         k < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE;
249 00309         k++)\{
250 00310       l1    = k - i - 1;
251 00311       \textcolor{keywordflow}{if}(l1>\hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP}) \textcolor{keywordflow}{break};
252 00312       \textcolor{keywordflow}{if}(S[k] != 3) \textcolor{keywordflow}{continue};
253 00313       \textcolor{keywordflow}{if}(c == energy + ggg[k][l - k] + P->internal\_loop[l1])\{
254 00314         *p = k; *q = l;
255 00315         \textcolor{keywordflow}{return} 1;
256 00316       \}
257 00317     \}
258 00318 
259 00319   \textcolor{keywordflow}{return} 0;
260 00320 \}
261 00321 
262 00322 INLINE PRIVATE
263 00323 \textcolor{keywordtype}{int}
264 00324 E\_GQuad\_IntLoop(\textcolor{keywordtype}{int} i,
265 00325                 \textcolor{keywordtype}{int} j,
266 00326                 \textcolor{keywordtype}{int} type,
267 00327                 \textcolor{keywordtype}{short} *S,
268 00328                 \textcolor{keywordtype}{int} *ggg,
269 00329                 \textcolor{keywordtype}{int} *index,
270 00330                 \hyperlink{structparamT}{paramT} *P)\{
271 00331 
272 00332   \textcolor{keywordtype}{int} energy, ge, en1, en2, \hyperlink{fold__vars_8h_a72b511ed1201f7e23ec437e468790d74}{dangles}, p, q, l1, minq, maxq;
273 00333   \textcolor{keywordtype}{int} c0, c1, c2, c3, up, d53, d5, d3;
274 00334   \textcolor{keywordtype}{short} si, sj;
275 00335 
276 00336   dangles = P->\hyperlink{structparamT_aeb912822ef912705bc202b14f9d71ad9}{model\_details}.\hyperlink{structmodel__detailsT_a89f9df217a4a7f4351a642655976376b}{dangles};
277 00337   si      = S[i + 1];
278 00338   sj      = S[j - 1];
279 00339   energy  = 0;
280 00340 
281 00341   \textcolor{keywordflow}{if}(dangles == 2)
282 00342     energy += P->mismatchI[type][si][sj];
283 00343 
284 00344   \textcolor{keywordflow}{if}(type > 2)
285 00345     energy += P->TerminalAU;
286 00346 
287 00347   ge = \hyperlink{energy__const_8h_a12c2040f25d8e3a7b9e1c2024c618cb6}{INF};
288 00348 
289 00349   p = i + 1;
290 00350   \textcolor{keywordflow}{if}(S[p] == 3)\{
291 00351     \textcolor{keywordflow}{if}(p < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE)\{
292 00352       minq  = j - i + p - \hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP} - 2;
293 00353       c0    = p + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
294 00354       minq  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(c0, minq);
295 00355       c0    = j - 3;
296 00356       maxq  = p + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
297 00357       maxq  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(c0, maxq);
298 00358       \textcolor{keywordflow}{for}(q = minq; q < maxq; q++)\{
299 00359         \textcolor{keywordflow}{if}(S[q] != 3) \textcolor{keywordflow}{continue};
300 00360         c0  = energy + ggg[index[q] + p] + P->internal\_loop[j - q - 1];
301 00361         ge  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(ge, c0);
302 00362       \}
303 00363     \}
304 00364   \}
305 00365 
306 00366   \textcolor{keywordflow}{for}(p = i + 2;
307 00367       p < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE;
308 00368       p++)\{
309 00369     l1    = p - i - 1;
310 00370     \textcolor{keywordflow}{if}(l1>MAXLOOP) \textcolor{keywordflow}{break};
311 00371     \textcolor{keywordflow}{if}(S[p] != 3) \textcolor{keywordflow}{continue};
312 00372     minq  = j - i + p - MAXLOOP - 2;
313 00373     c0    = p + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
314 00374     minq  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(c0, minq);
315 00375     c0    = j - 1;
316 00376     maxq  = p + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
317 00377     maxq  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(c0, maxq);
318 00378     \textcolor{keywordflow}{for}(q = minq; q < maxq; q++)\{
319 00379       \textcolor{keywordflow}{if}(S[q] != 3) \textcolor{keywordflow}{continue};
320 00380       c0  = energy + ggg[index[q] + p] + P->internal\_loop[l1 + j - q - 1];
321 00381       ge   = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(ge, c0);
322 00382     \}
323 00383   \}
324 00384 
325 00385   q = j - 1;
326 00386   \textcolor{keywordflow}{if}(S[q] == 3)
327 00387     \textcolor{keywordflow}{for}(p = i + 4;
328 00388         p < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE;
329 00389         p++)\{
330 00390       l1    = p - i - 1;
331 00391       \textcolor{keywordflow}{if}(l1>MAXLOOP) \textcolor{keywordflow}{break};
332 00392       \textcolor{keywordflow}{if}(S[p] != 3) \textcolor{keywordflow}{continue};
333 00393       c0  = energy + ggg[index[q] + p] + P->internal\_loop[l1];
334 00394       ge  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(ge, c0);
335 00395     \}
336 00396 
337 00397 \textcolor{preprocessor}{#if 0}
338 00398 \textcolor{preprocessor}{}  \textcolor{comment}{/* here comes the additional stuff for the odd dangle models */}
339 00399   \textcolor{keywordflow}{if}(dangles % 1)\{
340 00400     en1 = energy + P->dangle5[type][si];
341 00401     en2 = energy + P->dangle5[type][sj];
342 00402     en3 = energy + P->mismatchI[type][si][sj];
343 00403 
344 00404     \textcolor{comment}{/* first case with 5' dangle (i.e. j-1) onto enclosing pair */}
345 00405     p = i + 1;
346 00406     \textcolor{keywordflow}{if}(S[p] == 3)\{
347 00407       \textcolor{keywordflow}{if}(p < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE)\{
348 00408         minq  = j - i + p - MAXLOOP - 2;
349 00409         c0    = p + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
350 00410         minq  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(c0, minq);
351 00411         c0    = j - 4;
352 00412         maxq  = p + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
353 00413         maxq  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(c0, maxq);
354 00414         \textcolor{keywordflow}{for}(q = minq; q < maxq; q++)\{
355 00415           \textcolor{keywordflow}{if}(S[q] != 3) \textcolor{keywordflow}{continue};
356 00416           c0  = en1 + ggg[index[q] + p] + P->internal\_loop[j - q - 1];
357 00417           ge  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(ge, c0);
358 00418         \}
359 00419       \}
360 00420     \}
361 00421 
362 00422     \textcolor{keywordflow}{for}(p = i + 2; p < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE; p++)\{
363 00423       l1    = p - i - 1;
364 00424       \textcolor{keywordflow}{if}(l1>MAXLOOP) \textcolor{keywordflow}{break};
365 00425       \textcolor{keywordflow}{if}(S[p] != 3) \textcolor{keywordflow}{continue};
366 00426       minq  = j - i + p - MAXLOOP - 2;
367 00427       c0    = p + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
368 00428       minq  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(c0, minq);
369 00429       c0    = j - 2;
370 00430       maxq  = p + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
371 00431       maxq  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(c0, maxq);
372 00432       \textcolor{keywordflow}{for}(q = minq; q < maxq; q++)\{
373 00433         \textcolor{keywordflow}{if}(S[q] != 3) \textcolor{keywordflow}{continue};
374 00434         c0  = en1 + ggg[index[q] + p] + P->internal\_loop[l1 + j - q - 1];
375 00435         ge   = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(ge, c0);
376 00436       \}
377 00437     \}
378 00438 
379 00439     q = j - 2;
380 00440     \textcolor{keywordflow}{if}(S[q] == 3)
381 00441       \textcolor{keywordflow}{for}(p = i + 4; p < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE; p++)\{
382 00442         l1    = p - i - 1;
383 00443         \textcolor{keywordflow}{if}(l1>MAXLOOP) \textcolor{keywordflow}{break};
384 00444         \textcolor{keywordflow}{if}(S[p] != 3) \textcolor{keywordflow}{continue};
385 00445         c0  = en1 + ggg[index[q] + p] + P->internal\_loop[l1 + 1];
386 00446         ge  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(ge, c0);
387 00447       \}
388 00448 
389 00449     \textcolor{comment}{/* second case with 3' dangle (i.e. i+1) onto enclosing pair */}
390 00450 
391 00451   \}
392 00452 \textcolor{preprocessor}{#endif}
393 00453 \textcolor{preprocessor}{}  \textcolor{keywordflow}{return} ge;
394 00454 \}
395 00455 
396 00456 INLINE PRIVATE
397 00457 \textcolor{keywordtype}{int}
398 00458 E\_GQuad\_IntLoop\_L(\textcolor{keywordtype}{int} i,
399 00459                   \textcolor{keywordtype}{int} j,
400 00460                   \textcolor{keywordtype}{int} type,
401 00461                   \textcolor{keywordtype}{short} *S,
402 00462                   \textcolor{keywordtype}{int} **ggg,
403 00463                   \textcolor{keywordtype}{int} maxdist,
404 00464                   \hyperlink{structparamT}{paramT} *P)\{
405 00465 
406 00466   \textcolor{keywordtype}{int} energy, ge, en1, en2, dangles, p, q, l1, minq, maxq;
407 00467   \textcolor{keywordtype}{int} c0, c1, c2, c3, up, d53, d5, d3;
408 00468   \textcolor{keywordtype}{short} si, sj;
409 00469 
410 00470   dangles = P->\hyperlink{structparamT_aeb912822ef912705bc202b14f9d71ad9}{model\_details}.\hyperlink{structmodel__detailsT_a89f9df217a4a7f4351a642655976376b}{dangles};
411 00471   si      = S[i + 1];
412 00472   sj      = S[j - 1];
413 00473   energy  = 0;
414 00474 
415 00475   \textcolor{keywordflow}{if}(dangles == 2)
416 00476     energy += P->mismatchI[type][si][sj];
417 00477 
418 00478   \textcolor{keywordflow}{if}(type > 2)
419 00479     energy += P->TerminalAU;
420 00480 
421 00481   ge = \hyperlink{energy__const_8h_a12c2040f25d8e3a7b9e1c2024c618cb6}{INF};
422 00482 
423 00483   p = i + 1;
424 00484   \textcolor{keywordflow}{if}(S[p] == 3)\{
425 00485     \textcolor{keywordflow}{if}(p < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE)\{
426 00486       minq  = j - i + p - MAXLOOP - 2;
427 00487       c0    = p + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
428 00488       minq  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(c0, minq);
429 00489       c0    = j - 3;
430 00490       maxq  = p + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
431 00491       maxq  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(c0, maxq);
432 00492       \textcolor{keywordflow}{for}(q = minq; q < maxq; q++)\{
433 00493         \textcolor{keywordflow}{if}(S[q] != 3) \textcolor{keywordflow}{continue};
434 00494         c0  = energy + ggg[p][q-p] + P->internal\_loop[j - q - 1];
435 00495         ge  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(ge, c0);
436 00496       \}
437 00497     \}
438 00498   \}
439 00499 
440 00500   \textcolor{keywordflow}{for}(p = i + 2;
441 00501       p < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE;
442 00502       p++)\{
443 00503     l1    = p - i - 1;
444 00504     \textcolor{keywordflow}{if}(l1>MAXLOOP) \textcolor{keywordflow}{break};
445 00505     \textcolor{keywordflow}{if}(S[p] != 3) \textcolor{keywordflow}{continue};
446 00506     minq  = j - i + p - MAXLOOP - 2;
447 00507     c0    = p + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
448 00508     minq  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(c0, minq);
449 00509     c0    = j - 1;
450 00510     maxq  = p + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
451 00511     maxq  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(c0, maxq);
452 00512     \textcolor{keywordflow}{for}(q = minq; q < maxq; q++)\{
453 00513       \textcolor{keywordflow}{if}(S[q] != 3) \textcolor{keywordflow}{continue};
454 00514       c0  = energy + ggg[p][q - p] + P->internal\_loop[l1 + j - q - 1];
455 00515       ge   = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(ge, c0);
456 00516     \}
457 00517   \}
458 00518 
459 00519   q = j - 1;
460 00520   \textcolor{keywordflow}{if}(S[q] == 3)
461 00521     \textcolor{keywordflow}{for}(p = i + 4;
462 00522         p < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE;
463 00523         p++)\{
464 00524       l1    = p - i - 1;
465 00525       \textcolor{keywordflow}{if}(l1>MAXLOOP) \textcolor{keywordflow}{break};
466 00526       \textcolor{keywordflow}{if}(S[p] != 3) \textcolor{keywordflow}{continue};
467 00527       c0  = energy + ggg[p][q - p] + P->internal\_loop[l1];
468 00528       ge  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(ge, c0);
469 00529     \}
470 00530 
471 00531   \textcolor{keywordflow}{return} ge;
472 00532 \}
473 00533 
474 00534 INLINE PRIVATE
475 00535 FLT\_OR\_DBL
476 00536 exp\_E\_GQuad\_IntLoop(\textcolor{keywordtype}{int} i,
477 00537                     \textcolor{keywordtype}{int} j,
478 00538                     \textcolor{keywordtype}{int} type,
479 00539                     \textcolor{keywordtype}{short} *S,
480 00540                     FLT\_OR\_DBL *G,
481 00541                     \textcolor{keywordtype}{int} *index,
482 00542                     \hyperlink{structpf__paramT}{pf\_paramT} *pf)\{
483 00543 
484 00544   \textcolor{keywordtype}{int} k, l, minl, maxl, u, r;
485 00545   FLT\_OR\_DBL q, qe, *expintern;
486 00546   \textcolor{keywordtype}{short} si, sj;
487 00547 
488 00548   q         = 0;
489 00549   si        = S[i + 1];
490 00550   sj        = S[j - 1];
491 00551   qe        = pf->expmismatchI[type][si][sj];
492 00552   expintern = pf->expinternal;
493 00553 
494 00554   \textcolor{keywordflow}{if}(type > 2)
495 00555     qe *= pf->expTermAU;
496 00556 
497 00557   k = i + 1;
498 00558   \textcolor{keywordflow}{if}(S[k] == 3)\{
499 00559     \textcolor{keywordflow}{if}(k < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE)\{
500 00560       minl  = j - i + k - MAXLOOP - 2;
501 00561       u     = k + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
502 00562       minl  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(u, minl);
503 00563       u     = j - 3;
504 00564       maxl  = k + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
505 00565       maxl  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(u, maxl);
506 00566       \textcolor{keywordflow}{for}(l = minl; l < maxl; l++)\{
507 00567         \textcolor{keywordflow}{if}(S[l] != 3) \textcolor{keywordflow}{continue};
508 00568         q += qe * G[index[k]-l] * expintern[j - l - 1];
509 00569       \}
510 00570     \}
511 00571   \}
512 00572 
513 00573 
514 00574   \textcolor{keywordflow}{for}(k = i + 2;
515 00575       k <= j - VRNA\_GQUAD\_MIN\_BOX\_SIZE;
516 00576       k++)\{
517 00577     u = k - i - 1;
518 00578     \textcolor{keywordflow}{if}(u > MAXLOOP) \textcolor{keywordflow}{break};
519 00579     \textcolor{keywordflow}{if}(S[k] != 3) \textcolor{keywordflow}{continue};
520 00580     minl  = j - i + k - MAXLOOP - 2;
521 00581     r     = k + VRNA\_GQUAD\_MIN\_BOX\_SIZE - 1;
522 00582     minl  = \hyperlink{utils_8h_a33297b3679c713b0c4d897cd0fe3b122}{MAX2}(r, minl);
523 00583     maxl  = k + VRNA\_GQUAD\_MAX\_BOX\_SIZE + 1;
524 00584     r     = j - 1;
525 00585     maxl  = \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(r, maxl);
526 00586     \textcolor{keywordflow}{for}(l = minl; l < maxl; l++)\{
527 00587       \textcolor{keywordflow}{if}(S[l] != 3) \textcolor{keywordflow}{continue};
528 00588       q += qe * G[index[k]-l] * expintern[u + j - l - 1];
529 00589     \}
530 00590   \}
531 00591 
532 00592   l = j - 1;
533 00593   \textcolor{keywordflow}{if}(S[l] == 3)
534 00594     \textcolor{keywordflow}{for}(k = i + 4; k < j - VRNA\_GQUAD\_MIN\_BOX\_SIZE; k++)\{
535 00595       u    = k - i - 1;
536 00596       \textcolor{keywordflow}{if}(u>MAXLOOP) \textcolor{keywordflow}{break};
537 00597       \textcolor{keywordflow}{if}(S[k] != 3) \textcolor{keywordflow}{continue};
538 00598       q += qe * G[index[k]-l] * expintern[u];
539 00599     \}
540 00600 
541 00601   \textcolor{keywordflow}{return} q;
542 00602 \}
543 00603 
544 00604 \textcolor{preprocessor}{#endif}
545 \end{DoxyCode}