Ejemplo n.º 1
0
def test_lattice_frac_mesh_two_arr():
    """ Test that Lattice.frac_mesh is raising an exception for two input vectors """
    lattice = Lattice(np.eye(3))
    x = np.linspace(0, 1, num=2)

    with pytest.raises(ValueError):
        lattice.frac_mesh(x, x)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
def test_lattice_frac_mesh():
    """ Test that Lattice.frac_mesh is working as expected compared to numpy.meshgrid """
    lattice = Lattice(np.eye(3))
    x = np.linspace(0, 1, num=8)

    for out, n in zip(lattice.frac_mesh(x), np.meshgrid(x, x, x)):
        assert np.allclose(out, n)