<!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>bem.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:35 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>bem.h</h1><div class="fragment"><pre>00001 <font class="comment">//</font> 00002 <font class="comment">// bem.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_solvent_bem_h</font> 00029 <font class="preprocessor"></font><font class="preprocessor">#define _chemistry_solvent_bem_h</font> 00030 <font class="preprocessor"></font> 00031 <font class="preprocessor">#include <util/class/class.h></font> 00032 <font class="preprocessor">#include <util/state/state.h></font> 00033 <font class="preprocessor">#include <util/keyval/keyval.h></font> 00034 <font class="preprocessor">#include <math/isosurf/volume.h></font> 00035 <font class="preprocessor">#include <math/isosurf/surf.h></font> 00036 <font class="preprocessor">#include <math/scmat/matrix.h></font> 00037 <font class="preprocessor">#include <chemistry/molecule/molecule.h></font> 00038 00039 <font class="keyword">namespace </font>sc { 00040 00041 <font class="comment">// This represents a solvent by a polarization charge on a dielectric</font> 00042 <font class="comment">// boundary surface.</font> 00043 <font class="keyword">class </font>BEMSolvent: <font class="keyword">public</font> DescribedClass { 00044 <font class="keyword">private</font>: 00045 <font class="keywordtype">int</font> debug_; 00046 00047 Ref<Molecule> solute_; 00048 Ref<Molecule> solvent_; 00049 <font class="keywordtype">double</font> solvent_density_; 00050 <font class="keywordtype">double</font> dielectric_constant_; 00051 Ref<SCMatrixKit> matrixkit_; 00052 RefSCMatrix system_matrix_i_; 00053 <font class="keywordtype">double</font> f_; 00054 Ref<MessageGrp> grp_; 00055 00056 <font class="keywordtype">double</font> area_; 00057 <font class="keywordtype">double</font> volume_; 00058 <font class="keywordtype">double</font> computed_enclosed_charge_; 00059 <font class="keywordtype">double</font> edisp_; 00060 <font class="keywordtype">double</font> erep_; 00061 00062 Ref<TriangulatedImplicitSurface> surf_; 00063 00064 <font class="keywordtype">double</font>** alloc_array(<font class="keywordtype">int</font> n, <font class="keywordtype">int</font> m); 00065 <font class="keywordtype">void</font> free_array(<font class="keywordtype">double</font>**); 00066 00067 <font class="comment">// This holds the area associated with each vertex. It is used</font> 00068 <font class="comment">// to convert charges to charge densities and back.</font> 00069 <font class="keywordtype">double</font>* vertex_area_; 00070 00071 <font class="comment">// Given charges compute surface charge density.</font> 00072 <font class="keywordtype">void</font> charges_to_surface_charge_density(<font class="keywordtype">double</font> *charges); 00073 00074 <font class="comment">// Given surface charge density compute charges.</font> 00075 <font class="keywordtype">void</font> surface_charge_density_to_charges(<font class="keywordtype">double</font> *charges); 00076 <font class="keyword">public</font>: 00077 BEMSolvent(<font class="keyword">const</font> Ref<KeyVal>&); 00078 <font class="keyword">virtual</font> ~BEMSolvent(); 00079 00080 <font class="comment">// This should be called after everything is setup--the</font> 00081 <font class="comment">// molecule has the correct the geometry and all of the</font> 00082 <font class="comment">// parameters have been adjusted.</font> 00083 <font class="keywordtype">void</font> init(); 00084 <font class="comment">// This gets rid of the system matrix inverse and, optionally, the surface.</font> 00085 <font class="keywordtype">void</font> done(<font class="keywordtype">int</font> clear_surface = 1); 00086 00087 <font class="keywordtype">int</font> ncharge()<font class="keyword"> </font>{ <font class="keywordflow">return</font> surf_->nvertex(); } 00088 00089 Ref<Molecule> solvent()<font class="keyword"> </font>{ <font class="keywordflow">return</font> solvent_ ;} 00090 <font class="keywordtype">double</font> solvent_density()<font class="keyword"> </font>{ <font class="keywordflow">return</font> solvent_density_ ;} 00091 00092 <font class="comment">// NOTE: call allocation routines after init and free routines before done</font> 00093 <font class="keywordtype">double</font>** alloc_charge_positions()<font class="keyword"> </font>{ <font class="keywordflow">return</font> alloc_array(ncharge(), 3); } 00094 <font class="keywordtype">void</font> free_charge_positions(<font class="keywordtype">double</font>**a)<font class="keyword"> </font>{ free_array(a); } 00095 00096 <font class="keywordtype">double</font>** alloc_normals()<font class="keyword"> </font>{ <font class="keywordflow">return</font> alloc_array(ncharge(), 3); } 00097 <font class="keywordtype">void</font> free_normals(<font class="keywordtype">double</font>**a)<font class="keyword"> </font>{ free_array(a); } 00098 00099 <font class="keywordtype">double</font>* alloc_efield_dot_normals()<font class="keyword"> </font>{ <font class="keywordflow">return</font> <font class="keyword">new</font> <font class="keywordtype">double</font>[ncharge()]; } 00100 <font class="keywordtype">void</font> free_efield_dot_normals(<font class="keywordtype">double</font>*a)<font class="keyword"> </font>{ <font class="keyword">delete</font>[] a; } 00101 00102 <font class="keywordtype">double</font>* alloc_charges()<font class="keyword"> </font>{ <font class="keywordflow">return</font> <font class="keyword">new</font> <font class="keywordtype">double</font>[ncharge()]; } 00103 <font class="keywordtype">void</font> free_charges(<font class="keywordtype">double</font>*a)<font class="keyword"> </font>{ <font class="keyword">delete</font>[] a; } 00104 00105 <font class="keywordtype">void</font> charge_positions(<font class="keywordtype">double</font>**); 00106 <font class="keywordtype">void</font> normals(<font class="keywordtype">double</font>**); 00107 00108 <font class="comment">// Given the efield dotted with the normals at the charge positions this</font> 00109 <font class="comment">// will compute a new set of charges.</font> 00110 <font class="keywordtype">void</font> compute_charges(<font class="keywordtype">double</font>* efield_dot_normals, <font class="keywordtype">double</font>* charge); 00111 00112 <font class="comment">// Given a set of charges and a total charge, this will normalize</font> 00113 <font class="comment">// the integrated charge to the charge that would be expected on</font> 00114 <font class="comment">// the surface if the given total charge were enclosed within it.</font> 00115 <font class="keywordtype">void</font> normalize_charge(<font class="keywordtype">double</font> enclosed_charge, <font class="keywordtype">double</font>* charges); 00116 00117 <font class="comment">// Given charges and nuclear charges compute their interation energy.</font> 00118 <font class="keywordtype">double</font> nuclear_charge_interaction_energy(<font class="keywordtype">double</font> *nuclear_charge, 00119 <font class="keywordtype">double</font>** charge_positions, 00120 <font class="keywordtype">double</font>* charge); 00121 00122 <font class="comment">// Given charges compute the interaction energy between the nuclei</font> 00123 <font class="comment">// and the point charges.</font> 00124 <font class="keywordtype">double</font> nuclear_interaction_energy(<font class="keywordtype">double</font>** charge_positions, 00125 <font class="keywordtype">double</font>* charge); 00126 00127 <font class="comment">// Given charges compute the interaction energy for just the surface.</font> 00128 <font class="keywordtype">double</font> self_interaction_energy(<font class="keywordtype">double</font>** charge_positions, <font class="keywordtype">double</font> *charge); 00129 00130 <font class="comment">// Given the charges, return the total polarization charge on the surface.</font> 00131 <font class="keywordtype">double</font> polarization_charge(<font class="keywordtype">double</font>* charge); 00132 00133 <font class="comment">// Return the area (available after compute_charges called).</font> 00134 <font class="keywordtype">double</font> area()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> area_; } 00135 <font class="comment">// Return the volume (available after compute_charges called).</font> 00136 <font class="keywordtype">double</font> volume()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> volume_; } 00137 <font class="comment">// Return the enclosed charge (available after compute_charges called).</font> 00138 <font class="keywordtype">double</font> computed_enclosed_charge()<font class="keyword"> const </font>{ 00139 <font class="keywordflow">return</font> computed_enclosed_charge_; 00140 } 00141 00142 <font class="keywordtype">double</font> disp()<font class="keyword"> </font>{<font class="keywordflow">return</font> edisp_;} 00143 <font class="keywordtype">double</font> rep()<font class="keyword"> </font>{<font class="keywordflow">return</font> erep_;} 00144 <font class="keywordtype">double</font> disprep(); 00145 00146 <font class="comment">// this never needs to be called explicitly, but is here now for debugging</font> 00147 <font class="keywordtype">void</font> init_system_matrix(); 00148 00149 Ref<TriangulatedImplicitSurface> surface()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> surf_; } 00150 00151 Ref<SCMatrixKit> matrixkit()<font class="keyword"> </font>{ <font class="keywordflow">return</font> matrixkit_; } 00152 }; 00153 00154 } 00155 00156 <font class="preprocessor">#endif</font> 00157 <font class="preprocessor"></font> 00158 <font class="comment">// Local Variables:</font> 00159 <font class="comment">// mode: c++</font> 00160 <font class="comment">// c-file-style: "CLJ"</font> 00161 <font class="comment">// End:</font> </div></pre><hr> <address> <small> Generated at Mon Oct 14 14:16:35 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>