Currently, the direct optimization has trouble converging for complex basis sets (e.g. 6-31g) and XC (e.g. PBE). There are a few ideas to try out 1. Do one step second order optimization after running the first order optimizer for some number of steps 2. The final diagonalization might help as well https://github.com/sail-sg/d4ft/issues/11