Skip to content

Python Reference

import molrs

The top level of molrs is its subsystems, plus the core data classes a user handles directly. Those classes are the same objects as molrs.core's (molrs.Frame is molrs.core.Frame). No function, algorithm, region or unit preset is promoted; everything else has one path, the Python module named after its Rust owner. Import either way:

from molrs import Frame, Block, Trajectory, Topology
from molrs.core import Box, NeighborList
from molrs.ff.compile import PotentialCompiler

This page is rendered from the installed molrs package by mkdocstrings-python. The type stub molrs-python/python/molrs/_native.pyi is the committed companion artifact that keeps signatures visible to static tools and the docs build.

Module Rust owner Holds
molrs.core molrs::core Block, Frame, FrameMeta, MetaValue, MetaDocument, Trajectory, ObservableRecord, BlockDtypeError; Box (Rust SimBox) and its Cell, NeighborList, Neighbors, NeighborQuery, VerletSkin, the regions, TriMesh, Trace; MolGraph, Atomistic, CoarseGrain, the node / relation views, ExtractedSubgraph, Element, BondOrder, BondNumber, Topology; Unit, Quantity, UnitRegistry, UnitPreset, UnitsError
molrs.core.keys molrs::core::keys the canonical column, frame-meta and graph keys
molrs.core.schema molrs::core::schema ColumnSpec, BlockSpec, the block names, relation_endpoints
molrs.core.constants molrs::core::constants every physical and engine constant (AVOGADRO, COULOMB_REAL, AMBER_COULOMB, AMBER_SCEE, …)
molrs.op molrs::op superpose, centroid, place_from_internal_coords, Superposition, DEFAULT_GAP_TOL
molrs.perceive molrs::perceive perceive_rings → RingSet, the perceive_* / assign_* functions, add_hydrogens, SmartsPattern, SmartsMatch, Reaction, SubgraphMatcher
molrs.io molrs::io every file reader and writer, one door per format and direction: read_<fmt>(source) / write_<fmt>(sink, frame) (a source is an os.PathLike, bytes or Text; a sink an os.PathLike or a bytearray) — structure and trajectory files, write_mrec, wire-encoded frames (read_wire_frame / write_wire_frame), the LAMMPS log, CSV blocks; Text, CubeReader, XmlForcefieldReader / XmlForcefieldWriter
molrs.io.pdb, .xyz, .gro, .mol2, .cif, .sdf, .dcd, .trr, .xtc molrs::io::{pdb, xyz, gro, mol2, cif, sdf, dcd, trr, xtc} each format's multi-frame classes: <Fmt>Reader(source) and (all but SDF) <Fmt>Writer(sink)
molrs.io.lammps molrs::io::lammps LammpsDumpReader / LammpsDumpWriter, LammpsForcefieldReader / LammpsForcefieldWriter, BondReactTemplate, the Lammps* log records, is_lammps_log
molrs.io.gromacs, .amber, .openmm_xml molrs::io::{gromacs, amber, openmm_xml} the force-field classes: GromacsTopForcefieldReader / Writer, AmberPrmtopForcefieldReader, AmberFrcmodWriter, OpenmmXmlReader / Writer
molrs.io.smiles molrs::io::smiles read_smiles, read_smiles_fragment, write_smiles; SmilesIr, FragmentIr, SmilesError, BondingDescriptor
molrs.io.cgsmiles molrs::io::cgsmiles read_cgsmiles; CgSmilesIr and the CGsmiles records
molrs.io.mrec molrs::io::mrec MrecFile, MrecReader, MrecWriter, SequenceSchema, ForceFieldSection, pack_mrec_zip, validation
molrs.ff.forcefield molrs::ff::forcefield ForceField, the Style / ForceFieldType handles (the data model; its files are molrs.io's)
molrs.ff.potential molrs::ff::potential Potentials, WeightedTerms, PairLjCut, intramolecular_pairs, Potential
molrs.ff.compile molrs::ff::compile PotentialCompiler, ExplicitTerms
molrs.ff.typifier molrs::ff::typifier Typifier, TypeAssignment, the built-in typifiers, assign_cmaps
molrs.ff.charge molrs::ff::charge BccModel, MullikenModel, GasteigerModel
molrs.ff.ir molrs::ff::ir the force-field IR's vocabulary (ParamSpec, StyleSpec, CategorySpec) and its IrError family
molrs.ff.style_registry molrs::ff::style_registry register_category, register_style, register_engine_form, unregister_style, StyleDeclaration, styles, categories, evaluate
molrs.ff.params molrs::ff::params clpol_polarizability
molrs.ff.clpol_scaling molrs::ff::clpol_scaling FragmentScaling, compute_k_ij, scale_lj, fragment_table (the shipped table)
molrs.optimize molrs::optimize Lbfgs, OptimizationReport
molrs.md molrs::md MD, Phase, VelocityVerlet, FixLangevin, NeighborList, MaxwellBoltzmann
molrs.conformer molrs::conformer Conformer, ConformerReport, ConformerStageReport
molrs.builder molrs::builder GrapheneBuilder, CarbonTubeBuilder, Assembler and its placers / orienter, Coarsener
molrs.compute molrs::compute one class per compute type, flat; their results; ComputeSpec; the Compute protocol
molrs.stream molrs::stream Publisher, PublisherConfig, ControlCommand

Where Python's shape differs from Rust's

These binding classes have no one-to-one Rust type. Each is deliberate: it makes the Python object behave the way Python code uses it, and the Rust names it maps onto are listed here.

Python Rust Why
molrs.core.RelationRef and its per-kind subclasses Bond (itom, jtom), Angle, Dihedral, Improper, CgBond, Port (anchor, handle_atom) one molrs::core::Relation (a kind name, endpoint handles and fields) A view's class is its relation kind, so isinstance(r, Bond) and the named endpoints work; every view reads and writes the same graph row a Relation does. A user-registered kind is a plain RelationRef.
molrs.ff.typifier.Typifier and the built-in typifiers (Mmff94Typifier, GaffTypifier, …): assign, typify, forcefield the trait molrs::ff::typifier::Typifier (assign, source_forcefield) plus the driver Typing<T> (typify, forcefield) Rust splits them because a trait cannot hold the output force field that typing accumulates; a Python class can, so one object is both. Typifier.assign is the trait's method; typify and forcefield are Typing's.
molrs.compute.CombinedDistribution and its CombinedDistributionResult CombinedDistribution<N> / CombinedDistributionResult<N> for N = 2, 3 A Python class cannot be generic over a constant, so the number of observables picks N; spec() is the one registered CombinedDistribution descriptor.
molrs.compute.PmftResult, molrs.compute.Histogram PmftResult<C> for each Pmft<C> (PmftR12, PmftXy, PmftXyt, PmftXyz); Histogram<N> One result class per generic type: the arrays carry their own dimension.

molrs.core

Block

Heterogeneous column store exposed to Python as molrs.core.Block.

Each column is a named, typed array. All columns share the same number of rows (axis-0 length). The underlying storage lives in an FFI Store and is accessed through a version-tracked [BlockHandle]; a block read from a frame (frame["atoms"]) is a handle on the frame's stored block, so every method below reads and writes the frame's data.

A column is dense, so a per-row component that only some rows carry is stored alongside a validity mask: Block.validity(key) returns it, or None when every cell of that column is a real value.

Every column-key argument accepts a str or a :class:molrs.core.keys.Key.

Python Examples

import numpy as np
from molrs.core import Block

b = Block({"x": [1.0, 2.0, 3.0], "element": ["C", "H", "H"]})
assert b.n_rows == 3
assert "x" in b
arr = b["x"]                 # zero-copy numpy view
names = b["element"]         # numpy str array; a copy, shape preserved
xyz = b["x", "x", "x"]             # (3, 3) stacked columns
sub = b[b["x"] > 1.5]       # a new Block of the selected rows
assert b.validity("x") is None   # no holes in that column

__doc__ = 'Heterogeneous column store exposed to Python as `molrs.core.Block`.\n\nEach column is a named, typed array. All columns share the same number of\nrows (axis-0 length). The underlying storage lives in an FFI `Store` and is\naccessed through a version-tracked [`BlockHandle`]; a block read from a\nframe (``frame["atoms"]``) is a handle on the frame\'s stored block, so every\nmethod below reads and writes the frame\'s data.\n\nA column is dense, so a per-row component that only some rows carry is\nstored alongside a validity mask: `Block.validity(key)` returns it, or\n`None` when every cell of that column is a real value.\n\nEvery column-key argument accepts a ``str`` or a :class:`molrs.core.keys.Key`.\n\n# Python Examples\n\n```python\nimport numpy as np\nfrom molrs.core import Block\n\nb = Block({"x": [1.0, 2.0, 3.0], "element": ["C", "H", "H"]})\nassert b.n_rows == 3\nassert "x" in b\narr = b["x"] # zero-copy numpy view\nnames = b["element"] # numpy str array; a copy, shape preserved\nxyz = b["x", "x", "x"] # (3, 3) stacked columns\nsub = b[b["x"] > 1.5] # a new Block of the selected rows\nassert b.validity("x") is None # no holes in that column\n```' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

coords property

Positions as an (n_rows, 3) float64 array, gathered from the x / y / z columns (a copy).

Assigning an (N, 3) array-like writes it back into x / y / z (each replaced as a float64 column; a missing one is added).

Raises:

Type Description
KeyError

On read, if x, y or z is missing.

ValueError

On write, if the array is not (N, 3) or N differs from the block's row count.

n_rows property

Number of rows (axis-0 length); 0 for a block with no rows.

Returns:

Type Description
int

shape property

Reported shape: [n_rows] for a table, the declared N-D shape for a grid, [] for an empty block.

structural_shape property

Explicit N-D structural shape, or None for a plain row table.

__contains__(key) method descriptor

Return bool(key in self).

__delitem__(key) method descriptor

Delete self[key].

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__reduce__() method descriptor

Pickle by logical state: columns, validity masks, declared precisions, row count and structural shape.

__repr__() method descriptor

Return repr(self).

__setitem__(key, value) method descriptor

Set self[key] to value.

__setstate__(state) method descriptor

Restore the state __reduce__ produced.

copy() method descriptor

A deep copy: new buffers for every column, masks and shape included.

Writing into the copy's columns (through numpy) never reaches this block, nor the numpy array a column was built from.

dtype(key) method descriptor

Return the dtype string for the given column.

Returns:

Type Description
str

"float", "int", "i64", "uint", "bool", "u8", "string", …

Raises:

Type Description
KeyError

If key does not exist.

insert(key, values, validity=None) method descriptor

Insert a numpy array (or list of strings) as a named column, at the width given.

The typed write: unlike block[key] = array it does not convert to the schema dtype (an i64 column stays i64; a narrow float is promoted to float64, the one float width); a dtype the schema refuses raises. If a column with the same key already exists it is replaced. The array length must match the row count of existing columns, or the block must be empty.

validity optionally attaches a per-row mask — the write side of :meth:validity. validity[i] is False where row i of values is a hole: the array still carries something there (typically a zero) and the mask is the only place that says it is not a stated value. An all-True mask states nothing and is dropped, so :meth:validity keeps answering None.

Parameters:

Name Type Description Default
key str | Key

Column name (e.g. "x", "element").

required
values ndarray | list[str]

Column data.

required
validity ndarray | Sequence[bool] | None

1-D boolean mask in row order, one entry per row of values.

None

Raises:

Type Description
TypeError

If the array dtype is not supported, or validity is not a 1-D bool array or a sequence of bools.

ValueError

If the row count does not match existing columns, or validity does not have exactly one entry per row of values.

Examples:

>>> b = Block()
>>> b.insert("x", np.zeros(3, dtype=np.float32))
>>> b.insert("frag_id", np.array([7, 0, 0]), [True, False, False])
>>> b.validity("frag_id")
array([ True, False, False])

keys() method descriptor

List all column names.

precision(key) method descriptor

The declared precision of a column, or None when it declares none.

Raises:

Type Description
KeyError

If key does not exist in this block.

rename(old_key, new_key) method descriptor

Rename a column in place, keeping its data and validity mask.

Renaming is a write into new_key: when the Frame schema declares new_key with a different dtype, the column adopts it if the values survive the conversion (a file's int64 serial renamed onto id becomes uint), and the rename is refused otherwise.

Parameters:

Name Type Description Default
old_key str | Key

Existing column name.

required
new_key str | Key

New column name.

required

Raises:

Type Description
KeyError

If old_key does not exist or new_key already does.

ValueError

If the values do not survive the schema dtype of new_key.

resize(n_rows) method descriptor

Axis-0 length of an empty block, or reshape every column.

set_precision(key, precision) method descriptor

Declare (or, with None, withdraw) the precision of an f64 column: an absolute tolerance in the column's own units.

A record writer rounds the column to the largest power of two not above precision (ties to even) before storing it, so the stored values are within precision / 2 of these and compress several times better; the values in memory are not touched. The declaration is stored with the column (frame / system) or in the trajectory's schema, and reads back. A rename keeps it; replacing the column with another dtype, or removing it, drops it.

Parameters:

Name Type Description Default
key str | Key

Column name.

required
precision float | None

Finite, within [2**-1000, 2**1000]; None withdraws it.

required

Raises:

Type Description
KeyError

If key does not exist in this block.

ValueError

If the column is not float64 or precision is out of bounds.

Examples:

>>> b = molrs.core.Block({"x": np.array([0.12345, 1.5])})
>>> b.set_precision("x", 1e-3)
>>> b.precision("x")
0.001

set_shape(shape) method descriptor

Declare this block as N-dimensional. Product of shape must equal the row count when the block has columns.

set_target(key, target) method descriptor

Declare (or, with None, withdraw) that a uint64 column holds 0-based row indices into target: "<block>" of the same frame, or "/<section>/<block>" of a frame-shaped section of the record ("/frame/atoms").

The relation endpoints atomi … atoml reference atoms without one; a declaration overrides that, and names what any other referencing column (members.atom) points into. Subsetting and replicating renumber same-frame references; a *.mrec writer and reader refuse a reference that does not resolve.

Raises:

Type Description
KeyError

If key does not exist in this block.

ValueError

If the column is not uint64 or target is malformed or names a trajectory block ("/trajectory/…").

set_validity(key, mask) method descriptor

Attach a validity mask to an existing column, whatever its dtype.

mask[i] is False where row i holds no value. The mask replaces any the column had; an all-True mask clears it, so :meth:validity answers None afterwards.

Parameters:

Name Type Description Default
key str | Key

Column name.

required
mask ndarray | Sequence[bool]

1-D boolean mask, one entry per row.

required

Raises:

Type Description
KeyError

If key does not exist in this block.

TypeError

If mask is not a 1-D bool array or a sequence of bools.

ValueError

If mask does not have exactly one entry per row.

sort(key, reverse=False) method descriptor

Return a new Block sorted by the key column (original unchanged).

Parameters:

Name Type Description Default
key str | Key

Column to sort by.

required
reverse bool

Descending order (the ascending order reversed). Default False.

False

Raises:

Type Description
KeyError

If key is not a column.

stack(parts) staticmethod

Row-wise union of parts: their rows in order, under the union of their columns (first-seen order).

A column a part lacks is filled with the dtype's default for that part's rows and marked null in the column's validity mask. A part's own masks travel with its rows. The parts are not modified.

Parameters:

Name Type Description Default
parts Sequence[Block]
required

Returns:

Type Description
Block

A new block (new buffers).

Raises:

Type Description
ValueError

If two parts carry one column under different dtypes or per-row shapes.

Examples:

>>> s = Block.stack([Block({"x": [0.0]}), Block({"x": [1.0], "q": [2.0]})])
>>> s.validity("q")
array([False,  True])

target(key) method descriptor

The declared target of a column, or None.

Raises:

Type Description
KeyError

If key does not exist in this block.

targets() method descriptor

Every declared target, as {column: target}.

validity(key) method descriptor

The validity mask of a column, or None when the column has no holes.

A block column is dense, so a component that only some rows carry — frag_id on a partially labelled molecule, h_count declared on one bracket atom — needs a second array saying which cells are real. None is the common case and means "every cell is a stated value"; it is not an all-True array, and a caller must not read a missing mask as "all holes". A key that names no column is a different question and raises KeyError, as indexing and :meth:dtype do — were it to answer None, a misspelled key would read as a dense column.

Parameters:

Name Type Description Default
key str | Key

Column name.

required

Returns:

Type Description
ndarray | None

A 1-D bool array in row order — True where the cell holds a real value, False where it is a hole — or None when the column carries no mask.

Raises:

Type Description
KeyError

If key does not exist in this block.

Frame

Hierarchical data container exposed to Python as molrs.core.Frame.

A Frame is a dictionary of named Blocks with optional simulation box and metadata. It is the primary exchange format for molecular data across the molrs ecosystem, and the only Frame class: every reader, graph serialiser and builder returns it.

Python Examples

import numpy as np
from molrs.core import Box
from molrs.core import Frame

frame = Frame(
    {"atoms": {"element": ["O", "H", "H"], "x": [0.0, 0.76, -0.76]}},
    meta={"title": "water"},
    box=Box.cube(10.0),
)
frame["atoms"]["y"] = np.zeros(3)   # writes into the stored block
print(frame)          # Frame(blocks=['atoms'], box=yes)

__doc__ = 'Hierarchical data container exposed to Python as `molrs.core.Frame`.\n\nA `Frame` is a dictionary of named [`Block`](crate::core::block::PyBlock)s with\noptional simulation box and metadata. It is the primary exchange format for\nmolecular data across the molrs ecosystem, and the only `Frame` class:\nevery reader, graph serialiser and builder returns it.\n\n# Python Examples\n\n```python\nimport numpy as np\nfrom molrs.core import Box\nfrom molrs.core import Frame\n\nframe = Frame(\n {"atoms": {"element": ["O", "H", "H"], "x": [0.0, 0.76, -0.76]}},\n meta={"title": "water"},\n box=Box.cube(10.0),\n)\nframe["atoms"]["y"] = np.zeros(3) # writes into the stored block\nprint(frame) # Frame(blocks=[\'atoms\'], box=yes)\n```' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

box property

The simulation :class:Box attached to this frame, or None.

Returns:

Type Description
Box | None

Periodic simulation box, if set.

Examples:

>>> if frame.box is not None:
...     print(frame.box.volume())

coords property

The atoms block's positions as an (N, 3) float64 array (a copy), gathered from its x / y / z columns.

Assigning an (N, 3) array-like writes it back into atoms (created when the frame has none).

Raises:

Type Description
KeyError

On read, if there is no atoms block or it lacks x, y or z.

ValueError

On write, if the array is not (N, 3) or N differs from the atoms row count.

meta property

Live, write-through view of this frame's metadata.

Every door hands back a frozen value: scalars unwrap, a fixed-length vector is a tuple, a JSON array is a tuple, and a JSON object is a :class:MetaDocument. frame.meta["run"]["step"] = 3 raises TypeError. json.dumps rejects a document; use json.dumps(frame.meta["run"].copy()). Order inside a nested document is unspecified.

Returns:

Type Description
FrameMeta

Mutations of the mapping persist. dtype(k) reports the tag stored right now; a plain write re-infers it, and a :class:MetaValue fixes the dtype of that one write. A tag survives a round trip through a *.mrec frame or system, a declared sequence schema and the serde frame document.

__contains__(key) method descriptor

Return bool(key in self).

__delitem__(key) method descriptor

Delete self[key].

__getitem__(key) method descriptor

Return self[key].

__len__() method descriptor

Return len(self).

__reduce__() method descriptor

Pickle by logical state: the blocks, the typed metadata and the box.

__repr__() method descriptor

Return repr(self).

__setitem__(key, value) method descriptor

Set self[key] to value.

__setstate__(state) method descriptor

Restore the state __reduce__ produced.

concat(frames) staticmethod

The frames joined end to end, block by block — :meth:replicate for parts that differ.

Every block name any part has becomes one block of the parts' rows in order; a column one part lacks is filled for its rows and marked null. Every endpoint of a relation block (bonds, angles, …, or any block carrying atomi..atoml) in part p is offset by the rows the block it indexes has in the parts before it. Every other column — id / mol_id included — is copied verbatim. meta and the box are the first part's. No part is modified.

Parameters:

Name Type Description Default
frames Sequence[Frame]

The parts, in order; none gives an empty frame.

required

Returns:

Type Description
Frame

A new, independent frame.

Raises:

Type Description
ValueError

If a relation block indexes a block its part lacks or lacks a UInt endpoint column, or two parts carry one column under different dtypes.

copy() method descriptor

Return a deep copy of this frame.

All blocks (new column buffers), the simulation box, and typed metadata are copied into a new, independent frame backed by its own store.

Returns:

Type Description
Frame

An independent copy.

keys() method descriptor

List all block names.

Returns:

Type Description
list[str]

replicate(count) method descriptor

A new frame holding count copies of this one, concatenated block by block — the inverse of :meth:subset for count identical molecules.

Copy c of row r lands at c * nrows + r. Every endpoint of a relation block (bonds, angles, …, or any block carrying atomi..atoml) in copy c is offset by c times the row count of the block it indexes. Every other column — identifiers (id, mol_id) included — is copied verbatim; regenerate them if the copies need distinct labels. Validity masks travel; meta and the box are copied unchanged. This frame is never modified.

Parameters:

Name Type Description Default
count int

Number of copies; 0 gives zero-row blocks.

required

Returns:

Type Description
Frame

A new, independent frame.

Raises:

Type Description
ValueError

If a relation block indexes a block the frame lacks, lacks a UInt endpoint column, or the frame carries a members block.

subset(rows, block='atoms') method descriptor

A new frame holding rows rows of block, with every relation block that indexes it cut down and renumbered.

Old row rows[k] becomes new row k; every column travels. A relation block whose endpoints index block (bonds, angles, …, or any block carrying atomi..atoml) keeps only the rows whose endpoints all lie in the selection, in their original order, with each endpoint rewritten. Every other block, the box and meta are copied unchanged. Values keep their units. This frame is never modified.

Parameters:

Name Type Description Default
rows ArrayLike

A 1-D bool mask of length block.nrows (e.g. frame["atoms"]["mol_id"] == 1), which keeps its True rows in order, or 1-D integer row indices, which may be negative down to -nrows; the k-th selected old row becomes new row k.

required
block str

The block to select from (default "atoms").

'atoms'

Returns:

Type Description
Frame

A new, independent frame (no buffer shared with this one).

Raises:

Type Description
KeyError

If there is no block block.

IndexError

If rows is not 1-D, a mask has the wrong length, or an index is below -nrows.

TypeError

If rows is neither bool nor integer.

ValueError

If a row is past the end or repeated, a relation block indexing block lacks a UInt endpoint column, or the frame carries a members block.

validate() method descriptor

Judge this frame against the canonical Frame schema.

Delegates to molrs's Validator::canonical — dtype, shape, required columns, and endpoint ranges. Callers must not re-implement those checks in Python.

Raises:

Type Description
ValueError

If the frame does not conform (message is the full report).

FrameMeta

Live, write-through view of a frame's metadata.

Every door hands back a frozen value. Scalars unwrap, a fixed-length vector is a tuple (not a list), a JSON array — including one nested inside a document — is a tuple, and a JSON object is a MetaDocument. Writing a value lands in the frame. copy is the only mutable container this surface hands out; its values are still frozen, and MetaDocument::copy is that unfreeze one level down.

dtype reports the tag of the value stored right now; any plain write re-infers it. MetaValue fixes the dtype of that write only — it does not pin the key. A tag survives a round trip through a *.mrec frame or system (_meta_types), a declared sequence schema and the serde frame document.

frame.meta["run"]["step"] = 3 raises TypeError. Read, unfreeze, write back: doc = frame.meta["run"].copy(); doc["step"] = 3; frame.meta["run"] = doc. json.dumps accepts a tuple and rejects a document; the idiom is json.dumps(frame.meta["run"].copy()).

Iteration order of this mapping is insertion order. Order inside a nested MetaDocument is unspecified.

keys, values, and items are live collections.abc views in insertion order. A non-str lookup is absent; a non-str write raises TypeError. Deleting a not-yet-visited key while iterating values() or items() raises KeyError.

__doc__ = 'Live, write-through view of a frame\'s metadata.\n\nEvery door hands back a frozen value. Scalars unwrap, a fixed-length vector\nis a `tuple` (not a `list`), a JSON array — including one nested inside a\ndocument — is a `tuple`, and a JSON object is a [`MetaDocument`](PyMetaDocument).\nWriting a value lands in the frame. [`copy`](Self::copy) is the only mutable\ncontainer this surface hands out; its values are still frozen, and\n[`MetaDocument::copy`](PyMetaDocument::copy) is that unfreeze one level down.\n\n[`dtype`](Self::dtype) reports the tag of the value stored right now; any\nplain write re-infers it. [`MetaValue`](PyMetaValue) fixes the dtype of that\nwrite only — it does not pin the key. A tag survives a round trip through a\n`*.mrec` frame or system (`_meta_types`), a declared sequence schema and the\nserde frame document.\n\n`frame.meta["run"]["step"] = 3` raises `TypeError`. Read, unfreeze, write\nback: `doc = frame.meta["run"].copy(); doc["step"] = 3; frame.meta["run"] = doc`.\n`json.dumps` accepts a tuple and rejects a document; the idiom is\n`json.dumps(frame.meta["run"].copy())`.\n\nIteration order of this mapping is insertion order. Order inside a nested\n[`MetaDocument`](PyMetaDocument) is unspecified.\n\n[`keys`](Self::keys), [`values`](Self::values), and [`items`](Self::items)\nare live `collections.abc` views in insertion order. A non-`str` lookup is\nabsent; a non-`str` write raises `TypeError`. Deleting a not-yet-visited\nkey while iterating `values()` or `items()` raises `KeyError`.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__contains__(key) method descriptor

Return bool(key in self).

__delitem__(key) method descriptor

Delete self[key].

__eq__(value) method descriptor

Return self==value.

__ge__(value) method descriptor

Return self>=value.

__getitem__(key) method descriptor

Return self[key].

__gt__(value) method descriptor

Return self>value.

__ior__(value) method descriptor

Return self|=value.

__iter__() method descriptor

Implement iter(self).

__le__(value) method descriptor

Return self<=value.

__len__() method descriptor

Return len(self).

__lt__(value) method descriptor

Return self<value.

__ne__(value) method descriptor

Return self!=value.

__or__(value) method descriptor

Return self|value.

__repr__() method descriptor

Return repr(self).

__ror__(value) method descriptor

Return value|self.

__setitem__(key, value) method descriptor

Set self[key] to value.

copy() method descriptor

A plain dict snapshot; mutating it does not touch the frame.

dtype(key) method descriptor

The dtype tag stored for key, or None when the key is absent.

typed() method descriptor

The same snapshot with every dtype kept, as dict[str, MetaValue].

dict(meta) throws the tags away, which is the right default for reading; this is what a copy or a pickle has to carry instead.

MetaValue

Exact-dtype frame metadata value.

__doc__ = 'Exact-dtype frame metadata value.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

dtype property

value property

__repr__() method descriptor

Return repr(self).

Every door of frame.meta hands back a frozen value: a fixed-length vector is a tuple, and a JSON object is a MetaDocument. Nested arrays are tuples. json.dumps accepts a tuple and rejects a document — use json.dumps(frame.meta["run"].copy()). Order inside a nested document is unspecified.

MetaDocument

Frozen JSON object returned by every frame.meta door.

A fixed-length vector comes back as a tuple and a JSON object as a MetaDocument. Nested arrays are tuples; nested objects are documents. Item assignment raises TypeError — the snapshot does not write through. copy() is the unfreeze: a deep plain dict whose nested documents are dicts and whose nested arrays are lists. json.dumps rejects a document and accepts that copy: json.dumps(frame.meta["run"].copy()).

Iteration order is unspecified. frame.meta itself enumerates in insertion order; the two levels differ.

__doc__ = 'Frozen JSON object returned by every ``frame.meta`` door.\n\nA fixed-length vector comes back as a ``tuple`` and a JSON object as a\n``MetaDocument``. Nested arrays are tuples; nested objects are documents.\nItem assignment raises ``TypeError`` — the snapshot does not write through.\n``copy()`` is the unfreeze: a deep plain ``dict`` whose nested documents are\ndicts and whose nested arrays are lists. ``json.dumps`` rejects a document\nand accepts that copy: ``json.dumps(frame.meta["run"].copy())``.\n\nIteration order is unspecified. ``frame.meta`` itself enumerates in\ninsertion order; the two levels differ.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__contains__(key) method descriptor

Return bool(key in self).

__eq__(value) method descriptor

Return self==value.

__ge__(value) method descriptor

Return self>=value.

__getitem__(key) method descriptor

Return self[key].

__gt__(value) method descriptor

Return self>value.

__iter__() method descriptor

Implement iter(self).

__le__(value) method descriptor

Return self<=value.

__len__() method descriptor

Return len(self).

__lt__(value) method descriptor

Return self<value.

__ne__(value) method descriptor

Return self!=value.

__reduce__() method descriptor

Pickle by content: the plain copy, rebuilt through _from_plain — a document has no constructor.

__repr__() method descriptor

Return repr(self).

copy() method descriptor

Deep plain decode. Nested documents become dicts, nested arrays lists.

Trajectory

An in-memory frame sequence with optional per-frame step / time labels.

len(traj), traj[i] (negative indices count from the end) and iteration give frames; traj[a:b:c] is the sub-trajectory of those frames with their labels, and :meth:map builds a new trajectory frame by frame. Lazy, seekable reading from disk is a file reader's (:mod:molrs.io), not this container's.

Parameters:

Name Type Description Default
frames

The :class:Frame sequence; each frame is copied in.

required
step

Optional int64 step label per frame.

None
time

Optional float64 time per frame.

None

Raises:

Type Description
ValueError

If step or time does not have one entry per frame.

__doc__ = "An in-memory frame sequence with optional per-frame ``step`` / ``time``\nlabels.\n\n``len(traj)``, ``traj[i]`` (negative indices count from the end) and\niteration give frames; ``traj[a:b:c]`` is the sub-trajectory of those\nframes with their labels, and :meth:`map` builds a new trajectory frame by\nframe. Lazy, seekable reading from disk is a file reader's\n(:mod:`molrs.io`), not this container's.\n\nParameters\n----------\nframes\n The :class:`Frame` sequence; each frame is copied in.\nstep\n Optional ``int64`` step label per frame.\ntime\n Optional ``float64`` time per frame.\n\nRaises\n------\nValueError\n If ``step`` or ``time`` does not have one entry per frame." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

frames property

step property

time property

__getitem__(key) method descriptor

Return self[key].

__len__() method descriptor

Return len(self).

__repr__() method descriptor

Return repr(self).

map(func) method descriptor

A new trajectory of func(frame) for every frame, keeping this one's step / time labels. This trajectory is not modified.

Raises:

Type Description
TypeError

If func returns something other than a :class:Frame.

ObservableRecord

A named observable and its metadata: molrs::core::ObservableRecord.

kind is the contract spelling, "scalar" or "vector"; another spelling is carried verbatim, as Rust's ObservableKind::Other.

Parameters:

Name Type Description Default
name

The observable's name.

required
kind

The contract spelling of the kind.

required
values

A numpy array, a scalar, or a list[str].

required

__doc__ = 'A named observable and its metadata: ``molrs::core::ObservableRecord``.\n\n``kind`` is the contract spelling, ``"scalar"`` or ``"vector"``; another\nspelling is carried verbatim, as Rust\'s ``ObservableKind::Other``.\n\nParameters\n----------\nname\n The observable\'s name.\nkind\n The contract spelling of the kind.\nvalues\n A numpy array, a scalar, or a ``list[str]``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

axes property

description property

domain property

kind property

The contract spelling of the observable's kind.

name property

sampling property

target property

time_dependent property

unit property

values property

__repr__() method descriptor

Return repr(self).

Atomistic

All-atom molecular graph, exposed to Python as molrs.core.Atomistic.

Atomistic(**props): the keywords are the graph's :attr:props. Every atom, bond, angle, dihedral, improper, port and term is a live view; a view's mapping is the one door to its fields (atom["x"] = 1.0, del bond["k"]).

__doc__ = 'All-atom molecular graph, exposed to Python as `molrs.core.Atomistic`.\n\n``Atomistic(**props)``: the keywords are the graph\'s :attr:`props`. Every\natom, bond, angle, dihedral, improper, port and term is a live view; a\nview\'s mapping is the one door to its fields (``atom["x"] = 1.0``,\n``del bond["k"]``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

angles property

Every angle, in row order.

atoms property

Every atom, in row order.

bonds property

Every bond, in row order.

dihedrals property

Every dihedral, in row order.

impropers property

Every improper, in row order.

n_angles property

Number of angles.

n_atoms property

Number of atoms.

n_bonds property

Number of bonds.

n_dihedrals property

Number of dihedrals.

n_impropers property

Number of impropers.

n_ports property

Number of ports.

ports property

Every port, in row order (empty when the graph carries none).

props property

Whole-graph annotations (a name, a provenance tag): the keyword arguments the graph was built with, as a live dict. A copy, a pickle and every graph derived from this one (perception, typing, conformers, subgraphs) carry them.

__copy__() method descriptor

copy.copy(graph): an independent copy with a copy of its :attr:props. Handles are preserved (view.handle of a node names the same node in the copy).

__deepcopy__(_memo) method descriptor

copy.deepcopy(graph): the same independent copy as copy.copy — a graph holds no Python objects to recurse into.

add_angle(a, b, c, /, **props) method descriptor

Add an angle a–b–c (b the vertex), carrying props, and return its view.

Raises:

Type Description
TypeError

If a value is not a bool, int, float or str.

ValueError

If an endpoint belongs to another graph, or a value contradicts the type an existing column holds; the graph is then unchanged.

add_atom(*, kind=None, **props) method descriptor

Add an atom carrying props and return its view.

Parameters:

Name Type Description Default
kind type[VirtualSite]

Keyword-only. Make the atom a virtual site of this class (VirtualSite, DrudeParticle or MasslessSite): its vsite field is stamped with the kind the class names. None (the default) makes a plain atom.

None
**props bool | int | float | str

The atom's fields. atomic_number (0..=118, 0 = wildcard) is required; a symbol is converted explicitly first (Element.by_symbol("C").z).

required

Returns:

Type Description
Atom

The new atom's view, of class kind when one is given.

Raises:

Type Description
TypeError

If a value is not a bool, int, float or str, or kind is not one of the three virtual-site classes.

ValueError

If props has no valid atomic_number, gives vsite together with kind, or a value contradicts the type an existing column holds; the graph is then unchanged.

add_bond(a, b, /, **props) method descriptor

Add a bond between atoms a and b of this graph, carrying props, and return its view.

Raises:

Type Description
TypeError

If a value is not a bool, int, float or str.

ValueError

If an endpoint belongs to another graph, or a value contradicts the type an existing column holds; the graph is then unchanged.

add_dihedral(a, b, c, d, /, **props) method descriptor

Add a proper dihedral a–b–c–d, carrying props, and return its view.

Raises:

Type Description
TypeError

If a value is not a bool, int, float or str.

ValueError

If an endpoint belongs to another graph, or a value contradicts the type an existing column holds; the graph is then unchanged.

add_improper(a, b, c, d, /, **props) method descriptor

Add an improper over a, b, c, d in its style's slot order, carrying props, and return its view.

Raises:

Type Description
TypeError

If a value is not a bool, int, float or str.

ValueError

If an endpoint belongs to another graph, or a value contradicts the type an existing column holds; the graph is then unchanged.

add_port(anchor, handle_atom, /, kind, label='', order=1) method descriptor

Record a bonding descriptor on the (anchor, handle_atom) valence and return the port's view.

Parameters:

Name Type Description Default
anchor

The node that keeps its place in the product (positional-only).

required
handle_atom

The node bonded to anchor that roots the leaving group (positional-only). Endpoint order is load-bearing.

required
kind str

The notation glyph -- one of "$", "<", ">", "!".

required
label str

Descriptor label; "" (the default) means unnamed.

''
order int

Multiplicity of the bond this port will form, 1 to 4 (default 1).

1

Raises:

Type Description
ValueError

If an endpoint belongs to another graph, kind is not one of the four glyphs, handle_atom is not bonded to anchor, that valence already carries a port, or order is not a definite bond number.

add_term(block, atoms, /, **props) method descriptor

Add a row to the term block block (cmaps, constraints, drudes, exclusions, pairs, virtual_sites, a block declared with :meth:declare_term, or any block this graph already holds) over atoms, carrying props, and return its view.

The block's arity is the one this graph registered for it, else the Frame schema's; the block is registered on first use.

Raises:

Type Description
ValueError

If block has typed methods (bonds, angles, dihedrals, impropers, ports), its arity is unknown or differs from len(atoms), an atom belongs to another graph, or a value does not fit its column; nothing is written then.

bond_between(a, b) method descriptor

The bond joining atoms a and b, or None.

canonical_order() method descriptor

Deterministic canonical atom order from canonical labeling, so two isomorphic graphs line up node by node.

center(nodes) method descriptor

Mass-weighted centre (Å) of atoms (views or a Refs).

R = sum_i m_i r_i / sum_i m_i, reading positions from x / y / z and masses from mass; a node listed twice counts twice. No periodic imaging: a group split across a box face must be unwrapped first (:meth:Box.unwrap).

Returns:

Type Description
(ndarray, shape(3), float64)

Raises:

Type Description
ValueError

If the set is empty, a node belongs to another graph, lacks a finite x / y / z or a finite, non-negative mass (the message names its handle), or the total mass is not positive.

declare_term(block, arity) method descriptor

Declare the term block block with arity atoms per row, so :meth:add_term accepts a block the Frame schema does not define (a force-field term such as urey_bradleys). Re-declaring a block at the same arity is a no-op.

Raises:

Type Description
ValueError

If block has typed methods, arity is 0, the Frame schema defines block at another arity, or the graph already holds it at another arity.

del_angle(relation) method descriptor

Delete angle; its view goes stale.

del_angles(relations) method descriptor

Delete every angle of angles (views or a Refs). Atomic.

del_atom(atom) method descriptor

Delete atom and every relation touching it; their views go stale.

Raises:

Type Description
ValueError

If atom belongs to another graph or was deleted already.

del_atoms(atoms) method descriptor

Delete every atom of atoms (views or a Refs) and every relation touching one. Atomic: on an error (an atom of another graph, a deleted atom, an atom listed twice) nothing is deleted.

del_bond(bond) method descriptor

Delete bond; its view goes stale.

del_bonds(bonds) method descriptor

Delete every bond of bonds (views or a Refs). Atomic: on an error nothing is deleted.

del_dihedral(relation) method descriptor

Delete dihedral; its view goes stale.

del_dihedrals(relations) method descriptor

Delete every dihedral of dihedrals (views or a Refs). Atomic.

del_improper(relation) method descriptor

Delete improper; its view goes stale.

del_impropers(relations) method descriptor

Delete every improper of impropers (views or a Refs). Atomic.

del_port(port) method descriptor

Delete port (its bond stays); its view goes stale.

del_ports(ports) method descriptor

Delete every port of ports (their bonds stay). Atomic.

del_term(term) method descriptor

Delete the term term; its view goes stale.

del_terms(terms) method descriptor

Delete every term of terms — views of ONE term block. Atomic: on an error nothing is deleted.

extract_subgraph(centers, radius, *, regenerate_topology=False, max_ring_size=None) method descriptor

Radius ball around centers (atom views or a Refs) over the bond graph.

When regenerate_topology is true, only bonds are copied and angles/dihedrals are perceived on the ball. When false, higher-order terms fully inside the ball are copied from the parent.

max_ring_size closes the ball on ring systems: a ring of at most that many atoms which the radius only partly reaches comes along whole, together with everything fused or bridged to it. A cut ring is not a smaller molecule — ring perception, and with it aromaticity and every ring-aware atom type, reads the remainder as something else. The added atoms lie beyond radius, so they arrive as context: their hops are larger than the radius asked for.

The bound is not a tuning knob, it is the claim's domain. Cutting a benzene changes the chemistry; cutting a 5000-membered macrocycle changes nothing any typifier can see, while closing on it would drag the whole loop into a ball that asked for nine atoms. Pass the largest ring your typifier can actually distinguish. None disables closure; the cost then, and with a bound, follows the ball and its neighbourhood — never the size of the parent graph.

from_frame(frame) staticmethod

Build an Atomistic from a :class:~molrs.core.Frame: one atom per atoms row (each needs atomic_number; convert symbols first with Element.fill_atomic_numbers), then the relation blocks.

generate_topology(gen_angle=True, gen_dihedral=True, gen_improper=False, clear_existing=False) method descriptor

Perceive angle, dihedral and improper relations from the bond graph.

Angles are 2-edge paths i-j-k and proper dihedrals 3-edge paths i-j-k-l over the bonds. Impropers are the molecular-mechanics reading: one [centre, i, j, k] quartet per atom with exactly three neighbours, centre first, peripherals sorted — not every 3-combination at every centre of degree >= 3, which would hand an sp3 carbon four quartets. Whether a trivalent centre is planar enough to carry the term is force-field data, not a graph property, so every one is emitted.

Idempotent; clear_existing deletes existing relations of the requested kinds first. Returns (n_angles_added, n_dihedrals_added, n_impropers_added).

induced_subgraph(nodes) method descriptor

The subgraph induced by atoms (views or a Refs), with the map {node of this graph: node of the subgraph}.

inherit_frag_ids() method descriptor

Propagate each frag_id to the unlabelled degree-1 atoms bonded to a labelled one (one pass); returns how many were labelled.

is_isomorphic(other) method descriptor

Whether self and other are isomorphic as labelled graphs.

leaving_group(port) method descriptor

The leaving group of port: the atoms of its handle's connected component once the anchor–handle bond is cut, in handle order.

Join port a to port b and return the new anchor–anchor bond.

Both leaving groups are deleted, their partial charge (e) folds onto the anchors, and the anchors are bonded with the port order. No coordinate moves.

Raises:

Type Description
ValueError

If a port belongs to another graph or is stale, the two ports do not accept each other, share an anchor, their anchors are already bonded, or the leaving groups overlap or reach an anchor; the graph is unchanged.

merge(other) method descriptor

Merge other into this graph and return its atoms, now in this graph, in other's former row order. other is left empty; its views go stale.

Raises:

Type Description
ValueError

If other is this graph, or a property of other contradicts the type this graph holds for that key (a string tag into an int tag column); this graph is then unchanged.

n_terms(block) method descriptor

Number of rows of the term block block.

neighbor_bonds(node) method descriptor

The bonds of atom, as (neighbour, bond) pairs.

port_on(anchor, handle_atom) method descriptor

The port on the (anchor, handle_atom) valence, or None.

replicate(template, rotations, translations, frag_ids) method descriptor

Grow this graph by one rigid copy of template per transform.

Copy c is template moved by rotations[c] @ r + translations[c] and every node of it is stamped frag_id = frag_ids[c]. Every relation of template is copied with it. Column-wise and atomic: on an error this graph is unchanged. template is never mutated. The GIL is released while the copies are written.

Parameters:

Name Type Description Default
template Atomistic

Another graph: this graph cannot be its own template.

required
rotations (ndarray, shape(N, 3, 3), float64)
required
translations (ndarray, shape(N, 3), float64)
required
frag_ids (ndarray, shape(N), int32)
required

Returns:

Type Description
Refs

The new atoms, copy-major.

Raises:

Type Description
ValueError

If template is this graph, on a wrong shape, disagreeing counts, or a column of template whose type contradicts the one this graph holds.

rotate(axis, angle, about=None) method descriptor

Rotate every atom that has coordinates by angle radians about axis, pivoting on about (Å; None: the origin).

Raises:

Type Description
ValueError

If axis has no direction or angle is not finite; nothing moves then.

scale(factor, about=None) method descriptor

Scale every atom that has coordinates by the per-axis factor about about (Å; None: the origin). Pass [s, s, s] for a uniform scale.

set_bond_class(bond, bond_type, bond_number) method descriptor

Set a bond's chemical class and its localized bond number — the one door that writes bond_type / bond_number (a view refuses them).

The two are set together because they are only meaningful together: a class without a number leaves the bond un-standardized, and a number without a class leaves a consumer no way to tell aromatic from double.

structural_hash() method descriptor

Isomorphism-invariant Weisfeiler–Lehman structural hash (int).

A stable, reproducible dedup key over the graph's node and bond labels: identical for a node-permuted copy, sensitive to any label or connectivity change, reproducible across runs and processes.

term_blocks() method descriptor

The term blocks this graph holds, in registration order.

terms(block) method descriptor

Every row of the term block block, in row order; empty for a canonical block this graph holds no row of.

Raises:

Type Description
ValueError

If block has typed methods or is no term block.

to_frame() method descriptor

Export to a tabular :class:~molrs.core.Frame in the shared vocabulary. Select columns on the frame's blocks afterwards.

Raises:

Type Description
ValueError

If a node or relation property contradicts the dtype the Frame schema declares for its key (a string under "x").

topo_distances(atom, max_hops=None) method descriptor

Single-source shortest-path (BFS) distances over the bond graph from atom, as (atom, hops) pairs for every atom reachable from it (atom itself at 0), up to max_hops when given. Atoms of another connected component are omitted.

translate(delta) method descriptor

Translate every atom that has coordinates by delta (Å).

CoarseGrain

Coarse-grained molecular graph, exposed to Python as molrs.core.CoarseGrain.

CoarseGrain(**props): the keywords are the graph's :attr:props. A bead's membership (:meth:set_bead_members) names nodes of one source graph — the member world, fixed by the first membership recorded.

__doc__ = "Coarse-grained molecular graph, exposed to Python as `molrs.core.CoarseGrain`.\n\n``CoarseGrain(**props)``: the keywords are the graph's :attr:`props`.\nA bead's membership (:meth:`set_bead_members`) names nodes of one source\ngraph — the *member world*, fixed by the first membership recorded." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

beads property

Every bead, in row order.

bonds property

Every bond, in row order.

n_beads property

Number of beads.

n_bonds property

Number of bonds.

n_ports property

Number of ports.

ports property

Every port, in row order (empty when the graph carries none).

props property

Whole-graph annotations (a name, a provenance tag): the keyword arguments the graph was built with, as a live dict. A copy, a pickle and every graph derived from this one (perception, typing, conformers, subgraphs) carry them.

__copy__() method descriptor

copy.copy(graph): an independent copy with a copy of its :attr:props. Handles are preserved (view.handle of a node names the same node in the copy).

__deepcopy__(_memo) method descriptor

copy.deepcopy(graph): the same independent copy as copy.copy — a graph holds no Python objects to recurse into.

add_bead(**props) method descriptor

Add a bead carrying props and return its view.

Parameters:

Name Type Description Default
**props bool | int | float | str

The bead's fields. A string bead_type is required.

required

Raises:

Type Description
TypeError

If a value is not a bool, int, float or str.

ValueError

If props has no string bead_type, or a value contradicts the type an existing column holds; the graph is then unchanged.

add_bond(a, b, /, **props) method descriptor

Add a bond between beads a and b of this graph, carrying props, and return its view.

Raises:

Type Description
TypeError

If a value is not a bool, int, float or str.

ValueError

If an endpoint belongs to another graph, or a value contradicts the type an existing column holds; the graph is then unchanged.

add_port(anchor, handle_atom, /, kind, label='', order=1) method descriptor

Record a bonding descriptor on the (anchor, handle_atom) valence and return the port's view.

Parameters:

Name Type Description Default
anchor

The node that keeps its place in the product (positional-only).

required
handle_atom

The node bonded to anchor that roots the leaving group (positional-only). Endpoint order is load-bearing.

required
kind str

The notation glyph -- one of "$", "<", ">", "!".

required
label str

Descriptor label; "" (the default) means unnamed.

''
order int

Multiplicity of the bond this port will form, 1 to 4 (default 1).

1

Raises:

Type Description
ValueError

If an endpoint belongs to another graph, kind is not one of the four glyphs, handle_atom is not bonded to anchor, that valence already carries a port, or order is not a definite bond number.

axes(beads) method descriptor

The site axes of beads, one row per listed bead, in the listed order. A site from Coarsener.coarsen carries the vector from the first node of its group to the site; a one-node site's axis is zero.

Returns:

Type Description
(ndarray, shape(k, 3), float64)

axis_x / axis_y / axis_z as stored (Å).

Raises:

Type Description
ValueError

If a bead belongs to another graph, or lacks a finite axis; the message names its handle.

bead_members(bead) method descriptor

The nodes bead groups, as views of the member world (empty when it groups none).

Raises:

Type Description
ValueError

If bead belongs to another graph, a member was deleted from the member world, or the memberships were read from a frame (raw handles of no graph).

bead_types(beads) method descriptor

The bead_type of each of beads, in the listed order.

Raises:

Type Description
ValueError

If a bead belongs to another graph.

beads_of_atom(node) method descriptor

The beads whose membership includes node (a view of the member world), in bead-handle order.

canonical_order() method descriptor

Deterministic canonical bead order from canonical labeling, so two isomorphic graphs line up node by node.

center(nodes) method descriptor

Mass-weighted centre (Å) of beads (views or a Refs).

R = sum_i m_i r_i / sum_i m_i, reading positions from x / y / z and masses from mass; a node listed twice counts twice. No periodic imaging: a group split across a box face must be unwrapped first (:meth:Box.unwrap).

Returns:

Type Description
(ndarray, shape(3), float64)

Raises:

Type Description
ValueError

If the set is empty, a node belongs to another graph, lacks a finite x / y / z or a finite, non-negative mass (the message names its handle), or the total mass is not positive.

del_bead(bead) method descriptor

Delete bead, its bonds and its membership; their views go stale.

del_beads(beads) method descriptor

Delete every bead of beads (views or a Refs), their bonds and memberships. Atomic.

del_bond(bond) method descriptor

Delete bond; its view goes stale.

del_bonds(bonds) method descriptor

Delete every bond of bonds (views or a Refs). Atomic: on an error nothing is deleted.

del_port(port) method descriptor

Delete port (its bond stays); its view goes stale.

del_ports(ports) method descriptor

Delete every port of ports (their bonds stay). Atomic.

extract_subgraph(centers, radius) method descriptor

Radius ball around bead centers (views or a Refs) over CG bonds.

from_frame(frame) staticmethod

Build a CoarseGrain from a frame holding one molecule.

Every atoms row becomes a bead and every bonds row a CG bond (atomi / atomj are 0-based atoms rows); a members block, when present, is read back as bead membership (raw handles of no graph: :meth:bead_members refuses them). bead_type comes from the first column present: bead_type, then type, then type_id (rendered in decimal). CG bonds, ports and membership survive; other topology blocks are ignored.

Raises:

Type Description
ValueError

If the frame has no atoms rows; if mol_id holds a null row, is not an unsigned-int column, or holds more than one distinct value (the message points at Frame.subset); if none of bead_type / type / type_id is present, or the chosen one has a null row or the wrong dtype; if a bond row names no bead row; or if the members block lacks an unsigned-int ibead or atom column, names no bead row, or repeats an (ibead, atom) pair.

induced_subgraph(nodes) method descriptor

The subgraph induced by beads (views or a Refs), with the map {node of this graph: node of the subgraph}.

inherit_frag_ids() method descriptor

Propagate each frag_id to the unlabelled degree-1 beads bonded to a labelled one (one pass); returns how many were labelled.

is_isomorphic(other) method descriptor

Whether self and other are isomorphic as labelled graphs.

leaving_group(port) method descriptor

The leaving group of port: the beads of its handle's connected component once the anchor–handle bond is cut, in handle order.

Join port a to port b and return the new anchor–anchor bond.

Both leaving groups are deleted, their partial charge (e) folds onto the anchors, and the anchors are bonded with the port order. No coordinate moves.

Raises:

Type Description
ValueError

If a port belongs to another graph or is stale, the two ports do not accept each other, share an anchor, their anchors are already bonded, or the leaving groups overlap or reach an anchor; the graph is unchanged.

merge(other) method descriptor

Merge other into this graph and return its beads, now in this graph, in other's former row order. other is left empty; its views go stale. Memberships come along: both graphs' members must name one member world.

Raises:

Type Description
ValueError

If other is this graph, the two graphs' memberships name different source graphs, or a property of other contradicts the type this graph holds for that key; this graph is then unchanged.

neighbor_bonds(node) method descriptor

The bonds of bead, as (neighbour, bond) pairs.

port_on(anchor, handle_atom) method descriptor

The port on the (anchor, handle_atom) valence, or None.

positions(beads) method descriptor

The positions of beads (views or a Refs), one row per listed bead, in the listed order.

Returns:

Type Description
(ndarray, shape(k, 3), float64)

x / y / z as stored (Å).

Raises:

Type Description
ValueError

If a bead belongs to another graph, or lacks a finite x / y / z; the message names its handle.

replicate(template, rotations, translations, frag_ids) method descriptor

Grow this graph by one rigid copy of template per transform.

Copy c is template moved by rotations[c] @ r + translations[c] and every node of it is stamped frag_id = frag_ids[c]. Every relation of template is copied with it. Column-wise and atomic: on an error this graph is unchanged. template is never mutated. The GIL is released while the copies are written.

Parameters:

Name Type Description Default
template CoarseGrain

Another graph: this graph cannot be its own template.

required
rotations (ndarray, shape(N, 3, 3), float64)
required
translations (ndarray, shape(N, 3), float64)
required
frag_ids (ndarray, shape(N), int32)
required

Returns:

Type Description
Refs

The new beads, copy-major.

Raises:

Type Description
ValueError

If template is this graph, on a wrong shape, disagreeing counts, or a column of template whose type contradicts the one this graph holds.

rotate(axis, angle, about=None) method descriptor

Rotate every bead that has coordinates by angle radians about axis, pivoting on about (Å; None: the origin).

Raises:

Type Description
ValueError

If axis has no direction or angle is not finite; nothing moves then.

scale(factor, about=None) method descriptor

Scale every bead that has coordinates by the per-axis factor about about (Å; None: the origin). Pass [s, s, s] for a uniform scale.

set_bead_members(bead, members) method descriptor

Record the nodes bead groups (its membership), replacing any previous set; an empty iterable clears it.

members are node views of one source graph — the member world, which the first membership fixes.

Raises:

Type Description
ValueError

If bead belongs to another graph, or the members do not all come from the member world.

structural_hash() method descriptor

Isomorphism-invariant Weisfeiler–Lehman structural hash (int).

A stable, reproducible dedup key over the graph's node and bond labels: identical for a node-permuted copy, sensitive to any label or connectivity change, reproducible across runs and processes.

to_frame() method descriptor

Export to a tabular :class:~molrs.core.Frame in the shared vocabulary. Select columns on the frame's blocks afterwards.

Raises:

Type Description
ValueError

If a node or relation property contradicts the dtype the Frame schema declares for its key (a string under "x").

translate(delta) method descriptor

Translate every bead that has coordinates by delta (Å).

MolGraph

Domain-agnostic ECS world, exposed to Python as molrs.core.MolGraph.

Nodes and relations are addressed by stable opaque int handles (generational slotmap keys): deleting one entity never invalidates another, and a stale handle raises.

__doc__ = 'Domain-agnostic ECS world, exposed to Python as `molrs.core.MolGraph`.\n\nNodes and relations are addressed by stable opaque ``int`` handles\n(generational slotmap keys): deleting one entity never invalidates\nanother, and a stale handle raises.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

n_nodes property

Number of nodes.

n_ports property

Number of ports (0 when the world carries none).

add_node(**props) method descriptor

Add a node carrying props and return its handle.

Parameters:

Name Type Description Default
**props bool | int | float | str

The node's fields.

required

Returns:

Type Description
int

The new node's handle.

Raises:

Type Description
TypeError

If a value is not a bool, int, float or str.

ValueError

If a value contradicts the type an existing column holds for its key; the world is then unchanged.

add_relation(kind, nodes, /, **props) method descriptor

Add a relation of kind over node handles, carrying props.

Parameters:

Name Type Description Default
kind str

A registered relation kind.

required
nodes Sequence[int]

Endpoint node handles, as many as the kind's arity.

required
**props bool | int | float | str

The relation's fields.

required

Returns:

Type Description
int

The new relation's handle.

Raises:

Type Description
TypeError

If a value is not a bool, int, float or str.

ValueError

If kind is not registered, the endpoint count is not its arity, an endpoint is stale, or a value contradicts the type an existing column holds; the world is then unchanged.

adopt(other) method descriptor

Zero-copy adopt: move other's storage into self, leaving other empty. Handles in the adopted world stay valid (the whole generational slotmap is moved, not reindexed).

clear_node(node, key) method descriptor

Clear field key of node node (no-op if absent).

key is a :class:molrs.core.keys.Key or str.

clear_relation_prop(kind, rel, key) method descriptor

Clear field key of relation rel of kind (no-op if absent).

column(key) method descriptor

The field column key, aligned to row order (length == n_nodes), as a numpy array of the column's own element type.

A f64 column is a zero-copy view that writes through to the world (col[i] = v updates the node at row i); i32, bool and str columns are copied. The view borrows the world's storage; structural mutation (add_node / del_node) may reallocate or reorder the column and invalidate an outstanding view — re-fetch after such ops.

Every node must carry the field: a column with a hole is a KeyError naming how many nodes lack it, never a silently zero-filled array. Use :meth:validity to find the holes and :meth:get_node for node-wise reads.

columns() method descriptor

Names of every field column registered on the node table (a field set on at least one node), in no particular order.

del_node(node) method descriptor

Delete node node and every relation touching it.

Raises:

Type Description
ValueError

If node is stale or unknown.

del_nodes(nodes) method descriptor

Delete every node of nodes and every relation touching one. Atomic: on an error (a stale handle, a handle listed twice) nothing is deleted.

del_relation(kind, rel) method descriptor

Delete relation rel of kind.

del_relations(kind, rels) method descriptor

Delete every relation of rels of kind. Atomic: on an error nothing is deleted.

get_node(node) method descriptor

Every field of node node, as a new dict.

Raises:

Type Description
ValueError

If node is stale or unknown.

get_relation(kind, rel) method descriptor

Relation rel of kind: its endpoint node handles, in order, and a new dict of its fields.

incident_relations(node, kind) method descriptor

Relations of kind incident to node node, as (relation_handle, other_node_handle) pairs, via the adjacency index (O(degree)). Only arity-2 kinds are tracked in adjacency.

inherit_frag_ids() method descriptor

Propagate each frag_id to the unlabelled degree-1 nodes hanging off a labelled one (one pass); returns how many were labelled.

kind_arity(kind) method descriptor

Fixed endpoint count of a registered relation kind.

kinds() method descriptor

Names of all registered relation kinds, in registration order.

Join port a to port b with a new anchor–anchor bond and return the bond's relation handle.

Both leaving groups are deleted, their partial charge (e) folds onto the anchors, and the anchors are bonded with the port order. No coordinate moves.

Raises:

Type Description
ValueError

If a handle names no live port, a port is stale, the two ports do not accept each other, share an anchor, their anchors are already bonded, or the leaving groups overlap or reach an anchor; the world is unchanged.

n_relations(kind) method descriptor

Number of relations of kind.

node_ids() method descriptor

All live node handles, in row order.

register_kind(kind, arity) method descriptor

Register a relation kind (idempotent for a matching arity).

relation_ids(kind) method descriptor

Live relation handles of kind, in row order.

Authoritative enumeration — callers must not probe opaque handle ranges. Returns an empty list for a registered kind with no relations; errors only if kind is unregistered.

set_node(node, key, value) method descriptor

Set field key of node node (value is bool|int|float|str).

key is a :class:molrs.core.keys.Key or str.

set_relation_prop(kind, rel, key, value) method descriptor

Set field key of relation rel of kind.

validity(key) method descriptor

Validity mask (numpy bool array, copied) of field column key, aligned to row order: True where the node at that row has the field set.

key is a :class:molrs.core.keys.Key or str.

BondOrder

The chemical class of a bond — molrs::core::BondOrder.

Stored under keys.BOND_TYPE as its code: Unknown 0, Single 1, Double 2, Triple 3, Aromatic 4. Aromatic is a class, peer to single / double / triple, not a number: an aromatic bond's localized number is a :class:BondNumber.

Aromatic = BondOrder.Aromatic class-attribute

The chemical class of a bond — molrs::core::BondOrder.

Stored under keys.BOND_TYPE as its code: Unknown 0, Single 1, Double 2, Triple 3, Aromatic 4. Aromatic is a class, peer to single / double / triple, not a number: an aromatic bond's localized number is a :class:BondNumber.

Double = BondOrder.Double class-attribute

The chemical class of a bond — molrs::core::BondOrder.

Stored under keys.BOND_TYPE as its code: Unknown 0, Single 1, Double 2, Triple 3, Aromatic 4. Aromatic is a class, peer to single / double / triple, not a number: an aromatic bond's localized number is a :class:BondNumber.

Single = BondOrder.Single class-attribute

The chemical class of a bond — molrs::core::BondOrder.

Stored under keys.BOND_TYPE as its code: Unknown 0, Single 1, Double 2, Triple 3, Aromatic 4. Aromatic is a class, peer to single / double / triple, not a number: an aromatic bond's localized number is a :class:BondNumber.

Triple = BondOrder.Triple class-attribute

The chemical class of a bond — molrs::core::BondOrder.

Stored under keys.BOND_TYPE as its code: Unknown 0, Single 1, Double 2, Triple 3, Aromatic 4. Aromatic is a class, peer to single / double / triple, not a number: an aromatic bond's localized number is a :class:BondNumber.

Unknown = BondOrder.Unknown class-attribute

The chemical class of a bond — molrs::core::BondOrder.

Stored under keys.BOND_TYPE as its code: Unknown 0, Single 1, Double 2, Triple 3, Aromatic 4. Aromatic is a class, peer to single / double / triple, not a number: an aromatic bond's localized number is a :class:BondNumber.

__doc__ = "The chemical class of a bond — ``molrs::core::BondOrder``.\n\nStored under ``keys.BOND_TYPE`` as its code: ``Unknown`` 0, ``Single`` 1,\n``Double`` 2, ``Triple`` 3, ``Aromatic`` 4. ``Aromatic`` is a class, peer\nto single / double / triple, not a number: an aromatic bond's localized\nnumber is a :class:`BondNumber`." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

code property

The stored code (keys.BOND_TYPE).

__eq__(value) method descriptor

Return self==value.

__ge__(value) method descriptor

Return self>=value.

__gt__(value) method descriptor

Return self>value.

__hash__() method descriptor

Return hash(self).

__int__() method descriptor

int(self)

__le__(value) method descriptor

Return self<=value.

__lt__(value) method descriptor

Return self<value.

__ne__(value) method descriptor

Return self!=value.

__repr__() method descriptor

Return repr(self).

from_code(code) staticmethod

The class a stored code names; a code outside 0..=4 is Unknown.

implied_number() method descriptor

The bond number a non-aromatic class implies; None for Aromatic and Unknown.

is_aromatic() method descriptor

Whether this is an aromatic bond.

BondNumber

The integer bond number of a localized Lewis / Kekulé structure — molrs::core::BondNumber.

Stored under keys.BOND_NUMBER as its code: Unknown 0, Single 1, Double 2, Triple 3, Quadruple 4.

Double = BondNumber.Double class-attribute

The integer bond number of a localized Lewis / Kekulé structure — molrs::core::BondNumber.

Stored under keys.BOND_NUMBER as its code: Unknown 0, Single 1, Double 2, Triple 3, Quadruple 4.

Quadruple = BondNumber.Quadruple class-attribute

The integer bond number of a localized Lewis / Kekulé structure — molrs::core::BondNumber.

Stored under keys.BOND_NUMBER as its code: Unknown 0, Single 1, Double 2, Triple 3, Quadruple 4.

Single = BondNumber.Single class-attribute

The integer bond number of a localized Lewis / Kekulé structure — molrs::core::BondNumber.

Stored under keys.BOND_NUMBER as its code: Unknown 0, Single 1, Double 2, Triple 3, Quadruple 4.

Triple = BondNumber.Triple class-attribute

The integer bond number of a localized Lewis / Kekulé structure — molrs::core::BondNumber.

Stored under keys.BOND_NUMBER as its code: Unknown 0, Single 1, Double 2, Triple 3, Quadruple 4.

Unknown = BondNumber.Unknown class-attribute

The integer bond number of a localized Lewis / Kekulé structure — molrs::core::BondNumber.

Stored under keys.BOND_NUMBER as its code: Unknown 0, Single 1, Double 2, Triple 3, Quadruple 4.

__doc__ = 'The integer bond number of a localized Lewis / Kekulé structure —\n``molrs::core::BondNumber``.\n\nStored under ``keys.BOND_NUMBER`` as its code: ``Unknown`` 0, ``Single``\n1, ``Double`` 2, ``Triple`` 3, ``Quadruple`` 4.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

code property

The stored code (keys.BOND_NUMBER).

__eq__(value) method descriptor

Return self==value.

__ge__(value) method descriptor

Return self>=value.

__gt__(value) method descriptor

Return self>value.

__hash__() method descriptor

Return hash(self).

__int__() method descriptor

int(self)

__le__(value) method descriptor

Return self<=value.

__lt__(value) method descriptor

Return self<value.

__ne__(value) method descriptor

Return self!=value.

__repr__() method descriptor

Return repr(self).

count() method descriptor

The number as a count, for valence sums; Unknown counts as 0.

from_code(code) staticmethod

The number a stored code names; a code outside 0..=4 is Unknown.

implied_type() method descriptor

The bond class this number implies — the inverse of :meth:BondOrder.implied_number. Quadruple is classed Double; Unknown implies Unknown.

Atomistic and CoarseGrain are not MolGraph subclasses: each holds its own typed graph (Rust molrs::core::Atomistic / CoarseGrain) and speaks only its vocabulary. Every entity they hand out or take is a live view (Atom, Bond, Bead, …), and a view's mapping is the one door to its fields: atom["x"], atom["x"] = 1.0, del atom["charge"]. Removal is del_atom(atom) for one atom and del_atoms(atoms) for several (atomic), and likewise for bonds, angles, dihedrals, impropers, ports, beads and terms (add_term(block, atoms, **props) for any other relation block). A bond's class is written only by set_bond_class(bond, BondOrder, BondNumber). Copies are copy.copy(mol) / copy.deepcopy(mol).

Rigid-body moves are methods of Atomistic and CoarseGrain, with the same signatures on both: translate(delta), rotate(axis, angle, about=None) and scale(factor, about=None) move every node that has coordinates in place, and center(nodes) is the mass-weighted centre of the given nodes.

NodeRef

A live view of one node of a graph.

A view is made by the graph (graph.add_atom(...), graph.atoms[i]), never constructed directly. It reads and writes the node's fields as a mapping: atom["x"], atom["x", "y", "z"] = (0.0, 0.0, 1.0), del atom["charge"], "charge" in atom. Deleting the node leaves the view stale: its reads raise.

__doc__ = 'A live view of one node of a graph.\n\nA view is made by the graph (``graph.add_atom(...)``, ``graph.atoms[i]``),\nnever constructed directly. It reads and writes the node\'s fields as a\nmapping: ``atom["x"]``, ``atom["x", "y", "z"] = (0.0, 0.0, 1.0)``,\n``del atom["charge"]``, ``"charge" in atom``. Deleting the node leaves the\nview stale: its reads raise.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

handle property

The node's stable handle in :attr:world.

world property

The graph this node belongs to.

__contains__(key) method descriptor

Return bool(key in self).

__delitem__(key) method descriptor

Delete self[key].

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__repr__() method descriptor

Return repr(self).

__setitem__(key, value) method descriptor

Set self[key] to value.

get(key, default=None) method descriptor

The field key, or default when it is not set.

items() method descriptor

(name, value) pairs, in :meth:keys order.

keys() method descriptor

The field names, in column order.

update(*args, **kwargs) method descriptor

Write several fields, as dict.update takes them.

Every value is checked before any is written.

values() method descriptor

The field values, in :meth:keys order.

RelationRef

A live view of one relation (a bond, an angle, a port, a term, …) of a graph.

Made by the graph, never constructed directly. endpoints are the interned node views, in order; the relation's own fields read and write as a mapping (bond["order"]).

__doc__ = 'A live view of one relation (a bond, an angle, a port, a term, …) of a\ngraph.\n\nMade by the graph, never constructed directly. ``endpoints`` are the\ninterned node views, in order; the relation\'s own fields read and write\nas a mapping (``bond["order"]``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

endpoints property

The endpoint node views, in order.

handle property

The relation's stable handle within its kind.

kind property

The relation kind ("bonds", "angles", a term block, …).

world property

The graph this relation belongs to.

__contains__(key) method descriptor

Return bool(key in self).

__delitem__(key) method descriptor

Delete self[key].

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__repr__() method descriptor

Return repr(self).

__setitem__(key, value) method descriptor

Set self[key] to value.

get(key, default=None) method descriptor

The field key, or default when it is not set.

items() method descriptor

(name, value) pairs, in :meth:keys order.

keys() method descriptor

The field names, in column order.

update(*args, **kwargs) method descriptor

Write several fields, as dict.update takes them.

Every value is checked before any is written.

values() method descriptor

The field values, in :meth:keys order.

Refs

An ordered collection of views of one kind of one graph.

refs[i] is a view, refs[a:b] a smaller collection; refs["x"] reads a field of every item as a numpy array (None where unset) and refs["x", "y", "z"] stacks several side by side. Views are made on demand, so len(graph.atoms) and graph.atoms["x"] make none. Every door that takes several nodes or relations of a graph takes a Refs of it as well as any iterable of its views.

__doc__ = 'An ordered collection of views of one kind of one graph.\n\n``refs[i]`` is a view, ``refs[a:b]`` a smaller collection; ``refs["x"]``\nreads a field of every item as a numpy array (``None`` where unset) and\n``refs["x", "y", "z"]`` stacks several side by side. Views are made on\ndemand, so ``len(graph.atoms)`` and ``graph.atoms["x"]`` make none. Every\ndoor that takes several nodes or relations of a graph takes a ``Refs`` of\nit as well as any iterable of its views.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__contains__(key) method descriptor

Return bool(key in self).

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__repr__() method descriptor

Return repr(self).

Cell

The geometry of a simulation cell, exposed to Python as molrs.core.Cell.

Mirrors the core Cell enum: one staticmethod per variant, each building a frozen value that :class:Box and :class:Parallelepiped take. The geometry is checked where it is used (Box(...) raises for a singular matrix, a non-positive length or impossible angles).

Examples:

>>> Box(Cell.lengths([10.0, 10.0, 10.0])).volume()
1000.0
>>> Box(Cell.undefined(), pbc=(False, False, False)).is_cell_defined
False

__doc__ = 'The geometry of a simulation cell, exposed to Python as `molrs.core.Cell`.\n\nMirrors the core `Cell` enum: one staticmethod per variant, each building\na frozen value that :class:`Box` and :class:`Parallelepiped` take. The\ngeometry is checked where it is used (``Box(...)`` raises for a singular\nmatrix, a non-positive length or impossible angles).\n\nExamples\n--------\n>>> Box(Cell.lengths([10.0, 10.0, 10.0])).volume()\n1000.0\n>>> Box(Cell.undefined(), pbc=(False, False, False)).is_cell_defined\nFalse' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__eq__(value) method descriptor

Return self==value.

__ge__(value) method descriptor

Return self>=value.

__gt__(value) method descriptor

Return self>value.

__le__(value) method descriptor

Return self<=value.

__lt__(value) method descriptor

Return self<value.

__ne__(value) method descriptor

Return self!=value.

__repr__() method descriptor

Return repr(self).

lengths(lengths) staticmethod

An orthorhombic cell with edge lengths [a, b, c] (Å), all positive.

lengths_angles(lengths, angles) staticmethod

A restricted-triclinic cell from edge lengths [a, b, c] (Å) and the angles [alpha, beta, gamma] between them, in degrees.

lengths_tilts(lengths, tilts) staticmethod

A restricted-triclinic cell from the diagonal sizes [lx, ly, lz] (Å) and the tilts [xy, xz, yz] (Å) — the LAMMPS form.

matrix(h) staticmethod

The cell matrix h (3×3, Å), lattice vectors as columns — the layout :attr:Box.matrix returns.

undefined() staticmethod

No geometric cell: a box of undefined, zero volume (Box.is_cell_defined is False). Distinct from periodicity.

Box

Simulation box with periodic boundary conditions, exposed to Python as molrs.core.Box.

The box holds a :class:Cell (resolved to a 3x3 matrix H whose columns are the lattice vectors), an origin point and per-axis PBC flags. The factories build the common cells without spelling the :class:Cell.

Python Examples

from molrs.core import Box, Cell

box = Box.cube(10.0)                          # cubic, periodic
box = Box.ortho([10.0, 20.0, 30.0])           # orthorhombic
print(box.volume())                           # 6000.0
slab = Box.cube(20.0, pbc=(True, True, False))
free = Box(Cell.undefined(), pbc=(False, False, False))

__doc__ = 'Simulation box with periodic boundary conditions, exposed to Python as\n`molrs.core.Box`.\n\nThe box holds a :class:`Cell` (resolved to a 3x3 matrix **H** whose\ncolumns are the lattice vectors), an origin point and per-axis PBC flags.\nThe factories build the common cells without spelling the :class:`Cell`.\n\n# Python Examples\n\n```python\nfrom molrs.core import Box, Cell\n\nbox = Box.cube(10.0) # cubic, periodic\nbox = Box.ortho([10.0, 20.0, 30.0]) # orthorhombic\nprint(box.volume()) # 6000.0\nslab = Box.cube(20.0, pbc=(True, True, False))\nfree = Box(Cell.undefined(), pbc=(False, False, False))\n```' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

angles property

Lattice angles [alpha, beta, gamma] in degrees.

bounds property

Per-axis coordinate bounds as [[xlo, xhi], [ylo, yhi], [zlo, zhi]].

inverse property

Inverse cell matrix.

is_cell_defined property

Whether the cell is geometrically defined. False marks a box built from Cell.undefined() (undefined / zero volume), distinct from is_free (periodicity).

is_free property

True when the box is free (non-periodic on every axis).

lengths property

Lengths of the three lattice vectors [|a|, |b|, |c|].

matrix property

Cell matrix H (3x3, Å), lattice vectors as columns — the layout :meth:Cell.matrix takes.

nearest_plane_distance property

Perpendicular distances between opposite cell faces.

origin property

Box origin in Cartesian coordinates, shape (3,).

pbc property

Periodic boundary condition flags [pbc_x, pbc_y, pbc_z].

style property

Geometry style label: "free", "orthogonal", or "triclinic".

tilts property

LAMMPS-convention tilt factors (xy, xz, yz). Zero on orthogonal boxes.

__repr__() method descriptor

Return repr(self).

approx_eq(other, tol) method descriptor

Whether other describes the same cell within an absolute tolerance.

True iff every cell-matrix entry and origin component differ by at most tol (length units), the PBC flags are identical and both boxes agree on is_cell_defined. tol=0.0 is exact equality.

Raises:

Type Description
ValueError

If tol is negative or NaN.

bounding(points, padding, pbc) staticmethod

The orthorhombic box enclosing points: their axis-aligned bounds widened by padding[d] on each side of axis d, with periodicity pbc.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float64

The points to enclose (Å).

required
padding (array_like, shape(3))

Margin on each side of each axis (Å), finite and >= 0.

required
pbc array_like of bool, shape (3,)

Periodic boundary flags.

required

Raises:

Type Description
ValueError

No points, points not (N, 3), a negative or non-finite padding, or an axis of zero extent (pass a positive padding).

contains(xyz) method descriptor

Whether each point (N, 3) lies inside the primary cell (fractional coordinates in [0, 1)).

Raises:

Type Description
ValueError

If xyz does not have 3 columns.

corners() method descriptor

Eight Cartesian cell corners.

cube(a, origin=Ellipsis, pbc=Ellipsis) staticmethod

A cubic box of edge a (Å): Box(Cell.lengths([a, a, a]), …).

Raises:

Type Description
ValueError

A non-positive or non-finite a.

delta(xyzu1, xyzu2, minimum_image=False) method descriptor

Displacement vectors xyzu2 - xyzu1, minimum-imaged when minimum_image is set.

Parameters:

Name Type Description Default
xyzu1 numpy.ndarray, shape (N, 3) or (3,), dtype float

First set of Cartesian coordinates.

required
xyzu2 numpy.ndarray, shape (N, 3) or (3,), dtype float

Second set, of the same shape as xyzu1.

required
minimum_image bool

Apply the minimum-image convention. Default False.

False

Returns:

Type Description
numpy.ndarray, shape (N, 3) or (3,), dtype float

Rank matches the inputs.

Raises:

Type Description
ValueError

If ranks differ, 1-D length is not 3, columns != 3, or N differs.

distances(points1, points2) method descriptor

Row-wise minimum-image distances between equally sized point arrays.

from_lengths_angles(lengths, angles, origin=Ellipsis, pbc=Ellipsis) staticmethod

A restricted-triclinic box from edge lengths [a, b, c] (Å) and the angles [alpha, beta, gamma] between them, in degrees: Box(Cell.lengths_angles(lengths, angles), …).

Raises:

Type Description
ValueError

A non-positive length, or angles that describe no cell.

from_lengths_tilts(lengths, tilts, origin=Ellipsis, pbc=Ellipsis) staticmethod

A restricted-triclinic box from the diagonal sizes [lx, ly, lz] (Å) and the tilts [xy, xz, yz] (Å), the LAMMPS form: Box(Cell.lengths_tilts(lengths, tilts), …).

Raises:

Type Description
ValueError

A non-positive or non-finite length.

lattice(index) method descriptor

Return a lattice vector (a column of :attr:matrix) by index.

Raises:

Type Description
ValueError

If index is not 0, 1, or 2.

ortho(lengths, origin=Ellipsis, pbc=Ellipsis) staticmethod

An orthorhombic box with edge lengths [a, b, c] (Å): Box(Cell.lengths(lengths), …).

Raises:

Type Description
ValueError

A non-positive or non-finite length.

pairwise_delta(points1, points2) method descriptor

All pairwise minimum-image displacement vectors (points2 - points1).

pairwise_distances(points1, points2) method descriptor

All pairwise minimum-image distances.

restricted_matrix(matrix) staticmethod

A general cell matrix (columns = lattice vectors) in LAMMPS restricted-triclinic form.

to_cart(frac) method descriptor

Convert fractional coordinates (N, 3) to Cartesian coordinates.

Raises:

Type Description
ValueError

If frac does not have 3 columns.

to_frac(xyz) method descriptor

Convert Cartesian coordinates (N, 3) to fractional coordinates.

Raises:

Type Description
ValueError

If xyz does not have 3 columns.

transformed(transformation) method descriptor

Return a box whose cell matrix is right-multiplied by transformation.

unwrap(xyz, images) method descriptor

Reconstruct unwrapped coordinates from wrapped coordinates and images.

images is int32, the schema's integer type, so a frame's ix/iy/iz columns pass in without a cast.

volume() method descriptor

Volume of the simulation box (ų); 0.0 for an undefined cell.

wrap(xyz) method descriptor

Wrap coordinates into the cell on the periodic axes and report the integer lattice shift applied to each point.

Returns:

Type Description
tuple[ndarray, ndarray]

(wrapped, shifts): the wrapped (N, 3) float64 coordinates and the (N, 3) int32 shifts m with wrapped = xyz - (matrix @ m.T).T. For continuous coordinates shifts are their image flags (the ix/iy/iz columns).

Raises:

Type Description
ValueError

If xyz does not have 3 columns.

A region is a solid with a signed distance to its boundary: every class answers contains, distance (negative inside) and bounds, and composes with &, | and ~. Outside a shape is ~shape; a shell is outer & ~inner. TriMesh is the surface a Polyhedron is bounded by and what molrs.io.read_stl reads (from a path or from the file's bytes).

Sphere

Solid sphere region.

Exposed to Python as molrs.core.Sphere.

Parameters:

Name Type Description Default
center numpy.ndarray, shape (3,), dtype float

Center of the sphere.

required
radius float

Radius of the sphere.

required

Examples:

>>> s = Sphere(np.array([0, 0, 0]), 5.0)
>>> mask = s.contains(points)
>>> shell = s & ~Sphere(np.array([0, 0, 0]), 2.0)
>>> d = s.distance(points)  # negative inside

__doc__ = 'Solid sphere region.\n\nExposed to Python as `molrs.core.Sphere`.\n\nParameters\n----------\ncenter : numpy.ndarray, shape (3,), dtype float\n Center of the sphere.\nradius : float\n Radius of the sphere.\n\nExamples\n--------\n>>> s = Sphere(np.array([0, 0, 0]), 5.0)\n>>> mask = s.contains(points)\n>>> shell = s & ~Sphere(np.array([0, 0, 0]), 2.0)\n>>> d = s.distance(points) # negative inside' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

center property

Center, shape (3,).

radius property

Radius.

__and__(value) method descriptor

Return self&value.

__call__(*args, **kwargs) method descriptor

Call self as a function.

__invert__() method descriptor

~self

__or__(value) method descriptor

Return self|value.

__rand__(value) method descriptor

Return value&self.

__repr__() method descriptor

Return repr(self).

__ror__(value) method descriptor

Return value|self.

bounds() method descriptor

Axis-aligned bounding box, shape (3, 2): [[xmin, xmax], [ymin, ymax], [zmin, zmax]].

contains(points) method descriptor

Test which points are inside this region.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Test points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype bool

True for points inside (the boundary counts as inside).

Raises:

Type Description
ValueError

If points does not have 3 columns.

distance(points) method descriptor

Signed distance of each point to the boundary.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Query points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype float

Negative inside, positive outside, zero on the boundary; same unit as the coordinates.

Raises:

Type Description
ValueError

If points does not have 3 columns.

mask(block) method descriptor

Which rows of block lie inside: :meth:contains of its x / y / z columns.

Raises:

Type Description
KeyError

If block lacks x, y or z.

Cuboid

Axis-aligned cuboid (box) region, exposed to Python as molrs.core.Cuboid.

A point is inside when origin[d] <= p[d] <= origin[d] + lengths[d] on every axis.

__doc__ = 'Axis-aligned cuboid (box) region, exposed to Python as `molrs.core.Cuboid`.\n\nA point is inside when `origin[d] <= p[d] <= origin[d] + lengths[d]` on\nevery axis.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

lengths property

Edge lengths, shape (3,).

origin property

Minimum corner, shape (3,).

__and__(value) method descriptor

Return self&value.

__call__(*args, **kwargs) method descriptor

Call self as a function.

__invert__() method descriptor

~self

__or__(value) method descriptor

Return self|value.

__rand__(value) method descriptor

Return value&self.

__repr__() method descriptor

Return repr(self).

__ror__(value) method descriptor

Return value|self.

bounds() method descriptor

Axis-aligned bounding box, shape (3, 2): [[xmin, xmax], [ymin, ymax], [zmin, zmax]].

contains(points) method descriptor

Test which points are inside this region.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Test points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype bool

True for points inside (the boundary counts as inside).

Raises:

Type Description
ValueError

If points does not have 3 columns.

distance(points) method descriptor

Signed distance of each point to the boundary.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Query points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype float

Negative inside, positive outside, zero on the boundary; same unit as the coordinates.

Raises:

Type Description
ValueError

If points does not have 3 columns.

mask(block) method descriptor

Which rows of block lie inside: :meth:contains of its x / y / z columns.

Raises:

Type Description
KeyError

If block lacks x, y or z.

Parallelepiped

General parallelepiped (oblique box) region, exposed as molrs.core.Parallelepiped.

Defined by an origin corner and a 3×3 edge matrix h whose columns are the three edge vectors. A point is inside when its fractional coordinates lie in the closed cell [0, 1]³; distance is measured perpendicular to the bounding planes, in the input length unit.

This is pure geometric containment — not a periodic simulation box. For PBC / MIC / wrap, use :class:molrs.core.Box.

__doc__ = 'General parallelepiped (oblique box) region, exposed as `molrs.core.Parallelepiped`.\n\nDefined by an origin corner and a 3×3 edge matrix ``h`` whose **columns**\nare the three edge vectors. A point is inside when its fractional\ncoordinates lie in the closed cell ``[0, 1]³``; ``distance`` is measured\nperpendicular to the bounding planes, in the input length unit.\n\nThis is pure geometric containment — **not** a periodic simulation box.\nFor PBC / MIC / wrap, use :class:`molrs.core.Box`.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

h property

Edge matrix h (3×3, Å), the edge vectors as columns.

origin property

Origin corner, shape (3,) (Å).

__and__(value) method descriptor

Return self&value.

__call__(*args, **kwargs) method descriptor

Call self as a function.

__invert__() method descriptor

~self

__or__(value) method descriptor

Return self|value.

__rand__(value) method descriptor

Return value&self.

__repr__() method descriptor

Return repr(self).

__ror__(value) method descriptor

Return value|self.

bounds() method descriptor

Axis-aligned bounding box, shape (3, 2): [[xmin, xmax], [ymin, ymax], [zmin, zmax]].

contains(points) method descriptor

Test which points are inside this region.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Test points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype bool

True for points inside (the boundary counts as inside).

Raises:

Type Description
ValueError

If points does not have 3 columns.

distance(points) method descriptor

Signed distance of each point to the boundary.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Query points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype float

Negative inside, positive outside, zero on the boundary; same unit as the coordinates.

Raises:

Type Description
ValueError

If points does not have 3 columns.

mask(block) method descriptor

Which rows of block lie inside: :meth:contains of its x / y / z columns.

Raises:

Type Description
KeyError

If block lacks x, y or z.

volume() method descriptor

Signed volume det(h).

HalfSpace

One side of a plane, exposed as molrs.core.HalfSpace.

Inside is the side the normal points away from (n · (x − p) <= 0); the other side is ~HalfSpace(...). distance is the exact distance to the plane.

Parameters:

Name Type Description Default
normal numpy.ndarray, shape (3,), dtype float

Outward normal (any non-zero length).

required
point numpy.ndarray, shape (3,), dtype float

A point on the plane.

required

__doc__ = 'One side of a plane, exposed as `molrs.core.HalfSpace`.\n\nInside is the side the ``normal`` points *away* from (``n · (x − p) <= 0``);\nthe other side is ``~HalfSpace(...)``. ``distance`` is the exact distance\nto the plane.\n\nParameters\n----------\nnormal : numpy.ndarray, shape (3,), dtype float\n Outward normal (any non-zero length).\npoint : numpy.ndarray, shape (3,), dtype float\n A point on the plane.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__and__(value) method descriptor

Return self&value.

__call__(*args, **kwargs) method descriptor

Call self as a function.

__invert__() method descriptor

~self

__or__(value) method descriptor

Return self|value.

__rand__(value) method descriptor

Return value&self.

__repr__() method descriptor

Return repr(self).

__ror__(value) method descriptor

Return value|self.

bounds() method descriptor

Axis-aligned bounding box, shape (3, 2): [[xmin, xmax], [ymin, ymax], [zmin, zmax]].

contains(points) method descriptor

Test which points are inside this region.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Test points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype bool

True for points inside (the boundary counts as inside).

Raises:

Type Description
ValueError

If points does not have 3 columns.

distance(points) method descriptor

Signed distance of each point to the boundary.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Query points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype float

Negative inside, positive outside, zero on the boundary; same unit as the coordinates.

Raises:

Type Description
ValueError

If points does not have 3 columns.

mask(block) method descriptor

Which rows of block lie inside: :meth:contains of its x / y / z columns.

Raises:

Type Description
KeyError

If block lacks x, y or z.

normal() method descriptor

Unit outward normal, shape (3,).

Cylinder

Finite capped cylinder, exposed as molrs.core.Cylinder.

Parameters:

Name Type Description Default
base numpy.ndarray, shape (3,), dtype float

Centre of the first cap.

required
axis numpy.ndarray, shape (3,), dtype float

Direction from the first cap to the second (any non-zero length).

required
radius float
required
length float

Distance between the caps.

required

__doc__ = 'Finite capped cylinder, exposed as `molrs.core.Cylinder`.\n\nParameters\n----------\nbase : numpy.ndarray, shape (3,), dtype float\n Centre of the first cap.\naxis : numpy.ndarray, shape (3,), dtype float\n Direction from the first cap to the second (any non-zero length).\nradius : float\nlength : float\n Distance between the caps.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__and__(value) method descriptor

Return self&value.

__call__(*args, **kwargs) method descriptor

Call self as a function.

__invert__() method descriptor

~self

__or__(value) method descriptor

Return self|value.

__rand__(value) method descriptor

Return value&self.

__repr__() method descriptor

Return repr(self).

__ror__(value) method descriptor

Return value|self.

bounds() method descriptor

Axis-aligned bounding box, shape (3, 2): [[xmin, xmax], [ymin, ymax], [zmin, zmax]].

contains(points) method descriptor

Test which points are inside this region.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Test points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype bool

True for points inside (the boundary counts as inside).

Raises:

Type Description
ValueError

If points does not have 3 columns.

distance(points) method descriptor

Signed distance of each point to the boundary.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Query points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype float

Negative inside, positive outside, zero on the boundary; same unit as the coordinates.

Raises:

Type Description
ValueError

If points does not have 3 columns.

mask(block) method descriptor

Which rows of block lie inside: :meth:contains of its x / y / z columns.

Raises:

Type Description
KeyError

If block lacks x, y or z.

Ellipsoid

Axis-aligned ellipsoid, exposed as molrs.core.Ellipsoid.

distance has the exact sign; its magnitude is a lower bound on the Euclidean distance (exact along the shortest semi-axis).

Parameters:

Name Type Description Default
center numpy.ndarray, shape (3,), dtype float
required
semi_axes numpy.ndarray, shape (3,), dtype float

Semi-axes along x, y, z.

required

__doc__ = 'Axis-aligned ellipsoid, exposed as `molrs.core.Ellipsoid`.\n\n``distance`` has the exact sign; its magnitude is a lower bound on the\nEuclidean distance (exact along the shortest semi-axis).\n\nParameters\n----------\ncenter : numpy.ndarray, shape (3,), dtype float\nsemi_axes : numpy.ndarray, shape (3,), dtype float\n Semi-axes along x, y, z.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__and__(value) method descriptor

Return self&value.

__call__(*args, **kwargs) method descriptor

Call self as a function.

__invert__() method descriptor

~self

__or__(value) method descriptor

Return self|value.

__rand__(value) method descriptor

Return value&self.

__repr__() method descriptor

Return repr(self).

__ror__(value) method descriptor

Return value|self.

bounds() method descriptor

Axis-aligned bounding box, shape (3, 2): [[xmin, xmax], [ymin, ymax], [zmin, zmax]].

contains(points) method descriptor

Test which points are inside this region.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Test points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype bool

True for points inside (the boundary counts as inside).

Raises:

Type Description
ValueError

If points does not have 3 columns.

distance(points) method descriptor

Signed distance of each point to the boundary.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Query points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype float

Negative inside, positive outside, zero on the boundary; same unit as the coordinates.

Raises:

Type Description
ValueError

If points does not have 3 columns.

mask(block) method descriptor

Which rows of block lie inside: :meth:contains of its x / y / z columns.

Raises:

Type Description
KeyError

If block lacks x, y or z.

TriMesh

Triangle surface mesh: a vertex table plus faces indexing into it.

Exposed to Python as molrs.core.TriMesh. Lengths are whatever unit the vertices are in; :meth:scaled converts.

Examples:

>>> mesh = molrs.io.read_stl("cavity.stl").scaled(4.18)
>>> mesh.is_watertight()
True
>>> region = molrs.core.Polyhedron(mesh)

__doc__ = 'Triangle surface mesh: a vertex table plus faces indexing into it.\n\nExposed to Python as `molrs.core.TriMesh`. Lengths are whatever unit the\nvertices are in; :meth:`scaled` converts.\n\nExamples\n--------\n>>> mesh = molrs.io.read_stl("cavity.stl").scaled(4.18)\n>>> mesh.is_watertight()\nTrue\n>>> region = molrs.core.Polyhedron(mesh)' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

n_faces property

Number of faces.

n_vertices property

Number of vertices.

__repr__() method descriptor

Return repr(self).

bounds() method descriptor

Axis-aligned bounds, shape (3, 2): [[xmin, xmax], ...].

Raises:

Type Description
ValueError

If the mesh has no vertices.

faces() method descriptor

The face list, shape (F, 3), dtype uint32.

is_watertight() method descriptor

Whether every directed edge has exactly one opposite — a closed surface, the gate a :class:Polyhedron needs.

scaled(factor) method descriptor

The same mesh with every coordinate multiplied by factor.

vertices() method descriptor

The vertex table, shape (V, 3).

Polyhedron

Solid bounded by a watertight :class:TriMesh, exposed as molrs.core.Polyhedron.

Where the mesh came from is not the region's concern — an STL read with :func:molrs.io.read_stl, or a mesh built in memory. Scale the mesh first (mesh.scaled(s)) when the file is not in your working unit.

Examples:

>>> cavity = molrs.core.Polyhedron(molrs.io.read_stl("cavity.stl").scaled(4.18))
>>> inside = cavity.contains(points)

__doc__ = 'Solid bounded by a watertight :class:`TriMesh`, exposed as `molrs.core.Polyhedron`.\n\nWhere the mesh came from is not the region\'s concern — an STL read with\n:func:`molrs.io.read_stl`, or a mesh built in memory. Scale the mesh\nfirst (``mesh.scaled(s)``) when the file is not in your working unit.\n\nExamples\n--------\n>>> cavity = molrs.core.Polyhedron(molrs.io.read_stl("cavity.stl").scaled(4.18))\n>>> inside = cavity.contains(points)' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__and__(value) method descriptor

Return self&value.

__call__(*args, **kwargs) method descriptor

Call self as a function.

__invert__() method descriptor

~self

__or__(value) method descriptor

Return self|value.

__rand__(value) method descriptor

Return value&self.

__repr__() method descriptor

Return repr(self).

__ror__(value) method descriptor

Return value|self.

bounds() method descriptor

Axis-aligned bounding box, shape (3, 2): [[xmin, xmax], [ymin, ymax], [zmin, zmax]].

contains(points) method descriptor

Test which points are inside this region.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Test points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype bool

True for points inside (the boundary counts as inside).

Raises:

Type Description
ValueError

If points does not have 3 columns.

distance(points) method descriptor

Signed distance of each point to the boundary.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Query points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype float

Negative inside, positive outside, zero on the boundary; same unit as the coordinates.

Raises:

Type Description
ValueError

If points does not have 3 columns.

mask(block) method descriptor

Which rows of block lie inside: :meth:contains of its x / y / z columns.

Raises:

Type Description
KeyError

If block lacks x, y or z.

mesh() method descriptor

The bounding surface (a copy).

SphereUnion

Union of spheres, exposed as molrs.core.SphereUnion — atoms as a region.

One sphere per row of centers with its own radius (a scalar is broadcast). With radii = r_vdw + r_probe the union is the solvent-accessible volume and ~SphereUnion(...) the space a probe centre can occupy. Pass box to make the union periodic on the box's periodic axes (minimum image); without it the spheres sit in open space.

Examples:

>>> polymer = molrs.core.SphereUnion(centers, 0.5 * sigma + 1.0, box=frame.box)
>>> void = ~polymer

__doc__ = "Union of spheres, exposed as `molrs.core.SphereUnion` — atoms as a region.\n\nOne sphere per row of ``centers`` with its own radius (a scalar is\nbroadcast). With ``radii = r_vdw + r_probe`` the union is the\nsolvent-accessible volume and ``~SphereUnion(...)`` the space a probe\ncentre can occupy. Pass ``box`` to make the union periodic on the box's\nperiodic axes (minimum image); without it the spheres sit in open space.\n\nExamples\n--------\n>>> polymer = molrs.core.SphereUnion(centers, 0.5 * sigma + 1.0, box=frame.box)\n>>> void = ~polymer" class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

box property

The box the union lives in (free when constructed without one).

n_spheres property

Number of spheres.

__and__(value) method descriptor

Return self&value.

__call__(*args, **kwargs) method descriptor

Call self as a function.

__invert__() method descriptor

~self

__or__(value) method descriptor

Return self|value.

__rand__(value) method descriptor

Return value&self.

__repr__() method descriptor

Return repr(self).

__ror__(value) method descriptor

Return value|self.

bounds() method descriptor

Axis-aligned bounding box, shape (3, 2): [[xmin, xmax], [ymin, ymax], [zmin, zmax]].

centers() method descriptor

Sphere centres as stored (wrapped on periodic axes), shape (N, 3).

contains(points) method descriptor

Test which points are inside this region.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Test points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype bool

True for points inside (the boundary counts as inside).

Raises:

Type Description
ValueError

If points does not have 3 columns.

distance(points) method descriptor

Signed distance of each point to the boundary.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Query points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype float

Negative inside, positive outside, zero on the boundary; same unit as the coordinates.

Raises:

Type Description
ValueError

If points does not have 3 columns.

mask(block) method descriptor

Which rows of block lie inside: :meth:contains of its x / y / z columns.

Raises:

Type Description
KeyError

If block lacks x, y or z.

radii() method descriptor

Sphere radii, shape (N,).

Region

Composed region produced by &, |, or ~ operators.

Exposed to Python as molrs.core.Region. Region(source) clones any region object into this class; otherwise instances come from the operators.

Pickling records the composition as a tree of the operand objects, so a composed region round-trips through whatever its leaves pickle as.

Examples:

>>> shell = Sphere(c, 5.0) & ~Sphere(c, 3.0)
>>> shell.contains(points)

__doc__ = 'Composed region produced by ``&``, ``|``, or ``~`` operators.\n\nExposed to Python as `molrs.core.Region`. ``Region(source)`` clones any region\nobject into this class; otherwise instances come from the operators.\n\nPickling records the composition as a tree of the operand objects, so a\ncomposed region round-trips through whatever its leaves pickle as.\n\nExamples\n--------\n>>> shell = Sphere(c, 5.0) & ~Sphere(c, 3.0)\n>>> shell.contains(points)' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__and__(value) method descriptor

Return self&value.

__call__(*args, **kwargs) method descriptor

Call self as a function.

__invert__() method descriptor

~self

__or__(value) method descriptor

Return self|value.

__rand__(value) method descriptor

Return value&self.

__repr__() method descriptor

Return repr(self).

__ror__(value) method descriptor

Return value|self.

bounds() method descriptor

Axis-aligned bounding box, shape (3, 2): [[xmin, xmax], [ymin, ymax], [zmin, zmax]].

contains(points) method descriptor

Test which points are inside this region.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Test points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype bool

True for points inside (the boundary counts as inside).

Raises:

Type Description
ValueError

If points does not have 3 columns.

distance(points) method descriptor

Signed distance of each point to the boundary.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float

Query points.

required

Returns:

Type Description
numpy.ndarray, shape (N,), dtype float

Negative inside, positive outside, zero on the boundary; same unit as the coordinates.

Raises:

Type Description
ValueError

If points does not have 3 columns.

mask(block) method descriptor

Which rows of block lie inside: :meth:contains of its x / y / z columns.

Raises:

Type Description
KeyError

If block lacks x, y or z.

NeighborList

Neighbor search over one point set, exposed to Python as molrs.core.NeighborList.

The engine owns the cutoff, the backend that indexes space, and the box the index was built for, and keeps the two halves of the job apart: build / update index coordinates and enumerate nothing, neighbors turns the index into a :class:Neighbors table. The pairs are half-shell — each unordered pair once, with i < j. A directed search against a second point set is :class:NeighborQuery.

Parameters:

Name Type Description Default
cutoff float

Interaction radius in Å. Fixed at construction because it sets the cell width of the index.

required
brute_force bool

Use the O(N²) all-pairs backend instead of the O(N) cell list: the same pairs — that is what makes it useful as an oracle — at a cost that grows with the square of the particle count. Default False.

False

Raises:

Type Description
ValueError

If cutoff is not positive.

Passing the engine into :class:`VerletSkin` **moves** it: the list is
consumed, and every later method call on it raises ``ValueError`` — build a
new ``NeighborList`` instead.

Examples:

>>> nl = molrs.core.NeighborList(3.0)          # O(N) cell-list backend
>>> oracle = molrs.core.NeighborList(3.0, brute_force=True)
>>> nl.build(points, box)                 # index only — no pair table
>>> neigh = nl.neighbors()                # both columns (the default)
>>> lean = nl.neighbors(disp=False)       # indices + d² only
>>> nl.update(moved_points)               # re-index in the same box

__doc__ = 'Neighbor search over one point set, exposed to Python as\n`molrs.core.NeighborList`.\n\nThe engine owns the cutoff, the backend that indexes space, and the box the\nindex was built for, and keeps the two halves of the job apart: ``build`` /\n``update`` index coordinates and enumerate nothing, ``neighbors`` turns the\nindex into a :class:`Neighbors` table. The pairs are half-shell — each\nunordered pair once, with ``i < j``. A directed search against a *second*\npoint set is :class:`NeighborQuery`.\n\nParameters\n----------\ncutoff : float\n Interaction radius in Å. Fixed at construction because it sets the cell\n width of the index.\nbrute_force : bool, optional\n Use the O(N²) all-pairs backend instead of the O(N) cell list: the same\n pairs — that is what makes it useful as an oracle — at a cost that\n grows with the square of the particle count. Default ``False``.\n\nRaises\n------\nValueError\n If ``cutoff`` is not positive.\n\nPassing the engine into :class:`VerletSkin` **moves** it: the list is\nconsumed, and every later method call on it raises ``ValueError`` — build a\nnew ``NeighborList`` instead.\n\nExamples\n--------\n>>> nl = molrs.core.NeighborList(3.0) # O(N) cell-list backend\n>>> oracle = molrs.core.NeighborList(3.0, brute_force=True)\n>>> nl.build(points, box) # index only — no pair table\n>>> neigh = nl.neighbors() # both columns (the default)\n>>> lean = nl.neighbors(disp=False) # indices + d² only\n>>> nl.update(moved_points) # re-index in the same box' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

cutoff property

The cutoff distance (Å) fixed at construction.

__reduce__() method descriptor

Pickle as NeighborList(cutoff, brute_force) plus the last build's (points, box) (None before a build), replayed by :meth:__setstate__.

__repr__() method descriptor

Return repr(self).

__setstate__(state) method descriptor

Replay a pickled build: state is (points, box) or None.

build(points, box) method descriptor

Index points in box — coordinates and box.

Builds the spatial index and nothing else: no pairs are enumerated and no table is allocated. box is retained, so a later :meth:update can re-index new coordinates in the same box; a run whose box changes every step (a barostat) must call build again rather than update.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float64

Cartesian coordinates in Å.

required
box Box

Simulation box supplying the periodicity used for minimum images.

required

Raises:

Type Description
ValueError

If points does not have shape (N, 3).

neighbors(dist_sq=True, disp=True) method descriptor

Materialize the pairs into a :class:Neighbors table.

Both physical columns are kept by default, so no downstream analysis is surprised by a missing one; pass False for a column this call site will not read. A dropped column cannot be added afterwards — rerun the search instead.

Row order is unspecified: the cell-list backend materializes in parallel, and the work split decides the order.

Parameters:

Name Type Description Default
dist_sq bool

Keep the squared minimum-image distance column (Ų), 8 B/pair.

True
disp bool

Keep the minimum-image displacement column (Å), 24 B/pair.

True

Returns:

Type Description
Neighbors

update(points) method descriptor

Re-index new coordinates in the box captured by the last :meth:build.

The natural per-step call at fixed volume: the positions move, the box does not. Index-only, like build. There is no skin — this re-indexes every time rather than deciding for you that the previous index was still good enough.

Parameters:

Name Type Description Default
points numpy.ndarray, shape (N, 3), dtype float64

New Cartesian coordinates in Å.

required

Raises:

Type Description
ValueError

If points does not have shape (N, 3), or if no build has run yet — the box is then unknown, and guessing one would fold minimum images against a box the caller never named.

Neighbors

Materialized neighbor pair table, exposed to Python as molrs.core.Neighbors.

A column store of every pair within the cutoff: two index columns that are always present, plus whichever physical columns the search was told to keep. Row k of every column describes the same pair.

A self search is half-shell — each unordered pair appears once, with i < j. A cross-query (:class:NeighborQuery) is directed and has no such rule.

Optional columns are methods returning None when the search did not store them; None is deliberately distinct from a column of zeros, which would mean coincident particles.

Methods:

Name Description
query_point_indices

Query-point index i per pair.

point_indices

Reference-point index j per pair.

dist_sq

Squared minimum-image distance in Ų. Take np.sqrt at the call site for a distance — nothing here hides a per-pair square root.

disp

Minimum-image displacement r_j - r_i in Å, unnormalized.

Attributes:

Name Type Description
n_pairs int

Number of pairs — the row count every column shares.

n_points int

Number of reference points.

n_query_points int

Number of query points (equal to n_points for a self search).

is_self_query bool

True when both index columns address the same point set.

Examples:

>>> neigh = nl.neighbors()
>>> i, j = neigh.query_point_indices(), neigh.point_indices()
>>> distances = np.sqrt(neigh.dist_sq())
>>> directions = neigh.disp() / distances[:, None]

__doc__ = 'Materialized neighbor pair table, exposed to Python as `molrs.core.Neighbors`.\n\nA column store of every pair within the cutoff: two index columns that are\nalways present, plus whichever physical columns the search was told to keep.\nRow ``k`` of every column describes the same pair.\n\nA self search is half-shell — each unordered pair appears once, with\n``i < j``. A cross-query (:class:`NeighborQuery`) is directed and has no\nsuch rule.\n\nOptional columns are methods returning ``None`` when the search did not\nstore them; ``None`` is deliberately distinct from a column of zeros, which\nwould mean coincident particles.\n\nMethods\n-------\nquery_point_indices() : numpy.ndarray[uint32], shape (n_pairs,)\n Query-point index ``i`` per pair.\npoint_indices() : numpy.ndarray[uint32], shape (n_pairs,)\n Reference-point index ``j`` per pair.\ndist_sq() : numpy.ndarray[float64], shape (n_pairs,), or None\n Squared minimum-image distance in Ų. Take ``np.sqrt`` at the call site\n for a distance — nothing here hides a per-pair square root.\ndisp() : numpy.ndarray[float64], shape (n_pairs, 3), or None\n Minimum-image displacement ``r_j - r_i`` in Å, **unnormalized**.\n\nAttributes\n----------\nn_pairs : int\n Number of pairs — the row count every column shares.\nn_points : int\n Number of reference points.\nn_query_points : int\n Number of query points (equal to ``n_points`` for a self search).\nis_self_query : bool\n ``True`` when both index columns address the same point set.\n\nExamples\n--------\n>>> neigh = nl.neighbors()\n>>> i, j = neigh.query_point_indices(), neigh.point_indices()\n>>> distances = np.sqrt(neigh.dist_sq())\n>>> directions = neigh.disp() / distances[:, None]' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

is_self_query property

Whether both index columns address the same point set (half-shell).

n_pairs property

Number of neighbor pairs — the row count every column shares.

n_points property

Number of reference points the search indexed.

n_query_points property

Number of query points; equal to n_points for a self search.

__repr__() method descriptor

Return repr(self).

disp() method descriptor

Minimum-image displacements r_j - r_i (Å) as an (n_pairs, 3) array.

Row k points from i to j and is not normalized — its length is the pair distance. Zero-copy view, or None when this table never stored the column (which is not the same as a zero vector: that would mean two coincident particles).

Returns:

Type Description
numpy.ndarray, shape (n_pairs, 3), dtype float64, or None

dist_sq() method descriptor

Squared minimum-image distances (Ų), one per pair.

Zero-copy view, or None when this table never stored the column. The square root is left to the caller: most consumers compare against a squared cutoff, and an accessor that hid a per-pair sqrt would make that cost invisible.

Returns:

Type Description
numpy.ndarray, shape (n_pairs,), dtype float64, or None

point_indices() method descriptor

Reference-point indices j, one per pair.

Zero-copy view; see query_point_indices.

Returns:

Type Description
numpy.ndarray, shape (n_pairs,), dtype uint32

query_point_indices() method descriptor

Query-point indices i, one per pair.

Zero-copy numpy view into the underlying Rust Vec<u32>, pinned alive through numpy's .base mechanism: the returned array keeps this table alive for as long as Python references it.

Returns:

Type Description
numpy.ndarray, shape (n_pairs,), dtype uint32

NeighborQuery

Cross-query neighbor search, exposed to Python as molrs.core.NeighborQuery.

Build a spatial index from reference points once, then answer repeated queries against it. This is the door for the cross question — "which reference points lie within the cutoff of these other points?" — and is the reason the class exists. A search of one point set against itself belongs to :class:NeighborList, which can additionally re-index moved coordinates and choose which columns a table keeps.

Every table returned here carries both physical columns.

Parameters:

Name Type Description Default
box Box

Simulation box describing geometry and periodic boundaries. A free-boundary search of an isolated cluster takes the non-periodic bounding box padded by the cutoff: Box.bounding(points, (cutoff,) * 3, (False,) * 3).

required
points numpy.ndarray, shape (N, 3), dtype float64

Reference point positions in Å.

required
cutoff float

Cutoff radius in Å.

required

Examples:

>>> nq = molrs.core.NeighborQuery(box, positions, cutoff=3.0)
>>> cross = nq.query(query_positions)   # directed, no ``i < j`` rule
>>> half = nq.query_self()              # half-shell over the reference set

__doc__ = 'Cross-query neighbor search, exposed to Python as `molrs.core.NeighborQuery`.\n\nBuild a spatial index from reference points once, then answer repeated\nqueries against it. This is the door for the *cross* question — "which\nreference points lie within the cutoff of **these other** points?" — and is\nthe reason the class exists. A search of one point set against itself\nbelongs to :class:`NeighborList`, which can additionally re-index moved\ncoordinates and choose which columns a table keeps.\n\nEvery table returned here carries both physical columns.\n\nParameters\n----------\nbox : Box\n Simulation box describing geometry and periodic boundaries. A\n free-boundary search of an isolated cluster takes the non-periodic\n bounding box padded by the cutoff:\n ``Box.bounding(points, (cutoff,) * 3, (False,) * 3)``.\npoints : numpy.ndarray, shape (N, 3), dtype float64\n Reference point positions in Å.\ncutoff : float\n Cutoff radius in Å.\n\nExamples\n--------\n>>> nq = molrs.core.NeighborQuery(box, positions, cutoff=3.0)\n>>> cross = nq.query(query_positions) # directed, no ``i < j`` rule\n>>> half = nq.query_self() # half-shell over the reference set' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.core' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

query(query_points) method descriptor

Find all pairs where i indexes query_points and j indexes the reference points.

Directed: every query point reports all of its reference neighbors, with no i < j constraint. Passing the reference coordinates back in means each point finds itself at distance zero and each pair appears twice — use :meth:query_self when each unordered pair should appear once.

Returns:

Type Description
Neighbors

Raises:

Type Description
ValueError

If query_points does not have shape (M, 3).

query_self() method descriptor

Find each unordered pair within the reference point set once (i < j).

Returns:

Type Description
Neighbors

molrs.perceive

Two verbs: perceive_<fact> is a query — it reports a side table and leaves the graph alone; assign_<fact> is a mutation — it writes the fact onto the molecule it is given, in place, and returns None (assign_kekule_bond_orders returns whether every aromatic bond got a legal number). Copy first (copy.copy(mol)) to keep the input. add_hydrogens is a graph edit and returns a new graph. Atoms in results are the molecule's own views.

perceive_rings(mol) builtin

Perceive the rings of mol (SSSR / minimum cycle basis) as a :class:RingSet side table — a query: mol is left untouched.

perceive_rotatable_bonds(mol, *, unknown_bond=Ellipsis) builtin

Perceive the rotatable bonds of mol — a query: mol is left untouched.

A bond is rotatable when its class is single, both endpoints have degree

1, and it lies on no ring. :func:assign_rotatable_bonds writes the same answer onto the bonds.

Parameters:

Name Type Description Default
mol Atomistic
required
unknown_bond UnknownBondPolicy

What a bond with no bond_type written counts as.

``UnknownBondPolicy.NotRotatable``

Returns:

Type Description
list[RotatableBond]

j / k / downstream are mol's atom views.

RotatableBond

One rotatable bond, j–k, with the atoms that rotate about it — molrs::perceive::RotatableBond, its positional indices resolved to the molecule's atom views.

__doc__ = "One rotatable bond, ``j``–``k``, with the atoms that rotate about it —\n``molrs::perceive::RotatableBond``, its positional indices resolved to the\nmolecule's atom views." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.perceive' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

downstream property

The atoms on the k side, rotated by a torsion about the bond.

j property

The axis start atom.

k property

The axis end atom.

__repr__() method descriptor

Return repr(self).

assign_rings(mol) builtin

Perceive rings (SSSR) and write them onto mol, in place.

Every atom and every bond receives is_in_ring (0/1) and n_rings — including the acyclic ones, which are explicitly flagged 0 rather than left unset. For the ring list itself use :func:perceive_rings.

Examples:

>>> molrs.perceive.assign_rings(mol)
>>> atom["is_in_ring"]
1

assign_aromaticity(mol) builtin

Bring mol to the standard aromatic representation, in place.

On return every aromatic atom carries is_aromatic, every aromatic bond carries bond_type = 4, and every bond carries an integer bond_number — the localized Lewis structure. Nothing carries a fractional order: aromaticity is a bond type, not the number 1.5.

An input that already declares its aromatic bonds (a lowercase SMILES) is kekulized; one that does not is perceived from its integer bond numbers, rings, valences and electron counts, and any assignment it already stated is kept. Hydrogens are neither added nor required.

add_hydrogens(mol) builtin

Add the hydrogens implied by each heavy atom's open valence.

A graph edit, not an assignment: returns a new graph — the heavy-atom skeleton of mol plus the perceived hydrogens and their bonds; mol is left untouched.

Raises:

Type Description
ValueError

If repletion reports a stale atom handle on the graph it built — an invariant no molecule built through this package can break.

assign_stereo(mol) builtin

Perceive stereochemistry from 3-D coordinates and write it onto mol, in place: a stereo prop appears only where a real descriptor was perceived — "CW" / "CCW" on atoms, "E" / "Z" / "either" on bonds.

assign_rotatable_bonds(mol, *, unknown_bond=Ellipsis) builtin

Perceive rotatable bonds and write them onto mol, in place.

The :func:perceive_rotatable_bonds answer on the bonds: every bond receives is_rotatable (0/1).

Parameters:

Name Type Description Default
mol Atomistic

The molecule to annotate.

required
unknown_bond UnknownBondPolicy

What a bond with no bond_type written counts as.

``UnknownBondPolicy.NotRotatable``

assign_bond_orders(mol) builtin

Judge every bond's order from the connectivity alone, as antechamber's bondtype -j full does, and write it onto mol, in place: every judged bond gets a localized bond_number (½/3) and the bond_type it implies. The answer follows the atom and bond order, as antechamber's does; the bonds of a residue no valence state closes are left untouched.

assign_kekule_bond_orders(mol) builtin

Assign a localized (Kekulé) bond_number to every aromatic bond of mol, in place, and return whether every aromatic bond came out with a legal number.

Kekulization and nothing else: a molecule whose aromatic bonds are not marked yet is left unchanged (True), because deciding which bonds are aromatic belongs to :func:assign_aromaticity. An aromatic bond that already carries a legal number keeps it; a system with no legal assignment is left entirely unchanged rather than half-assigned (False).

assign_bcc_bond_types(mol, source) builtin

Perceive antechamber's BCC bond types and write them onto mol, in place: every bond receives a bcc_bond_type in {1, 2, 3, 6, 7, 8, 9} — the alphabet AM1-BCC's atom-type rules and correction table are keyed on, which distinguishes aromatic bonds (⅞) and delocalized ones (9, e.g. a carboxylate's two equivalent C–O bonds) from plain orders. The bond's type — the caller's force-field label — is neither read nor written.

Parameters:

Name Type Description Default
mol Atomistic
required
source BondOrderSource

Which bond orders the types follow: BondOrderSource.Stated (the molecule's own) or BondOrderSource.Connectivity (judged from the connectivity alone, as antechamber runs it; every hydrogen must be drawn). Required.

required

BondOrderSource

Where :func:assign_bcc_bond_types (and :class:~molrs.ff.typifier.AtdTypifier) take bond orders from — molrs::perceive::BondOrderSource.

Stated: the orders the molecule states (aromatic bonds without a number are kekulized). Connectivity: the orders antechamber judges from the connectivity alone (bondtype -j full), whatever the molecule states — what antechamber does by default; every hydrogen must be drawn.

Connectivity = BondOrderSource.Connectivity class-attribute

Where :func:assign_bcc_bond_types (and :class:~molrs.ff.typifier.AtdTypifier) take bond orders from — molrs::perceive::BondOrderSource.

Stated: the orders the molecule states (aromatic bonds without a number are kekulized). Connectivity: the orders antechamber judges from the connectivity alone (bondtype -j full), whatever the molecule states — what antechamber does by default; every hydrogen must be drawn.

Stated = BondOrderSource.Stated class-attribute

Where :func:assign_bcc_bond_types (and :class:~molrs.ff.typifier.AtdTypifier) take bond orders from — molrs::perceive::BondOrderSource.

Stated: the orders the molecule states (aromatic bonds without a number are kekulized). Connectivity: the orders antechamber judges from the connectivity alone (bondtype -j full), whatever the molecule states — what antechamber does by default; every hydrogen must be drawn.

__doc__ = 'Where :func:`assign_bcc_bond_types` (and :class:`~molrs.ff.typifier.AtdTypifier`)\ntake bond orders from — ``molrs::perceive::BondOrderSource``.\n\n``Stated``: the orders the molecule states (aromatic bonds without a\nnumber are kekulized). ``Connectivity``: the orders antechamber judges from\nthe connectivity alone (``bondtype -j full``), whatever the molecule\nstates — what ``antechamber`` does by default; every hydrogen must be\ndrawn.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.perceive' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__eq__(value) method descriptor

Return self==value.

__ge__(value) method descriptor

Return self>=value.

__gt__(value) method descriptor

Return self>value.

__hash__() method descriptor

Return hash(self).

__int__() method descriptor

int(self)

__le__(value) method descriptor

Return self<=value.

__lt__(value) method descriptor

Return self<value.

__ne__(value) method descriptor

Return self!=value.

__repr__() method descriptor

Return repr(self).

UnknownBondPolicy

What a bond with no bond_type written counts as when rotatable bonds are perceived — molrs::perceive::UnknownBondPolicy.

NotRotatable (the default): only a bond that is single rotates. AsSingle: an unclassified bond counts as single, then the degree and ring rules apply (all-single graphs whose orders were never written).

AsSingle = UnknownBondPolicy.AsSingle class-attribute

What a bond with no bond_type written counts as when rotatable bonds are perceived — molrs::perceive::UnknownBondPolicy.

NotRotatable (the default): only a bond that is single rotates. AsSingle: an unclassified bond counts as single, then the degree and ring rules apply (all-single graphs whose orders were never written).

NotRotatable = UnknownBondPolicy.NotRotatable class-attribute

What a bond with no bond_type written counts as when rotatable bonds are perceived — molrs::perceive::UnknownBondPolicy.

NotRotatable (the default): only a bond that is single rotates. AsSingle: an unclassified bond counts as single, then the degree and ring rules apply (all-single graphs whose orders were never written).

__doc__ = 'What a bond with no ``bond_type`` written counts as when rotatable bonds\nare perceived — ``molrs::perceive::UnknownBondPolicy``.\n\n``NotRotatable`` (the default): only a bond that *is* single rotates.\n``AsSingle``: an unclassified bond counts as single, then the degree and\nring rules apply (all-single graphs whose orders were never written).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.perceive' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__eq__(value) method descriptor

Return self==value.

__ge__(value) method descriptor

Return self>=value.

__gt__(value) method descriptor

Return self>value.

__hash__() method descriptor

Return hash(self).

__int__() method descriptor

int(self)

__le__(value) method descriptor

Return self<=value.

__lt__(value) method descriptor

Return self<value.

__ne__(value) method descriptor

Return self!=value.

__repr__() method descriptor

Return repr(self).

assign_equivalence_classes(mol) builtin

Perceive charge-equivalence classes and write them onto mol, in place: every atom receives an equiv_class id, antechamber's default -eq 1 partition (the one AM1-BCC averages its AM1 charges over). Whether to average is a property of the charge model (:meth:BccModel.needs_equivalencing), not of the graph.

RingSet

The ring facts of a molecule: SSSR rings and the systems they fuse into.

Returned by :func:perceive_rings, which runs the perception once; every method reads the result. Atoms are the molecule's own views: a ring is a list of :class:~molrs.core.Atom, and an atom argument must be an atom of that molecule.

Not to be confused with :func:assign_rings, which answers a different question — it decorates the graph with ring flags, in place. This type reports, and never touches the molecule.

Examples:

>>> rings = molrs.perceive.perceive_rings(molrs.io.smiles.read_smiles("c1ccccc1").to_atomistic())
>>> rings.n_rings()
1
>>> rings.ring_sizes()
[6]

__doc__ = 'The ring facts of a molecule: SSSR rings and the systems they fuse into.\n\nReturned by :func:`perceive_rings`, which runs the perception once; every\nmethod reads the result. Atoms are the molecule\'s own views: a ring is a\nlist of :class:`~molrs.core.Atom`, and an atom argument must be an atom\nof that molecule.\n\nNot to be confused with :func:`assign_rings`, which answers a\ndifferent question — it *decorates* the graph with ring flags, in place.\nThis type *reports*, and never touches the molecule.\n\nExamples\n--------\n>>> rings = molrs.perceive.perceive_rings(molrs.io.smiles.read_smiles("c1ccccc1").to_atomistic())\n>>> rings.n_rings()\n1\n>>> rings.ring_sizes()\n[6]' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.perceive' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

is_atom_in_ring(atom) method descriptor

Whether atom belongs to any ring.

Raises:

Type Description
ValueError

If atom is not an atom of the perceived molecule.

max_ring_system_size() method descriptor

Atom count of the largest fused / bridged ring system (naphthalene → 10); 0 for an acyclic molecule.

n_atom_rings(atom) method descriptor

Number of rings containing atom.

n_rings() method descriptor

Number of rings.

ring_sizes() method descriptor

Atom count of every ring, ascending.

ring_systems() method descriptor

Rings that share at least one atom, unioned: benzene → one system of 6, naphthalene → one of 10, biphenyl → two of 6.

rings() method descriptor

Every ring, as the atoms of a closed path.

smallest_ring_containing_atom(atom) method descriptor

Size of the smallest ring containing atom, or None.

Reaction

Compiled reaction SMARTS, exposed to Python as molrs.perceive.Reaction.

A thin wrapper over the core [Reaction] (molrs/src/core/chem/smarts). Parses reactants >> products (tolerating an ignored >agent> field), derives the graph edit from the Daylight atom-map diff, and applies it to one matched occurrence in place. Reacting atoms may carry SMARTS queries (RDKit-style reaction SMARTS); only concrete product atoms are addable.

Examples:

>>> rxn = molrs.perceive.Reaction("[N;H2:1].[C:2](=O)OC >> [N:1][C:2]=O")
>>> rxn.forming_bonds                 # [(1, 2)]
>>> binding = {}                       # match each reactant component ...
>>> for pat in rxn.reactant_patterns:  # ... and merge the map->atom dicts
...     binding.update(pat.find_matches(mol)[0].mapping)
>>> rxn.apply(mol, binding)            # edits `mol` in place

__doc__ = 'Compiled reaction SMARTS, exposed to Python as `molrs.perceive.Reaction`.\n\nA thin wrapper over the core [`Reaction`] (`molrs/src/core/chem/smarts`).\nParses ``reactants >> products`` (tolerating an ignored ``>agent>`` field),\nderives the graph edit from the Daylight atom-map diff, and applies it to one\nmatched occurrence in place. Reacting atoms may carry SMARTS queries\n(RDKit-style reaction SMARTS); only concrete product atoms are addable.\n\nExamples\n--------\n>>> rxn = molrs.perceive.Reaction("[N;H2:1].[C:2](=O)OC >> [N:1][C:2]=O")\n>>> rxn.forming_bonds # [(1, 2)]\n>>> binding = {} # match each reactant component ...\n>>> for pat in rxn.reactant_patterns: # ... and merge the map->atom dicts\n... binding.update(pat.find_matches(mol)[0].mapping)\n>>> rxn.apply(mol, binding) # edits `mol` in place' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.perceive' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

forming_bonds property

The (map_a, map_b) pairs of newly formed bonds between preserved atoms — the distance criterion for picking a reacting occurrence. Bonds that merely change order, and bonds to added atoms, are excluded.

reactant_patterns property

The reactant components (LHS), one :class:SmartsPattern per top-level . component, for matching / pairing each independently.

__repr__() method descriptor

Return repr(self).

apply(mol, binding, labels=None, refresh=True) method descriptor

Apply the transform to mol in place at the occurrence pinned by binding ({map_number: Atom}). Deletes unmapped-LHS atoms, adds unmapped-RHS atoms (no coordinates), forms/breaks bonds, then regenerates angle/dihedral topology and re-perceives aromaticity.

Returns the deduplicated, deterministically-ordered list of surviving touched atoms (formed/broken/order-changed bond endpoints, added atoms, deleted atoms' surviving neighbours, and prop-set atoms). Deleted atoms are never included. The caller expands this seed set into a retype-safe region. labels ({Atom: label}) is the %LABEL context the reactant patterns read.

refresh=False skips the per-apply whole-graph angle/dihedral regeneration + aromaticity re-perception: a batch caller (crosslinking a melt with many edits) passes it and refreshes ONCE at the end, turning an O(edits × N) cost into O(edits × local). Matching only needs bonds, which are updated in place regardless.

apply_many(mol, bindings, labels=None, refresh=True) method descriptor

Compile every binding against the intact graph, then apply the disjoint transforms as one batch (leaving groups deleted with one relation scan). labels and refresh are as for :meth:apply.

Returns:

Type Description
ReactionBatch

Per binding, the touched atoms (as :meth:apply returns them) and the atoms the product created, in product creation order.

Raises:

Type Description
ValueError

Two bindings resolve the same leaving atom, a binding misses an atom map, or an edit is refused.

ReactionBatch

The result of :meth:Reaction.apply_many — molrs::perceive::smarts::ReactionBatch.

__doc__ = 'The result of :meth:`Reaction.apply_many` —\n``molrs::perceive::smarts::ReactionBatch``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.perceive' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

created property

Per binding: the atoms the product added, in product creation order — the stable correspondence for replaying annotations onto RHS-added atoms (sorting handles cannot give it once deleted slots are reused).

touched property

Per binding: the surviving touched atoms, deduplicated and ordered as :meth:Reaction.apply returns them.

__repr__() method descriptor

Return repr(self).

molrs.io

One module per file format. Every format has one door per direction: read_X(source) reads a file's first (or only) frame and write_X(sink, frame) writes one frame as a whole file. A source is an os.PathLike, the bytes of a whole file, or a molrs.io.Text; a plain str is refused (ambiguous between a path and text). A sink is an os.PathLike or a bytearray (cleared, then holding exactly the file's bytes). A multi-frame format's classes live in its submodule: molrs.io.X.<X>Reader(source) (len, reader[i] / reader[a:b], iteration) and molrs.io.X.<X>Writer(sink) (write(frame), close(), context manager). Family formats carry the family name (read_lammps_data, read_prmtop, read_poscar). No door picks the format for the caller. Every reader emits the canonical column names (molrs.core.keys).

Text

The text of a whole file, for a molrs.io reader to read.

A reader takes a path (pathlib.Path), bytes, or this: a plain str is refused, because it could name a file or hold one.

Parameters:

Name Type Description Default
text str

The file's whole content.

required

Examples:

>>> frame = molrs.io.read_xyz(molrs.io.Text("1\n\nO 0 0 0\n"))
>>> frame["atoms"].nrows
1

__doc__ = 'The text of a whole file, for a ``molrs.io`` reader to read.\n\nA reader takes a path (``pathlib.Path``), ``bytes``, or this: a plain\n``str`` is refused, because it could name a file or hold one.\n\nParameters\n----------\ntext : str\n The file\'s whole content.\n\nExamples\n--------\n>>> frame = molrs.io.read_xyz(molrs.io.Text("1\\n\\nO 0 0 0\\n"))\n>>> frame["atoms"].nrows\n1' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

__str__() method descriptor

Return str(self).

Structure files

read_pdb(source) builtin

Read the first model of a PDB file.

The "atoms" block carries element (str), x/y/z (float), id and res_id (uint), name, res_name, chain, icode and altloc (str; "" for none), occupancy and b_factor (float). A CRYST1 record gives frame.box. Every model: :class:molrs.io.pdb.PdbReader.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

Raises:

Type Description
TypeError

If source is a str (pass pathlib.Path(s) or molrs.io.Text(s)).

OSError

If the file cannot be opened or parsed.

Examples:

>>> frame = molrs.io.read_pdb(pathlib.Path("molecule.pdb"))

write_pdb(sink, frame) builtin

Write a frame as a one-model PDB file.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file (created or truncated), or a buffer (cleared, then holding exactly the file's bytes).

required
frame Frame

The frame to write.

required

Raises:

Type Description
OSError

If the frame cannot be written.

read_xyz(source) builtin

Read the first frame of an (extended) XYZ file. Every frame: :class:molrs.io.xyz.XyzReader.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

Examples:

>>> frame = molrs.io.read_xyz(molrs.io.Text("1\n\nO 0 0 0\n"))
>>> frame["atoms"].nrows
1

write_xyz(sink, frame) builtin

Write a frame as a one-frame extended XYZ file.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required

read_gro(source) builtin

Read the first frame of a GROMACS GRO file.

The "atoms" block carries res_id, res_name, name, element (inferred from the atom name), id and x/y/z in Å (converted from the file's nm), plus vx/vy/vz in Å/ps when the file has velocities. The box is frame.box. Every frame: :class:molrs.io.gro.GroReader.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

write_gro(sink, frame) builtin

Write a frame as a one-frame GROMACS GRO file (Å → nm).

Reads x/y/z from the "atoms" block and, when present, res_id, res_name, name, id and vx/vy/vz. The box is frame.box.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required

read_sdf(source) builtin

Read the first record of an MDL SDF / molfile (V2000). Every record: :class:molrs.io.sdf.SdfReader.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

atoms (element, id, x/y/z) and, when the record has any, bonds.

read_mol2(source) builtin

Read the first molecule of a Tripos MOL2 file.

Atoms carry id, name, x/y/z, type (the SYBYL atom type), optional res_id/res_name (the substructure) and charge. Bonds carry atomi/atomj (0-based), type (the SYBYL bond type token) and the chemical bond_type/bond_number. Every molecule: :class:molrs.io.mol2.Mol2Reader.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

write_mol2(sink, frame) builtin

Write a frame as a one-molecule Tripos MOL2 file.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required

read_cif(source) builtin

Read the first data_ block of a CIF file. Every block: :class:molrs.io.cif.CifReader.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

write_cif(sink, frame) builtin

Write a frame as a single-block CIF file.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required

read_xsf(source) builtin

Read an XSF (XCrySDen Structure File).

Crystal structures (CRYSTAL + PRIMVEC/CONVVEC) yield a periodic box; molecular structures (MOLECULE) a free box. Atoms carry atomic_number and x/y/z (Å).

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

write_xsf(sink, frame) builtin

Write a frame as an XSF file: CRYSTAL for a defined periodic box, otherwise MOLECULE. Atoms need atomic_number and x/y/z.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required

read_cube(source) builtin

Read a Gaussian cube file.

The frame holds an "atoms" block (atomic_number, x, y, z, charge) and the grid "cube": "density" (a scalar field) or "mo_<idx>" arrays. Values are as stored in the file; frame.meta["cube_units"] records "bohr" or "angstrom". Cubes back to back: :class:molrs.io.cube.CubeReader.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

write_cube(sink, frame) builtin

Write a frame as a Gaussian cube file. The frame needs a "cube" grid and an "atoms" block.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required

read_poscar(source) builtin

Read a VASP POSCAR / CONTCAR structure file.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

write_poscar(sink, frame) builtin

Write a frame as a VASP POSCAR file.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required

read_chgcar(source) builtin

Read a VASP CHGCAR or CHGDIF file.

The frame holds an "atoms" block (element, Cartesian x/y/z in Å), a triclinic periodic box and the grid "chgcar" with "total" (and "diff" for ISPIN=2). The values are raw (ρ × V_cell, units e): divide by frame.box.volume() for e/ų.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

read_stl(source) builtin

Read an STL surface mesh (ASCII or binary).

The file's numbers are taken as they are; convert with TriMesh.scaled when the file is not in the length unit you work in.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
TriMesh

Raises:

Type Description
OSError

If the file cannot be opened or is not STL.

Multi-frame readers and writers

PdbReader

Lazy, indexed reader of every frame of a PDB (one frame per MODEL) file — molrs::io's PdbReader::open.

Frames are parsed on demand: random access (reader[i]) indexes the file once, then seeks; iteration walks it in order.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (.gz is decompressed), or its whole content.

required

Examples:

>>> reader = molrs.io.pdb.PdbReader(pathlib.Path("run"))
>>> last = reader[-1]

__doc__ = 'Lazy, indexed reader of every frame of a PDB (one frame per ``MODEL``) file —\n``molrs::io``\'s ``PdbReader::open``.\n\nFrames are parsed on demand: random access (``reader[i]``) indexes\nthe file once, then seeks; iteration walks it in order.\n\nParameters\n----------\nsource : os.PathLike | bytes | molrs.io.Text\n The file (``.gz`` is decompressed), or its whole content.\n\nExamples\n--------\n>>> reader = molrs.io.pdb.PdbReader(pathlib.Path("run")) # doctest: +SKIP\n>>> last = reader[-1] # doctest: +SKIP\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.pdb' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Index the whole file now rather than on the first random access.

close() method descriptor

Release the file. Further reads raise ValueError.

PdbWriter

Writer of a PDB file, one frame per :meth:write — molrs::io's PdbWriter::create.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file (created or truncated), or a buffer: cleared, then holding exactly the bytes written so far after each write.

required

Examples:

>>> with molrs.io.pdb.PdbWriter(pathlib.Path("out")) as w:
...     for frame in frames:
...         w.write(frame)

__doc__ = 'Writer of a PDB file, one frame per :meth:`write` —\n``molrs::io``\'s ``PdbWriter::create``.\n\nParameters\n----------\nsink : os.PathLike | bytearray\n The file (created or truncated), or a buffer: cleared, then\n holding exactly the bytes written so far after each write.\n\nExamples\n--------\n>>> with molrs.io.pdb.PdbWriter(pathlib.Path("out")) as w: # doctest: +SKIP\n... for frame in frames:\n... w.write(frame)\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.pdb' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

close() method descriptor

Release the file (every write is already flushed). Idempotent; writes after it raise ValueError.

write(frame) method descriptor

Append frame to the file.

Raises:

Type Description
ValueError

If the writer is closed.

OSError

If the frame cannot be written.

XyzReader

Lazy, indexed reader of every frame of a (extended) XYZ file — molrs::io's XyzReader::open.

Frames are parsed on demand: random access (reader[i]) indexes the file once, then seeks; iteration walks it in order.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (.gz is decompressed), or its whole content.

required

Examples:

>>> reader = molrs.io.xyz.XyzReader(pathlib.Path("run"))
>>> last = reader[-1]

__doc__ = 'Lazy, indexed reader of every frame of a (extended) XYZ file —\n``molrs::io``\'s ``XyzReader::open``.\n\nFrames are parsed on demand: random access (``reader[i]``) indexes\nthe file once, then seeks; iteration walks it in order.\n\nParameters\n----------\nsource : os.PathLike | bytes | molrs.io.Text\n The file (``.gz`` is decompressed), or its whole content.\n\nExamples\n--------\n>>> reader = molrs.io.xyz.XyzReader(pathlib.Path("run")) # doctest: +SKIP\n>>> last = reader[-1] # doctest: +SKIP\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.xyz' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Index the whole file now rather than on the first random access.

close() method descriptor

Release the file. Further reads raise ValueError.

XyzWriter

Writer of a (extended) XYZ file, one frame per :meth:write — molrs::io's XyzWriter::create.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file (created or truncated), or a buffer: cleared, then holding exactly the bytes written so far after each write.

required

Examples:

>>> with molrs.io.xyz.XyzWriter(pathlib.Path("out")) as w:
...     for frame in frames:
...         w.write(frame)

__doc__ = 'Writer of a (extended) XYZ file, one frame per :meth:`write` —\n``molrs::io``\'s ``XyzWriter::create``.\n\nParameters\n----------\nsink : os.PathLike | bytearray\n The file (created or truncated), or a buffer: cleared, then\n holding exactly the bytes written so far after each write.\n\nExamples\n--------\n>>> with molrs.io.xyz.XyzWriter(pathlib.Path("out")) as w: # doctest: +SKIP\n... for frame in frames:\n... w.write(frame)\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.xyz' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

close() method descriptor

Release the file (every write is already flushed). Idempotent; writes after it raise ValueError.

write(frame) method descriptor

Append frame to the file.

Raises:

Type Description
ValueError

If the writer is closed.

OSError

If the frame cannot be written.

GroReader

Lazy, indexed reader of every frame of a GROMACS GRO file — molrs::io's GroReader::open.

Frames are parsed on demand: random access (reader[i]) indexes the file once, then seeks; iteration walks it in order.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (.gz is decompressed), or its whole content.

required

Examples:

>>> reader = molrs.io.gro.GroReader(pathlib.Path("run"))
>>> last = reader[-1]

__doc__ = 'Lazy, indexed reader of every frame of a GROMACS GRO file —\n``molrs::io``\'s ``GroReader::open``.\n\nFrames are parsed on demand: random access (``reader[i]``) indexes\nthe file once, then seeks; iteration walks it in order.\n\nParameters\n----------\nsource : os.PathLike | bytes | molrs.io.Text\n The file (``.gz`` is decompressed), or its whole content.\n\nExamples\n--------\n>>> reader = molrs.io.gro.GroReader(pathlib.Path("run")) # doctest: +SKIP\n>>> last = reader[-1] # doctest: +SKIP\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.gro' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Index the whole file now rather than on the first random access.

close() method descriptor

Release the file. Further reads raise ValueError.

GroWriter

Writer of a GROMACS GRO file, one frame per :meth:write — molrs::io's GroWriter::create.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file (created or truncated), or a buffer: cleared, then holding exactly the bytes written so far after each write.

required

Examples:

>>> with molrs.io.gro.GroWriter(pathlib.Path("out")) as w:
...     for frame in frames:
...         w.write(frame)

__doc__ = 'Writer of a GROMACS GRO file, one frame per :meth:`write` —\n``molrs::io``\'s ``GroWriter::create``.\n\nParameters\n----------\nsink : os.PathLike | bytearray\n The file (created or truncated), or a buffer: cleared, then\n holding exactly the bytes written so far after each write.\n\nExamples\n--------\n>>> with molrs.io.gro.GroWriter(pathlib.Path("out")) as w: # doctest: +SKIP\n... for frame in frames:\n... w.write(frame)\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.gro' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

close() method descriptor

Release the file (every write is already flushed). Idempotent; writes after it raise ValueError.

write(frame) method descriptor

Append frame to the file.

Raises:

Type Description
ValueError

If the writer is closed.

OSError

If the frame cannot be written.

Mol2Reader

Lazy, indexed reader of every frame of a Tripos MOL2 (one frame per molecule) file — molrs::io's Mol2Reader::open.

Frames are parsed on demand: random access (reader[i]) indexes the file once, then seeks; iteration walks it in order.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (.gz is decompressed), or its whole content.

required

Examples:

>>> reader = molrs.io.mol2.Mol2Reader(pathlib.Path("run"))
>>> last = reader[-1]

__doc__ = 'Lazy, indexed reader of every frame of a Tripos MOL2 (one frame per molecule) file —\n``molrs::io``\'s ``Mol2Reader::open``.\n\nFrames are parsed on demand: random access (``reader[i]``) indexes\nthe file once, then seeks; iteration walks it in order.\n\nParameters\n----------\nsource : os.PathLike | bytes | molrs.io.Text\n The file (``.gz`` is decompressed), or its whole content.\n\nExamples\n--------\n>>> reader = molrs.io.mol2.Mol2Reader(pathlib.Path("run")) # doctest: +SKIP\n>>> last = reader[-1] # doctest: +SKIP\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.mol2' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Index the whole file now rather than on the first random access.

close() method descriptor

Release the file. Further reads raise ValueError.

Mol2Writer

Writer of a Tripos MOL2 file, one frame per :meth:write — molrs::io's Mol2Writer::create.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file (created or truncated), or a buffer: cleared, then holding exactly the bytes written so far after each write.

required

Examples:

>>> with molrs.io.mol2.Mol2Writer(pathlib.Path("out")) as w:
...     for frame in frames:
...         w.write(frame)

__doc__ = 'Writer of a Tripos MOL2 file, one frame per :meth:`write` —\n``molrs::io``\'s ``Mol2Writer::create``.\n\nParameters\n----------\nsink : os.PathLike | bytearray\n The file (created or truncated), or a buffer: cleared, then\n holding exactly the bytes written so far after each write.\n\nExamples\n--------\n>>> with molrs.io.mol2.Mol2Writer(pathlib.Path("out")) as w: # doctest: +SKIP\n... for frame in frames:\n... w.write(frame)\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.mol2' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

close() method descriptor

Release the file (every write is already flushed). Idempotent; writes after it raise ValueError.

write(frame) method descriptor

Append frame to the file.

Raises:

Type Description
ValueError

If the writer is closed.

OSError

If the frame cannot be written.

CifReader

Lazy, indexed reader of every frame of a CIF (one frame per data_ block) file — molrs::io's CifReader::open.

Frames are parsed on demand: random access (reader[i]) indexes the file once, then seeks; iteration walks it in order.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (.gz is decompressed), or its whole content.

required

Examples:

>>> reader = molrs.io.cif.CifReader(pathlib.Path("run"))
>>> last = reader[-1]

__doc__ = 'Lazy, indexed reader of every frame of a CIF (one frame per ``data_`` block) file —\n``molrs::io``\'s ``CifReader::open``.\n\nFrames are parsed on demand: random access (``reader[i]``) indexes\nthe file once, then seeks; iteration walks it in order.\n\nParameters\n----------\nsource : os.PathLike | bytes | molrs.io.Text\n The file (``.gz`` is decompressed), or its whole content.\n\nExamples\n--------\n>>> reader = molrs.io.cif.CifReader(pathlib.Path("run")) # doctest: +SKIP\n>>> last = reader[-1] # doctest: +SKIP\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.cif' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Index the whole file now rather than on the first random access.

close() method descriptor

Release the file. Further reads raise ValueError.

CifWriter

Writer of a CIF file, one frame per :meth:write — molrs::io's CifWriter::create.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file (created or truncated), or a buffer: cleared, then holding exactly the bytes written so far after each write.

required

Examples:

>>> with molrs.io.cif.CifWriter(pathlib.Path("out")) as w:
...     for frame in frames:
...         w.write(frame)

__doc__ = 'Writer of a CIF file, one frame per :meth:`write` —\n``molrs::io``\'s ``CifWriter::create``.\n\nParameters\n----------\nsink : os.PathLike | bytearray\n The file (created or truncated), or a buffer: cleared, then\n holding exactly the bytes written so far after each write.\n\nExamples\n--------\n>>> with molrs.io.cif.CifWriter(pathlib.Path("out")) as w: # doctest: +SKIP\n... for frame in frames:\n... w.write(frame)\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.cif' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

close() method descriptor

Release the file (every write is already flushed). Idempotent; writes after it raise ValueError.

write(frame) method descriptor

Append frame to the file.

Raises:

Type Description
ValueError

If the writer is closed.

OSError

If the frame cannot be written.

SdfReader

Lazy, indexed reader of every frame of a MDL SDF (one frame per record) file — molrs::io's SdfReader::open.

Frames are parsed on demand: random access (reader[i]) indexes the file once, then seeks; iteration walks it in order.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (.gz is decompressed), or its whole content.

required

Examples:

>>> reader = molrs.io.sdf.SdfReader(pathlib.Path("run"))
>>> last = reader[-1]

__doc__ = 'Lazy, indexed reader of every frame of a MDL SDF (one frame per record) file —\n``molrs::io``\'s ``SdfReader::open``.\n\nFrames are parsed on demand: random access (``reader[i]``) indexes\nthe file once, then seeks; iteration walks it in order.\n\nParameters\n----------\nsource : os.PathLike | bytes | molrs.io.Text\n The file (``.gz`` is decompressed), or its whole content.\n\nExamples\n--------\n>>> reader = molrs.io.sdf.SdfReader(pathlib.Path("run")) # doctest: +SKIP\n>>> last = reader[-1] # doctest: +SKIP\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.sdf' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Index the whole file now rather than on the first random access.

close() method descriptor

Release the file. Further reads raise ValueError.

CubeReader

Lazy, indexed reader of every frame of a Gaussian cube (cubes back to back) file — molrs::io's CubeReader::open.

Frames are parsed on demand: random access (reader[i]) indexes the file once, then seeks; iteration walks it in order.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (.gz is decompressed), or its whole content.

required

Examples:

>>> reader = molrs.io.cube.CubeReader(pathlib.Path("run"))
>>> last = reader[-1]

__doc__ = 'Lazy, indexed reader of every frame of a Gaussian cube (cubes back to back) file —\n``molrs::io``\'s ``CubeReader::open``.\n\nFrames are parsed on demand: random access (``reader[i]``) indexes\nthe file once, then seeks; iteration walks it in order.\n\nParameters\n----------\nsource : os.PathLike | bytes | molrs.io.Text\n The file (``.gz`` is decompressed), or its whole content.\n\nExamples\n--------\n>>> reader = molrs.io.cube.CubeReader(pathlib.Path("run")) # doctest: +SKIP\n>>> last = reader[-1] # doctest: +SKIP\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.cube' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Index the whole file now rather than on the first random access.

close() method descriptor

Release the file. Further reads raise ValueError.

read_dcd(source) builtin

Read the first frame of a DCD trajectory. Every frame: :class:molrs.io.dcd.DcdReader.

Parameters:

Name Type Description Default
source PathLike | bytes

The file, or its whole content.

required

Returns:

Type Description
Frame

write_dcd(sink, frame) builtin

Write a frame as a one-frame DCD file (NAMD-compatible, little-endian). A frame with a w column (4D dynamics) is refused.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required

DcdReader

Lazy, indexed reader of every frame of a DCD file — molrs::io's DcdReader::open.

Frames are parsed on demand: random access (reader[i]) indexes the file once, then seeks; iteration walks it in order.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (.gz is decompressed), or its whole content.

required

Examples:

>>> reader = molrs.io.dcd.DcdReader(pathlib.Path("run"))
>>> last = reader[-1]

__doc__ = 'Lazy, indexed reader of every frame of a DCD file —\n``molrs::io``\'s ``DcdReader::open``.\n\nFrames are parsed on demand: random access (``reader[i]``) indexes\nthe file once, then seeks; iteration walks it in order.\n\nParameters\n----------\nsource : os.PathLike | bytes | molrs.io.Text\n The file (``.gz`` is decompressed), or its whole content.\n\nExamples\n--------\n>>> reader = molrs.io.dcd.DcdReader(pathlib.Path("run")) # doctest: +SKIP\n>>> last = reader[-1] # doctest: +SKIP\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.dcd' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Index the whole file now rather than on the first random access.

close() method descriptor

Release the file. Further reads raise ValueError.

DcdWriter

Writer of a DCD file, one frame per :meth:write — molrs::io's DcdWriter::create.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file (created or truncated), or a buffer: cleared, then holding exactly the bytes written so far after each write.

required

Examples:

>>> with molrs.io.dcd.DcdWriter(pathlib.Path("out")) as w:
...     for frame in frames:
...         w.write(frame)

__doc__ = 'Writer of a DCD file, one frame per :meth:`write` —\n``molrs::io``\'s ``DcdWriter::create``.\n\nParameters\n----------\nsink : os.PathLike | bytearray\n The file (created or truncated), or a buffer: cleared, then\n holding exactly the bytes written so far after each write.\n\nExamples\n--------\n>>> with molrs.io.dcd.DcdWriter(pathlib.Path("out")) as w: # doctest: +SKIP\n... for frame in frames:\n... w.write(frame)\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.dcd' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

close() method descriptor

Release the file (every write is already flushed). Idempotent; writes after it raise ValueError.

write(frame) method descriptor

Append frame to the file.

Raises:

Type Description
ValueError

If the writer is closed.

OSError

If the frame cannot be written.

read_trr(source) builtin

Read the first frame of a GROMACS TRR trajectory (nm → Å). Every frame: :class:molrs.io.trr.TrrReader.

Parameters:

Name Type Description Default
source PathLike | bytes

The file, or its whole content.

required

Returns:

Type Description
Frame

write_trr(sink, frame) builtin

Write a frame as a one-frame GROMACS TRR file (Å → nm, single precision): x/y/z, and vx/vy/vz and fx/fy/fz when present.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required

TrrReader

Lazy, indexed reader of every frame of a GROMACS TRR file — molrs::io's TrrReader::open.

Frames are parsed on demand: random access (reader[i]) indexes the file once, then seeks; iteration walks it in order.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (.gz is decompressed), or its whole content.

required

Examples:

>>> reader = molrs.io.trr.TrrReader(pathlib.Path("run"))
>>> last = reader[-1]

__doc__ = 'Lazy, indexed reader of every frame of a GROMACS TRR file —\n``molrs::io``\'s ``TrrReader::open``.\n\nFrames are parsed on demand: random access (``reader[i]``) indexes\nthe file once, then seeks; iteration walks it in order.\n\nParameters\n----------\nsource : os.PathLike | bytes | molrs.io.Text\n The file (``.gz`` is decompressed), or its whole content.\n\nExamples\n--------\n>>> reader = molrs.io.trr.TrrReader(pathlib.Path("run")) # doctest: +SKIP\n>>> last = reader[-1] # doctest: +SKIP\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.trr' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Index the whole file now rather than on the first random access.

close() method descriptor

Release the file. Further reads raise ValueError.

TrrWriter

Writer of a GROMACS TRR file, one frame per :meth:write — molrs::io's TrrWriter::create.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file (created or truncated), or a buffer: cleared, then holding exactly the bytes written so far after each write.

required

Examples:

>>> with molrs.io.trr.TrrWriter(pathlib.Path("out")) as w:
...     for frame in frames:
...         w.write(frame)

__doc__ = 'Writer of a GROMACS TRR file, one frame per :meth:`write` —\n``molrs::io``\'s ``TrrWriter::create``.\n\nParameters\n----------\nsink : os.PathLike | bytearray\n The file (created or truncated), or a buffer: cleared, then\n holding exactly the bytes written so far after each write.\n\nExamples\n--------\n>>> with molrs.io.trr.TrrWriter(pathlib.Path("out")) as w: # doctest: +SKIP\n... for frame in frames:\n... w.write(frame)\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.trr' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

close() method descriptor

Release the file (every write is already flushed). Idempotent; writes after it raise ValueError.

write(frame) method descriptor

Append frame to the file.

Raises:

Type Description
ValueError

If the writer is closed.

OSError

If the frame cannot be written.

read_xtc(source) builtin

Read the first frame of a GROMACS XTC trajectory (nm → Å). Every frame: :class:molrs.io.xtc.XtcReader.

Parameters:

Name Type Description Default
source PathLike | bytes

The file, or its whole content.

required

Returns:

Type Description
Frame

write_xtc(sink, frame) builtin

Write a frame as a one-frame GROMACS XTC file (Å → nm, lossy). The quantization precision is frame.meta["precision"] when present.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required

XtcReader

Lazy, indexed reader of every frame of a GROMACS XTC file — molrs::io's XtcReader::open.

Frames are parsed on demand: random access (reader[i]) indexes the file once, then seeks; iteration walks it in order.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (.gz is decompressed), or its whole content.

required

Examples:

>>> reader = molrs.io.xtc.XtcReader(pathlib.Path("run"))
>>> last = reader[-1]

__doc__ = 'Lazy, indexed reader of every frame of a GROMACS XTC file —\n``molrs::io``\'s ``XtcReader::open``.\n\nFrames are parsed on demand: random access (``reader[i]``) indexes\nthe file once, then seeks; iteration walks it in order.\n\nParameters\n----------\nsource : os.PathLike | bytes | molrs.io.Text\n The file (``.gz`` is decompressed), or its whole content.\n\nExamples\n--------\n>>> reader = molrs.io.xtc.XtcReader(pathlib.Path("run")) # doctest: +SKIP\n>>> last = reader[-1] # doctest: +SKIP\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.xtc' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Index the whole file now rather than on the first random access.

close() method descriptor

Release the file. Further reads raise ValueError.

XtcWriter

Writer of a GROMACS XTC file, one frame per :meth:write — molrs::io's XtcWriter::create.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file (created or truncated), or a buffer: cleared, then holding exactly the bytes written so far after each write.

required

Examples:

>>> with molrs.io.xtc.XtcWriter(pathlib.Path("out")) as w:
...     for frame in frames:
...         w.write(frame)

__doc__ = 'Writer of a GROMACS XTC file, one frame per :meth:`write` —\n``molrs::io``\'s ``XtcWriter::create``.\n\nParameters\n----------\nsink : os.PathLike | bytearray\n The file (created or truncated), or a buffer: cleared, then\n holding exactly the bytes written so far after each write.\n\nExamples\n--------\n>>> with molrs.io.xtc.XtcWriter(pathlib.Path("out")) as w: # doctest: +SKIP\n... for frame in frames:\n... w.write(frame)\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.xtc' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

close() method descriptor

Release the file (every write is already flushed). Idempotent; writes after it raise ValueError.

write(frame) method descriptor

Append frame to the file.

Raises:

Type Description
ValueError

If the writer is closed.

OSError

If the frame cannot be written.

LAMMPS (molrs.io.lammps)

read_lammps_data(source, atom_style=None) builtin

Read a LAMMPS data file.

Every typed block (atoms, bonds, angles, dihedrals, impropers) carries the numeric type_id and the string type: the file's type label, or the id spelled as a label when the file has no * Type Labels section. The * Coeffs sections are kept verbatim in frame.meta["lammps_coeffs_text"] (:meth:molrs.io.lammps.LammpsForcefieldReader.read_data_coeffs reads them into a force field); the type-label inventories, header counts, unit style and the box axes the header named are in frame.meta too.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required
atom_style str

The Atoms column layout ("full", "atomic", "charge", …), as LAMMPS's atom_style governs read_data. Without it the section's # style comment decides, and without that the column count.

None

Returns:

Type Description
Frame

Raises:

Type Description
OSError

If the file cannot be opened or parsed, or atom_style is not an atom style.

write_lammps_data(sink, frame, *, type_labels=None, atom_style=None, units=None) builtin

Write a frame as a LAMMPS data file.

The box is frame.box. A frame without one is a non-periodic system, written inside the bounds of its coordinates widened by 1 length unit on every side: read it with boundary s s s. Atoms, topology, Masses and the * Type Labels sections are written; * Coeffs are not (:meth:molrs.io.lammps.LammpsForcefieldWriter.write_data_coeffs writes them for the same labels). A system with Drude particles gets a header comment with the fix drude C/D/N flags in atom-type order.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required
type_labels dict[str, list[str]]

Extra type labels per block ({"atoms": [...], "bonds": [...]}), declared in the file even when no row uses them; ids stay dense and follow the sorted labels. frame itself is not modified.

None

Raises:

Type Description
ValueError

If a declared label is empty or contains ,, or a block is not atoms / bonds / angles / dihedrals / impropers / cmaps.

OSError

If the frame cannot be written.

infer_lammps_atom_style(frame) builtin

The atom style the LAMMPS data writer infers from this frame's columns.

read_lammps_molecule(source) builtin

Read a LAMMPS molecule template in its native text format.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

write_lammps_molecule(sink, frame) builtin

Write a frame as a LAMMPS molecule template in the native text format.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The template.

required

read_lammps_molecule_json(source) builtin

Read a LAMMPS molecule template in its JSON format (format: "molecule").

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

write_lammps_molecule_json(sink, frame) builtin

Write a frame as a LAMMPS molecule template in its JSON format.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The template.

required

read_lammps_dump(source) builtin

Read the first snapshot of a LAMMPS dump. Every snapshot: :class:molrs.io.lammps.LammpsDumpReader.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

write_lammps_dump(sink, frame, columns=None) builtin

Write a frame as a one-snapshot LAMMPS dump. Several snapshots: :class:molrs.io.lammps.LammpsDumpWriter.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frame Frame

The frame to write.

required
columns list[str]

The dump custom column line, e.g. ["id", "element", "x", "y", "z"], written in the order given; a name the atoms block cannot supply raises. Without it every column the block holds is written.

None
Notes

The dump's type field is type_id when the block has it, otherwise the string type labels. Values are formatted from each column's stored dtype; a complex column, one with more than one value per row, or a string that is empty or contains whitespace raises.

LammpsDumpReader

Lazy, indexed reader of every frame of a LAMMPS dump file — molrs::io's LammpsDumpReader::open.

Frames are parsed on demand: random access (reader[i]) indexes the file once, then seeks; iteration walks it in order.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (.gz is decompressed), or its whole content.

required

Examples:

>>> reader = molrs.io.lammps.LammpsDumpReader(pathlib.Path("run"))
>>> last = reader[-1]

__doc__ = 'Lazy, indexed reader of every frame of a LAMMPS dump file —\n``molrs::io``\'s ``LammpsDumpReader::open``.\n\nFrames are parsed on demand: random access (``reader[i]``) indexes\nthe file once, then seeks; iteration walks it in order.\n\nParameters\n----------\nsource : os.PathLike | bytes | molrs.io.Text\n The file (``.gz`` is decompressed), or its whole content.\n\nExamples\n--------\n>>> reader = molrs.io.lammps.LammpsDumpReader(pathlib.Path("run")) # doctest: +SKIP\n>>> last = reader[-1] # doctest: +SKIP\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.lammps' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Index the whole file now rather than on the first random access.

close() method descriptor

Release the file. Further reads raise ValueError.

LammpsDumpWriter

Writer of a LAMMPS dump file, one frame per :meth:write — molrs::io's LammpsDumpWriter::create.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file (created or truncated), or a buffer: cleared, then holding exactly the bytes written so far after each write.

required

Examples:

>>> with molrs.io.lammps.LammpsDumpWriter(pathlib.Path("out")) as w:
...     for frame in frames:
...         w.write(frame)

__doc__ = 'Writer of a LAMMPS dump file, one frame per :meth:`write` —\n``molrs::io``\'s ``LammpsDumpWriter::create``.\n\nParameters\n----------\nsink : os.PathLike | bytearray\n The file (created or truncated), or a buffer: cleared, then\n holding exactly the bytes written so far after each write.\n\nExamples\n--------\n>>> with molrs.io.lammps.LammpsDumpWriter(pathlib.Path("out")) as w: # doctest: +SKIP\n... for frame in frames:\n... w.write(frame)\n' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.lammps' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

close() method descriptor

Release the file (every write is already flushed). Idempotent; writes after it raise ValueError.

set_columns(columns) method descriptor

Set the dump custom column line of the snapshots written after this call, e.g. ["id", "element", "x", "y", "z"], in the order given; a name a frame's atoms block cannot supply raises on :meth:write. Without it every column the block holds is written.

Raises:

Type Description
ValueError

If the writer is closed.

write(frame) method descriptor

Append frame to the file.

Raises:

Type Description
ValueError

If the writer is closed.

OSError

If the frame cannot be written.

write_lammps_dump_local(sink, frames) builtin

Write frames as a LAMMPS dump local file (OVITO's bond input): ITEM: NUMBER OF ENTRIES + ITEM: ENTRIES batom1 batom2 [btype] per frame, rows from an entries block if present, otherwise from the canonical bonds.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
frames list[Frame]

The frames, in order.

required

BondReactTemplate

One fix bond/react reaction: the pre-reaction template, the same atoms after the reaction, and the atoms its map file names.

pre and post are :class:~molrs.core.Atomistic graphs (or :class:~molrs.core.Frame s) whose atoms carry an integer react_id pairing them. initiator_atoms (exactly two), edge_atoms and deleted_atoms are atoms of pre — or their react_id values. The objects are kept as given (nothing is copied or renumbered); the writers read them when they write.

Serialized by :func:molrs.io.write_lammps_bond_react_map ({name}.map) and :func:write_lammps_bond_react_system (also {name}_pre.mol / {name}_post.mol). https://docs.lammps.org/fix_bond_react.html

__doc__ = 'One ``fix bond/react`` reaction: the pre-reaction template, the same\natoms after the reaction, and the atoms its map file names.\n\n``pre`` and ``post`` are :class:`~molrs.core.Atomistic` graphs (or\n:class:`~molrs.core.Frame` s) whose atoms carry an integer ``react_id`` pairing\nthem. ``initiator_atoms`` (exactly two), ``edge_atoms`` and\n``deleted_atoms`` are atoms of ``pre`` — or their ``react_id`` values.\nThe objects are kept as given (nothing is copied or renumbered); the\nwriters read them when they write.\n\nSerialized by :func:`molrs.io.write_lammps_bond_react_map` (``{name}.map``) and\n:func:`write_lammps_bond_react_system` (also ``{name}_pre.mol`` /\n``{name}_post.mol``). https://docs.lammps.org/fix_bond_react.html' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.lammps' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

deleted_atoms property

Atoms the reaction deletes.

edge_atoms property

Atoms bonded to atoms outside the template.

initiator_atoms property

The two atoms that initiate the reaction.

post property

Post-reaction template.

pre property

Pre-reaction template.

__repr__() method descriptor

Return repr(self).

write_lammps_bond_react_map(sink, template) builtin

Write the fix bond/react map file of template.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file (conventionally {name}.map), or a buffer that then holds exactly its bytes.

required
template BondReactTemplate

The reaction.

required

Raises:

Type Description
ValueError

The templates lack an integer react_id or repeat one, pre and post hold different react_id s, there are not exactly two initiators, or an initiator is not in pre.

OSError

The file cannot be written.

write_lammps_bond_react_system(workdir, frame, forcefield, templates) builtin

Write the whole file set of a fix bond/react run into workdir.

{stem}.data (the system), {stem}.ff (forcefield's styles and coefficients, without a units line: the input sets units and atom_style, reads the data file, then includes it), and per template {name}_pre.mol, {name}_post.mol and {name}.map; stem is workdir's own name. Every check runs before the first file is written. Every type label the system and the templates use is declared in the data file and covered by the .ff include, so the templates' type ids match the system's. Template topology rows without a type label are left out of the molecule files, with a :class:UserWarning per template and block.

Parameters:

Name Type Description Default
workdir str | PathLike

Output directory (created if missing).

required
frame Frame

The system.

required
forcefield ForceField

Holds a type for every label used.

required
templates dict[str, BondReactTemplate] | Sequence[BondReactTemplate]

Named templates; a sequence is named rxn1, rxn2, ….

required

Raises:

Type Description
ValueError

A malformed template, an untyped template atom, a label the force field lacks, or system labels that cannot share the numbering.

read_lammps_log(source, style='default') builtin

Read a LAMMPS log into a :class:LammpsLog record (molrs::io::read_lammps_log).

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The log file (e.g. log.lammps), or its whole content. The record's path is the file's path, "" for content in memory.

required
style str

Thermo style. Only "default" tables are parsed.

'default'

Returns:

Type Description
LammpsLog

Structured log: header, one LammpsRun per run (thermo table, timing, warnings), total_wall_time and warnings.

Raises:

Type Description
FileNotFoundError

If the file does not exist.

ValueError

If the content is not UTF-8 text.

OSError

On other I/O failures.

is_lammps_log(text) builtin

Whether text holds a LAMMPS run (molrs::io::lammps::is_lammps_log).

True when a Per MPI rank memory allocation line is present — the line :func:molrs.io.read_lammps_log opens each run at. A banner alone (a run that died in setup) is not a log with anything to read. Cheap enough to run on a file's first bytes.

Parameters:

Name Type Description Default
text str

The log text, or its first bytes.

required

Returns:

Type Description
bool

AMBER

read_prmtop(source) builtin

Read an AMBER prmtop structure: atoms (name, type, charge in electron units, mass, atomic_number when the file has it, res_id), bonds / angles / dihedrals with 0-based indices and type labels, and the POINTERS meta. The force field is :class:molrs.io.amber.AmberPrmtopForcefieldReader's.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

read_inpcrd(source, frame=None) builtin

Read an AMBER ASCII inpcrd / restrt coordinate file.

Fixed-width Fortran 6F12.7 layout. Without frame, returns a new frame with id, name, x/y/z, optional vel (shape [n, 3]), optional box, and meta title / timestep.

With frame (say, the structure :func:read_prmtop read), the file's coordinates go into that frame in place and it is returned: x / y / z (and vel) replace those atom columns, every other column stays; the file's box and meta keys are set. A frame without an atoms block receives the file's whole block.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required
frame Frame

Frame to receive the coordinates.

None

Returns:

Type Description
Frame

frame itself when given, else a new frame.

Raises:

Type Description
OSError

If the file cannot be opened or parsed, or frame's atom count differs from the file's (frame is then unchanged).

read_ac(source) builtin

Read an antechamber .ac file.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
Frame

read_prep(source) builtin

Read an AMBER prep residue into its nested-dict form (the serde JSON shape of the residue: name, atoms — each with index, name, atom_type, tree_type, na/nb/nc, r, theta, phi, charge, element — and impropers).

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
dict

write_prep(sink, residue) builtin

Write an AMBER prep residue from its nested-dict form (the shape :func:read_prep returns).

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
residue dict

The residue. Every atom field is required.

required

Raises:

Type Description
KeyError

If a field is missing (no default stands in for it).

Record files (molrs.io.mrec)

The Record files guide shows these in use.

write_mrec(sink, *, meta=None, frame=None, system=None, trajectory=None, forcefield=None) builtin

Write a record — its meta document and whichever state sections are given — as a *.mrec store (molrs::io::write_mrec).

A path is written as a directory store; a bytearray receives the packed record (the bytes of a *.mrec.zip), which :class:molrs.io.mrec.MrecFile reads back.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The store's path, or a buffer that then holds the packed record.

required
meta Mapping

The record's identity document, written to meta/ as given: a dict, a :class:~molrs.core.MetaDocument, or any mapping (frame.meta included). Nested tuples and documents are JSON arrays and objects.

None
frame Frame

The snapshot (frame/).

None
system Frame

The system definition — topology and types (system/).

None
trajectory Trajectory

The ordered frame sequence (trajectory/).

None
forcefield ForceFieldSection | ForceField

The force field the record's types link into (forcefield/): a :class:~molrs.io.mrec.ForceFieldSection as given, or a :class:~molrs.ff.forcefield.ForceField through :meth:~molrs.io.mrec.ForceFieldSection.from_forcefield.

None

Raises:

Type Description
ValueError

If the record has no state section, a section fails to encode, or the force field is invalid or has no section form.

TypeError

If meta is not a mapping or holds a value JSON cannot, or forcefield is neither a ForceField nor a ForceFieldSection.

OSError

If the store cannot be written.

MrecFile

A *.mrec record opened for its sections (molrs::io::mrec::MrecFile): each read decodes only the section it names, so another section — a trajectory, observables, one this build does not know — cannot fail it. A trajectory section is :class:MrecReader's.

Parameters:

Name Type Description Default
source PathLike | bytes

A *.mrec directory store, a packed *.mrec.zip (read in place), or the bytes of a packed one.

required

Raises:

Type Description
ValueError

If the source is neither a directory store nor a packed record.

Examples:

>>> record = molrs.io.mrec.MrecFile(pathlib.Path("water.mrec"))
>>> frame = record.frame()

__doc__ = 'A ``*.mrec`` record opened for its sections (``molrs::io::mrec::MrecFile``):\neach read decodes only the section it names, so another section — a\ntrajectory, observables, one this build does not know — cannot fail it.\nA trajectory section is :class:`MrecReader`\'s.\n\nParameters\n----------\nsource : os.PathLike | bytes\n A ``*.mrec`` directory store, a packed ``*.mrec.zip`` (read in\n place), or the bytes of a packed one.\n\nRaises\n------\nValueError\n If the source is neither a directory store nor a packed record.\n\nExamples\n--------\n>>> record = molrs.io.mrec.MrecFile(pathlib.Path("water.mrec")) # doctest: +SKIP\n>>> frame = record.frame() # doctest: +SKIP' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.mrec' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

forcefield() method descriptor

The forcefield section, validated, or None when the record has none. It comes back whole — every document key, every table, units as stored; :meth:ForceFieldSection.to_forcefield turns it into a force field molrs can compile.

Returns:

Type Description
ForceFieldSection | None

Raises:

Type Description
ValueError

If the section is malformed.

frame() method descriptor

The frame section — the snapshot — or None when the record has none.

Returns:

Type Description
Frame | None

Raises:

Type Description
ValueError

If the section fails to decode.

meta() method descriptor

The record's meta document, as the producer wrote it; empty when the store has none.

Returns:

Type Description
dict

sections() method descriptor

The record's top-level section names (meta, frame, system, …), sorted, without decoding any of them.

Returns:

Type Description
list[str]

system() method descriptor

The system section — the topology — or None when the record has none.

Returns:

Type Description
Frame | None

Raises:

Type Description
ValueError

If the section fails to decode.

SequenceSchema

A frame-sequence schema pinned before a run's frames are written.

The schema fixes every block, column and dtype the run may carry; :class:MrecWriter refuses a frame that steps outside it. Derive it from representative frames (:meth:from_frames), then refine it column by column with declare_*.

__doc__ = "A frame-sequence schema pinned before a run's frames are written.\n\nThe schema fixes every block, column and dtype the run may carry;\n:class:`MrecWriter` refuses a frame that steps outside it.\nDerive it from representative frames (:meth:`from_frames`), then refine\nit column by column with ``declare_*``." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.mrec' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

aligned_with(block) method descriptor

The block block is aligned with, or None.

block_names() method descriptor

The declared block names.

column_names(block) method descriptor

The declared column names of block, or None when undeclared.

declare_aligned(block, target) method descriptor

Declare block aligned with target: its rows are target's rows, one for one, at every frame after carry-forward. A frame whose target changes row count must restate block; one that keeps it may let block carry forward. The two blocks keep disjoint columns, alignments do not chain, and the aligned block declares no structural shape. A reader hands back the two blocks.

declare_block(name, rows=None) method descriptor

Declare a block, with the row count a typical frame of it carries.

rows sizes the block's frame-aligned inner chunk; None leaves the byte floor to decide.

declare_column(block, column, dtype, trailing=None) method descriptor

Declare a column of block by dtype tag ("f64", "u64", "string", …) and trailing shape ([3] for an xyz column).

declare_meta(key, dtype, fill=None) method descriptor

Declare a per-step metadata key by dtype tag ("f64", "i64", "f64x3", "string", "json", …). A frame that omits the key is an error unless fill is given: the value written for the steps that omit it, read at dtype (a :class:~molrs.core.MetaValue is taken as it is).

Raises:

Type Description
ValueError

An unknown dtype, a fill that does not read at it, or a key declared before.

declare_precision(block, column, precision) method descriptor

Declare the precision of column of block: an absolute tolerance in the column's units (1e-3 keeps Å coordinates to a thousandth).

Every frame's values are rounded to the largest power of two not above it (ties to even) before the change check and before they land, so a change below half that step is no change, and the column is stored shuffled and compressed. Pinned with the schema. A schema derived with :meth:from_frames takes each column's :meth:Block.precision.

declare_structural_shape(block, shape) method descriptor

Declare the structural shape of block (a volumetric grid); every update then carries exactly prod(shape) rows.

declare_target(block, column, target) method descriptor

Declare that column of block (u64) holds row indices into target: "<block>" of the same resolved frame, or "/<section>/<block>". Pinned with the schema; the writer refuses a frame whose resolved blocks break it. :meth:from_frames takes each column's :meth:Block.target.

from_frames(frames) staticmethod

Derive a schema from the union of several frames' blocks and columns (molrs::io::mrec::SequenceSchema::from_frames). from_frames([]) is the empty schema, to be filled with declare_*.

Parameters:

Name Type Description Default
frames Sequence[Frame]

Representative frames of the run.

required

Returns:

Type Description
SequenceSchema

Raises:

Type Description
ValueError

A reserved block or column name, or two frames that declare one block's shape, or one column's dtype or precision, differently.

meta_keys() method descriptor

The declared per-step metadata keys with their dtype tags.

precision(block, column) method descriptor

The declared precision of column of block, or None.

target(block, column) method descriptor

The declared target of column of block, or None.

MrecWriter

Append-first writer for a *.mrec trajectory store.

Wraps the Rust MrecWriter over the positional-write store. Frames are buffered and landed whole inner chunks at a time on a cadence derived from the frame size (or flush_every); flush() and close() commit whatever is buffered, durably unless durable=False.

Parameters:

Name Type Description Default
path

Destination filesystem path for the store.

required
schema

The :class:SequenceSchema every appended frame is checked against.

required
flush_every

Land every this many frames instead of the derived cadence.

None
compression

How floating-point columns are compressed: None, "gzip[:level]" or "zstd[:level]". Everything else always carries gzip level 1. A column with a declared precision is byte-shuffled and compressed whatever this says: None means zstd level 3, and a named compressor replaces it.

None
durable

Whether flush() / close() fsync the touched files.

True
meta

The record's identity document, written to meta/ as given: a dict, a :class:~molrs.core.MetaDocument, or any mapping (frame.meta included). Nested tuples and documents are JSON arrays and objects.

None

__doc__ = 'Append-first writer for a ``*.mrec`` trajectory store.\n\nWraps the Rust ``MrecWriter`` over the positional-write store.\nFrames are buffered and landed whole inner chunks at a time on a cadence\nderived from the frame size (or ``flush_every``); ``flush()`` and\n``close()`` commit whatever is buffered, durably unless ``durable=False``.\n\nParameters\n----------\npath\n Destination filesystem path for the store.\nschema\n The :class:`SequenceSchema` every appended frame is checked\n against.\nflush_every\n Land every this many frames instead of the derived cadence.\ncompression\n How floating-point columns are compressed: ``None``,\n ``"gzip[:level]"`` or ``"zstd[:level]"``. Everything else always\n carries gzip level 1. A column with a declared precision is\n byte-shuffled and compressed whatever this says: ``None`` means\n zstd level 3, and a named compressor replaces it.\ndurable\n Whether ``flush()`` / ``close()`` fsync the touched files.\nmeta\n The record\'s identity document, written to ``meta/`` as\n given: a ``dict``, a\n :class:`~molrs.core.MetaDocument`, or any mapping (``frame.meta``\n included). Nested tuples and documents are JSON arrays and objects.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.mrec' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

committed property

Frames committed so far.

flush_every property

The landing cadence in force, in frames.

append(frame, step=None, time=None) method descriptor

Buffer a frame. With no step the writer numbers frames 0, 1, 2, …; pass step (and optionally time, in the producer's own unit — the record stores none) for real MD numbering, or time alone to keep the automatic numbering and still record times.

Raises:

Type Description
ValueError

If the writer is closed, the frame steps outside the pinned schema, or step does not strictly increase.

close() method descriptor

Commit and release the store. Idempotent; appends after close raise.

flush() method descriptor

Commit every buffered frame (durably, unless durable=False).

open(path, *, flush_every=None, durable=True) staticmethod

Reattach to an existing store and continue appending after its last committed frame. Anything a crash left past the commit marker is rolled back first.

MrecReader

Lazy one-frame cursor over the trajectory section of a *.mrec record (molrs::io::mrec::MrecReader).

Construction opens the index only, and each read decodes exactly the asked-for frame, keeping the last decoded chunk of every column so playback through consecutive frames is a slice rather than a decode. Supports len(reader), reader[i] (negative indices included), iteration, and the with statement.

Parameters:

Name Type Description Default
source PathLike | bytes

A *.mrec directory store, a packed *.mrec.zip, or the bytes of a packed one.

required

Raises:

Type Description
ValueError

If the record has no trajectory section (read the others with :class:MrecFile), or its index does not decode.

__doc__ = 'Lazy one-frame cursor over the ``trajectory`` section of a ``*.mrec``\nrecord (``molrs::io::mrec::MrecReader``).\n\nConstruction opens the index only, and each read decodes exactly the\nasked-for frame, keeping the last decoded chunk of every column so\nplayback through consecutive frames is a slice rather than a decode.\nSupports ``len(reader)``, ``reader[i]`` (negative indices included),\niteration, and the ``with`` statement.\n\nParameters\n----------\nsource : os.PathLike | bytes\n A ``*.mrec`` directory store, a packed ``*.mrec.zip``, or the bytes of\n a packed one.\n\nRaises\n------\nValueError\n If the record has no ``trajectory`` section (read the others with\n :class:`MrecFile`), or its index does not decode.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.mrec' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

step property

Step numbers of the committed frames.

time property

Time of each committed frame, when the run wrote any. The record carries no unit for it; the producer's convention applies.

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__next__() method descriptor

Implement next(self).

block_names() method descriptor

Names of every block section present in the store.

block_update_at(name, index) method descriptor

The update of block name that frame index resolves to, or None when the block is absent there.

Two consecutive frames resolving to the same update carry the same rows, so a consumer can skip re-uploading a block whose update did not change without comparing a single value.

box_at(index) method descriptor

The cell at frame index, or None when no cell has been written at or before it.

frame_columns(index, columns) method descriptor

Decode one frame carrying only the named (block, column) pairs.

A viewer that needs coordinates decodes ("atoms", "x"), ("atoms", "y"), ("atoms", "z") and nothing else. Blocks none of whose columns are named are left out; the cell and per-step metadata always come along.

Parameters:

Name Type Description Default
index int

Zero-based frame index; negative counts from the end.

required
columns list[tuple[str, str]]

The (block, column) pairs to decode.

required

Returns:

Type Description
Frame

Raises:

Type Description
IndexError

If index is past the commit marker.

has_block(name) method descriptor

Whether the store carries a block section of this name (e.g. "bonds") with at least one committed update.

to_trajectory() method descriptor

Every committed frame, with the steps and the times when the run wrote any, as an in-memory :class:~molrs.core.Trajectory. A run too large for memory is what reader[i] is for.

Returns:

Type Description
Trajectory

Raises:

Type Description
ValueError

On the first frame that fails to decode.

ForceFieldSection

The forcefield section of a *.mrec record: the force-field document and one :class:~molrs.core.Block per style table (molrec docs/spec/forcefield.md).

It holds what a store holds, whole: the document keeps every key, the tables every block, and no number is converted to another unit. :meth:from_forcefield builds one from a force field; :meth:to_forcefield turns one into a force field molrs can compile. Nothing is checked on construction; :meth:validate checks the chapter's rules, and every writer runs it.

Parameters:

Name Type Description Default
document

The document (name, units, styles, …) — a dict or any mapping of JSON values.

required
tables

Block name → :class:~molrs.core.Block (the style tables, at :meth:block_name of their style, and any other block).

None

__doc__ = "The ``forcefield`` section of a ``*.mrec`` record: the force-field\ndocument and one :class:`~molrs.core.Block` per style table (molrec\n``docs/spec/forcefield.md``).\n\nIt holds what a store holds, whole: the document keeps every key, the\ntables every block, and no number is converted to another unit.\n:meth:`from_forcefield` builds one from a force field;\n:meth:`to_forcefield` turns one into a force field molrs can compile. Nothing is checked on construction; :meth:`validate`\nchecks the chapter's rules, and every writer runs it.\n\nParameters\n----------\ndocument\n The document (``name``, ``units``, ``styles``, …) — a\n ``dict`` or any mapping of JSON values.\ntables\n Block name → :class:`~molrs.core.Block` (the style tables, at\n :meth:`block_name` of their style, and any other block)." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.mrec' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

document property

The force-field document, as a fresh dict.

name property

The document's name, or None.

tables property

Block name → :class:~molrs.core.Block, in stored order. Each block is a copy: editing it does not change the section.

__repr__() method descriptor

Return repr(self).

block_name(category, style) staticmethod

The block name of a style's table: <category>.<style>, every byte of the style outside A-Z a-z 0-9 - _ written %XX (block_name("pair", "lj/cut") is "pair.lj%2Fcut").

from_forcefield(forcefield) staticmethod

A force field as a record's forcefield section.

The units are the declared (or default real) preset, stated beside its quantities; each style's types become its table's rows.

Raises:

Type Description
ValueError

When the force field has no section form (units that are no preset, a param that is a number in one type and a string in another, …).

table(category, style) method descriptor

The table of the (category, style) style (a copy), or None.

to_forcefield() method descriptor

The force field this section describes. Its units become the force field's declared units; nothing is converted.

Raises:

Type Description
ValueError

When the section is invalid, or molrs cannot hold it: a category outside atom/bond/angle/dihedral/improper/pair/cmap, units that are no preset, a smirks-keyed style.

validate() method descriptor

Check the section against the forcefield chapter.

Raises:

Type Description
ValueError

Naming the first rule broken (units, a duplicate style, a missing table, a duplicate or null type name, the wrong endpoint columns, a parameter dtype, a pair table pricing one unordered pair twice with different parameters, …).

pack_mrec_zip(path) builtin

Pack a closed *.mrec directory into a sibling *.mrec.zip (every entry stored, byte-identical to the files it replaces) and remove the directory.

Returns:

Type Description
str

The path of the archive.

Force-field files

Each format is a reader and / or writer class: read(source) -> ForceField, write(sink, forcefield), and the format's other files as methods of the same class.

LammpsForcefieldReader

Reader of LAMMPS force-field files — molrs::io::lammps::LammpsForcefieldReader.

:meth:read parses a force-field include (*.ff): the pair_style/pair_coeff + bond_style/angle_style/ dihedral_style/improper_style lines :class:LammpsForcefieldWriter writes. The force-field IR follows the LAMMPS standard, so every coefficient is stored as written (K, degrees) and the force field declares the file's units (real for a file without a units line); the special_bonds line is recorded on the force field (an include that omits it is refused). Per-atom charge and mass live in the data file, not the include.

:meth:read_data_coeffs reads the * Coeffs sections of a data file, :meth:read_cmap a fix cmap file.

Examples:

>>> ff = LammpsForcefieldReader().read(pathlib.Path("system.ff"))

__doc__ = 'Reader of LAMMPS force-field files — ``molrs::io::lammps::LammpsForcefieldReader``.\n\n:meth:`read` parses a force-field include (``*.ff``): the\n``pair_style``/``pair_coeff`` + ``bond_style``/``angle_style``/\n``dihedral_style``/``improper_style`` lines :class:`LammpsForcefieldWriter`\nwrites. The force-field IR follows the LAMMPS standard, so every\ncoefficient is stored as written (``K``, degrees) and the force field\ndeclares the file\'s ``units`` (``real`` for a file without a ``units``\nline); the ``special_bonds`` line is recorded on the force field (an\ninclude that omits it is refused). Per-atom charge and mass live in the\ndata file, not the include.\n\n:meth:`read_data_coeffs` reads the ``* Coeffs`` sections of a data file,\n:meth:`read_cmap` a ``fix cmap`` file.\n\nExamples\n--------\n>>> ff = LammpsForcefieldReader().read(pathlib.Path("system.ff")) # doctest: +SKIP' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.lammps' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

read(source) method descriptor

Read the force-field include source holds.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
ForceField

Raises:

Type Description
ValueError

On an unsupported style, a coefficient before its style declaration, a wrong-arity type label, a non-numeric parameter or a missing special_bonds line (reading is total — never a silent skip).

read_cmap(source) method descriptor

Read a LAMMPS fix cmap file (CHARMM's 24×24 grids) into a force field of cmap charmm rows — the inverse of :meth:LammpsForcefieldWriter.write_cmap.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
ForceField

Raises:

Type Description
ValueError

A non-numeric token, a file with no map, or a UNITS: tag that is no LAMMPS unit style.

read_data_coeffs(frame, units=None) method descriptor

Read the force field a LAMMPS data file's * Coeffs sections define, from the frame :func:molrs.io.read_lammps_data returned — the file is read once, for the system and its coefficients alike.

A row's numeric type id is named by the label the file's * Type Labels section gave it, else by the id itself. A section's # style comment selects the style (an accelerator suffix removed); a section without one is harmonic (bonded) or lj/cut (pair, cutoff 10.0 in the file's units).

Parameters:

Name Type Description Default
frame Frame

The data file's frame (frame.meta["lammps_coeffs_text"]).

required
units str

The unit style the coefficients are in; the one the file's title line stated when omitted.

None

Returns:

Type Description
ForceField

Raises:

Type Description
ValueError

A frame with no * Coeffs sections, a units that disagrees with the file's, a malformed type-label inventory, an unsupported hinted style, or a malformed coefficient row.

LammpsForcefieldWriter

Writer of LAMMPS force-field files for a typed system — molrs::io::lammps::LammpsForcefieldWriter.

The frame's type labels (TypeLabels.from_frame) number the rows, so the include matches the data file :func:molrs.io.write_lammps_data writes for the same frame. :meth:write writes the force-field include (*.ff), :meth:write_data_coeffs the data file's * Coeffs sections, :meth:write_cmap the fix cmap file.

Parameters:

Name Type Description Default
frame Frame

The typed system whose labels number the rows.

required
precision int

Decimal places for floating-point coefficients.

6
units str

The LAMMPS units style the file is written in.

'real'
skip_pair_style bool

Omit the pair_style line (the input script sets its own).

False
skip_special_bonds bool

Omit special_bonds (the input script states its own 1-4 weights).

False
skip_units bool

Omit the units line.

False
cmap_file str

The fix cmap file the include names, as the input script will find it; needed exactly when the system has CMAP crossterms.

None

Raises:

Type Description
ValueError

If units is no LAMMPS unit style or the frame's type-label inventory is malformed.

__doc__ = "Writer of LAMMPS force-field files for a typed system —\n``molrs::io::lammps::LammpsForcefieldWriter``.\n\nThe frame's type labels (``TypeLabels.from_frame``) number the rows, so\nthe include matches the data file :func:`molrs.io.write_lammps_data`\nwrites for the same frame. :meth:`write` writes the force-field include\n(``*.ff``), :meth:`write_data_coeffs` the data file's ``* Coeffs``\nsections, :meth:`write_cmap` the ``fix cmap`` file.\n\nParameters\n----------\nframe : Frame\n The typed system whose labels number the rows.\nprecision : int\n Decimal places for floating-point coefficients.\nunits : str\n The LAMMPS ``units`` style the file is written in.\nskip_pair_style : bool\n Omit the ``pair_style`` line (the input script sets its own).\nskip_special_bonds : bool\n Omit ``special_bonds`` (the input script states its own 1-4 weights).\nskip_units : bool\n Omit the ``units`` line.\ncmap_file : str, optional\n The ``fix cmap`` file the include names, as the input script will\n find it; needed exactly when the system has CMAP crossterms.\n\nRaises\n------\nValueError\n If ``units`` is no LAMMPS unit style or the frame's type-label\n inventory is malformed." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.lammps' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

write(sink, forcefield) method descriptor

Write forcefield as the LAMMPS force-field include (*.ff).

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
forcefield ForceField

The force field.

required

Raises:

Type Description
ValueError

A per-pair 1-4 override column on the frame's pairs (LAMMPS has no per-pair exception), or what the format cannot express (the typed IR refusal's subclass).

OSError

If the file cannot be written.

write_cmap(sink, forcefield) method descriptor

Write the LAMMPS fix cmap file of the cmaps labels — the inverse of :meth:LammpsForcefieldReader.read_cmap.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
forcefield ForceField

The force field.

required

Raises:

Type Description
ValueError

No cmaps label, a label with no cmap type, a grid that is not 24×24, or more than six maps.

OSError

If the file cannot be written.

write_data_coeffs(sink, forcefield) method descriptor

Write the data file's * Coeffs sections only (no units / *_style lines): a fragment for the caller to splice into a data file. Pair Coeffs holds self pairs only, so a used explicit cross pair is refused here (write it through :meth:write).

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
forcefield ForceField

The force field.

required

Raises:

Type Description
ValueError

What the include refuses, and a used explicit cross pair.

OSError

If the file cannot be written.

GromacsTopForcefieldReader

Reader of GROMACS topologies (.top / .itp) — molrs::io::gromacs::GromacsTopForcefieldReader.

:meth:read reads the force-field directives ([ defaults ], [ atomtypes ], [ nonbond_params ], [ pairtypes ], [ bondtypes ], [ angletypes ], [ dihedraltypes ], [ cmaptypes ]), converting GROMACS units (nm, kJ/mol, ½k) to the force-field IR (LAMMPS standard, real); :meth:read_system reads the molecule sections too. See the Force-field IR guide, "GROMACS topologies".

Parameters:

Name Type Description Default
include bool

Follow #include directives, relative to the including file and then each of include_dirs (false: they are ignored).

False
include_dirs Sequence[PathLike]

Directories an #include is resolved against, in order (GROMACS's -I, or its share/gromacs/top).

Ellipsis
skip_directives Sequence[str]

Sections read past, rows and all, instead of refused (bracket-less, case-insensitive, e.g. "constrainttypes").

Ellipsis

__doc__ = 'Reader of GROMACS topologies (``.top`` / ``.itp``) —\n``molrs::io::gromacs::GromacsTopForcefieldReader``.\n\n:meth:`read` reads the force-field directives (``[ defaults ]``,\n``[ atomtypes ]``, ``[ nonbond_params ]``, ``[ pairtypes ]``,\n``[ bondtypes ]``, ``[ angletypes ]``, ``[ dihedraltypes ]``,\n``[ cmaptypes ]``), converting GROMACS units (nm, kJ/mol, ``½k``) to the\nforce-field IR (LAMMPS standard, ``real``); :meth:`read_system` reads the\nmolecule sections too. See the Force-field IR guide, "GROMACS\ntopologies".\n\nParameters\n----------\ninclude : bool\n Follow ``#include`` directives, relative to the including file and\n then each of ``include_dirs`` (false: they are ignored).\ninclude_dirs : Sequence[os.PathLike]\n Directories an ``#include`` is resolved against, in order (GROMACS\'s\n ``-I``, or its ``share/gromacs/top``).\nskip_directives : Sequence[str]\n Sections read past, rows and all, instead of refused (bracket-less,\n case-insensitive, e.g. ``"constrainttypes"``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.gromacs' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

read(source) method descriptor

Read the force-field directives source holds.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The topology, or its whole content (#include needs a path).

required

Returns:

Type Description
ForceField

Raises:

Type Description
ValueError

What the IR cannot hold, by name: an unsupported function code or comb-rule, [ constrainttypes ], any unknown section, and every molecule section (read a whole topology with :meth:read_system, or skip them).

read_system(source) method descriptor

Read a whole topology — its directives and its molecules — into a force field and a typed frame.

The frame holds atoms (type, charge, mass, name, res_id, res_name, mol_id), bonds, angles, dihedrals, impropers, cmaps, constraints, exclusions and pairs (0-based indices). Coordinates come from the .gro (:func:molrs.io.read_gro).

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The topology, or its whole content.

required

Returns:

Type Description
tuple[ForceField, Frame]

Raises:

Type Description
ValueError

Anything the IR cannot hold, naming the file, line and row.

GromacsTopForcefieldWriter

Writer of GROMACS topologies — molrs::io::gromacs::GromacsTopForcefieldWriter.

Parameters:

Name Type Description Default
precision int

Decimal places for floating-point coefficients.

6

__doc__ = 'Writer of GROMACS topologies — ``molrs::io::gromacs::GromacsTopForcefieldWriter``.\n\nParameters\n----------\nprecision : int\n Decimal places for floating-point coefficients.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.gromacs' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

write(sink, forcefield) method descriptor

Write forcefield's directives as a topology.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
forcefield ForceField

The force field.

required

Raises:

Type Description
ValueError

What GROMACS cannot express (the typed IR refusal's subclass).

OSError

If the file cannot be written.

write_system(sink, forcefield, frame) method descriptor

Write a whole topology — the directives and the frame's molecules — the inverse of :meth:GromacsTopForcefieldReader.read_system.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
forcefield ForceField

The force field.

required
frame Frame

The typed system.

required

Raises:

Type Description
ValueError

What GROMACS cannot express; nothing is written then.

OSError

If the file cannot be written.

AmberPrmtopForcefieldReader

Reader of an AMBER prmtop's force field — molrs::io::amber::AmberPrmtopForcefieldReader.

:meth:read parses the parameter tables: harmonic bonds and angles (k = K; θ₀ to degrees), periodic dihedrals (phases to degrees), impropers in AMBER's atom order, and LJ A/B → σ/ε, in LAMMPS real units. The structure alone is :func:molrs.io.read_prmtop's; :meth:read_system reads both.

__doc__ = "Reader of an AMBER prmtop's force field —\n``molrs::io::amber::AmberPrmtopForcefieldReader``.\n\n:meth:`read` parses the parameter tables: harmonic bonds and angles\n(``k = K``; θ₀ to degrees), periodic dihedrals (phases to degrees),\nimpropers in AMBER's atom order, and LJ A/B → σ/ε, in LAMMPS ``real``\nunits. The structure alone is :func:`molrs.io.read_prmtop`'s;\n:meth:`read_system` reads both." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.amber' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

read(source) method descriptor

Read the force field of the prmtop source holds.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
ForceField

Raises:

Type Description
ValueError

On a table the IR cannot hold.

read_system(source) method descriptor

Read a whole prmtop (or ParmEd chamber) topology into a force field and a typed frame.

The frame is :func:molrs.io.read_prmtop's plus a pairs block holding the 1-4 pairs sander weighs otherwise than the field's special_bonds, each with its own coul_scale / lj_scale where it differs (no pairs block when every 1-4 pair agrees). Coordinates come from the restart (:func:molrs.io.read_inpcrd).

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
tuple[ForceField, Frame]

Raises:

Type Description
ValueError

What either reader refuses, and a 1-4 row on a bonded pair or an angle's ends.

AmberFrcmodWriter

Writer of an AMBER frcmod parameter file — molrs::io::amber::AmberFrcmodWriter.

__doc__ = 'Writer of an AMBER ``frcmod`` parameter file —\n``molrs::io::amber::AmberFrcmodWriter``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.amber' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

write(sink, forcefield) method descriptor

Write forcefield as a frcmod file.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
forcefield ForceField

The force field.

required

Raises:

Type Description
ValueError

What frcmod cannot express (the typed IR refusal's subclass).

OSError

If the file cannot be written.

OpenmmXmlReader

Reader of OpenMM force-field XML — molrs::io::openmm_xml::OpenmmXmlReader.

Reads OpenMM's own <ForceField> schema — CHARMM36, AMBER and OPLS-AA ports alike (nm, kJ/mol, radians, ½k harmonic terms) — into the force-field IR (Å, kcal/mol, degrees, un-halved K): harmonic bonds and angles, Urey-Bradley, periodic and Ryckaert-Bellemans torsions, periodic and CHARMM harmonic impropers, CMAP, NonbondedForce and LennardJonesForce with NBFIX and 1-4 parameters. molrs's own force-field XML is :class:molrs.io.xml.XmlForcefieldReader's.

__doc__ = "Reader of OpenMM force-field XML — ``molrs::io::openmm_xml::OpenmmXmlReader``.\n\nReads OpenMM's own ``<ForceField>`` schema — CHARMM36, AMBER and OPLS-AA\nports alike (nm, kJ/mol, radians, ``½k`` harmonic terms) — into the\nforce-field IR (Å, kcal/mol, degrees, un-halved ``K``): harmonic bonds and\nangles, Urey-Bradley, periodic and Ryckaert-Bellemans torsions, periodic\nand CHARMM harmonic impropers, CMAP, ``NonbondedForce`` and\n``LennardJonesForce`` with NBFIX and 1-4 parameters. molrs's own\nforce-field XML is :class:`molrs.io.xml.XmlForcefieldReader`'s." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.openmm_xml' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

read(source) method descriptor

Read the OpenMM force field source holds.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file (charmm36.xml, oplsaa.xml, …), or its whole content.

required

Returns:

Type Description
ForceField

Raises:

Type Description
ValueError

On a malformed document, a section or row with no IR form (named), or a missing / non-numeric required attribute.

OpenmmXmlWriter

Writer of OpenMM force-field XML — molrs::io::openmm_xml::OpenmmXmlWriter, the inverse of :class:OpenmmXmlReader.

Parameters:

Name Type Description Default
precision int

Decimals of every number; the shortest form that reads back to the same float when omitted.

None

__doc__ = 'Writer of OpenMM force-field XML — ``molrs::io::openmm_xml::OpenmmXmlWriter``,\nthe inverse of :class:`OpenmmXmlReader`.\n\nParameters\n----------\nprecision : int, optional\n Decimals of every number; the shortest form that reads back to the\n same float when omitted.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.openmm_xml' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

write(sink, forcefield) method descriptor

Write forcefield as an OpenMM force-field XML document.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
forcefield ForceField

The force field.

required

Raises:

Type Description
ValueError

What OpenMM cannot express (the typed IR refusal's subclass).

OSError

If the file cannot be written.

write_system(sink, forcefield, frame) method descriptor

Write the force field and the residue templates matching this frame's PDB.

XmlForcefieldReader

Reader of molrs's force-field XML — molrs::io::XmlForcefieldReader: every style one <{Category}Style name=…> element with its <Type> rows, in the units the <ForceField units=…> root declares. OpenMM's own force-field XML is :class:molrs.io.openmm_xml.OpenmmXmlReader's.

__doc__ = "Reader of molrs's force-field XML — ``molrs::io::XmlForcefieldReader``:\nevery style one ``<{Category}Style name=…>`` element with its ``<Type>``\nrows, in the units the ``<ForceField units=…>`` root declares. OpenMM's\nown force-field XML is :class:`molrs.io.openmm_xml.OpenmmXmlReader`'s." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.xml' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

read(source) method descriptor

Read the force field source holds.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
ForceField

With the root's units declared.

Raises:

Type Description
ValueError

On a malformed document or an element this layout does not have.

XmlForcefieldWriter

Writer of molrs's force-field XML — molrs::io::XmlForcefieldWriter, the inverse of :class:XmlForcefieldReader: every style of the force field as one element, in its declared units.

__doc__ = "Writer of molrs's force-field XML — ``molrs::io::XmlForcefieldWriter``,\nthe inverse of :class:`XmlForcefieldReader`: every style of the force\nfield as one element, in its declared units." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.xml' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

write(sink, forcefield) method descriptor

Write forcefield as a force-field XML document.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
forcefield ForceField

The force field.

required

Raises:

Type Description
ValueError

A style the layout cannot hold.

OSError

If the file cannot be written.

SMILES and CGsmiles

An IR is handed out by a read_* door, never constructed by the caller.

read_smiles(smiles) builtin

Read SMILES text into its IR.

Parameters:

Name Type Description Default
smiles str

SMILES text ("CCO" for ethanol, "c1ccccc1").

required

Returns:

Type Description
SmilesIr

Raises:

Type Description
SmilesError

(a ValueError) for text that is not SMILES: a syntax error, an unknown element, a bonding descriptor (a fragment body goes through :func:read_smiles_fragment).

Examples:

>>> molrs.io.smiles.read_smiles("CCO").to_atomistic().n_atoms
3

read_smiles_fragment(body) builtin

Read a fragment body — SMILES plus CGsmiles / BigSMILES bonding descriptors ([<]OCC[>], [$]COC[$]) — into its IR.

Parameters:

Name Type Description Default
body str

The fragment body.

required

Returns:

Type Description
FragmentIr

Raises:

Type Description
SmilesError

(a ValueError) for text that is not fragment notation.

Examples:

>>> molrs.io.smiles.read_smiles_fragment("[<]OCC[>]").to_template().n_ports
2

write_smiles(mol, *, canonical=True, root=None, aromatic='as_marked', hydrogens='organic_subset', include_stereo=False, multi_component='error_if_multiple', organic_subset=True) builtin

Write a molecule as SMILES text.

Every science or representation choice is an explicit keyword, the fields of molrs::io::smiles::SmilesEmitOptions.

Parameters:

Name Type Description Default
mol Atomistic

The molecule.

required
canonical bool

Use the canonical atom order for root selection and branch order.

True
root Atom

The atom the string starts at (overrides the canonical root).

None
aromatic (as_marked, kekule_only)

Honour aromatic marks, or require integer bond numbers.

"as_marked"
hydrogens (organic_subset, explicit_all, as_stored)

How hydrogens appear.

"organic_subset"
include_stereo bool

Write tetrahedral / double-bond stereo marks the graph holds.

False
multi_component (error_if_multiple, join_dot, first_only)

What a molecule of several connected components becomes.

"error_if_multiple"
organic_subset bool

Prefer the Daylight organic-subset letters when legal.

True

Returns:

Type Description
str

Raises:

Type Description
ValueError

An unknown option spelling, or root is not an atom.

SmilesError

If the molecule cannot be written under these options.

Examples:

>>> mol = molrs.io.smiles.read_smiles("CCO").to_atomistic()
>>> molrs.io.smiles.read_smiles(molrs.io.smiles.write_smiles(mol)).to_atomistic().n_atoms
3

SmilesIr

Intermediate representation of a parsed SMILES string: the syntax tree the parser produces, one chain per '.'-separated component.

:func:read_smiles hands it out; it has no constructor of its own. str(ir) writes it back as text (SMILES, or SMARTS where it holds query atoms or bond operators) and :meth:to_atomistic turns it into a molecular graph. A fragment body with bonding descriptors is :func:read_smiles_fragment's, a :class:FragmentIr.

Examples:

>>> ir = molrs.io.smiles.read_smiles("CCO")
>>> ir.n_components
1
>>> ir.to_atomistic().n_atoms
3
>>> str(ir)
'CCO'

__doc__ = 'Intermediate representation of a parsed SMILES string: the syntax tree\nthe parser produces, one chain per ``\'.\'``-separated component.\n\n:func:`read_smiles` hands it out; it has no constructor of its own.\n``str(ir)`` writes it back as text (SMILES, or SMARTS where it holds query\natoms or bond operators) and :meth:`to_atomistic` turns it into a\nmolecular graph. A fragment body with bonding descriptors is\n:func:`read_smiles_fragment`\'s, a :class:`FragmentIr`.\n\nExamples\n--------\n>>> ir = molrs.io.smiles.read_smiles("CCO")\n>>> ir.n_components\n1\n>>> ir.to_atomistic().n_atoms\n3\n>>> str(ir)\n\'CCO\'' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.smiles' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

n_components property

Number of '.'-separated components.

__repr__() method descriptor

Return repr(self).

__str__() method descriptor

Return str(self).

components() method descriptor

One graph per component, in input order. Splitting happens on the parsed components, not by cutting the text on '.'.

Returns:

Type Description
list[Atomistic]

to_atomistic() method descriptor

The molecular graph the IR states: atoms and bonds, connectivity only — hydrogens implicit in the text are not added (:func:molrs.perceive.add_hydrogens fills open valences) and no coordinates are made. Every component lands in the one graph; :meth:components gives them apart.

Returns:

Type Description
Atomistic

Raises:

Type Description
SmilesError

A ring-closure digit never closed, or SMARTS query atoms or bonds (which have no single atomistic reading).

FragmentIr

A SMILES fragment body — SMILES plus bonding descriptors ([<]OCC[>]) — as :func:read_smiles_fragment reads it, and as a CGsmiles fragment table holds an atomistic body (:attr:molrs.io.cgsmiles.CgFragmentDef.body).

Its own class, because its conversion is not :meth:SmilesIr.to_atomistic: the descriptors are data the graph does not hold, so :meth:to_atomistic returns them beside it. str(body) writes the body back as text.

Examples:

>>> body = molrs.io.smiles.read_smiles_fragment("[<]OCC[>]")
>>> mol, descriptors = body.to_atomistic()
>>> [d.kind for _, d in descriptors]
['<', '>']

__doc__ = 'A SMILES fragment body — SMILES plus bonding descriptors (``[<]OCC[>]``)\n— as :func:`read_smiles_fragment` reads it, and as a ``CGsmiles``\nfragment table holds an atomistic body\n(:attr:`molrs.io.cgsmiles.CgFragmentDef.body`).\n\nIts own class, because its conversion is not :meth:`SmilesIr.to_atomistic`:\nthe descriptors are data the graph does not hold, so :meth:`to_atomistic`\nreturns them beside it. ``str(body)`` writes the body back as text.\n\nExamples\n--------\n>>> body = molrs.io.smiles.read_smiles_fragment("[<]OCC[>]")\n>>> mol, descriptors = body.to_atomistic()\n>>> [d.kind for _, d in descriptors]\n[\'<\', \'>\']' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.smiles' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

__str__() method descriptor

Return str(self).

to_atomistic() method descriptor

The body's graph and its bonding descriptors.

The graph is built by the same walk as :meth:SmilesIr.to_atomistic; each descriptor is paired with the atom it binds to, in atom-visit order, then each atom's own descriptor order. Descriptors are data, not atoms: no hydrogens are added and no bond is made.

Returns:

Type Description
tuple[Atomistic, list[tuple[Atom, BondingDescriptor]]]

Raises:

Type Description
SmilesError

A ring-closure digit never closed, or SMARTS query atoms or bonds.

to_template() method descriptor

Build the ported :class:~molrs.core.Atomistic template of this body: the heavy atoms, plus one capping hydrogen handle and one port per bonding descriptor (with its label and bond order). No coordinates, no frag_id; a body without descriptors gives a template without ports. The one-unit form of :meth:CgSmilesIr.templates.

Returns:

Type Description
Atomistic

Raises:

Type Description
SmilesError

If the body does not convert.

Examples:

>>> eo = molrs.io.smiles.read_smiles_fragment("[<]OCC[>]").to_template()
>>> eo.n_atoms, eo.n_ports
(5, 2)

SmilesError

Bases: builtins.ValueError

Raised when a SMILES / SMARTS / CGsmiles string is refused, by the parser or by a later stage (expansion, emit). Carries the four facts the Rust SmilesError owns: kind (the SmilesErrorKind variant name), span (byte range into input, end clamped to its length), input (the offending text, empty when the error was raised away from the scanner) and notation ('smiles' | 'smarts' | 'cgsmiles'). Subclasses Python ValueError, so broad except ValueError handlers keep catching it.

__doc__ = "Raised when a SMILES / SMARTS / CGsmiles string is refused, by the parser or by a later stage (expansion, emit). Carries the four facts the Rust `SmilesError` owns: `kind` (the `SmilesErrorKind` variant name), `span` (byte range into `input`, end clamped to its length), `input` (the offending text, empty when the error was raised away from the scanner) and `notation` (`'smiles' | 'smarts' | 'cgsmiles'`). Subclasses Python `ValueError`, so broad `except ValueError` handlers keep catching it." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.smiles' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__weakref__ property

list of weak references to the object

read_cgsmiles(text) builtin

Read a CGsmiles string into its intermediate representation.

Parameters:

Name Type Description Default
text str

CGsmiles string — one {...} block per resolution, blocks separated by ., the last one atomistic.

required

Returns:

Type Description
CgSmilesIr

Raises:

Type Description
ValueError

For every refusal the notation makes, with the offending column marked in the message. The four families are: a syntax error (an unclosed block or bracket, a bond symbol with nothing after it, a malformed annotation); a name no fragment table defines; a construct this version refuses outright (the squash operator [!], the virtual bond ., a mapping weight w other than its default, the chirality key x); and a written coarse edge whose two fragments offer no free pair of compatible bonding descriptors, as in {[#A][#B]}.{#A=[$a]C,#B=[$b]C}.

Examples:

>>> molrs.io.cgsmiles.read_cgsmiles("{[#A][#B]}.{#A=[$]C,#B=[$]O}").to_atomistic().n_atoms
2

CgSmilesIr

Intermediate representation of a parsed CGsmiles string.

An intermediate representation is what the string says, in structured form — one step short of a molecule. CGsmiles writes a molecule at one or more resolutions: the coarse level names beads ({[#PEO][#PEO]}), and every block after the first is a table of the fragment bodies the level above named. Constructing this class parses, validates, expands and resolves the whole string; the value it returns is finished, and is read rather than built. Turning it into atoms is a separate call, :meth:to_atomistic.

Attributes:

Name Type Description
levels list of CgGraph

Resolution levels, coarsest first. Level 0 is the base block that was written; every later level is the expansion of the table above it.

fragments list of dict of (str, CgFragmentDef)

Fragment tables, coarsest first, each keyed by the name written after # and in name order. fragments[k] resolves the names of levels[k].

pairs list of list of ResolvedPair

Resolved descriptor pairs, parallel to :attr:levels, in resolution order. A level with nothing to pair against carries an empty list.

Notes

len(levels) == len(fragments) whenever any fragment table was written — one level fewer than blocks, because the last block is atomistic and a level is a graph of beads, not of atoms. A base-only string is the other case: fragments == [] and len(levels) == 1.

Examples:

>>> ir = molrs.io.cgsmiles.read_cgsmiles("{[#OH][#PEO]|3[#OH]}.{#OH=[$]O,#PEO=[$]COC[$]}")
>>> len(ir.levels[0].nodes)
5
>>> ir.to_atomistic().n_atoms
11

__doc__ = 'Intermediate representation of a parsed `CGsmiles` string.\n\nAn *intermediate representation* is what the string says, in structured\nform — one step short of a molecule. `CGsmiles` writes a molecule at one\nor more *resolutions*: the coarse level names beads (``{[#PEO][#PEO]}``),\nand every block after the first is a table of the fragment bodies the\nlevel above named. Constructing this class parses, validates, expands and\nresolves the whole string; the value it returns is finished, and is read\nrather than built. Turning it into atoms is a separate call,\n:meth:`to_atomistic`.\n\nAttributes\n----------\nlevels : list of CgGraph\n Resolution levels, coarsest first. Level 0 is the base block that was\n written; every later level is the expansion of the table above it.\nfragments : list of dict of (str, CgFragmentDef)\n Fragment tables, coarsest first, each keyed by the name written after\n ``#`` and in name order. ``fragments[k]`` resolves the names of\n ``levels[k]``.\npairs : list of list of ResolvedPair\n Resolved descriptor pairs, parallel to :attr:`levels`, in resolution\n order. A level with nothing to pair against carries an empty list.\n\nNotes\n-----\n``len(levels) == len(fragments)`` whenever any fragment table was written\n— one level fewer than blocks, because the last block is atomistic and a\nlevel is a graph of beads, not of atoms. A base-only string is the other\ncase: ``fragments == []`` and ``len(levels) == 1``.\n\nExamples\n--------\n>>> ir = molrs.io.cgsmiles.read_cgsmiles("{[#OH][#PEO]|3[#OH]}.{#OH=[$]O,#PEO=[$]COC[$]}")\n>>> len(ir.levels[0].nodes)\n5\n>>> ir.to_atomistic().n_atoms\n11' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.io.cgsmiles' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

fragments property

Fragment tables, coarsest first, each in fragment-name order.

Name order, not written order: the table is a sorted map in Rust and the dict is filled from it, so iteration is reproducible across runs.

Returns:

Type Description
list of dict of (str, CgFragmentDef)

Raises:

Type Description
Exception

Only what building the dictionaries themselves can raise (a MemoryError, say). Every entry is already parsed, so no notation error can originate here.

levels property

Resolution levels, coarsest first.

Returns:

Type Description
list of CgGraph

pairs property

Resolved descriptor pairs, parallel to :attr:levels.

Returns:

Type Description
list of list of ResolvedPair

__repr__() method descriptor

Return repr(self).

templates() method descriptor

Read the last fragment table as named, ported :class:~molrs.core.Atomistic templates.

One entry per fragment the table defines, keyed by the name written after #. Each body keeps its own atoms and bonds and carries one port per bonding descriptor the body wrote — the unsatisfied valences that joining the fragment to a neighbour consumes. This is the template view of the string, the counterpart of :meth:to_atomistic, which instead expands the whole molecule and consumes those descriptors as bonds.

Topology only. A line notation states no geometry, so no atom carries a position; coordinates come from a separate :class:molrs.conformer.Conformer step, in ångström (Å).

Returns:

Type Description
dict of (str, Atomistic)

One ported template per fragment definition, in name order.

Raises:

Type Description
ValueError

If the string defines no fragment table: a base-only string ("{[#A][#B]}") writes beads and never says what they are made of, so there is no body to read.

Examples:

>>> ir = molrs.io.cgsmiles.read_cgsmiles("{[#OH][#PEO]|3[#OH]}.{#OH=[$]O,#PEO=[$]COC[$]}")
>>> sorted(ir.templates())
['OH', 'PEO']
>>> ir.templates()["PEO"].n_ports
2

A single unit needs no table: read_smiles_fragment("[<]OCC[>]").to_template() builds the same template from the body alone.

to_atomistic() method descriptor

Expand the lowest resolution into an all-atom molecular graph.

Every node of the last level is replaced by a copy of its fragment body, and every pair the reader resolved becomes one bond, carrying the class the pairing decided (:attr:ResolvedPair.kind). A port left unpaired creates nothing.

Topology only. A line notation states no geometry, so no atom carries a position; no hydrogen is added and no chemical perception is run. The atom count is the heavy-atom count the bodies wrote. Those are separate steps a caller composes.

Every atom carries the integer property frag_id: the index, in levels[-1].nodes, of the node it was expanded from. It is the fragment-instance key — not mol_id (a whole molecule; a fragment instance is smaller than one) and not res_id (a biopolymer residue) — so a caller can partition the result by instance without re-deriving the grouping.

Atom indices are not contracted; the connectivity, the elements and frag_id are. A ring-bearing string may pair ports in a different order than the CGsmiles reference implementation does and so lay its atoms out differently, while the expansion stays isomorphic to the reference's as an unlabelled graph.

Returns:

Type Description
Atomistic

Molecular graph with atoms and bonds.

Raises:

Type Description
ValueError

If there is no atomistic body to expand: a base-only string, which writes beads and never says what they are made of ("{[#A][#B]}"). That is the only failure a parsed value can reach — a string whose last block is not atomistic, or whose bodies do not convert, is already refused by the constructor.

Examples:

>>> ir = molrs.io.cgsmiles.read_cgsmiles("{[#OH][#PEO]|3[#OH]}.{#OH=[$]O,#PEO=[$]COC[$]}")
>>> ir.to_atomistic().n_atoms
11

to_coarsegrain() method descriptor

Read the coarsest level, levels[0], as a bead graph.

One bead per node, in node order, whose only property is bead_type (the name written after #); one CG bond per edge. Only the base block is read, so a base-only string such as "{[#1][#1][#1][#4]}" converts. This is how a bead-group pattern for :class:molrs.perceive.SubgraphMatcher is written as notation.

No geometry. No bead carries x / y / z (Å), mass (g/mol) or charge, and there is no bead membership, so :meth:CoarseGrain.center refuses the result. Edge multiplicities and node annotations are dropped.

Returns:

Type Description
CoarseGrain

The level-0 bead graph.

Raises:

Type Description
SmilesError

(a ValueError) if the IR breaks a reader invariant: no levels, an edge endpoint out of range, or a CG bond that cannot be added. No parsed string reaches this; only a hand-edited IR does.

Examples:

>>> cg = molrs.io.cgsmiles.read_cgsmiles("{[#1][#1][#1][#4]}").to_coarsegrain()
>>> cg.n_beads
4

Wire-encoded frames and CSV blocks

read_wire_frame(data, encoding) builtin

Rebuild a :class:Frame from a wire payload — what a :class:molrs.stream.Publisher streams.

Parameters:

Name Type Description Default
data bytes

A payload written by :func:write_wire_frame or a publisher.

required
encoding (msgpack, json)

The payload's encoding (a JSON payload is its UTF-8 text).

"msgpack"

Returns:

Type Description
Frame

Raises:

Type Description
ValueError

If encoding is not one of the two, or the payload does not decode.

write_wire_frame(frame, encoding) builtin

Encode a :class:Frame as a wire payload — the inverse of :func:read_wire_frame.

Parameters:

Name Type Description Default
frame Frame

The frame to encode.

required
encoding (msgpack, json)

The encoding (JSON comes back as its UTF-8 bytes).

"msgpack"

Returns:

Type Description
bytes

Raises:

Type Description
ValueError

If encoding is not one of the two, or the frame does not encode.

read_clpol_alpha(source) builtin

Read a CL&Pol alpha.ff table into its rows, in file order.

The text is whitespace-separated rows type m_D q_D k_D alpha a_thole; # starts a comment and a line with fewer than six fields is not a row. A type given twice keeps both rows; the later one is the file's last word. The table molrs ships is :func:molrs.ff.params.clpol_polarizability.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content.

required

Returns:

Type Description
list[dict]

One dict per row: type_name, m_D (u), q_D_sign, k_D (kJ/mol/Ų, k/2 r² form), alpha (ų) and a_thole.

Raises:

Type Description
ValueError

A row's numeric fields do not parse.

OSError

The file cannot be read.

read_csv_block(source, delimiter=',', header=None) builtin

Read CSV into a :class:~molrs.core.Block.

Each column's dtype is inferred int → float → str. When header is given the text is treated as headerless and those names are used; otherwise the first non-empty line names the columns. Blank lines are skipped; fields are split on delimiter and trimmed, with no quoting.

Parameters:

Name Type Description Default
source PathLike | bytes | Text

The file, or its whole content (UTF-8).

required
delimiter str

The one-character field separator.

','
header list[str]

Column names of a headerless file.

None

Returns:

Type Description
Block

Raises:

Type Description
ValueError

The text is empty, a row is ragged, or delimiter is not one character.

OSError

The file cannot be read.

write_csv_block(sink, block, delimiter=',', header=True) builtin

Write a :class:~molrs.core.Block as CSV — the inverse of :func:read_csv_block.

Parameters:

Name Type Description Default
sink PathLike | bytearray

The file, or a buffer that then holds exactly its bytes.

required
block Block

The block to write.

required
delimiter str

The one-character field separator.

','
header bool

Whether the first line names the columns.

True

Raises:

Type Description
ValueError

delimiter is not one character, or a column has a dtype CSV cannot encode.

OSError

The file cannot be written.

molrs.ff

molrs.ff.forcefield

The native force-field model exposes a Style/ForceFieldType handle hierarchy (BondStyle/BondType, PairStyle/PairType, CmapStyle/CmapType, …); a handle's params is a plain dict of numbers, strings and float64 arrays (a CMAP grid).

ForceField

Force-field definition metadata exposed to Python as molrs.ff.forcefield.ForceField.

Subclassable, like every core data class (molnex's ForceField extends it). Styles and types are read and written through their handles (:mod:handles).

__doc__ = "Force-field definition metadata exposed to Python as `molrs.ff.forcefield.ForceField`.\n\nSubclassable, like every core data class (molnex's `ForceField` extends it).\nStyles and types\nare read and written through their handles (:mod:`handles`)." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

name property

special_bonds property

The special-bond triples (lj, coul), each [1-2, 1-3, 1-4] — what :meth:set_special_bonds declared, or the default [0, 0, 1].

units property

The unit system the parameters are expressed in (a LAMMPS units name); "real" when none is declared.

__repr__() method descriptor

Return repr(self).

canonical() method descriptor

The force field in canonical form: every style of a form family in its canonical style's category mapped onto that style, exactly (dihedral opls/charmm/rb/… → dihedral periodic, bond class2 → bond harmonic, pair lj/class2 → pair lj/cut). Raises ValueError naming the type and the condition for a row the canonical style cannot hold.

def_style(category, name, params=None) method descriptor

Define the category style name with style-level params (numbers and strings, e.g. {"cutoff": 10.0, "mixing": "geometric"}) and return its handle (AtomStyle … PairStyle, CmapStyle), whose typed def_type defines types. Any other category the force-field IR registry declares (drude, a registered custom category, …), or one this force field holds already, returns a RelationStyle, whose def_type(name, *endpoints, **params) takes as many endpoints as the category's arity. Re-defining it with equal params keeps the existing style.

Raises:

Type Description
ValueError

On different params for an existing style, or an unknown category.

fit_form(category, style, q, w=None, *, kt=None, offset=False) method descriptor

Fit every other style of category to style by least squares over the sample points q of the category's coordinate (r; θ, φ in radians) with weights w (default 1), Boltzmann factors of each row's source energy at kt when given, and a free constant offset when offset. Returns (forcefield, residual), residual a dict: sum_sq, rms, max_abs and types (per fitted row: style, type, exact, sum_sq, rms, max_abs, offset).

get_style(category, name) method descriptor

The category style name, or None.

get_styles(category) method descriptor

The styles of a category, in definition order — a name ("bond") or a style class (BondStyle; RelationStyle selects every category beyond the seven, Style every category). The one listing door: every style is get_styles(Style).

get_types(category) method descriptor

The types of a category — a name ("bond") or a type class (BondType; RelationType selects every category beyond the seven, ForceFieldType every category) — style by style.

materialize_one_four(frame) method descriptor

Write this force field's 1-4 pricing of frame's 1-4 pairs as per-pair override cells (epsilon, sigma, lj_scale, coul_scale) on its pairs block, and return how many rows were filled.

Every pairs row flagged is_14 (each 1-4 pair once; the block is built when the frame has none) that no dihedral charmm w > 0 covers gets its null cells: epsilon/sigma are the pair's 1-4 Lennard-Jones parameters — under lj/charmm with one_four = "epsilon14" the cross (NBFIX) row or the two types' epsilon14/sigma14 mixed, else the regular pair parameters — and the scales are the special_bonds 1-4 weights. Cells already set are kept. A field whose lj/charmm declares one_four = "epsilon14" (an OpenMM <LennardJonesForce> with sigma14/epsilon14, a GROMACS [ pairtypes ] table) needs this on its frames before it compiles; LAMMPS's writers refuse the override columns.

Parameters:

Name Type Description Default
frame Frame

A typed frame (atoms.type), modified in place.

required

Returns:

Type Description
int

The number of pairs rows given override cells.

Raises:

Type Description
ValueError

An untyped frame, a type without a pair row, two Lennard-Jones styles or an invalid one_four.

materialize_params(frame, *, prefix) method descriptor

Write the parameters this force field gives each row of frame as columns <prefix><parameter>, in place.

Each row of bonds, angles, dihedrals, impropers and cmaps gets the numeric parameters of the type its type column names (bonds.<prefix>k, bonds.<prefix>r0, dihedrals.<prefix>k1, <prefix>periodicity1, <prefix>phase1, …); each atom gets those of its atoms.type under every atom style (<prefix>mass) and those of its type's self row under every pair style with per-type rows (<prefix>epsilon, <prefix>sigma under lj/cut). The columns are the parameters the field stores, whatever the style — nothing here is per style — in the force-field IR's units (LAMMPS standard: degrees, K without a ½, the field's units preset).

A row whose type lacks a parameter another row's type has (a two-term torsion beside a three-term one; estimate_penalty on an estimated term only) is a null cell: Block.validity(column) marks it. String and array parameters, a pair style without per-type rows (coul/cut) and cross rows (NBFIX) are not written. A column already present under a written name is replaced. Charges are frame data, not a type parameter (unless the field stores them per type): a charge model writes atoms.charge.

Parameters:

Name Type Description Default
frame Frame

A frame typed by this force field (atoms.type, and a type column on every relation block with rows), modified in place.

required
prefix str

Prepended to every parameter name, e.g. "ref_"; "" writes the bare names.

required

Returns:

Type Description
dict[str, list[str]]

Block name → the columns written to it, in order.

Raises:

Type Description
ValueError

A relation block with rows but no string type column; a row or atom whose type no style of its category defines, or two styles define; an atom whose type has no self row in a pair style that has rows; two styles writing one atoms column.

Examples:

>>> gaff = molrs.ff.typifier.GaffTypifier(parameter_set="gaff2")
>>> frame = gaff.typify(labelled).to_frame()
>>> gaff.forcefield().materialize_params(frame, prefix="gaff2_")
{'bonds': ['gaff2_k', 'gaff2_r0'], 'angles': [...], ..., 'atoms': ['gaff2_epsilon', 'gaff2_mass', 'gaff2_sigma']}
>>> k = frame["bonds"].get("gaff2_k")

merge(other) method descriptor

Merge other into this force field, in place, and return self.

The union of both definitions: other's new styles and types are defined through the same primitives. A style or type both define is one definition when the two price alike — the parameters the style's spec declares, defaults filled in, numbers equal within a relative 1e-6 (annotations, estimate provenance and a reader's bookkeeping such as a prmtop atom type's id take no part) — and this force field's is kept; otherwise it raises ValueError. Declared units and special_bonds are adopted when this force field declares none; two declared values that differ raise ValueError. On error nothing changes.

set_special_bonds(lj, coul) method descriptor

Declare both LJ and Coulomb special-bond triples (1-2, 1-3, 1-4).

Length-3 sequences required; a wrong length raises ValueError. Entries [0]/[1] are stored but not applied (1-2/1-3 exclusion is by omitting pairs from the neighbour list).

to_form(category, style) method descriptor

The force field with every style of category in the form family of style converted to style, exactly; raises ValueError naming the first row outside style's image and the condition.

Style

Handle of one style of a :class:ForceField.

Made by ForceField.def_style / get_style / get_styles; its category's subclass (BondStyle, …) carries the typed def_type. Two handles are equal when they name the same category and style of the same force field.

__doc__ = "Handle of one style of a :class:`ForceField`.\n\nMade by ``ForceField.def_style`` / ``get_style`` / ``get_styles``; its\ncategory's subclass (``BondStyle``, …) carries the typed ``def_type``.\nTwo handles are equal when they name the same category and style of the\nsame force field." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

category property

The category ("atom", "bond", …, "pair", "cmap", or any other a relation style is of).

name property

The style name ("harmonic", "lj/cut", …).

params property

The style-level params (e.g. a pair style's cutoff, mixing), as a new dict.

__delitem__(key) method descriptor

Delete self[key].

__eq__(value) method descriptor

Return self==value.

__ge__(value) method descriptor

Return self>=value.

__getitem__(key) method descriptor

Return self[key].

__gt__(value) method descriptor

Return self>value.

__hash__() method descriptor

Return hash(self).

__le__(value) method descriptor

Return self<=value.

__lt__(value) method descriptor

Return self<value.

__ne__(value) method descriptor

Return self!=value.

__repr__() method descriptor

Return repr(self).

__setitem__(key, value) method descriptor

Set self[key] to value.

del_type(name) method descriptor

Remove the type named name from this style (Style::del_type) and return how many were removed: 1, or 0 when the style defines no such type. Handles onto the removed type go stale.

get_type_by_name(name) method descriptor

The type named name, or None.

get_types(type_cls=None) method descriptor

The types of this style that are instances of type_cls (every type, in definition order, when it is None).

AtomStyle

Bases: molrs.ff.forcefield.Style

The atom style: def_type(name, **params).

__doc__ = 'The atom style: ``def_type(name, **params)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

def_type(name, **params) method descriptor

Define the atom type name with params (numbers and strings, e.g. mass=12.011, element="C") and return its handle — the endpoint the bonded and pair styles take.

Raises:

Type Description
ValueError

On a conflicting re-definition.

BondStyle

Bases: molrs.ff.forcefield.Style

The bond style: def_type(name, itom, jtom, **params).

__doc__ = 'The bond style: ``def_type(name, itom, jtom, **params)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

def_type(name, itom, jtom, **params) method descriptor

Define the bond type name between the atom types itom and jtom with params and return its handle. The name is stored as given and never read for endpoints.

Raises:

Type Description
TypeError

If an endpoint is not an AtomType.

ValueError

On a conflicting re-definition.

AngleStyle

Bases: molrs.ff.forcefield.Style

The angle style: def_type(name, itom, jtom, ktom, **params).

__doc__ = 'The angle style: ``def_type(name, itom, jtom, ktom, **params)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

def_type(name, itom, jtom, ktom, **params) method descriptor

Define the angle type name on itom–jtom–ktom (jtom the vertex) with params and return its handle.

Raises:

Type Description
TypeError

If an endpoint is not an AtomType.

ValueError

On a conflicting re-definition.

DihedralStyle

Bases: molrs.ff.forcefield.Style

The dihedral style: def_type(name, itom, jtom, ktom, ltom, **params).

__doc__ = 'The dihedral style: ``def_type(name, itom, jtom, ktom, ltom, **params)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

def_type(name, itom, jtom, ktom, ltom, **params) method descriptor

Define the dihedral type name on itom–jtom–ktom–ltom with params and return its handle.

Raises:

Type Description
TypeError

If an endpoint is not an AtomType.

ValueError

On a conflicting re-definition.

ImproperStyle

Bases: molrs.ff.forcefield.Style

The improper style: def_type(name, itom, jtom, ktom, ltom, **params).

__doc__ = 'The improper style: ``def_type(name, itom, jtom, ktom, ltom, **params)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

def_type(name, itom, jtom, ktom, ltom, **params) method descriptor

Define the improper type name on itom, jtom, ktom, ltom in the style's slot order with params and return its handle.

Raises:

Type Description
TypeError

If an endpoint is not an AtomType.

ValueError

On a conflicting re-definition.

PairStyle

Bases: molrs.ff.forcefield.Style

The pair style: def_type(name, itom, jtom=None, **params).

__doc__ = 'The pair style: ``def_type(name, itom, jtom=None, **params)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

def_type(name, itom, jtom=None, **params) method descriptor

Define the pair type name between itom and jtom with params and return its handle; jtom=None is the self pair of itom.

A pair is its two atom types in either order, so a style holds one row per pair: restating a stored pair under any name with equal parameters (annotations such as desc aside) stores nothing and returns the stored row's handle.

Raises:

Type Description
TypeError

If an endpoint is not an AtomType.

ValueError

On a conflicting re-definition, or a restatement of a stored pair with different parameters.

CmapStyle

Bases: molrs.ff.forcefield.Style

The cmap style: def_type(name, itom, jtom, ktom, ltom, mtom, **params).

__doc__ = 'The cmap style: ``def_type(name, itom, jtom, ktom, ltom, mtom, **params)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

def_type(name, itom, jtom, ktom, ltom, mtom, **params) method descriptor

Define the cmap type name on the five atom types of two consecutive dihedrals, itom–jtom–ktom–ltom and jtom–ktom–ltom–mtom, with params (its correction table is the array param grid, an N × N float array) and return its handle.

Raises:

Type Description
TypeError

If an endpoint is not an AtomType.

ValueError

On a conflicting re-definition.

ForceFieldType

Handle of one type of a :class:ForceField.

Its params read as a mapping (t["k"], "k" in t, t.keys()) and write one at a time (t["k"] = 300.0, t["element"] = "C", t["grid"] = np.zeros((24, 24))). endpoints are the AtomType handles it is defined on. Two handles are equal when they name the same category, style and type of the same force field.

__doc__ = 'Handle of one type of a :class:`ForceField`.\n\nIts params read as a mapping (``t["k"]``, ``"k" in t``, ``t.keys()``) and\nwrite one at a time (``t["k"] = 300.0``, ``t["element"] = "C"``,\n``t["grid"] = np.zeros((24, 24))``).\n``endpoints`` are the ``AtomType`` handles it is defined on. Two handles\nare equal when they name the same category, style and type of the same\nforce field.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

category property

The category ("atom", "bond", …, "pair", "cmap", or any other a relation style is of).

endpoints property

The AtomType handles this type is defined on (none for an atom type; two for a pair type, a self pair naming one atom type twice).

name property

The type name — the label a Frame's type column carries.

params property

The type's params (numbers, strings and float64 arrays), as a new dict.

__contains__(key) method descriptor

Return bool(key in self).

__delitem__(key) method descriptor

Delete self[key].

__eq__(value) method descriptor

Return self==value.

__ge__(value) method descriptor

Return self>=value.

__getitem__(key) method descriptor

Return self[key].

__gt__(value) method descriptor

Return self>value.

__hash__() method descriptor

Return hash(self).

__le__(value) method descriptor

Return self<=value.

__lt__(value) method descriptor

Return self<value.

__ne__(value) method descriptor

Return self!=value.

__repr__() method descriptor

Return repr(self).

__setitem__(key, value) method descriptor

Set self[key] to value.

get(key, default=None) method descriptor

One param, or default.

items() method descriptor

(name, value) param pairs.

keys() method descriptor

The param names.

AtomType

Bases: molrs.ff.forcefield.ForceFieldType

An atom type; the endpoint every other type is defined on.

__doc__ = 'An atom type; the endpoint every other type is defined on.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

BondType

Bases: molrs.ff.forcefield.ForceFieldType

A bond type.

__doc__ = 'A bond type.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

itom property

The first endpoint atom type.

jtom property

The second endpoint atom type.

AngleType

Bases: molrs.ff.forcefield.ForceFieldType

An angle type (jtom the vertex).

__doc__ = 'An angle type (``jtom`` the vertex).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

itom property

The first endpoint atom type.

jtom property

The second endpoint atom type.

ktom property

The third endpoint atom type.

DihedralType

Bases: molrs.ff.forcefield.ForceFieldType

A dihedral type.

__doc__ = 'A dihedral type.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

itom property

The first endpoint atom type.

jtom property

The second endpoint atom type.

ktom property

The third endpoint atom type.

ltom property

The fourth endpoint atom type.

ImproperType

Bases: molrs.ff.forcefield.ForceFieldType

An improper type.

__doc__ = 'An improper type.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

itom property

The first endpoint atom type.

jtom property

The second endpoint atom type.

ktom property

The third endpoint atom type.

ltom property

The fourth endpoint atom type.

PairType

Bases: molrs.ff.forcefield.ForceFieldType

A pair type.

__doc__ = 'A pair type.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

itom property

The first endpoint atom type.

jtom property

The second endpoint atom type.

CmapType

Bases: molrs.ff.forcefield.ForceFieldType

A cmap type: two consecutive dihedrals on five atom types.

__doc__ = 'A cmap type: two consecutive dihedrals on five atom types.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.forcefield' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

itom property

The first endpoint atom type.

jtom property

The second endpoint atom type.

ktom property

The third endpoint atom type.

ltom property

The fourth endpoint atom type.

mtom property

The fifth endpoint atom type.

molrs.ff.compile

PotentialCompiler

Compiles a :class:ForceField into evaluable kernels.

Exposed to Python as molrs.ff.compile.PotentialCompiler. It owns a copy of the force field, taken at construction: later edits to that :class:ForceField do not reach a compiler that already exists — make a new one.

Three doors, each doing one thing:

  • :meth:compile — bind a typed :class:Frame now;
  • :meth:defer — a :class:Potentials that binds the topology of the :class:Frame it is evaluated on;
  • :meth:compile_typed — the kernels of a neighbour-driven evaluation, for MD.

Examples:

>>> compiler = molrs.ff.compile.PotentialCompiler(typifier.forcefield())
>>> potentials = compiler.compile(frame)
>>> energy = potentials.calc_energy(frame)

__doc__ = 'Compiles a :class:`ForceField` into evaluable kernels.\n\nExposed to Python as ``molrs.ff.compile.PotentialCompiler``. It owns a **copy** of\nthe force field, taken at construction: later edits to that\n:class:`ForceField` do not reach a compiler that already exists — make a\nnew one.\n\nThree doors, each doing one thing:\n\n* :meth:`compile` — bind a typed :class:`Frame` now;\n* :meth:`defer` — a :class:`Potentials` that binds the topology of the\n :class:`Frame` it is evaluated on;\n* :meth:`compile_typed` — the kernels of a neighbour-driven evaluation,\n for MD.\n\nExamples\n--------\n>>> compiler = molrs.ff.compile.PotentialCompiler(typifier.forcefield())\n>>> potentials = compiler.compile(frame)\n>>> energy = potentials.calc_energy(frame)' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.compile' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

compile(frame) method descriptor

Build evaluable :class:Potentials against a typed frame.

The frame must carry the topology + type columns each style resolves (atoms/bonds/angles/dihedrals/impropers/ pairs), as produced by a typifier or an external emitter. Every pair style is resolved against the frame's pairs block — a fixed list, right for a molecule in free space — and prices a row only inside its cutoff (r < cutoff, with its switch where it has one), as :meth:compile_typed and LAMMPS do; a style stating no cutoff prices every row. pair coul/long/pme reads the frame's periodic box.

Parameters:

Name Type Description Default
frame Frame

Typed molecular data. Required; for potentials that bind at evaluation time use :meth:defer.

required

Returns:

Type Description
Potentials

Raises:

Type Description
TypeError

If frame is not a :class:Frame (None included).

ValueError

If a style has no registered kernel, a type label is unknown, the force field's 1-2 / 1-3 weights are not 0 or 1, or a style that reads the box (coul/long/pme) meets a frame without a periodic one.

compile_typed(frame) method descriptor

Build the kernels for a neighbour-driven evaluation, with the special-bonds weights each one takes.

The counterpart of :meth:compile, and what periodic MD needs. That one resolves every pair style against the frame's pairs block — a fixed list, right for a free-boundary molecule and wrong for a periodic system; over the same pairs the two price the same energy. This one resolves them against the atoms, reads no pairs block, and requires the style's declared cutoff.

The weights come from the force field's special_bonds walked over the frame's bond graph. Without them a neighbour table would count a bonded pair twice: once by the bond term and once at full non-bonded strength, at bond length.

Parameters:

Name Type Description Default
frame Frame

Typed molecular data.

required

Returns:

Type Description
WeightedTerms

Raises:

Type Description
ValueError

If a style cannot be built, or a pair style has no neighbour-driven form.

defer() method descriptor

A :class:Potentials that compiles when it is evaluated.

It holds this compiler's force field and binds the topology and coordinates of the :class:Frame passed to calc_energy(frame) / calc_forces(frame) (the molpy evaluation model). It has no members until then, so len is 0, and it cannot be evaluated on a bare coordinate array or moved into an integrator.

Returns:

Type Description
Potentials

ExplicitTerms

The terms of one style over explicit instances — molrs::ff::compile::ExplicitTerms; :meth:compile builds their kernel.

Works for every style the force-field IR prices: a built-in, a style registered from Python (by expression or kernel, :mod:molrs.ff.ir), a style of a custom category, or an unregistered style given its expression=. The kernel is built exactly as :meth:PotentialCompiler.compile builds it, one type per term.

Parameters:

Name Type Description Default
category str

The style ("bond", "harmonic"; "pair", "lj/cut"; …).

required
style str

The style ("bond", "harmonic"; "pair", "lj/cut"; …).

required
atoms array_like of int, shape (n, arity)

Each term's atoms. A pair term is an atom pair, priced with its own row (the pair's cross row).

required
charges array_like of float

Per-atom charges (atoms.charge), read by coul/cut and by pair expressions through q1, q2.

None
**params

Style parameters (cutoff, mixing, coulomb, …, an unregistered style's expression) as a number or a string; every other one per term as stored (angle values in degrees): a number (broadcast) or one value per term, an array parameter one array (or n stacked), a text parameter a string or one per term. Indexed families are spelled k1, k2, …. A style whose numbers are per instance (coul/cut) takes none.

required

Raises:

Type Description
TypeError

A parameter the registered style does not declare.

Examples:

>>> import numpy as np
>>> from molrs.ff.compile import ExplicitTerms
>>> pots = ExplicitTerms("bond", "harmonic", [[0, 1]], k=300.0, r0=1.5).compile()
>>> e, f = pots.calc_energy_forces(np.array([0.0, 0, 0, 1.6, 0, 0]))
>>> round(e, 12)
3.0

__doc__ = 'The terms of one style over explicit instances —\n``molrs::ff::compile::ExplicitTerms``; :meth:`compile` builds their kernel.\n\nWorks for every style the force-field IR prices: a built-in, a style\nregistered from Python (by expression or kernel, :mod:`molrs.ff.ir`), a\nstyle of a custom category, or an unregistered style given its\n``expression=``. The kernel is built exactly as\n:meth:`PotentialCompiler.compile` builds it, one type per term.\n\nParameters\n----------\ncategory, style : str\n The style (``"bond", "harmonic"``; ``"pair", "lj/cut"``; …).\natoms : array_like of int, shape (n, arity)\n Each term\'s atoms. A pair term is an atom pair, priced with its own\n row (the pair\'s cross row).\ncharges : array_like of float, optional\n Per-atom charges (``atoms.charge``), read by ``coul/cut`` and by\n pair expressions through ``q1``, ``q2``.\n**params\n Style parameters (``cutoff``, ``mixing``, ``coulomb``, …, an\n unregistered style\'s ``expression``) as a number or a string; every\n other one per term **as stored** (angle values in degrees): a number\n (broadcast) or one value per term, an array parameter one array (or\n ``n`` stacked), a text parameter a string or one per term. Indexed\n families are spelled ``k1``, ``k2``, …. A style whose numbers are per\n instance (``coul/cut``) takes none.\n\nRaises\n------\nTypeError\n A parameter the registered style does not declare.\n\nExamples\n--------\n>>> import numpy as np\n>>> from molrs.ff.compile import ExplicitTerms\n>>> pots = ExplicitTerms("bond", "harmonic", [[0, 1]], k=300.0, r0=1.5).compile()\n>>> e, f = pots.calc_energy_forces(np.array([0.0, 0, 0, 1.6, 0, 0]))\n>>> round(e, 12)\n3.0' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.compile' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

compile() method descriptor

Build the kernel of these terms, exactly as :meth:PotentialCompiler.compile builds it, one type per term.

Returns:

Type Description
Potentials

One member; Potentials.push moves it into another collection.

Raises:

Type Description
IrError

The IR's refusal, by its subclass: UnknownCategory, Arity (a row of the wrong length), NoKernel, MissingParam, ….

molrs.ff.potential

Every potential evaluates energy and forces together, the one door of the core Potential::evaluate into an Accumulator: Potentials.evaluate(coords), a Python provider's evaluate(pos), and for the pair kernel PairLjCut.evaluate_pairs(pos, neighbors) (PairDriven::evaluate_pairs) and PairLjCut.pair_energy_force(r2, disp).

Potentials

Compiled force-field potentials for energy and force evaluation.

Exposed to Python as molrs.ff.potential.Potentials.

Operates on flat coordinate arrays in the layout [x0, y0, z0, x1, y1, z1, ...] (length 3N).

Examples:

>>> typifier = Mmff94Typifier()
>>> frame = typifier.typify(mol).to_frame()
>>> frame["pairs"] = molrs.ff.potential.intramolecular_pairs(frame)
>>> potentials = molrs.ff.compile.PotentialCompiler(typifier.forcefield()).compile(frame)
>>> energy, forces = potentials.evaluate(coords)

__doc__ = 'Compiled force-field potentials for energy and force evaluation.\n\nExposed to Python as `molrs.ff.potential.Potentials`.\n\nOperates on flat coordinate arrays in the layout\n``[x0, y0, z0, x1, y1, z1, ...]`` (length 3N).\n\nExamples\n--------\n>>> typifier = Mmff94Typifier()\n>>> frame = typifier.typify(mol).to_frame()\n>>> frame["pairs"] = molrs.ff.potential.intramolecular_pairs(frame)\n>>> potentials = molrs.ff.compile.PotentialCompiler(typifier.forcefield()).compile(frame)\n>>> energy, forces = potentials.evaluate(coords)' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.potential' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__len__() method descriptor

Return len(self).

__repr__() method descriptor

Return repr(self).

evaluate(arg) method descriptor

Energy and forces (-∇E) of every member (Potential::evaluate into a fresh accumulator): (energy, forces), forces of shape (N, 3).

arg is a :class:Frame (its atoms coordinates; a deferred collection binds the frame's topology first) or flat coordinates [x0, y0, z0, x1, ...] of length 3N.

push(potential) method descriptor

Move one more member into the collection: an PairLjCut nonbond term, a callable Potential, or another Potentials.

PairLjCut

LAMMPS pair_style lj/cut: the one-type cut Lennard-Jones / Mie kernel a neighbour loop feeds pairs to (MD's nonbond kernel). A pair list with a row per pair is ExplicitTerms("pair", "lj/cut", pairs, epsilon=…, sigma=…).compile().

__doc__ = 'LAMMPS ``pair_style lj/cut``: the one-type cut Lennard-Jones / Mie kernel\na neighbour loop feeds pairs to (MD\'s nonbond kernel). A pair list with a\nrow per pair is ``ExplicitTerms("pair", "lj/cut", pairs, epsilon=…, sigma=…).compile()``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.potential' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

cutoff property

epsilon property

m property

n property

shifted property

sigma property

smeared property

evaluate_pairs(pos, neighbors, factor=None) method descriptor

Energy and forces of every pair in neighbors (PairDriven::evaluate_pairs): (energy, forces), forces of shape (N, 3) for the N rows of pos.

neighbors must carry its separations (built with disp=True); factor is one weight per pair (None: all ones), a weight of exactly zero skipping the pair.

Raises:

Type Description
ValueError

pos is not (N, 3), neighbors has no disp or names a point past N, or factor is not one weight per pair.

pair_energy_force(r2, disp) method descriptor

Energy and force of one pair at squared distance r2 along the separation disp (PairPotential::pair_energy_force), or None beyond the cutoff.

molrs.ff.typifier

Mmff94Typifier

Bases: molrs.ff.typifier.Typifier

MMFF94 atom-type assigner.

Exposed to Python as molrs.ff.typifier.Mmff94Typifier.

Loads the embedded MMFF94 parameter tables at construction time. Use :meth:typify to label a molecular graph (atom types, partial charges, and the per-instance force constants the kernels read: koop (mdArad^-2) on the improper rows, v1/v2/v3 on the dihedral rows), then compile it through :meth:forcefield — the definitions typing assigned — the standard route, shared with every other force field in molrs. :meth:typify raises ValueError when atom types cannot be determined (e.g. unsupported elements).

See :class:Mmff94sTypifier for the "static" variant used in energy minimization.

References

  • Halgren, T.A. (1996). J. Comput. Chem. 17, 490-519.

Examples:

>>> typifier = Mmff94Typifier()
>>> frame = typifier.typify(mol).to_frame()          # labels + charges
>>> frame["pairs"] = molrs.ff.potential.intramolecular_pairs(frame)
>>> pots = molrs.ff.compile.PotentialCompiler(typifier.forcefield()).compile(frame)

__doc__ = 'MMFF94 atom-type assigner.\n\nExposed to Python as `molrs.ff.typifier.Mmff94Typifier`.\n\nLoads the embedded MMFF94 parameter tables at construction time. Use\n:meth:`typify` to label a molecular graph (atom types, partial charges, and\nthe per-instance force constants the kernels read: ``koop`` (md*A*rad^-2)\non the improper rows, ``v1``/``v2``/``v3`` on the dihedral rows), then\ncompile it through :meth:`forcefield` — the definitions typing assigned —\nthe standard route, shared with every other force field in molrs.\n:meth:`typify` raises ``ValueError`` when atom types cannot be determined\n(e.g. unsupported elements).\n\nSee :class:`Mmff94sTypifier` for the "static" variant used in energy\nminimization.\n\n# References\n\n- Halgren, T.A. (1996). J. Comput. Chem. 17, 490-519.\n\nExamples\n--------\n>>> typifier = Mmff94Typifier()\n>>> frame = typifier.typify(mol).to_frame() # labels + charges\n>>> frame["pairs"] = molrs.ff.potential.intramolecular_pairs(frame)\n>>> pots = molrs.ff.compile.PotentialCompiler(typifier.forcefield()).compile(frame)' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.typifier' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

Mmff94sTypifier

Bases: molrs.ff.typifier.Typifier

MMFF94s ("static") atom-type assigner and potential builder.

Exposed to Python as molrs.ff.typifier.Mmff94sTypifier.

Identical to :class:Mmff94Typifier except on delocalised trivalent nitrogen (MMFF numeric types 10 NC=O and 40 NC=C), where MMFF94s re-parameterises 11 out-of-plane rows and 42 torsion rows so the nitrogen minimizes to a planar geometry — the one seen in crystal structures.

The mechanism is the out-of-plane force constant koop (mdArad^-2) that :meth:typify bakes onto the improper rows. The kernel evaluates E_oop = 0.5 * 143.9325 * koop * chi**2 with chi the Wilson out-of-plane angle in radians, so koop > 0 makes the planar centre an energy minimum. MMFF94s sets it to +0.015 (type 10) / +0.030 (type 40); MMFF94's values on those rows run from -0.033 to +0.004.

All 95 atom types, and every bond / angle / stretch-bend / vdW / charge parameter, are shared with MMFF94 — so a molecule with no such nitrogen gets bit-for-bit the same answer from both classes.

References

  • Halgren, T.A. (1999). J. Comput. Chem. 20, 720-729. (MMFF94s)

Examples:

>>> typifier = Mmff94sTypifier()
>>> typifier.forcefield().name
'MMFF94s'

__doc__ = 'MMFF94s ("static") atom-type assigner and potential builder.\n\nExposed to Python as `molrs.ff.typifier.Mmff94sTypifier`.\n\nIdentical to :class:`Mmff94Typifier` except on delocalised trivalent\nnitrogen (MMFF numeric types 10 ``NC=O`` and 40 ``NC=C``), where MMFF94s\nre-parameterises 11 out-of-plane rows and 42 torsion rows so the nitrogen\nminimizes to a **planar** geometry — the one seen in crystal structures.\n\nThe mechanism is the out-of-plane force constant ``koop`` (md*A*rad^-2) that\n:meth:`typify` bakes onto the improper rows. The kernel evaluates\n``E_oop = 0.5 * 143.9325 * koop * chi**2`` with ``chi`` the Wilson\nout-of-plane angle in radians, so ``koop > 0`` makes the planar centre an\nenergy minimum. MMFF94s sets it to ``+0.015`` (type 10) / ``+0.030``\n(type 40); MMFF94\'s values on those rows run from ``-0.033`` to ``+0.004``.\n\nAll 95 atom types, and every bond / angle / stretch-bend / vdW / charge\nparameter, are shared with MMFF94 — so a molecule with no such nitrogen gets\nbit-for-bit the same answer from both classes.\n\n# References\n\n- Halgren, T.A. (1999). J. Comput. Chem. 20, 720-729. (MMFF94s)\n\nExamples\n--------\n>>> typifier = Mmff94sTypifier()\n>>> typifier.forcefield().name\n\'MMFF94s\'' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.typifier' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

OplsAaTypifier

Bases: molrs.ff.typifier.Typifier

OPLS-AA atom-type assigner and potential builder.

Exposed to Python as molrs.ff.typifier.OplsAaTypifier. It loads the embedded canonical OPLS-AA parameter set by default, or reads one XML source at construction. :meth:typify returns a typed :class:Atomistic (ValueError when atom typing fails); :meth:forcefield holds the definitions it assigned.

Parameters:

Name Type Description Default
source (PathLike, bytes or Text)

An OPLS-AA XML file (a path), or its whole content (bytes / :class:molrs.io.Text); a plain str is refused as ambiguous. None uses the embedded canonical OPLS-AA table.

None
strict bool

When True, a bonded term with no force-field match is an error. When False, such terms are skipped (left unparametrized).

True

Examples:

>>> typifier = OplsAaTypifier()
>>> typed = typifier.typify(mol)        # typed Atomistic
>>> # compose: typify → to_frame → intramolecular_pairs → PotentialCompiler(forcefield()).compile

__doc__ = 'OPLS-AA atom-type assigner and potential builder.\n\nExposed to Python as `molrs.ff.typifier.OplsAaTypifier`. It loads the embedded canonical\nOPLS-AA parameter set by default, or reads one XML source at construction.\n:meth:`typify` returns a typed :class:`Atomistic` (``ValueError`` when atom\ntyping fails); :meth:`forcefield` holds the definitions it assigned.\n\nParameters\n----------\nsource : os.PathLike, bytes or molrs.io.Text, optional\n An OPLS-AA XML file (a path), or its whole content (``bytes`` /\n :class:`molrs.io.Text`); a plain ``str`` is refused as ambiguous.\n ``None`` uses the embedded canonical OPLS-AA table.\nstrict : bool, default True\n When True, a bonded term with no force-field match is an error. When\n False, such terms are skipped (left unparametrized).\n\nExamples\n--------\n>>> typifier = OplsAaTypifier()\n>>> typed = typifier.typify(mol) # typed Atomistic\n>>> # compose: typify → to_frame → intramolecular_pairs → PotentialCompiler(forcefield()).compile' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.typifier' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

AtdTypifier

Bases: molrs.ff.typifier.Typifier

Antechamber atom typifier — molrs.ff.typifier.AtdTypifier.

One rule engine bound to one ATOMTYPE_*.DEF table. :meth:typify perceives antechamber bond types, derives the facts each rule can ask about, and labels every atom with the first rule of the table that matches it.

Graph in / graph out: :meth:typify returns a clone of mol with the table's atom type in keys.TYPE on every atom and the perceived bcc_bond_type on every bond; the caller's handles still address their atoms on it, and mol is left untouched — the standard AM1-BCC workflow needs the caller's force-field types and these at once. It raises ValueError if the molecule's facts cannot be derived.

An atom no rule matches comes back labelled "DU", the table's own catch-all row; that is antechamber's answer, not a fallback the engine invents. Refusing DU is the charge model's job.

Parameters:

Name Type Description Default
parameter_set str

The antechamber -at flag naming the table: "bcc", "abcg2", "gas", "gaff", "gaff2", "amber" or "sybyl". Required — there is no default table.

required
bond_orders BondOrderSource

Which bond orders the types follow (AtdTypifier::with_bond_orders; the core's default is Connectivity). Connectivity judges them from the connectivity alone, as antechamber does by default (bondtype -j full): the molecule's own orders are ignored, and on a molecule with two Kekulé structures (azulene, cyclooctatetraene) the colouring (cc / cd …) is the one antechamber's search settles on for the same atom and bond order. Every hydrogen must be drawn. Stated keeps the molecule's own orders (aromatic bonds without one are kekulized).

``BondOrderSource.Connectivity``

Raises:

Type Description
ValueError

If parameter_set names no table.

Examples:

>>> typed = molrs.ff.typifier.AtdTypifier(parameter_set="gaff").typify(benzene)
>>> typed.get(carbon, molrs.core.keys.TYPE)
'ca'

__doc__ = 'Antechamber atom typifier — `molrs.ff.typifier.AtdTypifier`.\n\nOne rule engine bound to one `ATOMTYPE_*.DEF` table. :meth:`typify` perceives\nantechamber bond types, derives the facts each rule can ask about, and labels\nevery atom with the first rule of the table that matches it.\n\nGraph in / graph out: :meth:`typify` returns a clone of ``mol`` with the\ntable\'s atom type in ``keys.TYPE`` on every atom and the perceived\n``bcc_bond_type`` on every bond; the caller\'s handles still address their\natoms on it, and ``mol`` is left untouched — the standard AM1-BCC workflow\nneeds the caller\'s force-field types *and* these at once. It raises\n``ValueError`` if the molecule\'s facts cannot be derived.\n\nAn atom no rule matches comes back labelled ``"DU"``, the table\'s own\ncatch-all row; that is antechamber\'s answer, not a fallback the engine\ninvents. Refusing ``DU`` is the *charge* model\'s job.\n\nParameters\n----------\nparameter_set : str\n The antechamber ``-at`` flag naming the table: ``"bcc"``, ``"abcg2"``,\n ``"gas"``, ``"gaff"``, ``"gaff2"``, ``"amber"`` or ``"sybyl"``. Required —\n there is no default table.\nbond_orders : BondOrderSource, default ``BondOrderSource.Connectivity``\n Which bond orders the types follow (``AtdTypifier::with_bond_orders``;\n the core\'s default is ``Connectivity``). ``Connectivity`` judges them\n from the connectivity alone, as antechamber does by default\n (``bondtype -j full``): the molecule\'s own orders are ignored, and on a\n molecule with two Kekulé structures (azulene, cyclooctatetraene) the\n colouring (``cc`` / ``cd`` …) is the one antechamber\'s search settles\n on for the same atom and bond order. Every hydrogen must be drawn.\n ``Stated`` keeps the molecule\'s own orders (aromatic bonds without one\n are kekulized).\n\nRaises\n------\nValueError\n If ``parameter_set`` names no table.\n\nExamples\n--------\n>>> typed = molrs.ff.typifier.AtdTypifier(parameter_set="gaff").typify(benzene)\n>>> typed.get(carbon, molrs.core.keys.TYPE)\n\'ca\'' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.typifier' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

bond_orders property

Which bond orders the types follow.

parameter_set property

The antechamber -at flag of the table this typifier walks.

__repr__() method descriptor

Return repr(self).

GaffTypifier

Bases: molrs.ff.typifier.Typifier

GAFF / GAFF2 bonded-term typifier — molrs.ff.typifier.GaffTypifier.

Matches a molecule whose atoms already carry GAFF atom types (keys.TYPE, as :class:AtdTypifier with the same parameter_set stamps them) against the AMBER gaff.dat / gaff2.dat table compiled into molrs. Angles and dihedrals are regenerated from the bond graph; impropers are built as tleap builds them, wherever tleap finds a row (or parmchk2 an estimate, at the centres PARMCHK.DAT flags as planar) for a triple of an atom's neighbours, in the atom order tleap gives them (centre third). Every term is looked up first against the table's exact rows, then against its wildcard rows, then estimated as parmchk2 estimates it; an estimated term's type carries the provenance params estimated, estimate_penalty, estimate_method and estimate_analog. They price nothing: every engine writer passes them over (the frcmod writer as the row's comment) and ForceField.merge ignores them.

The output (:meth:forcefield) holds the styles atom full, pair lj/cut, pair coul/cut (AMBER's Coulomb constant), bond harmonic, angle harmonic, dihedral periodic and improper periodic with AMBER's 1-4 weights (½ Lennard-Jones, 1/1.2 Coulomb), in the force-field IR's units. Charges are not a GAFF parameter: set atoms.charge with a charge model (:class:BccModel, :class:GasteigerModel) before pricing Coulomb.

Parameters:

Name Type Description Default
parameter_set str

"gaff" (GAFF 1.81, gaff.dat) or "gaff2" (gaff2.dat). Required; it must name the table the atoms were typed with.

required

Raises:

Type Description
ValueError

If parameter_set names no set; from :meth:typify, when an atom has no type, a type the table does not declare, or a term neither the table nor the estimator covers (every such term is listed).

Examples:

>>> labelled = molrs.ff.typifier.AtdTypifier(parameter_set="gaff2").typify(mol)
>>> gaff = molrs.ff.typifier.GaffTypifier(parameter_set="gaff2")
>>> frame = gaff.typify(labelled).to_frame()
>>> frame["pairs"] = molrs.ff.potential.intramolecular_pairs(frame)
>>> pots = molrs.ff.compile.PotentialCompiler(gaff.forcefield()).compile(frame)

__doc__ = 'GAFF / GAFF2 bonded-term typifier — ``molrs.ff.typifier.GaffTypifier``.\n\nMatches a molecule whose atoms already carry GAFF atom types (``keys.TYPE``,\nas :class:`AtdTypifier` with the same ``parameter_set`` stamps them) against\nthe AMBER ``gaff.dat`` / ``gaff2.dat`` table compiled into molrs. Angles and\ndihedrals are regenerated from the bond graph; impropers are built as\ntleap builds them, wherever tleap finds a row (or ``parmchk2`` an estimate,\nat the centres ``PARMCHK.DAT`` flags as planar) for a triple of an atom\'s\nneighbours, in the atom order tleap gives them (centre third). Every term\nis looked up first against the table\'s exact rows, then against its\nwildcard rows, then estimated as ``parmchk2`` estimates it; an estimated\nterm\'s type carries the provenance\nparams ``estimated``, ``estimate_penalty``, ``estimate_method`` and\n``estimate_analog``. They price nothing: every engine writer passes them\nover (the frcmod writer as the row\'s comment) and ``ForceField.merge``\nignores them.\n\nThe output (:meth:`forcefield`) holds the styles ``atom full``,\n``pair lj/cut``, ``pair coul/cut`` (AMBER\'s Coulomb constant),\n``bond harmonic``, ``angle harmonic``, ``dihedral periodic`` and\n``improper periodic`` with AMBER\'s 1-4 weights (1/2 Lennard-Jones,\n1/1.2 Coulomb), in the force-field IR\'s units. Charges are not a GAFF\nparameter: set ``atoms.charge`` with a charge model (:class:`BccModel`,\n:class:`GasteigerModel`) before pricing Coulomb.\n\nParameters\n----------\nparameter_set : str\n ``"gaff"`` (GAFF 1.81, ``gaff.dat``) or ``"gaff2"`` (``gaff2.dat``).\n Required; it must name the table the atoms were typed with.\n\nRaises\n------\nValueError\n If ``parameter_set`` names no set; from :meth:`typify`, when an atom has\n no type, a type the table does not declare, or a term neither the table\n nor the estimator covers (every such term is listed).\n\nExamples\n--------\n>>> labelled = molrs.ff.typifier.AtdTypifier(parameter_set="gaff2").typify(mol)\n>>> gaff = molrs.ff.typifier.GaffTypifier(parameter_set="gaff2")\n>>> frame = gaff.typify(labelled).to_frame()\n>>> frame["pairs"] = molrs.ff.potential.intramolecular_pairs(frame)\n>>> pots = molrs.ff.compile.PotentialCompiler(gaff.forcefield()).compile(frame)' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.typifier' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

parameter_set property

The name of the table this typifier matches against: "gaff" or "gaff2".

__repr__() method descriptor

Return repr(self).

Typifier

The base of every graph typifier: one assign hook plus the output force field its typing accumulates.

Exposed to Python as molrs.ff.typifier.Typifier and subclassable. A subclass implements :meth:assign (and optionally :meth:source_forcefield) and nothing else; :meth:typify is the one execution path and the only writer of :meth:forcefield. Defining typify on a subclass raises TypeError at class creation.

The native typifier classes (Mmff94Typifier, Mmff94sTypifier, OplsAaTypifier, AtdTypifier) extend this base and only construct: their assign runs the Rust matcher and their typify the Rust Typing::typify.

__doc__ = 'The base of every graph typifier: one ``assign`` hook plus the output force\nfield its typing accumulates.\n\nExposed to Python as ``molrs.ff.typifier.Typifier`` and subclassable. A\nsubclass implements :meth:`assign` (and optionally :meth:`source_forcefield`) and\nnothing else; :meth:`typify` is the one execution path and the only writer\nof :meth:`forcefield`. Defining ``typify`` on a subclass raises\n``TypeError`` at class creation.\n\nThe native typifier classes (``Mmff94Typifier``, ``Mmff94sTypifier``,\n``OplsAaTypifier``, ``AtdTypifier``) extend this base and only construct:\ntheir ``assign`` runs the Rust matcher and their ``typify`` the Rust\n``Typing::typify``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.typifier' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__init_subclass__(**kwargs) builtin

Reject a subclass that defines typify in its own body, and a subclass of a native typifier that defines assign or source_forcefield.

typify is the only writer of :meth:forcefield; an override would silently bypass the output. A native typifier (OplsAaTypifier, Mmff94Typifier, …) types in Rust and never calls a Python assign or source_forcefield, so overriding either on its subclass would be silently ignored. typing.final is only a static check.

assign(graph) method descriptor

Type graph and return what it assigns, as a :class:TypeAssignment.

The one hook a subclass implements. assign may write intermediate results (generated topology, perceived bond types) onto the graph it is given; :meth:typify always gives it a private copy. On a native typifier this runs the Rust matcher on graph.

Raises:

Type Description
NotImplementedError

On the base, when a subclass does not implement assign.

ValueError

If a native matcher cannot match the graph.

forcefield() method descriptor

The accumulated output — exactly the definitions :meth:typify has assigned — as an independent copy.

Edits to the returned force field do not reach the typifier; :meth:typify is the only writer. Before the first typify this is the seeded empty output (see :meth:source_forcefield).

source_forcefield() method descriptor

The force field this typifier matches against, as an independent copy.

The output starts as its empty likeness: the library's name and declared units and special_bonds, no styles or types. A Python subclass may override it; one that does not has no library (this raises NotImplementedError), and its output starts as an empty force field named after the class, with nothing declared.

typify(mol) method descriptor

Type mol: do not override; the only writer of :meth:forcefield.

Copies mol (as copy.copy(mol)), calls :meth:assign on the copy and writes the returned :class:TypeAssignment onto the copy and the output force field — stamping every annotation and defining every type. mol is never touched.

Returns:

Type Description
Atomistic

The typed copy.

Raises:

Type Description
NotImplementedError

If the typifier has no assign.

TypeError

If assign returns something other than a :class:TypeAssignment.

ValueError

If the match does not fit the graph or contradicts a definition the output already holds. The output is then unchanged.

TypeAssignment

What a typifier's assign assigns to one graph, exposed to Python as molrs.ff.typifier.TypeAssignment (the Rust TypeAssignment).

Parameters:

Name Type Description Default
nodes sequence of mapping

One mapping of key -> annotation per node, positional against graph.atoms. An empty mapping gives that node nothing.

required
links mapping

Relation kind to a sequence of mappings, positional against that kind's own rows (an improper never shifts a dihedral position). A key is a relation view class (Bond, Angle, Dihedral, Improper, Port), rows as graph.bonds / graph.angles / … / graph.ports, or a block name ("bonds", or a term block such as "urey_bradleys"), rows as graph.terms(block). A type annotation under a kind defines a type of the category whose block the kind is (urey_bradleys → urey_bradley). Any other key raises TypeError; a kind named twice raises ValueError.

None
styles sequence of (category, style, params)

Styles to declare, in order.

()
pairs sequence of (style, name, endpoints, params)

Pair rows to define.

()
Notes

An annotation is a str, bool, int or float (stamped, defines nothing), or a type: (style, name, endpoints, params), which stamps name and every param and defines the type name on endpoints (atom-type names; empty for an atom type) under the style. The name is never read for endpoints. Param values are numbers or strings.

__doc__ = 'What a typifier\'s ``assign`` assigns to one graph, exposed to Python as\n``molrs.ff.typifier.TypeAssignment`` (the Rust `TypeAssignment`).\n\nParameters\n----------\nnodes : sequence of mapping\n One mapping of ``key -> annotation`` per node, positional against\n ``graph.atoms``. An empty mapping gives that node nothing.\nlinks : mapping, optional\n Relation kind to a sequence of mappings, positional against that\n kind\'s own rows (an improper never shifts a dihedral position). A key\n is a relation view class (``Bond``, ``Angle``, ``Dihedral``,\n ``Improper``, ``Port``), rows as ``graph.bonds`` / ``graph.angles`` /\n … / ``graph.ports``, or a block name (``"bonds"``, or a term block such\n as ``"urey_bradleys"``), rows as ``graph.terms(block)``. A type\n annotation under a kind defines a type of the category whose block\n the kind is (``urey_bradleys`` → ``urey_bradley``). Any other key\n raises ``TypeError``; a kind named twice raises ``ValueError``.\nstyles : sequence of (category, style, params), optional\n Styles to declare, in order.\npairs : sequence of (style, name, endpoints, params), optional\n Pair rows to define.\n\nNotes\n-----\nAn annotation is a ``str``, ``bool``, ``int`` or ``float`` (stamped, defines\nnothing), or a type: ``(style, name, endpoints, params)``, which stamps\n``name`` and every param and defines the type ``name`` on ``endpoints``\n(atom-type names; empty for an atom type) under the style. The name is\nnever read for endpoints. Param values are numbers or strings.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.typifier' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

molrs.ff.charge

GasteigerModel

Gasteiger / PEOE partial charges — molrs.ff.charge.GasteigerModel.

The model with no QM input: it is handed a molecule and nothing else, and still lands on antechamber's -c gas column. The qm argument exists so that a caller holding an unknown model can call every model the same way; this one ignores it.

The loop runs to convergence (antechamber's CONVERG 1e-5, GASMAXITER 500) — a sweep count is not a knob, because the damping is geometric and where the loop stops is the answer.

Examples:

>>> molrs.ff.charge.GasteigerModel().assign(mol)

__doc__ = "Gasteiger / PEOE partial charges — `molrs.ff.charge.GasteigerModel`.\n\nThe model with **no QM input**: it is handed a molecule and nothing else, and\nstill lands on antechamber's ``-c gas`` column. The ``qm`` argument exists so that\na caller holding an unknown model can call every model the same way; this one\nignores it.\n\nThe loop runs to convergence (antechamber's ``CONVERG`` 1e-5, ``GASMAXITER`` 500)\n— a sweep count is not a knob, because the damping is geometric and where the loop\nstops *is* the answer.\n\nExamples\n--------\n>>> molrs.ff.charge.GasteigerModel().assign(mol)" class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.ff.charge' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

assign(mol, qm=None) method descriptor

The Gasteiger/PEOE charges of every atom, hydrogens included.

Parameters:

Name Type Description Default
mol Atomistic

The molecule; left untouched.

required
qm ndarray of float64

Ignored — this model needs no QM base charges. The argument exists only so that every charge model answers the same call.

None

Returns:

Type Description
ndarray of float64, shape (n_atoms,)

Raises:

Type Description
ValueError

If ATOMTYPE_GAS.DEF cannot type an atom, or GASPARM.DAT has no row for the type it assigned. An atom with no χ curve has no charge — it is not defaulted to zero.

needs_equivalencing() method descriptor

False — the PEOE charges are already symmetric by construction.

molrs.ff.params

clpol_polarizability() builtin

CL&Pol Drude parameters per atom type: the alpha.ff table molrs ships (paduagroup/clandpol alpha.ff 2024/06/05, molrs::ff::params::CLPOL_POLARIZABILITY). A caller's own alpha.ff is read by :func:molrs.io.read_clpol_alpha.

Returns:

Type Description
dict[str, dict[str, float]]

type -> {"m_D", "q_D_sign", "k_D", "alpha", "a_thole"} in u, e (sign), kJ/mol/Ų (k/2 r² form), ų and dimensionless. A type with k_D == 0 carries no Drude particle.

molrs.optimize

Lbfgs mirrors molrs::optimize::Lbfgs: minimize(frame) honours the frame's atoms.free mask, minimize_coords(coords) relaxes one (N, 3) array, minimize_batch(coords) a (B, N, 3) stack; each relaxes its input in place and returns the report(s).

Lbfgs

L-BFGS geometry optimizer, exposed as molrs.optimize.Lbfgs — the mirror of molrs::optimize::Lbfgs.

Construct with potentials + knobs (defaults are Rust's LbfgsSettings::DEFAULT). Every door relaxes its input in place and returns the report:

  • :meth:minimize — a :class:Frame, honouring its atoms.free mask (fixed atoms still enter the energy but do not move);
  • :meth:minimize_coords — one (N, 3) float64 array, every atom free;
  • :meth:minimize_batch — a (B, N, 3) stack, each structure independently.

Examples:

>>> pots = molrs.ff.compile.PotentialCompiler(ff).compile(frame)
>>> opt = molrs.optimize.Lbfgs(pots, fmax=0.05, max_steps=500)
>>> report = opt.minimize(frame)                  # frame relaxed in place
>>> report = opt.minimize_coords(coords)          # (N, 3), in place

__doc__ = "L-BFGS geometry optimizer, exposed as `molrs.optimize.Lbfgs` — the mirror\nof ``molrs::optimize::Lbfgs``.\n\nConstruct with potentials + knobs (defaults are Rust's\n``LbfgsSettings::DEFAULT``). Every door relaxes its input **in place** and\nreturns the report:\n\n* :meth:`minimize` — a :class:`Frame`, honouring its ``atoms.free`` mask\n (fixed atoms still enter the energy but do not move);\n* :meth:`minimize_coords` — one ``(N, 3)`` float64 array, every atom free;\n* :meth:`minimize_batch` — a ``(B, N, 3)`` stack, each structure\n independently.\n\nExamples\n--------\n>>> pots = molrs.ff.compile.PotentialCompiler(ff).compile(frame)\n>>> opt = molrs.optimize.Lbfgs(pots, fmax=0.05, max_steps=500)\n>>> report = opt.minimize(frame) # frame relaxed in place\n>>> report = opt.minimize_coords(coords) # (N, 3), in place" class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.optimize' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

minimize(frame) method descriptor

Relax frame's atoms coordinates in place (Optimizer::minimize).

A bool atoms.free column marks the movable atoms: a fixed atom stays where it is but still enters every energy and force evaluation. Without the column every atom moves. A deferred :class:Potentials is bound to the frame's topology first.

Raises:

Type Description
ValueError

The frame has no coordinates, atoms.free is not one bool per atom, or the potentials were moved.

minimize_batch(coords) method descriptor

Relax a homogeneous batch in place — B structures of N atoms, each independently (Lbfgs::minimize_batch) — and return one report per structure.

coords is a writeable C-contiguous float64 (B, N, 3) array.

Raises:

Type Description
ValueError

coords is not (B, N, 3), N differs from the potentials' atom count, or coords is not writeable and C-contiguous.

minimize_coords(coords) method descriptor

Relax one structure's coordinates in place, every atom free (Lbfgs::minimize_coords).

coords is a writeable C-contiguous float64 (N, 3) array.

Raises:

Type Description
ValueError

coords is not (N, 3), or is not writeable and C-contiguous (pass np.ascontiguousarray(coords, dtype=np.float64)).

OptimizationReport

Outcome of a minimization, exposed to Python as molrs.optimize.OptimizationReport.

__doc__ = 'Outcome of a minimization, exposed to Python as\n`molrs.optimize.OptimizationReport`.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.optimize' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

converged property

Whether fmax convergence was reached within max_steps.

final_energy property

Potential energy at the returned geometry (kcal/mol).

final_fmax property

Maximum per-atom force magnitude at the returned geometry (kcal/mol/angstrom).

final_grad_rms property

Root-mean-square gradient component at the returned geometry (kcal/mol/angstrom).

n_steps property

Number of outer L-BFGS iterations performed.

__repr__() method descriptor

Return repr(self).

molrs.conformer

Conformer

3D conformer generator for molecular graphs.

Exposed to Python as molrs.conformer.Conformer. Construct it with the desired generation parameters, then call :meth:generate to produce coordinates. The class is subclassable so downstream wrappers (e.g. molpy.conformer) can inherit it and refine the marshalling.

Parameters:

Name Type Description Default
speed str

Quality preset: "fast" (fewest iterations), "medium" (default), or "better" (most thorough search).

'medium'
add_hydrogens bool

If True (default), add implicit hydrogens before generation.

True
seed int | None

Random seed for reproducibility. None uses an arbitrary seed.

None

Examples:

>>> gen = Conformer(speed="fast", add_hydrogens=True, seed=42)
>>> mol_3d, report = gen.generate(mol)

__doc__ = '3D conformer generator for molecular graphs.\n\nExposed to Python as `molrs.conformer.Conformer`. Construct it with the desired\ngeneration parameters, then call :meth:`generate` to produce coordinates.\nThe class is subclassable so downstream wrappers (e.g. ``molpy.conformer``)\ncan inherit it and refine the marshalling.\n\nParameters\n----------\nspeed : str, optional\n Quality preset: ``"fast"`` (fewest iterations), ``"medium"`` (default),\n or ``"better"`` (most thorough search).\nadd_hydrogens : bool, optional\n If ``True`` (default), add implicit hydrogens before generation.\nseed : int | None, optional\n Random seed for reproducibility. ``None`` uses an arbitrary seed.\n\nExamples\n--------\n>>> gen = Conformer(speed="fast", add_hydrogens=True, seed=42)\n>>> mol_3d, report = gen.generate(mol)' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.conformer' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

generate(mol) method descriptor

Generate 3D coordinates for a molecular graph.

Runs the full distance-geometry + optimization pipeline. The input molecule is not modified; the result is an :class:~molrs.core.Atomistic that keeps the input's ports and its frag_id labels.

Parameters:

Name Type Description Default
mol Atomistic

Input molecular graph (heavy atoms and bonds); its ports are carried across unchanged.

required

Returns:

Type Description
tuple[Atomistic, ConformerReport]

The molecule with generated 3D coordinates — positions in ångström (Å) — and a per-stage report.

Raises:

Type Description
TypeError

If mol is not an Atomistic.

ValueError

If the molecular graph is invalid (e.g. an atom without a valid atomic_number).

Examples:

>>> mol = molrs.io.smiles.read_smiles("CCO").to_atomistic()
>>> mol_3d, report = Conformer(speed="fast", seed=42).generate(mol)
>>> mol_3d.n_atoms   # includes added hydrogens
9

Hydrogens this pipeline adds to a ported unit carry no frag_id; the caller relabels them, which is one call:

>>> unit = molrs.io.smiles.read_smiles_fragment("[$]CO").to_template()
>>> unit_3d, _ = Conformer(speed="fast", seed=42).generate(unit)
>>> _ = unit_3d.inherit_frag_ids()

ConformerStageReport

Report for a single stage of conformer generation.

Exposed to Python as molrs.conformer.ConformerStageReport.

Attributes:

Name Type Description
stage str

Stage name (e.g. "build_initial", "final_optimize").

energy_before float | None

Energy in kcal/mol before this stage, or None if not applicable.

energy_after float | None

Energy in kcal/mol after this stage, or None if not applicable.

steps int

Number of optimizer steps executed.

converged bool

Whether the stage converged.

elapsed_ms int

Wall-clock time for this stage in milliseconds.

__doc__ = 'Report for a single stage of conformer generation.\n\nExposed to Python as `molrs.conformer.ConformerStageReport`.\n\nAttributes\n----------\nstage : str\n Stage name (e.g. ``"build_initial"``, ``"final_optimize"``).\nenergy_before : float | None\n Energy in kcal/mol before this stage, or ``None`` if not applicable.\nenergy_after : float | None\n Energy in kcal/mol after this stage, or ``None`` if not applicable.\nsteps : int\n Number of optimizer steps executed.\nconverged : bool\n Whether the stage converged.\nelapsed_ms : int\n Wall-clock time for this stage in milliseconds.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.conformer' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

converged property

elapsed_ms property

energy_after property

energy_before property

stage property

steps property

__repr__() method descriptor

Return repr(self).

ConformerReport

Aggregate report for a conformer generation run.

Exposed to Python as molrs.conformer.ConformerReport.

Attributes:

Name Type Description
final_energy float | None

Total energy in kcal/mol after all stages, or None on failure.

warnings list[str]

Diagnostic warnings generated during the run.

stages list[ConformerStageReport]

Per-stage execution reports.

Examples:

>>> mol_3d, report = Conformer().generate(mol)
>>> report.final_energy
-12.34
>>> for s in report.stages:
...     print(s.stage, s.converged)

__doc__ = 'Aggregate report for a conformer generation run.\n\nExposed to Python as `molrs.conformer.ConformerReport`.\n\nAttributes\n----------\nfinal_energy : float | None\n Total energy in kcal/mol after all stages, or ``None`` on failure.\nwarnings : list[str]\n Diagnostic warnings generated during the run.\nstages : list[ConformerStageReport]\n Per-stage execution reports.\n\nExamples\n--------\n>>> mol_3d, report = Conformer().generate(mol)\n>>> report.final_energy\n-12.34\n>>> for s in report.stages:\n... print(s.stage, s.converged)' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.conformer' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

final_energy property

stages property

Per-stage execution reports.

Returns:

Type Description
list[ConformerStageReport]

warnings property

__repr__() method descriptor

Return repr(self).

molrs.builder

Coarsener

Coarse-graining of a held source graph — molrs.builder.Coarsener.

Site I of the result stands for groups[I]: it sits at the group's mass-weighted centre (Å; no periodic imaging, so unwrap first), carries the group's summed mass and bead_type = names[I], and records the group's handles as its members. Two sites are bonded once when a source bond joins their groups. The groups must be disjoint; SubgraphMatcher returns overlapping ones, so the caller selects first.

Parameters:

Name Type Description Default
source CoarseGrain or Atomistic

The graph whose nodes are grouped. The object is held, not copied, and read at each :meth:coarsen call.

required

Raises:

Type Description
TypeError

If source is neither a :class:~molrs.core.CoarseGrain nor an :class:~molrs.core.Atomistic.

Examples:

>>> groups = molrs.perceive.SubgraphMatcher(pattern).find(cg)
>>> sites = molrs.builder.Coarsener(cg).coarsen(groups, ["PMA"] * len(groups))

__doc__ = 'Coarse-graining of a held source graph — `molrs.builder.Coarsener`.\n\nSite ``I`` of the result stands for ``groups[I]``: it sits at the group\'s\nmass-weighted centre (Å; no periodic imaging, so unwrap first), carries the\ngroup\'s summed ``mass`` and ``bead_type = names[I]``, and records the\ngroup\'s handles as its members. Two sites are bonded once when a source\nbond joins their groups. The groups must be disjoint; ``SubgraphMatcher``\nreturns overlapping ones, so the caller selects first.\n\nParameters\n----------\nsource : CoarseGrain or Atomistic\n The graph whose nodes are grouped. The object is held, not copied, and\n read at each :meth:`coarsen` call.\n\nRaises\n------\nTypeError\n If ``source`` is neither a :class:`~molrs.core.CoarseGrain` nor an\n :class:`~molrs.core.Atomistic`.\n\nExamples\n--------\n>>> groups = molrs.perceive.SubgraphMatcher(pattern).find(cg)\n>>> sites = molrs.builder.Coarsener(cg).coarsen(groups, ["PMA"] * len(groups))' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.builder' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__repr__() method descriptor

Return repr(self).

coarsen(groups, names) method descriptor

A new :class:~molrs.core.CoarseGrain with one site per group.

The GIL is released while mapping.

Parameters:

Name Type Description Default
groups Sequence[Iterable[Atom | Bead]]

Disjoint, non-empty node groups of the source (views or Refs).

required
names Sequence[str]

One site bead_type per group.

required

Returns:

Type Description
CoarseGrain

The sites, in group order; empty when groups is empty. Each site's members (:meth:CoarseGrain.bead_members) are its group's nodes of the source.

Raises:

Type Description
ValueError

If groups and names differ in length, a group is empty, a node belongs to another graph or is listed twice, or a group has no centre (a missing coordinate or mass, a non-positive total mass); nodes are named by their handle.

molrs.compute

The Rust compute module is flat, and so is molrs.compute: every class is molrs.compute.<Name>, the core type of the same name. A compute's constructor takes configuration only — every optional setting is None unless given, and every default lives in the core — and compute(...) takes the data by keyword. A result is a read-only object that the next compute takes as is (Msd → TimeCorrelation → LinearFit, Steinhardt → SteinhardtResult → Pca, Cluster → ClusterResult → CenterOfMass).

Msd, Vacf and Rdf are streams only, as in the core: x.accumulator() hands out a CorrelatorAccumulator / RdfAccumulator; push one frame at a time and finish() reads the result (without consuming the accumulator).

Contract and descriptors

Every class is configured at construction and answers one call, compute, whose keyword arguments are the fields of the core input — or, for a stream, accumulator. ComputeSpec describes each one: its parameters (kind, default, required) and inputs (for a stream, the fields push takes).

Compute

Bases: typing.Protocol

Analysis kernel: configured at construction, one method compute taking the data as keyword arguments.

__abstractmethods__ = frozenset() class-attribute

Build an immutable unordered collection of unique elements.

__annotations__ = {} class-attribute

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dict__ = mappingproxy({'__module__': 'molrs.compute', '__firstlineno__': 21, '__doc__': 'Analysis kernel: configured at construction, one method ``compute``\ntaking the data as keyword arguments.', 'compute': <function Compute.compute at 0x7f7cac120040>, '__static_attributes__': (), '__dict__': <attribute '__dict__' of 'Compute' objects>, '__weakref__': <attribute '__weakref__' of 'Compute' objects>, '__parameters__': (), '_is_protocol': True, '__subclasshook__': <classmethod(<function _proto_hook at 0x7f7caf0962a0>)>, '__init__': <function _no_init_or_replace_init at 0x7f7caf095da0>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object at 0x7f7cac11cdc0>, '__annotations__': {}, '__protocol_attrs__': {'compute'}, '_is_runtime_protocol': True, '__non_callable_proto_members__': set()}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'Analysis kernel: configured at construction, one method ``compute``\ntaking the data as keyword arguments.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__firstlineno__ = 21 class-attribute

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__non_callable_proto_members__ = set() class-attribute

Build an unordered collection of unique elements.

__parameters__ = () class-attribute

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__protocol_attrs__ = {'compute'} class-attribute

Build an unordered collection of unique elements.

__static_attributes__ = () class-attribute

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__weakref__ property

list of weak references to the object

Stream

Bases: typing.Protocol

Streaming analysis: configured at construction, one method accumulator handing out a fresh accumulator.

__abstractmethods__ = frozenset() class-attribute

Build an immutable unordered collection of unique elements.

__annotations__ = {} class-attribute

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dict__ = mappingproxy({'__module__': 'molrs.compute', '__firstlineno__': 30, '__doc__': 'Streaming analysis: configured at construction, one method\n``accumulator`` handing out a fresh accumulator.', 'accumulator': <function Stream.accumulator at 0x7f7cac1200e0>, '__static_attributes__': (), '__dict__': <attribute '__dict__' of 'Stream' objects>, '__weakref__': <attribute '__weakref__' of 'Stream' objects>, '__parameters__': (), '_is_protocol': True, '__subclasshook__': <classmethod(<function _proto_hook at 0x7f7caf0962a0>)>, '__init__': <function _no_init_or_replace_init at 0x7f7caf095da0>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object at 0x7f7cac11cf40>, '__annotations__': {}, '__protocol_attrs__': {'accumulator'}, '_is_runtime_protocol': True, '__non_callable_proto_members__': set()}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'Streaming analysis: configured at construction, one method\n``accumulator`` handing out a fresh accumulator.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__firstlineno__ = 30 class-attribute

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating-point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__non_callable_proto_members__ = set() class-attribute

Build an unordered collection of unique elements.

__parameters__ = () class-attribute

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__protocol_attrs__ = {'accumulator'} class-attribute

Build an unordered collection of unique elements.

__static_attributes__ = () class-attribute

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__weakref__ property

list of weak references to the object

ComputeSpec

The descriptor of one compute type (molrs::compute::ComputeSpec).

__doc__ = 'The descriptor of one compute type (``molrs::compute::ComputeSpec``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

form property

"single" (one input per call) or "frames" (one list per field, an entry per frame).

inputs property

The fields of the input — the keyword arguments of compute.

name property

The class name.

params property

The configuration parameters, in constructor-then-setter order.

__repr__() method descriptor

Return repr(self).

all() staticmethod

The descriptor of every compute type in this build.

find(name) staticmethod

The descriptor named name, or None.

input(name) method descriptor

The input field named name, or None.

param(name) method descriptor

The parameter named name, or None.

ParamSpec

One configuration parameter of a compute (molrs::compute::ParamSpec).

__doc__ = 'One configuration parameter of a compute (``molrs::compute::ParamSpec``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

choices property

The canonical names of a choice / choice_list, else None.

default property

The default value (None for an option that is off, and for a parameter that is required or derived from another).

kind property

What values it takes: "float", "int", "bool", "choice", "choice_list", "float_list", "int_list", "vec3_list", "axis", "axis_list", "grid", "range" or "units".

name property

The __init__ argument name.

required property

Whether the caller must give it.

required_in property

For a parameter required by one of several constructor forms, the name of that form; else None.

same_as property

The parameter whose value this one defaults to, else None.

scaled property

(of, factor) when the default is factor times parameter of, else None.

__repr__() method descriptor

Return repr(self).

InputSpec

One field of a compute's input (molrs::compute::InputSpec).

__doc__ = "One field of a compute's input (``molrs::compute::InputSpec``)." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

choices property

The canonical names of a choice input, else None.

kind property

What data it holds, e.g. "positions", "pair_source", "partition", "upstream".

name property

The compute keyword.

optional property

Whether compute may be called without it.

upstream property

The upstream result type of an upstream / upstream_list input, else None.

__repr__() method descriptor

Return repr(self).

Values

Axis

A uniform binning axis: n_bins half-open bins over [min, max) (molrs::compute::Axis).

Parameters:

Name Type Description Default
min float

The axis range.

required
max float

The axis range.

required
n_bins int

The number of bins.

required

__doc__ = 'A uniform binning axis: ``n_bins`` half-open bins over ``[min, max)``\n(``molrs::compute::Axis``).\n\nParameters\n----------\nmin, max : float\n The axis range.\nn_bins : int\n The number of bins.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

centers property

The n_bins bin centres.

edges property

The n_bins + 1 bin edges.

max property

min property

n_bins property

width property

__repr__() method descriptor

Return repr(self).

RegularGrid

A regular 3-D voxel grid (molrs::compute::RegularGrid): origin, the three cell basis vectors (rows), dims voxels per axis and the periodicity pbc of each axis.

__doc__ = 'A regular 3-D voxel grid (``molrs::compute::RegularGrid``): ``origin``,\nthe three cell ``basis`` vectors (rows), ``dims`` voxels per axis and the\nperiodicity ``pbc`` of each axis.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

basis property

dims property

origin property

pbc property

voxel_volume property

__repr__() method descriptor

Return repr(self).

centered(extent, dims) staticmethod

A non-periodic orthogonal grid of total extent centred on the origin.

over_box(box, dims) staticmethod

The grid spanning box with dims voxels per cell vector, periodic where the box is.

Histogram

An N-D histogram (molrs::compute::Histogram): raw counts on axes, the number of samples that fell in a bin (binned) and the volume of one bin.

__doc__ = 'An N-D histogram (``molrs::compute::Histogram``): raw ``counts`` on\n``axes``, the number of samples that fell in a bin (``binned``) and the\nvolume of one bin.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

axes property

bin_volume property

binned property

counts property

__repr__() method descriptor

Return repr(self).

Time series

Correlator is the one estimator; Msd, Vacf, OnsagerCorrelation, DipoleAcf, CurrentAcf, ReorientationAcf, RotationalAutocorrelation and Survival are its fixed configurations (Msd and Vacf streamed through a CorrelatorAccumulator; Vacf takes each frame's velocities as an (n_dof, 1) column). Each returns a TimeCorrelation, which the fits and spectra take as is (and which pickles). The origin set is tunable (origins, and stride for every stride-th origin), as is the normalisation ("unbiased", "biased", "none"). ReorientationAcf is the orientational autocorrelation (OACF) of unit vectors; orders 1 and 2 run by FFT. A curve's derived quantities are the fits applied to it: CumulativeTrapezoid (integral, correlation time), LinearFit (Einstein slope), Plateau (Green–Kubo plateau), DebyeFit (exponential decay), and Spectrum (power spectrum).

Correlator

The one time-correlation estimator (molrs::compute::Correlator).

Parameters:

Name Type Description Default
kernel str

"product", "squared_displacement", "legendre", "wigner_d" or "persistence" (the core LagKernelKind).

required
max_lag int

The last lag, in frames.

required
l int

The order legendre / wigner_d require and the others refuse.

None
origins str

The core choices (Origins, MeanPolicy, Normalization — "unbiased", "biased" or "none" —, Reduction); None keeps the core default.

None
mean str

The core choices (Origins, MeanPolicy, Normalization — "unbiased", "biased" or "none" —, Reduction); None keeps the core default.

None
normalization str

The core choices (Origins, MeanPolicy, Normalization — "unbiased", "biased" or "none" —, Reduction); None keeps the core default.

None
reduction str

The core choices (Origins, MeanPolicy, Normalization — "unbiased", "biased" or "none" —, Reduction); None keeps the core default.

None
stride int

Take every stride-th frame as a time origin (origins="all").

None
dimension int

Use only the first dimension components.

None
stack
required

__doc__ = 'The one time-correlation estimator (``molrs::compute::Correlator``).\n\nParameters\n----------\nkernel : str\n ``"product"``, ``"squared_displacement"``, ``"legendre"``,\n ``"wigner_d"`` or ``"persistence"`` (the core ``LagKernelKind``).\nmax_lag : int\n The last lag, in frames.\nl : int, optional\n The order ``legendre`` / ``wigner_d`` require and the others refuse.\norigins, mean, normalization, reduction : str, optional\n The core choices (``Origins``, ``MeanPolicy``, ``Normalization`` —\n ``"unbiased"``, ``"biased"`` or ``"none"`` —, ``Reduction``); ``None``\n keeps the core default.\nstride : int, optional\n Take every ``stride``-th frame as a time origin (``origins="all"``).\ndimension : int, optional\n Use only the first ``dimension`` components.\n\n``compute(a=, b=None, dt=, boxes=None)`` correlates the ``(T, N, D)``\nstack ``a`` (with ``b`` for a cross-correlation) at frame spacing ``dt``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

TimeCorrelation

A correlation curve (molrs::compute::TimeCorrelation): values[lag, channel] at lag_times[lag].

The output of Correlator and its surfaces, and the input of the fits, Spectrum-based routes and checks. Build one from your own curve with TimeCorrelation(lag_times, values).

__doc__ = 'A correlation curve (``molrs::compute::TimeCorrelation``):\n``values[lag, channel]`` at ``lag_times[lag]``.\n\nThe output of ``Correlator`` and its surfaces, and the input of the\nfits, ``Spectrum``-based routes and checks. Build one from your own\ncurve with ``TimeCorrelation(lag_times, values)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

lag_times property

n_channels property

n_lags property

values property

__reduce__() method descriptor

Pickle as TimeCorrelation(lag_times, values).

__repr__() method descriptor

Return repr(self).

channel(channel) method descriptor

The curve of one channel.

Msd

Mean-squared displacement (molrs::compute::Msd), the squared_displacement correlator — a stream only.

Parameters:

Name Type Description Default
max_lag int
required
origins str
None
reduction str
None
stride int

Every stride-th frame is an origin (origins="all" only).

None
frame
required
simbox
required

__doc__ = 'Mean-squared displacement (``molrs::compute::Msd``), the\n``squared_displacement`` correlator — a stream only.\n\nParameters\n----------\nmax_lag : int\norigins, reduction : str, optional\nstride : int, optional\n Every ``stride``-th frame is an origin (``origins="all"`` only).\n\n:meth:`accumulator` hands out a :class:`CorrelatorAccumulator`; push each\nframe\'s unwrapped ``(N, 3)`` positions (``push(positions, dt=…,\nsimbox=…)``; with a box a wrapped trajectory is refused) and\n:meth:`CorrelatorAccumulator.finish` reads the curve.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

accumulator() method descriptor

A fresh accumulator configured like this Msd (Stream::accumulator).

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

CorrelatorAccumulator

The streaming correlator (molrs::compute::CorrelatorAccumulator), made by :meth:Msd.accumulator / :meth:Vacf.accumulator.

:meth:push folds one frame; :meth:finish reads the curve over every frame pushed so far without consuming the accumulator. Memory is O(max_lag · N · D) whatever the trajectory length.

__doc__ = 'The streaming correlator (``molrs::compute::CorrelatorAccumulator``),\nmade by :meth:`Msd.accumulator` / :meth:`Vacf.accumulator`.\n\n:meth:`push` folds one frame; :meth:`finish` reads the curve over every\nframe pushed so far without consuming the accumulator. Memory is\n``O(max_lag · N · D)`` whatever the trajectory length.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

n_frames property

Number of frames pushed so far.

finish() method descriptor

The correlation over every frame pushed so far.

push(a, *, b=None, dt, simbox=None) method descriptor

Fold one frame (CorrelatorFrame): a this frame of the series, (N, D); b the second series of a cross-correlation (on every frame or on none); dt the sample interval, identical on every frame; simbox this frame's box, for the displacement kernel's wrapped-trajectory check (None skips it). A rejected frame leaves the state unchanged.

Raises:

Type Description
ValueError

The frame's shape, b presence or dt differs from frame 0's, or the trajectory is wrapped under simbox.

Vacf

Velocity autocorrelation (molrs::compute::Vacf).

Parameters:

Name Type Description Default
max_lag int
required
normalization str

"unbiased", "biased" or "none".

None
stride int

Every stride-th frame is an origin.

None
mean str

"subtract" (default) correlates each component's fluctuation about its time mean; "keep" correlates the velocities as given.

None
A
required

__doc__ = 'Velocity autocorrelation (``molrs::compute::Vacf``).\n\nParameters\n----------\nmax_lag : int\nnormalization : str, optional\n ``"unbiased"``, ``"biased"`` or ``"none"``.\nstride : int, optional\n Every ``stride``-th frame is an origin.\nmean : str, optional\n ``"subtract"`` (default) correlates each component\'s fluctuation about\n its time mean; ``"keep"`` correlates the velocities as given.\n\nA stream only: :meth:`accumulator` hands out a\n:class:`CorrelatorAccumulator`; push each frame\'s velocities as an\n``(n_dof, 1)`` column (one degree of freedom per row: ``v.reshape(-1,\n1)``) and :meth:`CorrelatorAccumulator.finish` reads the curve.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

accumulator() method descriptor

A fresh accumulator configured like this Vacf (Stream::accumulator).

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

OnsagerCorrelation

Onsager cross-correlation of two (T, C) series (molrs::compute::OnsagerCorrelation).

stride (optional): every stride-th frame is an origin.

compute(a=, b=, dt=, boxes=None).

__doc__ = 'Onsager cross-correlation of two ``(T, C)`` series\n(``molrs::compute::OnsagerCorrelation``).\n\n``stride`` (optional): every ``stride``-th frame is an origin.\n\n``compute(a=, b=, dt=, boxes=None)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

DipoleAcf

Dipole autocorrelation of a (T, 3) dipole series (molrs::compute::DipoleAcf).

Parameters:

Name Type Description Default
max_lag int
required
normalization str

"unbiased", "biased" or "none" (the raw lagged sum).

None
stride int

Every stride-th frame is an origin.

None
mean str

"subtract" (default, the fluctuation δM) or "keep".

None

__doc__ = 'Dipole autocorrelation of a ``(T, 3)`` dipole series\n(``molrs::compute::DipoleAcf``).\n\nParameters\n----------\nmax_lag : int\nnormalization : str, optional\n ``"unbiased"``, ``"biased"`` or ``"none"`` (the raw lagged sum).\nstride : int, optional\n Every ``stride``-th frame is an origin.\nmean : str, optional\n ``"subtract"`` (default, the fluctuation ``δM``) or ``"keep"``.\n\n``compute(dipoles=, dt=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

CurrentAcf

Current autocorrelation of a (T, 3) current series (molrs::compute::CurrentAcf).

Parameters:

Name Type Description Default
max_lag int
required
normalization str

"unbiased", "biased" or "none" (the raw lagged sum, the former IR flux correlation).

None
stride int

Every stride-th frame is an origin.

None
mean str

"keep" (default) or "subtract" (the fluctuation δJ).

None

__doc__ = 'Current autocorrelation of a ``(T, 3)`` current series\n(``molrs::compute::CurrentAcf``).\n\nParameters\n----------\nmax_lag : int\nnormalization : str, optional\n ``"unbiased"``, ``"biased"`` or ``"none"`` (the raw lagged sum, the\n former IR flux correlation).\nstride : int, optional\n Every ``stride``-th frame is an origin.\nmean : str, optional\n ``"keep"`` (default) or ``"subtract"`` (the fluctuation ``δJ``).\n\n``compute(current=, dt=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

ReorientationAcf

Legendre reorientation correlation ⟨P_l(u(0)·u(t))⟩ of (T, N, D) vectors, each normalised (molrs::compute::ReorientationAcf) — the orientational autocorrelation (OACF); l <= 2 runs by FFT.

Parameters:

Name Type Description Default
l int
required
max_lag int
required
reduction str

"mean" over vectors or "per_item" (one curve per vector).

None
stride int

Every stride-th frame is an origin.

None

__doc__ = 'Legendre reorientation correlation ``⟨P_l(u(0)·u(t))⟩`` of ``(T, N, D)``\nvectors, each normalised (``molrs::compute::ReorientationAcf``) — the\norientational autocorrelation (OACF); ``l <= 2`` runs by FFT.\n\nParameters\n----------\nl : int\nmax_lag : int\nreduction : str, optional\n ``"mean"`` over vectors or ``"per_item"`` (one curve per vector).\nstride : int, optional\n Every ``stride``-th frame is an origin.\n\n``compute(vectors=, dt=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

RotationalAutocorrelation

Rotational autocorrelation of (T, N, 4) unit quaternions (molrs::compute::RotationalAutocorrelation).

compute(orientations=, dt=).

__doc__ = 'Rotational autocorrelation of ``(T, N, 4)`` unit quaternions\n(``molrs::compute::RotationalAutocorrelation``).\n\n``compute(orientations=, dt=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

Survival

Survival correlation of a (T, C) presence series (molrs::compute::Survival), e.g. PairPresence's values.

Parameters:

Name Type Description Default
kind str

"continuous" or "intermittent".

required
max_lag int
required
normalization str

"per_pair" or "per_reference" (C(0) the coordination number; compute then takes n_reference).

None
origin str

"present" or "inner" (runs start only where inner is 1, e.g. a PairPresence with r1 = r0).

None

__doc__ = 'Survival correlation of a ``(T, C)`` presence series\n(``molrs::compute::Survival``), e.g. ``PairPresence``\'s ``values``.\n\nParameters\n----------\nkind : str\n ``"continuous"`` or ``"intermittent"``.\nmax_lag : int\nnormalization : str, optional\n ``"per_pair"`` or ``"per_reference"`` (``C(0)`` the coordination\n number; ``compute`` then takes ``n_reference``).\norigin : str, optional\n ``"present"`` or ``"inner"`` (runs start only where ``inner`` is 1,\n e.g. a ``PairPresence`` with ``r1 = r0``).\n\n``compute(presence=, dt=, inner=None, n_reference=None)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

Derivative

Finite-difference time derivative of a (T, C) series (molrs::compute::Derivative).

Parameters:

Name Type Description Default
stencil str

"central", "gradient" or "backward".

required

__doc__ = 'Finite-difference time derivative of a ``(T, C)`` series\n(``molrs::compute::Derivative``).\n\nParameters\n----------\nstencil : str\n ``"central"``, ``"gradient"`` or ``"backward"``.\n\n``compute(series=, dt=)`` returns the ``(T, C)`` derivative.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

Unwrap

Unwrap a wrapped (T, N, 3) trajectory (molrs::compute::Unwrap), from int32 image flags when given, else by minimum image between frames.

compute(positions=, images=None, boxes=) returns the unwrapped (T, N, 3) positions.

__doc__ = 'Unwrap a wrapped ``(T, N, 3)`` trajectory (``molrs::compute::Unwrap``),\nfrom int32 image flags when given, else by minimum image between frames.\n\n``compute(positions=, images=None, boxes=)`` returns the unwrapped\n``(T, N, 3)`` positions.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

Spectrum

The one-sided Fourier transform of a real signal (molrs::compute::Spectrum).

Parameters:

Name Type Description Default
window str

"hann", "blackman", "cosine_sq" or "none".

required
pad int

Zero-pad to pad times the signal length (rounded up to a power of two).

required

__doc__ = 'The one-sided Fourier transform of a real signal\n(``molrs::compute::Spectrum``).\n\nParameters\n----------\nwindow : str\n ``"hann"``, ``"blackman"``, ``"cosine_sq"`` or ``"none"``.\npad : int\n Zero-pad to ``pad`` times the signal length (rounded up to a power of\n two).\n\n``compute(signal=, dt=)`` returns a ``OneSidedSpectrum``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

OneSidedSpectrum

A one-sided spectrum (molrs::compute::OneSidedSpectrum): real and imag parts at frequencies, from an n_fft-point transform.

__doc__ = 'A one-sided spectrum (``molrs::compute::OneSidedSpectrum``):\n``real`` and ``imag`` parts at ``frequencies``, from an ``n_fft``-point\ntransform.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

frequencies property

imag property

n_fft property

real property

__repr__() method descriptor

Return repr(self).

Fits

LinearFit

Least-squares line through one channel of a correlation over a window of its lags (molrs::compute::LinearFit) — e.g. the diffusive regime of an MSD.

Parameters:

Name Type Description Default
start float

The window, as fractions of the curve length.

required
end float

The window, as fractions of the curve length.

required

__doc__ = 'Least-squares line through one channel of a correlation over a window of\nits lags (``molrs::compute::LinearFit``) — e.g. the diffusive regime of an\nMSD.\n\nParameters\n----------\nstart, end : float\n The window, as fractions of the curve length.\n\n``compute(correlation=, channel=)`` returns a ``LinearFitResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

LinearFitResult

A least-squares line slope · t + intercept (molrs::compute::LinearFitResult) with its r2, fitted over the lags [fit_start, fit_end).

__doc__ = 'A least-squares line ``slope · t + intercept``\n(``molrs::compute::LinearFitResult``) with its ``r2``, fitted over the\nlags ``[fit_start, fit_end)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

fit_end property

fit_start property

intercept property

r2 property

slope property

__repr__() method descriptor

Return repr(self).

Plateau

The mean of one channel of a correlation over a window of its lags (molrs::compute::Plateau) — e.g. the plateau of a Green–Kubo integral.

Parameters:

Name Type Description Default
start float

The window, as fractions of the curve length.

required
end float

The window, as fractions of the curve length.

required

__doc__ = 'The mean of one channel of a correlation over a window of its lags\n(``molrs::compute::Plateau``) — e.g. the plateau of a Green–Kubo integral.\n\nParameters\n----------\nstart, end : float\n The window, as fractions of the curve length.\n\n``compute(correlation=, channel=)`` returns a ``PlateauResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

PlateauResult

The mean value (and its std) of a curve over a window of n_samples lags (molrs::compute::PlateauResult).

__doc__ = 'The mean ``value`` (and its ``std``) of a curve over a window of\n``n_samples`` lags (``molrs::compute::PlateauResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

n_samples property

std property

value property

__repr__() method descriptor

Return repr(self).

DebyeFit

Single-exponential (Debye) relaxation fit of one channel of a correlation (molrs::compute::DebyeFit).

compute(correlation=, channel=) returns a DebyeFitResult.

__doc__ = 'Single-exponential (Debye) relaxation fit of one channel of a correlation\n(``molrs::compute::DebyeFit``).\n\n``compute(correlation=, channel=)`` returns a ``DebyeFitResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

DebyeFitResult

A single-exponential fit C(t) = amplitude · exp(−t / tau) (molrs::compute::DebyeFitResult) over n_samples lags.

__doc__ = 'A single-exponential fit ``C(t) = amplitude · exp(−t / tau)``\n(``molrs::compute::DebyeFitResult``) over ``n_samples`` lags.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

amplitude property

n_samples property

tau property

__repr__() method descriptor

Return repr(self).

CumulativeTrapezoid

The running trapezoid integral of one channel of a correlation (molrs::compute::CumulativeTrapezoid) — a Green–Kubo integral.

Parameters:

Name Type Description Default
n_lags int

Integrate only the first n_lags lags; None keeps the core default (every lag).

None

__doc__ = 'The running trapezoid integral of one channel of a correlation\n(``molrs::compute::CumulativeTrapezoid``) — a Green–Kubo integral.\n\nParameters\n----------\nn_lags : int, optional\n Integrate only the first ``n_lags`` lags; ``None`` keeps the core\n default (every lag).\n\n``compute(correlation=, channel=)`` returns the integral as a\n``TimeCorrelation``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

Dielectric and spectroscopy

KineticEnergy

Kinetic energy ½ Σ m v² · mvv2e (molrs::compute::KineticEnergy).

Parameters:

Name Type Description Default
units str or UnitPreset

The unit system of masses and velocities ("real", "metal", …): the core KineticEnergy::new, which takes the preset's mass · velocity² → energy factor and Boltzmann constant.

required
mvv2e float

Replace the preset's mass · velocity² → energy factor (positive): the core with_mvv2e.

None
boltzmann float

Replace the preset's Boltzmann constant, in the energy unit (positive): the core with_boltzmann.

None
velocities
required

__doc__ = 'Kinetic energy ``½ Σ m v² · mvv2e`` (``molrs::compute::KineticEnergy``).\n\nParameters\n----------\nunits : str or UnitPreset\n The unit system of masses and velocities (``"real"``, ``"metal"``, …):\n the core ``KineticEnergy::new``, which takes the preset\'s\n ``mass · velocity²`` → energy factor and Boltzmann constant.\nmvv2e : float, optional\n Replace the preset\'s ``mass · velocity²`` → energy factor (positive):\n the core ``with_mvv2e``.\nboltzmann : float, optional\n Replace the preset\'s Boltzmann constant, in the energy unit\n (positive): the core ``with_boltzmann``.\n\n``compute(masses=, velocities=)`` over ``(N,)`` masses and ``(N, 3)``\nvelocities returns a ``KineticEnergyResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

KineticEnergyResult

A kinetic energy (molrs::compute::KineticEnergyResult) with the Boltzmann constant of its unit preset.

__doc__ = 'A kinetic energy (``molrs::compute::KineticEnergyResult``) with the\nBoltzmann constant of its unit preset.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

boltzmann property

energy property

__repr__() method descriptor

Return repr(self).

temperature(n_dof) method descriptor

The equipartition temperature 2 K / (n_dof · k_B).

DipoleMoment

The dipole moment Σ q r of each group in each frame (molrs::compute::DipoleMoment).

compute(positions=, charges=, partition=None) over (T, N, 3) positions and (N,) charges; partition (labels or a partition result) splits the items into groups, else the whole system is one.

__doc__ = 'The dipole moment ``Σ q r`` of each group in each frame\n(``molrs::compute::DipoleMoment``).\n\n``compute(positions=, charges=, partition=None)`` over ``(T, N, 3)``\npositions and ``(N,)`` charges; ``partition`` (labels or a partition\nresult) splits the items into groups, else the whole system is one.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

DipoleMomentResult

Dipole series per group (molrs::compute::DipoleMomentResult): moments[frame, group, :] for the group keys groups.

__doc__ = 'Dipole series per group (``molrs::compute::DipoleMomentResult``):\n``moments[frame, group, :]`` for the group keys ``groups``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

groups property

moments property

__repr__() method descriptor

Return repr(self).

series(column) method descriptor

The (T, 3) dipole series at column (0 for the whole system).

StaticDielectric

Static permittivity from the fluctuation of the total dipole (molrs::compute::StaticDielectric).

Parameters:

Name Type Description Default
units str or UnitPreset

The unit system of dipoles, volume and temperature.

required
epsilon_inf float

The high-frequency permittivity ε_∞; None keeps the core default.

None
dipole
required

__doc__ = 'Static permittivity from the fluctuation of the total dipole\n(``molrs::compute::StaticDielectric``).\n\nParameters\n----------\nunits : str or UnitPreset\n The unit system of dipoles, volume and temperature.\nepsilon_inf : float, optional\n The high-frequency permittivity ε_∞; ``None`` keeps the core default.\n\n``compute(dipoles=, volume=, temperature=, boundary=)`` over a ``(T, 3)``\ndipole series; ``boundary`` is ``"tin_foil"`` or ``"vacuum"``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

StaticDielectricResult

The static permittivity (molrs::compute::StaticDielectricResult): epsilon, per-axis epsilon_axes, the dipole moments behind it and the number of frames.

__doc__ = 'The static permittivity (``molrs::compute::StaticDielectricResult``):\n``epsilon``, per-axis ``epsilon_axes``, the dipole moments behind it and\nthe number of frames.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

dipole_mean property

dipole_sq_mean property

epsilon property

epsilon_axes property

epsilon_inf property

fluctuation property

n_frames property

__repr__() method descriptor

Return repr(self).

EinsteinHelfandSpectrum

ε(ω) by the Einstein–Helfand route from the fluctuation dipole ACF (molrs::compute::EinsteinHelfandSpectrum), e.g. DipoleAcf's curve.

Parameters:

Name Type Description Default
units str or UnitPreset
required
window str

"hann", "blackman", "cosine_sq" or "none".

None
pad int

Zero-padding factor of the transform.

None
epsilon_inf float

ε_∞.

None
temperature
required

__doc__ = 'ε(ω) by the Einstein–Helfand route from the fluctuation dipole ACF\n(``molrs::compute::EinsteinHelfandSpectrum``), e.g. ``DipoleAcf``\'s\ncurve.\n\nParameters\n----------\nunits : str or UnitPreset\nwindow : str, optional\n ``"hann"``, ``"blackman"``, ``"cosine_sq"`` or ``"none"``.\npad : int, optional\n Zero-padding factor of the transform.\nepsilon_inf : float, optional\n ε_∞.\n\n``None`` keeps the core default. ``compute(correlation=, volume=,\ntemperature=, boundary=)`` returns a ``DielectricSpectrumResult``;\n``boundary`` is ``"tin_foil"`` or ``"vacuum"``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

GreenKuboSpectrum

ε(ω) by the Green–Kubo route from the current ACF (molrs::compute::GreenKuboSpectrum), e.g. CurrentAcf's curve.

Parameters and compute as EinsteinHelfandSpectrum.

__doc__ = "ε(ω) by the Green–Kubo route from the current ACF\n(``molrs::compute::GreenKuboSpectrum``), e.g. ``CurrentAcf``'s curve.\n\nParameters and ``compute`` as ``EinsteinHelfandSpectrum``." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

DipoleRateCrossSpectrum

ε(ω) by the dipole–current cross-correlation route (molrs::compute::DipoleRateCrossSpectrum).

Parameters and compute as EinsteinHelfandSpectrum.

__doc__ = 'ε(ω) by the dipole–current cross-correlation route\n(``molrs::compute::DipoleRateCrossSpectrum``).\n\nParameters and ``compute`` as ``EinsteinHelfandSpectrum``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

DipoleAutocorrelationSpectrum

ε(ω) by the dipole-autocorrelation route (molrs::compute::DipoleAutocorrelationSpectrum).

Parameters as EinsteinHelfandSpectrum, plus plateau: an optional (start, end) fraction window whose value is subtracted from the correlation (a conductor's plateau), and plateau_value: "mean" (the window's mean) or "end" (its last sample). compute as EinsteinHelfandSpectrum.

__doc__ = 'ε(ω) by the dipole-autocorrelation route\n(``molrs::compute::DipoleAutocorrelationSpectrum``).\n\nParameters as ``EinsteinHelfandSpectrum``, plus ``plateau``: an optional\n``(start, end)`` fraction window whose value is subtracted from the\ncorrelation (a conductor\'s plateau), and ``plateau_value``: ``"mean"``\n(the window\'s mean) or ``"end"`` (its last sample). ``compute`` as\n``EinsteinHelfandSpectrum``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

DielectricSpectrumResult

A complex permittivity ε(ω) = eps_real − i eps_imag at frequencies (molrs::compute::DielectricSpectrumResult).

__doc__ = 'A complex permittivity ε(ω) = ``eps_real`` − i ``eps_imag`` at\n``frequencies`` (``molrs::compute::DielectricSpectrumResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

eps_imag property

eps_real property

epsilon_inf property

frequencies property

__repr__() method descriptor

Return repr(self).

KramersKronig

Kramers–Kronig consistency check of a ε(ω) spectrum (molrs::compute::KramersKronig).

Parameters:

Name Type Description Default
relative_tolerance float

The pass tolerance; one not given keeps the core's value.

None
absolute_tolerance float

The pass tolerance; one not given keeps the core's value.

None

__doc__ = "Kramers–Kronig consistency check of a ε(ω) spectrum\n(``molrs::compute::KramersKronig``).\n\nParameters\n----------\nrelative_tolerance, absolute_tolerance : float, optional\n The pass tolerance; one not given keeps the core's value.\n\n``compute(spectrum=)`` over a ``DielectricSpectrumResult`` returns a\n``KramersKronigCheck``." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

KramersKronigCheck

The Kramers–Kronig consistency of a spectrum (molrs::compute::KramersKronigCheck): ε′ recovered from ε″, its mean absolute error against ε′, the tolerance and the verdict.

__doc__ = 'The Kramers–Kronig consistency of a spectrum\n(``molrs::compute::KramersKronigCheck``): ε′ ``recovered`` from ε″, its\nmean absolute error against ε′, the tolerance and the verdict.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

mae property

passed property

recovered property

tolerance property

__repr__() method descriptor

Return repr(self).

ConductivitySumRule

The conductivity sum rule ∫ σ(ω) dω against its static value (molrs::compute::ConductivitySumRule).

Parameters:

Name Type Description Default
units str or UnitPreset
required
tolerance float

The pass tolerance on the relative error; None keeps the core default.

None
temperature
required

__doc__ = 'The conductivity sum rule ``∫ σ(ω) dω`` against its static value\n(``molrs::compute::ConductivitySumRule``).\n\nParameters\n----------\nunits : str or UnitPreset\ntolerance : float, optional\n The pass tolerance on the relative error; ``None`` keeps the core\n default.\n\n``compute(frequencies=, conductivity=, current_sq_mean=, volume=,\ntemperature=)`` returns a ``SumRuleCheck``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

SumRuleCheck

The conductivity sum rule (molrs::compute::SumRuleCheck): the integral, its expected value, their relative error and the verdict.

__doc__ = 'The conductivity sum rule (``molrs::compute::SumRuleCheck``): the\nintegral, its expected value, their relative error and the verdict.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

expected property

integral property

passed property

relative_error property

__repr__() method descriptor

Return repr(self).

RouteAgreement

Agreement of several ε(ω) routes on one system (molrs::compute::RouteAgreement).

Parameters:

Name Type Description Default
part str

"imaginary" or "real".

None
tolerance float
None

__doc__ = 'Agreement of several ε(ω) routes on one system\n(``molrs::compute::RouteAgreement``).\n\nParameters\n----------\npart : str, optional\n ``"imaginary"`` or ``"real"``.\ntolerance : float, optional\n\n``None`` keeps the core default. ``compute(spectra=)`` over a list of\n``DielectricSpectrumResult`` returns a ``RouteAgreementCheck``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

RouteAgreementCheck

The agreement of several ε(ω) routes (molrs::compute::RouteAgreementCheck): the RMS difference of every pair (i, j, rms), the largest and the verdict.

__doc__ = 'The agreement of several ε(ω) routes\n(``molrs::compute::RouteAgreementCheck``): the RMS difference of every\npair ``(i, j, rms)``, the largest and the verdict.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

max_rms property

pairwise property

passed property

__repr__() method descriptor

Return repr(self).

PolarizabilityParts

Split a polarizability series into its Raman invariants (molrs::compute::PolarizabilityParts).

compute(alpha=) over a (T, 6) series in Voigt order [xx, yy, zz, xy, xz, yz] returns a PolarizabilityPartsResult.

__doc__ = 'Split a polarizability series into its Raman invariants\n(``molrs::compute::PolarizabilityParts``).\n\n``compute(alpha=)`` over a ``(T, 6)`` series in Voigt order\n``[xx, yy, zz, xy, xz, yz]`` returns a ``PolarizabilityPartsResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

PolarizabilityPartsResult

The rotational invariants of a polarizability series (molrs::compute::PolarizabilityPartsResult): isotropic (T, 1) and anisotropic (T, 6).

__doc__ = 'The rotational invariants of a polarizability series\n(``molrs::compute::PolarizabilityPartsResult``): ``isotropic`` ``(T, 1)``\nand ``anisotropic`` ``(T, 6)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

anisotropic property

isotropic property

__repr__() method descriptor

Return repr(self).

RamanSpectrum

Raman spectrum from the isotropic and anisotropic polarizability correlations (molrs::compute::RamanSpectrum).

Parameters:

Name Type Description Default
window str

"hann", "blackman", "cosine_sq" or "none".

None
pad int

Zero-padding factor of the transform.

None
incident_frequency float

The laser wavenumber (cm⁻¹) of the scattering cross-section prefactor.

None
averaged bool

Report the orientation-averaged polarized / depolarized intensities.

None
temperature
required
returns
required
factor
required

__doc__ = 'Raman spectrum from the isotropic and anisotropic polarizability\ncorrelations (``molrs::compute::RamanSpectrum``).\n\nParameters\n----------\nwindow : str, optional\n ``"hann"``, ``"blackman"``, ``"cosine_sq"`` or ``"none"``.\npad : int, optional\n Zero-padding factor of the transform.\nincident_frequency : float, optional\n The laser wavenumber (cm⁻¹) of the scattering cross-section prefactor.\naveraged : bool, optional\n Report the orientation-averaged polarized / depolarized intensities.\n\n``None`` keeps the core default. ``compute(isotropic=, anisotropic=,\ntemperature=None)`` over two single-channel ``TimeCorrelation`` curves\nreturns a ``RamanSpectrumResult``; a ``temperature`` applies the Bose\nfactor.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

RamanSpectrumResult

A Raman spectrum (molrs::compute::RamanSpectrumResult): the isotropic and anisotropic intensities at frequencies_cm1, the polarized / depolarized combinations when averaged, and the spectral resolution.

__doc__ = 'A Raman spectrum (``molrs::compute::RamanSpectrumResult``): the\nisotropic and anisotropic intensities at ``frequencies_cm1``, the\npolarized / depolarized combinations when averaged, and the spectral\nresolution.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

anisotropic property

frequencies_cm1 property

isotropic property

parallel property

perpendicular property

resolution property

__repr__() method descriptor

Return repr(self).

Binned and gridded structure

Rdf, DistributionFunction, CombinedDistribution and SpatialDistribution fold frames: their compute takes one list per input field, an entry per frame.

Rdf

Radial distribution function g® (molrs::compute::Rdf) — a stream only: :meth:accumulator hands out an :class:RdfAccumulator; push one pair source per frame and :meth:RdfAccumulator.finish reads the RdfResult.

Parameters:

Name Type Description Default
n_bins int
required
r_max float

The binned range [r_min, r_max).

required
r_min float

The binned range [r_min, r_max).

required
dimensionality int

2 or 3; None keeps the core default.

None

__doc__ = 'Radial distribution function g(r) (``molrs::compute::Rdf``) — a stream\nonly: :meth:`accumulator` hands out an :class:`RdfAccumulator`; push one\npair source per frame and :meth:`RdfAccumulator.finish` reads the\n``RdfResult``.\n\nParameters\n----------\nn_bins : int\nr_max, r_min : float\n The binned range ``[r_min, r_max)``.\ndimensionality : int, optional\n ``2`` or ``3``; ``None`` keeps the core default.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

accumulator() method descriptor

A fresh accumulator configured like this Rdf (Stream::accumulator).

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

RdfAccumulator

The streaming g® accumulator (molrs::compute::RdfAccumulator), made by :meth:Rdf.accumulator.

:meth:push folds one frame's pair source; :meth:finish normalizes the running histogram into an RdfResult without consuming it, so a run can be inspected and continued. Memory is O(n_bins).

__doc__ = "The streaming g(r) accumulator (``molrs::compute::RdfAccumulator``), made\nby :meth:`Rdf.accumulator`.\n\n:meth:`push` folds one frame's pair source; :meth:`finish` normalizes the\nrunning histogram into an ``RdfResult`` without consuming it, so a run can\nbe inspected and continued. Memory is ``O(n_bins)``." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

n_frames property

Number of frames pushed so far.

finish() method descriptor

The g® over every frame pushed so far.

push(pairs) method descriptor

Fold one frame's pairs — a Neighbors table or a built NeighborList, carrying its box and dist_sq — into the running histogram. A rejected frame leaves the state unchanged.

Raises:

Type Description
ValueError

The pairing (self vs cross query) differs from frame 0's, the source has no box or no dist_sq, the box volume is not positive, or a distance is not finite.

RdfResult

A radial distribution function (molrs::compute::RdfResult): rdf and the cumulative count n_r on the bins, with the normalisation it used.

__doc__ = 'A radial distribution function (``molrs::compute::RdfResult``):\n``rdf`` and the cumulative count ``n_r`` on the bins, with the\nnormalisation it used.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

bin_centers property

bin_edges property

dimensionality property

n_frames property

n_points property

n_query_points property

n_r property

r_min property

rdf property

self_query property

volume property

__repr__() method descriptor

Return repr(self).

CorrelationFunction

Radial correlation of two per-point value arrays over a pair source (molrs::compute::CorrelationFunction).

Parameters:

Name Type Description Default
n_bins int
required
r_max float
required
r_min float
required
a
required
point
required

__doc__ = 'Radial correlation of two per-point value arrays over a pair source\n(``molrs::compute::CorrelationFunction``).\n\nParameters\n----------\nn_bins : int\nr_max, r_min : float\n\n``compute(pairs=, values_a=, values_b=)``: ``pairs`` is a ``Neighbors`` or\na ``NeighborList``; ``values_a`` / ``values_b`` are per query / reference\npoint.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

CorrelationFunctionResult

A pair correlation of per-point values on radial bins (molrs::compute::CorrelationFunctionResult).

__doc__ = 'A pair correlation of per-point values on radial bins\n(``molrs::compute::CorrelationFunctionResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

bin_centers property

bin_counts property

bin_edges property

correlation property

__repr__() method descriptor

Return repr(self).

LocalDensity

Local number density within r_max of each point (molrs::compute::LocalDensity).

Parameters:

Name Type Description Default
r_max float
required
diameter float

The particle diameter smoothing the sphere edge.

None

__doc__ = 'Local number density within ``r_max`` of each point\n(``molrs::compute::LocalDensity``).\n\nParameters\n----------\nr_max : float\ndiameter : float, optional\n The particle diameter smoothing the sphere edge.\n\n``compute(pairs=)``: a ``Neighbors`` or a ``NeighborList``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

LocalDensityResult

Per-point neighbour count and local number density (molrs::compute::LocalDensityResult).

__doc__ = 'Per-point neighbour count and local number density\n(``molrs::compute::LocalDensityResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

density property

n_neighbors property

__repr__() method descriptor

Return repr(self).

GaussianDensity

Gaussian-smeared density of points on a grid over the box (molrs::compute::GaussianDensity).

Parameters:

Name Type Description Default
dims tuple[int, int, int]

Voxels per cell vector.

required
sigma float

The Gaussian width.

required
r_max float

The cutoff of the Gaussian.

None
reach str

"ceil" (every voxel centre within r_max) or "floor" (freud's narrower stencil).

None

__doc__ = 'Gaussian-smeared density of points on a grid over the box\n(``molrs::compute::GaussianDensity``).\n\nParameters\n----------\ndims : tuple[int, int, int]\n Voxels per cell vector.\nsigma : float\n The Gaussian width.\nr_max : float, optional\n The cutoff of the Gaussian.\nreach : str, optional\n ``"ceil"`` (every voxel centre within ``r_max``) or ``"floor"``\n (freud\'s narrower stencil).\n\n``compute(positions=, simbox=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

GaussianDensityResult

A Gaussian-smeared density on a grid (molrs::compute::GaussianDensityResult).

__doc__ = 'A Gaussian-smeared density on a grid\n(``molrs::compute::GaussianDensityResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

density property

grid property

__repr__() method descriptor

Return repr(self).

SphereVoxelization

Voxels covered by spheres of radius r_max around the points (molrs::compute::SphereVoxelization).

Parameters:

Name Type Description Default
dims tuple[int, int, int]
required
r_max float
required

__doc__ = 'Voxels covered by spheres of radius ``r_max`` around the points\n(``molrs::compute::SphereVoxelization``).\n\nParameters\n----------\ndims : tuple[int, int, int]\nr_max : float\n\n``compute(positions=, simbox=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

SphereVoxelizationResult

Occupied voxels of spheres on a grid (molrs::compute::SphereVoxelizationResult).

__doc__ = 'Occupied voxels of spheres on a grid\n(``molrs::compute::SphereVoxelizationResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

grid property

raw_counts property

voxels property

__repr__() method descriptor

Return repr(self).

SpatialDistribution

Spatial distribution of target atoms in the body frame of a rigid reference, over frames (molrs::compute::SpatialDistribution).

Parameters:

Name Type Description Default
grid RegularGrid

The body-frame grid.

required
bulk_density float

Normalise g_sdf by this bulk density.

None
orientation
required
body
required

__doc__ = 'Spatial distribution of target atoms in the body frame of a rigid\nreference, over frames (``molrs::compute::SpatialDistribution``).\n\nParameters\n----------\ngrid : RegularGrid\n The body-frame grid.\nbulk_density : float, optional\n Normalise ``g_sdf`` by this bulk density.\n\n``compute(positions=, simbox=None, reference=, template=, target=,\norientation=None)`` takes one entry per frame in every list: positions\n``(N, 3)``, a box (or ``None``), reference indices, the ``(n_ref, 3)``\nbody-frame template, target indices and optional ``(head, tail)`` pairs.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

SpatialDistributionResult

A spatial distribution in a reference body frame (molrs::compute::SpatialDistributionResult).

__doc__ = 'A spatial distribution in a reference body frame\n(``molrs::compute::SpatialDistributionResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

counts property

density property

g_sdf property

grid property

n_frames property

orientation property

voxel_volume property

__repr__() method descriptor

Return repr(self).

DistributionFunction

Distribution of one internal coordinate over frames (molrs::compute::DistributionFunction).

Parameters:

Name Type Description Default
observable str

"distance", "angle" or "dihedral".

required
axis Axis

Bin on this axis (the core new).

None
n_bins int

Bin the coordinate's natural range into n_bins (the core over_natural_range). Give exactly one of axis / n_bins.

None
position
required

__doc__ = 'Distribution of one internal coordinate over frames\n(``molrs::compute::DistributionFunction``).\n\nParameters\n----------\nobservable : str\n ``"distance"``, ``"angle"`` or ``"dihedral"``.\naxis : Axis, optional\n Bin on this axis (the core ``new``).\nn_bins : int, optional\n Bin the coordinate\'s natural range into ``n_bins`` (the core\n ``over_natural_range``). Give exactly one of ``axis`` / ``n_bins``.\n\n``compute(positions=, simbox=None, tuples=)`` takes one ``(N, 3)``\nposition array, box (or ``None``) and ``(M, arity)`` index table per frame.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

DistributionResult

A 1-D distribution (molrs::compute::DistributionResult): the raw histogram, the normalised density and, for an angular coordinate, the sin θ-corrected density.

__doc__ = 'A 1-D distribution (``molrs::compute::DistributionResult``): the raw\n``histogram``, the normalised ``density`` and, for an angular\ncoordinate, the sin θ-corrected density.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

density property

density_sin_corrected property

histogram property

n_frames property

n_raw_samples property

__repr__() method descriptor

Return repr(self).

CombinedDistribution

Joint distribution of 2 or 3 internal coordinates over frames (molrs::compute::CombinedDistribution).

Parameters:

Name Type Description Default
observables list[str]

One of "distance", "angle", "dihedral" per axis (2 or 3).

required
axes list[Axis]

One binning axis per observable.

required
sin_weight list[int]

The angular axes whose marginal carries the sin θ-corrected density.

None

__doc__ = 'Joint distribution of 2 or 3 internal coordinates over frames\n(``molrs::compute::CombinedDistribution``).\n\nParameters\n----------\nobservables : list[str]\n One of ``"distance"``, ``"angle"``, ``"dihedral"`` per axis (2 or 3).\naxes : list[Axis]\n One binning axis per observable.\nsin_weight : list[int], optional\n The angular axes whose marginal carries the sin θ-corrected density.\n\n``compute(positions=, simbox=None, tuples=)`` takes, per frame, the\n``(N, 3)`` positions, a box (or ``None``) and one index table per axis.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

CombinedDistributionResult

A joint distribution (molrs::compute::CombinedDistributionResult): the N-D histogram and normalised density, with which axes are sin θ-corrected.

__doc__ = 'A joint distribution (``molrs::compute::CombinedDistributionResult``):\nthe N-D ``histogram`` and normalised ``density``, with which axes are\nsin θ-corrected.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

density property

histogram property

n_frames property

n_raw_samples property

sin_corrected property

__repr__() method descriptor

Return repr(self).

free_energy(temperature) method descriptor

The free-energy surface -kT ln p at temperature (K), as the core free_energy defines it.

marginal(axis) method descriptor

The 1-D distribution along axis, summed over the others.

StaticStructureFactorDebye

Static structure factor by the Debye sum over all pairs (molrs::compute::StaticStructureFactorDebye).

Parameters:

Name Type Description Default
k_values list[float]

Where to evaluate S(k).

required
sinc_tolerance float
None

__doc__ = 'Static structure factor by the Debye sum over all pairs\n(``molrs::compute::StaticStructureFactorDebye``).\n\nParameters\n----------\nk_values : list[float]\n Where to evaluate S(k).\nsinc_tolerance : float, optional\n\n``compute(positions=)`` over one ``(N, 3)`` snapshot.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

StaticStructureFactorDebyeResult

S(k) by the Debye sum (molrs::compute::StaticStructureFactorDebyeResult).

__doc__ = 'S(k) by the Debye sum (``molrs::compute::StaticStructureFactorDebyeResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

k_values property

n_particles property

sk property

__repr__() method descriptor

Return repr(self).

StaticStructureFactorDirect

Static structure factor from the density's Fourier components (molrs::compute::StaticStructureFactorDirect).

Parameters:

Name Type Description Default
k_vecs list of 3-vectors

Evaluate at these k-vectors (the core new).

None
k_max float
None
n_bins int

Bin the box's reciprocal lattice isotropically up to k_max (the core isotropic). Give either k_vecs or both k_max and n_bins.

None

__doc__ = "Static structure factor from the density's Fourier components\n(``molrs::compute::StaticStructureFactorDirect``).\n\nParameters\n----------\nk_vecs : list of 3-vectors, optional\n Evaluate at these k-vectors (the core ``new``).\nk_max : float, optional\nn_bins : int, optional\n Bin the box's reciprocal lattice isotropically up to ``k_max`` (the\n core ``isotropic``). Give either ``k_vecs`` or both ``k_max`` and\n ``n_bins``.\n\n``compute(positions=, simbox=None)``." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

StaticStructureFactorDirectResult

S(k) on explicit or isotropically binned k-vectors (molrs::compute::StaticStructureFactorDirectResult).

__doc__ = 'S(k) on explicit or isotropically binned k-vectors\n(``molrs::compute::StaticStructureFactorDirectResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

k_magnitudes property

n_particles property

sk property

__repr__() method descriptor

Return repr(self).

DiffractionPattern

A 2-D diffraction pattern of one snapshot projected along an axis (molrs::compute::DiffractionPattern).

Parameters:

Name Type Description Default
n_grid int

Image side length in pixels.

required
sigma float

The Gaussian width smearing each point.

required
axis int

The projection axis.

None
cutoff float

The cutoff of the Gaussian.

None

__doc__ = 'A 2-D diffraction pattern of one snapshot projected along an axis\n(``molrs::compute::DiffractionPattern``).\n\nParameters\n----------\nn_grid : int\n Image side length in pixels.\nsigma : float\n The Gaussian width smearing each point.\naxis : int, optional\n The projection axis.\ncutoff : float, optional\n The cutoff of the Gaussian.\n\n``compute(positions=, simbox=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

DiffractionPatternResult

A 2-D diffraction pattern and the projected density image it was transformed from (molrs::compute::DiffractionPatternResult).

__doc__ = 'A 2-D diffraction pattern and the projected density image it was\ntransformed from (``molrs::compute::DiffractionPatternResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

diffraction property

image property

__repr__() method descriptor

Return repr(self).

Dynamics

PairPresence

Pair presence with hysteresis over frames (molrs::compute::PairPresence): a pair enters at distance ≤ r0 and stays while within r1.

Parameters:

Name Type Description Default
r0 float
required
exclude_self bool

Drop i == j pairs.

required
r1 float

The exit distance (≥ r0).

None
pair
required

__doc__ = 'Pair presence with hysteresis over frames\n(``molrs::compute::PairPresence``): a pair enters at distance ``≤ r0`` and\nstays while within ``r1``.\n\nParameters\n----------\nr0 : float\nexclude_self : bool\n Drop ``i == j`` pairs.\nr1 : float, optional\n The exit distance (``≥ r0``).\n\n``compute(frames=)`` takes one pair source (``Neighbors`` or\n``NeighborList``) per frame and returns a ``Presence``, or ``None`` when no\npair is ever present.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

Presence

A presence series (molrs::compute::Presence): values[t, k] is 1 when pair pairs[k] is present at frame t. Pass values to Survival as its presence.

__doc__ = 'A presence series (``molrs::compute::Presence``): ``values[t, k]`` is\n1 when pair ``pairs[k]`` is present at frame ``t``. Pass ``values`` to\n``Survival`` as its ``presence``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

pairs property

values property

__repr__() method descriptor

Return repr(self).

VanHove

The van Hove correlation G(r, t) over a trajectory (molrs::compute::VanHove).

Parameters:

Name Type Description Default
axis Axis

The distance bins.

required
lags list[int]

The lags, in frames.

required
origins str

"all" or "first".

None
stride int

Origin stride.

None
upper_edge str

"open" (half-open bins) or "closed" (r_max in the last bin).

None
and
required

__doc__ = 'The van Hove correlation G(r, t) over a trajectory\n(``molrs::compute::VanHove``).\n\nParameters\n----------\naxis : Axis\n The distance bins.\nlags : list[int]\n The lags, in frames.\norigins : str, optional\n ``"all"`` or ``"first"``.\nstride : int, optional\n Origin stride.\nupper_edge : str, optional\n ``"open"`` (half-open bins) or ``"closed"`` (``r_max`` in the last\n bin).\n\n``compute(positions=, boxes=)``: an unwrapped ``(T, N, 3)`` trajectory\nand one box per frame.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

VanHoveResult

The self and distinct van Hove functions at each lag (molrs::compute::VanHoveResult).

__doc__ = 'The self and distinct van Hove functions at each lag\n(``molrs::compute::VanHoveResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

dr property

g_distinct property

g_self property

lags property

r_centers property

r_edges property

__repr__() method descriptor

Return repr(self).

HBonds

Geometric hydrogen-bond detection, frame by frame (molrs::compute::HBonds).

Parameters:

Name Type Description Default
dist_cutoff float
None
dist_kind str

"donor_acceptor" or "hydrogen_acceptor".

None
angle_cutoff float
None
donor_acceptor_margin float

The criterion fields; each None keeps the core default criterion.

None
trajectory
required

__doc__ = 'Geometric hydrogen-bond detection, frame by frame\n(``molrs::compute::HBonds``).\n\nParameters\n----------\ndist_cutoff : float, optional\ndist_kind : str, optional\n ``"donor_acceptor"`` or ``"hydrogen_acceptor"``.\nangle_cutoff : float, optional\ndonor_acceptor_margin : float, optional\n The criterion fields; each ``None`` keeps the core default criterion.\n\n``compute(positions=, donors=, acceptors=, pairs=)``: a ``(T, N, 3)``\ntrajectory, ``(donor, hydrogen)`` index pairs, acceptor indices and one\n``Neighbors`` cross-query per frame (donor sites against acceptors).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

HBondsResult

The hydrogen bonds of every frame (molrs::compute::HBondsResult): per_frame[t] lists frame t's HBonds, counts[t] their number.

__doc__ = "The hydrogen bonds of every frame (``molrs::compute::HBondsResult``):\n``per_frame[t]`` lists frame ``t``'s ``HBond``s, ``counts[t]`` their\nnumber." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

counts property

n_atoms property

per_frame property

__repr__() method descriptor

Return repr(self).

components(frame) method descriptor

The hydrogen-bond network component label of every atom in frame.

presence() method descriptor

The (donor, acceptor) presence series, for Survival; None when no bond is ever present.

HBond

One hydrogen bond (molrs::compute::HBond): donor, hydrogen and acceptor indices, the D···A distance (Å) and the D–H···A angle (deg).

__doc__ = 'One hydrogen bond (``molrs::compute::HBond``): donor, hydrogen and\nacceptor indices, the D···A distance (Å) and the D–H···A angle (deg).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

acceptor property

angle property

distance property

donor property

hydrogen property

__repr__() method descriptor

Return repr(self).

Order and environment

Steinhardt

Steinhardt bond-orientational order (molrs::compute::Steinhardt).

Parameters:

Name Type Description Default
l list[int]

The spherical-harmonic orders.

required
average bool

Neighbour-averaged q_l; also w_l; normalize w_l.

None
wl bool

Neighbour-averaged q_l; also w_l; normalize w_l.

None
wl_normalize bool

Neighbour-averaged q_l; also w_l; normalize w_l.

None

__doc__ = 'Steinhardt bond-orientational order (``molrs::compute::Steinhardt``).\n\nParameters\n----------\nl : list[int]\n The spherical-harmonic orders.\naverage, wl, wl_normalize : bool, optional\n Neighbour-averaged ``q_l``; also ``w_l``; normalize ``w_l``.\n\n``compute(neighbors=)`` over a half-shell self-query ``Neighbors``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

SteinhardtResult

Steinhardt order parameters (molrs::compute::SteinhardtResult); a feature matrix.

__doc__ = 'Steinhardt order parameters (``molrs::compute::SteinhardtResult``); a\nfeature matrix.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

l property

ql property

q_l per particle and order, (n_particles, len(l)).

tables property

One QlmTable per order, aligned with l.

wl property

w_l per particle and order, or None when not computed.

__repr__() method descriptor

Return repr(self).

qlm(l) method descriptor

The table of order l, or None.

QlmTable

Per-particle bond averages q_lm (or planar ψ_k) of one order (molrs::compute::QlmTable).

Read from SteinhardtResult.qlm(l); the input of SolidLiquid and ContinuousCoordination.

__doc__ = 'Per-particle bond averages ``q_lm`` (or planar ``ψ_k``) of one order\n(``molrs::compute::QlmTable``).\n\nRead from ``SteinhardtResult.qlm(l)``; the input of ``SolidLiquid`` and\n``ContinuousCoordination``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

is_planar property

n_particles property

order property

The order l (or k for a planar table).

values property

The (n_particles, n_m) complex128 table.

__repr__() method descriptor

Return repr(self).

bond_coherence(neighbors) method descriptor

The per-particle bond coherence over neighbors.

norms() method descriptor

The per-particle norm of the m vector.

ql() method descriptor

The rotation-invariant q_l per particle.

wl(normalize) method descriptor

The third-order invariant w_l per particle.

Hexatic

The k-atic bond order ψ_k of a 2-D system (molrs::compute::Hexatic).

compute(neighbors=).

__doc__ = 'The k-atic bond order ``ψ_k`` of a 2-D system (``molrs::compute::Hexatic``).\n\n``compute(neighbors=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

HexaticResult

The k-atic order ψ_k per particle (molrs::compute::HexaticResult).

__doc__ = 'The k-atic order ``ψ_k`` per particle (``molrs::compute::HexaticResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

k property

psi property

__repr__() method descriptor

Return repr(self).

SolidLiquid

Solid-liquid classification by bond coherence (molrs::compute::SolidLiquid).

Parameters:

Name Type Description Default
q_threshold float
None
n_threshold int
None
normalize_q bool
None

__doc__ = 'Solid-liquid classification by bond coherence\n(``molrs::compute::SolidLiquid``).\n\nParameters\n----------\nq_threshold : float, optional\nn_threshold : int, optional\nnormalize_q : bool, optional\n\n``compute(qlm=, neighbors=)`` with a ``QlmTable``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

SolidLiquidResult

Solid-like bonds and particles (molrs::compute::SolidLiquidResult).

__doc__ = 'Solid-like bonds and particles (``molrs::compute::SolidLiquidResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

is_solid property

l property

n_solid_bonds property

__repr__() method descriptor

Return repr(self).

ContinuousCoordination

Continuous coordination number (molrs::compute::ContinuousCoordination).

compute(qlm=, neighbors=) with a QlmTable.

__doc__ = 'Continuous coordination number (``molrs::compute::ContinuousCoordination``).\n\n``compute(qlm=, neighbors=)`` with a ``QlmTable``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

ContinuousCoordinationResult

Continuous coordination per particle (molrs::compute::ContinuousCoordinationResult).

__doc__ = 'Continuous coordination per particle\n(``molrs::compute::ContinuousCoordinationResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

coord property

l property

__repr__() method descriptor

Return repr(self).

Nematic

Nematic order of (N, 3) directors (molrs::compute::Nematic).

compute(directors=).

__doc__ = 'Nematic order of ``(N, 3)`` directors (``molrs::compute::Nematic``).\n\n``compute(directors=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

NematicResult

The nematic order tensor and director (molrs::compute::NematicResult).

__doc__ = 'The nematic order tensor and director (``molrs::compute::NematicResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

director property

eigenvalues property

order property

q_tensor property

__repr__() method descriptor

Return repr(self).

Cubatic

Cubatic order of (N, 3) directors by simulated annealing (molrs::compute::Cubatic).

Parameters:

Name Type Description Default
seed int
None
n_steps int
None
n_chains int
None
initial_temp float
None
cooling_rate float
None
min_temp float
None

__doc__ = 'Cubatic order of ``(N, 3)`` directors by simulated annealing\n(``molrs::compute::Cubatic``).\n\nParameters\n----------\nseed, n_steps, n_chains : int, optional\ninitial_temp, cooling_rate, min_temp : float, optional\n\n``compute(directors=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

CubaticResult

The cubatic order and its director basis (molrs::compute::CubaticResult).

__doc__ = 'The cubatic order and its director basis (``molrs::compute::CubaticResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

director_basis property

order property

__repr__() method descriptor

Return repr(self).

BondOrientationalOrder

Bond-orientational order diagram on a (theta, phi) grid (molrs::compute::BondOrientationalOrder).

compute(neighbors=).

__doc__ = 'Bond-orientational order diagram on a ``(theta, phi)`` grid\n(``molrs::compute::BondOrientationalOrder``).\n\n``compute(neighbors=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

BondOrientationalOrderResult

The bond-orientation histogram on the sphere (molrs::compute::BondOrientationalOrderResult).

__doc__ = 'The bond-orientation histogram on the sphere\n(``molrs::compute::BondOrientationalOrderResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

bond_order property

phi_edges property

raw_counts property

theta_edges property

__repr__() method descriptor

Return repr(self).

LocalDescriptors

Spherical-harmonic descriptors of every bond up to l_max (molrs::compute::LocalDescriptors).

compute(neighbors=).

__doc__ = 'Spherical-harmonic descriptors of every bond up to ``l_max``\n(``molrs::compute::LocalDescriptors``).\n\n``compute(neighbors=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

LocalDescriptorsResult

Per-bond spherical-harmonic descriptors (molrs::compute::LocalDescriptorsResult); a feature matrix.

__doc__ = 'Per-bond spherical-harmonic descriptors\n(``molrs::compute::LocalDescriptorsResult``); a feature matrix.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

features property

The (n_bonds, 2 * n_sphs) feature matrix (real and imaginary parts interleaved), one row per bond.

l_max property

n_sphs property

__repr__() method descriptor

Return repr(self).

descriptor(pair, l, m) method descriptor

The descriptor of bond pair at (l, m), or None out of range.

LocalBondProjection

Projections of each bond onto (M, 3) axes, in the particle frame when (N, 4) orientations are given (molrs::compute::LocalBondProjection).

compute(neighbors=, proj_vectors=, orientations=None).

__doc__ = 'Projections of each bond onto ``(M, 3)`` axes, in the particle frame when\n``(N, 4)`` orientations are given (``molrs::compute::LocalBondProjection``).\n\n``compute(neighbors=, proj_vectors=, orientations=None)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

LocalBondProjectionResult

Bond projections onto the given axes (molrs::compute::LocalBondProjectionResult).

__doc__ = 'Bond projections onto the given axes\n(``molrs::compute::LocalBondProjectionResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

projections property

__repr__() method descriptor

Return repr(self).

EnvironmentMatch

Cluster particles whose neighbour environments match within rmsd_threshold (molrs::compute::EnvironmentMatch).

Parameters:

Name Type Description Default
rmsd_threshold float
required
registration bool
None
max_neighbors_for_registration int
None

__doc__ = 'Cluster particles whose neighbour environments match within\n``rmsd_threshold`` (``molrs::compute::EnvironmentMatch``).\n\nParameters\n----------\nrmsd_threshold : float\nregistration : bool, optional\nmax_neighbors_for_registration : int, optional\n\n``compute(neighbors=)`` returns an ``EnvironmentMatchResult`` (a partition).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

EnvironmentMatchResult

Environment clusters (molrs::compute::EnvironmentMatchResult); a partition.

__doc__ = 'Environment clusters (``molrs::compute::EnvironmentMatchResult``); a\npartition.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

cluster_idx property

fingerprints property

n_clusters property

__repr__() method descriptor

Return repr(self).

AngularSeparationGlobal

Angles between (N, 4) query quaternions and (M, 4) reference ones (molrs::compute::AngularSeparationGlobal).

compute(query=, reference=).

__doc__ = 'Angles between ``(N, 4)`` query quaternions and ``(M, 4)`` reference ones\n(``molrs::compute::AngularSeparationGlobal``).\n\n``compute(query=, reference=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

AngularSeparationGlobalResult

Angles between query and reference orientations (molrs::compute::AngularSeparationGlobalResult).

__doc__ = 'Angles between query and reference orientations\n(``molrs::compute::AngularSeparationGlobalResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

angles property

__repr__() method descriptor

Return repr(self).

AngularSeparationNeighbor

Angles between the orientations of neighbouring particles (molrs::compute::AngularSeparationNeighbor).

compute(neighbors=, query_orientations=, point_orientations=).

__doc__ = 'Angles between the orientations of neighbouring particles\n(``molrs::compute::AngularSeparationNeighbor``).\n\n``compute(neighbors=, query_orientations=, point_orientations=)``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

AngularSeparationNeighborResult

Angles between neighbouring orientations (molrs::compute::AngularSeparationNeighborResult).

__doc__ = 'Angles between neighbouring orientations\n(``molrs::compute::AngularSeparationNeighborResult``).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

angles property

__repr__() method descriptor

Return repr(self).

PmftR12

PMFT in (r, θ1, θ2) of 2-D pairs (molrs::compute::Pmft<R12>).

compute(pairs=, orientations=None) with (N,) angles.

__doc__ = 'PMFT in ``(r, θ1, θ2)`` of 2-D pairs (``molrs::compute::Pmft<R12>``).\n\n``compute(pairs=, orientations=None)`` with ``(N,)`` angles.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

PmftXy

PMFT in the (x, y) frame of a 2-D particle (molrs::compute::Pmft<Xy>).

compute(pairs=, orientations=None) with (N,) angles.

__doc__ = 'PMFT in the ``(x, y)`` frame of a 2-D particle\n(``molrs::compute::Pmft<Xy>``).\n\n``compute(pairs=, orientations=None)`` with ``(N,)`` angles.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

PmftXyt

PMFT in (x, y, θ) of 2-D pairs (molrs::compute::Pmft<Xyt>).

compute(pairs=, orientations=None) with (N,) angles.

__doc__ = 'PMFT in ``(x, y, θ)`` of 2-D pairs (``molrs::compute::Pmft<Xyt>``).\n\n``compute(pairs=, orientations=None)`` with ``(N,)`` angles.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

PmftXyz

PMFT in the (x, y, z) frame of a 3-D particle (molrs::compute::Pmft<Xyz>).

compute(pairs=, orientations=None) with (N, 4) quaternions.

__doc__ = 'PMFT in the ``(x, y, z)`` frame of a 3-D particle\n(``molrs::compute::Pmft<Xyz>``).\n\n``compute(pairs=, orientations=None)`` with ``(N, 4)`` quaternions.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

PmftResult

A potential of mean force on a pair-coordinate grid (molrs::compute::PmftResult): pair density and raw_counts per bin, pmf = −ln(ρ / ρ_ref) (+inf where nothing was binned) and the bin edges of each axis.

__doc__ = 'A potential of mean force on a pair-coordinate grid\n(``molrs::compute::PmftResult``): pair ``density`` and ``raw_counts``\nper bin, ``pmf = −ln(ρ / ρ_ref)`` (``+inf`` where nothing was binned)\nand the bin ``edges`` of each axis.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

density property

edges property

pmf property

raw_counts property

__repr__() method descriptor

Return repr(self).

Groups and features

A partition argument is an unsigned-int label array or any partition result (ClusterResult, KmeansResult, EnvironmentMatchResult, VoronoiDomainResult); a feature matrix is a 2-D float array or a descriptor result (SteinhardtResult, LocalDescriptorsResult, PcaResult).

Cluster

Connected components of a neighbour table (molrs::compute::Cluster).

Parameters:

Name Type Description Default
min_cluster_size int

Drop clusters smaller than this; None keeps the core default.

None
the
required
the
required

__doc__ = 'Connected components of a neighbour table (``molrs::compute::Cluster``).\n\nParameters\n----------\nmin_cluster_size : int, optional\n Drop clusters smaller than this; ``None`` keeps the core default.\n\n``compute(pairs=, merge=None)`` clusters the items joined by the pairs of\nthe ``Neighbors`` table ``pairs``; ``merge`` (a partition) joins items of\nthe same group first. Returns a ``ClusterResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

ClusterResult

Connected clusters (molrs::compute::ClusterResult); a partition.

cluster_idx[i] is item i's cluster, cluster_sizes and cluster_keys are per cluster. Pass it as the partition= of a group compute (CenterOfMass, GyrationTensor, …).

__doc__ = "Connected clusters (``molrs::compute::ClusterResult``); a partition.\n\n``cluster_idx[i]`` is item ``i``'s cluster, ``cluster_sizes`` and\n``cluster_keys`` are per cluster. Pass it as the ``partition=`` of a\ngroup compute (``CenterOfMass``, ``GyrationTensor``, …)." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

cluster_idx property

cluster_keys property

cluster_sizes property

n_clusters property

__repr__() method descriptor

Return repr(self).

sizes() method descriptor

The size of every group, as [(group, size), …] by ascending group.

CenterOfMass

Mass-weighted centre of each group (molrs::compute::CenterOfMass).

compute(positions=, simbox=None, partition=, masses=): (N, 3) positions, the box (groups are unwrapped across it when given), a partition (an unsigned-int label array or a partition result) and (N,) masses. Returns a CenterOfMassResult.

__doc__ = 'Mass-weighted centre of each group (``molrs::compute::CenterOfMass``).\n\n``compute(positions=, simbox=None, partition=, masses=)``: ``(N, 3)``\npositions, the box (groups are unwrapped across it when given), a\npartition (an unsigned-int label array or a partition result) and ``(N,)``\nmasses. Returns a ``CenterOfMassResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

CenterOfMassResult

Centres of mass (molrs::compute::CenterOfMassResult): one row of centers and one total_masses entry per group key in groups.

__doc__ = 'Centres of mass (``molrs::compute::CenterOfMassResult``): one row of\n``centers`` and one ``total_masses`` entry per group key in ``groups``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

centers property

groups property

total_masses property

__repr__() method descriptor

Return repr(self).

GyrationTensor

Weighted gyration tensor of each group (molrs::compute::GyrationTensor).

compute(positions=, simbox=None, partition=, weights=): as CenterOfMass with (N,) weights. Returns a GyrationTensorResult.

__doc__ = 'Weighted gyration tensor of each group (``molrs::compute::GyrationTensor``).\n\n``compute(positions=, simbox=None, partition=, weights=)``: as\n``CenterOfMass`` with ``(N,)`` weights. Returns a ``GyrationTensorResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

GyrationTensorResult

Gyration tensors (molrs::compute::GyrationTensorResult): a (3, 3) tensor per group key in groups.

__doc__ = 'Gyration tensors (``molrs::compute::GyrationTensorResult``): a\n``(3, 3)`` tensor per group key in ``groups``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

groups property

tensors property

__repr__() method descriptor

Return repr(self).

radius_of_gyration() method descriptor

The radius of gyration of each group, sqrt(trace).

InertiaTensor

Moment of inertia tensor of each group (molrs::compute::InertiaTensor).

compute(positions=, simbox=None, partition=, masses=): as CenterOfMass. Returns an InertiaTensorResult.

__doc__ = 'Moment of inertia tensor of each group (``molrs::compute::InertiaTensor``).\n\n``compute(positions=, simbox=None, partition=, masses=)``: as\n``CenterOfMass``. Returns an ``InertiaTensorResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

InertiaTensorResult

Inertia tensors (molrs::compute::InertiaTensorResult): a (3, 3) tensor per group key in groups.

__doc__ = 'Inertia tensors (``molrs::compute::InertiaTensorResult``): a ``(3, 3)``\ntensor per group key in ``groups``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

groups property

tensors property

__repr__() method descriptor

Return repr(self).

Pca

Principal component analysis of the rows of a feature matrix (molrs::compute::Pca).

Parameters:

Name Type Description Default
n_components int

The number of components kept.

required
returns
required

__doc__ = 'Principal component analysis of the rows of a feature matrix\n(``molrs::compute::Pca``).\n\nParameters\n----------\nn_components : int\n The number of components kept.\n\n``compute(features=)`` decomposes a 2-D float array or a descriptor result\n(``SteinhardtResult``, ``LocalDescriptorsResult``, ``PcaResult``) and\nreturns a ``PcaResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

PcaResult

Principal components (molrs::compute::PcaResult): the (n_rows, n_components) projected coords and the variance of each component. A feature matrix.

__doc__ = 'Principal components (``molrs::compute::PcaResult``): the\n``(n_rows, n_components)`` projected ``coords`` and the ``variance``\nof each component. A feature matrix.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

coords property

variance property

__repr__() method descriptor

Return repr(self).

Kmeans

K-means clustering of the rows of a feature matrix (molrs::compute::Kmeans).

Parameters:

Name Type Description Default
k int

The number of clusters.

required
max_iter int

The iteration cap; None keeps the core default.

None
seed int

The initialisation seed; None keeps the core default.

None
returns
required

__doc__ = 'K-means clustering of the rows of a feature matrix\n(``molrs::compute::Kmeans``).\n\nParameters\n----------\nk : int\n The number of clusters.\nmax_iter : int, optional\n The iteration cap; ``None`` keeps the core default.\nseed : int, optional\n The initialisation seed; ``None`` keeps the core default.\n\n``compute(features=)`` clusters a 2-D float array or a descriptor result\n(``SteinhardtResult``, ``LocalDescriptorsResult``, ``PcaResult``) and\nreturns a ``KmeansResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

KmeansResult

The k-means partition (molrs::compute::KmeansResult): one label per row and the (k, n_features) centroids. A partition.

__doc__ = 'The k-means partition (``molrs::compute::KmeansResult``): one label per\nrow and the ``(k, n_features)`` centroids. A partition.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

centroids property

labels property

__repr__() method descriptor

Return repr(self).

Voronoi

RadicalVoronoi

The radical (power) Voronoi tessellation of one snapshot (molrs::compute::RadicalVoronoi).

compute(positions=, simbox=, radii=): (N, 3) positions, the box and (N,) radii. Returns VoronoiCells.

__doc__ = 'The radical (power) Voronoi tessellation of one snapshot\n(``molrs::compute::RadicalVoronoi``).\n\n``compute(positions=, simbox=, radii=)``: ``(N, 3)`` positions, the box\nand ``(N,)`` radii. Returns ``VoronoiCells``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

VoronoiCells

A tessellation (molrs::compute::VoronoiCells): the volumes of the cells and the faces of each.

__doc__ = 'A tessellation (``molrs::compute::VoronoiCells``): the ``volumes`` of\nthe cells and the ``faces`` of each.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

faces property

volumes property

__len__() method descriptor

Return len(self).

__repr__() method descriptor

Return repr(self).

neighbors(i) method descriptor

The neighbours of cell i across its faces.

total_volume() method descriptor

The summed volume of every cell.

VoronoiFace

One face of a Voronoi cell (molrs::compute::VoronoiFace): its area and the neighbor across it (negative for a boundary).

__doc__ = 'One face of a Voronoi cell (``molrs::compute::VoronoiFace``): its\n``area`` and the ``neighbor`` across it (negative for a boundary).' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

area property

neighbor property

__repr__() method descriptor

Return repr(self).

VoronoiDomainAnalysis

Connected domains of the cells a partition selects (molrs::compute::VoronoiDomainAnalysis).

compute(cells=, partition=): the VoronoiCells and a partition of the cells (an unlabelled cell is in no domain). Returns a VoronoiDomainResult.

__doc__ = 'Connected domains of the cells a partition selects\n(``molrs::compute::VoronoiDomainAnalysis``).\n\n``compute(cells=, partition=)``: the ``VoronoiCells`` and a partition of\nthe cells (an unlabelled cell is in no domain). Returns a\n``VoronoiDomainResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

VoronoiDomainResult

Voronoi domains (molrs::compute::VoronoiDomainResult): the sizes of the connected domains, their count, the largest_fraction and each cell's domain (None outside every domain). A partition.

__doc__ = "Voronoi domains (``molrs::compute::VoronoiDomainResult``): the ``sizes``\nof the connected domains, their ``count``, the ``largest_fraction``\nand each cell's domain (``None`` outside every domain). A partition." class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

count property

domain_of property

largest_fraction property

sizes property

__repr__() method descriptor

Return repr(self).

VoronoiVoidAnalysis

Cavities formed by connected void cells (molrs::compute::VoronoiVoidAnalysis).

compute(cells=, is_void=, box_volume=): the VoronoiCells, a per-cell flag marking the void (probe) cells and the box volume. Returns a VoronoiVoidResult.

__doc__ = 'Cavities formed by connected void cells\n(``molrs::compute::VoronoiVoidAnalysis``).\n\n``compute(cells=, is_void=, box_volume=)``: the ``VoronoiCells``, a\nper-cell flag marking the void (probe) cells and the box volume. Returns a\n``VoronoiVoidResult``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

VoronoiVoidResult

Voids (molrs::compute::VoronoiVoidResult): the cavity volumes (descending), their total and the void fraction of the box.

__doc__ = 'Voids (``molrs::compute::VoronoiVoidResult``): the cavity volumes\n(descending), their total and the void fraction of the box.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

cavity_volumes property

total_void_volume property

void_fraction property

__repr__() method descriptor

Return repr(self).

VoronoiIntegration

Integrate a density over the radical Voronoi cells of the atoms and sum the cells of each group (molrs::compute::VoronoiIntegration).

Parameters:

Name Type Description Default
unit str

The length unit of the positions and grid: "angstrom" or "bohr".

required
grid
required
charges
required
a
required
density
required

__doc__ = 'Integrate a density over the radical Voronoi cells of the atoms and sum\nthe cells of each group (``molrs::compute::VoronoiIntegration``).\n\nParameters\n----------\nunit : str\n The length unit of the positions and grid: ``"angstrom"`` or\n ``"bohr"``.\n\n``compute(positions=, radii=, nuclear_charges=, partition=, simbox=,\ngrid=, density=)``: ``(N, 3)`` positions, ``(N,)`` radii and nuclear\ncharges, a partition into molecules, the box, the ``RegularGrid`` the\ndensity lives on and the ``(nx, ny, nz)`` density. Returns\n``MolecularMoments``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.

MolecularMoments

Per-group moments from an integrated density (molrs::compute::MolecularMoments): the charges, dipoles and references of each group key in groups.

__doc__ = 'Per-group moments from an integrated density\n(``molrs::compute::MolecularMoments``): the ``charges``, ``dipoles``\nand ``references`` of each group key in ``groups``.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

charges property

dipoles property

groups property

references property

__repr__() method descriptor

Return repr(self).

FiniteFieldPolarizability

Polarizability by central finite differences of the group dipoles under ±field (molrs::compute::FiniteFieldPolarizability).

Parameters:

Name Type Description Default
field float

The applied field strength.

required

__doc__ = 'Polarizability by central finite differences of the group dipoles under\n``±field`` (``molrs::compute::FiniteFieldPolarizability``).\n\nParameters\n----------\nfield : float\n The applied field strength.\n\n``compute(plus=, minus=)``: the ``MolecularMoments`` under ``+field`` and\n``-field``. Returns the per-group polarizability array.' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

__module__ = 'molrs.compute' class-attribute

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.

spec() staticmethod

The descriptor of this compute type.

tunables() method descriptor

The value this instance holds for every parameter that has a default, as [(name, value), …] in spec order.