Implemented DIIS for potential update.