Skip to main content

ObservationArchive

Struct ObservationArchive 

Source
pub struct ObservationArchive { /* private fields */ }
Expand description

Fixed-composition archive of oracle evaluations.

Implementations§

Source§

impl ObservationArchive

Source

pub fn open(dir: impl AsRef<Path>, z: Vec<u32>, cell: [f64; 3]) -> Result<Self>

Open (or create) the archive at dir for one fixed composition. z is the per-atom atomic-number list in caller order; cell the orthorhombic box lengths. The corpus lives at dir/observations.rdb; trajectory ids continue across restarts.

Source

pub fn append(&self, positions: &[f64], forces: &[f64], energy: f64) -> bool

Enqueue one evaluation. positions and forces are flat 3 * natoms buffers in caller order. Returns false only when the row cannot be enqueued (wrong length, archive closing); disk-side failures are counted in Self::dropped instead.

Source

pub fn flush(&self)

Block until every previously enqueued row is committed (or counted dropped). Call before reading the corpus back.

Source

pub fn committed(&self) -> u64

Rows committed to the corpus (including prior runs).

Source

pub fn appended(&self) -> u64

Rows accepted by append, including any still in the writer queue (and prior runs). appended - dropped equals committed once flushed.

Source

pub fn dropped(&self) -> u64

Rows the writer could not persist.

Source

pub fn natoms(&self) -> usize

Atoms per row.

Source

pub fn dir(&self) -> &Path

Archive directory.

Source

pub fn fetch(&self, index: u64) -> Result<(Vec<f64>, Vec<f64>, f64)>

Fetch committed row index in the caller’s original atom order (the stored type-grouped permutation is inverted through the frame’s atom_ids). Flush first for a complete snapshot.

Trait Implementations§

Source§

impl Drop for ObservationArchive

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.