geometry_viewer.py 文件源码

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

项目:notebook-molecular-visualization 作者: Autodesk 项目源码 文件源码
def _update_atom_colors(colors, atoms, styles):
        """ Updates list of atoms with the given colors. Colors will be translated to hex.

        Args:
            color (List[str]): list of colors for each atom
            atoms (List[moldesign.Atom]): list of atoms to apply the colors to
            styles (dict): old style dictionary
        """
        styles = dict(styles)

        if len(colors) != len(atoms):
            raise ValueError("Number of colors provided does not match number of atoms provided")

        for atom, color in zip(atoms, colors):
            if str(atom.index) in styles:
                styles[str(atom.index)] = dict(styles[str(atom.index)])
            else:
                styles[str(atom.index)] = {}
            styles[str(atom.index)]['color'] = translate_color(color, prefix='#')

        return styles

    # some convenience synonyms
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号