Closed lorepieri8 closed 1 year ago
Hi @lorepieri8! The implementation is based on the following formula:
$V(r) = \epsilon[(\frac{\sigma}{r})^{12} - 2(\frac{\sigma}{r})^{6}]$
where $V$ is the potential. This formula was based on the work from Pinciroli et al. (2008) (Eq. 3). But this can also be found in other references, e.g., Fig.1c from Geada et al. (2018).
So, if you check the derivative (force $F$) will be:
$F(r) = -\frac{\partial{V}}{\partial{r}} = \frac{12\epsilon}{r}[(\frac{\sigma}{r})^{12} - (\frac{\sigma}{r})^{6}]$
and this last formula is the one implemented.
Please, let me know what you think.
Ops, I missed the 1/r in front in your implementation, that was the important bit. Definition of the constants seems slightly different from other sources, but this should be no big deal.
https://pyswarming.readthedocs.io/en/latest/_modules/pyswarming/behaviors.html#lennard_jones
Seems like the Lennard Jones potential is used, instead of the derivate of it, to obtain the force.
See for instance https://math.stackexchange.com/questions/1742524/numerical-force-due-to-lennard-jones-potential