pub struct DirectSum { /* private fields */ }Expand description
The DirectSum simulation method is the most intuitive way to process a molecular dynamics simulation. It bases the computation on the Direct Sum method.
Newton Pair Optimization: The only optimization DirectSum performs is avoiding computing the same pair of particles twice.
Trait Implementations§
Source§impl Simulation for DirectSum
impl Simulation for DirectSum
Source§fn system_name(&self) -> &str
fn system_name(&self) -> &str
Returns Read more
fn particles(&self) -> &[Particle]
fn particles_mut(&mut self) -> &mut [Particle]
Source§fn for_each_particle_pairs_mut(
&mut self,
f: &mut dyn FnMut(&mut Particle, &mut Particle),
)
fn for_each_particle_pairs_mut( &mut self, f: &mut dyn FnMut(&mut Particle, &mut Particle), )
The core method of the trait. Different implementations of Simulation vary
in performance as this is the heaviest part of the simulation. Invokes a lambda
callback for pair of particles in the simulation, with the following limitations: Read more
Source§fn particle_count(&self) -> usize
fn particle_count(&self) -> usize
The number of particles in the simulation.
Source§fn add_particles(&mut self, particles: Vec<Particle>)
fn add_particles(&mut self, particles: Vec<Particle>)
Set the particles in the simulation.
Source§fn args(&self) -> SimulationArgs
fn args(&self) -> SimulationArgs
Get the simulation arguments.
Source§fn set_args(&mut self, args: SimulationArgs)
fn set_args(&mut self, args: SimulationArgs)
Set the simulation arguments.
Source§fn for_each_particles(&self, f: &mut dyn FnMut(&Particle))
fn for_each_particles(&self, f: &mut dyn FnMut(&Particle))
Invokes a lambda callback for each particle in the simulation.
Source§fn for_each_particles_mut(&mut self, f: &mut dyn FnMut(&mut Particle))
fn for_each_particles_mut(&mut self, f: &mut dyn FnMut(&mut Particle))
Invokes a lambda callback for each particle (mutable) in the simulation.
Source§fn update_position(&mut self, delta_t: f64)
fn update_position(&mut self, delta_t: f64)
Updates the position of all particles.
Source§fn delay_force(&mut self)
fn delay_force(&mut self)
Delays the force.
Source§fn update_force(&mut self)
fn update_force(&mut self)
Updates the velocity of all particles.
Source§fn update_velocity(&mut self, delta_t: f64)
fn update_velocity(&mut self, delta_t: f64)
Updates the velocity of all particles.
Auto Trait Implementations§
impl Freeze for DirectSum
impl !RefUnwindSafe for DirectSum
impl !Send for DirectSum
impl !Sync for DirectSum
impl Unpin for DirectSum
impl !UnwindSafe for DirectSum
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more