# Accelerate pairwise Lennard-Jones force computation

**URL:** <https://discourse.julialang.org/t/accelerate-pairwise-lennard-jones-force-computation/67321>\
**Category:** Performance\
**Created:** [August 30, 2021, 1:34am UTC](https://discourse.julialang.org/t/accelerate-pairwise-lennard-jones-force-computation/67321 "2021-08-30T01:34:07Z")\
**Posts on this page:** 1\
**Showing post:** 56

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [September 2, 2021, 1:04am UTC](https://discourse.julialang.org/t/accelerate-pairwise-lennard-jones-force-computation/67321/56 "2021-09-02T01:04:10Z")

</div>

> [@Elrod](#):
>
> Also, you don’t want to actually ever call `sort` . No sense turning an `O(N)` algorithm into an `O(N*log(N))` algorithm.

That is out of question. But what do do is this: [Fastest way to partition array, given a condition](https://discourse.julialang.org/t/fastest-way-to-partition-array-given-a-condition/65243)

This takes quite a significant part of the time (but results in some of that locality and avoids a lot of force computations, and results to be very effective). Yet it is the most time-consuming operation except the calculation of the forces for the pairs.

---

_[View the full topic](https://discourse.julialang.org/t/accelerate-pairwise-lennard-jones-force-computation/67321)._
