Add TFG contact restraints for JSON constraints#310
Open
taivu1998 wants to merge 1 commit into
Open
Conversation
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
Addresses #307 by adding a supported Training-Free Guidance (TFG) path for JSON
constraint.contactinputs on Protenix v1/v2 models without enabling untrained constraint embedders.This PR:
UserDistanceRestraintPotential, a flat-bottom pairwise distance restraint term for user-provided contact boundsconstraint.contactentries into atom-pair TFG restraint features when TFG feature extraction is enabled--tfg_constraint_weightCLI knob for tuning restraint strengthRoot Cause
The v1/v2 checkpoints do not have trained
ConstraintEmbeddermodules enabled, so JSON constraints can be parsed without actually conditioning diffusion sampling. The existing TFG framework already supports differentiable geometry terms, but JSON contact constraints were not converted into TFG-compatible atom-pair features.Implementation Notes
The new restraint path is intentionally narrow:
constraint.pocketunsupported for v1/v2 TFG and documents that limitationValidation
python3 -m py_compile protenix/tfg/potentials.py protenix/tfg/config.py protenix/data/constraint/constraint_featurizer.py protenix/data/inference/json_to_feature.py runner/batch_inference.py tests/test_tfg_user_restraints.pygit diff --checkgit diff --cached --checkpython3 -m json.tool examples/example_tfg_contact_v1.jsonUserDistanceRestraintPotentialenergy and gradient directionpython -m pytest tests/test_tfg_user_restraints.py -qThe focused pytest file collected successfully in the local environment, but all tests were skipped because the local Python environment is missing optional Protenix chemistry dependencies such as RDKit/Biotite.
uv run pytest ...is also blocked locally by an existing invalid Anacondallvmliteegg-info version, before test execution begins.