From 008d1b9e8f5d5ec3843d0462dfed4c9311a9afde Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 8 Dec 2020 20:37:20 +0100 Subject: [PATCH 1/4] Improved huckel guess --- src/hartree_fock/10.hf.bats | 2 +- src/scf_utils/huckel.irp.f | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hartree_fock/10.hf.bats b/src/hartree_fock/10.hf.bats index 70ad6c6f..6d49f20c 100644 --- a/src/hartree_fock/10.hf.bats +++ b/src/hartree_fock/10.hf.bats @@ -15,7 +15,7 @@ function run() { qp run scf # qp set_frozen_core energy="$(ezfio get hartree_fock energy)" - eq $2 $energy $thresh + eq $energy $2 $thresh } diff --git a/src/scf_utils/huckel.irp.f b/src/scf_utils/huckel.irp.f index 676cc345..4a1c4162 100644 --- a/src/scf_utils/huckel.irp.f +++ b/src/scf_utils/huckel.irp.f @@ -15,7 +15,8 @@ subroutine huckel_guess A = 0.d0 do j=1,ao_num do i=1,ao_num - A(i,j) = c * ao_overlap(i,j) * (ao_one_e_integrals_diag(i) + ao_one_e_integrals_diag(j)) + A(i,j) = c * ao_overlap(i,j)/(ao_overlap(i,i)*ao_overlap(j,j)) * & + (ao_one_e_integrals_diag(i) + ao_one_e_integrals_diag(j)) enddo A(j,j) = ao_one_e_integrals_diag(j) + ao_two_e_integral_alpha(j,j) enddo From b89f53f40ba57799186663e4c4500ac293266ea0 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 8 Dec 2020 22:05:23 +0100 Subject: [PATCH 2/4] Remove possible division by zero --- src/utils/linear_algebra.irp.f | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/linear_algebra.irp.f b/src/utils/linear_algebra.irp.f index 26d0b78c..d858341d 100644 --- a/src/utils/linear_algebra.irp.f +++ b/src/utils/linear_algebra.irp.f @@ -1550,6 +1550,7 @@ subroutine nullify_small_elements(m,n,A,LDA,thresh) amax = max(dabs(A(i,j)), amax) enddo enddo + if (amax == 0.d0) return amax = 1.d0/amax ! Remove tiny elements From e767d5272546288a568001107f9d5c070c203fca Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 8 Dec 2020 22:33:52 +0100 Subject: [PATCH 3/4] Avoid possible divisions by zero --- config/ifort_debug.cfg | 2 +- src/ezfio_files/output.irp.f | 5 +++-- src/scf_utils/huckel.irp.f | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/ifort_debug.cfg b/config/ifort_debug.cfg index f0f90f34..f2fbf8ce 100644 --- a/config/ifort_debug.cfg +++ b/config/ifort_debug.cfg @@ -54,7 +54,7 @@ FCFLAGS : -msse4.2 -O2 -ip -ftz # [DEBUG] FC : -g -traceback -FCFLAGS : -msse4.2 -C -fpe0 -implicitnone +FCFLAGS : -msse4.2 -check all -debug all -fpe-all=0 -implicitnone # OpenMP flags diff --git a/src/ezfio_files/output.irp.f b/src/ezfio_files/output.irp.f index 5526fae2..48512f92 100644 --- a/src/ezfio_files/output.irp.f +++ b/src/ezfio_files/output.irp.f @@ -22,10 +22,11 @@ subroutine write_time(iunit) write(6,*) call print_memory_usage() call cpu_time(ct) + ct = ct - output_cpu_time_0 call wall_time(wt) + wt = wt - output_wall_time_0 write(6,'(A,F14.6,A,F14.6,A)') & - '.. >>>>> [ WALL TIME: ', wt-output_wall_time_0, & - ' s ] [ CPU TIME: ', ct-output_cpu_time_0, ' s ] <<<<< ..' + '.. >>>>> [ WALL TIME: ', wt, ' s ] [ CPU TIME: ', ct, ' s ] <<<<< ..' write(6,*) end diff --git a/src/scf_utils/huckel.irp.f b/src/scf_utils/huckel.irp.f index 4a1c4162..40d7cd5d 100644 --- a/src/scf_utils/huckel.irp.f +++ b/src/scf_utils/huckel.irp.f @@ -14,7 +14,9 @@ subroutine huckel_guess allocate (A(ao_num, ao_num)) A = 0.d0 do j=1,ao_num + if (ao_overlap(j,j) == 0.d0) cycle do i=1,ao_num + if (ao_overlap(i,i) == 0.d0) cycle A(i,j) = c * ao_overlap(i,j)/(ao_overlap(i,i)*ao_overlap(j,j)) * & (ao_one_e_integrals_diag(i) + ao_one_e_integrals_diag(j)) enddo From 92ac2d2eea1fc6df03f3506a2b60b523006bd76c Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 8 Dec 2020 23:18:47 +0100 Subject: [PATCH 4/4] Reset Huckel guess --- src/hartree_fock/10.hf.bats | 1 - src/scf_utils/huckel.irp.f | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/hartree_fock/10.hf.bats b/src/hartree_fock/10.hf.bats index 6d49f20c..65117b76 100644 --- a/src/hartree_fock/10.hf.bats +++ b/src/hartree_fock/10.hf.bats @@ -11,7 +11,6 @@ function run() { qp edit --check qp reset --mos 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 energy="$(ezfio get hartree_fock energy)" diff --git a/src/scf_utils/huckel.irp.f b/src/scf_utils/huckel.irp.f index 40d7cd5d..f6d4c190 100644 --- a/src/scf_utils/huckel.irp.f +++ b/src/scf_utils/huckel.irp.f @@ -14,13 +14,11 @@ subroutine huckel_guess allocate (A(ao_num, ao_num)) A = 0.d0 do j=1,ao_num - if (ao_overlap(j,j) == 0.d0) cycle do i=1,ao_num - if (ao_overlap(i,i) == 0.d0) cycle - A(i,j) = c * ao_overlap(i,j)/(ao_overlap(i,i)*ao_overlap(j,j)) * & - (ao_one_e_integrals_diag(i) + ao_one_e_integrals_diag(j)) + A(i,j) = c * ao_overlap(i,j) * & + (ao_one_e_integrals_diag(i) + ao_one_e_integrals_diag(j) ) enddo - A(j,j) = ao_one_e_integrals_diag(j) + ao_two_e_integral_alpha(j,j) + A(j,j) = ao_one_e_integrals_diag(j) + ao_two_e_integral_alpha(j,j) enddo Fock_matrix_ao_alpha(1:ao_num,1:ao_num) = A(1:ao_num,1:ao_num)