Hi(adsbygoogle = window.adsbygoogle || []).push({});

For a simulation regarding Lennard Jones fluids I'm getting divergences.

I have particles in a fixed volume.

I calculate distances between these particles to find the force.

However in the first iteration I already get divergences (NaN values in matlab).

I use [tex]F_x^{ij} = 24\varepsilon \left( 2r_{ij}^{-14}-r_{ij}^{-8}\right)\cdot \Delta x_{ij}[/tex]

Where the i,j have to do with the particles I'm viewing. For each direction I get such a force.

But some of the particles get so close that this force and hence the acceleration effectively become infinity. My simulation obviously breaks down at this point.

I tried changing the timestep, this doesn't do anything.

It worked at some point but I don't recall changing anything after that. Except adding the thermostat code which I can turn off. The divergence remains.

You can find my (messy) code in this pastebin http://pastebin.com/62v1yTCY

I've been looking at it for hours already yet I can't find any solution.

JorisL

Edit;

I had divergences before. Those were caused by an error in applying the periodic boundary conditions. I forgot using the nearest image convention at that time.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# [MD] Lennard Jones

Loading...

Similar Threads - Lennard Jones | Date |
---|---|

Verlet alghoritm and Lennard Jones simulation in Python | Apr 21, 2015 |

Integration of 6-12 Lennard Jones Potential to obtain the 3-9 one. | Aug 5, 2014 |

Arguments for the powers used in the Lennard Jones Potential | Jan 15, 2013 |

Lennard-Jones potential for 3 atoms | Feb 23, 2011 |

Lennard Jones- reduced units | Feb 16, 2010 |

**Physics Forums - The Fusion of Science and Community**