Cavity#

Classes for the cavity

Sphere#

class classyq::Sphere#

Public Functions

Sphere(double max_w, double r, const Eigen::Vector3d &c, bool on_atom = true)#

Constructor from maximum quadrature weight.

TODO convert it to density of points (G16 uses 5 points per Ang^2)

Parameters
  • max_w[in] maximum quadrature weight (inverse of the density of points)

  • r[in] radius of the sphere.

  • c[in] center of the sphere.

  • on_atom[in] whether the sphere is centered on an atom. Spheres not centered on atoms do not contribute to the molecular gradient.

auto switching(const Eigen::Vector3d &s, double rho) const -> double#

Switching function at given point.

The switching function is a smoothed Heaviside step function:

  • 0 if point \(j\) on sphere \(\alpha\) is inside sphere \(\beta\) (this sphere),

  • 1 if it’s outside.

Formally:

\[ \vartheta(d_{\beta}^{\alpha j}) = \frac{1}{2}\left[ 1 + \erf\left(d_{\beta}^{\alpha j}\right) \right], \]

where \(d_{\beta}^{\alpha j}\) is the penetration distance:

\[ d_{\beta}^{\alpha j} = \frac{|\mathbf{s}_{\alpha j} - \mathbf{c}_{\beta}| - R_{\beta}}{\rho}, \]

defined in terms of the signed normal distance and the interaction radius \(\rho\). The latter is a function of the given evaluation point.

Parameters
  • s[in] evaluation point.

  • rho[in] interaction radius of point.

inline auto center() const -> Eigen::Vector3d#

Center of sphere.

inline auto radius() const -> double#

Radius of sphere.

inline auto size() const -> size_t#

Number of quadrature points.

inline auto weight() const -> double#

Weight of EQ points.

inline auto omega() const -> double#

Weight of EQ points on the unit sphere

inline auto points() const -> Eigen::Matrix3Xd#

EQ points.

auto str() const -> std::string#

String representation of object.

Private Members

bool atom_centered_ = {true}#

Whether the sphere is centered on an atom.

Spheres not attached to an atom do not contribute to the molecular gradient.

size_t N_ = {0}#

Number of EQ points.

double omega_ = {0.0}#

Weight of EQ points for the unit sphere.

This is set to \( \omega = \frac{4\pi}{N} \), while the weight is \(w = \omega R^{2}\). The former is used in the definition of the self-potential and self-field factors, while the latter is the weight used in the quadrature of the interlocking-sphere cavity.

double radius_ = {0.0}#

Radius.

Eigen::Vector3d center_ = {0.0, 0.0, 0.0}#

Center.

Eigen::Matrix3Xd points_#

EQ points, in Cartesian coordinates, for the unit sphere.

Note

these are equivalent to the normal vectors at the points on the non-unit sphere.

TsLess#

class classyq::TsLess#

This is a modified implementation of the cavity partition first described in [2] At variance with the work of Pomelli:

  1. We define the sphere-sphere switching using the error function, instead of a polynomial.

  2. The diagonal factors for the collocation of the boundary integral operators are defined as in [3].

Public Functions

inline auto size() const -> size_t#

Return number of quadrature points.

inline auto n_spheres() const -> size_t#

Return number of spheres.

inline auto spheres() const -> std::vector<Sphere>#

Return list of spheres.

inline auto spheres(size_t A) const -> Sphere#

Return a sphere in list.

Parameters

A[in] index of sphere.

inline auto threshold() const -> double#

Return threshold for weight of point.

inline auto weights() const -> Eigen::VectorXd#

Return vector of quadrature weights.

inline auto points_per_sphere() const -> std::vector<size_t>#

Return list with number of points in quadrature belonging to each sphere.

inline auto points_per_sphere(size_t A) const -> size_t#

Return number of points in quadrature belonging to given sphere.

Parameters

A[in] index of sphere.

inline auto points() const -> Eigen::Matrix3Xd#

Return quadrature points.

inline auto points(size_t i) const -> Eigen::Vector3d#

Return given quadrature points.

Parameters

i[in] index of point.

inline auto normals() const -> Eigen::Matrix3Xd#

Return normal vectors at quadrature points.

inline auto normals(size_t i) const -> Eigen::Vector3d#

Return given normal vector at quadrature points.

Parameters

i[in] index of point.

inline auto area() const -> double#

Return surface area of cavity.

auto volume() const -> double#

Return surface area of cavity.

auto str() const -> std::string#

String representation of object.

Private Members

size_t N_ = {0}#

Total number of quadrature points.

double threshold_ = {std::numeric_limits<double>::epsilon()}#

Quadrature weight threshold.

std::vector<Sphere> spheres_#

List of spheres

Eigen::VectorXd weights_#

Weight of quadrature points.

Eigen::Matrix3Xd points_#

Quadrature points.

Eigen::Matrix3Xd normals_#

Normal vectors at quadrature points.

std::vector<size_t> points_per_sphere_#

List of points per sphere in the final quadrature.

std::vector<double> exposed_area_#

List of exposed areas per sphere.