topology
Molecular mechanics topology primitives.
import mlx_atomistic.topology
Classes
Section titled “Classes”Topology
Section titled “Topology”class Topology def __init__(n_atoms: int, bonds: object = (), angles: object = (), dihedrals: object = (), impropers: object = (), exclusions: object = (), partial_charges: object | None = None, one_four_pairs: object = (), nonbonded_exception_pairs: object = (), exclude_bonds: bool = True, nonbonded_cutoff: float | None = None, eager_nonbonded_pair_limit: int | None = DEFAULT_EAGER_NONBONDED_PAIR_LIMIT, virtual_sites: object = (), virtual_site_types: object = ())Programmatic molecular mechanics topology.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
n_atoms | int | ||
bonds | object | () | |
angles | object | () | |
dihedrals | object | () | |
impropers | object | () | |
exclusions | object | () | |
partial_charges | object | None | None | |
one_four_pairs | object | () | |
nonbonded_exception_pairs | object | () | |
exclude_bonds | bool | True | |
nonbonded_cutoff | float | None | None | |
eager_nonbonded_pair_limit | int | None | DEFAULT_EAGER_NONBONDED_PAIR_LIMIT | |
virtual_sites | object | () | |
virtual_site_types | object | () |
Properties
exclusion_setfrozenset[tuple[int, int]]— Excluded nonbonded pairs as normalized Python pairs.nonbonded_build_reportdict[str, int | float | str | None]— Compact report for topology nonbonded pair handling.nonbonded_pair_countint— Number of non-excluded full-system nonbonded pairs.nonbonded_pair_policystr— Whether full nonbonded pairs were eagerly materialized or deferred.one_four_setfrozenset[tuple[int, int]]— 1-4 scaled nonbonded pairs as normalized Python pairs.
Methods
from_sequences
Section titled “from_sequences”def from_sequences(*, n_atoms: int, bonds: Sequence[Sequence[int]] = (), angles: Sequence[Sequence[int]] = (), dihedrals: Sequence[Sequence[int]] = (), impropers: Sequence[Sequence[int]] = (), exclusions: Sequence[Sequence[int]] = (), partial_charges: Sequence[float] | None = None, one_four_pairs: Sequence[Sequence[int]] | None = None, nonbonded_exception_pairs: Sequence[Sequence[int]] = (), exclude_bonds: bool = True, nonbonded_cutoff: float | None = None, eager_nonbonded_pair_limit: int | None = DEFAULT_EAGER_NONBONDED_PAIR_LIMIT, virtual_sites: Sequence[object] = (), virtual_site_types: Sequence[str] = ()) -> TopologyCreate a topology from Python sequences.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
n_atoms | int | ||
bonds | Sequence[Sequence[int]] | () | |
angles | Sequence[Sequence[int]] | () | |
dihedrals | Sequence[Sequence[int]] | () | |
impropers | Sequence[Sequence[int]] | () | |
exclusions | Sequence[Sequence[int]] | () | |
partial_charges | Sequence[float] | None | None | |
one_four_pairs | Sequence[Sequence[int]] | None | None | |
nonbonded_exception_pairs | Sequence[Sequence[int]] | () | |
exclude_bonds | bool | True | |
nonbonded_cutoff | float | None | None | |
eager_nonbonded_pair_limit | int | None | DEFAULT_EAGER_NONBONDED_PAIR_LIMIT | |
virtual_sites | Sequence[object] | () | |
virtual_site_types | Sequence[str] | () |
Returns
Topology
nonbonded_pair_scales
Section titled “nonbonded_pair_scales”def nonbonded_pair_scales(*, one_four_scale: float = 1.0) -> mx.arrayReturn cached per-pair 1-4 scaling factors for all nonbonded pairs.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
one_four_scale | float | 1.0 |
Returns
mx.array
nonbonded_pairs
Section titled “nonbonded_pairs”def nonbonded_pairs(pairs = None) -> mx.arrayReturn nonbonded pairs with topology exclusions removed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
pairs | None |
Returns
mx.array
pair_scales
Section titled “pair_scales”def pair_scales(pairs, *, one_four_scale: float = 1.0) -> mx.arrayReturn per-pair 1-4 scaling factors.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
pairs | |||
one_four_scale | float | 1.0 |
Returns
mx.array