Skip to content

Single-well anchor dihedrals - #19

Merged
lohedges merged 3 commits into
develfrom
feature_single_well_anchors
Oct 26, 2026
Merged

lohedges merged 3 commits into
develfrom
feature_single_well_anchors

Conversation

@lohedges

Copy link
Copy Markdown
Contributor

This PR adds an option to replace anchor dihedrals with a single-well potential. On edges like FacX 4c/4d → edoxaban, the multi-well anchors let ghost atoms get trapped in the wrong well. It also fixes a bug in --stiffen-rotamers that put every stiffened dihedral's minimum at cis.

Changes

  • New single_well_anchors option (--single-well-anchors and --k-single-well on the CLI). It replaces each anchor dihedral that has a ghost terminal atom, three physical atoms and a non-zero force constant with k[1 + cos(φ − φ_ref + π)]. φ_ref is measured in the end state where the ghost is physical. The default is off, and k defaults to 5 kcal/mol, so the barrier is 10 kcal/mol.
    • This matters for terms such as the n=2 dihedral on a dummy H attached to a carbonyl O. At intermediate λ, the ghost can settle in either well, and independently equilibrated windows ended up in different ones, which caused hysteresis.
    • Each ghost's contribution still factors out, as in Boresch et al. (2021), so the end-state free energies are unaffected.
    • An anchor is left unchanged, with a warning, if one of its atoms is a ghost in the reference state or a bond angle in the reference state is above 170°, because the reference dihedral is ill-defined in those cases.
  • --stiffen-rotamers fix: every stiffened dihedral had its minimum at 0°. That eclipsed the ghosts with the anchor and stacked several ghosts on the same bridge on top of each other. The minimum now comes from the geometry of the end state where the ghosts are physical.
  • Refactor: _soften_mixed_dihedrals and _check_rotamer_anchors are merged into one post-processing pass, _modify_mixed_dihedrals, with the precedence remove > rotamer stiffening > single well > soften scaling. Shared helpers: _find_rotatable_bonds and _physical_state.

Testing

  • New tests cover:
    • the rotamer reference geometry;
    • single-well placement and its precedence over soften_anchors;
    • skipping zero-force-constant anchors, linear references and anchors that are ghosts in the reference state;
    • a FacX 4c → edo regression test using fac4c_edo.s3.
  • The full test suite passes.
  • Validation: FacX 4d → edo with 21 evenly spaced windows, using the ring_break_morph schedule. The dummy H on the ring-break bridge stays cis in every frame of every window, in both legs. Before this change it was trapped trans in some runs, and the free leg varied between replicates. Now the replicates agree to within about 0.1 kcal/mol per λ step. The remaining ΔΔG error on this edge comes from the bound starting pose, not from the ghost treatment.

@lohedges lohedges added the enhancement New feature or request label Oct 26, 2026
@lohedges
lohedges deployed to ghostly-build October 26, 2026 14:19 — with GitHub Actions Active
@lohedges
lohedges deployed to ghostly-build October 26, 2026 14:19 — with GitHub Actions Active
@lohedges
lohedges deployed to ghostly-build October 26, 2026 14:19 — with GitHub Actions Active
@lohedges
lohedges deployed to ghostly-build October 26, 2026 14:19 — with GitHub Actions Active
@lohedges
lohedges merged commit dc4d7d7 into devel Oct 26, 2026
4 checks passed
@lohedges
lohedges deleted the feature_single_well_anchors branch October 26, 2026 14:24

This branch was successfully deployed

1 active deployment
ghostly-build — bf572e6c Deployed Oct 26, 2026 by lohedges via build (3.12, linux) #86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant