Volume
Pocket volume calculation for single structures and MD trajectories.
This module provides the PocketVolume class, which orchestrates
the end-to-end POVME volume-measurement workflow:
- Generate (or load) the pocket-encompassing point field from user-defined inclusion/exclusion regions.
- Distribute per-frame volume calculations across workers using
RayManager. - Collect results and optionally write trajectory PDBs and volumetric density maps.
PocketVolume(config=None)
¶
The main class to run POVME.
Initialize POVME.
| PARAMETER | DESCRIPTION |
|---|---|
|
Pocket volume calculation configuration.
TYPE:
|
config = config
¶
gen_points(config)
¶
Generate the pocket-encompassing point field.
Constructs a regular grid of 3D points by unioning all inclusion-region grids and then subtracting all exclusion-region grids.
| PARAMETER | DESCRIPTION |
|---|---|
|
The volume-calculation configuration, which specifies inclusion/exclusion spheres and boxes and the grid spacing.
|
| RETURNS | DESCRIPTION |
|---|---|
|
An |
run(path_pdb, output_prefix=None, chunk_size=10)
¶
write_points(pts, output_prefix, config)
¶
write_points_contig(regions_contig, output_prefix, config)
¶
write_vol_dens(results, output_prefix, config)
¶
write_vol_traj(results_vol, output_prefix, config)
¶
collect_pdb_frames_in_chunks(filename, chunk_size)
¶
Read a multi-frame PDB and yield frames in chunks.
Frames are delimited by lines starting with END. Frames are
accumulated into chunks of chunk_size before being yielded, reducing
the overhead of task submission when using parallel workers.
| PARAMETER | DESCRIPTION |
|---|---|
|
Path to the multi-frame PDB file.
TYPE:
|
|
Maximum number of frames per yielded chunk.
TYPE:
|
| YIELDS | DESCRIPTION |
|---|---|
list[tuple[int, str]]
|
Lists of |
get_unique_rows(a)
¶
Return the unique rows of a 2-D array.
Each row is treated as an opaque byte string so that
numpy.unique
can identify duplicates without floating-point
tolerance issues (the input is assumed to be snapped to a grid).
| PARAMETER | DESCRIPTION |
|---|---|
|
An array of shape
|
| RETURNS | DESCRIPTION |
|---|---|
|
An array of shape |
|
|
unique rows, in sorted order. |
remove_exclusion_points(pts, pts_exclusion)
¶
Remove inclusion points that coincide with exclusion points.
Both point sets are assumed to lie on the same regular grid (i.e., their
coordinates are exact multiples of the grid spacing after snapping).
Instead of computing a full pairwise distance matrix with
cdist,
this function performs a set-difference using NumPy's structured-array view trick.
- Each
(x, y, z)row is reinterpreted as a single opaquenp.voidelement. numpy.isinperforms a hash-based membership test.
| PARAMETER | DESCRIPTION |
|---|---|
|
An
TYPE:
|
|
An
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ndarray
|
An |