The plane-wave method for electronic-structure calculations is reformulated using generalized curvilinear coordinates. The search for the solutions of the Schrödinger equation is then cast into an optimization problem in which both the plane-wave expansion coefficients and the coordinate system (or the Riemannian metric tensor) are treated as variational parameters. This allows the effective plane-wave energy cut-off to vary in the unit cell in an unbiased way. The method is tested in the calculation of the lowest bound state of an «atom» represented by a Gaussian potential well, showing that the relaxation of the metric dramatically improves the convergence of the plane-wave expansion of the solutions. © 1992 IOP Publishing Ltd.