Exemplo n.º 1
0
def test_load_trajectory(get_fn):
    # Compare a TNG file to the PDB file it was created from.

    pdbtraj = md.load_pdb(get_fn('frame0.pdb'))
    tngtraj = md.load_tng(get_fn('frame0.tng'), top=pdbtraj.topology)
    eq(pdbtraj.n_frames, tngtraj.n_frames)
    eq(pdbtraj.unitcell_vectors, tngtraj.unitcell_vectors)
    eq(pdbtraj.xyz, tngtraj.xyz)
Exemplo n.º 2
0
def test_load_trajectory():
    """Compare a TNG file to the PDB file it was created from."""
    
    pdbtraj = md.load_pdb(get_fn('frame0.pdb'))
    tngtraj = md.load_tng(get_fn('frame0.tng'), top=pdbtraj.topology)
    eq(pdbtraj.n_frames, tngtraj.n_frames)
    eq(pdbtraj.unitcell_vectors, tngtraj.unitcell_vectors)
    eq(pdbtraj.xyz, tngtraj.xyz)
Exemplo n.º 3
0
def test_load_topology(get_fn):
    # Test loading a Topology from a TNG file.

    traj = md.load_tng(get_fn('tng_example.tng'))
    top = traj.topology
    eq(5, top.n_residues)
    eq(10, top.n_bonds)
    bonds = [(a, b) for a, b in top.bonds]
    for res in top.residues:
        eq('HOH', res.name)
        eq(3, res.n_atoms)
        eq(md.element.oxygen, res.atom(0).element)
        eq(md.element.hydrogen, res.atom(1).element)
        eq(md.element.hydrogen, res.atom(2).element)
        assert (res.atom(0), res.atom(1)) in bonds
        assert (res.atom(0), res.atom(2)) in bonds
Exemplo n.º 4
0
def test_load_topology():
    """Test loading a Topology from a TNG file."""

    traj = md.load_tng(get_fn("tng_example.tng"))
    top = traj.topology
    eq(5, top.n_residues)
    eq(10, top.n_bonds)
    bonds = list(top.bonds)
    for res in top.residues:
        eq("HOH", res.name)
        eq(3, res.n_atoms)
        eq(md.element.oxygen, res.atom(0).element)
        eq(md.element.hydrogen, res.atom(1).element)
        eq(md.element.hydrogen, res.atom(2).element)
        assert (res.atom(0), res.atom(1)) in bonds
        assert (res.atom(0), res.atom(2)) in bonds
Exemplo n.º 5
0
def test_load_topology():
    """Test loading a Topology from a TNG file."""
    
    traj = md.load_tng(get_fn('tng_example.tng'))
    top = traj.topology
    eq(5, top.n_residues)
    eq(10, top.n_bonds)
    bonds = list(top.bonds)
    for res in top.residues:
        eq('HOH', res.name)
        eq(3, res.n_atoms)
        eq(md.element.oxygen, res.atom(0).element)
        eq(md.element.hydrogen, res.atom(1).element)
        eq(md.element.hydrogen, res.atom(2).element)
        assert((res.atom(0), res.atom(1)) in bonds)
        assert((res.atom(0), res.atom(2)) in bonds)