Molecular simulation of intermolecular attraction and repulsion in coexisting liquid and vapour phases