Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Nexus: make tiling more robust #1432
This PR fixes the issues raised in #1408. Full matrix tilings are trickier than first appreciated.
Nexus attempts to arrive at an effective diagonal tiling by reducing the tiling matrix into a volume preserving diagonal form via successive shear operations. This usually works, but the diagonal tiling apparently depends on the order of the shearing operations (e.g. you can sometimes get either (1,1,4) or (1,2,2)) as revealed by #1408.
This PR added tests of diagonal and matrix tiling and also a search over permutations in the shearing operation order. This change worked for the problem case of #1408, however it did not work for all of the randomly generated tiling matrices just added to the test set.
A final brute force fallback operation was added to catch the remaining cases: essentially find a bounding box for the tiled supercell in the basis of the untiled axes, generate new atomic coordinates in this bounding box, and then remove duplicate points. This approach was avoided originally because it's worst case scaling is order det(T)^3 rather than order det(T) as above.