# Simulating periodic boundary condition with long_range interaction

Consider 2 particles in a 2D plane. There is a long-range interaction between two particles: $$f (r_i-r_j)= \frac{\vec{r_i} - \vec{r_j}}{|r_i-r_j|^3}$$ $$\vec{r_i} =(x_i,y_i)$$

$r_i$ determines the position of particle number $i$ in the plane. Knowing position of particles in the 2D plane and also knowing that distances of particles is more than a threshold $r_0$ (so $f$ do not get infinite), how can one find $f_{tot}$ in the position of all particles in a periodic boundary condition simulation?

$f_{tot}$ is sum of effect of images of $j$ particle in f:

$$f_{tot}(\vec{r_i})= \sum_{n=-\infty}^{\infty} \bigg ( \frac{(x_i - x_j + n L,0)}{|y_i - y_j + n L|^3} \bigg) + \sum_{n=-\infty}^{\infty} \bigg ( \frac{(0,y_i - y_j + n L)}{|y_i - y_j + n L|^3} \bigg)$$

in above relation, r_i and r_j are known and n is an integer number which changes from -infinity to infinity

• Welcome to SciComp.SE! You need to add a lot more details to your question -- for example, what is $f_{tot}$ supposed to mean? – Christian Clason Jul 5 '17 at 14:50
• I have added details, is it clear now? @ChristianClason – sara nj Jul 5 '17 at 15:04
• What is your question? – nicoguaro Jul 5 '17 at 15:49
• I want to calculat f_tot @nicoguaro – sara nj Jul 5 '17 at 15:51
• You probably want to evalute that sum in Fourier space. See this paper for an overview of methods to evaluate such long-range interactions. – Henri Menke Jul 5 '17 at 22:42