From 5818f4f2551f8e66afce319eb545452a2fd11e44 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 9 Jun 2014 00:15:48 +0200 Subject: [PATCH] Bug corrected in saved wave function --- src/CISD/cisd.irp.f | 5 ++-- src/Dets/H_apply_template.f | 2 +- src/Dets/davidson.irp.f | 2 +- src/Dets/determinants.ezfio_config | 2 +- src/Dets/determinants.irp.f | 38 +++++++++++++++++++++++++++--- src/Full_CI/full_ci.irp.f | 2 +- 6 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/CISD/cisd.irp.f b/src/CISD/cisd.irp.f index 67e6f2e2..0b6bc9fd 100644 --- a/src/CISD/cisd.irp.f +++ b/src/CISD/cisd.irp.f @@ -4,10 +4,9 @@ program cisd print *, 'HF = ', HF_energy print *, 'N_states = ', N_states + N_det = 1 + touch psi_det psi_coef N_det call H_apply_cisd -! do i=1,N_det -! print '(100(X,O32))', det_connections(:,i) -! enddo print *, 'N_det = ', N_det do i = 1,N_states print *, 'energy = ',CI_energy(i) diff --git a/src/Dets/H_apply_template.f b/src/Dets/H_apply_template.f index 27afc8e5..58dccb87 100644 --- a/src/Dets/H_apply_template.f +++ b/src/Dets/H_apply_template.f @@ -381,7 +381,7 @@ subroutine $subroutine($params_main) integer :: ispin, k PROVIDE H_apply_buffer_allocated mo_bielec_integrals_in_map N_det_selectors psi_generators - PROVIDE psi_det_sorted_bit coef_hf_selector psi_det psi_coef H_apply_threshold + PROVIDE psi_det_sorted_bit coef_hf_selector psi_det psi_coef H_apply_threshold ref_bitmask_energy nmax = ( N_det_generators/nproc ) *nproc call wall_time(wall_1) diff --git a/src/Dets/davidson.irp.f b/src/Dets/davidson.irp.f index 3e874e17..a79e9123 100644 --- a/src/Dets/davidson.irp.f +++ b/src/Dets/davidson.irp.f @@ -48,7 +48,7 @@ subroutine davidson_diag(dets_in,u_in,energies,dim_in,sze,N_st,Nint,iunit) ASSERT (sze > 0) ASSERT (Nint > 0) ASSERT (Nint == N_int) - PROVIDE ref_bitmask_energy + PROVIDE ref_bitmask_energy mo_bielec_integrals_in_map allocate(H_jj(sze)) !$OMP PARALLEL DEFAULT(NONE) & diff --git a/src/Dets/determinants.ezfio_config b/src/Dets/determinants.ezfio_config index 0fedee17..5a01925a 100644 --- a/src/Dets/determinants.ezfio_config +++ b/src/Dets/determinants.ezfio_config @@ -1,6 +1,7 @@ determinants n_int integer bit_kind integer + mo_label character*(64) n_det integer n_states integer psi_coef double precision (determinants_n_det,determinants_n_states) @@ -9,4 +10,3 @@ determinants n_det_max_jacobi integer threshold_generators double precision threshold_selectors double precision - diff --git a/src/Dets/determinants.irp.f b/src/Dets/determinants.irp.f index 979386f1..d93507c0 100644 --- a/src/Dets/determinants.irp.f +++ b/src/Dets/determinants.irp.f @@ -13,6 +13,7 @@ BEGIN_PROVIDER [ integer, N_states ] else N_states = 1 endif + call write_int(output_dets,N_states,'Number of states') ASSERT (N_states > 0) END_PROVIDER @@ -22,13 +23,24 @@ BEGIN_PROVIDER [ integer, N_det ] ! Number of determinants in the wave function END_DOC logical :: exists + character*64 :: label PROVIDE ezfio_filename call ezfio_has_determinants_n_det(exists) + if (exists) then + if (exists) then + call ezfio_has_determinants_mo_label(exists) + if (exists) then + call ezfio_get_determinants_mo_label(label) + exists = (label == mo_label) + endif + endif + endif if (exists) then call ezfio_get_determinants_n_det(N_det) else N_det = 1 endif + call write_int(output_dets,N_det,'Number of determinants') ASSERT (N_det > 0) END_PROVIDER @@ -46,6 +58,7 @@ BEGIN_PROVIDER [ integer, N_det_max_jacobi ] else N_det_max_jacobi = 2000 endif + call write_int(output_dets,N_det_max_jacobi,'Lapack diagonalization up to') ASSERT (N_det_max_jacobi > 0) END_PROVIDER @@ -64,6 +77,7 @@ BEGIN_PROVIDER [ integer, psi_det_size ] psi_det_size = 1 endif psi_det_size = max(psi_det_size,10000) + call write_int(output_dets,psi_det_size,'Dimension of the psi arrays') END_PROVIDER @@ -75,7 +89,8 @@ BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ] END_DOC integer :: i logical :: exists - + character*64 :: label + call ezfio_has_determinants_N_int(exists) if (exists) then call ezfio_has_determinants_bit_kind(exists) @@ -84,7 +99,14 @@ BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ] if (exists) then call ezfio_has_determinants_N_states(exists) if (exists) then - call ezfio_has_determinants_psi_det(exists) + call ezfio_has_determinants_psi_det(exists) + if (exists) then + call ezfio_has_determinants_mo_label(exists) + if (exists) then + call ezfio_get_determinants_mo_label(label) + exists = (label == mo_label) + endif + endif endif endif endif @@ -156,8 +178,16 @@ BEGIN_PROVIDER [ double precision, psi_coef, (psi_det_size,N_states) ] integer :: i,k, N_int2 logical :: exists double precision, allocatable :: psi_coef_read(:,:) + character*(64) :: label call ezfio_has_determinants_psi_coef(exists) + if (exists) then + call ezfio_has_determinants_mo_label(exists) + if (exists) then + call ezfio_get_determinants_mo_label(label) + exists = (label == mo_label) + endif + endif if (exists) then @@ -303,6 +333,7 @@ subroutine save_wavefunction call ezfio_set_determinants_bit_kind(bit_kind) call ezfio_set_determinants_N_det(N_det) call ezfio_set_determinants_N_states(N_states) + call ezfio_set_determinants_mo_label(mo_label) N_int2 = (N_int*bit_kind)/8 allocate (psi_det_save(N_int2,2,N_det)) @@ -314,7 +345,7 @@ subroutine save_wavefunction psi_det_save(k,1,i) = det_8(k) enddo do k=1,N_int - det_bk(k) = psi_det(k,2,i) + det_bk(k) = psi_det_sorted(k,2,i) enddo do k=1,N_int2 psi_det_save(k,2,i) = det_8(k) @@ -330,6 +361,7 @@ subroutine save_wavefunction enddo enddo call ezfio_set_determinants_psi_coef(psi_coef_save) + call write_int(output_dets,N_det,'Saved determinants') deallocate (psi_coef_save) end diff --git a/src/Full_CI/full_ci.irp.f b/src/Full_CI/full_ci.irp.f index bef1b05b..532d3788 100644 --- a/src/Full_CI/full_ci.irp.f +++ b/src/Full_CI/full_ci.irp.f @@ -11,7 +11,7 @@ program cisd pt2 = 1.d0 diag_algorithm = "Lapack" - do while (maxval(abs(pt2(1:N_st))) > 1.d-3) + do while (maxval(abs(pt2(1:N_st))) > 1.d-4) call H_apply_FCI(pt2, norm_pert, H_pert_diag, N_st) call diagonalize_CI call save_wavefunction