The current-perpendicular-to-plane (CPP) magnetotransport of a metallic sam
ple sandwiched by two ideal leads is described at an ab initio level. The s
o-called "active" part of the system is either a trilayer consisting of two
magnetic slabs of finite thickness separated by a nonmagnetic spacer or a
multilayer formed by alternating magnetic and nonmagnetic layers. We use a
transmission matrix formulation of the conductance based on surface Green's
functions as formulated by means of the tight-binding linear muffin-tin or
bital method. The formalism is extended to the case of lateral supercells w
ith random arrangements of atoms of two types, which in turn allows to deal
with specular and diffusive scattering on equal footing, and which is appl
icable also to the case of noncollinear alignments of the magnetization in
the layers. Applications refer to fee-based Co/Cu/Co(001) trilayers and mul
tilayers, considering in detail the effect of substitutional alloying in th
e spacer and in the magnetic layers, as well as interdiffusion at the inter
faces.