A new implementation of frozen-density embedding (FDE) in the Amsterdam Density Functional (ADF) program package is presented. FDE is based on a subsystem formulation of density-functional theory (DFT), in which a large system is assembled from an arbitrary number of subsystems, which are coupled by an effective embedding potential. The new implementation allows both an optimization of all subsystems as a linear-scaling alternative to a conventional DFT treatment, the calculation of one active fragment in the presence of a frozen environment, and intermediate setups, in which individual subsystems are fully optimized, partially optimized, or completely frozen. It is shown how this flexible setup can facilitate the application of FDE in multilevel simulations. © 2007 Wiley Periodicals, Inc.