  Machine-learning potentials provide computationally efficient and accurate
approximations of the Born-Oppenheimer potential energy surface. This potential
determines many materials properties and simulation techniques usually require
its gradients, in particular forces and stress for molecular dynamics, and heat
flux for thermal transport properties. Recently developed potentials feature
high body order and can include equivariant semi-local interactions through
message-passing mechanisms. Due to their complex functional forms, they rely on
automatic differentiation (AD), overcoming the need for manual implementations
or finite-difference schemes to evaluate gradients. This study demonstrates a
unified AD approach to obtain forces, stress, and heat flux for such
potentials, and provides a model-independent implementation. The method is
tested on the Lennard-Jones potential, and then applied to predict cohesive
properties and thermal conductivity of tin selenide using an equivariant
message-passing neural network potential.
