  Reactions involving adsorbates on metallic surfaces and impurities in bulk
metals are ubiquitous in a wide range of technological applications. The
theoretical modelling of such reactions presents a formidable challenge for
theory because nuclear quantum effects (NQEs) can play a prominent role and the
coupling of the atomic motion with the electrons in the metal gives rise to
important non-adiabatic effects (NAEs) that alter atomic dynamics. In this
work, we derive a theoretical framework that captures both NQEs and NAEs and,
due to its high efficiency, can be applied to first-principles calculations of
reaction rates in high-dimensional realistic systems. In more detail, we
develop a method that we coin ring polymer instanton with explicit friction
(RPI-EF), starting from the ring-polymer instanton formalism applied to a
system-bath model. We derive general equations that incorporate the spatial and
frequency dependence of the friction tensor, and then combine this method with
the \textit{ab initio} electronic friction formalism for the calculation of
thermal reaction rates. We show that the connection between RPI-EF and the form
of the electronic friction tensor presented in this work does not require any
further approximations, and it is expected to be valid as long as the
approximations of both underlying theories remain valid.
