[Media] Tired of slow Python biology tools, so I wrote the first pure-Rust macromolecule modeling engine. Processes 3M atoms in ~600ms.
![[Media] Tired of slow Python biology tools, so I wrote the first pure-Rust macromolecule modeling engine. Processes 3M atoms in ~600ms.](https://i.redd.it/lmlhy72iw8lg1.png)
Hey guys, I'm a high schooler. I was getting really frustrated with standard prep tools (which are mostly just Python wrappers around old C++ code). They are super slow, eat up way too much RAM, and sometimes they just randomly segfault when you feed them a messy PDB file.
So obviously, I decided to rewrite it in Rust lol.
It’s called BioForge. As far as I know, it's the first pure-Rust open-source modeling crate and CLI for preparing proteins and DNA/RNA. It basically takes raw experimental structures, cleans them, repairs missing heavy atoms, adds hydrogens based on pH, and builds water boxes around them.
Because it's Rust, the performance is honestly insane compared to what biologists normally use. I used rayon for the multithreading and nalgebra for the math. There are zero memory leaks and it literally never OOMs, even on massive systems. If you look at the benchmark in the second picture, the scaling is strictly O(n). It chews through a 3-million atom virus capsid in about 600 milliseconds.
Also, the best part about having no weird C-bindings is WASM. I compiled the entire processing pipeline to WebAssembly and built a Web-GLU frontend for it. You can actually run this whole engine directly in your browser here: bio-forge.app.
The crate is up on crates.io (cargo add bio-forge) and the repo is here: github.com/TKanX/bio-forge.
I'm still learning, so if any senior Rustaceans want to look at the repo and roast my code structure or tell me how to optimize it further, I'd really appreciate it!