qp.manager.create.compress_sequence

qp.manager.create.compress_sequence(seq)[source]

Condense a list of atom indices into range notation for TeraChem constraints.

Converts a sorted list of integers into a compact string representation using ranges (e.g., 1-10) and comma-separated values for non-consecutive indices.

Parameters:

seq (list of int) – Sorted list of atom indices to freeze.

Returns:

TeraChem constraint block with xyz prefix for each range or group.

Return type:

str

Examples

>>> compress_sequence([1, 2, 3, 5, 7, 8, 9])
'xyz 1-3\nxyz 5\nxyz 7-9'