这是我想使用 xyz2graph 可视化的 .xyz 文件:
18
Atoms. File created from networkx graph by get_decomposition_calc_SRO1.py_edited_by_hand
Ga 0.0 0.0 0.0
In 1.59 0.917986928012 2.583
In 0.0 0.0 5.166
Ga 1.59 0.917986928012 7.749
Ga 0.0 0.0 10.332
Ga 1.59 0.917986928012 12.915
Ga 1.59 2.75396078403 0.0
In 3.18 3.67194771205 2.583
Ga 1.59 2.75396078403 5.166
In 3.18 3.67194771205 7.749
Ga 1.59 2.75396078403 10.332
Ga 3.18 3.67194771205 12.915
Ga 3.18 5.50792156807 0.0
In 4.77 6.42590849608 2.583
In 3.18 5.50792156807 5.166
Ga 4.77 6.42590849608 7.749
这是输出的静止图像:注意所有节点(标记为 In 和 Ga 的颜色相同)。
用于生成此图像的代码直接从该网站复制:
此处显示的确切代码段:
from xyz2graph import MolGraph, to_networkx_graph, to_plotly_figure
from plotly.offline import offline
# Create the MolGraph object
mg = MolGraph()
# Read the data from the .xyz file
mg.read_xyz('path/molecule.xyz')
# Create the Plotly figure object
fig = to_plotly_figure(mg)
# Plot the figure
offline.plot(fig)
如何改变化学结构中每个原子的颜色?