We present a flexible and efficient framework for multiscale modeling in computational chemistry (MiMiC). It is based on a multiple-program multiple-data (MPMD) model with loosely coupled programs. Fast data exchange between programs is achieved through the use of MPI intercommunicators. This allows exploiting the existing parallelization strategies used by the coupled programs while maintaining a high degree of flexibility. MiMiC has been used in a new electrostatic embedding quantum mechanics/molecular mechanics (QM/MM) implementation coupling the highly efficient CPMD and GROMACS programs but it can also be extended to use other programs. The framework can also be utilized to extend the partitioning of the system into several domains that can be treated using different models, such as models based on wavefunction or density functional theory as well as coarse-graining and continuum models. The new QM/MM implementation treats long-range electrostatic QM-MM interactions through the multipoles of the QM subsystem which substantially reduces the computational cost without loss of accuracy compared to an exact treatment. This enables QM/MM molecular dynamics (MD) simulations of very large systems.