Add a convergence checking functionality

- add options
- change sys.exit to assert