TL;DR
This paper introduces AnACor2.0, a new open-source software package that significantly speeds up analytical absorption corrections in X-ray crystallography using GPU acceleration and novel sampling techniques. This advancement is crucial for analyzing data from highly absorbing samples, enabling faster and more accurate structure determination.
What Problem Does This Paper Address?
X-ray crystallography is a powerful technique for determining the 3D structure of molecules. However, when crystals are highly absorbing of X-rays (common with long-wavelength data), the intensity of diffracted beams is reduced in a complex way that depends on the crystal's shape and composition. This "absorption effect" needs to be corrected for accurate structure determination. Traditional methods like spherical harmonics work well when there's a lot of data from different orientations, but struggle with limited datasets or radiation-sensitive crystals. Analytical absorption correction, which uses a 3D model of the crystal, offers a more robust solution. However, the computational cost of ray-tracing through millions of voxels in a detailed 3D model makes this process very time-consuming, hindering its practical application.
Methods
AnACor2.0 tackles the computational bottleneck of analytical absorption correction through several key innovations:
- GPU Acceleration (CUDA): The core ray-tracing computations are offloaded to NVIDIA GPUs using CUDA, leveraging their massive parallel processing capabilities. This allows for hundreds of thousands of threads to run concurrently.
- Sampling Strategies: Instead of processing every single voxel in the 3D model, AnACor2.0 employs various sampling techniques (systematic, random, randomized systematic, and stratified) to select a representative subset of voxels. This drastically reduces computation while maintaining accuracy.
- Bisection Method for Path Lengths: Standard ray-tracing involves stepping through each voxel. AnACor2.0 uses a bisection approach to iteratively find material boundaries, significantly reducing the complexity of path length calculations from O(n) to O(log₂n).
- Gridding Interpolation: For efficiency, especially with multiple datasets, AnACor2.0 calculates angular-dependent absorption grids. This allows for interpolation to find absorption corrections for reflections, avoiding redundant calculations for similar X-ray directions.
- Optimized Data Transfer: To minimize the slow transfer of data between CPU and GPU memory, the voxel cube is transferred once, and all reflections are calculated in parallel on the GPU.
Datasets
The study evaluated AnACor2.0 using three experimental datasets from protein crystals:
- Insulin: A roughly spherical crystal.
- Thermolysin: A pyramidal crystal.
- Thaumatin: An asymmetrical crystal.
These datasets were collected at different long wavelengths (3.10 Å, 3.53 Å, and 4.13 Å, respectively) and represent a range of crystal shapes and space groups. The paper also mentions using simulated data for evaluation.
Key Insights and Ideas
- GPU Power Unleashed: The paper demonstrates that leveraging GPUs with CUDA can dramatically accelerate a computationally intensive task like analytical absorption correction, making it practical for routine use.
- Sampling is Key: The effectiveness of sampling strategies is a major finding. By intelligently selecting a subset of voxels, significant speedups can be achieved with minimal loss in accuracy.
- Bisection Beats Brute Force: The bisection method for path length calculation is a clever algorithmic improvement that offers a substantial theoretical and practical speedup over traditional voxel-by-voxel traversal.
- Crystal Shape Matters for Sampling: Different sampling strategies perform better for different crystal shapes. While systematic sampling is generally robust, stratified sampling shows promise for more spherical crystals.
- Accuracy Maintained: Crucially, these acceleration techniques do not significantly compromise the accuracy of the absorption correction or the quality of the resulting crystallographic data (e.g., anomalous peak heights).
Key Results
- Speedup: AnACor2.0 achieves a maximum reduction in execution time of up to 175x compared to previous methods. For the insulin dataset, calculations can be completed in less than 10 seconds.
- Accuracy:
- Mean difference in absorption factors from full calculation (no sampling) is at most 2%.
- Mean difference in anomalous peak heights of sulfur atoms is at most 1%.
- Sampling Effectiveness: Sampling ratios as low as 0.01% show minimal differences (<2%) in absorption factors, and differences become nearly zero above 0.5%. Anomalous peak height differences are within 1% for sampling ratios above 0.01%.
- GPU Performance: GPU acceleration (using H100) can reduce processing time for insulin and thaumatin to a few minutes, achieving absorption factor differences below 0.5% compared to 100% sampling.
- CPU Alternatives: For users without GPU access, the bisection method offers significant speedups over standard ray-tracing, and the gridding method is particularly effective for large datasets.
Limitations and Future Work
- Stratified Sampling Scalability: While effective for small, spherical crystals, stratified sampling's computational time increases exponentially with crystal size, making it less practical for large, complex samples.
- Gridding Interpolation Accuracy: The gridding method, while efficient, can introduce errors due to nearest-neighbor interpolation, especially when large path length differences occur between adjacent grid points or for non-spherical crystals.
- Future Integration: The authors plan to integrate AnACor2.0 within the DIALS software package, making it more accessible to the crystallography community.
- Generalizability: The method is presented as applicable to any dataset with a voxel-annotated file and clearly defined coordinate system, suggesting broad applicability beyond the tested samples.
Summary updated