Skip to content

fix: correct bond reading mechanism from input coordinates - #1

Merged
amorehead merged 1 commit into
Zatom-AI:mainfrom
rish-16:main
Oct 26, 2026
Merged

amorehead merged 1 commit into
Zatom-AI:mainfrom
rish-16:main

Conversation

@rish-16

@rish-16 rish-16 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

docs/inference.md says molecule structure prediction perceives bonds with Open Babel when bond_sidecar_path=null, but only ZatomContigJsonDataset (validation) did this. zatom2 design loads specs through RFD3's ContigJsonDataset, so without a sidecar the model got an almost empty token_bonds graph and generated molecules with the right formula but the wrong connectivity.

  • Perceive bonds from preserved native coordinates in to_pipeline_input, which every inference path goes through.
  • Move _can_perceive_ligand_bonds to bond_sidecar.py and share one helper with ZatomContigJsonDataset (no double perception; sidecars still take precedence).
  • Add test_contig_inference_perceives_bonds_without_sidecar, covering the CLI loading path.

@amorehead amorehead changed the title Fix bond reading mechanism from input coordinates fix: correct bond reading mechanism from input coordinates Oct 25, 2026

@amorehead amorehead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your contribution!

@amorehead
amorehead merged commit 037350a into Zatom-AI:main Oct 26, 2026
1 check passed
@amorehead
amorehead requested a balanced review from Copilot October 26, 2026 01:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Sidecar-backed ligand inputs now require Open Babel before their precomputed bonds can be loaded, breaking those inputs when it is unavailable.

1 open issue
What changed in this PR

This PR addresses missing molecular connectivity in zatom2 design by moving bond perception into the shared inference-input conversion path.

Changes:

  • Perceive ligand bonds using preserved native coordinates before inference transforms.
  • Share perception logic with the validation dataset and avoid repeated perception.
  • Add regression coverage for the CLI’s ContigJsonDataset loading path.
File Description
tests/​test_bond_sidecar.py Tests inference bond perception without a sidecar.
src/​nucleus/​utils/​datasets.py Reuses shared perception logic and skips it when already completed.
src/​nucleus/​utils/​bond_sidecar.py Adds the shared native-coordinate bond-perception helper.
src/​nucleus/​inference_input_parsing.py Invokes bond perception during inference-input conversion.

Review effort: Balanced

Comment thread src/nucleus/inference_input_parsing.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants