Skip to content

Power fitting constraints

pyvoro2.powerfit.constraints

Constraint parsing and geometric normalization for inverse power fitting.

PairBisectorConstraints dataclass

Resolved pairwise separator constraints.

This object is the stable boundary between downstream pair-selection logic and pyvoro2's inverse solver. Each row refers to a specific ordered pair (i, j, shift) where shift is the lattice image applied to site j.

pair_labels(*, use_ids=False)

Return the left/right pair labels as indices or external ids.

subset(mask)

Return a subset with row order preserved.

to_records(*, use_ids=False)

Return one plain-Python record per constraint row.

resolve_pair_bisector_constraints(points, constraints, *, measurement='fraction', domain=None, ids=None, index_mode='index', image='nearest', image_search=1, confidence=None, allow_empty=False)

Parse and resolve pairwise separator constraints.

Parameters:

Name Type Description Default
points ndarray

Site coordinates with shape (n, d) where d is currently supported for planar (2D) and spatial (3D) workflows.

required
constraints ConstraintInput

Raw constraint tuples (i, j, value[, shift]).

required
measurement Literal['fraction', 'position']

Whether value is interpreted as a normalized fraction in [0, 1] or as an absolute position along the connector.

'fraction'
domain DomainAny | None

Optional non-periodic or periodic domain.

None
ids Sequence[int] | None

External ids used when index_mode='id'.

None
index_mode Literal['index', 'id']

Interpret the first two tuple entries as internal indices or external ids.

'index'
image Literal['nearest', 'given_only']

Shift resolution policy for tuples that do not specify a shift.

'nearest'
image_search int

Search radius for nearest-image resolution in triclinic periodic 3D cells. It is ignored for the current planar backend.

1
confidence Sequence[float] | None

Optional non-negative per-constraint weights.

None
allow_empty bool

Allow zero constraints and return an empty resolved object.

False

:::