Miscellanous

misc.get_brillouin_zone_2d(cell)

Generate the Brillouin Zone of a given 2D cell. The BZ is the Wigner-Seitz cell of the reciprocal lattice, which can be constructed by Voronoi decomposition to the reciprocal lattice. A Voronoi diagram is a subdivision of the space into the nearest neighborhoods of a given set of points.

See: https://en.wikipedia.org/wiki/Wigner%E2%80%93Seitz_cell https://docs.scipy.org/doc/scipy/reference/tutorial/spatial.html#voronoi-diagrams http://staff.ustc.edu.cn/~zqj/posts/howto-plot-brillouin-zone/

Returns list of vertices of the cell.

misc.handle_run(params, c_key, c_val, driver, move_fname=[], outfname='out.dat')

Change param file according to given key and value. Run the driver. Create a folder “key_value” according to key and value. Move parameter and output files in the folder. Return name of the folder.

misc.plot_BZ2d(ax, ws_verts, params={'color': 'tab:gray', 'fill': False, 'ls': '--', 'lw': 1})

Create a patch of the Brillouin Zone and add to MPL axis.

Inputs are a matplolib axis to plot (e.g. plt.gca()) and list of vertices (e.g. computed by get_brillouin_zone_2d). Optionally dictionary with plotting parameters.

Returns the axis and cell Polygon object

misc.plot_UC(ax, u, params={'color': 'tab:gray', 'ls': ':', 'lw': 1})

Shortcut to plot the unit cell of the lattice

misc.plt_cosmetic(ax, xlabel='x', ylabel='y')

Adjust ax for plotting: lines at x=0 y=0, set xylabels and aspect as equal