Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
g-bauer opened this issue Apr 4, 2017 · 0 comments
Open

Comments

@g-bauer
Copy link
Contributor

g-bauer commented Apr 4, 2017

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 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant