We derive and implement the necessary equations for solving
a dynamically
weighted, state-averaged constrained CASSCF(2,2) wave function describing
a molecule on a metal surface, where we constrain the overlap between
two active orbitals and the impurity atomic orbitals to be a finite
number. We show that a partial constraint is far more robust than
a full constraint. We further calculate the system-bath electronic
couplings that arise because, near a metal, there is a continuum (rather
than discrete) number of electronic states. This approach should be
very useful for simulating heterogeneous electron transfer and electrochemical
dynamics going forward.