Skip to content

Stores and backends

dynome.create_store(path, topology, chunk_frames=None, annotations=None, provenance=None, overwrite=False)

Create an empty store, opened for appending.

An existing dynome store at path is replaced only with overwrite=True; any other existing file or directory is never touched.

dynome.open_store(path, mode='r')

Open a store lazily. mode="a" also allows append.

dynome.convert_to_store(source, path, top=None, chunk_frames=None, overwrite=False)

Copy a trajectory file into a store without loading it whole.

PDB, XYZ and dynome archives are read natively; other formats are streamed through MDTraj's iterload (pip install 'dynome[formats]').

dynome.StoredEnsemble

An ensemble kept on disk. Reads are lazy; append adds frames.

weights property

Normalised per-frame weights over the whole store.

__getitem__(key)

Frames as an in-memory Ensemble. Only the chunks that hold them are read.

append(xyz, time=None, unitcell_lengths=None, unitcell_angles=None, weights=None, members=None)

Add frames. xyz is an array (F, n_atoms, 3) in nm, or an Ensemble.

The first append fixes which optional fields the store has (time, unit cell, weights); later appends must supply the same ones. Weights may be omitted on a weighted store and then count 1 per frame.

average(values)

Weighted ensemble average of a per-frame observable (first axis = frames).

iter_chunks(chunk_frames=None, atom_indices=None, stride=1)

Yield consecutive in-memory Ensembles of at most chunk_frames frames.

load(atom_indices=None)

The whole store as an in-memory Ensemble.

map(fn, *args, chunk_frames=None, **kwargs)

Apply fn(chunk, *args, **kwargs) to every chunk and join the results by frame.

dynome.set_backend(name='numpy', device=None)

Select the backend. "auto" uses a CUDA or Apple GPU when PyTorch can see one.

Returns the backend actually chosen.

dynome.use_backend

Context manager: with dn.use_backend("torch"): ... restores the old backend after.

dynome.get_backend()

dynome.use_compiled(enabled=True)

Turn the compiled kernels (the dynome-accel package) on or off for the NumPy backend. Returns whether they are now in use; always False if the package is missing.