Example #1
0
def test_write_prec():
    mf_xtc = XTCFile(XTC_multi_frame)
    with XTCFile('foo.xtc', 'w') as f_out:
        assert_equal(f_out.n_atoms, 0)
        frame = mf_xtc.read()
        f_out.write(frame.x, frame.box, frame.step, frame.time, 100.0)

    xtc = XTCFile('foo.xtc')
    assert_equal(len(xtc), 1)
    frame = xtc.read()
    assert_equal(frame.prec, 100.0)
def test_write_prec():
    mf_xtc = XTCFile(XTC_multi_frame)
    with XTCFile('foo.xtc', 'w') as f_out:
        assert_equal(f_out.n_atoms, 0)
        frame = mf_xtc.read()
        f_out.write(frame.x, frame.box, frame.step,
                    frame.time, 100.0)

    xtc = XTCFile('foo.xtc')
    assert_equal(len(xtc), 1)
    frame = xtc.read()
    assert_equal(frame.prec, 100.0)
Example #3
0
def test_write_prec(tmpdir, xtc):
    outname = str(tmpdir.join('foo.xtc'))
    with XTCFile(outname, 'w') as f_out:
        assert f_out.n_atoms == 0
        frame = xtc.read()
        f_out.write(frame.x, frame.box, frame.step, frame.time, 100.0)
    xtc = XTCFile(outname)
    assert len(xtc) == 1
    frame = xtc.read()
    assert frame.prec == 100.0
def test_xtc():
    f = XTCFile(XTC_single_frame)
    assert_equal(f.n_atoms, 10)
    xyz, box, step, time, prec = f.read()
    # xtc only saves with 3 decimal places precision
    assert_array_almost_equal(xyz.flat, np.arange(30), decimal=3)
    assert_array_almost_equal(box, np.eye(3) * 20, decimal=3)
    assert_equal(step, 0)
    assert_equal(time, 10.0)
    assert_equal(prec, 1000.0)
Example #5
0
def test_xtc():
    f = XTCFile(XTC_single_frame)
    assert_equal(f.n_atoms, 10)
    xyz, box, step, time, prec = f.read()
    # xtc only saves with 3 decimal places precision
    assert_array_almost_equal(xyz.flat, np.arange(30), decimal=3)
    assert_array_almost_equal(box, np.eye(3) * 20, decimal=3)
    assert_equal(step, 0)
    assert_equal(time, 10.0)
    assert_equal(prec, 1000.0)
Example #6
0
def test_write_prec(tmpdir, xtc):
    outname = str(tmpdir.join('foo.xtc'))
    with XTCFile(outname, 'w') as f_out:
        assert f_out.n_atoms == 0
        frame = xtc.read()
        f_out.write(frame.x, frame.box, frame.step, frame.time, 100.0)
    xtc = XTCFile(outname)
    assert len(xtc) == 1
    frame = xtc.read()
    assert frame.prec == 100.0