From a402d509a9fbbb3538030eb8208f40b7158de352 Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 26 Oct 2022 20:39:48 +0200 Subject: [PATCH] added the possibility to do maxovl in TC SCF --- src/tc_keywords/EZFIO.cfg | 6 +++++ src/tc_scf/routines_rotates.irp.f | 42 ++++++++++++++----------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/tc_keywords/EZFIO.cfg b/src/tc_keywords/EZFIO.cfg index 2dc8e6f1..d5d94c9d 100644 --- a/src/tc_keywords/EZFIO.cfg +++ b/src/tc_keywords/EZFIO.cfg @@ -130,3 +130,9 @@ type: Threshold doc: Threshold to determine if two orbitals are degenerate in TCSCF in order to avoid random quasi orthogonality between the right- and left-eigenvector for the same eigenvalue interface: ezfio,provider,ocaml default: 1.e-6 + +[maxovl_tc] +type: logical +doc: If |true|, maximize the overlap between orthogonalized left- and right eigenvectors +interface: ezfio,provider,ocaml +default: False diff --git a/src/tc_scf/routines_rotates.irp.f b/src/tc_scf/routines_rotates.irp.f index 74bc361f..0603cc77 100644 --- a/src/tc_scf/routines_rotates.irp.f +++ b/src/tc_scf/routines_rotates.irp.f @@ -58,29 +58,25 @@ subroutine routine_save_rotated_mos do j = 1, n_degen write(*,'(100(F8.4,X))')stmp(:,j) enddo - T = 0.d0 - Snew = 0.d0 - call maxovl(n_degen, n_degen, stmp, T, Snew) - print*,'overlap after' - do j = 1, n_degen - write(*,'(100(F16.10,X))')Snew(:,j) - enddo -! mo_l_coef_new = 0.D0 -! do j = 1, n_degen -! do k = 1, n_degen -! do m = 1, ao_num -! mo_l_coef_new(m,j) += T(k,j) * mo_l_coef_tmp(m,k) -! enddo -! enddo -! enddo - call dgemm( 'N', 'N', ao_num, n_degen, n_degen, 1.d0 & - , mo_l_coef_tmp, size(mo_l_coef_tmp, 1), T(1,1), size(T, 1) & - , 0.d0, mo_l_coef_new, size(mo_l_coef_new, 1) ) - call build_s_matrix(ao_num,n_degen,mo_l_coef_new,mo_r_coef_tmp,ao_overlap,stmp) - print*,'Overlap test' - do j = 1, n_degen - write(*,'(100(F16.10,X))')stmp(:,j) - enddo + if(maxovl_tc)then + T = 0.d0 + Snew = 0.d0 + call maxovl(n_degen, n_degen, stmp, T, Snew) + print*,'overlap after' + do j = 1, n_degen + write(*,'(100(F16.10,X))')Snew(:,j) + enddo + call dgemm( 'N', 'N', ao_num, n_degen, n_degen, 1.d0 & + , mo_l_coef_tmp, size(mo_l_coef_tmp, 1), T(1,1), size(T, 1) & + , 0.d0, mo_l_coef_new, size(mo_l_coef_new, 1) ) + call build_s_matrix(ao_num,n_degen,mo_l_coef_new,mo_r_coef_tmp,ao_overlap,stmp) + print*,'Overlap test' + do j = 1, n_degen + write(*,'(100(F16.10,X))')stmp(:,j) + enddo + else + mo_l_coef_new = mo_l_coef_tmp + endif call impose_biorthog_svd_overlap(ao_num, n_degen, ao_overlap, mo_l_coef_new, mo_r_coef_tmp) call build_s_matrix(ao_num,n_degen,mo_l_coef_new,mo_r_coef_tmp,ao_overlap,stmp) print*,'LAST OVERLAP '