File: rotor_8h_source.shtml

package info (click to toggle)
openbabel 2.3.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 75,308 kB
  • ctags: 41,952
  • sloc: cpp: 321,252; ansic: 89,228; python: 7,262; perl: 6,418; pascal: 793; sh: 194; xml: 97; ruby: 55; makefile: 47; java: 23
file content (513 lines) | stat: -rw-r--r-- 50,100 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>rotor.h Source File</title>
<link href="/site.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="search/search.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
</head>

<body>

<!--#include file="header.html" -->
<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.shtml"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.shtml"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.shtml"><span>Modules</span></a></li>
      <li><a href="namespaces.shtml"><span>Namespaces</span></a></li>
      <li><a href="annotated.shtml"><span>Classes</span></a></li>
      <li class="current"><a href="files.shtml"><span>Files</span></a></li>
      <li><a href="examples.shtml"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.shtml"><span>File&#160;List</span></a></li>
      <li><a href="globals.shtml"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">rotor.h</div>  </div>
</div>
<div class="contents">
<a href="rotor_8h.shtml">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/**********************************************************************</span>
<a name="l00002"></a>00002 <span class="comment">rotor.h - Rotate torsional according to rotor rules.</span>
<a name="l00003"></a>00003 <span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment">Copyright (C) 1998-2000 by OpenEye Scientific Software, Inc.</span>
<a name="l00005"></a>00005 <span class="comment">Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison</span>
<a name="l00006"></a>00006 <span class="comment"></span>
<a name="l00007"></a>00007 <span class="comment">This file is part of the Open Babel project.</span>
<a name="l00008"></a>00008 <span class="comment">For more information, see &lt;http://openbabel.org/&gt;</span>
<a name="l00009"></a>00009 <span class="comment"></span>
<a name="l00010"></a>00010 <span class="comment">This program is free software; you can redistribute it and/or modify</span>
<a name="l00011"></a>00011 <span class="comment">it under the terms of the GNU General Public License as published by</span>
<a name="l00012"></a>00012 <span class="comment">the Free Software Foundation version 2 of the License.</span>
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">This program is distributed in the hope that it will be useful,</span>
<a name="l00015"></a>00015 <span class="comment">but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00016"></a>00016 <span class="comment">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00017"></a>00017 <span class="comment">GNU General Public License for more details.</span>
<a name="l00018"></a>00018 <span class="comment">***********************************************************************/</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#ifndef OB_ROTOR_H</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define OB_ROTOR_H</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;<a class="code" href="parsmart_8h.shtml" title="Daylight SMARTS parser.">openbabel/parsmart.h</a>&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;<a class="code" href="typer_8h.shtml" title="Open Babel atom and aromaticity typer.">openbabel/typer.h</a>&gt;</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="keyword">namespace </span>OpenBabel
<a name="l00027"></a>00027 {
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="preprocessor">#ifndef SQUARE</span>
<a name="l00030"></a><a class="code" href="rotor_8h.shtml#aa1cf70a99e21bc2032e8867c6cafbb43">00030</a> <span class="preprocessor"></span><span class="preprocessor">#define SQUARE(x) ((x)*(x))</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00040"></a><a class="code" href="classOpenBabel_1_1OBRotorRule.shtml">00040</a>   <span class="keyword">class </span>OBAPI <a class="code" href="classOpenBabel_1_1OBRotorRule.shtml" title="A rule for torsional conformer searching, defined by a SMARTS pattern.">OBRotorRule</a>
<a name="l00041"></a>00041   {
<a name="l00042"></a>00042     <span class="keywordtype">int</span>                 _ref[4]; 
<a name="l00043"></a>00043     <span class="keywordtype">double</span>              _delta;  
<a name="l00044"></a>00044     std::string         _s;      
<a name="l00045"></a>00045     <a class="code" href="classOpenBabel_1_1OBSmartsPattern.shtml" title="SMARTS (SMiles ARbitrary Target Specification) substructure searching.">OBSmartsPattern</a>*    _sp;     
<a name="l00046"></a>00046     std::vector&lt;double&gt; _vals;   
<a name="l00047"></a>00047   <span class="keyword">public</span>:
<a name="l00048"></a>00048 
<a name="l00049"></a><a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#ac65f277d7001f0b88bfeb47c25490995">00049</a>   <a class="code" href="classOpenBabel_1_1OBRotorRule.shtml" title="A rule for torsional conformer searching, defined by a SMARTS pattern.">OBRotorRule</a>(<span class="keywordtype">char</span> *buffer,<span class="keywordtype">int</span> ref[4],std::vector&lt;double&gt; &amp;vals,<span class="keywordtype">double</span> d):
<a name="l00050"></a>00050     _delta(d), _s(buffer), _vals(vals)
<a name="l00051"></a>00051     {
<a name="l00052"></a>00052       _sp = <span class="keyword">new</span> <a class="code" href="classOpenBabel_1_1OBSmartsPattern.shtml" title="SMARTS (SMiles ARbitrary Target Specification) substructure searching.">OBSmartsPattern</a>;
<a name="l00053"></a>00053       _sp-&gt;<a class="code" href="classOpenBabel_1_1OBSmartsPattern.shtml#ab90ce667d180e55f26e7054ed1c6c8b1">Init</a>(buffer);
<a name="l00054"></a>00054       memcpy(_ref,ref,<span class="keyword">sizeof</span>(<span class="keywordtype">int</span>)*4);
<a name="l00055"></a>00055     }
<a name="l00056"></a>00056 
<a name="l00057"></a><a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a236044823d65dffe4868c831e45a157b">00057</a>     ~<a class="code" href="classOpenBabel_1_1OBRotorRule.shtml" title="A rule for torsional conformer searching, defined by a SMARTS pattern.">OBRotorRule</a>()
<a name="l00058"></a>00058       {
<a name="l00059"></a>00059         <span class="keywordflow">if</span> (_sp)
<a name="l00060"></a>00060           {
<a name="l00061"></a>00061             <span class="keyword">delete</span> _sp;
<a name="l00062"></a>00062             _sp = NULL;
<a name="l00063"></a>00063           }
<a name="l00064"></a>00064       }
<a name="l00065"></a>00065 
<a name="l00067"></a><a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a9dcb9b43a3d0fa9003d4c1c9d921f6b2">00067</a>     <span class="keywordtype">bool</span>    <a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a9dcb9b43a3d0fa9003d4c1c9d921f6b2">IsValid</a>()    {        <span class="keywordflow">return</span>(_sp-&gt;IsValid());       }
<a name="l00071"></a><a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a6583697916569d12c1a113b4ad4dbcc2">00071</a>     <span class="keywordtype">void</span>    <a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a6583697916569d12c1a113b4ad4dbcc2">GetReferenceAtoms</a>(<span class="keywordtype">int</span> ref[4]) { memcpy(ref,_ref,<span class="keyword">sizeof</span>(<span class="keywordtype">int</span>)*4); }
<a name="l00073"></a><a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a800aee2a9873012ac7e2a1bcedd5c6ba">00073</a>     <span class="keywordtype">void</span>    <a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a800aee2a9873012ac7e2a1bcedd5c6ba" title="Set the resolution (delta) of a torsional step in degrees.">SetDelta</a>(<span class="keywordtype">double</span> d)    {       _delta = d;           }
<a name="l00075"></a><a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#abaa1b786f36fb9bc98b5c46e74425056">00075</a>     <span class="keywordtype">double</span>  <a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#abaa1b786f36fb9bc98b5c46e74425056">GetDelta</a>()            {       <span class="keywordflow">return</span>(_delta);       }
<a name="l00077"></a><a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a111e26305dbd8f7c211cc259dff440e7">00077</a>     std::vector&lt;double&gt;   &amp;<a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a111e26305dbd8f7c211cc259dff440e7">GetTorsionVals</a>()    { <span class="keywordflow">return</span>(_vals); }
<a name="l00079"></a><a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a84366a387431ba9c8ed2f3813e60badd">00079</a>     std::string  &amp;<a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a84366a387431ba9c8ed2f3813e60badd">GetSmartsString</a>(){      <span class="keywordflow">return</span>(_s);           }
<a name="l00081"></a><a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a1b97208b08b2495efa0a4484b4d61938">00081</a>     <a class="code" href="classOpenBabel_1_1OBSmartsPattern.shtml" title="SMARTS (SMiles ARbitrary Target Specification) substructure searching.">OBSmartsPattern</a> *<a class="code" href="classOpenBabel_1_1OBRotorRule.shtml#a1b97208b08b2495efa0a4484b4d61938">GetSmartsPattern</a>() {  <span class="keywordflow">return</span>(_sp);         }
<a name="l00082"></a>00082   };
<a name="l00083"></a>00083 
<a name="l00090"></a><a class="code" href="classOpenBabel_1_1OBRotorRules.shtml">00090</a>  <span class="keyword">class </span>OBAPI <a class="code" href="classOpenBabel_1_1OBRotorRules.shtml" title="Database of default hybridization torsional rules and SMARTS-defined OBRotorRule objects.">OBRotorRules</a> : <span class="keyword">public</span> <a class="code" href="classOpenBabel_1_1OBGlobalDataBase.shtml" title="Base data table class, handles reading data files.">OBGlobalDataBase</a>
<a name="l00091"></a>00091   {
<a name="l00092"></a>00092     <span class="keywordtype">bool</span>                       _quiet;  
<a name="l00093"></a>00093     std::vector&lt;OBRotorRule*&gt;  _vr;     
<a name="l00094"></a>00094     std::vector&lt;double&gt;        _sp3sp3; 
<a name="l00095"></a>00095     std::vector&lt;double&gt;        _sp3sp2; 
<a name="l00096"></a>00096     std::vector&lt;double&gt;        _sp2sp2; 
<a name="l00097"></a>00097   <span class="keyword">public</span>:
<a name="l00098"></a>00098     <a class="code" href="classOpenBabel_1_1OBRotorRules.shtml" title="Database of default hybridization torsional rules and SMARTS-defined OBRotorRule objects.">OBRotorRules</a>();
<a name="l00099"></a>00099     ~<a class="code" href="classOpenBabel_1_1OBRotorRules.shtml" title="Database of default hybridization torsional rules and SMARTS-defined OBRotorRule objects.">OBRotorRules</a>();
<a name="l00100"></a>00100 
<a name="l00101"></a>00101     <span class="keywordtype">void</span> ParseLine(<span class="keyword">const</span> <span class="keywordtype">char</span>*);
<a name="l00103"></a><a class="code" href="classOpenBabel_1_1OBRotorRules.shtml#aab7c531e5ffc5174e57a85e853931534">00103</a>     <span class="keywordtype">size_t</span> <a class="code" href="classOpenBabel_1_1OBRotorRules.shtml#aab7c531e5ffc5174e57a85e853931534">GetSize</a>()                 { <span class="keywordflow">return</span> _vr.size();}
<a name="l00104"></a>00104 
<a name="l00106"></a><a class="code" href="classOpenBabel_1_1OBRotorRules.shtml#adeb3abe4bd6c3443362068379a6b665e">00106</a>     <span class="keywordtype">void</span> <a class="code" href="classOpenBabel_1_1OBRotorRules.shtml#adeb3abe4bd6c3443362068379a6b665e" title="Set the filename to be used for the database. Default = torlib.txt.">SetFilename</a>(std::string &amp;s)       { _filename = s;    }
<a name="l00107"></a>00107 
<a name="l00114"></a>00114     <span class="keywordtype">void</span> GetRotorIncrements(<a class="code" href="classOpenBabel_1_1OBMol.shtml" title="Molecule Class.">OBMol</a>&amp; mol,<a class="code" href="classOpenBabel_1_1OBBond.shtml" title="Bond class.">OBBond</a>* bond,<span class="keywordtype">int</span> refs[4],
<a name="l00115"></a>00115                             std::vector&lt;double&gt; &amp;vals,<span class="keywordtype">double</span> &amp;delta);
<a name="l00117"></a><a class="code" href="classOpenBabel_1_1OBRotorRules.shtml#a3bf46031273468cc23720df1c59d3e85">00117</a>     <span class="keywordtype">void</span> <a class="code" href="classOpenBabel_1_1OBRotorRules.shtml#a3bf46031273468cc23720df1c59d3e85" title="Turn off debugging output from GetRotorIncrements()">Quiet</a>()                           { _quiet=<span class="keyword">true</span>;      }
<a name="l00118"></a>00118   };
<a name="l00119"></a>00119 
<a name="l00124"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml">00124</a>   <span class="keyword">class </span>OBAPI <a class="code" href="classOpenBabel_1_1OBRotor.shtml" title="A single rotatable OBBond as part of rotamer searching.">OBRotor</a>
<a name="l00125"></a>00125   {
<a name="l00126"></a>00126     <span class="keywordtype">int</span> _idx; 
<a name="l00127"></a>00127     std::vector&lt;int&gt; _rotatoms; 
<a name="l00128"></a>00128     <span class="keywordtype">double</span> _imag, _refang; 
<a name="l00129"></a>00129     <a class="code" href="classOpenBabel_1_1OBBond.shtml" title="Bond class.">OBBond</a> *_bond; 
<a name="l00130"></a>00130     std::vector&lt;int&gt; _ref, _torsion; 
<a name="l00131"></a>00131     <a class="code" href="classOpenBabel_1_1OBBitVec.shtml" title="A speed-optimized vector of bits.">OBBitVec</a> _fixedatoms,_fixedbonds, _evalatoms; 
<a name="l00132"></a>00132     std::vector&lt;double&gt; _torsionAngles;  
<a name="l00133"></a>00133     std::vector&lt;double&gt; _invmag; 
<a name="l00134"></a>00134     std::vector&lt;std::vector&lt;double&gt; &gt; _sn,_cs,_t; 
<a name="l00135"></a>00135   <span class="keyword">public</span>:
<a name="l00139"></a>00139     <a class="code" href="classOpenBabel_1_1OBRotor.shtml" title="A single rotatable OBBond as part of rotamer searching.">OBRotor</a>();
<a name="l00143"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a6a1a300dca75a2089732a7a66f7e1234">00143</a>     ~<a class="code" href="classOpenBabel_1_1OBRotor.shtml" title="A single rotatable OBBond as part of rotamer searching.">OBRotor</a>()
<a name="l00144"></a>00144     {
<a name="l00145"></a>00145     }
<a name="l00146"></a>00146 
<a name="l00149"></a>00149 
<a name="l00152"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a75c73979e73fb44e48424150fa0208c7">00152</a>     <span class="keywordtype">void</span> SetBond(<a class="code" href="classOpenBabel_1_1OBBond.shtml" title="Bond class.">OBBond</a> *bond)
<a name="l00153"></a>00153     {
<a name="l00154"></a>00154       _bond = bond;
<a name="l00155"></a>00155     }
<a name="l00159"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#ab994a975e39f5c62288f4f972b6f90c9">00159</a>     <span class="keywordtype">void</span> SetIdx(<span class="keywordtype">int</span> idx)
<a name="l00160"></a>00160     {
<a name="l00161"></a>00161       _idx = idx;
<a name="l00162"></a>00162     }
<a name="l00167"></a>00167     <span class="keywordtype">void</span> SetDihedralAtoms(std::vector&lt;int&gt; &amp;ref);
<a name="l00172"></a>00172     <span class="keywordtype">void</span> SetDihedralAtoms(<span class="keywordtype">int</span> ref[4]);
<a name="l00178"></a>00178     <span class="keywordtype">void</span> SetRotAtoms(std::vector&lt;int&gt; &amp;atoms);
<a name="l00182"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a0d37d5e994df8c97fe401ee821a3cbe7">00182</a>     <span class="keywordtype">void</span> SetTorsionValues(std::vector&lt;double&gt; &amp;angles)
<a name="l00183"></a>00183     {
<a name="l00184"></a>00184       _torsionAngles = angles;
<a name="l00185"></a>00185     }
<a name="l00189"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#ab263260a251aaa20610c7ca9dba31491">00189</a>     <span class="keywordtype">void</span> SetFixedBonds(<a class="code" href="classOpenBabel_1_1OBBitVec.shtml" title="A speed-optimized vector of bits.">OBBitVec</a> &amp;bv)
<a name="l00190"></a>00190     {
<a name="l00191"></a>00191       _fixedbonds = bv;
<a name="l00192"></a>00192     }
<a name="l00194"></a>00194 
<a name="l00197"></a>00197 
<a name="l00202"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a00e2cf7f72570502a2e543e85499b1cc">00202</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> SetToAngle(<span class="keywordtype">double</span> *coordinates, <span class="keywordtype">double</span> setang)
<a name="l00203"></a>00203     {
<a name="l00204"></a>00204       <span class="keywordtype">double</span> <span class="comment">/*dx,dy,dz,*/</span> sn,cs,t,ang,mag;
<a name="l00205"></a>00205       <span class="comment">// compute the angle to rotate (radians)</span>
<a name="l00206"></a>00206       ang = setang - CalcTorsion(coordinates);
<a name="l00207"></a>00207       <span class="comment">// if the angle to rotate is too small, we&#39;re done</span>
<a name="l00208"></a>00208       <span class="keywordflow">if</span> (fabs(ang) &lt; 1e-5)
<a name="l00209"></a>00209         <span class="keywordflow">return</span>;
<a name="l00210"></a>00210 
<a name="l00211"></a>00211       <span class="comment">// compute the bond length</span>
<a name="l00212"></a>00212       mag = CalcBondLength(coordinates);
<a name="l00213"></a>00213       <span class="comment">// compute some rotation matrix elements</span>
<a name="l00214"></a>00214       sn = sin(ang);
<a name="l00215"></a>00215       cs = cos(ang);
<a name="l00216"></a>00216       t = 1 - cs;
<a name="l00217"></a>00217 
<a name="l00218"></a>00218       <span class="comment">// perform rotation</span>
<a name="l00219"></a>00219       Set(coordinates, sn, cs, t, 1.0 / mag);
<a name="l00220"></a>00220     }
<a name="l00231"></a>00231     <span class="keywordtype">void</span> SetRotor(<span class="keywordtype">double</span> *coordinates, <span class="keywordtype">int</span> next, <span class="keywordtype">int</span> prev = -1);
<a name="l00236"></a>00236     <span class="keywordtype">void</span> Set(<span class="keywordtype">double</span> *coordinates, <span class="keywordtype">double</span> sine, <span class="keywordtype">double</span> cosine, <span class="keywordtype">double</span> translation, <span class="keywordtype">double</span> invmag);
<a name="l00285"></a>00285     <span class="keywordtype">void</span> Precompute(<span class="keywordtype">double</span> *coordinates);
<a name="l00293"></a>00293     <span class="keywordtype">void</span> Set(<span class="keywordtype">double</span> *coordinates, <span class="keywordtype">int</span> idx);
<a name="l00300"></a>00300     <span class="keywordtype">void</span> Precalc(std::vector&lt;double*&gt; &amp;conformers);
<a name="l00310"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a1ade9c212155ac04f25ddf32731657ea">00310</a>     <span class="keywordtype">void</span> Set(<span class="keywordtype">double</span> *coordinates, <span class="keywordtype">int</span> conformer, <span class="keywordtype">int</span> idx)
<a name="l00311"></a>00311     {
<a name="l00312"></a>00312       Set(coordinates, _sn[conformer][idx], _cs[conformer][idx], _t[conformer][idx], _invmag[conformer]);
<a name="l00313"></a>00313     }
<a name="l00315"></a>00315 
<a name="l00316"></a>00316 
<a name="l00319"></a>00319 
<a name="l00322"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a1b723190c734e234d87398f8eb245a8e">00322</a>     <a class="code" href="classOpenBabel_1_1OBBond.shtml" title="Bond class.">OBBond</a> *GetBond()
<a name="l00323"></a>00323     {
<a name="l00324"></a>00324       <span class="keywordflow">return</span>(_bond);
<a name="l00325"></a>00325     }
<a name="l00330"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a7b470b21b5807f0a9162bef72aebfef9">00330</a>     <span class="keywordtype">size_t</span> Size()
<a name="l00331"></a>00331     {
<a name="l00332"></a>00332       <span class="keywordflow">return</span> _torsionAngles.size();
<a name="l00333"></a>00333     }
<a name="l00337"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#ac8451eabbc164153f5030ae9723cf48b">00337</a>     <span class="keywordtype">int</span> GetIdx()<span class="keyword"> const</span>
<a name="l00338"></a>00338 <span class="keyword">    </span>{
<a name="l00339"></a>00339       <span class="keywordflow">return</span> _idx;
<a name="l00340"></a>00340     }
<a name="l00344"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a44db679688b64e9032ea9bf6def76315">00344</a>     <span class="keywordtype">void</span> GetDihedralAtoms(<span class="keywordtype">int</span> ref[4])
<a name="l00345"></a>00345     {
<a name="l00346"></a>00346       <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 4; ++i)
<a name="l00347"></a>00347         ref[i] = _ref[i];
<a name="l00348"></a>00348     }
<a name="l00352"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a75d6cacf7c1783272f74546387716902">00352</a>     std::vector&lt;int&gt; &amp;GetDihedralAtoms()
<a name="l00353"></a>00353     {
<a name="l00354"></a>00354       <span class="keywordflow">return</span> _ref;
<a name="l00355"></a>00355     }
<a name="l00360"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a7092cc4675cd2c384be6c8d4cf6b75ae">00360</a>     <span class="keyword">const</span> std::vector&lt;int&gt;&amp; GetRotAtoms()<span class="keyword"> const</span>
<a name="l00361"></a>00361 <span class="keyword">    </span>{
<a name="l00362"></a>00362       <span class="keywordflow">return</span> _rotatoms;
<a name="l00363"></a>00363     }
<a name="l00367"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a21e54e7c2d59ecbf4dfd8787a9d204e0">00367</a>     <span class="keyword">const</span> std::vector&lt;double&gt; &amp;GetTorsionValues()<span class="keyword"> const</span>
<a name="l00368"></a>00368 <span class="keyword">    </span>{
<a name="l00369"></a>00369       <span class="keywordflow">return</span> _torsionAngles;
<a name="l00370"></a>00370     }
<a name="l00375"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#ade5378a288a25258f4e3cc28a954bc2e">00375</a>     <a class="code" href="classOpenBabel_1_1OBBitVec.shtml" title="A speed-optimized vector of bits.">OBBitVec</a> &amp;GetFixedBonds()
<a name="l00376"></a>00376     {
<a name="l00377"></a>00377       <span class="keywordflow">return</span> _fixedbonds;
<a name="l00378"></a>00378     }
<a name="l00384"></a>00384     <span class="keywordtype">double</span> CalcTorsion(<span class="keywordtype">double</span> *coordinates);
<a name="l00389"></a>00389     <span class="keywordtype">double</span> CalcBondLength(<span class="keywordtype">double</span> *coordinates);
<a name="l00391"></a>00391 
<a name="l00392"></a>00392 
<a name="l00395"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a06d5fdac08688bdff198a92c78bdeb69">00395</a>     std::vector&lt;double&gt;::iterator BeginTorIncrement()
<a name="l00396"></a>00396     {
<a name="l00397"></a>00397       <span class="keywordflow">return</span> _torsionAngles.begin();
<a name="l00398"></a>00398     }
<a name="l00399"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#ac5857c1e09978240624038b2c6352dcc">00399</a>     std::vector&lt;double&gt;::iterator EndTorIncrement()
<a name="l00400"></a>00400     {
<a name="l00401"></a>00401       <span class="keywordflow">return</span> _torsionAngles.end();
<a name="l00402"></a>00402     }
<a name="l00404"></a>00404 
<a name="l00405"></a>00405     <span class="keywordtype">void</span> RemoveSymTorsionValues(<span class="keywordtype">int</span>);
<a name="l00406"></a>00406 
<a name="l00409"></a>00409 
<a name="l00410"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a800aee2a9873012ac7e2a1bcedd5c6ba">00410</a>     <span class="keywordtype">void</span> <a class="code" href="classOpenBabel_1_1OBRotor.shtml#a800aee2a9873012ac7e2a1bcedd5c6ba">SetDelta</a>(<span class="keywordtype">double</span> UNUSED(d)) {}
<a name="l00412"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#abaa1b786f36fb9bc98b5c46e74425056">00412</a>     <span class="keywordtype">double</span> <a class="code" href="classOpenBabel_1_1OBRotor.shtml#abaa1b786f36fb9bc98b5c46e74425056">GetDelta</a>() { <span class="keywordflow">return</span> 10.0; }
<a name="l00414"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a937745b1178a21d8b223992d16d7d50a">00414</a>     <a class="code" href="classOpenBabel_1_1OBBitVec.shtml" title="A speed-optimized vector of bits.">OBBitVec</a> &amp;<a class="code" href="classOpenBabel_1_1OBRotor.shtml#a937745b1178a21d8b223992d16d7d50a">GetFixedAtoms</a>() { <span class="keywordflow">return</span> _fixedatoms; }
<a name="l00416"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a530a0fd1a1e312d489b367ac73e56bb7">00416</a>     <span class="keywordtype">void</span> <a class="code" href="classOpenBabel_1_1OBRotor.shtml#a530a0fd1a1e312d489b367ac73e56bb7">SetFixedAtoms</a>(<a class="code" href="classOpenBabel_1_1OBBitVec.shtml" title="A speed-optimized vector of bits.">OBBitVec</a> &amp;bv) { _fixedatoms = bv; }
<a name="l00418"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#ab690ce98b2f06352f9079eeae94da3c4">00418</a>     <a class="code" href="classOpenBabel_1_1OBBitVec.shtml" title="A speed-optimized vector of bits.">OBBitVec</a> &amp;<a class="code" href="classOpenBabel_1_1OBRotor.shtml#ab690ce98b2f06352f9079eeae94da3c4">GetEvalAtoms</a>() { <span class="keywordflow">return</span> _evalatoms; }
<a name="l00420"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a33bdb71641015f05a632ffaf76e7672a">00420</a>     <span class="keywordtype">void</span> <a class="code" href="classOpenBabel_1_1OBRotor.shtml#a33bdb71641015f05a632ffaf76e7672a">SetEvalAtoms</a>(<a class="code" href="classOpenBabel_1_1OBBitVec.shtml" title="A speed-optimized vector of bits.">OBBitVec</a> &amp;bv) { _evalatoms = bv; }
<a name="l00422"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#aa68d318d4f18049ca83fbbe8d1c5fa90">00422</a>     <span class="keywordtype">void</span>* <a class="code" href="classOpenBabel_1_1OBRotor.shtml#aa68d318d4f18049ca83fbbe8d1c5fa90">GetRotAtoms</a>() { <span class="keywordflow">return</span> &amp;_rotatoms; }
<a name="l00424"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a8feebfa38afe9888e7a50e421b8f5243">00424</a>     std::vector&lt;double&gt; &amp;<a class="code" href="classOpenBabel_1_1OBRotor.shtml#a8feebfa38afe9888e7a50e421b8f5243">GetResolution</a>() { <span class="keywordflow">return</span> _torsionAngles; }
<a name="l00426"></a><a class="code" href="classOpenBabel_1_1OBRotor.shtml#a4e82f80e2cd8faf3bce17c464ab1672c">00426</a>     <span class="keywordtype">void</span> <a class="code" href="classOpenBabel_1_1OBRotor.shtml#a4e82f80e2cd8faf3bce17c464ab1672c">SetNumCoords</a>(<span class="keywordtype">int</span> UNUSED(nc)) {}
<a name="l00428"></a>00428 
<a name="l00429"></a>00429   };
<a name="l00430"></a>00430 
<a name="l00431"></a>00431 
<a name="l00433"></a><a class="code" href="namespaceOpenBabel.shtml#a434f394d0613a8ef6c119670ff49710f">00433</a>   <span class="keyword">typedef</span> std::vector&lt;OBRotor*&gt;::iterator <a class="code" href="namespaceOpenBabel.shtml#a434f394d0613a8ef6c119670ff49710f" title="A standard iterator over a vector of rotors.">OBRotorIterator</a>;
<a name="l00434"></a>00434 
<a name="l00439"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml">00439</a>   <span class="keyword">class </span>OBAPI <a class="code" href="classOpenBabel_1_1OBRotorList.shtml" title="Given an OBMol, set up a list of possibly rotatable torsions,.">OBRotorList</a>
<a name="l00440"></a>00440   {
<a name="l00441"></a>00441     <span class="keywordtype">bool</span> _quiet;                    
<a name="l00442"></a>00442     <span class="keywordtype">bool</span> _removesym;                
<a name="l00443"></a>00443     <a class="code" href="classOpenBabel_1_1OBBitVec.shtml" title="A speed-optimized vector of bits.">OBBitVec</a> _fixedatoms, _fixedbonds; 
<a name="l00444"></a>00444     <a class="code" href="classOpenBabel_1_1OBRotorRules.shtml" title="Database of default hybridization torsional rules and SMARTS-defined OBRotorRule objects.">OBRotorRules</a> _rr;               
<a name="l00445"></a>00445     std::vector&lt;int&gt; _dffv;         
<a name="l00446"></a>00446     std::vector&lt;OBRotor*&gt; _rotor;   
<a name="l00447"></a>00447 
<a name="l00448"></a>00448     std::vector&lt;std::pair&lt;OBSmartsPattern*,std::pair&lt;int,int&gt; &gt; &gt; _vsym2;
<a name="l00450"></a>00450     std::vector&lt;std::pair&lt;OBSmartsPattern*,std::pair&lt;int,int&gt; &gt; &gt; _vsym3;
<a name="l00451"></a>00451   <span class="keyword">public</span>:
<a name="l00455"></a>00455     <a class="code" href="classOpenBabel_1_1OBRotorList.shtml" title="Given an OBMol, set up a list of possibly rotatable torsions,.">OBRotorList</a>();
<a name="l00459"></a>00459     ~<a class="code" href="classOpenBabel_1_1OBRotorList.shtml" title="Given an OBMol, set up a list of possibly rotatable torsions,.">OBRotorList</a>();
<a name="l00460"></a>00460 
<a name="l00464"></a>00464     <span class="keywordtype">void</span> Clear();
<a name="l00468"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#a7b470b21b5807f0a9162bef72aebfef9">00468</a>     <span class="keywordtype">size_t</span> Size()
<a name="l00469"></a>00469     {
<a name="l00470"></a>00470       <span class="keywordflow">return</span>((_rotor.empty()) ? (<span class="keywordtype">size_t</span>)0: _rotor.size());
<a name="l00471"></a>00471     }
<a name="l00478"></a>00478     <span class="keywordtype">bool</span> IsFixedBond(<a class="code" href="classOpenBabel_1_1OBBond.shtml" title="Bond class.">OBBond</a>*);
<a name="l00482"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#aa0258fc5190b093eb234530b7e09f60f">00482</a>     <span class="keywordtype">bool</span> HasFixedBonds()
<a name="l00483"></a>00483     {
<a name="l00484"></a>00484       <span class="keywordflow">return</span> !_fixedbonds.Empty();
<a name="l00485"></a>00485     }
<a name="l00489"></a>00489     <span class="keywordtype">void</span> RemoveSymVals(<a class="code" href="classOpenBabel_1_1OBMol.shtml" title="Molecule Class.">OBMol</a>&amp;);
<a name="l00490"></a>00490 
<a name="l00491"></a>00491 
<a name="l00493"></a>00493 
<a name="l00499"></a>00499     <span class="keywordtype">bool</span> Setup(<a class="code" href="classOpenBabel_1_1OBMol.shtml" title="Molecule Class.">OBMol</a> &amp;mol);
<a name="l00503"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#ade6c00d93af1e19168894486ad6cbdba">00503</a>     <span class="keywordtype">void</span> SetFixedBonds(<a class="code" href="classOpenBabel_1_1OBBitVec.shtml" title="A speed-optimized vector of bits.">OBBitVec</a> &amp;fix)
<a name="l00504"></a>00504     {
<a name="l00505"></a>00505       _fixedbonds = fix;
<a name="l00506"></a>00506       _fixedatoms.<a class="code" href="classOpenBabel_1_1OBBitVec.shtml#aa71d36872f416feaa853788a7a7a7ef8" title="Set all bits to zero.">Clear</a>();
<a name="l00507"></a>00507     }
<a name="l00511"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#addb143a5ae2f64420fa692a14489288b">00511</a>     <span class="keywordtype">void</span> Init(std::string &amp;fname)
<a name="l00512"></a>00512     {
<a name="l00513"></a>00513       _rr.SetFilename(fname);
<a name="l00514"></a>00514       _rr.Init();
<a name="l00515"></a>00515     }
<a name="l00519"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#a15266fb4e5ef334d0de47b203d420f22">00519</a>     <span class="keywordtype">void</span> <a class="code" href="classOpenBabel_1_1OBRotorList.shtml#a15266fb4e5ef334d0de47b203d420f22">SetQuiet</a>() {
<a name="l00520"></a>00520       _quiet=<span class="keyword">true</span>;
<a name="l00521"></a>00521       _rr.Quiet();
<a name="l00522"></a>00522     }
<a name="l00527"></a>00527     <span class="keywordtype">bool</span> SetRotAtoms(<a class="code" href="classOpenBabel_1_1OBMol.shtml" title="Molecule Class.">OBMol</a>&amp;);
<a name="l00539"></a>00539     <span class="keywordtype">bool</span> FindRotors(<a class="code" href="classOpenBabel_1_1OBMol.shtml" title="Molecule Class.">OBMol</a> &amp;mol);
<a name="l00543"></a>00543     <span class="keywordtype">bool</span> SetEvalAtoms(<a class="code" href="classOpenBabel_1_1OBMol.shtml" title="Molecule Class.">OBMol</a>&amp;);
<a name="l00552"></a>00552     <span class="keywordtype">bool</span> AssignTorVals(<a class="code" href="classOpenBabel_1_1OBMol.shtml" title="Molecule Class.">OBMol</a> &amp;);
<a name="l00554"></a>00554 
<a name="l00556"></a>00556 
<a name="l00557"></a>00557 
<a name="l00561"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#a0911c08e37e43925167a51149d143e3a">00561</a>     <a class="code" href="classOpenBabel_1_1OBRotor.shtml" title="A single rotatable OBBond as part of rotamer searching.">OBRotor</a> *BeginRotor(<a class="code" href="namespaceOpenBabel.shtml#a434f394d0613a8ef6c119670ff49710f" title="A standard iterator over a vector of rotors.">OBRotorIterator</a> &amp;i)
<a name="l00562"></a>00562     {
<a name="l00563"></a>00563       i = _rotor.begin();
<a name="l00564"></a>00564       <span class="keywordflow">return</span>((i ==_rotor.end()) ? NULL:*i);
<a name="l00565"></a>00565     }
<a name="l00570"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#a610d31fe22e09be685d1bc3e90584e56">00570</a>     <a class="code" href="classOpenBabel_1_1OBRotor.shtml" title="A single rotatable OBBond as part of rotamer searching.">OBRotor</a> *NextRotor(<a class="code" href="namespaceOpenBabel.shtml#a434f394d0613a8ef6c119670ff49710f" title="A standard iterator over a vector of rotors.">OBRotorIterator</a> &amp;i)
<a name="l00571"></a>00571     {
<a name="l00572"></a>00572       ++i;
<a name="l00573"></a>00573       <span class="keywordflow">return</span>((i ==_rotor.end()) ? NULL:*i);
<a name="l00574"></a>00574     }
<a name="l00578"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#a9168b57d7fd7c6ac082ab7349e6c82df">00578</a>     <a class="code" href="namespaceOpenBabel.shtml#a434f394d0613a8ef6c119670ff49710f" title="A standard iterator over a vector of rotors.">OBRotorIterator</a> <a class="code" href="classOpenBabel_1_1OBRotorList.shtml#a9168b57d7fd7c6ac082ab7349e6c82df">BeginRotors</a>()   { <span class="keywordflow">return</span>(_rotor.begin()); }
<a name="l00582"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#aac6c765496e1602cdf8a2160251cce9e">00582</a>     <a class="code" href="namespaceOpenBabel.shtml#a434f394d0613a8ef6c119670ff49710f" title="A standard iterator over a vector of rotors.">OBRotorIterator</a> <a class="code" href="classOpenBabel_1_1OBRotorList.shtml#aac6c765496e1602cdf8a2160251cce9e">EndRotors</a>()     { <span class="keywordflow">return</span>(_rotor.end());   }
<a name="l00584"></a>00584 
<a name="l00587"></a>00587     <span class="comment">// Not declared</span>
<a name="l00589"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#af5b2891615e85e4fb9ff52d2931c6170">00589</a> <span class="comment"></span>    <span class="keywordtype">bool</span>   <a class="code" href="classOpenBabel_1_1OBRotorList.shtml#af5b2891615e85e4fb9ff52d2931c6170">IdentifyEvalAtoms</a>(<a class="code" href="classOpenBabel_1_1OBMol.shtml" title="Molecule Class.">OBMol</a> &amp;mol) { <span class="keywordflow">return</span> SetEvalAtoms(mol); }
<a name="l00594"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#aaabb93aa1f24c335405418bfa3ead95b">00594</a>     <span class="keywordtype">void</span> SetFixAtoms(<a class="code" href="classOpenBabel_1_1OBBitVec.shtml" title="A speed-optimized vector of bits.">OBBitVec</a> &amp;fix)
<a name="l00595"></a>00595     {
<a name="l00596"></a>00596       _fixedatoms = fix;
<a name="l00597"></a>00597       _fixedbonds.<a class="code" href="classOpenBabel_1_1OBBitVec.shtml#aa71d36872f416feaa853788a7a7a7ef8" title="Set all bits to zero.">Clear</a>();
<a name="l00598"></a>00598     }
<a name="l00603"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#acb5c0375aa5f28091792762a5f66f23e">00603</a>     <span class="keywordtype">bool</span> HasFixedAtoms()
<a name="l00604"></a>00604     {
<a name="l00605"></a>00605       <span class="keywordflow">return</span>(!_fixedatoms.Empty());
<a name="l00606"></a>00606     }
<a name="l00609"></a><a class="code" href="classOpenBabel_1_1OBRotorList.shtml#adbf9e2936af60825abb7f7812ba8fae8">00609</a>     <span class="keywordtype">void</span> <a class="code" href="classOpenBabel_1_1OBRotorList.shtml#adbf9e2936af60825abb7f7812ba8fae8">IgnoreSymmetryRemoval</a>()    { _removesym = <span class="keyword">false</span>;}
<a name="l00613"></a>00613     <span class="keywordtype">void</span> SetRotAtomsByFix(<a class="code" href="classOpenBabel_1_1OBMol.shtml" title="Molecule Class.">OBMol</a>&amp;);
<a name="l00615"></a>00615 
<a name="l00616"></a>00616   };
<a name="l00617"></a>00617 
<a name="l00619"></a>00619   <span class="keyword">class </span>rotor_digit {
<a name="l00620"></a>00620     <span class="keyword">public</span>:
<a name="l00621"></a>00621       rotor_digit(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rs)
<a name="l00622"></a>00622       {
<a name="l00623"></a>00623         resolution_size = rs;
<a name="l00624"></a>00624         state = 0;
<a name="l00625"></a>00625       }
<a name="l00626"></a>00626 
<a name="l00627"></a>00627       rotor_digit()
<a name="l00628"></a>00628       {
<a name="l00629"></a>00629         resolution_size = 0;
<a name="l00630"></a>00630         state = 0;
<a name="l00631"></a>00631       }
<a name="l00632"></a>00632 
<a name="l00633"></a>00633       <span class="keywordtype">void</span> set_size(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rs)
<a name="l00634"></a>00634       {
<a name="l00635"></a>00635         resolution_size = rs;
<a name="l00636"></a>00636         state = 0;
<a name="l00637"></a>00637       }
<a name="l00638"></a>00638 
<a name="l00639"></a>00639       <span class="keywordtype">void</span> set_state(<span class="keywordtype">int</span> st)
<a name="l00640"></a>00640       {
<a name="l00641"></a>00641         state = st;
<a name="l00642"></a>00642       }
<a name="l00643"></a>00643 
<a name="l00644"></a>00644       <span class="keywordtype">int</span> get_state()
<a name="l00645"></a>00645       {
<a name="l00646"></a>00646         <span class="keywordflow">return</span> state;
<a name="l00647"></a>00647       }
<a name="l00648"></a>00648 
<a name="l00649"></a>00649       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size()
<a name="l00650"></a>00650       {
<a name="l00651"></a>00651         <span class="keywordflow">return</span> resolution_size;
<a name="l00652"></a>00652       }
<a name="l00653"></a>00653 
<a name="l00654"></a>00654       <span class="keywordtype">bool</span> next()
<a name="l00655"></a>00655       {
<a name="l00656"></a>00656         <span class="keywordflow">if</span> (state &lt; static_cast&lt;int&gt;(resolution_size - 1)) {
<a name="l00657"></a>00657           ++state;
<a name="l00658"></a>00658           <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00659"></a>00659         } <span class="keywordflow">else</span>
<a name="l00660"></a>00660           state = 0;
<a name="l00661"></a>00661 
<a name="l00662"></a>00662         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00663"></a>00663       }
<a name="l00664"></a>00664     <span class="keyword">private</span>:
<a name="l00665"></a>00665       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> resolution_size;
<a name="l00666"></a>00666       <span class="keywordtype">int</span> state;
<a name="l00667"></a>00667 <span class="preprocessor">#ifndef SWIG</span>
<a name="l00668"></a>00668 <span class="preprocessor"></span>  } <span class="keyword">typedef</span> rotor_digit;
<a name="l00669"></a>00669 <span class="preprocessor">#else</span>
<a name="l00670"></a>00670 <span class="preprocessor"></span>  };
<a name="l00671"></a>00671 <span class="preprocessor">#endif</span>
<a name="l00672"></a>00672 <span class="preprocessor"></span>
<a name="l00673"></a>00673 
<a name="l00676"></a><a class="code" href="classOpenBabel_1_1OBRotorKeys.shtml">00676</a>   <span class="keyword">class </span>OBAPI <a class="code" href="classOpenBabel_1_1OBRotorKeys.shtml" title="A class to generate all possible rotorKeys.">OBRotorKeys</a>
<a name="l00677"></a>00677   {
<a name="l00723"></a>00723     <span class="keyword">public</span>:
<a name="l00725"></a><a class="code" href="classOpenBabel_1_1OBRotorKeys.shtml#a1df6b471196fede2ca7816bdb48a55c4">00725</a>       <a class="code" href="classOpenBabel_1_1OBRotorKeys.shtml" title="A class to generate all possible rotorKeys.">OBRotorKeys</a>()
<a name="l00726"></a>00726       {
<a name="l00727"></a>00727         _vr.clear();
<a name="l00728"></a>00728       }
<a name="l00729"></a>00729 
<a name="l00731"></a><a class="code" href="classOpenBabel_1_1OBRotorKeys.shtml#aa71d36872f416feaa853788a7a7a7ef8">00731</a>       <span class="keywordtype">void</span> <a class="code" href="classOpenBabel_1_1OBRotorKeys.shtml#aa71d36872f416feaa853788a7a7a7ef8" title="Clear all rotors.">Clear</a>(){
<a name="l00732"></a>00732         _vr.clear();
<a name="l00733"></a>00733       }
<a name="l00734"></a>00734 
<a name="l00736"></a><a class="code" href="classOpenBabel_1_1OBRotorKeys.shtml#a5e2ff872d231d1a136588edf2f214812">00736</a>       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> NumKeys()
<a name="l00737"></a>00737       {
<a name="l00738"></a>00738         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> numKeys = 0;
<a name="l00739"></a>00739 
<a name="l00740"></a>00740         <span class="keywordflow">while</span> (Next())
<a name="l00741"></a>00741           numKeys++;
<a name="l00742"></a>00742 
<a name="l00743"></a>00743         <span class="keywordflow">return</span> numKeys;
<a name="l00744"></a>00744       }
<a name="l00745"></a>00745 
<a name="l00748"></a><a class="code" href="classOpenBabel_1_1OBRotorKeys.shtml#a978846687be54138173a299d169bce37">00748</a>       <span class="keywordtype">void</span> AddRotor(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size)
<a name="l00749"></a>00749       {
<a name="l00750"></a>00750         rotor_digit rd(size);
<a name="l00751"></a>00751         _vr.push_back(rd);
<a name="l00752"></a>00752       }
<a name="l00753"></a>00753 
<a name="l00756"></a><a class="code" href="classOpenBabel_1_1OBRotorKeys.shtml#a3947d19ac087ef2cd68c2409920339c4">00756</a>       <span class="keywordtype">bool</span> Next()
<a name="l00757"></a>00757       {
<a name="l00758"></a>00758         <span class="keywordflow">if</span>(_vr.size() == 0)
<a name="l00759"></a>00759           <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00760"></a>00760 
<a name="l00761"></a>00761         <span class="keywordtype">bool</span> carry = _vr[0].next();
<a name="l00762"></a>00762         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 1;
<a name="l00763"></a>00763         <span class="keywordflow">while</span> (carry) {
<a name="l00764"></a>00764           <span class="keywordflow">if</span>(i == _vr.size())
<a name="l00765"></a>00765             <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00766"></a>00766 
<a name="l00767"></a>00767           carry = _vr[i].next();
<a name="l00768"></a>00768           i++;
<a name="l00769"></a>00769         }
<a name="l00770"></a>00770         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00771"></a>00771       }
<a name="l00772"></a>00772 
<a name="l00775"></a><a class="code" href="classOpenBabel_1_1OBRotorKeys.shtml#a0ea664b7db8e291318eda525a542aa7f">00775</a>       std::vector&lt;int&gt; GetKey()
<a name="l00776"></a>00776       {
<a name="l00777"></a>00777         std::vector&lt;int&gt; rt;
<a name="l00778"></a>00778         rt.clear();
<a name="l00779"></a>00779         rt.push_back(0);
<a name="l00780"></a>00780         <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; _vr.size(); i++){
<a name="l00781"></a>00781           rt.push_back(_vr[i].get_state());
<a name="l00782"></a>00782         }
<a name="l00783"></a>00783 
<a name="l00784"></a>00784         <span class="keywordflow">return</span> rt;
<a name="l00785"></a>00785       }
<a name="l00786"></a>00786 
<a name="l00787"></a>00787     <span class="keyword">private</span>:
<a name="l00788"></a>00788       std::vector&lt;rotor_digit&gt; _vr;
<a name="l00789"></a>00789   };
<a name="l00790"></a>00790 
<a name="l00791"></a>00791 
<a name="l00792"></a>00792 } <span class="comment">// end namespace OpenBabel</span>
<a name="l00793"></a>00793 
<a name="l00794"></a>00794 <span class="preprocessor">#endif // OB_ROTOR_H</span>
<a name="l00795"></a>00795 <span class="preprocessor"></span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- end content -->

<!--#include file="footer.html" -->

<div id="footer">
<hr size="1">
<img src="http://openbabel.org/babel256.png" width="136" height="127" alt="" style="float: left;" />
<p>This file is part of the documentation for <a href="http://openbabel.org/wiki/">Open Babel</a>, version 2.3.</p>
<div class="bottom">
Documentation copyright &copy; 1998-2007, the <a href="http://openbabel.org/wiki/THANKS">Open Babel Developers</a>.<br>
Open Babel is hosted by: <a href="http://sourceforge.net">
<img src="http://sourceforge.net/sflogo.php?group_id=40728" 
width="88" height="31" border="0" alt="SourceForge Logo"></a><br>
Generated on Thu Oct 13 2011 16:08:08 by&nbsp;<a href="http://www.doxygen.org/"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.7.5.1.
</div>

</body>
</html>