autofragment.multilevel.assignment

Layer assignment algorithms for multi-level methods.

This module provides algorithms for automatically assigning atoms to computational layers based on various criteria such as distance, residue membership, or custom selectors.

Example

>>> from autofragment.multilevel.assignment import assign_by_distance
>>> coords = np.array([[0, 0, 0], [1, 0, 0], [5, 0, 0]])
>>> layers = assign_by_distance(coords, center_atoms={0}, layer_cutoffs=[3.0])
>>> layers  # [{0}, {1}, {2}] - center, within 3A, beyond 3A

Functions

assign_by_atom_properties(atom_properties, ...)

Assign atoms to layers based on atom properties.

assign_by_custom(n_atoms, selector)

Assign atoms to layers using a custom selector function.

assign_by_distance(coords, center_atoms, ...)

Assign atoms to layers based on distance from center atoms.

assign_by_element(elements, qm_elements)

Assign atoms to QM or MM region based on element type.

assign_by_residue(residue_ids, qm_residues)

Assign atoms to QM or MM region based on residue name.

assign_by_residue_number(residue_numbers, ...)

Assign atoms to QM or MM region based on residue number.

compute_min_distance_to_atoms(coords, ...)

Compute minimum distance from an atom to a set of reference atoms.

expand_selection_to_residues(atom_selection, ...)

Expand atom selection to include complete residues.

validate_layer_assignment(layers, n_atoms)

Validate that a layer assignment covers all atoms exactly once.