for iParticle in range(0, NUMBER_PARTICLES - 1):
    positionsJ = currentPositions[iParticle + 1:, :]
distance = currentPositions[(iParticle), :] - positionsJ
distance = distance - BOX_LENGTH * (distance / BOX_LENGTH).round()
distanceSquared = (distance ** 2).sum(axis=1)
ind = distanceSquared < CUT_OFF_RADIUS_SQUARED
if ind.any():
    r2i = 1.0 / distanceSquared[ind]
r6i = r2i * r2i * r2i
lennardJones = 48.0 * r2i * r6i * (r6i - 0.5)
ljdist = lennardJones[:, (None)] * distance[(ind), :]
force[(iParticle), :] += ljdist.sum(axis=0)
force[iParticle + 1:, :][(ind), :] -= ljdist
potentialEnergy += (4.0 * r6i * (r6i - 1.0) - CUT_OFF_ENERGY).sum()
return force, potentialEnergy
improve nested loop performance