IMP logo
IMP Reference Guide  2.19.0
The Integrative Modeling Platform
algebra/connolly_surface.h
Go to the documentation of this file.
1 /**
2  * \file IMP/algebra/connolly_surface.h
3  * \brief Generate surface for a set of atoms.
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPALGEBRA_CONNOLLY_SURFACE_H
10 #define IMPALGEBRA_CONNOLLY_SURFACE_H
11 
12 #include <IMP/algebra/algebra_config.h>
13 #include "Sphere3D.h"
14 #include <IMP/value_macros.h>
15 #include <IMP/showable_macros.h>
16 #include <IMP/Vector.h>
17 #include <cereal/access.hpp>
18 
19 IMPALGEBRA_BEGIN_NAMESPACE
20 
21 //! Represent a point on the Connolly surface.
22 /** \see get_connolly_surface */
24  int atom[3];
25  algebra::Vector3D surface_point;
26  double area;
27  algebra::Vector3D normal;
28 
29  friend class cereal::access;
30 
31  template<class Archive> void serialize(Archive &ar) {
32  ar(atom[0], atom[1], atom[2], surface_point, area, normal);
33  }
34 
35  public:
37 
38  ConnollySurfacePoint(int a0, int a1, int a2, algebra::Vector3D sp, float a,
40  : surface_point(sp), area(a), normal(n) {
41  atom[0] = a0;
42  atom[1] = a1;
43  atom[2] = a2;
44  }
45  int get_atom(unsigned int i) {
46  IMP_USAGE_CHECK(i < 3, "Out of range");
47  return atom[i];
48  }
49  const algebra::Vector3D& get_surface_point() const { return surface_point; }
50  double get_area() const { return area; }
51  const algebra::Vector3D& get_normal() const { return normal; }
52  IMP_SHOWABLE_INLINE(ConnollySurfacePoint, out << surface_point);
53 };
54 
56 
57 /** The algorithm is taken from Connolly's original MS program, which is
58  freely distributable and Copyright 1983, Michael Connolly.
59 
60  M.L. Connolly, "Solvent-accessible surfaces of proteins and nucleic acids",
61  Science, 221, p709-713 (1983).
62 
63  M.L. Connolly, "Analytical molecular surface calculation",
64  J. Appl. Cryst. 16, p548-558 (1983).
65 
66  See also get_uniform_surface_cover(const IMP::algebra::Sphere3Ds&, double)
67  for a faster alternative.
68  */
69 IMPALGEBRAEXPORT ConnollySurfacePoints
70  get_connolly_surface(const algebra::Sphere3Ds& spheres, double density,
71  double probe_radius);
72 
73 IMPALGEBRA_END_NAMESPACE
74 
75 #endif /* IMPALGEBRA_CONNOLLY_SURFACE_H */
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
double get_area(const Geometry &)
Compute the area of any surface object.
Atom get_atom(Residue rd, AtomType at)
Return a particle atom from the residue.
A more IMP-like version of the std::vector.
Definition: Vector.h:42
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Definition: value_macros.h:23
A class for storing lists of IMP items.
VectorD< 3 > Vector3D
Definition: VectorD.h:425
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Definition: check_macros.h:168
Macros to help in implementing Value objects.
Represent a point on the Connolly surface.
Simple 3D sphere class.
Macros to help with objects that can be printed to a stream.
ConnollySurfacePoints get_connolly_surface(const algebra::Sphere3Ds &spheres, double density, double probe_radius)