In order to obtain the electronic density of the QM subsystem, we also need to add the potential induced by MM atoms to the external KS potential. The potential is obtained as the functional derivative of the electrostatic QM-MM interaction energy (eq 1) with respect to the electronic density which yields