<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>molshape.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Mon Oct 14 14:16:37 2002 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>molshape.h</h1><div class="fragment"><pre>00001 <font class="comment">//</font> 00002 <font class="comment">// molshape.h</font> 00003 <font class="comment">//</font> 00004 <font class="comment">// Copyright (C) 1996 Limit Point Systems, Inc.</font> 00005 <font class="comment">//</font> 00006 <font class="comment">// Author: Curtis Janssen <cljanss@limitpt.com></font> 00007 <font class="comment">// Maintainer: LPS</font> 00008 <font class="comment">//</font> 00009 <font class="comment">// This file is part of the SC Toolkit.</font> 00010 <font class="comment">//</font> 00011 <font class="comment">// The SC Toolkit is free software; you can redistribute it and/or modify</font> 00012 <font class="comment">// it under the terms of the GNU Library General Public License as published by</font> 00013 <font class="comment">// the Free Software Foundation; either version 2, or (at your option)</font> 00014 <font class="comment">// any later version.</font> 00015 <font class="comment">//</font> 00016 <font class="comment">// The SC Toolkit is distributed in the hope that it will be useful,</font> 00017 <font class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00018 <font class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00019 <font class="comment">// GNU Library General Public License for more details.</font> 00020 <font class="comment">//</font> 00021 <font class="comment">// You should have received a copy of the GNU Library General Public License</font> 00022 <font class="comment">// along with the SC Toolkit; see the file COPYING.LIB. If not, write to</font> 00023 <font class="comment">// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.</font> 00024 <font class="comment">//</font> 00025 <font class="comment">// The U.S. Government is granted a limited license as per AL 91-7.</font> 00026 <font class="comment">//</font> 00027 00028 <font class="preprocessor">#ifndef _chemistry_molecule_molshape_h</font> 00029 <font class="preprocessor"></font><font class="preprocessor">#define _chemistry_molecule_molshape_h</font> 00030 <font class="preprocessor"></font> 00031 <font class="preprocessor">#ifdef __GNUC__</font> 00032 <font class="preprocessor"></font><font class="preprocessor">#pragma interface</font> 00033 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00034 <font class="preprocessor"></font> 00035 <font class="preprocessor">#include <util/misc/formio.h></font> 00036 00037 <font class="preprocessor">#include <math/isosurf/shape.h></font> 00038 <font class="preprocessor">#include <chemistry/molecule/atominfo.h></font> 00039 <font class="preprocessor">#include <chemistry/molecule/molecule.h></font> 00040 00041 <font class="keyword">namespace </font>sc { 00042 <a name="l00047"></a><a class="code" href="class_sc__VDWShape.html">00047</a> <font class="keyword">class </font>VDWShape: <font class="keyword">public</font> UnionShape { 00048 <font class="keyword">private</font>: 00049 Ref<AtomInfo> atominfo_; 00050 <font class="keyword">public</font>: 00051 VDWShape(<font class="keyword">const</font> Ref<Molecule>&); 00052 VDWShape(<font class="keyword">const</font> Ref<KeyVal>&); 00053 ~VDWShape(); 00054 <font class="keywordtype">void</font> initialize(<font class="keyword">const</font> Ref<Molecule>&); 00055 }; 00056 <a name="l00061"></a><a class="code" href="class_sc__DiscreteConnollyShape.html">00061</a> <font class="keyword">class </font>DiscreteConnollyShape: <font class="keyword">public</font> UnionShape { 00062 <font class="keyword">private</font>: 00063 <font class="keywordtype">double</font> radius_scale_factor_; 00064 Ref<AtomInfo> atominfo_; 00065 <font class="keyword">public</font>: 00066 DiscreteConnollyShape(<font class="keyword">const</font> Ref<KeyVal>&); 00067 ~DiscreteConnollyShape(); 00068 <font class="keywordtype">void</font> initialize(<font class="keyword">const</font> Ref<Molecule>&,<font class="keywordtype">double</font> probe_radius); 00069 }; 00070 00071 <font class="preprocessor">#ifndef COUNT_CONNOLLY</font> 00072 <font class="preprocessor"></font><font class="preprocessor"># define COUNT_CONNOLLY 1</font> 00073 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00074 <font class="preprocessor"></font> 00075 <font class="comment">// This is a utility class needed by ConnollyShape2</font> 00076 <font class="keyword">class </font>CS2Sphere 00077 { 00078 SCVector3 _v; 00079 <font class="keywordtype">double</font> _radius; 00080 00081 <font class="keyword">public</font>: 00082 <font class="preprocessor">#if COUNT_CONNOLLY</font> 00083 <font class="preprocessor"></font> <font class="keyword">static</font> <font class="keywordtype">int</font> n_no_spheres_; 00084 <font class="keyword">static</font> <font class="keywordtype">int</font> n_probe_enclosed_by_a_sphere_; 00085 <font class="keyword">static</font> <font class="keywordtype">int</font> n_probe_center_not_enclosed_; 00086 <font class="keyword">static</font> <font class="keywordtype">int</font> n_surface_of_s0_not_covered_; 00087 <font class="keyword">static</font> <font class="keywordtype">int</font> n_plane_totally_covered_; 00088 <font class="keyword">static</font> <font class="keywordtype">int</font> n_internal_edge_not_covered_; 00089 <font class="keyword">static</font> <font class="keywordtype">int</font> n_totally_covered_; 00090 <font class="preprocessor">#endif</font> 00091 <font class="preprocessor"></font> 00092 CS2Sphere(<font class="keyword">const</font> SCVector3& v, <font class="keywordtype">double</font> rad): 00093 _v(v),_radius(rad){} 00094 CS2Sphere(<font class="keywordtype">double</font> x, <font class="keywordtype">double</font> y, <font class="keywordtype">double</font> z, <font class="keywordtype">double</font> rad): 00095 _v(x,y,z),_radius(rad){} 00096 CS2Sphere(<font class="keywordtype">void</font>)<font class="keyword"> </font>{}; 00097 <font class="keywordtype">void</font> initialize(SCVector3& v, <font class="keywordtype">double</font> rad)<font class="keyword"> </font>{ 00098 _v = v; _radius = rad; } 00099 00100 CS2Sphere& operator=(<font class="keyword">const</font> CS2Sphere&s)<font class="keyword"> </font>{ 00101 _v = s._v; _radius = s._radius; <font class="keywordflow">return</font> *<font class="keyword">this</font>; } 00102 00103 <font class="comment">// Return the distance between the centers of the two</font> 00104 <font class="comment">// spheres</font> 00105 <font class="keywordtype">double</font> distance(CS2Sphere &asphere)<font class="keyword"></font> 00106 <font class="keyword"> </font>{ <font class="keywordflow">return</font> sqrt((_v[0]-asphere._v[0])*(_v[0]-asphere._v[0])+ 00107 (_v[1]-asphere._v[1])*(_v[1]-asphere._v[1])+ 00108 (_v[2]-asphere._v[2])*(_v[2]-asphere._v[2]));} 00109 00110 <font class="comment">// Return the radius of the circle intersecting the two spheres</font> 00111 <font class="comment">// Note that this assumes the spheres do overlap!</font> 00112 <font class="keywordtype">double</font> common_radius(CS2Sphere &asphere); 00113 00114 <font class="comment">// Return the center</font> 00115 <font class="keyword">const</font> SCVector3& center(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _v; } 00116 <font class="keywordtype">double</font> x()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _v[0]; } 00117 <font class="keywordtype">double</font> y()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _v[1]; } 00118 <font class="keywordtype">double</font> z()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> _v[2]; } 00119 00120 <font class="comment">// Return the vector3d connecting the two centers</font> 00121 SCVector3 center_vec(<font class="keyword">const</font> CS2Sphere &asphere)<font class="keyword"> </font>{ <font class="keywordflow">return</font> _v - asphere._v; } 00122 00123 <font class="keywordtype">double</font> radius(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{<font class="keywordflow">return</font> _radius;} 00124 00125 <font class="keywordtype">void</font> recenter(<font class="keyword">const</font> SCVector3 &v)<font class="keyword"> </font>{ _v -= v; } 00126 <font class="keywordtype">void</font> print(std::ostream& os=ExEnv::out0()) <font class="keyword">const</font> 00127 { 00128 os << indent 00129 << scprintf(<font class="stringliteral">"Rad=%lf, Center=(%lf,%lf,%lf), From origin=%lf\n"</font>, 00130 _radius, _v[0], _v[1], _v[2], _v.norm()); 00131 } 00132 00133 <font class="comment">// Function to determine if there is any portion of this that </font> 00134 <font class="comment">// is not inside one or more of the spheres in s[]. Returns</font> 00135 <font class="comment">// 1 if the intersection is empty, otherwise 0 is returned.</font> 00136 <font class="comment">// Warning: the spheres in s are modified.</font> 00137 <font class="keywordtype">int</font> intersect(CS2Sphere *s, 00138 <font class="keywordtype">int</font> n_spheres) <font class="keyword">const</font>; 00139 00140 <font class="keyword">static</font> <font class="keywordtype">void</font> print_counts(std::ostream& = ExEnv::out0()); 00141 }; 00142 00143 <font class="preprocessor">#define CONNOLLYSHAPE_N_WITH_NSPHERE_DIM 10</font> 00144 <font class="preprocessor"></font> <a name="l00148"></a><a class="code" href="class_sc__ConnollyShape.html">00148</a> <font class="keyword">class </font>ConnollyShape: <font class="keyword">public</font> Shape { 00149 <font class="keyword">private</font>: 00150 CS2Sphere* sphere; 00151 <font class="keywordtype">double</font> probe_r; 00152 <font class="keywordtype">double</font> radius_scale_factor_; 00153 <font class="keywordtype">int</font> n_spheres; 00154 Ref<AtomInfo> atominfo_; 00155 00156 Arrayint ***box_; 00157 <font class="keywordtype">double</font> l_; 00158 <font class="keywordtype">int</font> xmax_; 00159 <font class="keywordtype">int</font> ymax_; 00160 <font class="keywordtype">int</font> zmax_; 00161 SCVector3 lower_; 00162 00163 <font class="keywordtype">int</font> get_box(<font class="keyword">const</font> SCVector3 &v, <font class="keywordtype">int</font> &x, <font class="keywordtype">int</font> &y, <font class="keywordtype">int</font> &z) <font class="keyword">const</font>; 00164 00165 <font class="preprocessor">#if COUNT_CONNOLLY</font> 00166 <font class="preprocessor"></font> <font class="keyword">static</font> <font class="keywordtype">int</font> n_total_; 00167 <font class="keyword">static</font> <font class="keywordtype">int</font> n_inside_vdw_; 00168 <font class="keyword">static</font> <font class="keywordtype">int</font> n_with_nsphere_[CONNOLLYSHAPE_N_WITH_NSPHERE_DIM]; 00169 <font class="preprocessor">#endif</font> 00170 <font class="preprocessor"></font> 00171 <font class="keyword">public</font>: 00172 ConnollyShape(<font class="keyword">const</font> Ref<KeyVal>&); 00173 ~ConnollyShape(); 00174 <font class="keywordtype">void</font> initialize(<font class="keyword">const</font> Ref<Molecule>&,<font class="keywordtype">double</font> probe_radius); 00175 <font class="keywordtype">void</font> clear(); 00176 <font class="keywordtype">double</font> distance_to_surface(<font class="keyword">const</font> SCVector3&r, 00177 SCVector3*grad=0) <font class="keyword">const</font>; 00178 <font class="keywordtype">void</font> boundingbox(<font class="keywordtype">double</font> valuemin, 00179 <font class="keywordtype">double</font> valuemax, 00180 SCVector3& p1, SCVector3& p2); 00181 00182 <font class="keyword">static</font> <font class="keywordtype">void</font> print_counts(std::ostream& = ExEnv::out0()); 00183 }; 00184 00185 } 00186 00187 <font class="preprocessor">#endif</font> 00188 <font class="preprocessor"></font> 00189 <font class="comment">// Local Variables:</font> 00190 <font class="comment">// mode: c++</font> 00191 <font class="comment">// c-file-style: "CLJ"</font> 00192 <font class="comment">// End:</font> </div></pre><hr> <address> <small> Generated at Mon Oct 14 14:16:37 2002 for <a href="http://aros.ca.sandia.gov/~cljanss/mpqc">MPQC</a> 2.1.2 using the documentation package <a href="http://www.stack.nl/~dimitri/doxygen/index.html">Doxygen</a> 1.2.5. </small> </address> </body> </html>