Esempio n. 1
0
def test_coordinates_meta():
    from mdtraj.testing import get_fn
    fn, tn = [get_fn('frame0.pdb'),] * 2
    trajs = [pt.load(fn, tn), md.load(fn, top=tn), pmd.load_file(tn, fn)]

    N_FRAMES = trajs[0].n_frames

    from MDAnalysis import Universe
    u = Universe(tn, fn)
    trajs.append(Universe(tn, fn))

    views = [nv.show_pytraj(trajs[0]), nv.show_mdtraj(trajs[1]), nv.show_parmed(trajs[2])]
    views.append(nv.show_mdanalysis(trajs[3]))

    for index, (view, traj) in enumerate(zip(views, trajs)):
        view.frame = 3
        
        nt.assert_equal(view.trajlist[0].n_frames, N_FRAMES)
        nt.assert_equal(len(view.trajlist[0].get_coordinates_dict().keys()), N_FRAMES)

        if index in [0, 1]:
            # pytraj, mdtraj
            if index == 0:
                aa_eq(view.coordinates[0], traj.xyz[3], decimal=4)
            else:
                aa_eq(view.coordinates[0],10*traj.xyz[3], decimal=4)
            view.coordinates = traj.xyz[2]
Esempio n. 2
0
 def visualize(self, show_ports=False):
     """Visualize the Compound using nglview. """
     if run_from_ipython():
         structure = self.to_parmed(show_ports)
         return nglview.show_parmed(structure)
     else:
         raise RuntimeError('Visualization is only supported in Jupyter '
                            'Notebooks.')
Esempio n. 3
0
def test_show_parmed():
    import parmed as pmd
    fn = nv.datafiles.PDB
    parm = pmd.load_file(fn)
    view = nv.show_parmed(parm)

    ngl_traj = nv.ParmEdTrajectory(parm)
    ngl_traj.only_save_1st_model = False
    ngl_traj.get_structure_string()
Esempio n. 4
0
def test_show_parmed():
    import parmed as pmd
    fn = nv.datafiles.PDB 
    parm = pmd.load_file(fn)
    view = nv.show_parmed(parm)

    ngl_traj = nv.ParmEdTrajectory(parm)
    ngl_traj.only_save_1st_model = False
    ngl_traj.get_structure_string()
Esempio n. 5
0
def test_coordinates_meta():
    from mdtraj.testing import get_fn
    fn, tn = [get_fn('frame0.pdb'),] * 2
    trajs = [pt.load(fn, tn), md.load(fn, top=tn), pmd.load_file(tn, fn)]

    N_FRAMES = trajs[0].n_frames

    from MDAnalysis import Universe
    u = Universe(tn, fn)
    trajs.append(Universe(tn, fn))

    views = [nv.show_pytraj(trajs[0]), nv.show_mdtraj(trajs[1]), nv.show_parmed(trajs[2])]
    views.append(nv.show_mdanalysis(trajs[3]))

    for index, (view, traj) in enumerate(zip(views, trajs)):
        view.frame = 3
        
        nt.assert_equal(view._trajlist[0].n_frames, N_FRAMES)
Esempio n. 6
0
def test_coordinates_meta():
    from mdtraj.testing import get_fn
    fn, tn = [get_fn('frame0.pdb'),] * 2
    trajs = [pt.load(fn, tn), md.load(fn, top=tn), pmd.load_file(tn, fn)]

    N_FRAMES = trajs[0].n_frames

    from MDAnalysis import Universe
    u = Universe(tn, fn)
    trajs.append(Universe(tn, fn))

    views = [nv.show_pytraj(trajs[0]), nv.show_mdtraj(trajs[1]), nv.show_parmed(trajs[2])]
    views.append(nv.show_mdanalysis(trajs[3]))

    for index, (view, traj) in enumerate(zip(views, trajs)):
        view.frame = 3
        
        nt.assert_equal(view._trajlist[0].n_frames, N_FRAMES)
Esempio n. 7
0
def to_nglview_NGLWidget(item,
                         atom_indices='all',
                         structure_indices='all',
                         check=True):

    if check:

        digest_item(item, 'parmed.Structure')
        atom_indices = digest_atom_indices(atom_indices)
        structure_indices = digest_structure_indices(structure_indices)

    from nglview import show_parmed
    from . import extract

    tmp_item = extract(item,
                       atom_indices=atom_indices,
                       structure_indices=structure_indices,
                       copy_if_all=False,
                       check=False)
    tmp_item = show_parmed(tmp_item)

    return tmp_item
def test_show_parmed():
    import parmed as pmd
    fn = nv.datafiles.PDB
    parm = pmd.load_file(fn)
    view = nv.show_parmed(parm)
Esempio n. 9
0
def test_show_parmed():
    import parmed as pmd
    fn = nv.datafiles.PDB 
    parm = pmd.load_file(fn)
    view = nv.show_parmed(parm)