I’m new to pymatgen as well as python which might be already the reason for my moste likely easy preventable error. Nevertheless, I can’t fix it myself.
What i want:
I try to visualize the different 111 surface slabs i found via the slab generator.
Im using this code:
fig = plt.figure()
for n, slab in enumerate(slabs):
ax = fig.add_subplot(1, 2, n+1)
plot_slab(slab, ax, adsorption_sites= False)
and getting this error massage:
KeyError Traceback (most recent call last)
2 for n, slab in enumerate(slabs):
3 ax = fig.add_subplot(1, 2, n+1)
----> 4 plot_slab(slab, ax, adsorption_sites= False)
~\Miniconda3\lib\site-packages\pymatgen\analysis\adsorption.py in plot_slab(slab, ax, scale, repeat, window, draw_unit_cell, decay, adsorption_sites)
669 ax.add_patch(patches.Circle(coord[:2] - lattsum * (repeat // 2),
670 r, color=‘w’, zorder=2 * n))
–> 671 color = color_dict[sites[n].species_string]
672 ax.add_patch(patches.Circle(coord[:2] - lattsum * (repeat // 2), r,
673 facecolor=color, alpha=alphas[n],
From what I understand of the error massage system of jupyter the problem is in the line 4 “plot_slab…” and in some kind of subroutine line 671 color. Right?
Does anyone has a hint for me how to fix this problem and give me a hint me how I could have found the solution myself. Is there for instance a documentation which could explain me the “key error : O2-”?
Thank you very much.