def optimise_xy(xy, *args):
    """Return negative pore diameter for x and y coordinates optimisation."""
    z, elements, coordinates = args
    window_com = np.array([xy[0], xy[1], z])
    return -pore_diameter(elements, coordinates, com=window_com)[0]
Return negative pore diameter for x and y coordinates optimisation.