The impact of tensorial temperature on equilibrium thermodynamics

Thermodynamic temperature is a scalar. However, the connection with the kinetic energy tensor in statistical mechanics leaves open the possibility to define a tensorial temperature. This concept has sometimes been used to simulate isothermal conditions in out-of-equilibrium systems. Here, we show, by studying a sessile water droplet, that a tensorial temperature leads to the wrong thermodynamics, or, in other words, the equilibrium isothermal ensemble generated using a tensorial temperature is not the canonical one, with interfacial free energies that can diﬀer up to 40% from the correct ones.

Molecular dynamics simulations, by integrating Newton's equations of motion, naturally sample microcanonical ensembles, where the state of the system evolves on the constant energy hypersurface of the phase space. Often, however, it is necessary or preferable to simulate other ensembles. Modifications to the numerical integration scheme, which allow for the sampling of isothermal ensembles, go under the generic name of a ''thermostat''. In the literature, one can find a large number of different thermostats, each one with its own advantages and disadvantages. [1][2][3] Here, we focus on the consequences of considering temperature as a tensorial quantity and decoupling one or more spatial directions from a global thermostat, particularly in view of its application to out-of-equilibrium simulations.
It is worth remembering that a global thermostat is one that uses the total kinetic energy of the system to define its temperature, according to its statistical mechanical definition. Strictly speaking, all global thermostats work only at equilibrium and fail if the time-averaged velocity field is not zero (or a constant) everywhere, as in the case of an imposed shear flow. Often, the following simple modification of a global thermostat is thought to be a good enough solution. Let's consider, for example, the shear flow mentioned before, whose stationary velocity field has the form v(x,y,z) = u(z)ŷ. In a linear regime, one could reasonably assume that the dynamics are perturbed from the equilibrium only along the direction of the flow, ŷ. One can then modify any global thermostat in such a way that only the velocity components in the two orthogonal directions, x and ẑ, are affected by the thermostat. Of course, the way the temperature is computed from the set of velocities has to be changed accordingly, to take into account the loss of one degree of freedom per particle.
This approach has often been used, including by one of the authors of this work, to simulate the flow of fluids in nanochannels, 4-10 and is usually believed to be accurate enough if not too far from equilibrium. 11 However, some legitimate concerns could arise when dealing with molecular fluids with rigid bonds, because the configuration space and the momentum space are no longer independent of each other, and this can have significant consequences (it is worth noting here that in atomistic models, most molecular bonds have to be modelled as rigid at room temperature, as the first available bond-stretching modes have energies several times higher than the thermal energy; in water, this is true also for the bending modes). As we have shown in our previous work, 12 for example, the configurational part of the pressure (i.e., the virial part) is not enough to describe the average value of the surface tension of liquid interfaces because of the preferential orientation of the molecules at the boundaries.
Let's assume, for simplicity, that one of the molecular axes is fixed in a macroscopic reference frame (in this case, the liquid vapor interface). In this example, it is clear that the rotational degrees of freedom do not contribute to the kinetic part of the stress in equal measure along the three Cartesian axes. The anisotropy of the kinetic energy tensor at interfaces (which, by the way, constitutes no violation of the equipartition theorem) can contribute a considerable amount to the surface tension -for example, 15% in water, modeled using the SPC/E potential. 12,13 The modification of global thermostats for out-of-equilibrium flows that we mentioned before consists, in its essence, of the consideration of the temperature as a tensorial object, and the restriction of the original algorithm to two Cartesian components only. Because of the anisotropy of the kinetic energy tensor, however, it is reasonable to question the validity of this approach. In the typical setup for shear flow in a nanochannel, the fluid fills the region between two planar walls, which are sheared by imposing either constant velocity or constant force on the walls' atoms. One basic requirement for these modified thermostats is to be able to reproduce, at equilibrium, the correct free energy of the system, which in this case can be probed by computing the liquid/solid and liquid/vapor surface tensions. As a representative system, we have chosen water in contact with a graphitic surface. Water molecules are modeled using the SPC/E potential, while the substrate is modeled using a graphite-like structure of carbon atoms, fixed in space and arranged in six layers. The interlayer distance is 0.3394 nm, and in each layer, the atoms are located on a hexagonal lattice with bond lengths of 0.142 nm. The carbon atoms interact with the oxygen atoms following a Lennard-Jones potential, i.e., U(r) = 4e[(s/r) 12 À (s/r) 6 ], where s = 0.3151 nm and e = 0.65060 kJ mol À1 . The depth of the energy well, e, has been chosen with no other particular aim but to obtain a contact angle of about 751 using the unmodified thermostat. We included contributions to the Lennard-Jones interactions for pair distances of up to 1 nm, whereas we computed the electrostatic interaction using the smooth Particle Mesh Ewald method, 14 with a short-range cutoff of 1 nm, a grid spacing of 0.12 nm, a 4th order interpolation scheme, and a relative accuracy at the cutoff of 10 À5 . No longrange corrections to the dispersion forces were applied in any case. The molecular structure of water was kept rigid using the SETTLE algorithm. 15 As for the shape of the water droplet, we opted for a cylindrical cap that spans the periodic simulation box in one direction ( y), instead of a spherical cap. This setup avoids having a sizedependent contact angle because of the presence of a nonzero line tension. The final system consists of a rectangular simulation box of edges 13.035, 4.118, and 10.0 nm along the x, y, and z axes, respectively, containing 12 243 carbon atoms and 2000 water molecules. The graphitic planes are arranged with their normal pointing along the z axis. For the calculation of the water/vapor surface tension, we simulated a free-standing slab of water with 4000 molecules in a simulation box of 5 Â 5 Â 15 nm, with the surface normal along the z axis. Fig. 1 presents a simulation snapshot of the sessile cylindrical droplet.
We performed molecular dynamics simulations with an in-house modified version of GROMACS v. 5.1, 16 integrating the equations of motion using a timestep of 1 fs. We used, as a reference thermostat, the Nosé-Hoover 17,18 (NH) thermostat, simulating the canonical ensemble at T = 300 K, with a relaxation time of 0.5 ps. Additionally, we tested two modified coupling schemes. In the first one (T1), there is only one thermostat acting on the degrees of freedom parallel to a chosen plane, while the velocities along the normal direction are not modified. In the second one (T2), two thermostats are acting separately on two subspaces (the in-plane and normal directions). It should be noted that T1 can be thought of as a variant of T2, with an infinite relaxation time for the thermostat applied to the normal direction. For both of these thermostats, the scalar temperature fluctuates around the target value. However, as we will now show, they fail in sampling the canonical ensemble at equilibrium.
Solid/liquid surface tension can be accessed by measuring the contact angle of a water droplet on a solid substrate. The Young equation, g sg À g sl À g lv cos y = 0, relates the surface tensions, g, between solid (s), gas (g), and liquid (l) to the macroscopic contact angle, y. The surface tension g lv can be computed easily from a liquid/vapour interface using the mechanical definition g lv ¼ L 2 p n À p t ð Þ , where p n and p t are the normal and tangential components of the pressure tensor, L is the simulation box edge along the interface normal, and the factor 1/2 accounts for the presence of two interfaces. The most striking difference between the macroscopic properties sampled with the NH thermostat and those sampled with the modified thermostats is the value of the equilibrium contact angle of the sessile droplet. Fig. 2 reports one isodensity line in the x-z plane, outlining the shape of the droplet, for the same system simulated using the NH, T1, and T2 thermostats. The droplet simulated using the T2 thermostat has a remarkably different contact angle, about 101 (C12%) smaller than that obtained with the NH thermostat. The effect of the T1 thermostat is less appreciable by visual inspection, but the value resulting from the best fit to the arc of a circle is about 31 (C4%) larger than that obtained when using the NH thermostat. Although small (but statistically significant, as it is larger than three standard deviations), this difference has a considerable impact on the value of g sg À g sl .
The other ingredient needed is the liquid/vapor surface tension, g lv , which can be obtained directly from the sampled  values of the pressure tensor in the simulation of the freestanding water slab. The two modified thermostats also have an impact on this surface free energy, which is about 3% (T1) and 6% (T2) smaller than that of the standard NH thermostat. The values of cos y and g lv can be combined to obtain g sg À g sl , which is 146 AE 3, 113 AE 2, and 222 AE 4 bar nm, for NH, T1, and T2, respectively. This result implies that g sg À g sl is about 20% smaller and 40% larger than it should be when using T1 and T2, respectively. The significant difference in the T1 case could strike one as unexpected because the contact angle is close to the NH one. What matters, however, is the combined effect of the liquid/vapor surface tension and the cos y factor: the closer y is to 901, the more the factor changes, and it is, in fact, T1 that generates the largest contact angle (in Table 1, we report the calculated average values and the standard deviations of the liquid/vapor surface tension for the NH, T1, and T2 thermostats).
One could wonder whether this behaviour is characteristic of Nosé-Hoover-like thermostats only, or of other types of thermostats as well. We also investigated the case of the Langevin thermostat, implemented as in ref. 19. Due to the very structure of the Langevin equation, an equivalent version of the T2 thermostat is meaningless, but it is possible to realize an equivalent of T1, where the Langevin friction and forcing terms are applied only in the x-y plane. The simulations run with the full Langevin thermostat lead to a contact angle of 75.71 AE 0.11, in accordance with the NH results, whereas those run when not applying the Langevin friction and stochastic forcing to the z direction yield a contact angle of 72.71 AE 0.21. Perhaps more importantly, the thermostat with partial Langevin coupling also led to a wrong temperature of 296.1 AE 0.2 K (compared to the value of 300.0 AE 0.1 K obtained with all other thermostats), due to the fact that the projected constrained degrees of freedom do not satisfy the usual fluctuation-dissipation relations.
The conclusion that can be drawn from this investigation is that using a tensorial temperature and applying separate (albeit identical) thermostats to its elements, or removing one of the spatial directions from the thermostating procedure, does not allow for the sampling of canonical ensembles at equilibrium. This failure arises from the fact that the Cartesian kinetic tensor is not always isotropic everywhere, as in the case of rigid molecules in the presence of interfaces. Fully flexible molecules and monatomic liquids are not affected by this problem because the kinetic and configurational parts of the partition function are independent of each other. We showed that in a test case of water in contact with a graphite-like material, g sg À g sl is affected so much as to change by 20-40% from its ''true'' value obtained in the canonical ensemble. We advise refraining from using these kinds of thermostats in cases where thermodynamic consistency is a strict requirement.

Conflicts of interest
There are no conflicts to declare.