Skip to main content

Adjoint Nonlinear Gradients

Project description

<link rel="icon" href="img/favicon.png" type="image/x-icon" /> Angler


angler (named for 'adjoint nonlinear gradients') is a package for simulating and optimizing optical structures.

It provides a finite-difference frequency-domain (FDFD) solver for simulating for linear and nonlinear devices in the frequency domain.

It also provides an easy to use package for adjoint-based inverse design and optimization of linear and nonlinear devices. For example, you can inverse design optical switches to transport power to different ports for different input powers:


angler is released as part of a paper Adjoint method and inverse design for nonlinear optical devices, which can be viewed here.


For angler to work, you must have MKL installed.

The best way to do this is through conda

conda install MKL

The python wrapper for MKL that we are using does not work well when MKL is pip installed.


One can install the current version of angler and all of its dependencies (apart from MKL) using

git clone
pip install -e angler

Alternatively, the dependencies can be installed separately with

pip install -r requirements.txt

And then this directory can be added to path to import angler, i.e.

import sys

Examples / Quickstart

There are several jupyter notebook examples in the Notebooks/ directory.

For a good introduction, try:


For more specific applications:

Electromagnetic simulations

For modeling linear devices with our FDFD solver (no optimization), see


For modeling nonlinear devices with FDFD (no optimization), see


Inverse design & optimization

For examples of optimizing linear devices, see


For examples of optimizing nonlinear devices, see


Package Structure

angler provides two main classes, Simulation and Optimization, which perform most of the functionality.

Generally, Simulation objects are used to perform FDFD simulations, and Optimization classes run inverse design and optimization algorithms over Simulations. To learn more about how angler works and how to use it, please take a look at angler/ for a more detailed explanation.


To run all tests:

python -m unittest discover tests

Or to run individually:

python tests/


angler is under development and we welcome suggestions, pull-requests, feature-requests, etc.

If you contribute a new feature, please also write a few tests and document your changes in angler/ or the wiki.


angler was written by Tyler Hughes, Momchil Minkov, and Ian Williamson.


If you use angler, please cite us using

Author = {Tyler W. Hughes and Momchil Minkov and Ian A. D. Williamson and Shanhui Fan},
Title = {Adjoint method and inverse design for nonlinear nanophotonic devices},
Year = {2018},
Eprint = {arXiv:1811.01255},


This project is licensed under the MIT License - see the file for details. Copyright 2018 Tyler Hughes.


  • our logo was made by Nadine Gilmer
  • RIP Ian's contributions before the code merge
  • We made use of a lot of code snippets (and advice) from Jerry Shi

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for angler, version 0.0.11
Filename, size File type Python version Upload date Hashes
Filename, size angler-0.0.11.tar.gz (27.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page