# WIP: bound state solver

Closed requested to merge jbweston/kwant:boundstate into master

Closes #177.

Relevant reference: 1711.08250.

For the moment we will implement the simplest interface with the loosest guarantees. Specifically, there will be a single top-level function, `kwant.physics.bound_states`, that will return a single bound state from an energy interval, if one is detected. The user is on their own if there is >1 bound state in the energy interval (they would have to implement their own disambiguation logic).

We can then build on this foundation in future merge requests.

# Current Status

There are 2 implemented algorithms (as detailed in the paper). Each has their merits (speed vs robustness). The code is mostly well factored, however we will need to deal with renaming things and some minor reorganization.

There are also open questions with respect to how to make the algorithm robust (in particular the root finding/minimization). For the moment we will implement the simplest interface we can with the loosest guarantees

# Open Questions

• [ ] Whether to use the singular value algorithm or the eigenvalue algorithm. Either one or the other, or use some heuristic to select the best one
• [ ] How to handle when there is != 1 bound state in the provided energy interval
• [ ] Choice of minimization/root finding algorithm (taking into account the previous point about finding none/multiple bound states in the selected energy window
• If the user requests the wavefunction, in what form should we return it? Returning an array defined over the scattering region is not really enough, as for a bound state one may well be interested in how it decays into the leads.
• How else can we test the algorithm beyond cases where we can hard-code the solution? e.g. we could diagonalize with a finite slab of lead and see how eigenvalues converge to the output of the bound state finder (do we look at the rate of convergence, or just stick a few hundred unit cells and call it a day?)

• Rename the different components so that their function is obvious (e.g. currently there is `BS_solver` and `BS_finder`).
• Throw away dead code that is never used or has been made obsolete (e.g. `null_space`?)
• Transplant the code from `kwant/physics/Bound_state_solver` into `kwant/physics/boundstate.py`