Skip to content

Add torsion_window option to avoid torsion singularities at linear angles - #287

Merged
lohedges merged 7 commits into
develfrom
feature_linear_torsions
Nov 11, 2026
Merged

lohedges merged 7 commits into
develfrom
feature_linear_torsions

Conversation

@lohedges

@lohedges lohedges commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Adds a torsion_window option, auto by default, to avoid simulations crashing when an angle of a perturbable molecule becomes linear at one end state, e.g. a C=C bond that becomes C≡C, or a methyl that becomes a nitrile.

Torsions and impropers through such an angle are interpolated to zero while the angle opens towards 180°. Near the linear end state they still carry part of their force constant while the angle's atoms are almost collinear, where their forces diverge. This crashed hiv1_protease 13~14 from the OpenFE benchmark set at λ = 0.8–0.9, with or without replica exchange, and matches the failures OpenFE reported for single-to-triple-bond edges in janssen_bace.

When auto finds an angle that is linear at only one end state, with a non-zero torsion or improper through it at the other end state, the torsions and impropers of that molecule change over only part of each stage of the λ schedule: the first half when the angle is linear at λ = 1, the second half when it is linear at λ = 0, and the middle half (with a warning) when both occur. Within that window they follow a smoothstep, which roughly doubled the exchange rate at the end of the window for hiv1 13~14, compared with a linear ramp. Other molecules keep the original schedule, via a per-molecule schedule. true applies the window whenever an angle becomes linear, and is an error if it can't be applied. false disables it. A warning is logged if a non-zero term passes through an angle at the end state where it's linear, which the schedule can't help.

With the window, hiv1 13~14 runs with all 11 windows exchanging, and the alkyne angles reach 179.5° at λ = 1 without problems. A scan of the 604 OpenFE benchmark edges found that auto applies the window to 5 of them: hiv1_protease 13~14, bace CAT-17i~CAT-17c and CAT-24~CAT-17i, tyk2 jmc_28~jmc_30, and p38 2aa~3flw.

Other changes:

  • Runners now work on a copy of the config, so that changes they make, e.g. to the λ schedule, don't carry over to other runners created from the same config.
  • The windows applied are recorded in the saved config as torsion_windows, and restarts check that they match. Simulations started before this option existed must be restarted with torsion_window set to false if a window would now be applied.

@lohedges lohedges changed the title Add linear_torsions option to avoid torsion singularities at linear angles Add torsion_window option to avoid torsion singularities at linear angles Nov 11, 2026
@lohedges
lohedges merged commit 6dea460 into devel Nov 11, 2026
3 of 4 checks passed
@lohedges
lohedges deleted the feature_linear_torsions branch November 11, 2026 12:49

This branch had an error being deployed

1 failed deployment
somd2-build — 9cdf0ef1 Deployed Nov 11, 2026 by lohedges via build (3.13, linux) #149
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