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 izip(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] 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)
def draw(self, rbcoords, index, shift_com=True): 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) self.aasystem.sites 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"): for i1, i2 in self.draw_bonds: self.drawCylinder(coords[i1]-com, coords[i2]-com)
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)