DirectSum

Struct DirectSum 

Source
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 Default for DirectSum

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Simulation for DirectSum

Source§

fn system_name(&self) -> &str

Returns Read more
Source§

fn particles(&self) -> &[Particle]

Source§

fn particles_mut(&mut self) -> &mut [Particle]

Source§

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

The number of particles in the simulation.
Source§

fn add_particles(&mut self, particles: Vec<Particle>)

Set the particles in the simulation.
Source§

fn get_force(&self) -> Arc<dyn Force>

Get the force calculation method.
Source§

fn set_force(&mut self, force: Arc<dyn Force>)

Set the force calculation method.
Source§

fn args(&self) -> SimulationArgs

Get the simulation arguments.
Source§

fn set_args(&mut self, args: SimulationArgs)

Set the simulation arguments.
Source§

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))

Invokes a lambda callback for each particle (mutable) in the simulation.
Source§

fn update_position(&mut self, delta_t: f64)

Updates the position of all particles.
Source§

fn delay_force(&mut self)

Delays the force.
Source§

fn update_force(&mut self)

Updates the velocity of all particles.
Source§

fn update_velocity(&mut self, delta_t: f64)

Updates the velocity of all particles.
Source§

fn step(&mut self, delta_t: f64)

TODO document

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.