Electronic structure calculations for plane-wave codes without diagonalization