An algorithm for generating optimal nonuniform grids for solving the two-body
Schr\"odinger equation is developed and implemented. The shape of the grid is
optimized to accurately reproduce the low-energy part of the spectrum of the
Schr\"odinger operator. Grids constructed this way are applicable to more
complex few-body systems where the number of grid points is a critical
limitation to numerical accuracy. The utility of the grid generation for
improving few-body calculations is illustrated through an application to bound
states of He trimers