Exemple #1
0
def test_read_write_2():
    xyz = np.random.randn(1, 10, 3)
    time = np.random.randn(1)
    boxlengths = np.random.randn(1, 3)
    boxangles = np.random.randn(1, 3)

    with AmberNetCDFRestartFile(temp2, 'w', force_overwrite=True) as f:
        f.write(xyz, time, boxlengths, boxangles)

    with AmberNetCDFRestartFile(temp2) as f:
        a, b, c, d = f.read()
        yield lambda: eq(a, xyz)
        yield lambda: eq(b, time)
        yield lambda: eq(c, boxlengths)
        yield lambda: eq(d, boxangles)
Exemple #2
0
def test_shape_2():
    with AmberNetCDFRestartFile(get_fn('ncinpcrd.rst7')) as f:
        xyz, time, lengths, angles = f.read()

    yield lambda: eq(xyz.shape, (1, 2101, 3))
    yield lambda: eq(time.shape, (1, ))
    yield lambda: eq(lengths, np.asarray([[30.2642725] * 3]))
    yield lambda: eq(angles, np.asarray([[109.471219] * 3]))
def test_read_after_close(get_fn):
    f = AmberNetCDFRestartFile(get_fn('ncinpcrd.rst7'))
    assert eq(f.n_atoms, 2101)
    assert eq(f.n_frames, 1)

    f.close()

    with pytest.raises(IOError):
        f.read()
Exemple #4
0
def test_read_after_close():
    f = AmberNetCDFRestartFile(get_fn('ncinpcrd.rst7'))
    yield lambda: eq(f.n_atoms, 2101)
    yield lambda: eq(f.n_frames, 1)

    f.close()