# pymatgen.util.coord_cython module

Utilities for manipulating coordinates or list of coordinates, under periodic boundary conditions or otherwise.

coord_list_mapping_pbc()[source]

Gives the index mapping from a subset to a superset. Superset cannot contain duplicate matching rows

Parameters:
• subset – List of frac_coords

• superset – List of frac_coords

• pbc – a tuple defining the periodic boundary conditions along the three axis of the lattice.

Returns:

list of indices such that superset[indices] = subset

is_coord_subset_pbc()[source]

Tests if all fractional coords in subset are contained in superset. Allows specification of a mask determining pairs that are not allowed to match to each other

Parameters:
• subset – List of fractional coords

• superset – List of fractional coords

• pbc – a tuple defining the periodic boundary conditions along the three axis of the lattice.

Returns:

True if all of subset is in superset.

pbc_shortest_vectors()[source]

Returns the shortest vectors between two lists of coordinates taking into account periodic boundary conditions and the lattice.

Parameters:
• lattice – lattice to use

• fcoords1 – First set of fractional coordinates. e.g., [0.5, 0.6, 0.7] or [[1.1, 1.2, 4.3], [0.5, 0.6, 0.7]]. Must be np.float_

• fcoords2 – Second set of fractional coordinates.

• mask (int_ array) – Mask of matches that are not allowed. i.e. if mask[1,2] == True, then subset cannot be matched to superset

• lll_frac_tol (float_ array of length 3) – Fractional tolerance (per LLL lattice vector) over which the calculation of minimum vectors will be skipped. Can speed up calculation considerably for large structures.

Returns:

array of displacement vectors from fcoords1 to fcoords2 first index is fcoords1 index, second is fcoords2 index