init
__all__ = ['SphericalRegion', 'RectangularRegion', 'collect_regions', 'GridMesh']
¶
GridMesh(box, res)
¶
A class representing a box of equidistant points.
Initialize the class.
PARAMETER | DESCRIPTION |
---|---|
|
A numpy array representing two 3D points, (min_x, min_y, min_z) and (max_x, max_y, max_z), that define a box.
TYPE:
|
|
The space between the points of the box, in the X, Y, and Z direction.
TYPE:
|
points = np.array(list(zip(x.ravel(), y.ravel(), z.ravel())))
¶
write_pdbs = write_pdbs()
¶
__delete_limited_points(pt_indices)
¶
A support function
__keep_limited_points(pt_indices)
¶
A support function
__snap_float(val, res)
¶
Snaps an arbitrary point to the nearest grid point.
PARAMETER | DESCRIPTION |
---|---|
|
A numpy array corresponding to a 3D point.
TYPE:
|
|
The resolution (distance in the X, Y, and Z directions between adjacent points) of the grid.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
NDArray[float64]
|
A numpy array corresponding to a 3D point near val that is on a nearby grid point. |
__unique_points()
¶
Identifies unique points (rows) in an array of points.
PARAMETER | DESCRIPTION |
---|---|
|
A nx3 np.array representing 3D points.
|
RETURNS | DESCRIPTION |
---|---|
A nx2 np.array containing the 3D points that are unique. |
expand_around_existing_points(num_pts, reso)
¶
filter_isolated_points_until_no_change(reso, number_of_neighbors)
¶
remove_all_points_close_to_other_points(other_points, dist_cutoff, config)
¶
Removes all points in this box that come within the points specified in a numpy array
PARAMETER | DESCRIPTION |
---|---|
|
A numpy array containing the other points.
TYPE:
|
|
A float, the cutoff distance to use in determining whether or not box points will be removed.
TYPE:
|
|
Configuration object containing
TYPE:
|
remove_points_outside_convex_hull(hull, config)
¶
separate_out_pockets()
¶
Separate the points according to the pocket they belong to. Determined by looking at patches of contiguous points.
RETURNS | DESCRIPTION |
---|---|
list[NDArray[float64]]
|
A list of point arrays, each array corresponding to the points of a separate pocket. |
RectangularRegion(center, lengths)
¶
Bases: Region
A 3D rectangular region defined by its center and dimensions.
This class represents a rectangular box in 3D space, capable of generating a grid of points that fill the box.
Initialize a rectangular region.
PARAMETER | DESCRIPTION |
---|---|
|
The x, y, and z coordinates of the center of the box.
TYPE:
|
|
The lengths of the box along the x, y, and z axes.
TYPE:
|
center = np.array(center)
¶
A list of three floats representing the x, y, and z coordinates of the box's center, in Angstroms.
lengths = np.array(lengths)
¶
A list of three floats representing the lengths of the box along the x, y, and z axes, in Angstroms.
__str__()
¶
Returns a string representation of the rectangular region.
get_points(res)
¶
Generates a grid of points filling the rectangular region.
PARAMETER | DESCRIPTION |
---|---|
|
The resolution of the grid, defining the spacing between points.
|
RETURNS | DESCRIPTION |
---|---|
A numpy array of shape (n, 3), where each row is a [x, y, z] |
|
coordinate representing a point within the rectangular region. |
SphericalRegion(center, radius)
¶
Bases: Region
A 3D spherical region defined by a center and a radius.
This class represents a sphere in 3D space, capable of generating a grid of points that fill the sphere. Points outside the sphere boundary are excluded.
Initialize a spherical region.
PARAMETER | DESCRIPTION |
---|---|
|
The x, y, and z coordinates of the center of the sphere.
TYPE:
|
|
The radius of the sphere in Angstroms.
TYPE:
|
center = np.array(center)
¶
x
, y
, and z
coordinates in Angstroms of the center.
radius = radius
¶
Sphere radius in Angstroms.
__str__()
¶
Returns a string representation of the spherical region.
get_points(res)
¶
Generates a grid of points filling the spherical region.
PARAMETER | DESCRIPTION |
---|---|
|
The resolution of the grid, defining the spacing between points.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
NDArray[float64]
|
A numpy array of shape (n, 3), where each row is a [x, y, z] |
NDArray[float64]
|
coordinate representing a point within the spherical region. |
collect_regions(spherical_configs, rectangular_configs)
¶
Creates a collection of 3D regions from spherical and rectangular configurations.
This function takes configurations for spherical and rectangular regions, instantiates the respective region objects, and returns a combined list of these regions. Empty or invalid configurations are skipped.
PARAMETER | DESCRIPTION |
---|---|
|
A list of dictionaries, each specifying a spherical region. Each dictionary must have:
If
TYPE:
|
|
A list of dictionaries, each specifying a rectangular region. Each dictionary must have:
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[SphericalRegion | RectangularRegion]
|
A list containing |
Example
>>> spherical_configs = [
... {"center": [0.0, 0.0, 0.0], "radius": 5.0},
... {"center": [10.0, 10.0, 10.0], "radius": 3.0},
... ]
>>> rectangular_configs = [
... {"center": [0.0, 0.0, 0.0], "lengths": [10.0, 5.0, 2.0]}
... ]
>>> regions = collect_regions(spherical_configs, rectangular_configs)
>>> for region in regions:
... print(region)
sphere at (0.0, 0.0, 0.0), radius = 5.0
sphere at (10.0, 10.0, 10.0), radius = 3.0
box centered at (0.0, 0.0, 0.0) with dimensions (10.0, 5.0, 2.0)