mdevaluate/test/test_pbc.py

15 lines
325 B
Python
Raw Normal View History

2022-04-20 12:08:38 +00:00
from pytest import approx
from mdevaluate import pbc
import numpy as np
def test_pbc_diff():
x = np.random.rand(10, 3)
y = np.random.rand(10, 3)
box = np.ones((3,))
2023-12-18 13:47:22 +00:00
assert pbc.pbc_diff(x, x, box) == approx(0)
dxy = (pbc.pbc_diff(x, y, box) ** 2).sum(axis=1) ** 0.5
2022-04-20 12:08:38 +00:00
assert (dxy <= 0.75**0.5).all()