  A general real-space multigrid algorithm MIKA (Multigrid Instead of the
K-spAce) for the self-consistent solution of the Kohn-Sham equations appearing
in the state-of-the-art electronic-structure calculations is described. The
most important part of the method is the multigrid solver for the Schr\"odinger
equation. Our choice is the Rayleigh quotient multigrid method (RQMG), which
applies directly to the minimization of the Rayleigh quotient on the finest
level. Very coarse correction grids can be used, because there is in principle
no need to represent the states on the coarse levels. The RQMG method is
generalized for the simultaneous solution of all the states of the system using
a penalty functional to keep the states orthogonal. Special care has been taken
to optimize the iterations towards the self-consistency and to run the code in
parallel computer architectures. The scheme has been implemented in multiple
geometries. We show examples from electronic structure calculations employing
nonlocal pseudopotentials and/or the jellium model. The RQMG solver is also
applied for the calculation of positron states in solids.
