1- """These functions find neighbours .
1+ """These functions find neighbors .
22
3- There are different functions for different types of neighbour searching.
3+ There are different functions for different types of neighbor searching.
44Currently RAD is the default with grid as an alternative.
55"""
66
1010
1111class Search :
1212 """
13- Class for functions to find neighbours .
13+ Class for functions to find neighbors .
1414 """
1515
1616 def __init__ (self ):
@@ -20,6 +20,7 @@ def __init__(self):
2020 """
2121
2222 self ._universe = None
23+ self ._mol_id = None
2324
2425 def get_RAD_neighbors (self , universe , mol_id ):
2526 """
@@ -51,29 +52,29 @@ def get_RAD_neighbors(self, universe, mol_id):
5152
5253 # Get indices of neighbors
5354 neighbor_indices = self ._get_RAD_indices (
54- central_position , sorted_dist , universe
55+ central_position , sorted_dist , universe , number_molecules
5556 )
5657
5758 return neighbor_indices
5859
59- def _get_RAD_indices (self , i_coords , sorted_distances , system ):
60+ def _get_RAD_indices (self , i_coords , sorted_distances , system , number_molecules ):
6061 # pylint: disable=too-many-locals
6162 r"""
6263 For a given set of atom coordinates, find its RAD shell from the distance
6364 sorted list, truncated to the closest 30 molecules.
6465
6566 This function calculates coordination shells using RAD the relative
6667 angular distance, as defined first in DOI:10.1063/1.4961439
67- where molecules are defined as neighbours if
68+ where molecules are defined as neighbors if
6869 they fulfil the following condition:
6970
7071 .. math::
7172 \Bigg(\frac{1}{r_{ij}}\Bigg)^2 >
7273 \Bigg(\frac{1}{r_{ik}}\Bigg)^2 \cos \theta_{jik}
7374
74- For a given particle :math:`i`, neighbour :math:`j` is in its coordination
75+ For a given particle :math:`i`, neighbor :math:`j` is in its coordination
7576 shell if :math:`k` is not blocking particle :math:`j`. In this implementation
76- of RAD, we enforce symmetry, whereby neighbouring particles must be in each
77+ of RAD, we enforce symmetry, whereby neighboring particles must be in each
7778 others coordination shells.
7879
7980 Args:
@@ -84,17 +85,18 @@ def _get_RAD_indices(self, i_coords, sorted_distances, system):
8485 Returns:
8586 shell: list of indices of particles in the RAD shell of neighbors.
8687 """
87- # 1. truncate neighbour list to closest 30 united atoms
88+ # 1. truncate neighbor list to closest 30 united atoms and iterate
89+ # through neighbors from closest to furthest/
8890 shell = []
8991 count = - 1
90- # 2. iterate through neighbours from closest to furthest
91- for y in range (30 ):
92+ limit = min ( number_molecules - 1 , 30 )
93+ for y in range (limit ):
9294 count += 1
9395 j_idx = sorted_distances [y ][0 ]
9496 j_coords = system .atoms .fragments [j_idx ].center_of_mass ()
9597 r_ij = sorted_distances [y ][1 ]
9698 blocked = False
97- # 3. iterate through neighbours other than atom j and check if they block
99+ # 3. iterate through neighbors other than atom j and check if they block
98100 # it from molecule i
99101 for z in range (count ): # only closer units can block
100102 k_idx = sorted_distances [z ][0 ]
0 commit comments