Ejemplo n.º 1
0
def test_volume(base_box):
    assert isclose(base_box.volume, np.product(base_box.L))
    for L in np.linspace(1, 10, 10):
        box = Box.cube(L)
        assert isclose(box.volume, L**3)
        box = Box(L, L + 1, L + 2)
        assert isclose(box.volume, L * (L + 1) * (L + 2))
Ejemplo n.º 2
0
def test_lattice_vectors(base_box):
    expected_vectors = np.array([[1, 0, 0], [2, 2, 0], [6, 9, 3]],
                                dtype=np.float64)
    assert np.allclose(base_box.lattice_vectors, expected_vectors)
    box = Box.cube(4)
    lattice_vectors = np.array([[4, 0, 0], [0, 4, 0], [0, 0, 4]])
    assert np.allclose(box.lattice_vectors, lattice_vectors)
Ejemplo n.º 3
0
def test_cube():
    for L in np.linspace(1, 100, 10):
        box = Box.cube(L)
        assert all(box.L == L)
        assert box.Lx == box.Ly == box.Lz == L