How surface bonding and repulsive interactions cause phase transformations: ordering of a prototype macrocyclic compound on Ag(111).