[WIP] A generalized PeriodicEuclidean (allows specifying the periods as a parallelogon) #237
+27
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In physics, we often use lattices, the periodic boundary condition is non-rectangular in most cases. It can be an arbitrary parallelogon.
It would be nice if the periods can be a matrix, it will make
NearestNeighbors.jl
more useful to condensed matter physicists.I am not very familiar with the design pattern of this package, if someone feel the added code is not qualified according to your standard, please feel free to modify this PR. Thanks!
Example
UPDATE: somehow, the NearestNeighbors.jl does not work properly with this update. Still checking why it is so.
UPDATE 2: they redefined some functions in their own package... this is so wield.
https://github.com/KristofferC/NearestNeighbors.jl/blob/1de39f57fcf5e51ce51592e382f530e514a59952/src/evaluation.jl#L9
https://github.com/KristofferC/NearestNeighbors.jl/blob/1de39f57fcf5e51ce51592e382f530e514a59952/src/ball_tree.jl#L64
@KristofferC
UPDATE3: This issue can be fixed by this monkey patch (KristofferC/NearestNeighbors.jl#130). I tested it in my lattice package, it is a correct fix.