PF2Fit, a Polar Fast Fourier Fitting library, is a rigid-body fitting library that uses PFCorr, a non-uniform SO(3) Fourier-based scheme. A new generalized framework was developed to fit crystal structures into density maps. The framework includes three new scoring functions that quantify the goodness of fit between the crystal structure and density map: the scattering potential score, which is based on using a more realistic representation of the input crystal structure in terms of the density map, the non-uniform exterior penalty, which efficiently penalizes atoms outside a certain isocontour of the target density map, and the skeleton-secondary structure score, which correlates the skeleton of the density map with secondary structural elements in the crystal structure. The framework also includes a search scheme based on non-uniform correlations over the space of rotations SO(3), and a reranking stage that improves confidence in fitting results obtained during the initial search stage.