It is very challenging to simulate electron-transfer reactions under potential control within high-level electronic structure theory, e. g. to study electrochemical and electrocatalytic reaction mechanisms. We develop a novel method to sample the canonical NVTΦ or NpTΦ ensemble at constant electrode potential in ab initio molecular dynamics…