def pbc_all_distances(lattice, fcoords1, fcoords2):
    """
    Returns the distances between two lists of coordinates taking into
    account periodic boundary conditions and the lattice. Note that this
    computes an MxN array of distances (i.e. the distance between each
    point in fcoords1 and every coordinate in fcoords2). This is
    different functionality from pbc_diff.

    Args:
        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]]. It can be a single
            coord or any array of coords.
        fcoords2: Second set of fractional coordinates.

    Returns:
        2d array of cartesian distances. E.g the distance between
        fcoords1[i] and fcoords2[j] is distances[i,j]
    """
    return lattice.get_all_distances(fcoords1, fcoords2)