pub struct AtomSet {
pub atom_types: Vec<AtomTypeDesc>,
pub positions: Vec<[f64; 3]>,
pub velocities: Vec<[f64; 3]>,
pub forces: Vec<[f64; 3]>,
pub type_indices: Vec<usize>,
pub box_size: f64,
}Expand description
A typed atom set that groups atoms by species.
Supports heterogeneous systems with multiple atom types, per-atom charges, and retrieval of all positions / velocities by type.
Fields§
§atom_types: Vec<AtomTypeDesc>Registered atom type descriptors.
positions: Vec<[f64; 3]>Per-atom position [x, y, z].
velocities: Vec<[f64; 3]>Per-atom velocity [vx, vy, vz].
forces: Vec<[f64; 3]>Per-atom force (accumulated each step) [fx, fy, fz].
type_indices: Vec<usize>Per-atom type index (into atom_types).
box_size: f64Simulation box size (cubic).
Implementations§
Source§impl AtomSet
impl AtomSet
Sourcepub fn register_type(&mut self, desc: AtomTypeDesc) -> usize
pub fn register_type(&mut self, desc: AtomTypeDesc) -> usize
Register an atom type and return its index.
Sourcepub fn add_atom(&mut self, position: [f64; 3], type_idx: usize) -> usize
pub fn add_atom(&mut self, position: [f64; 3], type_idx: usize) -> usize
Add an atom at position with the given type index. Returns atom index.
Sourcepub fn positions_of_type(&self, type_idx: usize) -> Vec<[f64; 3]>
pub fn positions_of_type(&self, type_idx: usize) -> Vec<[f64; 3]>
Return all positions of atoms with type index type_idx.
Sourcepub fn net_charge(&self) -> f64
pub fn net_charge(&self) -> f64
Net charge of the system (sum of all partial charges).
Sourcepub fn kinetic_energy(&self) -> f64
pub fn kinetic_energy(&self) -> f64
Total kinetic energy.
Sourcepub fn temperature(&self) -> f64
pub fn temperature(&self) -> f64
Temperature from equipartition (reduced units k_B = 1).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AtomSet
impl<'de> Deserialize<'de> for AtomSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AtomSet
impl RefUnwindSafe for AtomSet
impl Send for AtomSet
impl Sync for AtomSet
impl Unpin for AtomSet
impl UnsafeUnpin for AtomSet
impl UnwindSafe for AtomSet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.