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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>tetranonplanar.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 Page</span></a></li>
<li><a href="pages.shtml"><span>Related 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 List</span></a></li>
<li><a href="globals.shtml"><span>File Members</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<div class="title">tetranonplanar.h</div> </div>
</div>
<div class="contents">
<a href="tetranonplanar_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"> tetranonplanar.h - OBTetraNonPlanarStereo</span>
<a name="l00003"></a>00003 <span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment"> Copyright (C) 2009 by Tim Vandermeersch</span>
<a name="l00005"></a>00005 <span class="comment"></span>
<a name="l00006"></a>00006 <span class="comment"> This file is part of the Open Babel project.</span>
<a name="l00007"></a>00007 <span class="comment"> For more information, see <http://openbabel.org/></span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment"> This program is free software; you can redistribute it and/or modify</span>
<a name="l00010"></a>00010 <span class="comment"> it under the terms of the GNU General Public License as published by</span>
<a name="l00011"></a>00011 <span class="comment"> the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00012"></a>00012 <span class="comment"> (at your option) any later version.</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 <span class="comment"> You should have received a copy of the GNU General Public License</span>
<a name="l00020"></a>00020 <span class="comment"> along with this program; if not, write to the Free Software</span>
<a name="l00021"></a>00021 <span class="comment"> Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA</span>
<a name="l00022"></a>00022 <span class="comment"> 02110-1301, USA.</span>
<a name="l00023"></a>00023 <span class="comment"> **********************************************************************/</span>
<a name="l00024"></a>00024 <span class="preprocessor">#ifndef OB_TETRANONPLANAR_H</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define OB_TETRANONPLANAR_H</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a>00027 <span class="preprocessor">#include <<a class="code" href="stereo_8h.shtml" title="Process molecular stereochemistry information.">openbabel/stereo/stereo.h</a>></span>
<a name="l00028"></a>00028 <span class="preprocessor">#include <<a class="code" href="oberror_8h.shtml" title="Handle error messages, warnings, notices, etc.">openbabel/oberror.h</a>></span>
<a name="l00029"></a>00029
<a name="l00030"></a>00030 <span class="keyword">namespace </span>OpenBabel {
<a name="l00031"></a>00031
<a name="l00034"></a>00034
<a name="l00091"></a><a class="code" href="classOpenBabel_1_1OBTetraNonPlanarStereo.shtml">00091</a> <span class="keyword">class </span>OBAPI <a class="code" href="classOpenBabel_1_1OBTetraNonPlanarStereo.shtml" title="Base class for handling and storing non-planar stereochemistry with 4 reference atom ids...">OBTetraNonPlanarStereo</a> : <span class="keyword">public</span> <a class="code" href="classOpenBabel_1_1OBStereoBase.shtml" title="Base class for all stereochemistry classes.">OBStereoBase</a>
<a name="l00092"></a>00092 {
<a name="l00093"></a>00093 <span class="keyword">public</span>:
<a name="l00098"></a>00098 <a class="code" href="classOpenBabel_1_1OBTetraNonPlanarStereo.shtml" title="Base class for handling and storing non-planar stereochemistry with 4 reference atom ids...">OBTetraNonPlanarStereo</a>(<a class="code" href="classOpenBabel_1_1OBMol.shtml" title="Molecule Class.">OBMol</a> *mol);
<a name="l00102"></a>00102 <span class="keyword">virtual</span> ~<a class="code" href="classOpenBabel_1_1OBTetraNonPlanarStereo.shtml" title="Base class for handling and storing non-planar stereochemistry with 4 reference atom ids...">OBTetraNonPlanarStereo</a>();
<a name="l00103"></a>00103
<a name="l00144"></a>00144 <span class="keyword">template</span> <<span class="keyword">typename</span> ConfigType>
<a name="l00145"></a><a class="code" href="classOpenBabel_1_1OBTetraNonPlanarStereo.shtml#ac6f1bf41e38b3e8b182fa57269046070">00145</a> <span class="keyword">static</span> ConfigType ToConfig(<span class="keyword">const</span> ConfigType &cfg, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> from_or_towards,
<a name="l00146"></a>00146 <a class="code" href="structOpenBabel_1_1OBStereo.shtml#ac3e0e8e3a194037cdf6103a95a1c6d31">OBStereo::Winding</a> winding = <a class="code" href="structOpenBabel_1_1OBStereo.shtml#ac3e0e8e3a194037cdf6103a95a1c6d31adc82829d52b935bb1ba087f98f44dac7" title="Clockwise winding.">OBStereo::Clockwise</a>,
<a name="l00147"></a>00147 <a class="code" href="structOpenBabel_1_1OBStereo.shtml#af1dfb9e747d80437422fdb5fba87c2c7">OBStereo::View</a> view = <a class="code" href="structOpenBabel_1_1OBStereo.shtml#af1dfb9e747d80437422fdb5fba87c2c7ad67cd67454910029af59ecf137366d0e" title="view from the atom (id parameter) towards the center atom">OBStereo::ViewFrom</a>)
<a name="l00148"></a>00148 {
<a name="l00149"></a>00149 <span class="keywordflow">if</span> (cfg.from == <a class="code" href="structOpenBabel_1_1OBStereo.shtml#aba01db17f4a2bfbc3db60dc172972a25a7295d9aeb6e0e6f3a5b77aa0ce7ed0db" title="No Ref set (invalid Ref)">OBStereo::NoRef</a>) {
<a name="l00150"></a>00150 <a class="code" href="namespaceOpenBabel.shtml#a394eef44b3dd6a9174067715712c2d16" title="Global OBMessageHandler error handler.">obErrorLog</a>.<a class="code" href="classOpenBabel_1_1OBMessageHandler.shtml#a2482566201934523c4631d85b1214a70" title="Throw an error with an already-formatted OBError object.">ThrowError</a>(__FUNCTION__,
<a name="l00151"></a>00151 <span class="stringliteral">"OBTetraNonPlanarStereo::ToConfig : Invalid from in ConfigType struct."</span>, <a class="code" href="namespaceOpenBabel.shtml#acf195409ac7024002db5c178f20862d9afbf66ee4ae8ad04bc5003a16aa9b2b77" title="for critical errors (e.g., cannot read a file)">obError</a>);
<a name="l00152"></a>00152 <span class="keywordflow">return</span> ConfigType();
<a name="l00153"></a>00153 }
<a name="l00154"></a>00154 <span class="keywordflow">if</span> (cfg.refs.size() != 3) {
<a name="l00155"></a>00155 <a class="code" href="namespaceOpenBabel.shtml#a394eef44b3dd6a9174067715712c2d16" title="Global OBMessageHandler error handler.">obErrorLog</a>.<a class="code" href="classOpenBabel_1_1OBMessageHandler.shtml#a2482566201934523c4631d85b1214a70" title="Throw an error with an already-formatted OBError object.">ThrowError</a>(__FUNCTION__,
<a name="l00156"></a>00156 <span class="stringliteral">"OBTetraNonPlanarStereo::ToConfig : Invalid refs size."</span>, <a class="code" href="namespaceOpenBabel.shtml#acf195409ac7024002db5c178f20862d9afbf66ee4ae8ad04bc5003a16aa9b2b77" title="for critical errors (e.g., cannot read a file)">obError</a>);
<a name="l00157"></a>00157 <span class="keywordflow">return</span> ConfigType();
<a name="l00158"></a>00158 }
<a name="l00159"></a>00159
<a name="l00160"></a>00160 <span class="comment">// copy the internal refs</span>
<a name="l00161"></a>00161 ConfigType result = cfg;
<a name="l00162"></a>00162 result.from = from_or_towards;
<a name="l00163"></a>00163 result.winding = winding;
<a name="l00164"></a>00164 result.view = view;
<a name="l00165"></a>00165
<a name="l00166"></a>00166 <span class="comment">// keep track of the permuations by using the oddness</span>
<a name="l00167"></a>00167 <span class="keywordtype">bool</span> odd = <span class="keyword">false</span>;
<a name="l00168"></a>00168
<a name="l00169"></a>00169 <span class="comment">// find id</span>
<a name="l00170"></a>00170 <span class="keywordflow">if</span> (cfg.from != from_or_towards) {
<a name="l00171"></a>00171 <span class="comment">// move id to front and remove it = 1 permutation</span>
<a name="l00172"></a>00172 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < 3; ++i) {
<a name="l00173"></a>00173 <span class="keywordflow">if</span> (cfg.refs.at(i) == from_or_towards) {
<a name="l00174"></a>00174 result.refs[i] = cfg.from;
<a name="l00175"></a>00175 <span class="keywordflow">break</span>;
<a name="l00176"></a>00176 }
<a name="l00177"></a>00177 }
<a name="l00178"></a>00178 <span class="comment">// 1 permutation perfromed --> odd = true</span>
<a name="l00179"></a>00179 odd = <span class="keyword">true</span>;
<a name="l00180"></a>00180 }
<a name="l00181"></a>00181
<a name="l00182"></a>00182 <span class="comment">// clockwise <-> anti-clockwise : odd = true</span>
<a name="l00183"></a>00183 <span class="keywordflow">if</span> (winding == cfg.winding)
<a name="l00184"></a>00184 odd = !odd;
<a name="l00185"></a>00185 <span class="comment">// ViewFrom <-> ViewTowards : odd = true</span>
<a name="l00186"></a>00186 <span class="keywordflow">if</span> (view == cfg.view)
<a name="l00187"></a>00187 odd = !odd;
<a name="l00188"></a>00188
<a name="l00189"></a>00189 <span class="comment">// make sure we actually found id</span>
<a name="l00190"></a>00190 <span class="keywordflow">if</span> (result.refs.size() == 3) {
<a name="l00191"></a>00191 <span class="keywordflow">if</span> (odd)
<a name="l00192"></a>00192 <a class="code" href="structOpenBabel_1_1OBStereo.shtml#a91f98766fb3dc116169a4871f8b153cd">OBStereo::Permutate</a>(result.refs, 1, 2);
<a name="l00193"></a>00193 <span class="keywordflow">return</span> result;
<a name="l00194"></a>00194 }
<a name="l00195"></a>00195
<a name="l00196"></a>00196 <a class="code" href="namespaceOpenBabel.shtml#a394eef44b3dd6a9174067715712c2d16" title="Global OBMessageHandler error handler.">obErrorLog</a>.<a class="code" href="classOpenBabel_1_1OBMessageHandler.shtml#a2482566201934523c4631d85b1214a70" title="Throw an error with an already-formatted OBError object.">ThrowError</a>(__FUNCTION__,
<a name="l00197"></a>00197 <span class="stringliteral">"OBTetraNonPlanarStereo::ToConfig : Parameter id not found in internal refs."</span>, <a class="code" href="namespaceOpenBabel.shtml#acf195409ac7024002db5c178f20862d9afbf66ee4ae8ad04bc5003a16aa9b2b77" title="for critical errors (e.g., cannot read a file)">obError</a>);
<a name="l00198"></a>00198 <span class="keywordflow">return</span> result;
<a name="l00199"></a>00199 }
<a name="l00203"></a>00203 <span class="keyword">template</span> <<span class="keyword">typename</span> ConfigType>
<a name="l00204"></a><a class="code" href="classOpenBabel_1_1OBTetraNonPlanarStereo.shtml#a2bcce1b06cf3b4bedda017788b670561">00204</a> <span class="keyword">static</span> <span class="keywordtype">void</span> ChangeWinding(ConfigType &cfg)
<a name="l00205"></a>00205 {
<a name="l00206"></a>00206 cfg.winding = (cfg.winding == <a class="code" href="structOpenBabel_1_1OBStereo.shtml#ac3e0e8e3a194037cdf6103a95a1c6d31adc82829d52b935bb1ba087f98f44dac7" title="Clockwise winding.">OBStereo::Clockwise</a>) ? <a class="code" href="structOpenBabel_1_1OBStereo.shtml#ac3e0e8e3a194037cdf6103a95a1c6d31a6bf12c9b9fea555c370c5f75629cd609" title="AntiClockwise winding (or CounterClockwise)">OBStereo::AntiClockwise</a> : <a class="code" href="structOpenBabel_1_1OBStereo.shtml#ac3e0e8e3a194037cdf6103a95a1c6d31adc82829d52b935bb1ba087f98f44dac7" title="Clockwise winding.">OBStereo::Clockwise</a>;
<a name="l00207"></a>00207 <a class="code" href="structOpenBabel_1_1OBStereo.shtml#a91f98766fb3dc116169a4871f8b153cd">OBStereo::Permutate</a>(cfg.refs, 1, 2);
<a name="l00208"></a>00208 }
<a name="l00212"></a>00212 <span class="keyword">template</span> <<span class="keyword">typename</span> ConfigType>
<a name="l00213"></a><a class="code" href="classOpenBabel_1_1OBTetraNonPlanarStereo.shtml#a7b6468e32f45ddd869bb6562e48932ba">00213</a> <span class="keyword">static</span> <span class="keywordtype">void</span> ChangeView(ConfigType &cfg)
<a name="l00214"></a>00214 {
<a name="l00215"></a>00215 cfg.view = (cfg.view == <a class="code" href="structOpenBabel_1_1OBStereo.shtml#af1dfb9e747d80437422fdb5fba87c2c7ad67cd67454910029af59ecf137366d0e" title="view from the atom (id parameter) towards the center atom">OBStereo::ViewFrom</a>) ? <a class="code" href="structOpenBabel_1_1OBStereo.shtml#af1dfb9e747d80437422fdb5fba87c2c7a82407be1a15d633a8bf5df6eaecad155" title="view from center atom towards the atom (id paramater)">OBStereo::ViewTowards</a> : <a class="code" href="structOpenBabel_1_1OBStereo.shtml#af1dfb9e747d80437422fdb5fba87c2c7ad67cd67454910029af59ecf137366d0e" title="view from the atom (id parameter) towards the center atom">OBStereo::ViewFrom</a>;
<a name="l00216"></a>00216 <a class="code" href="structOpenBabel_1_1OBStereo.shtml#a91f98766fb3dc116169a4871f8b153cd">OBStereo::Permutate</a>(cfg.refs, 1, 2);
<a name="l00217"></a>00217 }
<a name="l00221"></a>00221 <span class="keyword">template</span> <<span class="keyword">typename</span> ConfigType>
<a name="l00222"></a><a class="code" href="classOpenBabel_1_1OBTetraNonPlanarStereo.shtml#aae41e67e3acadf06788b04ab7252e0e8">00222</a> <span class="keyword">static</span> <span class="keywordtype">void</span> Invert(ConfigType &cfg)
<a name="l00223"></a>00223 {
<a name="l00224"></a>00224 <a class="code" href="structOpenBabel_1_1OBStereo.shtml#a91f98766fb3dc116169a4871f8b153cd">OBStereo::Permutate</a>(cfg.refs, 1, 2);
<a name="l00225"></a>00225 }
<a name="l00226"></a>00226 };
<a name="l00227"></a>00227
<a name="l00229"></a>00229
<a name="l00230"></a>00230 }
<a name="l00231"></a>00231
<a name="l00232"></a>00232 <span class="preprocessor">#endif</span>
<a name="l00233"></a>00233 <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"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </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 © 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 <a href="http://www.doxygen.org/"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.7.5.1.
</div>
</body>
</html>
|