From 4342169da802673f16b746fa9481b2fa67b0a4f9 Mon Sep 17 00:00:00 2001 From: Emmanuel Giner Date: Thu, 22 Jul 2021 23:29:13 +0200 Subject: [PATCH] added no_ov_natorb --- etc/openmp.rc | 1 + src/determinants/density_matrix.irp.f | 43 +++++++++++++++++++++++---- src/tools/save_natorb_no_ov_rot.irp.f | 25 ++++++++++++++++ 3 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 etc/openmp.rc create mode 100644 src/tools/save_natorb_no_ov_rot.irp.f diff --git a/etc/openmp.rc b/etc/openmp.rc new file mode 100644 index 00000000..7f71c9b8 --- /dev/null +++ b/etc/openmp.rc @@ -0,0 +1 @@ +export OMP_NESTED=True diff --git a/src/determinants/density_matrix.irp.f b/src/determinants/density_matrix.irp.f index 7c4a7fec..c72dbc9e 100644 --- a/src/determinants/density_matrix.irp.f +++ b/src/determinants/density_matrix.irp.f @@ -262,17 +262,48 @@ subroutine set_natural_mos iorb = list_virt(i) do j = 1, n_core_inact_act_orb jorb = list_core_inact_act(j) - if(one_e_dm_mo(iorb,jorb).ne. 0.d0)then - print*,'AHAHAH' - print*,iorb,jorb,one_e_dm_mo(iorb,jorb) - stop - endif enddo enddo call mo_as_svd_vectors_of_mo_matrix_eig(one_e_dm_mo,size(one_e_dm_mo,1),mo_num,mo_num,mo_occ,label) soft_touch mo_occ - end + +subroutine set_natorb_no_ov_rot + implicit none + BEGIN_DOC + ! Set natural orbitals, obtained by diagonalization of the one-body density matrix + ! in the |MO| basis + END_DOC + character*(64) :: label + double precision, allocatable :: tmp(:,:) + allocate(tmp(mo_num, mo_num)) + label = "Natural" + tmp = one_e_dm_mo + integer :: i,j,iorb,jorb + do i = 1, n_virt_orb + iorb = list_virt(i) + do j = 1, n_core_inact_act_orb + jorb = list_core_inact_act(j) + tmp(iorb, jorb) = 0.d0 + tmp(jorb, iorb) = 0.d0 + enddo + enddo + call mo_as_svd_vectors_of_mo_matrix_eig(tmp,size(tmp,1),mo_num,mo_num,mo_occ,label) + soft_touch mo_occ +end + +subroutine save_natural_mos_no_ov_rot + implicit none + BEGIN_DOC + ! Save natural orbitals, obtained by diagonalization of the one-body density matrix in + ! the |MO| basis + END_DOC + call set_natorb_no_ov_rot + call nullify_small_elements(ao_num,mo_num,mo_coef,size(mo_coef,1),1.d-10) + call orthonormalize_mos + call save_mos +end + subroutine save_natural_mos implicit none BEGIN_DOC diff --git a/src/tools/save_natorb_no_ov_rot.irp.f b/src/tools/save_natorb_no_ov_rot.irp.f new file mode 100644 index 00000000..e5b69fbf --- /dev/null +++ b/src/tools/save_natorb_no_ov_rot.irp.f @@ -0,0 +1,25 @@ +program save_natorb + implicit none + BEGIN_DOC +! Save natural |MOs| into the |EZFIO|. +! +! This program reads the wave function stored in the |EZFIO| directory, +! extracts the corresponding natural orbitals and setd them as the new +! |MOs|. +! +! If this is a multi-state calculation, the density matrix that produces +! the natural orbitals is obtained from an average of the density +! matrices of each state with the corresponding +! :option:`determinants state_average_weight` + END_DOC + read_wf = .True. + touch read_wf + call save_natural_mos_no_ov_rot + call save_ref_determinant + call ezfio_set_mo_two_e_ints_io_mo_two_e_integrals('None') + call ezfio_set_mo_one_e_ints_io_mo_one_e_integrals('None') + call ezfio_set_mo_one_e_ints_io_mo_integrals_kinetic('None') + call ezfio_set_mo_one_e_ints_io_mo_integrals_n_e('None') + call ezfio_set_mo_one_e_ints_io_mo_integrals_pseudo('None') +end +