MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
molshape.h
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#include <util/misc/formio.h>
32
33#include <math/isosurf/shape.h>
34#include <chemistry/molecule/atominfo.h>
35#include <chemistry/molecule/molecule.h>
36
37namespace sc {
38
43class VDWShape: public UnionShape {
44 private:
45 Ref<AtomInfo> atominfo_;
46 public:
48 double radius_scale_factor = 1.0);
49 VDWShape(const Ref<KeyVal>&);
50 ~VDWShape();
51 void initialize(const Ref<Molecule>&,
52 double radius_scale_factor = 1.0);
53};
54
60 private:
61 double radius_scale_factor_;
62 Ref<AtomInfo> atominfo_;
63 public:
66 void initialize(const Ref<Molecule>&,double probe_radius);
67};
68
69#ifndef COUNT_CONNOLLY
70# define COUNT_CONNOLLY 1
71#endif
72
73// This is a utility class needed by ConnollyShape2
75{
76 SCVector3 _v;
77 double _radius;
78
79 public:
80#if COUNT_CONNOLLY
81 static int n_no_spheres_;
82 static int n_probe_enclosed_by_a_sphere_;
83 static int n_probe_center_not_enclosed_;
84 static int n_surface_of_s0_not_covered_;
85 static int n_plane_totally_covered_;
86 static int n_internal_edge_not_covered_;
87 static int n_totally_covered_;
88#endif
89
90 CS2Sphere(const SCVector3& v, double rad):
91 _v(v),_radius(rad){}
92 CS2Sphere(double x, double y, double z, double rad):
93 _v(x,y,z),_radius(rad){}
94 CS2Sphere(void) {};
95 void initialize(SCVector3& v, double rad) {
96 _v = v; _radius = rad; }
97
98 CS2Sphere& operator=(const CS2Sphere&s) {
99 _v = s._v; _radius = s._radius; return *this; }
100
101 // Return the distance between the centers of the two
102 // spheres
103 double distance(CS2Sphere &asphere)
104 { return sqrt((_v[0]-asphere._v[0])*(_v[0]-asphere._v[0])+
105 (_v[1]-asphere._v[1])*(_v[1]-asphere._v[1])+
106 (_v[2]-asphere._v[2])*(_v[2]-asphere._v[2]));}
107
108 // Return the radius of the circle intersecting the two spheres
109 // Note that this assumes the spheres do overlap!
110 double common_radius(CS2Sphere &asphere);
111
112 // Return the center
113 const SCVector3& center(void) const { return _v; }
114 double x() const { return _v[0]; }
115 double y() const { return _v[1]; }
116 double z() const { return _v[2]; }
117
118 // Return the vector3d connecting the two centers
119 SCVector3 center_vec(const CS2Sphere &asphere) { return _v - asphere._v; }
120
121 double radius(void) const {return _radius;}
122
123 void recenter(const SCVector3 &v) { _v -= v; }
124 void print(std::ostream& os=ExEnv::out0()) const
125 {
126 os << indent
127 << scprintf("Rad=%lf, Center=(%lf,%lf,%lf), From origin=%lf\n",
128 _radius, _v[0], _v[1], _v[2], _v.norm());
129 }
130
131 // Function to determine if there is any portion of this that
132 // is not inside one or more of the spheres in s[]. Returns
133 // 1 if the intersection is empty, otherwise 0 is returned.
134 // Warning: the spheres in s are modified.
135 int intersect(CS2Sphere *s,
136 int n_spheres) const;
137
138 static void print_counts(std::ostream& = ExEnv::out0());
139};
140
141#define CONNOLLYSHAPE_N_WITH_NSPHERE_DIM 10
146class ConnollyShape: public Shape {
147 private:
148 CS2Sphere* sphere;
149 double probe_r;
150 double radius_scale_factor_;
151 int n_spheres;
152 Ref<AtomInfo> atominfo_;
153
154 std::vector<int> ***box_;
155 double l_;
156 int xmax_;
157 int ymax_;
158 int zmax_;
159 SCVector3 lower_;
160
161 int get_box(const SCVector3 &v, int &x, int &y, int &z) const;
162
163#if COUNT_CONNOLLY
164 static int n_total_;
165 static int n_inside_vdw_;
166 static int n_with_nsphere_[CONNOLLYSHAPE_N_WITH_NSPHERE_DIM];
167#endif
168
169 public:
172 void initialize(const Ref<Molecule>&,double probe_radius);
173 void clear();
174 double distance_to_surface(const SCVector3&r,
175 SCVector3*grad=0) const;
176 void boundingbox(double valuemin,
177 double valuemax,
178 SCVector3& p1, SCVector3& p2);
179
180 static void print_counts(std::ostream& = ExEnv::out0());
181};
182
183}
184
185#endif
186
187// Local Variables:
188// mode: c++
189// c-file-style: "CLJ"
190// End:
Definition molshape.h:75
DiscreteConnollyShape and ConnollyShape should produce the same result.
Definition molshape.h:146
DiscreteConnollyShape and ConnollyShape should produce the same result.
Definition molshape.h:59
static std::ostream & out0()
Return an ostream that writes from node 0.
A template class that maintains references counts.
Definition ref.h:361
a 3-element version of SCVector
Definition vector3.h:44
A Shape is a Volume represents an 3D solid.
Definition shape.h:44
A UnionShape is volume enclosed by a set of Shape's.
Definition shape.h:226
The VDWShape class describes the surface of a molecule as the union of atom centered spheres,...
Definition molshape.h:43
This class allows printf-like output to be sent to an ostream.
Definition formio.h:97
Contains all MPQC code up to version 3.
Definition mpqcin.h:14

Generated at Wed Sep 25 2024 02:45:29 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.