haddock3
  • A brief introduction to HADDOCK3
  • Installation
  • Usage
  • Workflow Examples
  • Advanced features
  • Command-line interfaces
  • Modules
  • Testing
  • Contributing to HADDOCK3
  • Citing
  • Library Reference
    • Core Reference
    • Libs Reference
      • Subpackages
      • Submodules
        • libalign: sequence and structural alignments
        • libcli: functions helping clients
        • libclust: functions related to clustering
        • libcns: creating CNS files
        • haddock.libs.libfcc module
        • libfunc: functional-programming helping tools
        • libhpc: HPC execution functions
        • libinteractive: functions related to interactive tasks
        • libio: I/O helping functions
        • liblog: Logging helping functions
        • libmath: Math helping functions
        • libmpi: MPI execution functions
        • libontology: module communication
        • libparallel: multiprocessing helping functions
        • libpdb: PDB helping functions
        • libplots: plotting functionalities
        • libprodigy: classes and functions related to the use of prodigy
        • librestraints: functions related to restraints
        • libstructure: functions related to structures
        • libsubprocess: subprocess execution functions
        • libtimer: timing functions
        • libutil: utility functions
        • libworkflow: workflow functions
      • Module contents
    • Gear Reference
haddock3
  • Library Reference
  • Libs Reference
  • librestraints: functions related to restraints
  • View page source

librestraints: functions related to restraints

haddock.libs.librestraints.active_passive_to_ambig(active1, passive1, active2, passive2, segid1='A', segid2='B')[source]

Convert active and passive residues to Ambiguous Interaction Restraints

Parameters:
  • active1 (list) – List of active residue numbers of the first segid

  • passive1 (list) – List of passive residue numbers of the first segid

  • passive2 (list) – List of passive residue numbers of the second segid

  • active2 (list) – List of active residue numbers of the second segid

  • active2 (list) – List of passive residue numbers of the second segid

  • segid1 (string) – Segid to use for the first model

  • segid2 (string) – Segid to use for the second model

haddock.libs.librestraints.build_restraints(bodies)[source]

Generates distance restraints to maintain the relative orientation of the different bodies during the simulations.

Generates two unique restraints per pair of bodies.

Each restraint is created using two random atoms on each body and using their exact euclidean distance as target distance.

haddock.libs.librestraints.calc_euclidean(i, j)[source]
haddock.libs.librestraints.check_parenthesis(file)[source]
haddock.libs.librestraints.extract_restraint_entries(tbl_filepath: str) → list[str][source]

Read and extract restraints in a AIR.tbl file.

Parameters:

tbl_filepath (str) – Path to a AIR.tbl file containing restraints.

Returns:

restraints (list[str]) – Loaded restraints as a list.

haddock.libs.librestraints.generate_tbl(atom_lst, restraints)[source]

Makes a list of TBL-formatted restraints.

Parameters:
  • atom_lst (list) – List of atoms in the form (chain, resi, aname, coords)

  • restraints (list) – List of restraints in the form (res_i, res_j)

haddock.libs.librestraints.get_bodies(atom_lst, prot_threshold=4.0, dna_threshold=7.5)[source]

Determines gaps in an atom list following simple distance based criteria. Returns continuous fragments.

haddock.libs.librestraints.get_restraint_subset(tblfile: str, rd_removed_ratio: float, seed: int = 917) → Generator[list[str], None, None][source]

Generator of restraints subsets.

Parameters:
  • tblfile (str) – Path to a AIR.tbl file containing restraints.

  • rd_removed_ratio (float) – Ratio of the number of restraints to remove.

  • seed (int, optional) – Pseudo-random seed, by default 917

Yields:

subset_restraints (list[str]) – A subset of the input restraints.

Raises:
  • ValueError – When random removal ratio is too high and no restraints a kept.

  • ValueError – When random removal ratio is too low and all restraints a kept.

haddock.libs.librestraints.get_surface_resids(structure, cutoff=15)[source]

Calls freesasa using its Python API and returns per-residue accessibilities.

haddock.libs.librestraints.parse_actpass_file(actpass_file)[source]

Parse actpass file

Parameters:

actpass_file (str or Path) – path to actpass_file

Returns:

  • active (list) – list of active residues

  • passive (list) – list of passive residues

haddock.libs.librestraints.passive_from_active_raw(structure, active, chain_id=None, surface=None, radius=6.5)[source]

Get the passive residues.

Parameters:
  • structure (str) – path to the PDB file

  • active (list) – List of active residues

  • chain_id (str) – Chain ID

  • surface (list) – List of surface residues.

  • radius (float) – Radius from active residues

haddock.libs.librestraints.read_structure(pdbf, exclude=None)[source]

Reads a PDB file and returns a list of parsed atoms

haddock.libs.librestraints.validate_tbldata(restraints, pcs=False)[source]
Previous Next

© Copyright 2025, BonvinLab. Last updated on Jul 02, 2025.

Built with Sphinx using a theme provided by Read the Docs.