MdState

Struct MdState 

Source
pub struct MdState {
    pub cfg: MdConfig,
    pub atoms: Vec<AtomDynamics>,
    pub adjacency_list: Vec<Vec<usize>>,
    pub force_field_params: ForceFieldParamsIndexed,
    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,
    /* private fields */
}

Fields§

§cfg: MdConfig§atoms: Vec<AtomDynamics>§adjacency_list: Vec<Vec<usize>>§force_field_params: ForceFieldParamsIndexed§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

Implementations§

Source§

impl MdState

Source

pub fn apply_bond_stretching_forces(&mut self)

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

pub fn apply_dihedral_forces(&mut self, improper: bool)

This maintains dihedral angles. (i.e. the angle between four atoms in a sequence). This models effects such as σ-bond overlap (e.g. staggered conformations), π-conjugation, which locks certain dihedrals near 0 or τ, and steric hindrance. (Bulky groups clashing).

This applies both “proper” linear dihedral angles, and “improper”, hub-and-spoke dihedrals. These two angles are calculated in the same way, but the covalent-bond arrangement of the 4 atoms differs.

Source

pub fn shake_hydrogens(&mut self)

Part of our SHAKE + RATTLE algorithms for fixed hydrogens.

Source

pub fn rattle_hydrogens(&mut self, mol_i: usize)

Part of our SHAKE + RATTLE algorithms for fixed hydrogens.

Source§

impl MdState

Source

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

One Velocity-Verlet step (leap-frog style) 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.

Source§

impl MdState

Source

pub fn build_neighbors_if_needed(&mut self)

Call during each step; determines if we need to rebuild neighbors, and does so A/R. todo: Run on GPU?

Source

pub fn rebuild_dy_water_inv(&mut self)

This inverts our neighbor set between water and dynamic atoms.

Source§

impl MdState

Source

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

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

Source§

impl MdState

Source

pub fn water_vv_first_half_and_drift(&mut self, dt: f32, dt_half: f32)

Verlet velocity integration for water, part 1. Forces for this step must be pre-calculated. Accepts as mutable to allow projecting M/EP force onto the other atoms.

In addition to the VV half-kick and drift, it handles force projection from M/EP, and applying SETTLE to main each molecul’s rigid geometry.

Source

pub fn water_vv_second_half(&mut self, dt_half: f32)

Velocity-Verlet integration for water, part 2. Forces (as .accel) must be computed prior to this step.

Source§

impl MdState

Source

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

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,