def test_lattice_real_mesh_trivial(): """ Test that Lattice.mesh works identically to Lattice.frac_mesh for trivial lattice """ lattice = Lattice(np.eye(3)) x = np.linspace(0, 1, num=8) for frac, real in zip(lattice.frac_mesh(x), lattice.mesh(x)): assert np.allclose(frac, real)
def test_lattice_real_mesh(): """ Test that Lattice.mesh works as expected """ lattice = Lattice(2 * np.eye(3)) x = np.linspace(0, 1, num=8) # since lattice is a stretched euclidian lattice, we expect # a maximum length of 2 assert np.max(lattice.mesh(x)[0]) == 2