@@ -425,16 +425,7 @@ double MCSCF_2STEP::compute_energy() {
425425 diis_manager.delete_diis_file ();
426426 } // end of MCSCF macro iterations
427427
428- // perform final active space computation using converged orbitals
429- if (print_ >= PrintLevel::Default)
430- psi::outfile->Printf (" \n\n Performing final CI Calculation using converged orbitals" );
431-
432- as_solver_->set_maxiter (as_maxiter);
433- as_solver_->set_die_if_not_converged (true );
434- energy_ =
435- diagonalize_hamiltonian (cas_grad.active_space_ints (),
436- {print_, e_conv_, r_conv, options_->get_bool (" DUMP_ACTIVE_WFN" )});
437-
428+ // Transform the orbitals to canonical or natural basis
438429 if (ints_->integral_type () != Custom) {
439430 // fix orbitals for redundant pairs
440431 rdms = as_solver_->compute_average_rdms (state_weights_map_, 1 , RDMsType::spin_free);
@@ -456,6 +447,9 @@ double MCSCF_2STEP::compute_energy() {
456447 semi.semicanonicalize (rdms, false , actv_orb_type, false );
457448 cas_grad.canonicalize_final (semi.Ua ());
458449
450+ // after this step, the integrals, CI coefficients, and rdms are no longer valid.
451+ // Below we rediagonalize the Hamiltonian to get the new CI coefficients.
452+
459453 // pass the MO coefficients to the wave function
460454 auto Ca = cas_grad.Ca ();
461455 ints_->wfn ()->Ca ()->copy (Ca);
@@ -518,6 +512,17 @@ double MCSCF_2STEP::compute_energy() {
518512 throw_convergence_error ();
519513 }
520514
515+ // Perform final active space computation using converged transformed orbitals
516+ if (der_type_ != " FIRST" or options_->get_str (" CORRELATION_SOLVER" ) != " NONE" ) {
517+ if (print_ >= PrintLevel::Default)
518+ psi::outfile->Printf (" \n\n Performing final CI Calculation using converged orbitals" );
519+ as_solver_->set_maxiter (as_maxiter);
520+ as_solver_->set_die_if_not_converged (true );
521+ energy_ = diagonalize_hamiltonian (
522+ cas_grad.active_space_ints (),
523+ {print_, e_conv_, r_conv, options_->get_bool (" DUMP_ACTIVE_WFN" )});
524+ }
525+
521526 return energy_;
522527}
523528
0 commit comments