van der Waals theory of melting in two and three dimensions