This commit is contained in:
commit
568474d52f
1591 files changed
+528213
No files matched your search
@@ -0,0 +1,11 @@
|
||||
// PairDistance: the distance between two points in a cubic periodic box of
|
||||
// side Box, each coordinate difference taken by the minimum image
|
||||
// convention. HYPOT adds the squares without overflowing on the way.
|
||||
USE md.MinimumImage
|
||||
FUNCTION PairDistance(A : LIST OF FLOAT, B : LIST OF FLOAT, Box : FLOAT) RETURNS FLOAT
|
||||
REQUIRE LENGTH(A) == 3 AND LENGTH(B) == 3 AND Box > 0.0
|
||||
DECLARE Dx : FLOAT <- MinimumImage(A[0] - B[0], Box)
|
||||
DECLARE Dy : FLOAT <- MinimumImage(A[1] - B[1], Box)
|
||||
DECLARE Dz : FLOAT <- MinimumImage(A[2] - B[2], Box)
|
||||
RETURN HYPOT(HYPOT(Dx, Dy), Dz)
|
||||
ENDFUNCTION
|
||||
Reference in new issue
Block a user