-
Notifications
You must be signed in to change notification settings - Fork 0
Mathematical Foundations
This page condenses the formal contract behind CYPForge's heme placement and ligand identity layers. The full proof — Theorem 11.1, "conditional consistency of the assembly contract" — lives in the Supporting Information (S3 of the manuscript). What follows is the working-mathematician's tour: definitions, the three geometric layers, the discrete addressing layer, the ligand identity layer, and the consistency theorem that ties them together.
CYPForge produces a tuple
where:
| Symbol | Meaning |
|---|---|
| the standardized prepared/assembly PDB | |
| HEM mol2, CYP/CYM mol2, frcmod for state |
|
| rigid transformation from the heme template frame to the source frame | |
injective map from (chain, resid, resname) to LEaP residue index |
|
| heavy-atom map from SDF to complex-PDB ligand | |
| atom-name merge map from final mol2 to complex-PDB ligand | |
| ligand RESP partial charges | |
the explicit Fe–S bond statement |
|
| validation gates (file existence, tool execution, geometric/charge checks) |
The contract is conditional: the claims below hold only when every check in WARN or FAIL.
The state set is restricted to the three predefined cases:
Custom states are supported by the low-level scripts but do not propagate through the default ten-stage path.
Heme placement is decomposed into three layers, each with its own degeneracy condition. If any layer's input is degenerate, the workflow halts; it does not paper over a bad geometric situation.
Given the macrocycle core atoms
Lemma. Let
If
The SVD lemma only gives an unsigned pair
If the initial normal violates this, flip it. For the template:
- if O1 is present (DIOXY / CPDI states): $\mathbf{n} \cdot (\mathbf{x}{O1} - \mathbf{x}{FE}) > 0$;
- if O1 is absent (IC6): use the propionate midpoint $\mathbf{m}{prop} = \frac{1}{2}(\mathbf{x}{CGA} + \mathbf{x}{CGD})$ and require $\mathbf{n} \cdot (\mathbf{m}{prop} - \mathbf{x}_{FE}) < 0$.
Proposition (sign compatibility). Under these rules, the source frame and the template frame assign
With the normal fixed, fix the rotational degree of freedom in the porphyrin plane. Use the propionate midpoint vector $\mathbf{v} = \mathbf{m}{prop} - \mathbf{x}{FE}$, project onto the plane:
Normalize, take
Result. The basis
are mutual inverses (this is just
Let
Theorem.
Corollary. All template-internal bond lengths, bond angles, and oriented dihedrals are preserved. Bond lengths are pairwise distances; angles follow from three distances via the law of cosines; oriented dihedrals are preserved because
This corollary is the structural justification for not re-parameterizing the template after placement: the geometry was good before
A subtle failure: even with the normal correctly oriented, an atom-matching error could mis-assign which side of the macrocycle is "proximal". Re-fit the plane using NA / NB / NC / ND nitrogens, define the signed distance
where $\mathbf{x}m = \frac{1}{2}(\mathbf{x}{CGA} + \mathbf{x}_{CGD})$. A positive product means the two atoms lie on the same side of the macrocycle plane. A flip changes the sign of at least one product. The third inequality is mathematically implied by the first two but is recorded in the audit manifest for redundancy.
On the bundled validation set (1R9O, 1Z10, 2FDW, 2J0D, 4EJJ, 4GQS), every structure passes with consistent sign pattern.
This is the discrete layer. Let (chain, resid, resname) triples in the prepared PDB. For the subset
assigning sequential LEaP residue indices in output-PDB order. The proximal cysteine is renamed CYM, the heme is added as an extra residue, and the ligand (if ligand-aware) as another. The Fe–S bond statement is then
bond mol.ρ(CYM).SG mol.ρ(HEM).FE
Proposition. Because (chain, resid, resname) triples land at distinct LEaP indices, and the two endpoints of the Fe–S bond are uniquely referenced. This guarantees LEaP-input uniqueness, not successful tleap execution — those are separate.
Two sources, one chemistry. The SDF provides the chemical graph
The atom-identity map
If this yields a unique solution,
If strict isomorphism returns no solution or multiple solutions (common for highly symmetric ligands), CYPForge 1.1.0 invokes a heavy-atom hypergraph fallback that ranks candidates by (i) element, (ii) graph-neighborhood signature, (iii) pairwise distance terms, and (iv) Kabsch residual. The fallback admits a result only if its decision is unique (mathematically determined) or equivalent_ok (remaining ambiguities are indistinguishable under retained checks or are explicitly recorded equivalent exchanges). Anything else is rejected.
equivalent_ok is recorded as an audit boundary — it is admitted as a working identity but is not promoted to a strict uniqueness proof.
GAFF2 atom types are assigned by Antechamber from the SDF and written to a typed mol2. Before charges are injected, parmchk2 produces the frcmod. Then the complex-PDB heavy-atom coordinates (identified by
RESP charges are fit from an HF/6-31G* wavefunction (PySCF / GPU4PySCF) via Multiwfn. The total-charge consistency check is
where
During ligand-aware LEaP preparation, the final mol2 and the complex-PDB ligand residue are merged by atom name, not row index. If both sides have identical, duplicate-free name sets, the merge
The seven properties below jointly define what "an internally consistent CYPForge contract" means. They are not independent — see the coupling remark.
Theorem (Conditional consistency of
-
Geometric consistency. Heme geometry is the image of the template under the rigid
$\Phi$ , preserving all template-internal distances, angles, and oriented dihedrals. -
State consistency. HEM mol2, CYP/CYM mol2, and frcmod all come from the same
$\Omega_s$ . -
Face-orientation consistency. Both frames assign
$+z$ to the distal face, and the propionate-side QC gate passes. -
Residue-addressing consistency. Every residue has a unique LEaP address
$\rho(r)$ . -
Fe–S bond consistency. The Fe–S bond endpoints are uniquely determined by the same
$\rho$ . -
Ligand identity. If strict graph isomorphism is unique,
$\phi$ is determined; if the fallback is invoked,$\phi$ is admitted only underuniqueorequivalent_ok. When mol2 and PDB atom-name sets match and are duplicate-free, the merge$\mu_L$ is unique. -
Ligand charge-sum consistency.
$|\sum q_L - Q_L| \leq 10^{-4}$ .
Coupling remark. A single state index
The contract proves conditional internal consistency. It does not prove:
- conformational optimality of any Vina-derived pose,
- chemical validity of the heme template for states outside
$\mathcal{S}_0$ , - successful
tleapexecution or downstream MD stability, - that per-atom RESP charges are chemically optimal (only the sum is gated),
- that an
equivalent_okfallback decision is a strict uniqueness result.
A passing contract means: given that you accept the input as chemically valid, the structural, parametric, and addressing layers are mutually compatible. It is a guarantee about CYPForge's internal logic, not about the underlying chemistry. The chemistry is on you.
| Layer | Source |
|---|---|
| SVD plane fit | src/cypforge/heme/prepare.py |
| Normal orientation, in-plane phase | src/cypforge/heme/prepare.py |
| Rigid transformation |
src/cypforge/heme/prepare.py |
| Atom matching | src/cypforge/heme/mapping.py |
| Propionate-side QC |
src/cypforge/heme/prepare.py (signed-distance gate) |
| Residue addressing |
src/cypforge_core/heme_mapping_leapin.py |
| Strict graph isomorphism + fallback |
src/cypforge_core/ligand_mapping_resolver.py, ligand_heavy_hypergraph_resolver.py
|
| Atom-name merge |
src/cypforge_core/ligand_mapping_leapin.py |
| RESP fit | src/cypforge_core/ligand_gpu4pyscf_esp.py |
| Charge-sum gate | src/cypforge_core/ligand_gpu4pyscf_esp.py |
Next: deep dives on Heme Parameterization and Ligand Parameterization.
CYPForge v1.3.0 · MIT License · GitHub · Cite Shahrokh et al. 2012 for the bundled heme parameters.
- Home
- Why CYPForge
- Architecture
- Mathematical Foundations
- Heme Parameterization
- Ligand Parameterization
- Gate System and Manifests
- FAQ
Getting started
Reference