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
geometry_viewer.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录