The second goal of this paper is to implement the optimization approach described in Ref. 28 for choosing the phases of the adiabatic states. For a real-valued electronic Hamiltonian, to smoothly propagate the electronic wavefunction using the overlap-based scheme, the overlap matrix at each time step must be a proper rotation matrix with a real matrix logarithm.