How to retrieve the amount of vacuum in a unit cell?

Consider the atoms object created using the following command.
atoms = ase.build.fcc111('Al', size=(1,2,2), vacuum=18, orthogonal=True)
How can I retrieve the vacuum amount (18 in this case) from the atoms object?

Hi pxb,

This should do the trick:

scaled_c_coords = atoms.get_scaled_positions()[:,2]
scaled_slab_width = max(scaled_c_coords) - min(scaled_c_coords)
vacuum_width = (1 - scaled_slab_width) * atoms.cell.lengths()[2]
print(vacuum_width/2)

Best,
Peter