amep.pbc.mirror_points#
- amep.pbc.mirror_points(coords: ndarray, box_boundary: ndarray, width: float | None = None, thickness: float | None = None, index: bool = False, inclusive: bool = True, verbose: bool = False, fold: bool = False, enforce_nd: int | None = None) ndarray #
Returns the points and their first periodic mirrors. This function is used for Voronoi tessellations without periodic boundary conditions. The dimension (2d or 3d) is guessed from the shape and values of the supplied coordinates.
- Parameters:
coordinates (np.ndarray) – coordinate frame (Nx3 array of floats; required)
box_boundary (np.ndarray) – Boundaries of the simulation box given in the form np.array([[xmin, xmax], [ymin, ymax], [zmin, zmax]]).
width (float or None) – Width of the periodic images relative to the box dimensions. None means the original and all periodic images are returned; positive means points are cutoff at box*(1+width); negative values mean that less than the box is returned. At most one periodic image in each direction is returned. This keyword is preferred before thickness. (default=None)
thickness (float or None) – Absolute width of the periodic images in each direction. None means the original and all periodic images are returned; positive means points are cutoff at box+thickness; negative values mean that less than the box is returned. If width is supplied, this keyword is ignored. (default=None)
index (boolean) – if true, also the indices with indices of images being their original values are returned (default=False)
inclusive (boolean) – if false only the images are returned (defautl=True)
fold (boolean) – if true points in coordinates are fold back into the box (default=False)
verbose (bool, optional) – If True, runtime information is printed. The default is False.
enforce_nd (int, None, optional) – enforces the number of dimensions. 2 for 2d, 3 for 3d. If None is supplied, a best guess is used by checking if all particles have the same dimension in the last coordinate. See utils.dimension()
- Returns:
array of all coordinates (including periodic images;
array of floats)
Examples
>>> import amep >>> traj = amep.load.traj("../examples/data/lammps.h5amep") >>> frame = traj[-1] >>> images = amep.pbc.mirror_points( ... frame.coords(), frame.box, inclusive=False ... ) >>> perm_vectors = np.array([ ... [-1, -1, 0], ... [-1, 0, 0], ... [-1, 1, 0], ... [ 0, -1, 0], ... [ 0, 1, 0], ... [ 1, -1, 0], ... [ 1, 0, 0], ... [ 1, 1, 0] ... ]).astype(float) >>> fig, axs = amep.plot.new(figsize=(3,3)) >>> amep.plot.particles( ... axs, images, frame.box, 0.5, color="tab:blue", ... set_ax_limits=False ... ) >>> amep.plot.particles( ... axs, frame.coords(), frame.box, 0.5, color="tab:orange", ... set_ax_limits=False ... ) >>> amep.plot.box(axs, frame.box, color='k', linewidth=2) >>> for p in perm_vectors: ... shift = p*(frame.box[:,1]-frame.box[:,0]) ... amep.plot.box( ... axs, frame.box+shift[:,None], color='k', ... linewidth=1, linestyle='--' ... ) >>> axs.set_xlabel(r'$x$') >>> axs.set_ylabel(r'$y$') >>> fig.savefig('./figures/pbc/pbc-mirror_points.png') >>>