Skip to content

Using squared distances vs. squared cutoff in force and energy loops #135

@g-bauer

Description

@g-bauer

Currently, we check the distance between interaction sites versus the cutoff.

let r = system.cell().distance(posi, posj);
if r >= self.cutoff {
    0.0
} else {
// compute potential / force 

We could test if using the squared distance and squared cutoff (an hence skipping calculation of the square root) impacts performance.

let r2 = system.cell().distance2(posi, posj);
if r2 >= self.cutoff2 {
    0.0
} else {
// (compute distance)
// compute potential / force 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions