get_subset

mdhelper.openmm.topology.get_subset(topology: Topology, positions: ndarray[float], *, delete: list[Any] = None, keep: list[Any] = None, types: str | Iterable[str] = None) Topology | ndarray[float][source]

Creates a topology subset and gets its corresponding particle positions.

Parameters:
topologyopenmm.app.Topology

OpenMM topology.

positionsnumpy.ndarray

Positions of the \(N\) particles in the topology.

Shape: \((N,\,3)\).

deletearray-like, keyword-only, optional

openmm.app.Atom, openmm.app.Bond, openmm.app.Residue, and/or openmm.app.Chain objects, or the indices of those objects. If indices are provided, their corresponding object types ("atom", "residue", "chain") must be provided in types. The specified items will be deleted from the model.

Note

Only one of delete and keep can be specified.

keeparray-like, keyword-only, optional

openmm.app.Atom, openmm.app.Bond, openmm.app.Residue, and/or openmm.app.Chain objects, or the indices of those objects. If indices are provided, their corresponding object types ("atom", "residue", "chain") must be provided in types. The specified items will be kept in the model.

Note

Only one of delete and keep can be specified.

typesstr or array-like, keyword-only, optional

Object types corresponding to the indices provided in delete or keep. If a str is provided, all items in the array are assumed to have the same object type. Must be provided if not all items in delete or keep are OpenMM topology objects.

Returns:
topologyopenmm.app.Topology

OpenMM topology subset.

positionsnumpy.ndarray

Positions of the remaining \(N_\mathrm{rem}\) particles in the topology.

Shape: \((N_\mathrm{rem},\,3)\).