From 8c521906488177db9dd3695cb49e08aadbd98e31 Mon Sep 17 00:00:00 2001 From: FiletoRodriguez Date: Tue, 30 Nov 2021 15:35:19 +0100 Subject: [PATCH] added src/tools/save_natorb_no_ref.irp.f --- src/determinants/density_matrix.irp.f | 38 +++++++++++++++++++++++++++ src/tools/save_natorb_no_ref.irp.f | 24 +++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 src/tools/save_natorb_no_ref.irp.f diff --git a/src/determinants/density_matrix.irp.f b/src/determinants/density_matrix.irp.f index 6a474662..fa4b3328 100644 --- a/src/determinants/density_matrix.irp.f +++ b/src/determinants/density_matrix.irp.f @@ -268,6 +268,44 @@ subroutine set_natural_mos soft_touch mo_occ end + +subroutine save_natural_mos_canon_label + implicit none + BEGIN_DOC + ! Save natural orbitals, obtained by diagonalization of the one-body density matrix in + ! the |MO| basis + END_DOC + call set_natural_mos_canon_label + 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 set_natural_mos_canon_label + 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(:,:) + + label = "Canonical" + 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) + 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 diff --git a/src/tools/save_natorb_no_ref.irp.f b/src/tools/save_natorb_no_ref.irp.f new file mode 100644 index 00000000..9d253fa0 --- /dev/null +++ b/src/tools/save_natorb_no_ref.irp.f @@ -0,0 +1,24 @@ +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_canon_label + 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 +