The R matrix of Wigner and Eisenbud has been widely used in nuclear scattering theory and in the theory of electron scattering by atoms and molecules. To consider problems in solid-state or surface physics, where atoms are in complex environments, this theory must be put into a form that is valid for volumes enclosed by surfaces of arbitrary shape. A variational principle for an? operator in general geometry is derived. This operator relates function values to normal derivatives on a surface of a closed volume inside which the function satisfies Schrödinger's equation. Using a spherically averaged potential function, the? operator for a Wigner-Seitz atomic cell can be computed from solutions of the local radial Schrödinger equation. Formulas that eliminate a common interface between adjacent cells are derived. With these methods, calculations carried out in modular subcells can be extended to larger structures. For regular solids, it is shown that periodic boundary conditions applied to functions and normal derivatives at the surface of a translational unit cell lead to a secular determinant expressed in terms of the? operator for the unit cell, whose zeros determine energy-band structure. © 1984 The American Physical Society.