Distance
Distance map utilities.
Distance map calculations for a protein’s main chain.
This module provides the DistanceMap class, which:
computes pairwise distances between beads in the main chain,
stores distances in a vectorized form for multiple axes,
applies qubit fixes to account for predefined bead states,
and maintains a dictionary of squared distances for downstream quantum simulations of protein folding.
- class distance.distance_map.DistanceMap(protein)
Bases:
objectRepresents a distance map for a protein’s main chain.
Computes and stores quantum pairwise distances between beads in the protein’s main chain, producing axis-wise Pauli operator vectors, applying qubit fixes, and exposing a ready-to-use distance map for Hamiltonian construction.
- __init__(protein)
Initializes the distance map for the given protein’s main chain, setting up data structures to store distances along multiple axes and computing initial pairwise distances.
- Parameters:
protein (Protein) – The Protein object that includes all information about protein.
- Raises:
Exception – If distance calculation for the main chain fails.
- _calc_distances_main_chain()
Calculates pairwise quantum distances between beads in the main chain.
For each bead pair (lower_bead_idx, upper_bead_idx), computes a vector of quantum operators representing the squared distance along each axis, using turn functions and sublattice signs. Results are stored in the distance map for use in quantum Hamiltonian construction.
- Return type:
None
Note
Each axis in the distance vector corresponds to a dimension in the tetrahedral lattice representation. The sub_lattice_sign alternates between +1 and -1 depending on the bead index, reflecting the sublattice structure of the main chain.