class rgpot::nlist::MinimumImage

Nearest periodic image for row-major lattice vectors: d - n H.

The working type is double. Each product-sum is rgpot::simd::mul_add: a hardware fused multiply-add when the processor has one, and the exactly rounded TwoProduct/TwoSum emulation otherwise. This translation unit is compiled with contraction off, so the folded bits do not depend on the instruction set. A cell whose infinity-norm condition estimate would spend more than half the double significand is Minkowski-reduced (Nguyen and Stehlé, ACM Trans. Algorithms 5, 46 (2009), doi:10.1145/1597036.1597050) and the image is taken in that basis. A reduced basis that is still too ill-conditioned searches the 27 images of coefficients in {-1, 0, 1}. Singular or non-finite cells throw. An index that does not fit in an int64 throws.

#include <MinimumImage.hpp>
 
class MinimumImage {
public:
    // construction
 
    MinimumImage();
    MinimumImage(const double* cell, const std::array<bool, 3>& periodic);
 
    // methods
 
    void fold(double& dx, double& dy, double& dz) const;
};