41 lines
1.1 KiB
JSON
41 lines
1.1 KiB
JSON
{
|
|
"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, 2nd edition (Oxford, 2017), sections 1.6.2, Periodic boundary conditions, and 1.6.3, Potential truncation: the minimum image convention"
|
|
}
|
|
],
|
|
"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
|
|
}
|
|
]
|
|
}
|