nvalchemi.csp.RigidMoleculeASUZarrReader#

class nvalchemi.csp.RigidMoleculeASUZarrReader(store)[source]#

Read active rigid-molecule ASU representations from a CSP Zarr store.

Parameters:

store (StoreLike) – Path or Zarr-compatible store containing an existing CSP ASU dataset.

Notes

Selections index the current sequence of undeleted rows; call refresh after a writer changes the store.

read_batch requires an explicit selection to bound P1 expansion. Returned tensors are newly constructed and do not alias Zarr buffers. The reader snapshots root metadata and the active row mapping, not an immutable copy of stored payloads.

close()[source]#

Close this reader; subsequent operations raise RuntimeError.

Return type:

None

property field_names: list[str]#

Return stored field names in schema order.

get_metadata(indices)[source]#

Return selected rows’ atom and edge counts without P1 expansion.

Parameters:

indices (torch.Tensor) – One-dimensional int32/int64 indices in the active logical row space.

Returns:

int64 [selection_size, 2] metadata in selection order, including repeated indices. Column 0 is the full-cell atom count (formula-unit atom count times Z); column 1 is zero because the ASU store has no materialized neighbor edges.

Return type:

torch.Tensor

property metadata: Mapping[str, object]#

Read-only copy of root attributes.

read(indices=None, *, device='cpu')[source]#

Load selected active rows as an ASU batch.

Parameters:
  • indices (torch.Tensor or None, optional) – One-dimensional int32/int64 logical row indices. Order and repeated indices are preserved. None selects every active row.

  • device (torch.device or str, default="cpu") – Device for returned tensors.

Returns:

An owned ASU batch; formula input and selected row payloads are copied from the store.

Return type:

RigidMoleculeASUBatch

read_batch(indices, *, device='cpu')[source]#

Expand explicitly selected active logical rows into a Toolkit P1 batch.

Parameters:
  • indices (torch.Tensor) – Required one-dimensional int32/int64 indices in active logical row space. Order and repeated indices are preserved. None is rejected so callers must bound potentially large P1 expansion.

  • device (torch.device or str, default="cpu") – Device for the returned batch.

Returns:

A newly expanded P1 batch carrying source structure IDs.

Return type:

Batch

Raises:
  • TypeError – If indices is None or is not a one-dimensional int32/int64 tensor.

  • IndexError – If an index is outside the active logical row range.

refresh()[source]#

Reload reader metadata and active rows after appends, deletions, or defragmentation.

Existing selected results remain independent tensors; this reader’s logical-to-physical mapping and root metadata are replaced.

Return type:

None