In Eq. ( ), P is the density matrix with elements P µν , Z I labels the I-th QM nuclear charge and T I is the corresponding generalized external field on MM atoms, and R f ext represents the generalized field on each MM atom at position (R jx , R jy , R jz ):