Add 2RN2 FKC-steered free-energy example; reorganise notebooks#222
Open
YuuuXie wants to merge 11 commits into
Open
Add 2RN2 FKC-steered free-energy example; reorganise notebooks#222YuuuXie wants to merge 11 commits into
YuuuXie wants to merge 11 commits into
Conversation
Add a self-contained FKC steered-sampling example (notebooks/steered_dg_example.py) that compares folding ΔG with and without RMSD steering across particle counts, evaluated via the FNC CV, plus a README documenting all notebook examples. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Run the unsteered ΔG baseline through dpm_solver_fkc with an empty potential (fk_potentials=[], steering_config=None) at the same step count and SDE noise (N=100, noise=1.0) as the steered runs, so the two estimates are directly comparable. Document the FNC-CV reference-ΔG provenance (thermomutdb_fnc_slopes.csv). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The steering slope for RMSD-based CVs must be negative (drive toward high RMSD / unfolding, then reweight), matching run_steering_foldedness.py's NEGATIVE_SLOPE_CVS and the release cv_steer.yaml default. Earlier code used a positive slope which over-folded and biased ΔG. Empirically validated on 2ABD (negative -> ΔG -1.18 ≈ ref -1.2; positive -> -1.55, biased). Add steered_dg_subsampling.py: generates a large pool of steered (FKC) and unsteered (empty-potential FKC) samples in batches, sub-samples to produce ΔG convergence curves with error bars. On 2RN2 the steered curve converges to the internal reference (-5.3 kcal/mol) by a few hundred samples while the unsteered baseline saturates at an artifactual floor (~-9.5). Update README with corrected 2ABD numbers, the negative slope-sign convention, and the 2RN2 convergence result. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reorganise notebooks/ into self-documented subfolders (Enhanced_Diffusion_ Sampling_Protein, Enhanced_Diffusion_Sampling_GMM, Physicality_Steering, PPFT), each with its own README, and slim notebooks/README.md to a brief index. The protein steered free-energy example is consolidated for release as a two-file 2RN2 example: - steered_dg_2rn2.py: single-run, single-GPU generation of ~1000 steered and unsteered samples, then a ΔG convergence curve (with error bars) via batch subsampling. - steered_dg_lib.py: shared library (2RN2 system, FKC steering / unsteered denoiser configs, FNC ΔG recipe, subsampling utilities). FKC RMSD steering recovers the internal reference folding ΔG (≈ -5.3 kcal/mol) at a sample budget where the unsteered baseline saturates and cannot resolve the rare unfolded state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
YuuuXie
commented
Jun 9, 2026
Co-authored-by: Yu Xie <xieyu.fish@outlook.com>
…irectly Ship the steered (RMSD CV + linear potential) and unsteered (empty potential) denoiser configs as self-contained YAML files next to the example, mirroring config/steering/cv_steer.yaml. The driver loads them via load_denoiser_config() (injecting only the runtime reference_pdb / num_particles) and calls bioemu sample() directly instead of a generate_pool wrapper. The steering potential used for inverse-Boltzmann reweighting is now instantiated from the same YAML fk_potentials entry, so the sampling and reweighting potentials cannot drift. The RMSD slope sign is written explicitly in YAML (-9.77, the per-system 2RN2 value) rather than via -abs() in code. System no longer carries steer_slope / steer_clip_max. Verified: ΔG on existing pools unchanged (steered -4.786, unsteered -9.504). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
precompute_steered_batches / precompute_unsteered_cv now glob the batch_*.npz written directly into each pool directory instead of rglob-ing recursively, so the single-process steered_dg_2rn2.py example computes ΔG and the convergence plot from exactly the samples it generated under steered_pool/ and unsteered_pool/, rather than inadvertently pooling stale shard subdirectories from earlier runs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apply black/isort, strip trailing whitespace, and satisfy mypy: assert the steering potential's CV is not None before use, and array-ify the per-draw ΔG lists under new names so they are not flagged as List[float]. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
test_steering_numerically imports toy_gmm, which moved into notebooks/Enhanced_Diffusion_Sampling_GMM/ during the notebooks reorganisation. Point sys.path at that subfolder so collection succeeds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
Author
|
@ludwigwinkler @nw13slx this PR adds the steering and dG calculation example of a real protein 2RN2 @sarahnlewis @ludwigwinkler I re-organized our previous examples into subdirs @sarahnlewis @josejimenezluna , we might need to make a new release after this because after my three PR of refactorizing the steering code and adding new steering features, the version is bumped to 1.4.0 now |
SummarySummary
Coveragesrc.bioemu - 89%
src.bioemu.colabfold_inline - 79.1%
src.bioemu.hpacker_setup - 69.2%
src.bioemu.steering - 79.5%
src.bioemu.training - 100%
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a release-ready, end-to-end FKC-steered folding free-energy (ΔG) example on a real protein (2RN2, E. coli RNase H), and reorganises
notebooks/into self-documented per-topic subfolders.What's included
notebooks/Enhanced_Diffusion_Sampling_Protein/(new example):steered_dg_2rn2.py— single-run, single-GPU generation of ~1000 steered + ~1000 unsteered samples (a direct call to bioemusample()), then a ΔG convergence curve (with error bars) via batch subsampling.steered_denoiser.yaml/unsteered_denoiser.yaml— self-contained denoiser configs (passed straight tosample()), mirroringsrc/bioemu/config/steering/cv_steer.yaml. The steered config is the RMSD CV + linear potential with the per-system 2RN2 values; the unsteered config is the same FKC integrator with an empty potential.steered_dg_lib.py— shared library: 2RN2 system definition, YAML config loader, the Fraction-of-Native-Contacts ΔG recipe, and the subsampling utilities. Uses release APIs only.README.md— usage, outputs, example result, and implementation notes.Reorganisation of
notebooks/into per-topic subfolders, each with its own README, and a slimmed top-level index README:Enhanced_Diffusion_Sampling_Protein/(steered protein ΔG)Enhanced_Diffusion_Sampling_GMM/(toy-GMM FKC validation + umbrella/MBAR)Physicality_Steering/(physical/clash steering)PPFT/(property-prediction fine-tuning)Key technical notes
steered_denoiser.yamlasslope: -9.77(the per-system 2RN2 value from the internalsystems_config.csv); the release default incv_steer.yamlis a generic-7.4. The steered ensemble is reweighted back to the unbiased ensemble with inverse-Boltzmann weights, using a steering potential instantiated from the same YAML entry so sampling and reweighting cannot drift.fk_potentials: [],steering_config: null) and identical step count / SDE noise (N=100, noise=1.0), so the two ΔG estimates are directly comparable.batch_*.npzthis run writes directly intosteered_pool/andunsteered_pool/.foldedness_from_fnc(steepness=20, p_fold_thr=0.5) → weighted p_fold →ΔG = -kT·ln(p_fold/(1-p_fold)).Verification
bioemuenv.Follow-up
bioemu.__version__is now1.4.0but the latest published tag isv1.3.1— a new release should be cut.🤖 Generated with assistance from GitHub Copilot CLI.