We describe a set of techniques for performing large scale ab initio calculations using multigrid accelerations and a real-space grid as a basis. The multigrid methods provide effective convergence acceleration and preconditioning on all length scales, thereby permitting efficient calculations for ill-conditioned systems with long length scales or high energy cutoffs. We discuss specific implementations of multigrid and real-space algorithms for electronic structure calculations, including an efficient multigrid-accelerated solver for Kohn-Sham equations, compact yet accurate discretization schemes for the Kohn-Sham and Poisson equations, optimized pseudopotentials for real-space calculations, efficacious computation of ionic forces, and a complex-wave-function implementation for arbitrary sampling of the Brillouin zone. A particular strength of a real-space multigrid approach is its ready adaptability to massively parallel computer architectures, and we present an implementation for the Cray-T3D with essentially linear scaling of the execution time with the number of processors. The method has been applied to a variety of periodic and nonperiodic systems, including disordered Si, a N impurity in diamond, AlN in the wurtzite structure, and bulk Al. The high accuracy of the atomic forces allows for large step molecular dynamics; e.g., in a 1-ps simulation of Si at 1100 K with an ionic step of 80 a.u., the total energy was conserved within 27 \ensuremath{\mu}eV per atom. \textcopyright{} 1996 The American Physical Society.