JWS-117 Compiled all tools with ./compilebin.sh and some were missing related files.
[jabaws.git] / binaries / src / ViennaRNA / doc / latex / loop__energies_8h_source.tex
1 \hypertarget{loop__energies_8h_source}{
2 \section{/homes/fmmarquesmadeira/Projects/jabaws/binaries/src/ViennaRNA/H/loop\_\-energies.h}
3 }
4
5
6 \begin{footnotesize}\begin{alltt}
7 00001 \textcolor{preprocessor}{#ifndef \_\_VIENNA\_RNA\_PACKAGE\_LOOP\_ENERGIES\_H\_\_}
8 00002 \textcolor{preprocessor}{}\textcolor{preprocessor}{#define \_\_VIENNA\_RNA\_PACKAGE\_LOOP\_ENERGIES\_H\_\_}
9 00003 \textcolor{preprocessor}{}
10 00004 \textcolor{preprocessor}{#include <stdio.h>}
11 00005 \textcolor{preprocessor}{#include <stdlib.h>}
12 00006 \textcolor{preprocessor}{#include <math.h>}
13 00007 \textcolor{preprocessor}{#include <ctype.h>}
14 00008 \textcolor{preprocessor}{#include <string.h>}
15 00009 \textcolor{preprocessor}{#include "\hyperlink{params_8h}{params.h}"}
16 00010 \textcolor{preprocessor}{#include "\hyperlink{fold__vars_8h}{fold_vars.h}"}
17 00011 \textcolor{preprocessor}{#include "energy\_par.h"}
18 00012 
19 00013 \textcolor{preprocessor}{#ifdef \_\_GNUC\_\_}
20 00014 \textcolor{preprocessor}{}\textcolor{preprocessor}{# define INLINE inline}
21 00015 \textcolor{preprocessor}{}\textcolor{preprocessor}{#else}
22 00016 \textcolor{preprocessor}{}\textcolor{preprocessor}{# define INLINE}
23 00017 \textcolor{preprocessor}{}\textcolor{preprocessor}{#endif}
24 00018 \textcolor{preprocessor}{}
25 00054 INLINE  PRIVATE \textcolor{keywordtype}{int} E\_MLstem( \textcolor{keywordtype}{int} type,
26 00055                               \textcolor{keywordtype}{int} si1,
27 00056                               \textcolor{keywordtype}{int} sj1,
28 00057                               \hyperlink{structparamT}{paramT} *P);
29 00058 
30 00065 INLINE  PRIVATE \textcolor{keywordtype}{double} exp\_E\_MLstem(\textcolor{keywordtype}{int} type,
31 00066                                     \textcolor{keywordtype}{int} si1,
32 00067                                     \textcolor{keywordtype}{int} sj1,
33 00068                                     \hyperlink{structpf__paramT}{pf_paramT} *P);
34 00069 
35 00089 INLINE  PRIVATE \textcolor{keywordtype}{int} E\_ExtLoop(\textcolor{keywordtype}{int} type,
36 00090                               \textcolor{keywordtype}{int} si1,
37 00091                               \textcolor{keywordtype}{int} sj1,
38 00092                               \hyperlink{structparamT}{paramT} *P);
39 00093 
40 00100 INLINE  PRIVATE \textcolor{keywordtype}{double} exp\_E\_ExtLoop( \textcolor{keywordtype}{int} type,
41 00101                                       \textcolor{keywordtype}{int} si1,
42 00102                                       \textcolor{keywordtype}{int} sj1,
43 00103                                       \hyperlink{structpf__paramT}{pf_paramT} *P);
44 00104 
45 00149 INLINE  PRIVATE \textcolor{keywordtype}{int} \hyperlink{loop__energies_8h_a3e5ad89f451254b1fe366d77aa8ff7bd}{E_IntLoop}(\textcolor{keywordtype}{int} n1,
46 00150                               \textcolor{keywordtype}{int} n2,
47 00151                               \textcolor{keywordtype}{int} type,
48 00152                               \textcolor{keywordtype}{int} type\_2,
49 00153                               \textcolor{keywordtype}{int} si1,
50 00154                               \textcolor{keywordtype}{int} sj1,
51 00155                               \textcolor{keywordtype}{int} sp1,
52 00156                               \textcolor{keywordtype}{int} sq1,
53 00157                               \hyperlink{structparamT}{paramT} *P);
54 00158 
55 00159 
56 00191 INLINE  PRIVATE \textcolor{keywordtype}{int} \hyperlink{loop__energies_8h_aa362183cf6db89a10cdb0f5c4bd180c6}{E_Hairpin}(\textcolor{keywordtype}{int} size,
57 00192                               \textcolor{keywordtype}{int} type,
58 00193                               \textcolor{keywordtype}{int} si1,
59 00194                               \textcolor{keywordtype}{int} sj1,
60 00195                               \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\textcolor{keywordtype}{string},
61 00196                               \hyperlink{structparamT}{paramT} *P);
62 00197 
63 00243 INLINE  PRIVATE \textcolor{keywordtype}{int} \hyperlink{loop__energies_8h_af5a6594eba9b2622cb47076650c69819}{E_Stem}( \textcolor{keywordtype}{int} type,
64 00244                             \textcolor{keywordtype}{int} si1,
65 00245                             \textcolor{keywordtype}{int} sj1,
66 00246                             \textcolor{keywordtype}{int} extLoop,
67 00247                             \hyperlink{structparamT}{paramT} *P);
68 00248 
69 00257 INLINE  PRIVATE \textcolor{keywordtype}{double} \hyperlink{loop__energies_8h_a76cc24ec96199e04beddad13e7891e21}{exp_E_Stem}(\textcolor{keywordtype}{int} type,
70 00258                                   \textcolor{keywordtype}{int} si1,
71 00259                                   \textcolor{keywordtype}{int} sj1,
72 00260                                   \textcolor{keywordtype}{int} extLoop,
73 00261                                   \hyperlink{structpf__paramT}{pf_paramT} *P);
74 00262 
75 00280 INLINE  PRIVATE \textcolor{keywordtype}{double} \hyperlink{loop__energies_8h_a0e128184bb097dc2da33706f33b555a6}{exp_E_Hairpin}( \textcolor{keywordtype}{int} u,
76 00281                                       \textcolor{keywordtype}{int} type,
77 00282                                       \textcolor{keywordtype}{short} si1,
78 00283                                       \textcolor{keywordtype}{short} sj1,
79 00284                                       \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\textcolor{keywordtype}{string},
80 00285                                       \hyperlink{structpf__paramT}{pf_paramT} *P);
81 00286 
82 00306 INLINE  PRIVATE \textcolor{keywordtype}{double}  \hyperlink{loop__energies_8h_aa5e98e524e2a41e290b942b09544bc9e}{exp_E_IntLoop}(\textcolor{keywordtype}{int} u1,
83 00307                                       \textcolor{keywordtype}{int} u2,
84 00308                                       \textcolor{keywordtype}{int} type,
85 00309                                       \textcolor{keywordtype}{int} type2,
86 00310                                       \textcolor{keywordtype}{short} si1,
87 00311                                       \textcolor{keywordtype}{short} sj1,
88 00312                                       \textcolor{keywordtype}{short} sp1,
89 00313                                       \textcolor{keywordtype}{short} sq1,
90 00314                                       \hyperlink{structpf__paramT}{pf_paramT} *P);
91 00315 
92 00316 
93 00317 \textcolor{comment}{/*}
94 00318 \textcolor{comment}{#################################}
95 00319 \textcolor{comment}{# BEGIN OF FUNCTION DEFINITIONS #}
96 00320 \textcolor{comment}{#################################}
97 00321 \textcolor{comment}{*/}
98 \hypertarget{loop__energies_8h_source_l00322}{}\hyperlink{loop__energies_8h_aa362183cf6db89a10cdb0f5c4bd180c6}{00322} INLINE  PRIVATE \textcolor{keywordtype}{int} \hyperlink{loop__energies_8h_aa362183cf6db89a10cdb0f5c4bd180c6}{E_Hairpin}(\textcolor{keywordtype}{int} size, \textcolor{keywordtype}{int} type, \textcolor{keywordtype}{int} si1, \textcolor{keywordtype}{int} sj1, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\textcolor{keywordtype}{s
99       tring}, \hyperlink{structparamT}{paramT} *P)\{
100 00323   \textcolor{keywordtype}{int} energy;
101 00324 
102 00325   energy = (size <= 30) ? P->hairpin[size] : P->hairpin[30]+(\textcolor{keywordtype}{int})(P->lxc*log((siz
103       e)/30.));
104 00326   \textcolor{keywordflow}{if} (P->\hyperlink{structparamT_aeb912822ef912705bc202b14f9d71ad9}{model_details}.\hyperlink{structmodel__detailsT_a9d73fde17b0465311a80f607faa85617}{special_hp})\{
105 00327     \textcolor{keywordflow}{if} (size == 4) \{ \textcolor{comment}{/* check for tetraloop bonus */}
106 00328       \textcolor{keywordtype}{char} tl[7]=\{0\}, *ts;
107 00329       strncpy(tl, \textcolor{keywordtype}{string}, 6);
108 00330       \textcolor{keywordflow}{if} ((ts=strstr(P->Tetraloops, tl)))
109 00331         \textcolor{keywordflow}{return} (P->Tetraloop\_E[(ts - P->Tetraloops)/7]);
110 00332     \}
111 00333     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (size == 6) \{
112 00334       \textcolor{keywordtype}{char} tl[9]=\{0\}, *ts;
113 00335       strncpy(tl, \textcolor{keywordtype}{string}, 8);
114 00336       \textcolor{keywordflow}{if} ((ts=strstr(P->Hexaloops, tl)))
115 00337         \textcolor{keywordflow}{return} (energy = P->Hexaloop\_E[(ts - P->Hexaloops)/9]);
116 00338     \}
117 00339     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (size == 3) \{
118 00340       \textcolor{keywordtype}{char} tl[6]=\{0,0,0,0,0,0\}, *ts;
119 00341       strncpy(tl, \textcolor{keywordtype}{string}, 5);
120 00342       \textcolor{keywordflow}{if} ((ts=strstr(P->Triloops, tl))) \{
121 00343         \textcolor{keywordflow}{return} (P->Triloop\_E[(ts - P->Triloops)/6]);
122 00344       \}
123 00345       \textcolor{keywordflow}{return} (energy + (type>2 ? P->TerminalAU : 0));
124 00346     \}
125 00347   \}
126 00348   energy += P->mismatchH[type][si1][sj1];
127 00349 
128 00350   \textcolor{keywordflow}{return} energy;
129 00351 \}
130 00352 
131 \hypertarget{loop__energies_8h_source_l00353}{}\hyperlink{loop__energies_8h_a3e5ad89f451254b1fe366d77aa8ff7bd}{00353} INLINE  PRIVATE \textcolor{keywordtype}{int} \hyperlink{loop__energies_8h_a3e5ad89f451254b1fe366d77aa8ff7bd}{E_IntLoop}(\textcolor{keywordtype}{int} n1, \textcolor{keywordtype}{int} n2, \textcolor{keywordtype}{int} type, \textcolor{keywordtype}{int} type\_2, \textcolor{keywordtype}{int} si1, \textcolor{keywordtype}{int} 
132       sj1, \textcolor{keywordtype}{int} sp1, \textcolor{keywordtype}{int} sq1, \hyperlink{structparamT}{paramT} *P)\{
133 00354   \textcolor{comment}{/* compute energy of degree 2 loop (stack bulge or interior) */}
134 00355   \textcolor{keywordtype}{int} nl, ns, energy;
135 00356   energy = \hyperlink{energy__const_8h_a12c2040f25d8e3a7b9e1c2024c618cb6}{INF};
136 00357 
137 00358   \textcolor{keywordflow}{if} (n1>n2) \{ nl=n1; ns=n2;\}
138 00359   \textcolor{keywordflow}{else} \{nl=n2; ns=n1;\}
139 00360 
140 00361   \textcolor{keywordflow}{if} (nl == 0)
141 00362     \textcolor{keywordflow}{return} P->stack[type][type\_2];  \textcolor{comment}{/* stack */}
142 00363 
143 00364   \textcolor{keywordflow}{if} (ns==0) \{                      \textcolor{comment}{/* bulge */}
144 00365     energy = (nl<=\hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP})?P->bulge[nl]:
145 00366       (P->bulge[30]+(\textcolor{keywordtype}{int})(P->lxc*log(nl/30.)));
146 00367     \textcolor{keywordflow}{if} (nl==1) energy += P->stack[type][type\_2];
147 00368     \textcolor{keywordflow}{else} \{
148 00369       \textcolor{keywordflow}{if} (type>2) energy += P->TerminalAU;
149 00370       \textcolor{keywordflow}{if} (type\_2>2) energy += P->TerminalAU;
150 00371     \}
151 00372     \textcolor{keywordflow}{return} energy;
152 00373   \}
153 00374   \textcolor{keywordflow}{else} \{                            \textcolor{comment}{/* interior loop */}
154 00375     \textcolor{keywordflow}{if} (ns==1) \{
155 00376       \textcolor{keywordflow}{if} (nl==1)                    \textcolor{comment}{/* 1x1 loop */}
156 00377         \textcolor{keywordflow}{return} P->int11[type][type\_2][si1][sj1];
157 00378       \textcolor{keywordflow}{if} (nl==2) \{                  \textcolor{comment}{/* 2x1 loop */}
158 00379         \textcolor{keywordflow}{if} (n1==1)
159 00380           energy = P->int21[type][type\_2][si1][sq1][sj1];
160 00381         \textcolor{keywordflow}{else}
161 00382           energy = P->int21[type\_2][type][sq1][si1][sp1];
162 00383         \textcolor{keywordflow}{return} energy;
163 00384       \}
164 00385       \textcolor{keywordflow}{else} \{  \textcolor{comment}{/* 1xn loop */}
165 00386         energy = (nl+1<=\hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP})?(P->internal\_loop[nl+1]) : (P->internal\_loop[30]
166       +(int)(P->lxc*log((nl+1)/30.)));
167 00387         energy += \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(MAX\_NINIO, (nl-ns)*P->ninio[2]);
168 00388         energy += P->mismatch1nI[type][si1][sj1] + P->mismatch1nI[type\_2][sq1][sp
169       1];
170 00389         \textcolor{keywordflow}{return} energy;
171 00390       \}
172 00391     \}
173 00392     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (ns==2) \{
174 00393       \textcolor{keywordflow}{if}(nl==2)      \{              \textcolor{comment}{/* 2x2 loop */}
175 00394         \textcolor{keywordflow}{return} P->int22[type][type\_2][si1][sp1][sq1][sj1];\}
176 00395       \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (nl==3)\{              \textcolor{comment}{/* 2x3 loop */}
177 00396         energy = P->internal\_loop[5]+P->ninio[2];
178 00397         energy += P->mismatch23I[type][si1][sj1] + P->mismatch23I[type\_2][sq1][sp
179       1];
180 00398         \textcolor{keywordflow}{return} energy;
181 00399       \}
182 00400 
183 00401     \}
184 00402     \{ \textcolor{comment}{/* generic interior loop (no else here!)*/}
185 00403       energy = (n1+n2<=\hyperlink{energy__const_8h_ad1bd6eabac419670ddd3c9ed82145988}{MAXLOOP})?(P->internal\_loop[n1+n2]) : (P->internal\_loop[30]
186       +(int)(P->lxc*log((n1+n2)/30.)));
187 00404 
188 00405       energy += \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(MAX\_NINIO, (nl-ns)*P->ninio[2]);
189 00406 
190 00407       energy += P->mismatchI[type][si1][sj1] + P->mismatchI[type\_2][sq1][sp1];
191 00408     \}
192 00409   \}
193 00410   \textcolor{keywordflow}{return} energy;
194 00411 \}
195 00412 
196 \hypertarget{loop__energies_8h_source_l00413}{}\hyperlink{loop__energies_8h_af5a6594eba9b2622cb47076650c69819}{00413} INLINE  PRIVATE \textcolor{keywordtype}{int} \hyperlink{loop__energies_8h_af5a6594eba9b2622cb47076650c69819}{E_Stem}(\textcolor{keywordtype}{int} type, \textcolor{keywordtype}{int} si1, \textcolor{keywordtype}{int} sj1, \textcolor{keywordtype}{int} extLoop, \hyperlink{structparamT}{paramT} *P)\{
197 00414   \textcolor{keywordtype}{int} energy = 0;
198 00415   \textcolor{keywordtype}{int} d5 = (si1 >= 0) ? P->dangle5[type][si1] : 0;
199 00416   \textcolor{keywordtype}{int} d3 = (sj1 >= 0) ? P->dangle3[type][sj1] : 0;
200 00417 
201 00418   \textcolor{keywordflow}{if}(type > 2)
202 00419     energy += P->TerminalAU;
203 00420 
204 00421   \textcolor{keywordflow}{if}(si1 >= 0 && sj1 >= 0)
205 00422     energy += (extLoop) ? P->mismatchExt[type][si1][sj1] : P->mismatchM[type][si1
206       ][sj1];
207 00423   \textcolor{keywordflow}{else}
208 00424     energy += d5 + d3;
209 00425 
210 00426   \textcolor{keywordflow}{if}(!extLoop) energy += P->MLintern[type];
211 00427   \textcolor{keywordflow}{return} energy;
212 00428 \}
213 00429 
214 00430 INLINE  PRIVATE \textcolor{keywordtype}{int} E\_ExtLoop(\textcolor{keywordtype}{int} type, \textcolor{keywordtype}{int} si1, \textcolor{keywordtype}{int} sj1, \hyperlink{structparamT}{paramT} *P)\{
215 00431   \textcolor{keywordtype}{int} energy = 0;
216 00432   \textcolor{keywordflow}{if}(si1 >= 0 && sj1 >= 0)\{
217 00433     energy += P->mismatchExt[type][si1][sj1];
218 00434   \}
219 00435   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (si1 >= 0)\{
220 00436     energy += P->dangle5[type][si1];
221 00437   \}
222 00438   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (sj1 >= 0)\{
223 00439     energy += P->dangle3[type][sj1];
224 00440   \}
225 00441 
226 00442   \textcolor{keywordflow}{if}(type > 2)
227 00443     energy += P->TerminalAU;
228 00444 
229 00445   \textcolor{keywordflow}{return} energy;
230 00446 \}
231 00447 
232 00448 INLINE  PRIVATE \textcolor{keywordtype}{int} E\_MLstem(\textcolor{keywordtype}{int} type, \textcolor{keywordtype}{int} si1, \textcolor{keywordtype}{int} sj1, \hyperlink{structparamT}{paramT} *P)\{
233 00449   \textcolor{keywordtype}{int} energy = 0;
234 00450   \textcolor{keywordflow}{if}(si1 >= 0 && sj1 >= 0)\{
235 00451     energy += P->mismatchM[type][si1][sj1];
236 00452   \}
237 00453   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (si1 >= 0)\{
238 00454     energy += P->dangle5[type][si1];
239 00455   \}
240 00456   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (sj1 >= 0)\{
241 00457     energy += P->dangle3[type][sj1];
242 00458   \}
243 00459 
244 00460   \textcolor{keywordflow}{if}(type > 2)
245 00461     energy += P->TerminalAU;
246 00462 
247 00463   energy += P->MLintern[type];
248 00464 
249 00465   \textcolor{keywordflow}{return} energy;
250 00466 \}
251 00467 
252 \hypertarget{loop__energies_8h_source_l00468}{}\hyperlink{loop__energies_8h_a0e128184bb097dc2da33706f33b555a6}{00468} INLINE  PRIVATE \textcolor{keywordtype}{double} \hyperlink{loop__energies_8h_a0e128184bb097dc2da33706f33b555a6}{exp_E_Hairpin}(\textcolor{keywordtype}{int} u, \textcolor{keywordtype}{int} type, \textcolor{keywordtype}{short} si1, \textcolor{keywordtype}{short} sj1, \textcolor{keyword}{const
253       } \textcolor{keywordtype}{char} *\textcolor{keywordtype}{string}, \hyperlink{structpf__paramT}{pf_paramT} *P)\{
254 00469   \textcolor{keywordtype}{double} q, kT;
255 00470   kT = P->kT;   \textcolor{comment}{/* kT in cal/mol  */}
256 00471 
257 00472   \textcolor{keywordflow}{if}(u <= 30)
258 00473     q = P->exphairpin[u];
259 00474   \textcolor{keywordflow}{else}
260 00475     q = P->exphairpin[30] * exp( -(P->lxc*log( u/30.))*10./kT);
261 00476 
262 00477   \textcolor{keywordflow}{if}(u < 3) \textcolor{keywordflow}{return} q; \textcolor{comment}{/* should only be the case when folding alignments */}
263 00478 
264 00479   \textcolor{keywordflow}{if} ((P->\hyperlink{structpf__paramT_a43ec875779c5e7c8bf5fa7e837ec6d09}{model_details}.\hyperlink{structmodel__detailsT_a9d73fde17b0465311a80f607faa85617}{special_hp})&&(u==4)) \{
265 00480     \textcolor{keywordtype}{char} tl[7]=\{0,0,0,0,0,0,0\}, *ts;
266 00481     strncpy(tl, \textcolor{keywordtype}{string}, 6);
267 00482     \textcolor{keywordflow}{if} ((ts=strstr(P->Tetraloops, tl)))\{
268 00483       \textcolor{keywordflow}{if}(type != 7)
269 00484         \textcolor{keywordflow}{return} (P->exptetra[(ts-P->Tetraloops)/7]);
270 00485       \textcolor{keywordflow}{else}
271 00486         q *= P->exptetra[(ts-P->Tetraloops)/7];
272 00487     \}
273 00488   \}
274 00489   \textcolor{keywordflow}{if} ((\hyperlink{fold__vars_8h_a4f6265bdf0ead7ff4628a360adbfd77e}{tetra_loop})&&(u==6)) \{
275 00490     \textcolor{keywordtype}{char} tl[9]=\{0,0,0,0,0,0,0,0,0\}, *ts;
276 00491     strncpy(tl, \textcolor{keywordtype}{string}, 6);
277 00492     \textcolor{keywordflow}{if} ((ts=strstr(P->Hexaloops, tl)))
278 00493       \textcolor{keywordflow}{return}  (P->exphex[(ts-P->Hexaloops)/9]);
279 00494   \}
280 00495   \textcolor{keywordflow}{if} (u==3) \{
281 00496     \textcolor{keywordtype}{char} tl[6]=\{0,0,0,0,0,0\}, *ts;
282 00497     strncpy(tl, \textcolor{keywordtype}{string}, 5);
283 00498     \textcolor{keywordflow}{if} ((ts=strstr(P->Triloops, tl)))
284 00499       \textcolor{keywordflow}{return} (P->exptri[(ts-P->Triloops)/6]);
285 00500     \textcolor{keywordflow}{if} (type>2)
286 00501       q *= P->expTermAU;
287 00502   \}
288 00503   \textcolor{keywordflow}{else} \textcolor{comment}{/* no mismatches for tri-loops */}
289 00504     q *= P->expmismatchH[type][si1][sj1];
290 00505 
291 00506   \textcolor{keywordflow}{return} q;
292 00507 \}
293 00508 
294 \hypertarget{loop__energies_8h_source_l00509}{}\hyperlink{loop__energies_8h_aa5e98e524e2a41e290b942b09544bc9e}{00509} INLINE  PRIVATE \textcolor{keywordtype}{double} \hyperlink{loop__energies_8h_aa5e98e524e2a41e290b942b09544bc9e}{exp_E_IntLoop}(\textcolor{keywordtype}{int} u1, \textcolor{keywordtype}{int} u2, \textcolor{keywordtype}{int} type, \textcolor{keywordtype}{int} type2, \textcolor{keywordtype}{short} s
295       i1, \textcolor{keywordtype}{short} sj1, \textcolor{keywordtype}{short} sp1, \textcolor{keywordtype}{short} sq1, \hyperlink{structpf__paramT}{pf_paramT} *P)\{
296 00510   \textcolor{keywordtype}{int} ul, us, no\_close = 0;
297 00511   \textcolor{keywordtype}{double} z = 0.;
298 00512 
299 00513   \textcolor{keywordflow}{if} ((\hyperlink{fold__vars_8h_aa8d1c7b92489179e1eafa562b7bdd259}{no_closingGU}) && ((type2==3)||(type2==4)||(type==3)||(type==4)))
300 00514     no\_close = 1;
301 00515 
302 00516   \textcolor{keywordflow}{if} (u1>u2) \{ ul=u1; us=u2;\}
303 00517   \textcolor{keywordflow}{else} \{ul=u2; us=u1;\}
304 00518 
305 00519   \textcolor{keywordflow}{if} (ul==0) \textcolor{comment}{/* stack */}
306 00520     z = P->expstack[type][type2];
307 00521   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(!no\_close)\{
308 00522     \textcolor{keywordflow}{if} (us==0) \{                      \textcolor{comment}{/* bulge */}
309 00523       z = P->expbulge[ul];
310 00524       \textcolor{keywordflow}{if} (ul==1) z *= P->expstack[type][type2];
311 00525       \textcolor{keywordflow}{else} \{
312 00526         \textcolor{keywordflow}{if} (type>2) z *= P->expTermAU;
313 00527         \textcolor{keywordflow}{if} (type2>2) z *= P->expTermAU;
314 00528       \}
315 00529       \textcolor{keywordflow}{return} z;
316 00530     \}
317 00531     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (us==1) \{
318 00532       \textcolor{keywordflow}{if} (ul==1)\{                    \textcolor{comment}{/* 1x1 loop */}
319 00533         \textcolor{keywordflow}{return} P->expint11[type][type2][si1][sj1];
320 00534       \}
321 00535       \textcolor{keywordflow}{if} (ul==2) \{                  \textcolor{comment}{/* 2x1 loop */}
322 00536         \textcolor{keywordflow}{if} (u1==1)
323 00537           \textcolor{keywordflow}{return} P->expint21[type][type2][si1][sq1][sj1];
324 00538         \textcolor{keywordflow}{else}
325 00539           \textcolor{keywordflow}{return} P->expint21[type2][type][sq1][si1][sp1];
326 00540       \}
327 00541       \textcolor{keywordflow}{else} \{  \textcolor{comment}{/* 1xn loop */}
328 00542         z = P->expinternal[ul+us] * P->expmismatch1nI[type][si1][sj1] * P->expmis
329       match1nI[type2][sq1][sp1];
330 00543         \textcolor{keywordflow}{return} z * P->expninio[2][ul-us];
331 00544       \}
332 00545     \}
333 00546     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (us==2) \{
334 00547       \textcolor{keywordflow}{if}(ul==2) \textcolor{comment}{/* 2x2 loop */}
335 00548         \textcolor{keywordflow}{return} P->expint22[type][type2][si1][sp1][sq1][sj1];
336 00549       \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(ul==3)\{              \textcolor{comment}{/* 2x3 loop */}
337 00550         z = P->expinternal[5]*P->expmismatch23I[type][si1][sj1]*P->expmismatch23I
338       [type2][sq1][sp1];
339 00551         \textcolor{keywordflow}{return} z * P->expninio[2][1];
340 00552       \}
341 00553     \}
342 00554     \textcolor{comment}{/* generic interior loop (no else here!)*/}
343 00555     z = P->expinternal[ul+us] * P->expmismatchI[type][si1][sj1] * P->expmismatchI
344       [type2][sq1][sp1];
345 00556     \textcolor{keywordflow}{return} z * P->expninio[2][ul-us];
346 00557 
347 00558   \}
348 00559   \textcolor{keywordflow}{return} z;
349 00560 \}
350 00561 
351 \hypertarget{loop__energies_8h_source_l00562}{}\hyperlink{loop__energies_8h_a76cc24ec96199e04beddad13e7891e21}{00562} INLINE  PRIVATE \textcolor{keywordtype}{double} \hyperlink{loop__energies_8h_a76cc24ec96199e04beddad13e7891e21}{exp_E_Stem}(\textcolor{keywordtype}{int} type, \textcolor{keywordtype}{int} si1, \textcolor{keywordtype}{int} sj1, \textcolor{keywordtype}{int} extLoop, 
352       \hyperlink{structpf__paramT}{pf_paramT} *P)\{
353 00563   \textcolor{keywordtype}{double} energy = 1.0;
354 00564   \textcolor{keywordtype}{double} d5 = (si1 >= 0) ? P->expdangle5[type][si1] : 1.;
355 00565   \textcolor{keywordtype}{double} d3 = (sj1 >= 0) ? P->expdangle3[type][sj1] : 1.;
356 00566 
357 00567   \textcolor{keywordflow}{if}(type > 2)
358 00568     energy *= P->expTermAU;
359 00569 
360 00570   \textcolor{keywordflow}{if}(si1 >= 0 && sj1 >= 0)
361 00571     energy *= (extLoop) ? P->expmismatchExt[type][si1][sj1] : P->expmismatchM[typ
362       e][si1][sj1];
363 00572   \textcolor{keywordflow}{else}
364 00573     energy *= d5 * d3;
365 00574 
366 00575   \textcolor{keywordflow}{if}(!extLoop) energy *= P->expMLintern[type];
367 00576   \textcolor{keywordflow}{return} energy;
368 00577 \}
369 00578 
370 00579 INLINE  PRIVATE \textcolor{keywordtype}{double} exp\_E\_MLstem(\textcolor{keywordtype}{int} type, \textcolor{keywordtype}{int} si1, \textcolor{keywordtype}{int} sj1, \hyperlink{structpf__paramT}{pf_paramT} *P)\{
371 00580   \textcolor{keywordtype}{double} energy = 1.0;
372 00581   \textcolor{keywordflow}{if}(si1 >= 0 && sj1 >= 0)\{
373 00582     energy *= P->expmismatchM[type][si1][sj1];
374 00583   \}
375 00584   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(si1 >= 0)\{
376 00585     energy *= P->expdangle5[type][si1];
377 00586   \}
378 00587   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(sj1 >= 0)\{
379 00588     energy *= P->expdangle3[type][sj1];
380 00589   \}
381 00590 
382 00591   \textcolor{keywordflow}{if}(type > 2)
383 00592     energy *= P->expTermAU;
384 00593 
385 00594   energy *= P->expMLintern[type];
386 00595   \textcolor{keywordflow}{return} energy;
387 00596 \}
388 00597 
389 00598 INLINE  PRIVATE \textcolor{keywordtype}{double} exp\_E\_ExtLoop(\textcolor{keywordtype}{int} type, \textcolor{keywordtype}{int} si1, \textcolor{keywordtype}{int} sj1, \hyperlink{structpf__paramT}{pf_paramT} *P)\{
390 00599   \textcolor{keywordtype}{double} energy = 1.0;
391 00600   \textcolor{keywordflow}{if}(si1 >= 0 && sj1 >= 0)\{
392 00601     energy *= P->expmismatchExt[type][si1][sj1];
393 00602   \}
394 00603   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(si1 >= 0)\{
395 00604     energy *= P->expdangle5[type][si1];
396 00605   \}
397 00606   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(sj1 >= 0)\{
398 00607     energy *= P->expdangle3[type][sj1];
399 00608   \}
400 00609 
401 00610   \textcolor{keywordflow}{if}(type > 2)
402 00611     energy *= P->expTermAU;
403 00612 
404 00613   \textcolor{keywordflow}{return} energy;
405 00614 \}
406 00615 
407 00616 INLINE  PRIVATE \textcolor{keywordtype}{int}     E\_IntLoop\_Co(\textcolor{keywordtype}{int} type, \textcolor{keywordtype}{int} type\_2, \textcolor{keywordtype}{int} i, \textcolor{keywordtype}{int} j, \textcolor{keywordtype}{int} p, \textcolor{keywordtype}{i
408       nt} q, \textcolor{keywordtype}{int} cutpoint, \textcolor{keywordtype}{short} si1, \textcolor{keywordtype}{short} sj1, \textcolor{keywordtype}{short} sp1, \textcolor{keywordtype}{short} sq1, \textcolor{keywordtype}{int} dangles, 
409       \hyperlink{structparamT}{paramT} *P)\{
410 00617   \textcolor{keywordtype}{int} energy = 0;
411 00618   \textcolor{keywordflow}{if}(type > 2)   energy += P->TerminalAU;
412 00619   \textcolor{keywordflow}{if}(type\_2 > 2) energy += P->TerminalAU;
413 00620 
414 00621   \textcolor{keywordflow}{if}(!dangles) \textcolor{keywordflow}{return} energy;
415 00622 
416 00623   \textcolor{keywordtype}{int} ci = (i>=cutpoint)||((i+1)<cutpoint);
417 00624   \textcolor{keywordtype}{int} cj = ((j-1)>=cutpoint)||(j<cutpoint);
418 00625   \textcolor{keywordtype}{int} cp = ((p-1)>=cutpoint)||(p<cutpoint);
419 00626   \textcolor{keywordtype}{int} cq = (q>=cutpoint)||((q+1)<cutpoint);
420 00627 
421 00628   \textcolor{keywordtype}{int} d3    = ci  ? P->dangle3[type][si1]   : 0;
422 00629   \textcolor{keywordtype}{int} d5    = cj  ? P->dangle5[type][sj1]   : 0;
423 00630   \textcolor{keywordtype}{int} d5\_2  = cp  ? P->dangle5[type\_2][sp1] : 0;
424 00631   \textcolor{keywordtype}{int} d3\_2  = cq  ? P->dangle3[type\_2][sq1] : 0;
425 00632 
426 00633   \textcolor{keywordtype}{int} tmm   = (cj && ci) ? P->mismatchExt[type][sj1][si1]   : d5 + d3;
427 00634   \textcolor{keywordtype}{int} tmm\_2 = (cp && cq) ? P->mismatchExt[type\_2][sp1][sq1] : d5\_2 + d3\_2;
428 00635 
429 00636   \textcolor{keywordflow}{if}(dangles == 2) \textcolor{keywordflow}{return} energy + tmm + tmm\_2;
430 00637 
431 00638   \textcolor{comment}{/* now we may have non-double dangles only */}
432 00639   \textcolor{keywordflow}{if}(i+2 < p)\{
433 00640     \textcolor{keywordflow}{if}(q+2 < j)\{ energy += tmm + tmm\_2;\}
434 00641     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(q+2 == j)\{ energy += (cj && cq) ? \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(tmm + d5\_2, tmm\_2 + d3) : tmm 
435       + tmm\_2;\}
436 00642     \textcolor{keywordflow}{else} energy += d3 + d5\_2;
437 00643   \}
438 00644   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(i+2 == p)\{
439 00645     \textcolor{keywordflow}{if}(q+2 < j)\{ energy += (ci && cp) ? \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(tmm + d3\_2, tmm\_2 + d5) : tmm + tmm\_
440       2;\}
441 00646     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(q+2 == j)\{
442 00647       energy += \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(tmm, \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(tmm\_2, \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(d5 + d5\_2, d3 + d3\_2)));
443 00648     \}
444 00649     \textcolor{keywordflow}{else} energy += \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(d3, d5\_2);
445 00650   \}
446 00651   \textcolor{keywordflow}{else}\{
447 00652     \textcolor{keywordflow}{if}(q+2 < j)\{ energy += d5 + d3\_2;\}
448 00653     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(q+2 == j)\{ energy += \hyperlink{utils_8h_ae0b9cd0ce090bd69b951aa73e8fa4f7d}{MIN2}(d5, d3\_2);\}
449 00654   \}
450 00655   \textcolor{keywordflow}{return} energy;
451 00656 \}
452 00657 
453 00658 \textcolor{preprocessor}{#endif}
454 \end{alltt}\end{footnotesize}