def draw(self, rbcoords, index, shift_com=True): # pragma: no cover
        from pele.systems._opengl_tools import draw_atoms, draw_cylinder
        from matplotlib.colors import cnames, hex2color
        
        coords = self.aasystem.to_atomistic(rbcoords).copy()
        coords = coords.reshape([-1,3])
        if shift_com:
            com=np.mean(coords, axis=0)
            coords -= com[np.newaxis, :]
        else:
            com = np.zeros(3)
            
        radius = 0.42

        red = hex2color(cnames["red"])
        c2 = hex2color(cnames["grey"])
        draw_atoms(coords, self.harmonic_atoms, c2, radius=radius)
        draw_atoms(coords, self.lj_atoms, red, radius=radius)
        draw_atoms(coords, self.extra_atoms, c2, radius=radius)

        for i1, i2 in self.draw_bonds:
            draw_cylinder(coords[i1,:], coords[i2,:], color=c2)
Exemple #2
0
    def draw(self, rbcoords, index, shift_com=True): # pragma: no cover
        from pele.systems._opengl_tools import draw_atoms, draw_cylinder
        from matplotlib.colors import cnames, hex2color
        
        coords = self.aasystem.to_atomistic(rbcoords).copy()
        coords = coords.reshape([-1,3])
        if shift_com:
            com=np.mean(coords, axis=0)
            coords -= com[np.newaxis, :]
        else:
            com = np.zeros(3)
            
        radius = 0.42

        red = hex2color(cnames["red"])
        c2 = hex2color(cnames["grey"])
        draw_atoms(coords, self.harmonic_atoms, c2, radius=radius)
        draw_atoms(coords, self.lj_atoms, red, radius=radius)
        draw_atoms(coords, self.extra_atoms, c2, radius=radius)

        for i1, i2 in self.draw_bonds:
            draw_cylinder(coords[i1,:], coords[i2,:], color=c2)
Exemple #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)
Exemple #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)
Exemple #5
0
    def draw(self, rbcoords, index, shift_com=True):  # pragma: no cover
        from OpenGL import GL, GLUT
        coords = self.aasystem.to_atomistic(rbcoords)
        if shift_com:
            com = np.mean(coords, axis=0)
        else:
            com = np.zeros(3)

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

            i += 1
            GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, color)

            x = xx - com
            GL.glPushMatrix()
            GL.glTranslate(x[0], x[1], x[2])
            GLUT.glutSolidSphere(radius, 10, 10)
            GL.glPopMatrix()

        color = [1.0, 1.0, 1.0]
        if index == 2:
            color = [0.5, 1.0, .5]
        GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, color)

        if hasattr(self, "draw_bonds"):
            from pele.systems._opengl_tools import draw_cylinder
            for i1, i2 in self.draw_bonds:
                draw_cylinder(coords[i1] - com, coords[i2] - com)
Exemple #6
0
 def draw(self, rbcoords, index, shift_com=True): # pragma: no cover
     from OpenGL import GL, GLUT    
     coords = self.aasystem.to_atomistic(rbcoords)
     if shift_com:
         com=np.mean(coords, axis=0)
     else:
         com = np.zeros(3)
         
     i=0
     for atom_type, xx in zip(self.atom_types, coords):
         color = [1.0, 0.0, 0.0]
         radius = 0.3
         if elements.has_key(atom_type):
             color = elements[atom_type]["color"]
             radius = elements[atom_type]["radius"]*self.render_scale
         if index == 2:
             color = [0.5, 1.0, .5]                
         
         i+=1
         GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, color)
         
         x=xx-com
         GL.glPushMatrix()            
         GL.glTranslate(x[0],x[1],x[2])
         GLUT.glutSolidSphere(radius,10,10)
         GL.glPopMatrix()
    
     color = [1.0, 1.0, 1.0]
     if index == 2:
         color = [0.5, 1.0, .5]                
     GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, color)
             
     if hasattr(self, "draw_bonds"):
         from pele.systems._opengl_tools import draw_cylinder
         for i1, i2 in self.draw_bonds:
             draw_cylinder(coords[i1]-com, coords[i2]-com)