Skip to content

Python Reference

Canonical import style:

import molrs as mr

This page is rendered from the installed molrs package by mkdocstrings-python. Autodoc identifiers use the package name (molrs.Frame); user code should import molrs as mr and write mr.Frame. The type stub in molrs-python/python/molrs/_lib.pyi is the committed companion artifact that keeps signatures visible to static tools and the docs build.

Core Model

Box

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

The box is defined by a 3x3 cell matrix H whose columns are the lattice vectors, an origin point, and per-axis PBC flags.

Python Examples

import numpy as np
from molrs import Box

box = Box.cube(10.0)                       # 10 x 10 x 10 cubic
box = Box.ortho(np.array([10, 20, 30]))    # orthorhombic
print(box.volume())                        # 6000.0

__doc__ = 'Simulation box with periodic boundary conditions, exposed to Python as\n`molrs.Box`.\n\nThe box is defined by a 3x3 cell matrix **H** whose columns are the\nlattice vectors, an origin point, and per-axis PBC flags.\n\n# Python Examples\n\n```python\nimport numpy as np\nfrom molrs import Box\n\nbox = Box.cube(10.0) # 10 x 10 x 10 cubic\nbox = Box.ortho(np.array([10, 20, 30])) # orthorhombic\nprint(box.volume()) # 6000.0\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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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]].

cell_defined property

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

h property

Cell matrix H (3x3), lattice vectors as columns.

Returns

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

inverse property

Inverse cell matrix.

is_free property

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

lengths property

Lengths of the three lattice vectors (property; [|a|, |b|, |c|]).

matrix property

Box matrix with lattice vectors as columns, shape (3, 3). Alias for h to mirror the molpy API.

nearest_plane_distance property

Perpendicular distances between opposite cell faces.

origin property

Box origin in Cartesian coordinates.

Returns

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

pbc property

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

Returns

numpy.ndarray, shape (3,), dtype bool

style property

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

tilts property

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

corners() method descriptor

Eight Cartesian cell corners.

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

Create a cubic simulation box.

Parameters

a : float Side length of the cube in the same length unit as coordinates. origin : numpy.ndarray, shape (3,), optional Box origin. Defaults to [0, 0, 0]. pbc : numpy.ndarray, shape (3,), dtype bool, optional Periodic boundary flags. Defaults to [True, True, True].

Returns

Box

Examples

box = Box.cube(10.0) box.volume() 1000.0

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

Compute displacement vectors between two point sets.

Calculates xyzu2 - xyzu1 with optional minimum-image convention for periodic systems.

Parameters

xyzu1 : numpy.ndarray, shape (N, 3), dtype float First set of Cartesian coordinates. xyzu2 : numpy.ndarray, shape (N, 3), dtype float Second set of Cartesian coordinates (same shape as xyzu1). minimum_image : bool, optional If True, apply the minimum-image convention to displacements. Default is False.

Returns

numpy.ndarray, shape (N, 3), dtype float Displacement vectors xyzu2 - xyzu1.

Raises

ValueError If shapes do not match or columns != 3.

distance(r1, r2) method descriptor

Minimum-image distance between two points.

distance_squared(r1, r2) method descriptor

Squared minimum-image distance between two points.

distances(points1, points2) method descriptor

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

from_bounds(points, padding, pbc=None) staticmethod

Create a tight orthorhombic box around a point cloud.

images(xyz) method descriptor

Integer periodic image flags for Cartesian coordinates.

isin(xyz) method descriptor

Test whether each point lies inside the primary simulation cell.

Parameters

xyz : numpy.ndarray, shape (N, 3), dtype float Cartesian coordinates.

Returns

numpy.ndarray, shape (N,), dtype bool True for points inside the cell.

Raises

ValueError If xyz does not have 3 columns.

lattice(index) method descriptor

Return a lattice vector by index.

Parameters

index : int Lattice vector index: 0, 1, or 2.

Returns

numpy.ndarray, shape (3,) The lattice vector as a Cartesian 3-vector.

Raises

ValueError If index is not 0, 1, or 2.

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

Create an orthorhombic (rectangular) simulation box.

Parameters

lengths : numpy.ndarray, shape (3,), dtype float Side lengths [Lx, Ly, Lz]. origin : numpy.ndarray, shape (3,), optional Box origin. Defaults to [0, 0, 0]. pbc : numpy.ndarray, shape (3,), dtype bool, optional Periodic boundary flags. Defaults to [True, True, True].

Returns

Box

Raises

ValueError If lengths does not have exactly 3 elements.

Examples

box = Box.ortho(np.array([10.0, 20.0, 30.0]))

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.

shortest_vector(r1, r2) method descriptor

Minimum-image displacement from r1 to r2.

to_cart(xyzs) method descriptor

Convert fractional coordinates to Cartesian coordinates.

Parameters

xyzs : numpy.ndarray, shape (N, 3), dtype float Fractional coordinates.

Returns

numpy.ndarray, shape (N, 3), dtype float Cartesian coordinates.

Raises

ValueError If xyzs does not have 3 columns.

to_frac(xyz) method descriptor

Convert Cartesian coordinates to fractional coordinates.

Parameters

xyz : numpy.ndarray, shape (N, 3), dtype float Cartesian coordinates.

Returns

numpy.ndarray, shape (N, 3), dtype float Fractional coordinates in the range [0, 1) for wrapped points.

Raises

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.

volume() method descriptor

Volume of the simulation box.

Returns

float Volume in length_unit^3 (e.g. angstrom^3).

wrap(xyzu) method descriptor

Wrap coordinates into the primary simulation cell.

Applies periodic wrapping along axes where PBC is enabled.

Parameters

xyzu : numpy.ndarray, shape (N, 3), dtype float Unwrapped Cartesian coordinates.

Returns

numpy.ndarray, shape (N, 3), dtype float Wrapped Cartesian coordinates.

Raises

ValueError If xyzu does not have 3 columns.

Block

Bases: molrs.Block, collections.abc.MutableMapping

Tidy columnar table mapping name -> 1D/2D numpy column.

Inherits the PyO3 molrs.Block so a rich Block IS-A core block and is accepted by every molrs.* API with no conversion. All columns live in the Rust Store (numpy-representable dtypes only); reads are zero-copy views.

Behaves like a dict and supports advanced indexing: by key (column), by int/slice (row / sub-block), by boolean mask, by list of keys (2D array), and by any callable selector (key(self)).

__abstractmethods__ = frozenset() class-attribute

Build an immutable unordered collection of unique elements.

__dict__ = mappingproxy({'__module__': 'molrs.frame', '__firstlineno__': 45, '__doc__': 'Tidy columnar table mapping name -> 1D/2D numpy column.\n\nInherits the PyO3 ``molrs.Block`` so a rich ``Block`` IS-A core block and is\naccepted by every ``molrs.*`` API with no conversion. All columns live in the\nRust Store (numpy-representable dtypes only); reads are zero-copy views.\n\nBehaves like a dict and supports advanced indexing: by key (column), by\nint/slice (row / sub-block), by boolean mask, by list of keys (2D array), and\nby any callable selector (``key(self)``).\n', '__new__': <staticmethod(<function Block.__new__ at 0x7f5598269f80>)>, '__init__': <function Block.__init__ at 0x7f559826a160>, '_backing': <function Block._backing at 0x7f559826a200>, '_as_storage': <function Block._as_storage at 0x7f559826a2a0>, 'view': <function Block.view at 0x7f559826a340>, 'insert': <function Block.insert at 0x7f559826a3e0>, 'remove': <function Block.remove at 0x7f559826a480>, 'dtype': <function Block.dtype at 0x7f559826a520>, '__getitem__': <function Block.__getitem__ at 0x7f559826a8e0>, '__setitem__': <function Block.__setitem__ at 0x7f559826a980>, '__delitem__': <function Block.__delitem__ at 0x7f559826aa20>, '__iter__': <function Block.__iter__ at 0x7f559826aac0>, '__len__': <function Block.__len__ at 0x7f559826ab60>, '__contains__': <function Block.__contains__ at 0x7f559826ac00>, 'keys': <function Block.keys at 0x7f559826aca0>, '_view_array': <function Block._view_array at 0x7f559826ad40>, '_as_dict': <function Block._as_dict at 0x7f559826ade0>, 'to_dict': <function Block.to_dict at 0x7f559826ae80>, 'from_dict': <classmethod(<function Block.from_dict at 0x7f559826af20>)>, 'from_csv': <classmethod(<function Block.from_csv at 0x7f559826afc0>)>, 'to_csv': <function Block.to_csv at 0x7f559826b060>, 'copy': <function Block.copy at 0x7f559826b100>, 'rename': <function Block.rename at 0x7f559826b1a0>, 'sort': <function Block.sort at 0x7f559826b240>, 'sort_': <function Block.sort_ at 0x7f559826b2e0>, '__repr__': <function Block.__repr__ at 0x7f559826b380>, 'nrows': <property object at 0x7f559a146840>, 'shape': <property object at 0x7f559a147a60>, 'iterrows': <function Block.iterrows at 0x7f559826b560>, 'itertuples': <function Block.itertuples at 0x7f559826b600>, '__static_attributes__': ('_source',), '__orig_bases__': (<class 'molrs.Block'>, collections.abc.MutableMapping[str, numpy.ndarray]), '__dict__': <attribute '__dict__' of 'Block' objects>, '__weakref__': <attribute '__weakref__' of 'Block' objects>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object at 0x7f559a1b0280>}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'Tidy columnar table mapping name -> 1D/2D numpy column.\n\nInherits the PyO3 ``molrs.Block`` so a rich ``Block`` IS-A core block and is\naccepted by every ``molrs.*`` API with no conversion. All columns live in the\nRust Store (numpy-representable dtypes only); reads are zero-copy views.\n\nBehaves like a dict and supports advanced indexing: by key (column), by\nint/slice (row / sub-block), by boolean mask, by list of keys (2D array), and\nby any callable selector (``key(self)``).\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'.

__firstlineno__ = 45 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.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'.

__orig_bases__ = (<class 'molrs.Block'>, collections.abc.MutableMapping[str, numpy.ndarray]) 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.

__static_attributes__ = ('_source',) 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

nrows property

Number of rows (0 if empty).

shape property

(nrows, ncols), or () when empty.

copy()

Deep copy (data copied into a new Rust Store).

from_csv(source, *, delimiter=',', encoding='utf-8', header=None, skipinitialspace=False) classmethod

Create a Block from CSV.

The CSV grammar + per-column dtype inference (int → float → str) is implemented in the molrs Rust core; this wrapper only resolves source (text, a file path, or a StringIO) to text and adopts the parsed core block as a rich :class:Block.

Parameters:

Name Type Description Default
skipinitialspace bool

When True, runs of the delimiter are collapsed so whitespace-aligned columns (e.g. LAMMPS data sections) parse cleanly. The core also trims each field; combined, leading and repeated delimiters never produce spurious empty columns.

False

from_dict(data) classmethod

Build a Block from a dict, or alias a bare molrs.Block.

An already-rich Block is returned as-is. A bare molrs.Block is aliased (the returned block routes reads/writes through it — a live view of its storage, used for the frame[key][col] = arr write-through).

iterrows(n=None)

Yield (index, row_dict) for each row.

itertuples(index=True, name='Row')

Yield a named tuple per row.

keys()

All column names.

rename(old_key, new_key)

Rename a column in place. Raises KeyError if old_key is absent.

sort(key, *, reverse=False)

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

The argsort + per-column gather runs in the Rust core (molrs.Block.sort); this is a thin call, not a NumPy reimplementation.

sort_(key, *, reverse=False)

Sort the block in place by key; returns self.

to_csv(filepath=None, *, delimiter=',', header=True, encoding='utf-8')

Serialize the block to CSV (inverse of :meth:from_csv).

CSV serialization lives in the molrs Rust core; this wrapper only writes the produced text to filepath (returning None) or returns it as a string when filepath is None.

to_dict()

Return each column as a numpy array (views into Rust memory).

Frame

Bases: molrs.Frame

Container of named :class:Block tables plus a box and metadata.

Inherits the PyO3 molrs.Frame: a rich Frame IS-A core frame, accepted by every molrs.* API with no conversion. __getitem__ upgrades the stored block to a rich :class:Block. The box is the native molrs.Box (inherited). Frame has no CSV methods — CSV belongs to Block.

__dict__ = mappingproxy({'__module__': 'molrs.frame', '__firstlineno__': 412, '__doc__': 'Container of named :class:`Block` tables plus a box and metadata.\n\nInherits the PyO3 ``molrs.Frame``: a rich ``Frame`` IS-A core frame, accepted\nby every ``molrs.*`` API with no conversion. ``__getitem__`` upgrades the\nstored block to a rich :class:`Block`. The ``box`` is the native\n``molrs.Box`` (inherited). Frame has no CSV methods — CSV belongs to Block.\n', '__new__': <staticmethod(<function Frame.__new__ at 0x7f559826b740>)>, '__init__': <function Frame.__init__ at 0x7f559826b7e0>, '__getitem__': <function Frame.__getitem__ at 0x7f559826b880>, '__setitem__': <function Frame.__setitem__ at 0x7f559826b920>, '__delitem__': <function Frame.__delitem__ at 0x7f559826b9c0>, '__contains__': <function Frame.__contains__ at 0x7f559826ba60>, '__len__': <function Frame.__len__ at 0x7f559826bb00>, 'keys': <function Frame.keys at 0x7f559826bba0>, '_blocks': <property object at 0x7f559a1477e0>, 'blocks': <property object at 0x7f559a1476a0>, 'to_dict': <function Frame.to_dict at 0x7f559826bd80>, 'from_dict': <classmethod(<function Frame.from_dict at 0x7f559826be20>)>, '_from_ffi_frameref_capsule': <classmethod(<function Frame._from_ffi_frameref_capsule at 0x7f559826bec0>)>, 'copy': <function Frame.copy at 0x7f559826bf60>, '__repr__': <function Frame.__repr__ at 0x7f559826c040>, '__static_attributes__': ('meta',), '__dict__': <attribute '__dict__' of 'Frame' objects>, '__weakref__': <attribute '__weakref__' of 'Frame' objects>}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'Container of named :class:`Block` tables plus a box and metadata.\n\nInherits the PyO3 ``molrs.Frame``: a rich ``Frame`` IS-A core frame, accepted\nby every ``molrs.*`` API with no conversion. ``__getitem__`` upgrades the\nstored block to a rich :class:`Block`. The ``box`` is the native\n``molrs.Box`` (inherited). Frame has no CSV methods — CSV belongs to Block.\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'.

__firstlineno__ = 412 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.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'.

__static_attributes__ = ('meta',) 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

blocks property

Iterate over the stored blocks (as rich Blocks).

__getitem__(key)

Return the named block as a rich :class:Block (live view).

copy()

Deep copy (blocks copied into new storage; box + metadata copied).

from_dict(data) classmethod

Build a Frame from a dict, or upgrade a bare molrs.Frame.

to_dict()

Frame as {"blocks": {name: block.to_dict()}, "meta": {...}}.

Topology and SMILES

Atomistic

Bases: molrs.Atomistic, molrs.views.GraphViews

Public all-atom graph with live node and relation views.

The native PyO3 leaf remains the storage owner and first base. This class contributes factories and handle views only; native algorithms continue to accept it directly because it is an _RsAtomistic subclass.

__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.views', '__firstlineno__': 579, '__doc__': 'Public all-atom graph with live node and relation views.\n\nThe native PyO3 leaf remains the storage owner and first base. This class\ncontributes factories and handle views only; native algorithms continue to\naccept it directly because it is an ``_RsAtomistic`` subclass.\n', '_node_cls': <class 'molrs.views.Atom'>, '_relation_classes': {'bonds': <class 'molrs.views.Bond'>, 'angles': <class 'molrs.views.Angle'>, 'dihedrals': <class 'molrs.views.Dihedral'>, 'impropers': <class 'molrs.views.Improper'>}, '__init__': <function Atomistic.__init__ at 0x7f559829c7c0>, 'atoms': <property object at 0x7f559828fa60>, 'bonds': <property object at 0x7f559828fab0>, 'angles': <property object at 0x7f559828fb00>, 'dihedrals': <property object at 0x7f559828fb50>, 'impropers': <property object at 0x7f559828fba0>, 'def_atom': <function Atomistic.def_atom at 0x7f559829cb80>, 'def_virtual_site': <function Atomistic.def_virtual_site at 0x7f559829cc20>, 'def_bond': <function Atomistic.def_bond at 0x7f559829ccc0>, 'def_angle': <function Atomistic.def_angle at 0x7f559829cd60>, 'def_dihedral': <function Atomistic.def_dihedral at 0x7f559829ce00>, 'def_improper': <function Atomistic.def_improper at 0x7f559829cea0>, 'del_atom': <function Atomistic.del_atom at 0x7f559829cf40>, 'remove_link': <function Atomistic.remove_link at 0x7f559829cfe0>, '__static_attributes__': (), '__dict__': <attribute '__dict__' of 'Atomistic' objects>, '__weakref__': <attribute '__weakref__' of 'Atomistic' objects>, '__annotations__': {}}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'Public all-atom graph with live node and relation views.\n\nThe native PyO3 leaf remains the storage owner and first base. This class\ncontributes factories and handle views only; native algorithms continue to\naccept it directly because it is an ``_RsAtomistic`` subclass.\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'.

__firstlineno__ = 579 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.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'.

__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

CoarseGrain

Bases: molrs.CoarseGrain, molrs.views.GraphViews

Public coarse-grained graph with live bead and bond views.

__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.views', '__firstlineno__': 665, '__doc__': 'Public coarse-grained graph with live bead and bond views.', '_node_cls': <class 'molrs.views.Bead'>, '_relation_classes': {'bonds': <class 'molrs.views.CGBond'>}, '__init__': <function CoarseGrain.__init__ at 0x7f559829d1c0>, 'beads': <property object at 0x7f559828fc90>, 'cgbonds': <property object at 0x7f559828fce0>, 'def_bead': <function CoarseGrain.def_bead at 0x7f559829d3a0>, '_set_bead_atoms': <function CoarseGrain._set_bead_atoms at 0x7f559829d440>, '_resolve_bead_atoms': <function CoarseGrain._resolve_bead_atoms at 0x7f559829d4e0>, 'def_cgbond': <function CoarseGrain.def_cgbond at 0x7f559829d580>, 'del_bead': <function CoarseGrain.del_bead at 0x7f559829d620>, 'remove_link': <function CoarseGrain.remove_link at 0x7f559829d6c0>, '__static_attributes__': ('_member_world',), '__dict__': <attribute '__dict__' of 'CoarseGrain' objects>, '__weakref__': <attribute '__weakref__' of 'CoarseGrain' objects>, '__annotations__': {}}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'Public coarse-grained graph with live bead and bond 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'.

__firstlineno__ = 665 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.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'.

__static_attributes__ = ('_member_world',) 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

Graph

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

__doc__ = 'Domain-agnostic ECS world, exposed to Python as `molrs.Graph`.' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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 entities.

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

add_relation(kind, nodes) method descriptor

Add a relation of kind over node handles, returning its handle.

adopt(other) method descriptor

Zero-copy adopt: move other's graph storage into self, leaving other empty. Handles in the adopted graph stay valid (the whole generational slotmap is moved, not reindexed). For taking ownership of a graph produced elsewhere without a per-node copy. Defined per leaf so it swaps the leaf's own backing store.

column(key) method descriptor

Zero-copy numpy view of the f64 component column key, aligned to row order (length == n_nodes). Writes through to the world: col[i] = v updates the entity at row i.

The view borrows the world's storage; structural mutation (spawn/despawn) may reallocate or reorder the column and invalidate an outstanding view — re-fetch after such ops.

delete(h, key) method descriptor

Clear entity h's component key (no-op if absent).

delete_relation_prop(kind, rh, key) method descriptor

Clear property key on relation rh of kind (no-op if absent).

despawn(h) method descriptor

Remove an entity (cascades incident relations). Errors if stale.

entities() method descriptor

All live entity handles, in row order.

get(h, key) method descriptor

Read entity h's component key (None if absent).

get_relation_prop(kind, rh, key) method descriptor

Read a property of relation rh of kind (None if absent).

has(h, key) method descriptor

Whether entity h has component key.

has_entity(h) method descriptor

Whether h is a live entity handle.

incident_relations(nh, kind) method descriptor

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

kinds() method descriptor

Names of all registered relation kinds.

n_relations(kind) method descriptor

Number of relations of kind.

node_keys(h) method descriptor

Component keys currently set on entity h, in column 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.

relation_keys(kind, rh) method descriptor

Property keys currently set on relation rh of kind.

relation_nodes(kind, rh) method descriptor

Endpoint node handles of relation rh of kind.

remove_relation(kind, rh) method descriptor

Remove relation rh of kind.

set(h, key, value) method descriptor

Set entity h's component key (value is int|float|str).

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

Set a property on relation rh of kind.

spawn() method descriptor

Spawn a new entity, returning its stable handle.

validity(key) method descriptor

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

SmilesIR

Intermediate representation of a parsed SMILES or SMARTS string.

This is the raw syntax tree produced by the parser. Convert it to a molecular graph via :meth:to_atomistic.

Attributes

n_components : int Number of disconnected components (fragments separated by '.' in the SMILES string).

Examples

ir = molrs.parse_smiles("CCO") ir.n_components 1 mol = ir.to_atomistic() mol.n_atoms 3

__doc__ = 'Intermediate representation of a parsed SMILES or SMARTS string.\n\nThis is the raw syntax tree produced by the parser. Convert it to a\nmolecular graph via :meth:`to_atomistic`.\n\nAttributes\n----------\nn_components : int\n Number of disconnected components (fragments separated by ``\'.\'``\n in the SMILES string).\n\nExamples\n--------\n>>> ir = molrs.parse_smiles("CCO")\n>>> ir.n_components\n1\n>>> mol = ir.to_atomistic()\n>>> mol.n_atoms\n3' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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 disconnected molecular components.

Fragments separated by '.' in the SMILES string are counted as separate components.

Returns

int

__repr__() method descriptor

Return repr(self).

to_atomistic() method descriptor

Convert the SMILES intermediate representation to an all-atom molecular graph.

Hydrogen atoms that are implicit in the SMILES string are not added here; use :class:Conformer with add_hydrogens=True for that.

Returns

Atomistic Molecular graph with atoms and bonds.

Raises

ValueError If the IR contains invalid ring-closure or stereochemistry data.

Examples

mol = parse_smiles("c1ccccc1").to_atomistic() mol.n_atoms 6

parse_smiles(smiles) builtin

Parse a SMILES string into an intermediate representation.

The returned :class:SmilesIR can be converted to an :class:Atomistic molecular graph via :meth:SmilesIR.to_atomistic.

Parameters

smiles : str SMILES string (e.g. "CCO" for ethanol, "c1ccccc1" for benzene).

Returns

SmilesIR Parsed intermediate representation.

Raises

ValueError If the SMILES string is syntactically invalid.

Examples

ir = molrs.parse_smiles("CCO") mol = ir.to_atomistic() mol.n_atoms 3

Chemistry Perception

perceive_aromaticity(mol) builtin

Perceive aromaticity in place; returns the number of aromatic atoms found. A chemistry system — operates on an Atomistic leaf.

find_rings(mol) builtin

Find all SSSR rings; returns each ring as a list of atom handles. A chemistry system — operates on an Atomistic leaf.

add_hydrogens(mol) builtin

Add explicit hydrogens, returning a new Atomistic (chemistry system).

compute_gasteiger_charges(mol) builtin

Compute Gasteiger/PEOE partial charges; returns (atom_handle, charge) for every atom, hydrogens included. A chemistry system — operates on an Atomistic leaf.

Delegates to molrs's one Gasteiger, ff::charge::GasteigerModel (antechamber -c gas). Three things changed with it, all of them things the previous RDKit-port signature promised and this model does not have:

  • no n_iter — the loop runs to convergence (antechamber's CONVERG 1e-5, GASMAXITER 500). A sweep count is not a knob; the damping is geometric, so where the loop stops IS the answer, and the old default of 6 stops 0.0131 e short on methylammonium.
  • no h_charge — hydrogens are atoms, with their own charge and their own entry. The model has no notion of an implicit hydrogen.
  • it can fail — an atom ATOMTYPE_GAS.DEF cannot type has no charge, and raises, rather than silently taking a fallback of zero.

Transforms

rotate(mol, axis, angle, about=None) builtin

Rotate node coordinates by angle radians about axis (optionally about a point — defaults to the origin). Generic geometry system.

translate(mol, delta) builtin

Translate every node's coordinates by delta (generic geometry system).

scale(mol, factor, about=None) builtin

Scale node coordinates by a per-axis factor about an optional center (defaults to the origin). Pass [s, s, s] for a uniform scale. Generic geometry system.

I/O

read_pdb(path) builtin

Read a PDB file and return a Frame.

The resulting frame contains an "atoms" block with columns symbol (str), x/y/z (float), name (str), resname (str), and resid (int). If CRYST1 records are present a Box is also attached.

Parameters

path : str Path to a .pdb file on disk.

Returns

Frame Parsed molecular data.

Raises

IOError If the file cannot be opened or parsed.

Examples

frame = molrs.read_pdb("molecule.pdb") atoms = frame["atoms"] symbols = atoms.view("symbol")

read_xyz(path) builtin

Read an XYZ file and return a single Frame.

Parameters

path : str Path to a .xyz file on disk.

Returns

Frame

read_xyz_trajectory(path) builtin

Read all frames from an XYZ trajectory file.

Parameters

path : str Path to a multi-frame .xyz file.

Returns

list[Frame]

read_lammps(path) builtin

Read a LAMMPS data file and return a Frame.

Parameters

path : str Path to a LAMMPS data file on disk.

Returns

Frame Parsed molecular data with atoms, bonds, and box metadata.

Raises

IOError If the file cannot be opened or parsed.

Examples

frame = molrs.read_lammps_data("system.data") atoms = frame["atoms"]

read_lammps_traj(path) builtin

Read a LAMMPS dump trajectory file and return a list of Frames.

Parameters

path : str Path to a LAMMPS dump file (e.g. .lammpstrj) on disk.

Returns

list[Frame] All frames in the trajectory.

Raises

IOError If the file cannot be opened or parsed.

Examples

frames = molrs.read_lammps_dump("trajectory.lammpstrj") len(frames) 100

LAMMPSTrajReader

Lazy, indexed reader for LAMMPS dump trajectory files.

Unlike :func:read_lammps_traj, this does not parse every frame upfront. The underlying file stays open and frames are parsed on demand via byte-offset seeks. Random access (reader[i], read_step(i)) triggers a one-time index scan for ITEM: TIMESTEP markers; subsequent accesses are O(1) seeks plus one frame parse.

Use this for long trajectories where you only need a subset of frames or want to walk lazily without holding all frames in memory.

Parameters

path : str Path to a LAMMPS dump file (.lammpstrj). Gzip files are auto-detected by extension and decompressed into memory.

Examples

reader = molrs.LAMMPSTrajReader("trajectory.lammpstrj") len(reader) 1000 frame = reader[42] for frame in reader: ... pass

__doc__ = 'Lazy, indexed reader for LAMMPS dump trajectory files.\n\nUnlike :func:`read_lammps_traj`, this does **not** parse every frame\nupfront. The underlying file stays open and frames are parsed on demand\nvia byte-offset seeks. Random access (``reader[i]``, ``read_step(i)``)\ntriggers a one-time index scan for ``ITEM: TIMESTEP`` markers; subsequent\naccesses are O(1) seeks plus one frame parse.\n\nUse this for long trajectories where you only need a subset of frames\nor want to walk lazily without holding all frames in memory.\n\nParameters\n----------\npath : str\n Path to a LAMMPS dump file (``.lammpstrj``). Gzip files are\n auto-detected by extension and decompressed into memory.\n\nExamples\n--------\n>>> reader = molrs.LAMMPSTrajReader("trajectory.lammpstrj")\n>>> len(reader)\n1000\n>>> frame = reader[42]\n>>> for frame in reader:\n... pass' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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 in the trajectory (triggers index construction).

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Force the byte-offset index to be built now.

The index is built lazily on the first call to __len__, __getitem__, or read_step. Call this explicitly to amortize the cost upfront — useful when timing only the random-access path.

close() method descriptor

Release the underlying file handle. Further reads raise ValueError.

read_all() method descriptor

Eagerly read every frame into a list.

read_frame(index) method descriptor

Read a single frame by index (supports negative indexing).

Raises IndexError if out of range. molpy-aligned.

read_frames(indices) method descriptor

Read an explicit list of frame indices (each may be negative).

read_range(start=0, stop=None, step=1) method descriptor

Read a contiguous range of frames, Python-slice style.

read_dcd(path) builtin

Read every frame of a DCD trajectory file and return a list of Frames.

DCD is the binary trajectory format used by CHARMM, NAMD, and LAMMPS. Each frame contains an "atoms" block with x/y/z columns (Å). Unit-cell information, when present, is stored in frame.box; per-frame timestep/delta (and the file title) are recorded in frame.meta.

For long trajectories where only a subset of frames is needed, prefer the lazy :class:DCDTrajReader, which seeks frame-by-frame instead of loading everything into memory.

Parameters

path : str Path to a .dcd file on disk.

Returns

list[Frame] All frames in the trajectory.

Raises

IOError If the file cannot be opened or parsed.

Examples

frames = molrs.read_dcd("trajectory.dcd") len(frames) 100 frames[0]["atoms"].view("x")

DCDTrajReader

Lazy, indexed reader for DCD trajectory files.

Unlike :func:read_dcd, this does not load every frame upfront. The underlying file stays open and frames are parsed on demand via byte-offset seeks computed from the DCD header. The header is parsed lazily on the first call to __len__, __getitem__, or read_step (or eagerly via build_index()); subsequent random access (reader[i], read_step(i)) is an O(1) seek plus one frame parse.

Use this for long trajectories where you only need a subset of frames or want to walk lazily without holding all frames in memory.

Parameters

path : str Path to a .dcd file.

Examples

reader = molrs.DCDTrajReader("trajectory.dcd") len(reader) 1000 frame = reader[42] for frame in reader: ... pass

__doc__ = 'Lazy, indexed reader for DCD trajectory files.\n\nUnlike :func:`read_dcd`, this does **not** load every frame upfront. The\nunderlying file stays open and frames are parsed on demand via byte-offset\nseeks computed from the DCD header. The header is parsed lazily on the\nfirst call to ``__len__``, ``__getitem__``, or ``read_step`` (or eagerly\nvia ``build_index()``); subsequent random access (``reader[i]``,\n``read_step(i)``) is an O(1) seek plus one frame parse.\n\nUse this for long trajectories where you only need a subset of frames or\nwant to walk lazily without holding all frames in memory.\n\nParameters\n----------\npath : str\n Path to a ``.dcd`` file.\n\nExamples\n--------\n>>> reader = molrs.DCDTrajReader("trajectory.dcd")\n>>> len(reader)\n1000\n>>> frame = reader[42]\n>>> for frame in reader:\n... pass' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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 in the trajectory (triggers header parsing).

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Force the DCD header to be parsed now.

The header is parsed lazily on the first call to __len__, __getitem__, or read_step. Call this explicitly to amortize the cost upfront — useful when timing only the random-access path.

close() method descriptor

Release the underlying file handle. Further reads raise ValueError.

read_all() method descriptor

Eagerly read every frame into a list.

read_frame(index) method descriptor

Read a single frame by index (supports negative indexing).

Raises IndexError if out of range. molpy-aligned.

read_frames(indices) method descriptor

Read an explicit list of frame indices (each may be negative).

read_range(start=0, stop=None, step=1) method descriptor

Read a contiguous range of frames, Python-slice style.

XYZTrajReader

Lazy, indexed reader for multi-frame XYZ trajectory files.

The molrs-native counterpart to :func:read_xyz_trajectory (which eagerly returns list[Frame]). Frames are parsed on demand; the frame-offset index is built lazily on first random access or eagerly via build_index().

Exposes the same molpy BaseTrajectoryReader surface as :class:DCDTrajReader and :class:LAMMPSTrajReader: read_frame, read_frames, read_range, read_all, n_frames, slicing, close(), and context-manager use.

Parameters

path : str Path to a multi-frame .xyz file.

Examples

reader = molrs.XYZTrajReader("traj.xyz") reader.n_frames 50 reader[-1]["atoms"].view("x")

__doc__ = 'Lazy, indexed reader for multi-frame XYZ trajectory files.\n\nThe molrs-native counterpart to :func:`read_xyz_trajectory` (which eagerly\nreturns ``list[Frame]``). Frames are parsed on demand; the frame-offset\nindex is built lazily on first random access or eagerly via\n``build_index()``.\n\nExposes the same molpy ``BaseTrajectoryReader`` surface as\n:class:`DCDTrajReader` and :class:`LAMMPSTrajReader`: ``read_frame``,\n``read_frames``, ``read_range``, ``read_all``, ``n_frames``, slicing,\n``close()``, and context-manager use.\n\nParameters\n----------\npath : str\n Path to a multi-frame ``.xyz`` file.\n\nExamples\n--------\n>>> reader = molrs.XYZTrajReader("traj.xyz")\n>>> reader.n_frames\n50\n>>> reader[-1]["atoms"].view("x")' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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 in the trajectory (triggers index construction).

__getitem__(key) method descriptor

Return self[key].

__iter__() method descriptor

Implement iter(self).

__len__() method descriptor

Return len(self).

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__next__() method descriptor

Implement next(self).

__repr__() method descriptor

Return repr(self).

build_index() method descriptor

Force the frame-offset index to be built now.

close() method descriptor

Release the underlying file handle. Further reads raise ValueError.

read_all() method descriptor

Eagerly read every frame into a list.

read_frame(index) method descriptor

Read a single frame by index (supports negative indexing).

Raises IndexError if out of range. molpy-aligned.

read_frames(indices) method descriptor

Read an explicit list of frame indices (each may be negative).

read_range(start=0, stop=None, step=1) method descriptor

Read a contiguous range of frames, Python-slice style.

read_gro(path) builtin

Read all frames from a GROMACS GRO file.

GRO is a fixed-column text format used by GROMACS for input structures and single-precision trajectories. Each frame contains an "atoms" block with columns resid, resname, atom_name, atom_id, x/y/z (in nm), and optional vx/vy/vz. The simulation box is stored in frame.box.

Parameters

path : str Path to a .gro file on disk.

Returns

list[Frame] All frames in the file (single-frame files return a one-element list).

Raises

IOError If the file cannot be opened or parsed.

Examples

frames = molrs.read_gro("system.gro") frame = frames[0] atoms = frame["atoms"] atoms.view("atom_name")

read_chgcar_file(path) builtin

Read a VASP CHGCAR or CHGDIF file.

Returns a Frame containing:

  • "atoms" block with symbol, x, y, z (Cartesian Å)
  • box: triclinic periodic box
  • grid "chgcar": a :class:Grid with at least "total" (and "diff" for spin-polarised ISPIN=2 calculations)

The volumetric values are stored raw (ρ × V_cell, units e). Divide by simbox.volume() to get charge density in e/ų.

Parameters

path : str Path to a CHGCAR or CHGDIF file.

Returns

Frame

Raises

ValueError On parse errors. IOError If the file cannot be opened.

Examples

frame = molrs.read_chgcar("CHGCAR") grid = frame["chgcar"] total = grid["total"] # shape (nx, ny, nz) density = total / frame.box.volume()

read_cube_file(path) builtin

Read a Gaussian Cube file.

Returns a Frame containing:

  • "atoms" block with element, x, y, z, atomic_number, charge
  • grid "cube": a :class:Grid with "density" (scalar field) or "mo_<idx>" arrays (MO variant)

Values are stored as-is from the file (no unit conversion). The unit system is recorded in frame.meta["cube_units"] ("bohr" or "angstrom").

Parameters

path : str Path to a .cube file.

Returns

Frame

Raises

ValueError On parse errors. IOError If the file cannot be opened.

Examples

frame = molrs.read_cube_file("density.cube") grid = frame["cube"] density = grid["density"] # shape (nx, ny, nz)

write_cube_file(path, frame) builtin

Write a Frame to a Gaussian Cube file.

The Frame must contain a "cube" grid and an "atoms" block.

Parameters

path : str Output file path. frame : Frame Frame to write.

write_pdb(path, frame) builtin

Write a Frame to a PDB file.

Parameters

path : str Output file path. frame : Frame Frame to write.

write_xyz(path, frame) builtin

Write a Frame to an XYZ file.

Parameters

path : str Output file path. frame : Frame Frame to write.

write_lammps(path, frame) builtin

Write a Frame to a LAMMPS data file.

Parameters

path : str Output file path. frame : Frame Frame to write.

write_lammps_traj(path, frames) builtin

Write Frames to a LAMMPS dump trajectory file.

Parameters

path : str Output file path. frames : list[Frame] Frames to write.

Sphere

Solid sphere region.

Exposed to Python as molrs.Sphere.

Supports Boolean composition: & (AND), | (OR), ~ (NOT).

Parameters

center : numpy.ndarray, shape (3,), dtype float Center of the sphere. radius : float Radius of the sphere.

Examples

s = Sphere(np.array([0, 0, 0]), 5.0) mask = s.contains(points) region = s & ~Sphere(np.array([0, 0, 0]), 2.0) # shell

__doc__ = 'Solid sphere region.\n\nExposed to Python as `molrs.Sphere`.\n\nSupports Boolean composition: ``&`` (AND), ``|`` (OR), ``~`` (NOT).\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>>> region = s & ~Sphere(np.array([0, 0, 0]), 2.0) # shell' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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.

__invert__() method descriptor

~self

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__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 of this sphere.

Returns

numpy.ndarray, shape (3, 2), dtype float [[xmin, xmax], [ymin, ymax], [zmin, zmax]].

contains(points) method descriptor

Test which points are inside this sphere.

Parameters

points : numpy.ndarray, shape (N, 3), dtype float Test points.

Returns

numpy.ndarray, shape (N,), dtype bool True for points inside the sphere.

Raises

ValueError If points does not have 3 columns.

HollowSphere

Hollow sphere (spherical shell) region.

Exposed to Python as molrs.HollowSphere.

A point is inside if its distance from the center is between inner_radius and outer_radius.

Parameters

center : numpy.ndarray, shape (3,), dtype float Center of the spherical shell. inner_radius : float Inner radius. outer_radius : float Outer radius.

Examples

shell = HollowSphere(np.array([0,0,0]), 3.0, 5.0) mask = shell.contains(points)

__doc__ = 'Hollow sphere (spherical shell) region.\n\nExposed to Python as `molrs.HollowSphere`.\n\nA point is inside if its distance from the center is between\n``inner_radius`` and ``outer_radius``.\n\nParameters\n----------\ncenter : numpy.ndarray, shape (3,), dtype float\n Center of the spherical shell.\ninner_radius : float\n Inner radius.\nouter_radius : float\n Outer radius.\n\nExamples\n--------\n>>> shell = HollowSphere(np.array([0,0,0]), 3.0, 5.0)\n>>> mask = 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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.

__invert__() method descriptor

~self

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__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 of the outer sphere.

Returns

numpy.ndarray, shape (3, 2), dtype float

contains(points) method descriptor

Test which points are inside this spherical shell.

Parameters

points : numpy.ndarray, shape (N, 3), dtype float Test points.

Returns

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

Raises

ValueError If points does not have 3 columns.

Cuboid

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

A point is inside when origin[d] <= p[d] <= origin[d] + lengths[d] on every axis. Supports & / | / ~ composition like the other regions.

__doc__ = 'Axis-aligned cuboid (box) region, exposed to Python as `molrs.Cuboid`.\n\nA point is inside when `origin[d] <= p[d] <= origin[d] + lengths[d]` on\nevery axis. Supports `&` / `|` / `~` composition like the other regions.' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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.

__invert__() method descriptor

~self

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__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): [[min, max], ...] per axis.

contains(points) method descriptor

Test which points are inside this cuboid (shape (N,3) -> (N,) bool).

Region

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

Exposed to Python as molrs.Region.

Cannot be constructed directly. Use Boolean operators on :class:Sphere, :class:HollowSphere, or other Region instances.

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.Region`.\n\nCannot be constructed directly. Use Boolean operators on :class:`Sphere`,\n:class:`HollowSphere`, or other `Region` instances.\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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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.

__invert__() method descriptor

~self

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__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 of this region.

Returns

numpy.ndarray, shape (3, 2), dtype float

contains(points) method descriptor

Test which points are inside this composed region.

Parameters

points : numpy.ndarray, shape (N, 3), dtype float Test points.

Returns

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

Raises

ValueError If points does not have 3 columns.

LinkedCell

Link-cell neighbor list (legacy API), exposed to Python as molrs.LinkedCell.

This is a backward-compatible wrapper around the Rust LinkCell. For new code, prefer :class:NeighborQuery.

Parameters

points : numpy.ndarray, shape (N, 3), dtype float Particle positions. cutoff : float Cutoff radius for neighbor search. box : Box Simulation box for periodic boundary handling.

Examples

lc = LinkedCell(positions, cutoff=3.0, box=simbox) pairs = lc.pairs() # (M, 2) int64 array lc.update(new_positions, box=simbox)

__doc__ = 'Link-cell neighbor list (legacy API), exposed to Python as\n`molrs.LinkedCell`.\n\nThis is a backward-compatible wrapper around the Rust `LinkCell`.\nFor new code, prefer :class:`NeighborQuery`.\n\nParameters\n----------\npoints : numpy.ndarray, shape (N, 3), dtype float\n Particle positions.\ncutoff : float\n Cutoff radius for neighbor search.\nbox : Box\n Simulation box for periodic boundary handling.\n\nExamples\n--------\n>>> lc = LinkedCell(positions, cutoff=3.0, box=simbox)\n>>> pairs = lc.pairs() # (M, 2) int64 array\n>>> lc.update(new_positions, box=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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

pairs() method descriptor

Compute unique neighbor pairs (i < j) within cutoff.

Returns

numpy.ndarray, shape (M, 2), dtype int64 Array of index pairs [i, j].

Raises

ValueError On internal shape error (should not happen).

update(points, box) method descriptor

Rebuild the neighbor list with new positions.

Parameters

points : numpy.ndarray, shape (N, 3), dtype float New particle positions. box : Box Simulation box (may have changed).

Raises

ValueError If points does not have 3 columns.

NeighborQuery

Spatial neighbor query (freud-style API).

Exposed to Python as molrs.NeighborQuery.

Build a spatial index from reference points and a simulation box, then query for neighbors within cutoff.

Parameters

box : Box Simulation box describing geometry and periodic boundaries. points : numpy.ndarray, shape (N, 3), dtype float Reference point positions in Cartesian coordinates. cutoff : float Cutoff radius for neighbor search (same unit as coordinates).

Examples

nq = NeighborQuery(box, positions, cutoff=3.0) nlist = nq.query(query_positions) # cross-query nlist = nq.query_self() # self-query (unique pairs)

__doc__ = 'Spatial neighbor query (freud-style API).\n\nExposed to Python as `molrs.NeighborQuery`.\n\nBuild a spatial index from reference points and a simulation box, then\nquery for neighbors within cutoff.\n\nParameters\n----------\nbox : Box\n Simulation box describing geometry and periodic boundaries.\npoints : numpy.ndarray, shape (N, 3), dtype float\n Reference point positions in Cartesian coordinates.\ncutoff : float\n Cutoff radius for neighbor search (same unit as coordinates).\n\nExamples\n--------\n>>> nq = NeighborQuery(box, positions, cutoff=3.0)\n>>> nlist = nq.query(query_positions) # cross-query\n>>> nlist = nq.query_self() # self-query (unique 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

free(points, cutoff) staticmethod

Build a free-boundary spatial index from reference points.

The non-periodic bounding box is derived from the point cloud, so the caller does not need to manufacture a simulation box for selections or other isolated-coordinate queries.

query(query_points) method descriptor

Find all neighbor pairs between query points and reference points.

A pair (i, j) means query point i is within cutoff of reference point j.

Parameters

query_points : numpy.ndarray, shape (M, 3), dtype float Query point positions.

Returns

NeighborList Neighbor pairs with distances.

Raises

ValueError If query_points does not have 3 columns.

query_self() method descriptor

Find unique neighbor pairs within the reference point set.

Only pairs i < j are returned to avoid double-counting.

Returns

NeighborList Unique neighbor pairs with distances.

NeighborList

Result of a neighbor query, holding all pairs within cutoff.

Exposed to Python as molrs.NeighborList.

Each pair (i, j) represents a neighbor relationship where i is the query-point index and j is the reference-point index. For self-queries only unique pairs i < j are stored.

Attributes

query_point_indices : numpy.ndarray[uint32] Query-point index per pair. point_indices : numpy.ndarray[uint32] Reference-point index per pair. distances : numpy.ndarray[float] Euclidean distance per pair. dist_sq : numpy.ndarray[float] Squared distance per pair. n_pairs : int Total number of neighbor pairs. num_points : int Number of reference points. num_query_points : int Number of query points. is_self_query : bool True if this list was built from a self-query.

Examples

nlist = aabb.query_self() nlist.n_pairs 42 nlist.distances # numpy float array

__doc__ = 'Result of a neighbor query, holding all pairs within cutoff.\n\nExposed to Python as `molrs.NeighborList`.\n\nEach pair ``(i, j)`` represents a neighbor relationship where ``i`` is the\nquery-point index and ``j`` is the reference-point index. For self-queries\nonly unique pairs ``i < j`` are stored.\n\nAttributes\n----------\nquery_point_indices : numpy.ndarray[uint32]\n Query-point index per pair.\npoint_indices : numpy.ndarray[uint32]\n Reference-point index per pair.\ndistances : numpy.ndarray[float]\n Euclidean distance per pair.\ndist_sq : numpy.ndarray[float]\n Squared distance per pair.\nn_pairs : int\n Total number of neighbor pairs.\nnum_points : int\n Number of reference points.\nnum_query_points : int\n Number of query points.\nis_self_query : bool\n ``True`` if this list was built from a self-query.\n\nExamples\n--------\n>>> nlist = aabb.query_self()\n>>> nlist.n_pairs\n42\n>>> nlist.distances # numpy float 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' class-attribute

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

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

dist_sq property

Squared distances, one per pair.

Zero-copy view into the underlying Rust Vec<f64>.

Returns

numpy.ndarray, shape (n_pairs,), dtype float

distances property

Euclidean distances, one per pair.

This getter must allocate because distances are stored as squared distances internally (sqrt applied on access).

Returns

numpy.ndarray, shape (n_pairs,), dtype float

is_self_query property

Whether this list was produced by a self-query (unique pairs only).

Returns

bool

n_pairs property

Number of neighbor pairs.

Returns

int

num_points property

Number of reference points used to build this list.

Returns

int

num_query_points property

Number of query points used to build this list.

Returns

int

point_indices property

Reference-point indices, one per pair.

Zero-copy view; see [query_point_indices].

Returns

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

query_point_indices property

Query-point indices, one per pair.

Returns a zero-copy numpy view into the underlying Rust Vec<u32>. Pinned alive via numpy's .base mechanism: the returned array keeps this NeighborList alive for as long as it is referenced from Python.

Returns

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

__repr__() method descriptor

Return repr(self).

pairs() method descriptor

Return index pairs as an (M, 2) array.

Each row is [query_point_index, point_index]. This method exists for backward compatibility with code that expects an integer pair array.

Returns

numpy.ndarray, shape (n_pairs, 2), dtype int64

Raises

ValueError On internal shape error (should not happen).

3D Conformer Generation

Conformer

3D conformer generator for molecular graphs.

Exposed to Python as molrs.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

speed : str, optional Quality preset: "fast" (fewest iterations), "medium" (default), or "better" (most thorough search). add_hydrogens : bool, optional If True (default), add implicit hydrogens before generation. seed : int | None, optional Random seed for reproducibility. None uses an arbitrary seed.

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`. 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__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.

Parameters

mol : Atomistic Input molecular graph (heavy atoms and bonds).

Returns

tuple[Atomistic, ConformerReport] The molecule with generated 3D coordinates and a per-stage report.

Raises

ValueError If the molecular graph is invalid (e.g. missing element symbols).

Examples

mol = parse_smiles("CCO").to_atomistic() mol_3d, report = Conformer(speed="fast", seed=42).generate(mol) mol_3d.n_atoms # includes added hydrogens 9

ConformerStageReport

Report for a single stage of conformer generation.

Exposed to Python as molrs.ConformerStageReport.

Attributes

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.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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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.ConformerReport.

Attributes

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.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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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

list[ConformerStageReport]

warnings property

__repr__() method descriptor

Return repr(self).

Force Fields

The native force-field model exposes a Style/Type hierarchy (BondStyle/BondType, PairStyle/PairType, …) and Parameters.

ForceField

Bases: molrs.ForceField

A molrs force field with the chainable, object-style builder layer.

Subclasses the Rust :class:molrs.ForceField (inheriting def_type / types / to_potentials) and adds def_*style factories that return chainable :class:Style handles plus style/type query helpers.

__dict__ = mappingproxy({'__module__': 'molrs.forcefield', '__firstlineno__': 523, '__doc__': 'A molrs force field with the chainable, object-style builder layer.\n\nSubclasses the Rust :class:`molrs.ForceField` (inheriting ``def_type`` /\n``types`` / ``to_potentials``) and adds ``def_*style`` factories that return\nchainable :class:`Style` handles plus style/type query helpers.\n', '__init__': <function ForceField.__init__ at 0x7f559826f560>, '_from_raw': <classmethod(<function ForceField._from_raw at 0x7f559826f600>)>, 'subset': <function ForceField.subset at 0x7f559826f6a0>, 'def_atomstyle': <function ForceField.def_atomstyle at 0x7f559826f740>, 'def_bondstyle': <function ForceField.def_bondstyle at 0x7f559826f7e0>, 'def_anglestyle': <function ForceField.def_anglestyle at 0x7f559826f880>, 'def_dihedralstyle': <function ForceField.def_dihedralstyle at 0x7f559826f920>, 'def_improperstyle': <function ForceField.def_improperstyle at 0x7f559826f9c0>, 'def_pairstyle': <function ForceField.def_pairstyle at 0x7f559826fa60>, '_styles': <function ForceField._styles at 0x7f559826fb00>, 'styles': <property object at 0x7f559824d3a0>, 'get_style': <function ForceField.get_style at 0x7f559826fc40>, 'get_styles': <function ForceField.get_styles at 0x7f559826fce0>, 'get_types': <function ForceField.get_types at 0x7f559826fd80>, '_ensure_style': <function ForceField._ensure_style at 0x7f559826fe20>, 'def_style': <function ForceField.def_style at 0x7f559826fec0>, '_replay_type': <function ForceField._replay_type at 0x7f559826ff60>, 'merge': <function ForceField.merge at 0x7f5598280040>, 'rename_type': <function ForceField.rename_type at 0x7f55982800e0>, 'remove_type': <function ForceField.remove_type at 0x7f5598280180>, 'remove_style': <function ForceField.remove_style at 0x7f5598280220>, '__static_attributes__': ('units',), '__dict__': <attribute '__dict__' of 'ForceField' objects>, '__weakref__': <attribute '__weakref__' of 'ForceField' objects>}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'A molrs force field with the chainable, object-style builder layer.\n\nSubclasses the Rust :class:`molrs.ForceField` (inheriting ``def_type`` /\n``types`` / ``to_potentials``) and adds ``def_*style`` factories that return\nchainable :class:`Style` handles plus style/type query helpers.\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'.

__firstlineno__ = 523 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.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'.

__static_attributes__ = ('units',) 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

def_style(style)

Register style (an unbound :class:Style, e.g. BondHarmonicStyle()) and return a bound handle of the same class.

get_styles(category_or_cls)

Styles of a category (str) or by :class:Style subclass.

get_types(category_or_cls)

Types of a category (str) or by :class:Type subclass, across styles.

merge(other)

Merge other's styles and types into this force field (in place).

rename_type(style_cls, old, new)

Rename type old -> new across all styles of style_cls's category (molpy signature).

Style

Handle view of one style over a :class:ForceField.

__annotations__ = {'_category': 'str', '_type_cls': 'type[Type]'} 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.forcefield', '__firstlineno__': 299, '__annotations__': {'_category': 'str', '_type_cls': 'type[Type]'}, '__doc__': 'Handle view of one style over a :class:`ForceField`.', '_category': '', '_type_cls': <class 'molrs.forcefield.Type'>, '__init__': <function Style.__init__ at 0x7f559826d760>, '_name_default': <function Style._name_default at 0x7f559826e480>, 'name': <property object at 0x7f559a2a9c10>, 'category': <property object at 0x7f559a2aa250>, 'types': <property object at 0x7f559a2aa160>, 'get_types': <function Style.get_types at 0x7f559826e700>, 'get_type_by_name': <function Style.get_type_by_name at 0x7f559826e7a0>, '_finish_type': <function Style._finish_type at 0x7f559826e840>, '__hash__': <function Style.__hash__ at 0x7f559826e8e0>, '__eq__': <function Style.__eq__ at 0x7f559826e980>, '__repr__': <function Style.__repr__ at 0x7f559826ea20>, '__static_attributes__': ('_ff', '_name'), '__dict__': <attribute '__dict__' of 'Style' objects>, '__weakref__': <attribute '__weakref__' of 'Style' objects>}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'Handle view of one style over a :class:`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'.

__firstlineno__ = 299 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.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'.

__static_attributes__ = ('_ff', '_name') 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

AtomStyle

Bases: molrs.forcefield.Style

__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)

__firstlineno__ = 374 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.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'.

__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.

BondStyle

Bases: molrs.forcefield.Style

__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)

__firstlineno__ = 386 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.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'.

__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.

AngleStyle

Bases: molrs.forcefield.Style

__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)

__firstlineno__ = 396 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.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'.

__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.

DihedralStyle

Bases: molrs.forcefield.Style

__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)

__firstlineno__ = 408 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.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'.

__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.

ImproperStyle

Bases: molrs.forcefield.Style

__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)

__firstlineno__ = 425 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.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'.

__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.

PairStyle

Bases: molrs.forcefield.Style

__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)

__firstlineno__ = 442 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.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'.

__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.

Type

Handle view of one force-field type over a :class:ForceField.

__annotations__ = {'_category': 'str'} 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.forcefield', '__firstlineno__': 106, '__annotations__': {'_category': 'str'}, '__doc__': 'Handle view of one force-field type over a :class:`ForceField`.', '_category': '', '__init__': <function Type.__init__ at 0x7f559826ce00>, 'name': <property object at 0x7f559a147470>, 'category': <property object at 0x7f559a1472e0>, 'params': <property object at 0x7f559a144e50>, '__getitem__': <function Type.__getitem__ at 0x7f559826d080>, 'get': <function Type.get at 0x7f559826d120>, '__contains__': <function Type.__contains__ at 0x7f559826d1c0>, '__setitem__': <function Type.__setitem__ at 0x7f559826d260>, 'keys': <function Type.keys at 0x7f559826d300>, 'items': <function Type.items at 0x7f559826d3a0>, 'endpoints': <property object at 0x7f559a144ea0>, '__hash__': <function Type.__hash__ at 0x7f559826d4e0>, '__eq__': <function Type.__eq__ at 0x7f559826d580>, '__repr__': <function Type.__repr__ at 0x7f559826d620>, '__static_attributes__': ('_ff', '_name', '_style'), '__dict__': <attribute '__dict__' of 'Type' objects>, '__weakref__': <attribute '__weakref__' of 'Type' objects>}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'Handle view of one force-field type over a :class:`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'.

__firstlineno__ = 106 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.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'.

__static_attributes__ = ('_ff', '_name', '_style') 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

AtomType

Bases: molrs.forcefield.Type

__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)

__firstlineno__ = 170 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.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'.

__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.

BondType

Bases: molrs.forcefield.Type

__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)

__firstlineno__ = 181 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.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'.

__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.

AngleType

Bases: molrs.forcefield.Type

__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)

__firstlineno__ = 198 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.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'.

__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.

DihedralType

Bases: molrs.forcefield.Type

__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)

__firstlineno__ = 220 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.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'.

__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.

ImproperType

Bases: molrs.forcefield.Type

__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)

__firstlineno__ = 247 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.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'.

__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.

PairType

Bases: molrs.forcefield.Type

__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)

__firstlineno__ = 276 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.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'.

__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.

Parameters

The parameter view of a :class:Type — keyword access plus the .kwargs mapping consumers read. The model is keyword-only, so .args is always empty.

__dict__ = mappingproxy({'__module__': 'molrs.forcefield', '__firstlineno__': 56, '__doc__': 'The parameter view of a :class:`Type` — keyword access plus the\n``.kwargs`` mapping consumers read. The model is keyword-only, so ``.args``\nis always empty.\n', '__init__': <function Parameters.__init__ at 0x7f559826c540>, 'kwargs': <property object at 0x7f559a147600>, 'args': <property object at 0x7f559a147650>, '__getitem__': <function Parameters.__getitem__ at 0x7f559826c720>, 'get': <function Parameters.get at 0x7f559826c7c0>, '__contains__': <function Parameters.__contains__ at 0x7f559826c860>, '__iter__': <function Parameters.__iter__ at 0x7f559826c900>, '__len__': <function Parameters.__len__ at 0x7f559826c9a0>, 'keys': <function Parameters.keys at 0x7f559826ca40>, 'values': <function Parameters.values at 0x7f559826cae0>, 'items': <function Parameters.items at 0x7f559826cb80>, '__repr__': <function Parameters.__repr__ at 0x7f559826cc20>, '__static_attributes__': ('_d',), '__dict__': <attribute '__dict__' of 'Parameters' objects>, '__weakref__': <attribute '__weakref__' of 'Parameters' objects>}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'The parameter view of a :class:`Type` — keyword access plus the\n``.kwargs`` mapping consumers read. The model is keyword-only, so ``.args``\nis always empty.\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'.

__firstlineno__ = 56 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.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'.

__static_attributes__ = ('_d',) 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

MMFF94Typifier

Bases: molrs.Typifier

MMFF94 atom-type assigner.

Exposed to Python as molrs.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), then compile it through :meth:forcefield — the standard route, shared with every other force field in molrs.

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.intramolecular_pairs(frame) pots = typifier.forcefield().to_potentials(frame)

__doc__ = 'MMFF94 atom-type assigner.\n\nExposed to Python as `molrs.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), then compile it through\n:meth:`forcefield` — the standard route, shared with every other force\nfield in molrs.\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.intramolecular_pairs(frame)\n>>> pots = typifier.forcefield().to_potentials(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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

forcefield() method descriptor

Return the underlying force-field definition.

This is the seam to the standard compile path — the typifier labels the graph, the force field compiles it::

typed = typifier.typify(mol)
frame = typed.to_frame()
frame["pairs"] = molrs.intramolecular_pairs(frame)
pots  = typifier.forcefield().to_potentials(frame)

typify(mol) method descriptor

Assign MMFF atom types (and this variant's bonded parameters) to a molecular graph.

Parameters

mol : Atomistic Molecular graph with element symbols and bonds.

Returns

Atomistic Typed molecular graph. Call typed.to_frame() explicitly when a tabular representation is needed. The improper rows carry koop (mdArad^-2) and the dihedral rows v1/v2/v3, both resolved from this class's parameter set.

Raises

ValueError If atom types cannot be determined (e.g. unsupported elements).

MMFF94STypifier

Bases: molrs.Typifier

MMFF94s ("static") atom-type assigner and potential builder.

Exposed to Python as molrs.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.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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

forcefield() method descriptor

Return the underlying force-field definition.

This is the seam to the standard compile path — the typifier labels the graph, the force field compiles it::

typed = typifier.typify(mol)
frame = typed.to_frame()
frame["pairs"] = molrs.intramolecular_pairs(frame)
pots  = typifier.forcefield().to_potentials(frame)

typify(mol) method descriptor

Assign MMFF atom types (and this variant's bonded parameters) to a molecular graph.

Parameters

mol : Atomistic Molecular graph with element symbols and bonds.

Returns

Atomistic Typed molecular graph. Call typed.to_frame() explicitly when a tabular representation is needed. The improper rows carry koop (mdArad^-2) and the dihedral rows v1/v2/v3, both resolved from this class's parameter set.

Raises

ValueError If atom types cannot be determined (e.g. unsupported elements).

OPLSAATypifier

Bases: molrs.Typifier

OPLS-AA atom-type assigner and potential builder.

Exposed to Python as molrs.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; use :meth:build for the one-step potential compilation path.

Parameters

source : str or path-like, optional OPLS-AA XML text or a path to an XML file. None uses the embedded canonical OPLS-AA table. strict : bool, default True When True, a bonded term with no force-field match is an error. When False, such terms are skipped (left unparametrized).

Examples

typifier = OPLSAATypifier() typed = typifier.typify(mol) # typed Atomistic potentials = typifier.build(mol) # compiled Potentials

__doc__ = 'OPLS-AA atom-type assigner and potential builder.\n\nExposed to Python as `molrs.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`; use :meth:`build` for the\none-step potential compilation path.\n\nParameters\n----------\nsource : str or path-like, optional\n OPLS-AA XML text or a path to an XML file. ``None`` uses the embedded\n 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>>> potentials = typifier.build(mol) # compiled Potentials' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

build(mol) method descriptor

Typify and compile potentials in one step.

Raises

ValueError If typification or compilation fails.

forcefield() method descriptor

Return the underlying force-field definition.

typify(mol) method descriptor

Assign OPLS-AA atom and bonded-term types to a molecular graph.

Raises

ValueError If atom typing fails.

Typifier

Nominal Python base for every graph typifier.

The algorithm contract already lives in the Rust molrs::ff::typifier::Typifier trait. This is its Python nominal counterpart: native typifiers extend it and downstream Python typifiers may subclass it.

__doc__ = 'Nominal Python base for every graph typifier.\n\nThe algorithm contract already lives in the Rust\n`molrs::ff::typifier::Typifier` trait. This is its Python nominal\ncounterpart: native typifiers extend it and downstream Python typifiers may\nsubclass 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

Potentials

Compiled force-field potentials for energy and force evaluation.

Exposed to Python as molrs.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.intramolecular_pairs(frame) potentials = typifier.forcefield().to_potentials(frame) energy, forces = potentials.eval(coords)

__doc__ = 'Compiled force-field potentials for energy and force evaluation.\n\nExposed to Python as `molrs.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.intramolecular_pairs(frame)\n>>> potentials = typifier.forcefield().to_potentials(frame)\n>>> energy, forces = potentials.eval(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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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).

calc_energy(arg) method descriptor

Evaluate total energy (kcal/mol) against a :class:Frame or coordinates.

calc_energy_forces(arg) method descriptor

Returns (energy, forces), forces shape (N, 3).

calc_forces(arg) method descriptor

Compute forces (= -gradient) in kcal/(mol·Å), shape (N, 3).

LBFGS

L-BFGS geometry optimizer, exposed as molrs.LBFGS.

Mirrors molpy: construct with the potentials + config, then run (single or homogeneous batch, dispatched on the input rank).

Examples

pots = molrs.MMFF94Typifier().forcefield().to_potentials(frame) opt = molrs.LBFGS(pots, fmax=0.05) coords, report = opt.run(coords) # (N, 3) batch, reports = opt.run(batch) # (B, N, 3)

__doc__ = 'L-BFGS geometry optimizer, exposed as `molrs.LBFGS`.\n\nMirrors molpy: construct with the potentials + config, then ``run`` (single\nor homogeneous batch, dispatched on the input rank).\n\nExamples\n--------\n>>> pots = molrs.MMFF94Typifier().forcefield().to_potentials(frame)\n>>> opt = molrs.LBFGS(pots, fmax=0.05)\n>>> coords, report = opt.run(coords) # (N, 3)\n>>> batch, reports = opt.run(batch) # (B, N, 3)' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

run(coords) method descriptor

Relax coordinates by L-BFGS. (N, 3) / (3N,) -> single structure returning ((N, 3) array, OptReport); (B, N, 3) -> homogeneous batch returning ((B, N, 3) array, list[OptReport]). Input is not mutated.

OptReport

Outcome of a geometry optimization, exposed to Python as molrs.OptReport.

__doc__ = 'Outcome of a geometry optimization, exposed to Python as `molrs.OptReport`.' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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).

n_steps property

Number of outer L-BFGS iterations performed.

__repr__() method descriptor

Return repr(self).

read_forcefield_xml(path)

read_opls_xml(path)

extract_coords(frame) builtin

Extract a flat coordinate array from a Frame's "atoms" block.

Reads the x, y, z columns from the "atoms" block and interleaves them into a flat 1D array: [x0, y0, z0, x1, y1, z1, ...].

Parameters

frame : Frame Frame with an "atoms" block containing x, y, z float columns.

Returns

numpy.ndarray, shape (3*N,), dtype float Flat coordinate array suitable for :meth:Potentials.eval.

Raises

ValueError If the "atoms" block or required columns are missing.

Examples

coords = extract_coords(frame) energy, forces = potentials.eval(coords)

Trajectory

Trajectory

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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).

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

count_frames() method descriptor

Number of frames in the trajectory.

read_zarr(path) staticmethod

Read a frame-sequence Zarr archive into a Trajectory.

write_zarr(path) method descriptor

Write this trajectory to a frame-sequence Zarr archive.

ScalarObservable

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

data property

kind property

name property

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

VectorObservable

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

data property

kind property

name property

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

Analysis

Analysis classes live under the molrs.compute subpackage, organized by domain. The layout mirrors freud and the underlying Rust crate (molrs_compute::{density, order, environment, …}).

molrs.compute.density

RDF

Radial distribution function calculator.

Accepts either a single (frame, nlist) pair or a list of each. Results accumulate across frames and are ideal-gas normalized on return.

__doc__ = 'Radial distribution function calculator.\n\nAccepts either a single `(frame, nlist)` pair or a list of each. Results\naccumulate across frames and are ideal-gas normalized on return.' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

compute(frames, nlists) method descriptor

Compute g® from a batch of frames + neighbor lists.

Parameters

frames : Frame | list[Frame] nlists : NeighborList | list[NeighborList] One neighbor list per frame.

Returns

RDFResult

RDFResult

Radial distribution function g® result.

rdf is already normalized (RDF.compute finalizes eagerly).

__doc__ = 'Radial distribution function g(r) result.\n\n`rdf` is already normalized (RDF.compute finalizes eagerly).' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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

n_frames property

n_points property

n_r property

r_min property

rdf property

volume property

__repr__() method descriptor

Return repr(self).

GaussianDensity

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

compute(frames) method descriptor

Returns a list of 3-D density grids (nx, ny, nz), one per frame.

LocalDensity

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

compute(frames, nlists) method descriptor

Returns (num_neighbors, density) ndarrays per frame.

molrs.compute.order

Steinhardt

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

Nematic

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

compute(frames) method descriptor

Per-particle orientation directors are the unit head − tail vectors of the "orientations" topology block, read from the first frame (one (head, tail) atom pair per row). No external director array is passed.

Returns (order: float, eigenvalues: ndarray[3], director: ndarray[3], q_tensor: ndarray[3,3]).

Hexatic

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

compute(frames, nlists) method descriptor

Returns one numpy array per frame: complex64 per-particle ψ_k (interleaved real/imag pairs in an (N, 2) float64 array).

SolidLiquid

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

compute(frames, nlists) method descriptor

Returns (n_solid_bonds[i] : u32 ndarray, is_solid[i] : bool list) per frame.

molrs.compute.environment

BondOrder

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

compute(frames, nlists) method descriptor

Returns per-frame (raw_counts, bond_order, theta_edges, phi_edges).

molrs.compute.pmft

PMFTXY

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

compute(frames, nlists) method descriptor

Returns per-frame (raw_counts, density, pmf). If the first frame carries an "orientations" topology block (one (head, tail) atom pair per query particle), every bond is rotated into that particle's local frame — the per-particle 2-D angle is atan2 of its head − tail axis, recomputed per frame from that frame's positions. Without the block the analyzer works in the lab frame.

molrs.compute.diffraction

StaticStructureFactorDebye

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

compute(frames) method descriptor

Returns per-frame (k_values, S(k), n_particles).

molrs.compute.cluster

Cluster

Distance-based cluster analysis.

__doc__ = 'Distance-based cluster analysis.' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

compute(frames, nlists=None, keys=None) method descriptor

Compute one cluster result per input frame.

Two modes (mirroring freud's Cluster.compute): * spatial — pass nlists (a NeighborList per frame); particles within the cutoff and transitively connected form a cluster. * by key — pass keys (one non-negative integer per atom, e.g. a molecule id); all atoms sharing a key form one cluster, independent of geometry. Robust for per-molecule properties (e.g. per-chain Rg) even when molecules overlap or a bond exceeds any spatial cutoff. nlists is then ignored.

Returns a single ClusterResult when a single frame is passed, or a list[ClusterResult] when a list is passed.

ClusterResult

Per-frame cluster assignment.

__doc__ = 'Per-frame cluster assignment.' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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

The membership keys present in each cluster (freud's cluster_keys). Empty for spatial clustering; one key per cluster for keys=-based grouping.

cluster_sizes property

num_clusters property

__repr__() method descriptor

Return repr(self).

ClusterCenters

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

ClusterCentersResult

Geometric cluster centers for a single frame.

__doc__ = 'Geometric cluster centers for a single 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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

__len__() method descriptor

Return len(self).

__repr__() method descriptor

Return repr(self).

ClusterProperties

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

compute(frames, clusters) method descriptor

Returns a dict per frame with keys sizes, centers, centers_of_mass, cluster_masses, gyration_tensors, radii_of_gyration.

CenterOfMass

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

CenterOfMassResult

Per-frame mass-weighted cluster centers and total cluster masses.

__doc__ = 'Per-frame mass-weighted cluster centers and total cluster masses.' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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_of_mass property

cluster_masses property

__repr__() method descriptor

Return repr(self).

GyrationTensor

Gyration tensor per cluster.

compute(frames, clusters, centers): - single frame → shape (num_clusters, 3, 3) but wrapped as a list of length 1 when a list of frames is passed. For a single frame you get a (num_clusters, 3, 3) ndarray. - list of frames → ndarray of shape (n_frames, num_clusters, 3, 3) only if all frames have identical cluster counts; otherwise a Python list of per-frame ndarrays.

__doc__ = 'Gyration tensor per cluster.\n\n``compute(frames, clusters, centers)``:\n- single frame → shape `(num_clusters, 3, 3)` **but wrapped as a list of length 1**\n when a list of frames is passed. For a single frame you get a `(num_clusters, 3, 3)` ndarray.\n- list of frames → ndarray of shape `(n_frames, num_clusters, 3, 3)` only if all frames\n have identical cluster counts; otherwise a Python list of per-frame ndarrays.' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

InertiaTensor

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

RadiusOfGyration

__doc__ = '' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

compute(frames, clusters, com) method descriptor

Compute Rg per cluster.

Returns a (num_clusters,) ndarray for a single frame, or a (n_frames, num_clusters) ndarray for a batch (clusters per frame must be identical; otherwise a Python list is returned).

molrs.compute.msd

MSD

Stateless MSD calculator.

compute(frames) uses frames[0] as the reference and returns a MSDTimeSeries of the same length as frames.

__doc__ = 'Stateless MSD calculator.\n\n``compute(frames)`` uses ``frames[0]`` as the reference and returns a\n``MSDTimeSeries`` of the same length as ``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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

compute(frames) method descriptor

Compute MSD time series against frames[0].

MSDResult

Per-frame MSD result (from a single time point).

__doc__ = 'Per-frame MSD result (from a single time point).' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

mean property

per_particle property

__repr__() method descriptor

Return repr(self).

MSDTimeSeries

MSD time series aligned with the input frame list.

series.data[0] is the reference frame (mean = 0); series.data[i] compares frame i against frame 0.

__doc__ = 'MSD time series aligned with the input frame list.\n\n`series.data[0]` is the reference frame (mean = 0); `series.data[i]`\ncompares frame `i` against frame `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' class-attribute

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

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

mean property

per_particle property

__getitem__(key) method descriptor

Return self[key].

__len__() method descriptor

Return len(self).

__repr__() method descriptor

Return repr(self).

molrs.compute.ml

DescriptorRow

Row-based descriptor wrapper for PCA/KMeans input.

Wrap each row (a 1-D float array) with DescriptorRow(row); then pass a Python list of them to Pca2.compute / KMeans.compute.

__doc__ = 'Row-based descriptor wrapper for PCA/KMeans input.\n\nWrap each row (a 1-D float array) with `DescriptorRow(row)`; then pass a\nPython list of them to ``Pca2.compute`` / ``KMeans.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'.

__module__ = 'molrs' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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).

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

Pca2

Two-component PCA calculator.

__doc__ = 'Two-component PCA calculator.' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

compute(rows) method descriptor

Compute PCA over a list of DescriptorRow objects.

PcaResult

Two-component PCA result.

__doc__ = 'Two-component PCA result.' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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

Row-major (n_rows, 2) projected coordinates.

variance property

[var_pc1, var_pc2] — explained variance per component.

__repr__() method descriptor

Return repr(self).

KMeans

k-means clustering over a PCA projection (2-D).

__doc__ = 'k-means clustering over a PCA projection (2-D).' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

__new__(*args, **kwargs) builtin

Create and return a new object. See help(type) for accurate signature.

__repr__() method descriptor

Return repr(self).

compute(pca) method descriptor

Cluster a PcaResult.

KMeansResult

k-means cluster labels.

__doc__ = 'k-means cluster labels.' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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' class-attribute

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

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

labels property

__len__() method descriptor

Return len(self).

__repr__() method descriptor

Return repr(self).

Transport

Electrolyte transport kernels (ports of the tame recipes). See the Transport Kernels guide for signatures, units, and worked examples.

molrs.transport

Onsager

Onsager collective mean-displacement cross-correlation (static).

__dict__ = mappingproxy({'__module__': 'molrs.transport', '__firstlineno__': 20, '__doc__': 'Onsager collective mean-displacement cross-correlation (static).', 'correlation': <staticmethod(<built-in function transport_onsager_correlation>)>, '__static_attributes__': (), '__dict__': <attribute '__dict__' of 'Onsager' objects>, '__weakref__': <attribute '__weakref__' of 'Onsager' objects>}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'Onsager collective mean-displacement cross-correlation (static).' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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__ = 20 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.transport' class-attribute

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

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

__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

Persist

Pair-survival (persistence) time-correlation functions (static).

__dict__ = mappingproxy({'__module__': 'molrs.transport', '__firstlineno__': 32, '__doc__': 'Pair-survival (persistence) time-correlation functions (static).', 'pair_survival_tcf': <staticmethod(<built-in function transport_pair_survival_tcf>)>, '__static_attributes__': (), '__dict__': <attribute '__dict__' of 'Persist' objects>, '__weakref__': <attribute '__weakref__' of 'Persist' objects>}) class-attribute

Read-only proxy of a mapping.

__doc__ = 'Pair-survival (persistence) time-correlation functions (static).' class-attribute

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

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding 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__ = 32 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.transport' class-attribute

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

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

__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