From 6b2020d40dfd61569e6b1fb7eb933a044343406c Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 11 Nov 2020 10:26:36 +0100 Subject: [PATCH] Orthogonalize MOs --- src/hartree_fock/10.hf.bats | 6 +++--- src/hartree_fock/scf.irp.f | 7 ++++--- src/mo_guess/h_core_guess_routine.irp.f | 2 +- src/scf_utils/huckel.irp.f | 1 + src/scf_utils/roothaan_hall_scf.irp.f | 7 ++++--- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/hartree_fock/10.hf.bats b/src/hartree_fock/10.hf.bats index 54845685..6d49f20c 100644 --- a/src/hartree_fock/10.hf.bats +++ b/src/hartree_fock/10.hf.bats @@ -13,7 +13,7 @@ function run() { qp set scf_utils n_it_scf_max 50 qp set ao_one_e_ints lin_dep_cutoff 1.e-50 qp run scf -# qp set_frozen_core +# qp set_frozen_core energy="$(ezfio get hartree_fock energy)" eq $energy $2 $thresh } @@ -49,7 +49,7 @@ function run() { } @test "HBO" { # 0.805600 1.4543s - run hbo.ezfio -100.018582259096 + run hbo.ezfio -100.018582259096 } @test "H2S" { # 1.655600 4.21402s @@ -101,7 +101,7 @@ function run() { } @test "DHNO" { # 12.856700 16.5908s - run dhno.ezfio -130.427877782432 + run dhno.ezfio -130.427877782432 } @test "NH3" { # 13.632200 34.7981s diff --git a/src/hartree_fock/scf.irp.f b/src/hartree_fock/scf.irp.f index ace4e354..0368c347 100644 --- a/src/hartree_fock/scf.irp.f +++ b/src/hartree_fock/scf.irp.f @@ -47,22 +47,23 @@ subroutine create_guess PROVIDE ezfio_filename call ezfio_has_mo_basis_mo_coef(exists) if (.not.exists) then + mo_label = 'Guess' if (mo_guess_type == "HCore") then mo_coef = ao_ortho_lowdin_coef TOUCH mo_coef - mo_label = 'Guess' call mo_as_eigvectors_of_mo_matrix(mo_one_e_integrals, & size(mo_one_e_integrals,1), & size(mo_one_e_integrals,2), & mo_label,1,.false.) call nullify_small_elements(ao_num, mo_num, mo_coef, size(mo_coef,1), 1.d-10) - SOFT_TOUCH mo_coef mo_label + SOFT_TOUCH mo_coef else if (mo_guess_type == "Huckel") then call huckel_guess else print *, 'Unrecognized MO guess type : '//mo_guess_type stop 1 endif + SOFT_TOUCH mo_label endif end @@ -77,7 +78,7 @@ subroutine run integer :: i_it, i, j, k - mo_label = "Orthonormalized" + mo_label = 'Near-Canonical' call Roothaan_Hall_SCF call ezfio_set_hartree_fock_energy(SCF_energy) diff --git a/src/mo_guess/h_core_guess_routine.irp.f b/src/mo_guess/h_core_guess_routine.irp.f index 1073f052..a2e34dd0 100644 --- a/src/mo_guess/h_core_guess_routine.irp.f +++ b/src/mo_guess/h_core_guess_routine.irp.f @@ -4,7 +4,7 @@ subroutine hcore_guess END_DOC implicit none character*(64) :: label - label = "Guess" + label = 'Guess' call mo_as_eigvectors_of_mo_matrix(mo_one_e_integrals, & size(mo_one_e_integrals,1), & size(mo_one_e_integrals,2),label,1,.false.) diff --git a/src/scf_utils/huckel.irp.f b/src/scf_utils/huckel.irp.f index 304d5144..a6087da3 100644 --- a/src/scf_utils/huckel.irp.f +++ b/src/scf_utils/huckel.irp.f @@ -26,6 +26,7 @@ subroutine huckel_guess TOUCH Fock_matrix_ao_alpha Fock_matrix_ao_beta mo_coef = eigenvectors_fock_matrix_mo call nullify_small_elements(ao_num, mo_num, mo_coef, size(mo_coef,1), 1.d-12 ) + call orthonormalize_mos SOFT_TOUCH mo_coef call save_mos deallocate(A) diff --git a/src/scf_utils/roothaan_hall_scf.irp.f b/src/scf_utils/roothaan_hall_scf.irp.f index e880fadf..29f563cf 100644 --- a/src/scf_utils/roothaan_hall_scf.irp.f +++ b/src/scf_utils/roothaan_hall_scf.irp.f @@ -153,7 +153,7 @@ END_DOC enddo if (iteration_SCF < n_it_SCF_max) then - mo_label = "Canonical" + mo_label = 'Canonical' endif ! ! End of Main SCF loop @@ -164,7 +164,8 @@ END_DOC write(6,*) if(.not.frozen_orb_scf)then - call mo_as_eigvectors_of_mo_matrix(Fock_matrix_mo,size(Fock_matrix_mo,1),size(Fock_matrix_mo,2),mo_label,1,.true.) + call mo_as_eigvectors_of_mo_matrix(Fock_matrix_mo,size(Fock_matrix_mo,1), & + size(Fock_matrix_mo,2),mo_label,1,.true.) call nullify_small_elements(ao_num, mo_num, mo_coef, size(mo_coef,1), 1.d-10) call orthonormalize_mos call save_mos @@ -305,7 +306,7 @@ END_DOC Fock_matrix_AO_(i,j) = 0.d0 enddo do k=1,dim_DIIS - if (dabs(X_vector_DIIS(k)) < 1.d-12) cycle + if (dabs(X_vector_DIIS(k)) < 1.d-10) cycle do i=1,ao_num Fock_matrix_AO_(i,j) = Fock_matrix_AO_(i,j) + & X_vector_DIIS(k)*Fock_matrix_DIIS(i,j,dim_DIIS-k+1)