Abstract
We present a simple yet efficient random (brute-force) algorithm for constructing solvated molecular systems. By placing solvent molecules at random positions and orientations within a simulation box, we circumvent the complexities typically associated with more sophisticated packing algorithms. The main computational cost lies in detecting and preventing steric overlaps between newly placed molecules and those already inserted. To address this, we employ a k-d tree—a data structure that partitions three-dimensional space—to query potential overlaps in near-logarithmic time with respect to system size. When combined with a dynamic batch insertion strategy, this method reduces the frequency of tree rebuilding and achieves nearly linear scaling for large systems, thereby avoiding the high overhead commonly incurred by naive O(N) distance checks.