SENPAI-Molecular-Dynamics / SENPAI

Molecular dynamics simulation software
https://senpaimd.org
GNU General Public License v3.0
126 stars 16 forks source link

Extreme slowdown from periodic boundary conditions #16

Closed Chelsea486MHz closed 3 years ago

Chelsea486MHz commented 4 years ago

As per this revelation -> https://github.com/Garuda1/senpai/issues/9#issuecomment-556102717

The way periodic boundary conditions are handled is beyond inefficient. Claiming I am surprised would be lying, but I am still speechless.

raresraf commented 4 years ago

Seems that this in not a Cataclysmic problem of cosmological proportions after all. 😄 Only when I ran ./senpai.bin --in examples/DES.mol --out render.xyz --density 0.001 --time 0.01 this issue appeared. If we run with --copy 5, periodic boundary conditions total time drops below 0.1%

Chelsea486MHz commented 4 years ago

Well, the force computations do scale at O(n²), while the PBCs scale at O(n).

I'll look into optimizing the PBCs anyway, since a lot of research went behind that.

Still, it's nice to know the impact isn't so bad.