This is a Python package for running bandstructure simulations of photonic crystals (PhCs) with MIT Photonic-Bands (MPB, http://ab-initio.mit.edu/wiki/index.php/MIT_Photonic_Bands). It creates a .ctl file, runs it, and does some postprocessing and plotting.
- supports 2D and 3D simulations
- works with anisotropic dielectric materials
- supports MPB's cylinder and block objects (but easily extendable)
- rectangular and triangular lattices
- uses mpb-data (from MPB) and h5topng (from h5utils) to export PNG-Images of calculated fields
- exports simulation results (frequencies, group velocities) to .csv files
- plots band structure diagrams with matplotlib
- predefined simulations for 2D triangular lattice of holes and 3D triangular PhC slab
- MPB
- H5utils (for png export of fields)
- Python
- numpy
- matplotlib (for outputting diagrams)
- Inside downloaded folder, install package with pip (
-e
installs with symlinks, meaning you can change and update the source code without reinstalling; The dot at the end is important):pip install -e .
- Add your material's refractive indices to data.py
- Update defaults (programm calls etc.) in defaults.py
- Start with predefined PhC simulations in phc_simulations.py
- See examples in examples folder
I am in a hurry - I need to finish my thesis. So my code is neither nice nor clean. Meanwhile, I hope somebody finds this useful!