# Calculate forces on atoms from potential energy of system and position of atoms

## Background

I am using a neural network to calculate the potential energy of atoms in a configuration and then adding energy of all atoms to compare it with the true energy of the configuration(label) to update the weights.

I am doing so for 10000 configurations of 100 atoms each for liquid Argon at 100K.

Note I don't have the actual energy of each atom and only the energy of the configuration.

## Problem

I need to calculate the forces on each atom to see if the sum of forces for all the atoms is zero in X,Y,Z axis. In case it is not I want to find out how off is it from zero.

How do I calculate the force on atoms using their position and potential energy for a given trajectory. I know I need to do $\frac{dE}{dr}$ but what should be my E and r. Also since I don,t a formula for E(r), what should my $dE$ and $dr$ be respectively?

• If I'm understanding correctly, you have two methods to calculate the energy of a configuration: (1) a neural network and (2) a more standard algorithm. Do you want to check that the forces add up to zero for 1, or for 2? Is the liquid argon being simulated in a container, or is it a droplet being simulated as it floats weightlessly in space?
– user28109
Jul 25, 2018 at 17:47
• @fireball.1 chemistry.stackexchange.com/q/99760/41556 I think I have brought this up before, but if you are going to cross post a question, link the other versions of it in your post. It helps to avoid wasting people's time repeating answers. Jul 29, 2018 at 18:42

Generally speaking, the force acting on particle $i$ is just $-\nabla E(\vec{r}_i)$ (note the minus sign), where $\nabla$ is the gradient operator and $\vec{r}_i$ is the position of particle $i$. However, note that this expression assumes that we are dealing with conservative forces. But if that's the case, the energy is conserved by definition, which means that the forces must average to 0.
$$F_\alpha \approx - \frac{E(\vec{r}_i + \delta \vec{\alpha}) - E(\vec{r}_i)}{\delta \alpha}$$
where $\alpha = x$, $y$ or $z$. You should first do this for several values of $\delta$ in order to choose the optimal value and then compute the force acting on each particle for a given configuration.