torchref.restraints.ramachandran module

Ramachandran NLL surfaces for backbone restraints.

Pre-computed NLL = -log P(phi, psi | residue_type) surfaces derived from MolProbity/cctbx distributions (6 residue-type-dependent surfaces at 1° resolution). The surfaces are stored as a single tensor of shape (6, 360, 360) in torchref/data/rama_nll_surfaces.pt.

Surface types

0 general Standard amino acids (not GLY, PRO, ILE, VAL, pre-PRO) 1 glycine Current residue is GLY 2 cis-proline Current residue is PRO with cis peptide bond 3 trans-proline Current residue is PRO with trans peptide bond 4 pre-proline Next residue is PRO 5 ile/val Current residue is ILE or VAL

torchref.restraints.ramachandran.load_nll_surfaces(device)[source]

Load pre-computed Ramachandran NLL surfaces.

Parameters:

device (torch.device) – Target device for the returned tensor.

Returns:

Shape (6, 360, 360) with NLL values. Index [type, i, j] corresponds to phi = (i - 180)° and psi = (j - 180)°.

Return type:

torch.Tensor

torchref.restraints.ramachandran.classify_residue(resname, next_resname, omega_deg=180.0)[source]

Determine the Ramachandran surface type for a residue.

Parameters:
  • resname (str) – Three-letter residue name of the current residue.

  • next_resname (str) – Three-letter residue name of the next residue in sequence.

  • omega_deg (float) – Omega torsion angle in degrees (for cis/trans proline detection).

Returns:

One of TYPE_GENERAL .. TYPE_ILE_VAL.

Return type:

int