<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def optimise_z(z, *args):
 """Return pore diameter for coordinates optimisation in z direction."""

    x, y, elements, coordinates = args
    window_com = np.array([x, y, z])
    return pore_diameter(elements, coordinates, com=window_com)[0]