示例#1
0
    def draw(self, coordsl, index):
        from pele.systems._opengl_tools import draw_sphere

        coords = coordsl.reshape([-1, 3])
        com = np.mean(coords, axis=0)

        # draw atoms as spheres      
        for i, name in enumerate(self.atom_names):  # in self.potential.prmtop.topology.atoms():
            x = coords[i, :] - com
            col = elements[name]['color']
            if index == 2:
                col = [0.5, 1.0, .5]
            rad = elements[name]['radius'] / 5
            draw_sphere(x, radius=rad, color=col)

        # draw bonds  
        for atomPairs in self.bonds:  # self.potential.prmtop.topology.bonds():
            # note that atom numbers in topology start at 0
            xyz1 = coords[atomPairs[0]] - com
            xyz2 = coords[atomPairs[1]] - com

            self.drawCylinder(xyz1, xyz2)
示例#2
0
    def draw(self, coordsl, index):
        from pele.systems._opengl_tools import draw_sphere

        coords = coordsl.reshape([-1, 3])
        com = np.mean(coords, axis=0)

        # draw atoms as spheres
        for i, name in enumerate(
                self.atom_names):  # in self.potential.prmtop.topology.atoms():
            x = coords[i, :] - com
            col = elements[name]['color']
            if index == 2:
                col = [0.5, 1.0, .5]
            rad = elements[name]['radius'] / 5
            draw_sphere(x, radius=rad, color=col)

        # draw bonds
        for atomPairs in self.bonds:  # self.potential.prmtop.topology.bonds():
            # note that atom numbers in topology start at 0
            xyz1 = coords[atomPairs[0]] - com
            xyz2 = coords[atomPairs[1]] - com

            self.drawCylinder(xyz1, xyz2)
示例#3
0
    def draw(self, rbcoords, index, shift_com=True):  # pragma: no cover
        from pele.systems._opengl_tools import draw_sphere, draw_cylinder
        coords = self.aasystem.to_atomistic(rbcoords).reshape(-1, 3)
        if shift_com:
            com = np.mean(coords, axis=0)
            coords = coords - com[np.newaxis, :]

        for atom_type, xx in zip(self.atom_types, coords):
            color = [1.0, 0.0, 0.0]
            radius = 0.3
            if atom_type in elements:
                color = elements[atom_type]["color"]
                radius = elements[atom_type]["radius"] * self.render_scale
            if index == 2:
                color = [0.5, 1.0, .5]
            draw_sphere(xx, radius, color)

        if hasattr(self, "draw_bonds"):
            color = [1.0, 1.0, 1.0]
            if index == 2:
                color = [0.5, 1.0, .5]
            for i1, i2 in self.draw_bonds:
                draw_cylinder(coords[i1], coords[i2], color=color)
示例#4
0
 def draw(self, rbcoords, index, shift_com=True): # pragma: no cover
     from pele.systems._opengl_tools import draw_sphere, draw_cylinder
     coords = self.aasystem.to_atomistic(rbcoords).reshape(-1, 3)
     if shift_com:
         com = np.mean(coords, axis=0)
         coords = coords - com[np.newaxis, :]
     
     for atom_type, xx in zip(self.atom_types, coords):
         color = [1.0, 0.0, 0.0]
         radius = 0.3
         if atom_type in elements:
             color = elements[atom_type]["color"]
             radius = elements[atom_type]["radius"] * self.render_scale
         if index == 2:
             color = [0.5, 1.0, .5]   
         draw_sphere(xx, radius, color) 
         
             
     if hasattr(self, "draw_bonds"):
         color = [1.0, 1.0, 1.0]
         if index == 2:
             color = [0.5, 1.0, .5]               
         for i1, i2 in self.draw_bonds:
             draw_cylinder(coords[i1], coords[i2], color=color)