graph_viewer.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:notebook-molecular-visualization 作者: Autodesk 项目源码 文件源码
def __init__(self, atoms,
                 carbon_labels=True,
                 names=None,
                 width=400, height=350,
                 display=False,
                 _forcebig=False,
                 **kwargs):

        self.atoms = getattr(atoms, 'atoms', atoms)

        if not _forcebig and len(self.atoms) > self.MAXATOMS:
            raise ValueError('Refusing to draw more than 200 atoms in 2D visualization. '
                             'Override this with _forcebig=True')

        if names is None:
            names = []
            for atom in self.atoms:
                if atom.formal_charge == 0:
                    names.append(atom.name)
                else:
                    names.append(atom.name + _charge_str(atom.formal_charge))

        self.names = names

        self.atom_indices = {atom: i for i, atom in enumerate(self.atoms)}
        self.selection_group = None
        self.selection_id = None
        self.width = width
        self.height = height
        self.uuid = 'mol2d'+str(uuid.uuid4())
        self.carbon_labels = carbon_labels
        self._clicks_enabled = False
        self.graph = self.to_graph(self.atoms)

        super().__init__(layout=ipy.Layout(width=str(width), height=str(height)))

        if display: dsp.display(self)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号