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

Add traits for energy computation #19

Open
Luthaf opened this issue Mar 2, 2016 · 0 comments
Open

Add traits for energy computation #19

Luthaf opened this issue Mar 2, 2016 · 0 comments
Labels

Comments

@Luthaf
Copy link
Member

Luthaf commented Mar 2, 2016

The following traits should be added:

trait Energy {
    // Used in monte-carlo and energy computation
    fn energy(&mut self, system: &System) -> f64;
}

trait Forces {
    // Used in virial computation
    fn forces(&mut self, system: &System) -> Vec<Vector3D>;
}

trait Energetics: Energy + Forces {
    // Used in energy minimization
    fn forces_and_energy(&mut self, system: &System) -> (f64, Vec<Vector3D>) {
        (self.energy(system), self.forces(system))
    }
}

This would allow to:

  • Have a SimpleEnergetics mode where we do not re-compute periodic boundary conditions when needing both forces and energy;
  • Add other way of computing energy, like ThreadedEnergetics, VerletLists or GPUEnergetics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant