In classical computer simulations such as molecular dynamics (MD) simulations, one integrates Newton's equations of motion to determine particle trajectories. If we think of Newton's Second Law as simply $$\textbf{f}_i = \frac{d \textbf{p}_i}{dt}$$ where $\textbf{f}_i$ is the net force acting on a particle $i$ and $\textbf{p}_i$ is the momentum of the particle, then it is clear that to ultimately integrate this and propagate the trajectory, we will need to calculate the force on every particle in the system.
However, in practice, I think that the potential energy $u$, rather than the force, is initially calculated (a force field specifies the form of the potential energy $V$). Now, I know that there is a relationship between potential energy $u$ and force $f$: $$\textbf{f} = -\boldsymbol{\nabla} u$$
In other words, force is the negative gradient of the potiental energy.
I am reading Understanding Molecular Simulation by Frenkel and Smit (Second Edition), and on page 69 (Google Books has some pages here), I see this paragraph:
Suppose that we wish to compute the $x$-component of the force: $$f_x(r) = -\frac{\partial u(r)}{\partial x} = -\left(\frac{x}{r}\right)\left(\frac{\partial u(r)}{\partial r}\right)$$
I am a little afraid this is a silly question, but how do the authors go from $-\frac{\partial u(r)}{\partial x}$ to $-\left(\frac{x}{r}\right)\left(\frac{\partial u(r)}{\partial r}\right)$? Is this the chain rule? Could you please help me see the step that the authors are making?