source: ThirdParty/mpqc_open/src/lib/chemistry/molecule/molshape.h@ 482400e

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_levmar Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 482400e was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 5.7 KB
Line 
1//
2// molshape.h
3//
4// Copyright (C) 1996 Limit Point Systems, Inc.
5//
6// Author: Curtis Janssen <cljanss@limitpt.com>
7// Maintainer: LPS
8//
9// This file is part of the SC Toolkit.
10//
11// The SC Toolkit is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Library General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// The SC Toolkit is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Library General Public License for more details.
20//
21// You should have received a copy of the GNU Library General Public License
22// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27
28#ifndef _chemistry_molecule_molshape_h
29#define _chemistry_molecule_molshape_h
30
31#ifdef __GNUC__
32#pragma interface
33#endif
34
35#include <util/misc/formio.h>
36
37#include <math/isosurf/shape.h>
38#include <chemistry/molecule/atominfo.h>
39#include <chemistry/molecule/molecule.h>
40
41namespace sc {
42
43/** The VDWShape class describes the surface of a
44 molecule as the union of atom centered spheres, each the
45 van der Waals radius of the atom.
46*/
47class VDWShape: public UnionShape {
48 private:
49 Ref<AtomInfo> atominfo_;
50 public:
51 VDWShape(const Ref<Molecule>&);
52 VDWShape(const Ref<KeyVal>&);
53 ~VDWShape();
54 void initialize(const Ref<Molecule>&);
55};
56
57/** DiscreteConnollyShape and ConnollyShape should produce the same result.
58 The discrete version is a shape union of discrete subshapes and is
59 slower. These classes describe the solvent accessible surface of a
60 molecule. */
61class DiscreteConnollyShape: public UnionShape {
62 private:
63 double radius_scale_factor_;
64 Ref<AtomInfo> atominfo_;
65 public:
66 DiscreteConnollyShape(const Ref<KeyVal>&);
67 ~DiscreteConnollyShape();
68 void initialize(const Ref<Molecule>&,double probe_radius);
69};
70
71#ifndef COUNT_CONNOLLY
72# define COUNT_CONNOLLY 1
73#endif
74
75// This is a utility class needed by ConnollyShape2
76class CS2Sphere
77{
78 SCVector3 _v;
79 double _radius;
80
81 public:
82#if COUNT_CONNOLLY
83 static int n_no_spheres_;
84 static int n_probe_enclosed_by_a_sphere_;
85 static int n_probe_center_not_enclosed_;
86 static int n_surface_of_s0_not_covered_;
87 static int n_plane_totally_covered_;
88 static int n_internal_edge_not_covered_;
89 static int n_totally_covered_;
90#endif
91
92 CS2Sphere(const SCVector3& v, double rad):
93 _v(v),_radius(rad){}
94 CS2Sphere(double x, double y, double z, double rad):
95 _v(x,y,z),_radius(rad){}
96 CS2Sphere(void) {};
97 void initialize(SCVector3& v, double rad) {
98 _v = v; _radius = rad; }
99
100 CS2Sphere& operator=(const CS2Sphere&s) {
101 _v = s._v; _radius = s._radius; return *this; }
102
103 // Return the distance between the centers of the two
104 // spheres
105 double distance(CS2Sphere &asphere)
106 { return sqrt((_v[0]-asphere._v[0])*(_v[0]-asphere._v[0])+
107 (_v[1]-asphere._v[1])*(_v[1]-asphere._v[1])+
108 (_v[2]-asphere._v[2])*(_v[2]-asphere._v[2]));}
109
110 // Return the radius of the circle intersecting the two spheres
111 // Note that this assumes the spheres do overlap!
112 double common_radius(CS2Sphere &asphere);
113
114 // Return the center
115 const SCVector3& center(void) const { return _v; }
116 double x() const { return _v[0]; }
117 double y() const { return _v[1]; }
118 double z() const { return _v[2]; }
119
120 // Return the vector3d connecting the two centers
121 SCVector3 center_vec(const CS2Sphere &asphere) { return _v - asphere._v; }
122
123 double radius(void) const {return _radius;}
124
125 void recenter(const SCVector3 &v) { _v -= v; }
126 void print(std::ostream& os=ExEnv::out0()) const
127 {
128 os << indent
129 << scprintf("Rad=%lf, Center=(%lf,%lf,%lf), From origin=%lf\n",
130 _radius, _v[0], _v[1], _v[2], _v.norm());
131 }
132
133 // Function to determine if there is any portion of this that
134 // is not inside one or more of the spheres in s[]. Returns
135 // 1 if the intersection is empty, otherwise 0 is returned.
136 // Warning: the spheres in s are modified.
137 int intersect(CS2Sphere *s,
138 int n_spheres) const;
139
140 static void print_counts(std::ostream& = ExEnv::out0());
141};
142
143#define CONNOLLYSHAPE_N_WITH_NSPHERE_DIM 10
144/** DiscreteConnollyShape and ConnollyShape should produce the same result.
145 The discrete version is a shape union of discrete subshapes and is
146 slower. These classes describe the solvent accessible surface of a
147 molecule. */
148class ConnollyShape: public Shape {
149 private:
150 CS2Sphere* sphere;
151 double probe_r;
152 double radius_scale_factor_;
153 int n_spheres;
154 Ref<AtomInfo> atominfo_;
155
156 std::vector<int> ***box_;
157 double l_;
158 int xmax_;
159 int ymax_;
160 int zmax_;
161 SCVector3 lower_;
162
163 int get_box(const SCVector3 &v, int &x, int &y, int &z) const;
164
165#if COUNT_CONNOLLY
166 static int n_total_;
167 static int n_inside_vdw_;
168 static int n_with_nsphere_[CONNOLLYSHAPE_N_WITH_NSPHERE_DIM];
169#endif
170
171 public:
172 ConnollyShape(const Ref<KeyVal>&);
173 ~ConnollyShape();
174 void initialize(const Ref<Molecule>&,double probe_radius);
175 void clear();
176 double distance_to_surface(const SCVector3&r,
177 SCVector3*grad=0) const;
178 void boundingbox(double valuemin,
179 double valuemax,
180 SCVector3& p1, SCVector3& p2);
181
182 static void print_counts(std::ostream& = ExEnv::out0());
183};
184
185}
186
187#endif
188
189// Local Variables:
190// mode: c++
191// c-file-style: "CLJ"
192// End:
Note: See TracBrowser for help on using the repository browser.