molsysmt.structure.get_center#
- molsysmt.structure.get_center(molecular_system, selection='all', weights=None, structure_indices='all', syntax='MolSysMT', engine='MolSysMT', heavy_mode='auto', parallel=None, num_threads=None, skip_digestion=False)[source]#
Computing centers (centroids or weighted centers) of atom selections.
- Parameters:
molecular_system (molecular system) – Input system.
selection (str, list, tuple or numpy.ndarray, default 'all') – Atoms (or groups of atoms) to center; nested iterables are treated as groups.
weights (array-like or 'masses', optional) – Non-negative weights per atom (or per group) when computing centers. Use
'masses'to compute centers of mass. Every group must have a positive total weight.structure_indices ('all' or array-like, default 'all') – Structures/frames over which centers are computed.
syntax (str, default 'MolSysMT') – Selection syntax when using strings.
engine ({'MolSysMT'}, default 'MolSysMT') – Backend.
heavy_mode (str, default 'auto') – Chunked execution mode: ‘auto’ | ‘force’ | ‘off’.
parallel (bool or str, optional) – Parallel mode override: True | False | ‘auto’.
num_threads (int, optional) – Number of threads override.
skip_digestion (bool, default False) – Whether to skip argument digestion.
- Returns:
Centers as a PyUnitWizard quantity in length units.
- Return type:
quantity
- Raises:
ArgumentError – If the atom or frame selection is empty, or weights are non-finite, negative, or have zero total weight.
ArgumentLengthError – If the number of weights does not match the selected atoms.
NotImplementedMethodError – If an unsupported engine is requested.
Examples
>>> import molsysmt as msm >>> molsys = msm.convert(msm.systems['alanine dipeptide']['alanine_dipeptide.h5msm'], to_form='molsysmt.MolSys') >>> msm.structure.get_center(molsys, weights='masses').shape (1, 1, 3)
Added in version 1.0.0.