Skip to content

Set nonzero vina seed for determinism - #929

Merged
padix-key merged 1 commit into
biotite-dev:mainfrom
jberg5:set-vina-seed
Jul 18, 2026
Merged

Set nonzero vina seed for determinism#929
padix-key merged 1 commit into
biotite-dev:mainfrom
jberg5:set-vina-seed

Conversation

@jberg5

@jberg5 jberg5 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Should fix this failing test:

=========================== short test summary info ============================
FAILED tests/application/test_autodock.py::test_docking[True] - assert np.float32(2.6669219) < 2.0
 +  where np.float32(2.6669219) = <function max at 0x7feb411b0f70>(array([0., 0., 0., ..., 0., 0., 0.], shape=(1776,), dtype=float32))
 +    where <function max at 0x7feb411b0f70> = np.max
 +    and   array([0., 0., 0., ..., 0., 0., 0.], shape=(1776,), dtype=float32) = <function distance at 0x7feb189d28e0>(array([[38.607, 14.202, 18.949],\n       [39.073, 14.187, 17.510],\n       [38.898, 15.623, 16.986],\n       ...,\n       ...49, 23.656,  8.504],\n       [49.002, 21.454,  6.825],\n       [50.497, 22.367,  7.110]], shape=(1776, 3), dtype=float32), array([\n	Atom(np.array([ 31.137,  21.711, -13.344], dtype=float32), chain_id="B", res_id=84, ins_code="", res_name="ARG", hetero=False, atom_name="CD", element="C", charge=0),\n	...,\n]))
 +      where <function distance at 0x7feb189d28e0> = struc.distance
= 1 failed, 943 passed, 7 skipped, 4 xpassed, 14 warnings in 157.23s (0:02:37) =

Reason for this is pretty wild, apparently Vina interprets 0 as "please give me a random seed"

https://github.com/ccsb-scripps/AutoDock-Vina/blob/3c65c0b3e6c2c1d183f6a175ecb65e3c5ba91645/src/lib/vina.cpp#L56

@padix-key

Copy link
Copy Markdown
Member

Nice find! I already wondered why the docking results in the tests were still not deterministic.

@codspeed-hq

codspeed-hq Bot commented Jul 16, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 15.07%

⚡ 2 improved benchmarks
✅ 101 untouched benchmarks
⏩ 14 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
benchmark_match_kmer_selection[BucketKmerTable(10000)-None] 353.3 µs 303.7 µs +16.32%
benchmark_match[BucketKmerTable(10000)-None] 401.2 µs 352.5 µs +13.82%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing jberg5:set-vina-seed (e46d9e8) with main (1fa1b70)

Open in CodSpeed

Footnotes

  1. 14 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@jberg5

jberg5 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Thank you!! It is totally reasonable to assume that seed(0) means "use 0 as the random seed", I was extremely surprised to find out that autodock-vina has other ideas :)

@padix-key
padix-key merged commit 7fb9641 into biotite-dev:main Jul 18, 2026
24 checks passed
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.

2 participants