Skip to main content

LammpsDataSectionBuilder

Struct LammpsDataSectionBuilder 

Source
pub struct LammpsDataSectionBuilder {
    pub masses: Vec<(usize, f64)>,
    pub pair_coeffs: Vec<(usize, usize, f64, f64)>,
    pub bond_coeffs: Vec<(usize, f64, f64)>,
    pub angle_coeffs: Vec<(usize, f64, f64)>,
}
Expand description

Builder for the coefficient sections of a LAMMPS data file.

Generates the Masses, Pair Coeffs, and Bond Coeffs sections.

Fields§

§masses: Vec<(usize, f64)>

(type_id, mass)

§pair_coeffs: Vec<(usize, usize, f64, f64)>

(type_i, type_j, epsilon, sigma)

§bond_coeffs: Vec<(usize, f64, f64)>

(bond_type, k, r0)

§angle_coeffs: Vec<(usize, f64, f64)>

(angle_type, k, theta0_deg)

Implementations§

Source§

impl LammpsDataSectionBuilder

Source

pub fn new() -> Self

Create an empty builder.

Source

pub fn add_mass(&mut self, type_id: usize, mass: f64)

Add a mass entry.

Source

pub fn add_pair_coeff( &mut self, type_i: usize, type_j: usize, epsilon: f64, sigma: f64, )

Add a Lennard-Jones pair coefficient.

Source

pub fn add_bond_coeff(&mut self, bond_type: usize, k: f64, r0: f64)

Add a harmonic bond coefficient.

Source

pub fn add_angle_coeff(&mut self, angle_type: usize, k: f64, theta0_deg: f64)

Add a harmonic angle coefficient.

Source

pub fn masses_section(&self) -> String

Generate the Masses section text.

Source

pub fn pair_coeffs_section(&self) -> String

Generate the Pair Coeffs section text.

Source

pub fn bond_coeffs_section(&self) -> String

Generate the Bond Coeffs section text.

Source

pub fn angle_coeffs_section(&self) -> String

Generate the Angle Coeffs section text.

Source

pub fn build(&self) -> String

Combine all sections into one string.

Trait Implementations§

Source§

impl Default for LammpsDataSectionBuilder

Source§

fn default() -> Self

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

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> 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, 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.