{ "name": "PairDistance", "summary": "The distance between two points in a cubic periodic box, each coordinate difference taken by the minimum image convention.", "tags": [ "molecular dynamics", "periodic boundary conditions" ], "sources": [ { "title": "Allen and Tildesley, Computer Simulation of Liquids, section 1.5.2" } ], "cases": [ { "call": "PairDistance([0.1, 0.1, 0.1], [0.9, 0.9, 0.9], 1.0)" }, { "call": "PairDistance([0.0, 0.0, 0.0], [3.0, 4.0, 0.0], 20.0)" }, { "call": "PairDistance([1.0, 2.0, 3.0], [1.0, 2.0, 3.0], 5.0)" } ], "references": [ { "lang": "python", "level": "plain", "file": "ref/python/plain.py", "note": "The same steps, with math.hypot of all three differences at once.", "rel": 1e-15 }, { "lang": "mojo", "level": "plain", "file": "ref/mojo/plain.mojo", "note": "The same steps in Mojo, with the square root of the sum of squares.", "rel": 1e-15 } ] }