Finding Neighbors
lahuta.core.neighbor_finder.NeighborSearch ¶
Handle atom related operations, including finding neighbors and preparation for computation.
The class provides methods to find neighbors of each atom in the universe and to remove pairs of atoms that are adjacent in the sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mda |
AtomGroupType
|
The AtomGroup containing the atoms. |
required |
Attributes:
Name | Type | Description |
---|---|---|
ag_no_h |
AtomGroup
|
Atom group of a universe excluding hydrogen atoms. |
og_resids |
ndarray
|
The residue IDs of each atom in the universe. |
Source code in lahuta/core/neighbor_finder.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
compute ¶
compute(radius=5.0, res_dif=1)
Compute the neighbors of each atom in the Universe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
radius |
float
|
The cutoff radius. Default is 5.0. |
5.0
|
res_dif |
int
|
The residue difference to consider. Default is 1. |
1
|
Returns:
Name | Type | Description |
---|---|---|
PairsDistances |
PairsDistances
|
A tuple containing the pairs of atom indices and the distances. |
Source code in lahuta/core/neighbor_finder.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
get_neighbors ¶
get_neighbors(radius)
Get the neighbors of an AtomGroup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
radius |
float
|
The cutoff radius. |
required |
Returns:
Name | Type | Description |
---|---|---|
PairsDistances |
PairsDistances
|
A tuple containing the pairs of atom indices and the distances. |
Source code in lahuta/core/neighbor_finder.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
remove_adjacent_residue_pairs ¶
remove_adjacent_residue_pairs(pairs, res_dif=1)
Remove pairs where the difference in residue ids is less than res_dif
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pairs |
NDArray[int32]
|
An array of shape (n_pairs, 2) where each row is a pair of atom indices. |
required |
res_dif |
int
|
The difference in residue ids to remove. Default is 1. |
1
|
Returns:
Type | Description |
---|---|
NDArray[bool_]
|
NDArray[np.bool_]: An array of shape (n_pairs,) containing the indices of the pairs to keep. |
Source code in lahuta/core/neighbor_finder.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|