Shipped this project!
Correct N-Terminal Proline Hydrogen Geometry
Correct N-Terminal Proline Hydrogen Geometry
Fixed a bug where N-terminal Proline residues were incorrectly assigned three hydrogens (H1, H2, H3) with a standard primary amine sp³ geometry. Proline has a secondary amine due to its pyrrolidine ring, so its N-terminus should only receive two hydrogens (H2, H3) when protonated, and one (H2) when deprotonated. The geometry calculation has been updated to correctly place these hydrogens based on the angle bisector of the CA-N-CD bonds, respecting the ring structure.
Updated construct_n_term_hydrogens in ops/hydro.rs:
StandardResidue::PRO.Added Validation Tests:
n_terminal_pro_residue helper for generating test cases.pro_n_terminal_defaults_to_protonated_without_ph, pro_n_terminal_remains_protonated_below_pka, pro_n_terminal_deprotonates_above_pka).pro_n_terminal_h_has_tetrahedral_bond_lengths, pro_n_terminal_h_has_tetrahedral_bond_angles) to ensure the newly placed hydrogens satisfy the expected 1.01 Å bond length and ~109.5° tetrahedral angles relative to the CA and CD atoms.
Log in to leave a comment
Improved Accuracy and Performance.
Performance: Enhanced both parallel and algorithmic efficiency. (For details, please refer to the release notes and associated PRs.)
Accuracy: Implemented a script enabling one-command reproduction of benchmark results (https://github.com/caltechmsc/dreid-pack?tab=readme-ov-file#benchmark). The results achieve state-of-the-art performance, outperforming both SCWRL4 and FASPR.
dpack-bench Binary and Workspace Restructuring - by @TKanX in https://github.com/caltechmsc/dreid-pack/pull/10
Full Changelog: https://github.com/caltechmsc/dreid-pack/compare/v0.1.0...v0.2.0
Log in to leave a comment
Finally released! This project consists of 8 sub-projects (packages), totaling over 100,000 lines of code. Ahhhhh!
With a total of ~150 commits (spanning the past 20 days, 12h+/day), I won’t repeat the details here. You can check it out on GH.
The first production-ready version has been released: https://github.com/caltechmsc/dreid-pack/releases/tag/v0.1.0
Log in to leave a comment
This project consists of multiple sub-projects (decoupled for modularity, as the scope of work is massive—spanning hundreds of thousands of lines of Rust code).
Please refer to the attached diagram for the specific architecture. Full is open-sourced under the MIT License.
PS: The scientific rigor of the project has been validated, and I presented a talk on it at the Caltech Theoretical Chemistry Seminar, see: https://marcuscenter.caltech.edu/events/theory-seminar-series#:~:text=Tony%20Kan
Apologies—due to my ADHD, I’m unable to consistently pause to write detailed logs. However, all my Git commits are atomic (and I’ve already made thousands of them), and there is a corresponding Pull Request on GH for every feature that you can review.
If you need any support, please feel free to contact me!
Log in to leave a comment
NoneWithError in Enum Struct Tail AssertionFixes the ICE triggered when a syntax error appears inside an enum variant struct literal.
PR rust-lang/rust#153227 added StructTailExpr::NoneWithError and updated the match base arm in the AdtKind::Enum branch of thir/cx/expr.rs, but overlooked the assert!(matches!(...)) guard preceding it, which still only listed None | DefaultFields(_).
Closes rust-lang/rust#153390
Log in to leave a comment
Small aggregate arguments passed via PassMode::Cast in the Rust ABI (e.g. [u32; 2] cast to i64) are missing noundef in the emitted LLVM IR, even when the type contains no uninit bytes:
#[no_mangle]
pub fn f(v: [u32; 2]) -> u32 { v[0] }
; expected: define i32 @f(i64 noundef %0)
; actual: define i32 @f(i64 %0) ← noundef missing
This blocks LLVM from applying optimizations that require value-defined semantics on function arguments.
adjust_for_rust_abi calls arg.cast_to(Reg::Integer), which internally creates a CastTarget with ArgAttributes::new() — always empty. Any validity attribute that was present before the cast is silently dropped.
This affects all PassMode::Cast arguments and return values in the Rust ABI: plain arrays, newtype wrappers, and any BackendRepr::Memory type small enough to fit in a register.
A prior attempt (rust-lang/rust#127210) used Ty/repr attributes to detect padding.
After adjust_for_rust_abi, iterate all PassMode::Cast args and the return value. For each, call layout_is_noundef on the original layout; if it returns true, set NoUndef on the CastTarget’s attrs.
layout_is_noundef uses only the computed layout — BackendRepr, FieldsShape, Variants, Scalar::is_uninit_valid() — and never touches Ty or repr attributes. Anything it cannot prove returns false.
Covered cases:
Scalar / ScalarPair (both halves initialized, fields contiguous)FieldsShape::Array (element type recursively uninit-free)FieldsShape::Arbitrary with Variants::Single (fields cover 0..size with no gaps, each recursively uninit-free) — handles newtype wrappers, multi-field structs, single-variant enums, repr(transparent), repr(C) wrappers
Log in to leave a comment
size_of_val == 0 for DSTs with Non-zero-sized Prefix via NUW and Assumesize_of_val(p) == 0 fails to optimize away for DST types that have a statically-known non-zero-sized prefix:
pub struct Foo<T: ?Sized>(pub [u32; 3], pub T);
pub fn demo(p: &Foo<dyn std::fmt::Debug>) -> bool {
std::mem::size_of_val(p) == 0 // always false, but LLVM can't prove it
}
Foo has a 12-byte prefix, so its total size is always ≥ 12. Yet the comparison persists as a runtime computation in LLVM IR. This matters because Box<dyn T> drop emits this exact check to guard the deallocation call — for types with a guaranteed non-zero prefix, the branch should vanish but doesn’t.
The slice tail variant Foo<[i32]> already optimized correctly; Foo<dyn Trait> and Foo<[u8]> did not.
In size_and_align_of_dst (the ADT/Tuple branch), the size computation is:
full_size = (offset + unsized_size + (align-1)) & -align
LLVM cannot prove full_size > 0 because:
offset + unsized_size used plain add — no NUW flag, so LLVM cannot conclude the result is ≥ offset.(x + addend) & -align — LLVM has no information that alignment rounding never reduces the value below x.Additionally, the vtable alignment range metadata was [1, u64::MAX] (only non-zero), despite the actual bound being [1, 1 << (ptr_width - 1)] (all alignments are powers of two with a tighter upper bound).
Log in to leave a comment
def_kind in codegen_fn_attrs: ConstCoercing a #[target_feature] const fn to a function pointer inside a const body triggers an ICE (debug builds only):
#[target_feature(enable = "sse2")]
const fn with_target_feature() {}
const X: () = unsafe {
let _: unsafe fn() = with_target_feature; // ICE
};
assertion failed: def_kind.has_codegen_attrs()
unexpected `def_kind` in `codegen_fn_attrs`: Const
Introduced in rust-lang/rust#135504 (2025-01-14, commit 8fee6a77394). adjust_target_feature_sig unconditionally calls codegen_fn_attrs(caller) to get the caller’s target features. codegen_fn_attrs requires that the DefId satisfies has_codegen_attrs(). DefKind::Const, AssocConst, and InlineConst do not — they have no codegen attributes by design. The debug assertion fires.
In release builds the call “worked” accidentally: codegen_fn_attrs on a const would reach the query machinery and happen to return empty attributes, producing a correct (but unguaranteed) result. The bug was latent until debug builds exposed it.
Replace codegen_fn_attrs(caller) with body_codegen_attrs(caller). body_codegen_attrs exists precisely for this case: it delegates to codegen_fn_attrs for function-like DefKinds and returns CodegenFnAttrs::EMPTY for const items. A const body has no target features, so returning empty is semantically correct.
Also fix the pre-existing variable name callee_features → caller_features (the variable holds the caller‘s features, not the callee’s).
Log in to leave a comment
Can process a viral capsid with 8 million atoms in one second (~800ms)!
Full Changelog: https://github.com/TKanX/bio-forge/compare/v0.3.1...v0.4.0
Significantly enhances the hydrogenation pipeline (ops::hydro) by introducing context-aware histidine protonation logic. It now detects potential salt bridges between histidine residues and nearby carboxylate groups (ASP⁻, GLU⁻, C-terminal COO⁻), automatically converting them to the doubly protonated HIP state when geometrically favorable. Additionally, the pH handling logic has been refined to allow users to opt-out of automatic protonation state changes by omitting the --ph flag, preserving original residue names while still adding hydrogens.
Log in to leave a comment
SEE PR #36: https://github.com/TKanX/bio-forge/pull/36
Summary:
Addresses geometric artifacts observed in reconstructed terminal atoms (N-terminal hydrogens, C-terminal OXT, and nucleic acid termini). The previous implementation of calculate_transform was too simplistic for single/double atom alignments and relied on global SVD coupling which could distort local geometry. Additionally, terminal atom construction has been rewritten to use robust local coordinate frames based on standard bond lengths and angles, rather than rough vector approximations.
Log in to leave a comment
Core Mathematical Kernel
High-Performance Architecture
Portability & Usability
no_std Support: Fully compatible with bare-metal and WASM environments (via libm).NsOrbital) for safety and a low-level functional API (sto_coulomb_integral) for raw performance.Full Changelog: https://github.com/TKanX/sto-ns/commits/v0.1.0
Log in to leave a comment
Comprehensive Force Field Support
High-Performance Architecture
Portability & Usability
no_std Support: Fully compatible with bare-metal, embedded, and WebAssembly (WASM) environments.phf crate), keeping the dependency tree minimal.Full Changelog: https://github.com/TKanX/ffcharge/commits/v0.1.0
Log in to leave a comment
Based on quantum mechanical dynamic charge calculations, this accurately calculates the electric field and charge distribution polarization of drug-protein ligand binding pockets, which is used in drug simulations.
Introduces a major new feature to the cheq library: the ability to perform charge equilibration in the presence of an external electrostatic potential. This enables hybrid QEq/MM simulations, where a quantum-mechanically treated region (the QEq system) polarizes in response to a classical environment (the external field). The implementation supports contributions from both discrete point charges and a uniform electric field, which are incorporated into the QEq equations by modifying the effective electronegativity of each atom.
Implemented ExternalPotential and PointCharge Data Structures:
PointCharge struct to represent a fixed charge in the classical environment (e.g., an atom from a protein).ExternalPotential struct to aggregate contributions from multiple PointCharges and/or a uniform_field.ExternalPotential (with_point_charges, with_uniform_field) for ergonomic construction.Introduced a New solve_in_field Solver Method:
QEqSolver::solve_in_field, which accepts an ExternalPotential as an argument.V_ext at each QEq atom’s position, using the same STO/GTO shielded Coulomb formalism for consistency with internal interactions.χ_i* = χ_i + V_ext_i), effectively polarizing the QEq system.Parallelized External Potential Calculation:
rayon for optimal performance.
Log in to leave a comment
Nice addition to Cheq. Supporting external electrostatic potentials (point charges and uniform fields) enables hybrid QEq/MM-style setups and makes charge equilibration more physically realistic.
Full Changelog: https://github.com/TKanX/bio-forge/compare/v0.2.2...v0.3.0
Full Changelog: https://github.com/TKanX/bio-forge/compare/v0.2.2...v0.3.0
Log in to leave a comment
DIFF(+15,607): https://github.com/TKanX/bio-forge/pull/26/changes
Introduces the official BioForge Web Application, a high-performance, browser-based interface for molecular structure preparation. Built with Next.js 15, React 19, and Tailwind CSS, this application leverages the bio-forge-wasm crate to perform all heavy computations client-side, ensuring data privacy and zero-latency feedback. It features a fully integrated 3D viewer (Mol*), a reactive pipeline configuration system, and a robust state management architecture utilizing Zustand.
WASM Integration & Core Logic:
core/wasm to ensure the heavy binary is initialized only once.PipelineExecutor (core/pipeline) that orchestrates the execution of Clean, Repair, Hydro, Solvate, and Topology operations directly in the browser thread.core/file) capable of handling PDB, mmCIF, and MOL2 templates, converting them into managed FileEntry objects with live WASM structure references.User Interface & Experience:
oklch color spaces for a modern, accessible dark mode aesthetic.
Log in to leave a comment
Full Changelog: https://github.com/TKanX/bio-forge/commits/v0.2.2
Log in to leave a comment