def photogeneration(loc): arl = 0.10 sep = 0.05 arprop = dict(mutation_scale=10, lw=1, arrowstyle="-|>", zorder=20) x, y, z = loc #electron electron, = ax.plot3D([x-sep/2], [y], [z], c='c', marker='$-$', markersize=7, ls='none') v = ((x-sep/2,x-sep/2), (y,y), (z+0.02, z+arl)) ar = Arrow3D(*v, color='c', **arprop) ax.add_artist(ar) #hole hole, = ax.plot3D([x+sep/2], [y], [z], c='r', marker='$+$', markersize=7, ls='none') v = ((x+sep/2,x+sep/2), (y,y), (z-0.02, z-arl)) ar = Arrow3D(*v, color='r', **arprop) ax.add_artist(ar) #photon draw_photon(ax, (0,0,1), location=(x,y,z-0.35), length=0.3, amplitude=0.02) #encircle ell = Ellipse((x,y), 2.5*sep, 2.5*sep, ls=':', ec='y', fc='none', lw=1) art3d.pathpatch_2d_to_3d(ell, z, 'z') ell._path2d = ell._path ax.add_patch(ell) return electron, hole