MdState

Struct MdState 

Source
pub struct MdState {
Show 14 fields pub cfg: MdConfig, pub atoms: Vec<AtomDynamics>, pub water: Vec<WaterMol>, pub adjacency_list: Vec<Vec<usize>>, pub time: f64, pub step_count: usize, pub snapshots: Vec<Snapshot>, pub cell: SimBox, pub neighbors_nb: NeighborsNb, pub water_pme_sites_forces: Vec<[Vec3; 3]>, pub kinetic_energy: f64, pub potential_energy: f64, pub neighbor_rebuild_count: usize, pub computation_time: ComputationTimeSums, /* private fields */
}

Fields§

§cfg: MdConfig§atoms: Vec<AtomDynamics>§water: Vec<WaterMol>§adjacency_list: Vec<Vec<usize>>§time: f64

Current simulation time, in picoseconds.

§step_count: usize§snapshots: Vec<Snapshot>

These are the snapshots we keep in memory, accumulating.

§cell: SimBox§neighbors_nb: NeighborsNb§water_pme_sites_forces: Vec<[Vec3; 3]>§kinetic_energy: f64

kcal/mol

§potential_energy: f64§neighbor_rebuild_count: usize§computation_time: ComputationTimeSums

Implementations§

Source§

impl MdState

Source

pub fn apply_angle_bending_forces(&mut self)

This maintains bond angles between sets of three atoms as they should be from hybridization. It reflects this hybridization, steric clashes, and partial double-bond character. This identifies deviations from the ideal angle, calculates restoring torque, and applies forces based on this to push the atoms back into their ideal positions in the molecule.

Valence angles, which are the angle formed by two adjacent bonds ba et bc in a same molecule; a valence angle tends to maintain constant the anglê abc. A valence angle is thus concerned by the positions of three atoms.

Source§

impl MdState

Source

pub fn step(&mut self, dev: &ComputationDevice, dt: f32)

Perform one integration step. This is the entry point for running the simulation. One step of length dt is in picoseconds (10^-12), with typical values of 0.001, or 0.002ps (1 or 2fs). This method orchestrates the dynamics at each time step. Uses a Verlet Velocity base, with different thermostat approaches depending on configuration.

Source§

impl MdState

Source

pub fn apply_nonbonded_forces(&mut self, dev: &ComputationDevice)

Run the appropriate force-computation function to get force on non-water atoms, force on water atoms, and virial sum for the barostat. Uses GPU if available.

Applies Coulomb and Van der Waals (Lennard-Jones) forces on non-water atoms, in place. We use the MD-standard [S]PME approach to handle approximated Coulomb forces. This function applies forces from non-water, and water sources.

Source§

impl MdState

Source

pub fn pack_atoms(&mut self)

Source§

impl MdState

Source

pub fn zero_linear_momentum_atoms(&mut self)

Remove center-of-mass drift for “atoms” only (exclude water).

Source

pub fn zero_angular_momentum_atoms(&mut self)

Remove rigid-body rotation for “atoms” only (exclude water). Computes ω from I ω = L about the atoms’ COM, then sets v’ = v - ω × (r - r_cm).

Source§

impl MdState

Source

pub fn minimize_energy(&mut self, dev: &ComputationDevice, max_iters: usize)

Relaxes the molecules. Use this at the start of the simulation to control kinetic energy that arrises from differences between atom positions, and bonded parameters. It can also be called externally. It also stabilizes the water molecules, so that their hydrogen bond structure is correct at initialization.

Uses flexible bonds to hydrogen. (Not Shake/Rattle constraints)

Source§

impl MdState

Source

pub fn new( dev: &ComputationDevice, cfg: &MdConfig, mols: &[MolDynamics], param_set: &FfParamSet, ) -> Result<Self, ParamError>

Source

pub fn computation_time(&self) -> Result<ComputationTime>

Source

pub fn save_snapshots_to_file(&mut self, path: &Path)

Trait Implementations§

Source§

impl Default for MdState

Source§

fn default() -> MdState

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

impl Display for MdState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for MdState

§

impl !RefUnwindSafe for MdState

§

impl !Send for MdState

§

impl !Sync for MdState

§

impl Unpin for MdState

§

impl !UnwindSafe for MdState

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,