identify_surface

nanoCAT.bde.identify_surface

A module for identifying which atoms are located on the surface, rather than in the bulk

Index

identify_surface(mol[, max_dist, tolerance, ...])

Take a molecule and identify which atoms are located on the surface, rather than in the bulk.

identify_surface_ch(mol[, n, invert])

Identify the surface of mol using a convex hull-based approach.

API

nanoCAT.bde.identify_surface.identify_surface(mol, max_dist=None, tolerance=0.5, compare_func=<built-in function gt>)[source]

Take a molecule and identify which atoms are located on the surface, rather than in the bulk.

The function compares the position of all reference atoms in mol with its direct neighbors, the latter being defined as all atoms within a radius max_dist. The distance is then calculated between the reference atoms and the mean-position of its direct neighbours. A length of 0 means that the atom is surrounded in a spherical symmetric manner, i.e. it must be located in the bulk. Deviations from 0 conversely imply that an atom is located on the surface.

Parameters:
  • mol (array-like [float], shape \((n, 3)\)) – An array-like object with the Cartesian coordinates of the molecule.

  • max_dist (float, optional) – The radius for defining which atoms constitute as neighbors. If None, estimate this value using the radial distribution function of mol.

  • tolerance (float) – The tolerance for considering atoms part of the surface. A higher value will impose stricter criteria, which might be necasary as the local symmetry of mol becomes less pronounced. Should be in the same units as the coordinates of mol.

  • compare_func (Callable) – The function for evaluating the direct-neighbor distance. The default, __gt__(), is equivalent to identifying the surface, while e.g. __lt__() identifies the bulk.

Returns:

The (0-based) indices of all atoms in mol located on the surface.

Return type:

numpy.ndarray [int], shape \((n,)\)

Raises:

ValueError – Raised if no atom-pairs are found within the distance max_dist. Implies that either the user-specified or guessed value is too small.

See also

guess_core_core_dist()

Estimate a value for max_dist based on the radial distribution function of mol.

nanoCAT.bde.identify_surface.identify_surface_ch(mol, n=0.5, invert=False)[source]

Identify the surface of mol using a convex hull-based approach.

A convex hull represents the smallest set of points enclosing itself, thus defining a surface.

Parameters:
  • mol (array-like [float], shape \((n, 3)\)) – A 2D array-like object of Cartesian coordinates representing a polyhedron. The supplied polyhedron should be convex in shape.

  • n (float) –

    Smoothing factor for constructing a convex hull. Should obey \(0 <= n <= 1\). Represents the degree of displacement of all atoms to a spherical surface; \(n = 1\) is a complete projection while \(n = 0\) means no displacement at all.

    A non-zero value is generally recomended here, as the herein utilized ConvexHull class requires an adequate degree of surface-convexness, lest it fails to properly identify all valid surface points.

  • invert (bool) – If True, return the indices of all atoms in the bulk rather than on the surface.

Returns:

The (0-based) indices of all atoms in mol located on the surface.

Return type:

numpy.ndarray [int], shape \((n,)\)

See also

ConvexHull

Convex hulls in N dimensions.