pestifer.util.linkcell module¶
Custom link-cell algorithm for pair-wise searches in 3D space
The Linkcell object is used by the RingCheck algorithm to detect pierced rings
- class pestifer.util.linkcell.Linkcell(corners: ndarray = array([[0., 0., 0.], [100., 100., 100.]]), cutoff: float = 10.0, atidxlabel: str = 'serial', atposlabel: list[str] = ['x', 'y', 'z'])[source]¶
Bases:
objectA class for implementing the link-cell algorithm for pairwise distance calculations in 3D space.
- Parameters:
corners (np.ndarray, optional) – A 2x3 array defining the lower left and upper right corners of the simulation box in Angstroms. Default is a box from (0,0,0) to (100,100,100).
cutoff (float, optional) – The cutoff distance for the link-cell algorithm in Angstroms. Default is 10.0.
atidxlabel (str, optional) – The label for the atom index in the link-cell structure. Default is ‘serial’.
atposlabel (list, optional) – A list of labels for the atom positions in the link-cell structure. Default is [‘x’, ‘y’, ‘z’].
- cellndx_of_ldx(i: int)[source]¶
Returns (i,j,k)-index of cell with scalar index i
- Parameters:
i (int) – The scalar index of the cell.
- Returns:
A 3-element array representing the (i,j,k) index of the cell with scalar index i.
- Return type:
np.ndarray
- cellndx_of_point(R: ndarray)[source]¶
Returns the (i,j,k) cell index of point R
- Parameters:
R (np.ndarray) – A 3-element array representing the coordinates of the point.
- Returns:
A 3-element array representing the (i,j,k) index of the cell containing the point R.
- Return type:
np.ndarray
- ldx_of_cellndx(C: ndarray)[source]¶
Returns scalar index of cell with (i,j,k)-index C
- Parameters:
C (np.ndarray) – A 3-element array representing the (i,j,k) index of the cell
- Returns:
The scalar index of the cell with (i,j,k)-index C.
- Return type:
- ldx_searchlist_of_ldx(i: int)[source]¶
Returns the list of cells to search around and including central cell i.
- Parameters:
i (int) – The scalar index of the central cell.
- wrap_point(ri: ndarray)[source]¶
Wraps point ri into the base periodic image
- Parameters:
ri (np.ndarray) – A 3-element array representing the coordinates of the point to be wrapped.
- Returns:
A tuple containing:
R: The wrapped coordinates of the point.box_lengths: An array indicating how many times the point was wrapped in each dimension.
- Return type: