  We compute the thermal conductivity of water within linear response theory
from equilibrium molecular dynamics simulations, by adopting two different
approaches. In one, the potential energy surface (PES) is derived on the fly
from the electronic ground state of density functional theory (DFT) and the
corresponding analytical expression is used for the energy flux. In the other,
the PES is represented by a deep neural network (DNN) trained on DFT data,
whereby the PES has an explicit local decomposition and the energy flux takes a
particularly simple expression. By virtue of a gauge invariance principle,
established by Marcolongo, Umari, and Baroni, the two approaches should be
equivalent if the PES were reproduced accurately by the DNN model. We test this
hypothesis by calculating the thermal conductivity, at the GGA (PBE) level of
theory, using the direct formulation and its DNN proxy, finding that both
approaches yield the same conductivity, in excess of the experimental value by
approximately 60%. Besides being numerically much more efficient than its
direct DFT counterpart, the DNN scheme has the advantage of being easily
applicable to more sophisticated DFT approximations, such as meta-GGA and
hybrid functionals, for which it would be hard to derive analytically the
expression of the energy flux. We find in this way, that a DNN model, trained
on meta-GGA (SCAN) data, reduce the deviation from experiment of the predicted
thermal conductivity by about 50%, leaving the question open as to whether the
residual error is due to deficiencies of the functional, to a neglect of
nuclear quantum effects in the atomic dynamics, or, likely, to a combination of
the two.
