## Abstract

We report on an extensive study of the viscosity of liquid water at near-ambient conditions, performed within the Green-Kubo theory of linear response and equilibrium ab initio molecular dynamics (AIMD), based on density-functional theory (DFT). In order to cope with the long simulation times necessary to achieve an acceptable statistical accuracy, our ab initio *approach* is enhanced with deep-neural-network potentials (NNP). This approach is first validated against AIMD results, obtained by using the Perdew–Burke–Ernzerhof (PBE) exchange-correlation functional and paying careful attention to crucial, yet often overlooked, aspects of the statistical data analysis. Then, we train a second NNP to a dataset generated from the Strongly Constrained and Appropriately Normed (SCAN) functional. Once the error resulting from the imperfect prediction of the melting line is offset by referring the simulated temperature to the theoretical melting one, our SCAN predictions of the shear viscosity of water are in very good agreement with experiments.

## Introduction

Shear viscosity is one of the most important transport properties governing the macroscopic flow of liquids. As such, it plays a fundamental role in various fields of science and technology, such as, e.g., chemical and mechanical engineering or earth and planetary sciences, to name but a few. For instance, the viscosity of a solvent crucially affects the dynamics of solutes and the reactions rates, of fundamental importance in the study of biological processes and chemical reactions^{1,2,3}. The value of the viscosity of liquid iron, abundant in Earth’s outer core, is key in the prediction of the magnetic field of rocky planets^{4,5}. An accurate determination of the temperature and pressure profile of the viscosity is also essential for the correct modeling of tidal interactions in the planets’ interior, in particular in the presence of icy layers^{6,7}.

In this work, we focus on water, an ubiquitous molecular liquid with extraordinary and complex properties^{8,9,10,11,12,13}. In spite of the great importance of this system and the large number of studies based on density-functional theory (DFT) and ab initio molecular dynamics (AIMD) devoted to it^{14,15,16,17,18,19,20,21,22}, all of these efforts have, until very recently^{23}, dodged its viscous properties, because *an accurate computation of the viscosity of water would require exceedingly long first-principles simulations*^{20}. A number of studies based on classical force fields exists^{24,25,26,27}, but the poor transferability of these models sets a limit to their predictive power. An attempt to estimate the viscosity of water from first principles was made with an indirect approach relying on the Stokes–Einstein relation^{22}, which, however, does not hold over all the phase diagram for liquid water, particularly in the supercooled regime^{28,29,30}.

A rigorous microscopic description of the shear viscosity of liquids, *η*, is provided by the Green–Kubo (GK) theory of linear response^{31,32,33,34}, according to which its value is proportional to the integral of the time auto-correlation function (tACF) of the off-diagonal matrix elements of the stress tensor. This integral can be estimated from the time series of the stress, generated by an equilibrium molecular-dynamics simulation of the system of interest. A number of different procedures have been developed to cope with the evaluation of the GK integral^{35,36}. Here, we adopt a spectral approach, recently proposed by Ercole et al.^{37,38,39,40}, which allows one to compute transport coefficients, along with the statistical errors affecting them, from shorter trajectories than previously thought to be necessary. This progress notwithstanding, the estimate of transport coefficients from AIMD may require generating trajectories of a few hundred picoseconds for systems as large as a few hundred atoms. It is evident that, although technically quite possible, AIMD simulations of this size do not lend themselves to an easy estimate of the statistical accuracy of the results, let alone a systematic exploration of a broad region of the phase diagram of a material.

The last decade has seen the rise of machine-trained potentials, as represented by either deep-neural networks^{41,42,43,44} or by Gaussian processes^{45}, as powerful tools for atomistic simulations. These potentials are able to deliver a nearly quantum mechanical accuracy at a cost that is only marginally higher than that of classical force fields. This opens the way to extend the scope of AIMD simulations to the size range necessary for the computation of reliable transport coefficient such as the viscosity. In the present work, we adopt the recently developed *Deep Potential* framework^{43,46,47} to study the shear viscosity of liquid water. Deep potential molecular dynamics (DPMD) simulations have already been proved to successfully predict bulk thermodynamic properties beyond the reach of direct DFT calculations^{13,48,49,50,51,52}, as well as dynamic properties like mass diffusion in solid state electrolytes^{53,54}, their interactions with defects^{55}, thermal transport properties in silicon^{56}, infrared spectra of water and ice^{57}, Raman spectra of water^{58} and very recently also the thermal conductivity of liquids such as liquid water^{59}.

So far, a combination of AIMD, advanced data analysis, and neural-network techniques has only been applied to thermal and charge transport^{39,40,55,59,60,61}. In this work, we attempt to apply them to the computation of viscosity. In this study, we report on calculations, from both direct DFT and DPMD simulations, of the shear viscosity of water. We show that *η* can be obtained with trajectories of ≈400 ps, which are still quite demanding for an extensive ab initio study over a broad portion of the phase diagram. We thus take advantage of the DPMD technique and perform extensive simulation employing a deep-neural-network potential (NNP) trained on extensive DFT data. Our methodology proceeds in two steps. In the first, we train a NNP on Perdew–Burke–Ernzerhof (PBE)^{62} data and validate our procedure against results from a rather long (400-ps) AIMD trajectory. We then adopt the *strongly constrained and appropriately normed* (SCAN) meta-GGA exchange-correlation (XC) functional^{63,64}, which provides a much more accurate description of the H-bond network in water^{19}, to perform extensive simulations of the viscous properties of water just above melting. Close to melting, the viscosity depends very sensitively on temperature. Once the error resulting from the imperfect prediction of the melting line is offset by referring the simulated temperature to the theoretical melting one, our SCAN predictions of the shear viscosity of water in a temperature range extending above the melting line are in very good agreement with experiment.

Our paper is organized as follows. “Results” contains all the discussion of the results: in “Ab initio molecular dynamics” we present the results of our direct PBE-AIMD simulations and draw some conclusions on the simulation time and length scales necessary to achieve an acceptable statistical accuracy; in “PBE NNP” we benchmark our NNP against ab initio MD simulations of liquid water at the PBE level of theory; in “Statistical analysis and finite-size scaling“ we expand our analysis on the statistical properties of our estimator of the shear viscosity and briefly discuss its size-dependency. Once our methodology is set up and validated, in “SCAN NNP” we report on an extensive set of simulations performed with a NNP model trained on SCAN meta-GGA DFT data and we compare their results with available experimental data and our PBE-NNP results. We show that SCAN meta-GGA reduces the deviation from experiments of the predicted shear viscosity. “Discussion” contains our final discussion with some interesting perspectives and further applications of our work. In “Methods”, we recall the main theoretical and numerical methods used throughout the work: the main aspects of the GK theory of transport; its application to viscosity; the main data-analysis technique; and briefly describe the neural-network model.

## Results

### Ab initio molecular dynamics

We performed AIMD simulations of liquid water at near-ambient conditions using the PBE^{62} XC functional, the plane-wave pseudopotential method, Hamann–Schluter–Chiang–Vanderbilt norm-conserving pseudopotentials^{65}, and a kinetic-energy cutoff of 85 Ry. The simulated system was made of 64 molecules at the standard density of 1 gr cm^{−3}, corresponding to a cubic box of edge *l* = 12.43 Å. All the simulations were carried out with the Car-Parrinello extended-Langrangian method^{66} using the cp.x component of the QUANTUM ESPRESSO™ distribution^{67,68,69} and setting the fictitious electronic mass to 25 physical masses and the timestep to dt = 0.073 fs. We performed two simulations aiming at thermodynamic conditions near ambient temperature and somewhat above it. As PBE is known to enhance the short-range structure of water and to overestimate the melting temperature by ≈ 140 K^{70,71}, we set the target temperatures of the two simulations to 450 and 600 K, respectively. Both trajectories were first equilibrated in the NVT ensemble using a Nosè-Hoover thermostat^{72} at the target temperature, followed by long production NVE runs of 400-ps. Finally, the shear viscosity was obtained from the cepstral analysis of the power spectrum of the off-diagonal elements of the stress, using the SporTran^{73} code.

In Fig. 1, we display the (moving averages^{74} of the) power spectra of the stress-tensor time series resulting from our two simulations. While showing similar features at high frequency, the two spectra differ substantially approaching *ω* = 0. In particular, lower temperatures see the appearance of sharp peaks near *ω* = 0, which requires a greater care in the cepstral analysis of the data, which is based on a low-pass filter of the (logarithm of) the power spectra. In the inset, we display the low-frequency region of the spectra together with the results carried out by the cepstral analysis, i.e., by applying a low-pass filter to the logarithm of the raw spectra. The filtered spectra are represented by thick solid lines whose zero-frequency value is a fair and accurate estimate of the shear viscosity we are after:

where the unit cP stays for *centipoise*, 1 cP = 10^{−3} Pa⋅s. It is often assumed that the predictions of ab initio simulations should be compared with experiments upon shifting the simulated temperature by the offset between the theoretical and experimental melting temperatures, which, in the case of PBE, amounts to *T*_{m}(PBE) − *T*_{m}(expt) ≈ 140 K^{71}. We thus compare our value predicted by PBE at *T* = 454 K with the experimental value measured at *T* = 313 ≈ 454−140 K, *η*^{expt}(*T* = 313 K) = 0.653 cP. The agreement is fair, on account of both the uncertainties related to the empirical temperature shift and the very sensitive dependence of the viscosity upon temperature near melting. More on the meaning of the residual disagreement will be discussed in “SCAN NNP”.

In Fig. 2, we display how the prediction of the shear viscosity in water depends on the length of the simulation. In order to highlight the impact of possibly long relaxation times on the estimate of the transport coefficient, we have split our 400-ps trajectories into segments of 100, 200, and 300-ps (in the latter case the two segments were overlapping). The estimates from different segments coincide with the statistical errors evaluated within each of them at 600 K, but not quite so at 454 K. This can be ascribed to the emergence of a narrow peak in the stress power spectrum at *ω* = 0 (see Fig. 1), related to an increase of the stress correlation time occurring as the freezing temperature is approached. A similar behavior had been already observed by Ercole et al.^{37} in the case of heat transport in strongly harmonic crystals. All these considerations suggest that near freezing the computation of the shear viscosity requires longer simulation runs, and even longer runs would be required for a fair evaluation of the statistical uncertainties, indicating that AIMD may not be the most efficient approach to explore a broad range of thermodynamic conditions. In the following we show that neural-network models of inter-atomic interactions trained on ab initio data provide a valid alternative to direct AIMD simulations, yielding results of similar quality at a much lower computational cost.

### PBE NNP

In order to appraise the ability of NNP to accurately predict shear viscosity, we have generated one such model, by training it on a set of PBE-DFT data. The training dataset is prepared via a recently proposed “on-the-fly” learning procedure called Deep Potential Generator (DP-GEN)^{75,76} and it consists of the energies and atomic forces of 4000 configurations of water generated by the DP-GEN from NPT MD trajectories at different temperatures in the [300–700 K] range and for pressures up to 50 kbar. The PBE-NNP is then constructed and trained with the DeePMD-kit. The cutoff radius is set to 6 Å. The size of the embedding and fitting nets is (50, 50, 50) and (250, 250, 250), respectively. The model was trained by minimizing the standard loss function, \({{{\mathcal{L}}}}\), presented in Eq. (8) of “Methods” with 2 million steps of Adam stochastic gradient descent^{77}. We tried to include the values of the virial in the definition of the loss function, but we found no improvement with respect to the standard definition of Eq. (8), and thus decided not to modify it.

Figure 3 shows a scatter plot of the NNP predictions for atomic forces and stress vs. PBE-DFT data, evaluated over a set of 10,000 configurations, not included in the training dataset. The average error on the forces and on the off-diagonal elements of the virial are *σ*_{F} = 40 meV Å^{−1} and *σ*_{Ξ} = 1.4 meV/atom, respectively, corresponding to correlation coefficients^{78} of 0.998 and 0.995, respectively.

In order to validate our neural-network methodology for the prediction of the shear viscosity, we performed DPMD simulations in the NVE ensemble for the same model of liquid water described above. Simulations of 20-ns were run at two different temperatures, 454 K and 600 K, using our NNP trained to PBE water. All simulations were carried out using the LAMMPS code^{79} interfaced with DeepMD-kit. In Fig. 4 we display the results obtained by analyzing independently each one of the about 50 400-ps segments in which we have partitioned the whole 20-ns trajectory. The shear viscosity of each segment is obtained again by cepstral analysis using the SporTran code and is represented by solid dots together with its estimated statistical error. The blue and orange regions represent respectively the estimate of the shear viscosity given in “Ab initio molecular dynamics” from ab initio MD simulations at 454 K and 600 K. We observe a very good agreement between the two approaches and conclude therefore that our NNP is capable of predicting correctly the shear viscosity of water at the given pT conditions. Also, notice the close agreement between the standard deviation of the viscosity estimated by cepstral analysis on individual 400-ps trajectory segments and the value computed over a sample of about 50 segments. More on the statistical analysis and significance of our data in “Statistical analysis and finite-size scaling”.

In Table 1 we report our results for the viscosity of water computed at two different temperatures with DPMD and NNP trained on PBE-DFT data, obtained from very long (20-ns) trajectories, and compare them with the AIMD data of “Ab initio molecular dynamics”.

### Statistical analysis and finite-size scaling

We are now ready to investigate the statistical behavior of the shear viscosity for different simulation lengths. To this end, we sliced our 20-ns simulations in segments of smaller lengths (100-, 200-, and 400-ps) and analyzed them independently. Before proceeding, we remind the pivotal tenet of cepstral analysis: if a sample of a stationary stochastic process is longer than all the relevant time scales of the process, then the sample spectrum (i.e., the squared modulus of the Fourier transform of the series) equals the theoretical power spectrum of the process, times a set of identically distributed *χ*^{2} stochastic variables that are independent of each other for different frequencies. This implies that the low-pass-filtered logarithm of the sample spectrum is normally distributed at any (sufficiently low) frequency^{37} and that the estimator of the transport coefficient—which is proportional to the *ω* = 0 value of the filtered spectrum—is, therefore, a log-normal variate. In order to check the reliability of the cepstral estimate of the viscosity from trajectories of different lengths, in Fig. 5 we display the distributions of the logarithm of these estimates from trajectory segments of different length (100-, 200-, and 400-ps) and report the p-values of the Shapiro-Wilk (SW) normality test^{80} for each distribution. We observe that: i) at *T* ≈ 450 K the WS test is failed for segments shorter than 400-ps, indicating the subsistence of slow stress fluctuations that adversely affect our data analysis technique ; ii) at *T* = 600 K the WS is never failed with respect to a standard significance level *α* = 0.05; even for the shortest segment length (100 ps), for which we compute a *p* value of 0.07 over a sample of 200 segments \(\log (\eta )\); iii) the width of the distributions of the viscosity estimated at different lengths is slightly larger than the standard deviation estimated within each segment by cepstral analysis; iv) this difference decreases as the length of the segments increases, until it roughly vanishes at 400-ps; v) this difference also decreases by increasing the temperature. This observation is made more quantitative in Fig. 6, which shows the correlation between the standard deviations of the cepstral estimates of the viscosity from trajectories of different lengths and temperatures, vs. the spread of the distribution of their values resulting from different trajectories. The former quantity is itself affected by a statistical uncertainty because cepstral analysis returns different standard deviations for different trajectories of the same length. Figure 6 indicates that as the system approaches freezing from above and the viscosity increases, the low-frequency components of the virial fluctuations become increasingly important, and simulations of increasing length become necessary to cope with them. This is confirmed in Fig. 7 that displays the low-frequency portion of the power spectrum of the off-diagonal elements of the stress in water at different temperatures, and shows that as the system approaches freezing from above, a narrow peak develops at *ω* = 0, as a consequence of the onset of long-lived relaxation modes. In the present case, it appears that at 450 K trajectories as long as 400-ps are needed to get a reliable estimate of the statistical error affecting the estimate of the PBE-DFT viscosity. More generally, it seems that the flexibility offered by NNP and the long simulations they can afford are instrumental not only in exploring broad regions of the phase diagram of a material, but also in providing a reliable estimate of the statistical accuracy of individual simulations.

Finite-size effects may affect the transport properties calculated in numerical simulations^{81,82}. In order to quantify these effects in the present case, we run up to 5-ns long NVE simulations at 454 K and 600 K of PBE-NNP water at fixed density and increasingly larger cells (with up to 4096 molecules). The results, reported in Table 2, indicate that *η* shows no evident size dependence within the error bars of our simulations.

### SCAN NNP

The SCAN meta-GGA XC functional has demonstrated the ability to predict well several properties of water over a broad range of thermodynamic conditions, whose exploration was made possible by NNP techniques^{13,19,20,48,83}. A combination of AIMD and NNP techniques, based on the SCAN XC functional, has recently been successfully applied to the prediction of the heat transport properties of liquid water^{59}. In the following, we report on our extension of this effort to the computation of the shear viscosity.

Accurate DPMD simulations were performed using NNP force fields trained on both PBE and SCAN DFT data^{59} and the same software setup as in “PBE NNP”. Our simulated systems consist of 512 water molecules. With systems of this size, temperature fluctuations are smaller than 1 K. We first perform NVT simulations at the target temperature, followed by NVE production runs, up to 5-ns long. The volume was fixed to the value corresponding to the equilibrium densities evaluated in ref. ^{83} via enhanced-sampling simulations for SCAN, while for PBE it is computed from direct DPMD NPT simulations at ambient pressure, whose results are in agreement with previous calculations^{18,84}.

In Fig. 8 we compare our SCAN-NNP and PBE-NNP results with each other and with experimental data^{85,86}. Results below the melting temperature, *T*_{m}, refer to the undercooled fluid, which becomes increasingly viscous as the temperature decreases. Remarkably, when temperatures are referred to the theoretical melting one, the SCAN predictions for the viscosity are in close agreement with the experiment at melting (and above, as we will discuss shortly). This is not so for PBE. One could argue that PBE yields too low a viscosity as a consequence of the too low equilibrium density (0.77 vs ≈1 gr cm^{−3} at melting). This is not the case, however, because repeating the simulations at the density of 1 gr cm^{−3} (dashed lines) results in only a marginal increase in the predicted viscosity. We conclude that the common wisdom according to which the properties of PBE water would match those of real water at a simulation temperature ≳100 K above the experimental one is likely too simplistic: PBE water not only freezes at too high temperature, but its dynamics is way too fast at melting, as confirmed by the too-high self-diffusivity predicted by PBE, with respect to SCAN and experiment, when all the simulations are performed at the same temperature offset from *T*_{m} as in the experiment. For instance, the self-diffusivity of water predicted by PBE at a temperature *T* = 430 K, which is ≈ 20 K higher than the PBE melting temperature, *T*_{m}(PBE) ≈ 410 K, is 0.45 Å^{2} ps^{−1}^{59}. This is to be compared with a value of 0.19 Å^{2} ps^{−1} predicted by SCAN at 20 K above its own melting temperature (i.e., at 330 ≈ 312 + 20 K,^{19} and practically the same value measured at *T* = 20 ^{∘}*C*, 0.2 Å^{2} ps^{−1}^{87}). In a model where the dependence of the self-diffusivity on temperature was Arrhenius-like, this behavior would be consistent with a too-small pre-exponential factor predicted by PBE relative to SCAN and experiment. Further insight into the dynamics of the water hydrogen-bond network at melting would deserve further investigation.

In Fig. 9 we compare with the experiment the SCAN-NNP predictions for the viscosity of water, on a temperature scale that has been offset by the difference between the predicted melting temperature for the model and the one observed in the experiment, Δ*T* = 312−273 = 39 K. One observes that, while the agreement between theory and experiment is excellent above the melting temperature, SCAN consistently overestimates the viscosity in the undercooled regime. This indicates that the tendency toward dynamical arrest upon undercooling is occurring faster in the model than in the experiment. Interestingly, a crossover between the predicted and observed densities occurs at temperatures near melting: SCAN slightly overestimates the density of water for *T* > *T*_{m}, while it underestimates it in the undercooled regime. We hypothesize that the too large SCAN predictions for the viscosity below freezing may be related to a propensity of SCAN to overestimate the strength of the hydrogen bonds. In turn, this would lead to overestimate low-density (LD) over high-density (HD) fluctuations upon cooling, corresponding to configurations that underlie the structure of amorphous ices and water. At very deep undercooling they may lead to phase separation between an LD and a HD liquid^{13,88,89}. The stronger local structure of LD water with respect to HD water seems compatible with a more marked solid-like behavior^{90,91,92} and, hence, with a larger viscosity.

## Discussion

We conclude with a summary of our results and some interesting perspectives and further applications of our work. In this article, we have performed a systematic ab initio study of the viscosity of liquid water, made possible by a combination of quantum-mechanical first-principles and deep-neural-network techniques. Our study confirms the ability of the SCAN exchange-correlation density functional to predict a broad array of properties of water over a wide range of thermodynamic conditions. Minor shortcomings observed in the undercooled regime are possibly related to the subtle balance between the high- and low-density fluctuations that become more prominent upon undercooling, as one approaches the hypothesized metastable liquid–liquid critical point. These shortcomings might be attenuated by training a neural network on more accurate quantum mechanical data, such as obtained from hybrid functionals^{18,93}, or by using density-corrected DFT^{94}, which adopts a more accurate electron density obtained at the Hartree–Fock level of theory. One of the most successful in describing the property of water is the recently developed DC-SCAN^{95}, which produces remarkably accurate molecular dynamics for liquid water, and a highly realistic self-diffusion coefficient as a function of temperature. Finally, as a technical, but important, side product of our study we have highlighted that a careful analysis of the statistical properties of the stress time series, from which the viscosity can be evaluated through the Green–Kubo theory of linear response, is necessary, and we have provided a detailed report on some mathematical and computational tools that can be deployed to ease this task.

## Methods

The GK theory of linear response^{31,32} provides a rigorous and elegant framework to compute transport coefficients in extended systems, such as the viscosity *η*, in terms of the stationary time series of a macroscopic flux (a *flux*, ** J**, is defined as the macroscopic average of a current density,

**(**

*j***): \({{{\boldsymbol{J}}}}=\frac{1}{V}{\int}_{V}{{{\boldsymbol{j}}}}({{{\boldsymbol{r}}}})d{{{\boldsymbol{r}}}}\), where**

*r**V*is the system’s volume) evaluated at thermal equilibrium with MD. For an isotropic system of

*N*interacting particles, the shear viscosity

*η*is related to the fluctuations of the off-diagonal elements of the stress tensor:

where *V* is the volume of the system, *T* is its temperature, *k*_{B} is the Boltzmann’s constant, *σ*_{s} is any of the three independent off-diagonal elements of the stress tensor, (\({\sigma }_{s}\in \left\{{\sigma }_{xy},{\sigma }_{xz},{\sigma }_{yz}\right\}\)), and **Γ**_{t} indicates the time evolution of a point in phase space from the initial condition **Γ**_{0}. In practice, the value of the integral in Eq. (1) is averaged over the three pairs of Cartesian indices.

### Expression of stress tensor

The thermodynamic stress tensor is the equilibrium average, \(\bar{\sigma }\), of a microscopic estimator, *σ*, defined as:

where *α*, *β* represent Cartesian coordinates, *p*_{iα} is the *α* component of the momentum of the *i*-th atom, *m*_{i} is its mass, while Ξ is the virial term, defined as the derivative of the system’s potential energy, *E*, with respect to an uniform scale transformation of the system (*r*_{α} → *r*_{α} + ∑_{β}*ϵ*_{αβ}*r*_{β}, *ϵ* being the strain tensor):

The expression of the virial term depends on the approach one adopts to perform the simulations: explicit formulas in the classical case are given, e.g., in ref. ^{96}, for pair-wise potentials, and in ref. ^{97}, for general many-body potentials, while the quantum-mechanical case is thoroughly covered within DFT in refs. ^{98,99}. The expression of the virial stress using *Deep Potential* models relies on the decomposition of the total energy into individual atomic contributions, as it is the case for the heat current^{97}, and will be presented in some detail in “Neural-network potentials”.

### Data analysis

The MD evaluation of the GK formula starts with the computation of the stress time auto-correlation function. This can be done by exploiting the ergodic hypothesis and turning the ensemble average into a time average. The following step is to integrate the tACF, as stated in Eq. (1). Despite the apparent simplicity of this process, the straight evaluation of any transport coefficient through the GK formula is jeopardized by the fact that, while ideally the tACF goes to zero for large times, in practice it is very noisy. Indeed, as the tACF approaches zero, Eq. (1) starts accumulating noise and the integral behaves like the distance traveled by a random walk, whose variance grows linearly with the upper integration limit, making it very difficult to estimate both the bias due to the truncation of the integral and the statistical error.

A better approach is to focus on the *power spectrum* *S*(*ω*) of the stress time series *σ*_{s}(*t*), which, according to the Wiener–Khintchine theorem^{100,101}, is the Fourier transform of the tACF of time series:

According to Eq. (4), the shear viscosity we are after, Eq. (1), is proportional to the *ω* = 0 value of the stress power spectrum,

and any method able to accurately estimate the latter can be leveraged for the former. *Cepstral analysis*^{102} is one such method^{37,39,40}, and we will rely on it in the present case, as previously done for the thermal and electrical conductivities^{37,39,40,60,103}. A full and user-friendly implementation of cepstral analysis for the estimate of transport coefficients is available in the SporTran^{73} open-source code.

### Neural-network potentials

The *Deep Potential* scheme has already been fully explained in the literature^{43,46}, so in this section, we limit ourselves to a brief overview of its main features.

Let us consider a system of *N* atoms and let us indicate by **R** the set of its atomic coordinates: \({{{\bf{R}}}}=\{{{{{\bf{r}}}}}_{1},...,{{{{\bf{r}}}}}_{N}\}\in {{\mathbb{R}}}^{3N}\). The potential energy surface of the system \(E({{{\bf{R}}}})=E\left({{{{\bf{r}}}}}_{1},...,{{{{\bf{r}}}}}_{N}\right)\) is a function of the 3*N* atomic coordinates and of the species of each atom. Assuming that interatomic interactions are local, we make the ansatz that *E*(**R**) can be decomposed into the sum of atomic contributions, \({{{{\mathcal{E}}}}}_{i}\), which only depend on the coordinates of the atoms that are close enough to the one they are associated with. In order to establish a convenient notation, let us define by \({{{{\mathcal{R}}}}}_{i}\) the set of coordinates of the atoms whose distance from the *i*-th atom is smaller that a certain cut-off radius, *R*_{c}, referred to the position of the *i*-th atom itself (let *N*_{i} be the number of them):

where \({{{{\bf{r}}}}}_{ij}={{{{\bf{r}}}}}_{i}-{{{{\bf{r}}}}}_{j}=({x}_{ij},{y}_{ij},{z}_{ij})\). Using these ingredients, the symmetry-preserving descriptors of the local atomic environments, \({{{{\mathcal{D}}}}}_{i}\), are defined and fed to a neural network, which returns the local atomic energies \({{{{\mathcal{E}}}}}_{s(i)}({{{{\mathcal{D}}}}}_{i})\), depending on the chemical species of the *i*-th atom, *s*(*i*), and on its environment, as described by \({{{{\mathcal{D}}}}}_{i}\) (extensive details in ref. ^{46}). The total potential energy of the system is recovered as the sum of all the atomic contributions, thus ensuring extensivity:

The neural network is trained to return the local energy contribution corresponding to any given local environment. The training is performed by minimizing the so-called *loss function*, \({{{\mathcal{L}}}}\) with respect to the parameters *ω* of the deep-neural network:

where Δ*E*^{2} and \({{\Delta }}{{{{\bf{F}}}}}_{i}^{2}\) are the squared deviations of the potential energy and atomic forces respectively, between the reference DFT model and the NNP predictions. The two prefactors, *p*_{E} and *p*_{F} are needed to optimize the training efficiency and to account for the difference in the physical dimensions of energies and forces.

The force acting on the *i*-th atom is given by:

where we applied Eq. (7) and the chain rule. Thus the computation of the atomic forces can be split in two different contributions: the first is the derivative of the atomic energy \({{{{\mathcal{E}}}}}_{s(j)}\) with respect to each element \({{{{\mathcal{D}}}}}_{j}\) of the descriptor and can be easily evaluated through TensorFlow^{104}, while the second term is given by the gradient of the descriptor with respect to the position of the atoms^{105}.

Beside energies and forces, the NNP predicts also the virial of the system defined as in Eq. (3). Using Eq. (7) one can write^{105}:

where the second term can be further split in two contributions as previously shown for the forces. We remark that the resulting formula is well-defined in PBC and enters directly in the calculation of the stress given by Eq. (2), serving our purpose of computing the shear viscosity through the GK formula Eq. (1).

## Data availability

Numerical data supporting the plots and relevant results within this paper are available on the Materials Cloud Platform^{106,107}. In particular the folder contains: the data training set and the input files for training the PBE-NNP model, and also the ab initio stress time series.

## References

Olea, A. F. & Thomas, J. K. Rate constants for reactions in viscous media: correlation between the viscosity of the solvent and the rate constant of the diffusion-controlled reactions.

*J. Am. Chem. Soc.***110**, 4494–4502 (1988).McKinnie, R. E. & Olson, J. S. Effects of solvent composition and viscosity on the rates of CO binding to heme proteins.

*J. Biol. Chem.***256**, 8928–8932 (1981).Kyushiki, H. & Ikai, A. The effect of solvent viscosity on the rate-determining step of fatty acid synthetase.

*Proteins: Struct. Funct. Bioinform.***8**, 287–293 (1990).de Wijs, G. A. et al. The viscosity of liquid iron at the physical conditions of the earth’s core.

*Nature***392**, 805–807 (1998).Alfè, D. & Gillan, M. J. First-principles calculation of transport coefficients.

*Phys. Rev. Lett.***81**, 5161–5164 (1998).Bolmont, E. et al. Solid tidal friction in multi-layer planets: application to Earth, Venus, a super Earth and the TRAPPIST-1 planets - potential approximation of a multi-layer planet as a homogeneous body.

*A&A***644**, A165 (2020).Dumoulin, C., Tobie, G., Verhoeven, O., Rosenblatt, P. & Rambaux, N. Tidal constraints on the interior of Venus.

*J. Geophys. Res. Planets***122**, 1338–1352 (2017).Gallo, P. et al. Water: a tale of two liquids.

*Chem. Rev.***116**, 7463–7500 (2016).Pourasad, S., Hajibabaei, A., Myung, C. W. & Kim, K. S. Two liquid-liquid phase transitions in confined water nanofilms.

*J. Phys. Chem. Lett.***12**, 4786–4792 (2021). PMID: 33988370.Lu, D., Gygi, F. & Galli, G. Dielectric properties of ice and liquid water from first-principles calculations.

*Phys. Rev. Lett.***100**, 147601 (2008).Sharma, M., Resta, R. & Car, R. Intermolecular dynamical charge fluctuations in water: a signature of the H-bond network.

*Phys. Rev. Lett.***95**, https://doi.org/10.1103/physrevlett.95.187401 (2005).Sharma, M., Resta, R. & Car, R. Dipolar correlations and the dielectric permittivity of water.

*Phys. Rev. Lett.***98**, https://doi.org/10.1103/physrevlett.98.247401 (2007).Gartner, T. E. et al. Signatures of a liquid–liquid transition in an ab initio deep neural network model for water.

*Proc. Natl Acad. Sci.***117**, 26040–26046 (2020).Kuo, I.-F. W. et al. Liquid water from first principles: investigation of different sampling approaches.

*J. Phys. Chem. B***108**, 12990–12998 (2004).Grossman, J. C., Schwegler, E., Draeger, E. W., Gygi, F. & Galli, G. Towards an assessment of the accuracy of density functional theory for first-principles simulations of water.

*J. Chem. Phys.***120**, 300–311 (2004).Schwegler, E., Grossman, J. C., Gygi, F. & Galli, G. Towards an assessment of the accuracy of density functional theory for first principles simulations of water. II.

*J. Chem. Phys.***121**, 5400–5409 (2004).Todorova, T., Seitsonen, A. P., Hutter, J., Kuo, I.-F. W. & Mundy, C. J. Molecular dynamics simulation of liquid water: Hybrid density functionals.

*J. Phys. Chem. B***110**, 3685–3691 (2006).Gillan, M. J., Alfè, D. & Michaelides, A. Perspective: how good is DFT for water?

*J. Chem. Phys.***144**, 130901 (2016).Chen, M. et al. Ab initio theory and modeling of water.

*Proc Natl Acad. Sci.***114**, 10846–10851 (2017).LaCount, M. D. & Gygi, F. Ensemble first-principles molecular dynamics simulations of water using the SCAN meta-GGA density functional.

*J. Chem. Phys.***151**, 164101 (2019).Zheng, L. et al. Structural, electronic, and dynamical properties of liquid water by ab initio molecular dynamics based on scan functional within the canonical ensemble.

*J. Chem. Phys.***148**, 164505 (2018).Kühne, T. D., Krack, M. & Parrinello, M. Static and dynamical properties of liquid water from first principles by a novel Car-Parrinello-like approach.

*J. Chem. Theory Comput.***5**, 235–241 (2009).Herrero, C., Pauletti, M., Tocci, G., Iannuzzi, M. & Joly, L. Connection between water’s dynamical and structural properties: Insights from ab initio simulations.

*Proc. Natl Acad. Sci.***119**, e2121641119 (2022).González, M. A. & Abascal, J. L. F. The shear viscosity of rigid water models.

*J. Chem. Phys.***132**, 096101 (2010).Tazi, S. et al. Diffusion coefficient and shear viscosity of rigid water models.

*J. Phys.: Condens. Matter***24**, 284117 (2012).Heyes, D. M., Smith, E. R. & Dini, D. Shear stress relaxation and diffusion in simple liquids by molecular dynamics simulations: analytic expressions and paths to viscosity.

*J. Chem. Phys.***150**, 174504 (2019).Montero de Hijes, P., Sanz, E., Joly, L., Valeriani, C. & Caupin, F. Viscosity and self-diffusion of supercooled and stretched water from molecular dynamics simulations.

*J. Chem. Phys.***149**, 094503 (2018).Kumar, P. et al. Relation between the widom line and the breakdown of the Stokes–Einstein relation in supercooled water.

*Proc. Natl Acad. Sci.***104**, 9575–9579 (2007).Xu, L. et al. Appearance of a fractional stokes–einstein relation in water and a structural interpretation of its onset.

*Nat. Phys.***5**, 565–569 (2009).Tsimpanogiannis, I. N., Jamali, S. H., Economou, I. G., Vlugt, T. J. H. & Moultos, O. A. On the validity of the stokes-einstein relation for various water force fields.

*Mol. Phys.***118**, e1702729 (2020).Green, M. S. Markoff random processes and the statistical mechanics of time-dependent phenomena, ii. irreversible processes in fluids.

*J. Chem. Phys.***22**, 398–413 (1954).Kubo, R. Statistical-mechanical theory of irreversible processes. i. general theory and simple applications to magnetic and conduction problems.

*J. Phys. Soc. Jpn.***12**, 570–586 (1957).Evans, D. J. & Morriss, G. Statistical Mechanics of Nonequilibrium Liquids 2nd edn, (Cambridge University Press, 2008), .

Allen, M. P. & Tildesley, D. J. Computer Simulation of Liquids, 2017.

Maginn, E. J., Messerly, R. A., Carlson, D. J., Roe, D. R. & Elliot, J. R. Best practices for computing transport properties 1. self-diffusivity and viscosity from equilibrium molecular dynamics [article v1.0].

*Living J. Comput. Mol. Sci.***1**, 6324 (2018).Zhang, Y., Otani, A. & Maginn, E. J. Reliable viscosity calculation from equilibrium molecular dynamics simulations: a time decomposition method.

*J. Chem. Theory Comput.***11**, 3537–3546 (2015). PMID: 26574439.Ercole, L., Marcolongo, A. & Baroni, S. Accurate thermal conductivities from optimally short molecular dynamics simulations.

*Sci. Rep.***7**, 15835 (2017).Ercole, L., Marcolongo, A., Umari, P. & Baroni, S. Gauge invariance of thermal transport coefficients.

*J. Low Temp. Phys.***185**, 79–86 (2016).Baroni, S., Bertossa, R., Ercole, L., Grasselli, F. & Marcolongo, A. Heat Transport in Insulators from Ab Initio Green-Kubo Theory, 1–36 (Springer International Publishing, Cham, 2018).

Grasselli, F. & Baroni, S. Invariance principles in the theory and computation of transport coefficients.

*Eur. Phys. J. B***94**, 160 (2021).Behler, J. & Parrinello, M. Generalized neural-network representation of high-dimensional potential-energy surfaces.

*Phys. Rev. Lett.***98**, 146401 (2007).Smith, J. S., Isayev, O. & Roitberg, A. E. ANI-1: an extensible neural network potential with DFT accuracy at force field computational cost. Chem. Sci. 8, 3192–3203, (2017). 1610.08935.

Zhang, L., Han, J., Wang, H., Car, R. & Weinan, E. Deep potential molecular dynamics: a scalable model with the accuracy of quantum mechanics.

*Phys. Rev. Lett.***120**, 143001 (2018).Kocer, E., Ko, T. W. & Behler, J. Neural network potentials: a concise overview of methods.

*Annu. Rev. Phys. Chem.***73**, null, https://doi.org/10.1146/annurev-physchem-082720-034254 (2022).Bartók, A. P., Payne, M. C., Kondor, R. & Csányi, G. Gaussian approximation potentials: the accuracy of quantum mechanics, without the electrons.

*Phys. Rev. Lett.***104**, 136403 (2010).Zhang, L. et al. End-to-end symmetry preserving inter-atomic potential energy model for finite and extended systems. In Bengio, S. et al. (eds.)

*Advances in Neural Information Processing Systems*, 4436–4446 (Curran Associates, Inc., 2018).*31*Jia, W. et al. Pushing the limit of molecular dynamics with ab initio accuracy to 100 million atoms with machine learning. In

*Proc.**SC20: International Conference for High-Performance Computing, Networking, Storage and Analysis*, 1–14, https://doi.org/10.1109/SC41405.2020.00009 (2020).Zhang, L., Wang, H., Car, R. & E, W. Phase diagram of a deep potential water model.

*Phys. Rev. Lett.***126**, 236001 (2021).Jiang, W., Zhang, Y., Zhang, L. & Wang, H. Accurate deep potential model for the Al-Cu-Mg alloy in the full concentration space*.

*Chin. Phys. B***30**, 050706 (2021).Zhang, C. et al. Modeling liquid water by climbing up Jacob’s ladder in density functional theory facilitated by using deep neural network potentials.

*J. Phys. Chem. B***125**, 11444–11456 (2021). PMID: 34533960.Wu, J., Zhang, Y., Zhang, L. & Liu, S. Deep learning of accurate force field of ferroelectric HfO

_{2}.*Phys. Rev. B***103**, 024108 (2021).Niu, H., Bonati, L., Piaggi, P. M. & Parrinello, M. Ab initio phase diagram and nucleation of gallium.

*Nat. Commun.***11**, 2654 (2020).Marcolongo, A., Binninger, T., Zipoli, F. & Laino, T. Simulating diffusion properties of solid-state electrolytes via a neural network potential: Performance and training scheme.

*Chem.Systems.Chem***2**, https://doi.org/10.1002/syst.201900031 (2019). 1910.10090.Huang, J. et al. Deep potential generation scheme and simulation protocol for the Li10GeP2S12-type superionic conductors.

*J. Chem. Phys.***154**, 094703 (2021).Pegolo, P., Baroni, S. & Grasselli, F. Temperature- and vacancy-concentration-dependence of heat transport in Li

_{3}ClO from multi-method numerical simulations.*npj Comput. Mater.***8**, 24 (2022).Li, R., Lee, E. & Luo, T. A unified deep neural network potential capable of predicting thermal conductivity of silicon in different phases.

*Mater. Today Phys.***12**, 100181 (2020).Zhang, L. et al. Deep neural network for the dielectric response of insulators.

*Phys. Rev. B***102**, 041121(R) (2020).Sommers, G. M., Calegari Andrade, M. F., Zhang, L., Wang, H. & Car, R. Raman spectrum and polarizability of liquid water from deep neural networks.

*Phys. Chem. Chem. Phys.***22**, 10592–10602 (2020).Tisi, D. et al. Heat transport in liquid water from first-principles and deep neural network simulations.

*Phys. Rev. B***104**, 224202 (2021).Grasselli, F., Stixrude, L. & Baroni, S. Heat and charge transport in H2O at ice-giant conditions from ab initio molecular dynamics simulations.

*Nat. Commun.***11**, 3605 (2020).Marcolongo, A., Bertossa, R., Tisi, D. & Baroni, S. QEHeat: an open-source energy flux calculator for the computation of heat-transport coefficients from first principles.

*Comput. Phys. Commun.***269**, 108090 (2021).Perdew, J. P., Burke, K. & Ernzerhof, M. Generalized gradient approximation made simple.

*Phys. Rev. Lett.***77**, 3865–3868 (1996).Sun, J. et al. Accurate first-principles structures and energies of diversely bonded systems from an efficient density functional.

*Nat. Chem.***8**, 831–836 (2016).Sun, J., Ruzsinszky, A. & Perdew, J. P. Strongly constrained and appropriately normed semilocal density functional.

*Phys. Rev. Lett.***115**, 036402 (2015).Hamann, D. R. Optimized norm-conserving Vanderbilt pseudopotentials.

*Phys. Rev. B***88**, 085117 (2013).Roberto, C. & Michele, P. Unified approach for molecular dynamics and density-functional theory.

*Phys. Rev. Lett.***55**, 2471–2474 (1985).Giannozzi, P. et al. QUANTUM ESPRESSO: a modular and open-source software project for quantum simulations of materials.

*J. Phys. Condens. Matter***21**, 395502 (2009).Giannozzi, P. et al. Advanced capabilities for materials modelling with quantum ESPRESSO.

*J. Phys. Condens. Matter***29**, 465901 (2017).Giannozzi, P. et al. Quantum espresso toward the exascale.

*J. Chem. Phys.***152**, 154105 (2020).Sit, P. H.-L. & Marzari, N. Static and dynamical properties of heavy water at ambient conditions from first-principles molecular dynamics.

*J. Chem. Phys.***122**, 204510 (2005).Yoo, S., Zeng, X. C. & Xantheas, S. S. On the phase diagram of water with density functional theory potentials: The melting temperature of ice Ih with the Perdew–Burke–Ernzerhof and Becke–Lee–Yang–Parr functionals.

*J. Chem. Phys.***130**, 221102 (2009).Martyna, G. J., Klein, M. L. & Tuckerman, M. Nosé-Hoover chains: the canonical ensemble via continuous dynamics.

*J. Chem. Phys.***97**, 2635–2643 (1992).Ercole, L., Bertossa, R., Bisacchi, S. & Baroni, S. Sportran: a code to estimate transport coefficients from the cepstral analysis of (multivariate) current time series. https://arxiv.org/abs/2202.11571 (2022).

Weisstein, E. W.

*Moving Average*. From MathWorld – A Wolfram Web Resource. https://mathworld.wolfram.com/MovingAverage.html.Zhang, Y. et al. DP-GEN: a concurrent learning platform for the generation of reliable deep learning based potential energy models.

*Comput. Phys. Commun.***253**, 107206 (2020).Zhang, L., Lin, D.-Y., Wang, H., Car, R. & E, W. Active learning of uniformly accurate interatomic potentials for materials simulation.

*Phys. Rev. Mater.***3**, 023804 (2019).Kingma and Jimmy Ba, D. P. Adam: A method for stochastic optimization. In Bengio, Y. & LeCun, Y. (eds.) In

*Proc.**3rd International Conference on Learning Representations, ICLR2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings*(2015).Weisstein, E. W.

*Correlation Coefficient*(2022). From MathWorld—a Wolfram Web Resource. https://mathworld.wolfram.com/CorrelationCoefficient.html.Thompson, A. P. et al. LAMMPS—a flexible simulation tool for particle-based materials modeling at the atomic, meso, and continuum scales. Comput. Phys. Commun. 108171, https://doi.org/10.1016/j.cpc.2021.108171 (2021).

Shapiro, S. S. & Wilk, M. B. An analysis of variance test for normality (complete samples).

*Biometrika***52**, 591–611 (1965).Yeh, I. C. & Hummer, G. System-size dependence of diffusion coefficients and viscosities from molecular dynamics simulations with periodic boundary conditions.

*J. Phys. Chem. B***108**, 15873–15879 (2004).Grasselli, F. Investigating finite-size effects in molecular dynamics simulations of ion diffusion, heat transport, and thermal motion in superionic materials.

*J. Chem. Phys.***156**, 134705 (2022).Piaggi, P. M., Panagiotopoulos, A. Z., Debenedetti, P. G. & Car, R. Phase equilibrium of water with hexagonal and cubic ice using the SCAN functional.

*J. Chem. Theory Comput.***17**, 3065–3077 (2021).Gaiduk, A. P., Gygi, F. & Galli, G. Density and compressibility of liquid water and ice from first-principles simulations with hybrid functionals.

*J. Phys. Chem. Lett.***6**, 2902–2908 (2015). PMID: 26267178.Haynes, W. M., Lide, D. R. & Bruno, T. J. CRC Handbook of Chemistry and Physics: A Ready-Reference Book of Chemical and Physical Data (Florida: CRC Press, 2016).

Dehaoui, A., Issenmann, B. & Caupin, F. Viscosity of deeply supercooled water and its coupling to molecular diffusion.

*Proc. Natl Acad. Sci.***112**, 12020–12025 (2015).Easteal, A. J., Price, W. E. & Woolf, L. A. Diaphragm cell for high-temperature diffusion measurements. tracer diffusion coefficients for water to 363 K.

*J. Chem. Soc., Faraday Trans. 1***85**, 1091–1097 (1989).Poole, P. H., Sciortino, F., Essmann, U. & Stanley, H. E. Phase behaviour of metastable water.

*Nature***360**, 324–328 (1992).Santra, B., Jr. D., R. A., Martelli, F. & Car, R. Local structure analysis in ab initio liquid water.

*Mol. Phys.***113**, 2829–2841 (2015).Kuo, Y.-W., Tang, P.-H., Wang, H., Wu, T.-M. & Saito, S. Tetrahedral structure of supercooled water at ambient pressure and its influence on dynamic relaxation: comparative study of water models.

*J. Mol. Liq.***341**, 117269 (2021).Foffi, R., Russo, J. & Sciortino, F. Structural and topological changes across the liquid-liquid transition in water.

*J. Chem. Phys.***154**, 184506 (2021).Soper, A. K. & Ricci, M. A. Structures of high-density and low-density water.

*Phys. Rev. Lett.***84**, 2881–2884 (2000).Zhang, C. et al. Modeling liquid water by climbing up Jacob's ladder in density functional theory facilitated by using deep neural network potentials.

*J. Phys. Chem. B***125**, 11444–11456 (2021).Kim, M.-C., Sim, E. & Burke, K. Ions in solution: density corrected density functional theory (DC-DFT).

*J. Chem. Phys.***140**, 18A528 (2014).Dasgupta, S., Lambros, E., Perdew, J. P. & Paesani, F. Elevating density functional theory to chemical accuracy for water simulations through a density-corrected many-body formalism.

*Nat. Commun.***12**, 6359 (2021).Tsai, D. H. The virial theorem and stress calculation in molecular dynamics.

*J. Chem. Phys.***70**, 1375–1382 (1979).Fan, Z. et al. Force and heat current formulas for many-body potentials in molecular dynamics simulations with applications to thermal conductivity calculations.

*Phys. Rev.*B**92**, https://doi.org/10.1103/physrevb.92.094301 (2015).Nielsen, O. H. & Martin, R. M. First-principles calculation of stress.

*Phys. Rev. Lett.***50**, 697–700 (1983).Nielsen, O. H. & Martin, R. M. Quantum-mechanical theory of stress and force.

*Phys. Rev. B***32**, 3780–3791 (1985).Wiener, N. Generalized harmonic analysis.

*Acta Math.***55**, 117–258 (1930).Khintchine, A. Korrelationstheorie der stationaren stochastischen Prozesse.

*Math. Annalen***109**, 604–615 (1934).Bogert, B., Healy, J. & Tukey, J. The Quefrency Analysis of Time Series for Echoes: Cepstrum, Pseudo-Autocovariance, Cross-Cepstrum, and Saphe Cracking. In

*Proc. Symposium of Time Series Analysis*, 209–243 (1963).Bertossa, R., Grasselli, F., Ercole, L. & Baroni, S. Theory and numerical simulation of heat transport in multicomponent systems.

*Phys. Rev. Lett.***122**, 255901 (2019).Abadi, M. et al. TensorFlow: large-scale machine learning on heterogeneous systems (2015). Software available from tensorflow.org.

Wang, H., Zhang, L., Han, J. & E, W. DeePMD-kit: a deep learning package for many-body potential energy representation and molecular dynamics.

*Comput. Phys. Commun.***228**, 178–184 (2017).Talirz, L. et al. Materials cloud, a platform for open computational science.

*Sci. Data***7**, 299 (2020).Malosso, C., Zhang, L., Car, R., Baroni, S. & Tisi, D. Viscosity in water from first-principles and deep-neural-network simulations. https://doi.org/10.24435/materialscloud:x7-b0 (2022).

## Acknowledgements

C.M., S.B., and D.T. are grateful to Federico Grasselli, Paolo Pegolo, and Riccardo Bertossa for enlightening discussions throughout the completion of this work. This work was partially funded by the EU through the MAX Centre of Excellence for supercomputing applications (Project No. 824143) and the Italian MUR, through the PRIN grant *FERMAT*. The work at Princeton University was supported by the Computational Chemical Sciences Center “Chemistry in Solution and at Interfaces” funded by the US Department of Energy under Award No. DE-SC0019394.

## Author information

### Authors and Affiliations

### Contributions

Computer simulations and data analysis were mainly performed by C.M. under the supervision of D.T. S.B. conceived the work and directed some of the data analysis. R.C. and L.Z. supervised the early stages of the machine-learning work and provided training data for the SCAN NNP. All authors contributed equally to writing the paper.

### Corresponding author

## Ethics declarations

### Competing interests

The authors declare no competing interests.

## Additional information

**Publisher’s note** Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.

## About this article

### Cite this article

Malosso, C., Zhang, L., Car, R. *et al.* Viscosity in water from first-principles and deep-neural-network simulations.
*npj Comput Mater* **8**, 139 (2022). https://doi.org/10.1038/s41524-022-00830-7

Received:

Accepted:

Published:

DOI: https://doi.org/10.1038/s41524-022-00830-7