From 5c7a4da88d6a235238d75aacc26059e660fae6ac Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 7 Jun 2014 16:44:37 +0200 Subject: [PATCH 1/4] Setup environment repaired --- setup_environment.sh | 7 +------ src/MonoInts/README.rst | 18 +++++++++--------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/setup_environment.sh b/setup_environment.sh index 176cc604..62b579ed 100755 --- a/setup_environment.sh +++ b/setup_environment.sh @@ -5,9 +5,6 @@ # Mon Apr 7 15:41:19 CEST 2014 QPACKAGE_ROOT=${PWD} -echo $QPACKAGE_ROOT -IRPF90=${QPACKAGE_ROOT}/irpf90/bin/irpf90 -echo $IRPF90 if [[ -z ${IRPF90} ]] ; then @@ -18,9 +15,7 @@ then echo "Error in IRPF90 installation" exit 1 fi - rm -rf EZFIO fi -echo $IRPF90 cat << EOF > quantum_package.rc export IRPF90=${IRPF90} @@ -39,6 +34,6 @@ fi if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]] then - echo "Error in EZFIO installation" + echo "Error in IRPF90 installation" exit 1 fi diff --git a/src/MonoInts/README.rst b/src/MonoInts/README.rst index 052e2053..a9bd07bc 100644 --- a/src/MonoInts/README.rst +++ b/src/MonoInts/README.rst @@ -91,34 +91,34 @@ Documentation `ao_nucl_elec_integral `_ interaction nuclear electron -`give_polynom_mult_center_mono_elec `_ +`give_polynom_mult_center_mono_elec `_ Undocumented -`i_x1_pol_mult_mono_elec `_ +`i_x1_pol_mult_mono_elec `_ Undocumented -`i_x2_pol_mult_mono_elec `_ +`i_x2_pol_mult_mono_elec `_ Undocumented -`int_gaus_pol `_ +`int_gaus_pol `_ Undocumented `nai_pol_mult `_ Undocumented -`v_e_n `_ +`v_e_n `_ Undocumented -`v_phi `_ +`v_phi `_ Undocumented -`v_r `_ +`v_r `_ Undocumented -`v_theta `_ +`v_theta `_ Undocumented -`wallis `_ +`wallis `_ Undocumented `mo_nucl_elec_integral `_ From 33e8f41268718c0a4ee9a1c4d7723c5b20f71917 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 7 Jun 2014 22:07:50 +0200 Subject: [PATCH 2/4] Save wavefunction --- scripts/update_README.py | 5 +- setup_environment.sh | 7 +- src/BiInts/options.irp.f | 9 +- src/Bitmask/bitmasks.irp.f | 8 -- src/CIS_dressed/options.irp.f | 5 - src/Dets/H_apply.irp.f | 1 - src/Dets/README.rst | 22 ++-- src/Dets/determinants.ezfio_config | 4 +- src/Dets/determinants.irp.f | 190 ++++++++++++++++++++++----- src/Full_CI/full_ci.irp.f | 1 + src/Generators_full/generators.irp.f | 1 - src/Hartree_Fock/options.irp.f | 3 - src/MOs/mos.irp.f | 1 - src/Makefile.common | 4 + src/Makefile.config.ifort | 2 +- src/Selectors_full/selectors.irp.f | 1 - 16 files changed, 187 insertions(+), 77 deletions(-) diff --git a/scripts/update_README.py b/scripts/update_README.py index 811899d9..c530ae58 100755 --- a/scripts/update_README.py +++ b/scripts/update_README.py @@ -203,5 +203,8 @@ def main(): if __name__ == '__main__': - main() + try: + main() + except: + pass diff --git a/setup_environment.sh b/setup_environment.sh index 176cc604..db61497b 100755 --- a/setup_environment.sh +++ b/setup_environment.sh @@ -5,9 +5,6 @@ # Mon Apr 7 15:41:19 CEST 2014 QPACKAGE_ROOT=${PWD} -echo $QPACKAGE_ROOT -IRPF90=${QPACKAGE_ROOT}/irpf90/bin/irpf90 -echo $IRPF90 if [[ -z ${IRPF90} ]] ; then @@ -28,7 +25,9 @@ export QPACKAGE_ROOT=${QPACKAGE_ROOT} export PYTHONPATH+=:\${QPACKAGE_ROOT}/scripts export PATH+=:\${QPACKAGE_ROOT}/scripts export PATH+=:\${QPACKAGE_ROOT}/bin -export QPACKAGE_CACHE_URL="http://qmcchem.ups-tlse.fr/files/scemama/quantum_package/cache" +export QPACKAGE_CACHE_URL="http://qmcchem.ups-tlse.fr/files/scemama/quantum_package/cache +export PATH+=:${QPACKAGE_ROOT}/irpf90/bin/ +" EOF source quantum_package.rc diff --git a/src/BiInts/options.irp.f b/src/BiInts/options.irp.f index d4af85e1..f5d5fb8d 100644 --- a/src/BiInts/options.irp.f +++ b/src/BiInts/options.irp.f @@ -11,7 +11,6 @@ BEGIN_PROVIDER [ logical, write_mo_integrals ] call ezfio_get_bielec_integrals_write_mo_integrals(write_mo_integrals) else write_mo_integrals = .False. - call ezfio_set_bielec_integrals_write_mo_integrals(write_mo_integrals) endif END_PROVIDER @@ -29,7 +28,6 @@ BEGIN_PROVIDER [ logical, write_ao_integrals ] call ezfio_get_bielec_integrals_write_ao_integrals(write_ao_integrals) else write_ao_integrals = .False. - call ezfio_set_bielec_integrals_write_ao_integrals(write_ao_integrals) endif END_PROVIDER @@ -47,7 +45,6 @@ BEGIN_PROVIDER [ logical, read_mo_integrals ] call ezfio_get_bielec_integrals_read_mo_integrals(read_mo_integrals) else read_mo_integrals = .False. - call ezfio_set_bielec_integrals_read_mo_integrals(read_mo_integrals) endif END_PROVIDER @@ -65,7 +62,6 @@ BEGIN_PROVIDER [ logical, read_ao_integrals ] call ezfio_get_bielec_integrals_read_ao_integrals(read_ao_integrals) else read_ao_integrals = .False. - call ezfio_set_bielec_integrals_read_ao_integrals(read_ao_integrals) endif END_PROVIDER @@ -82,8 +78,7 @@ BEGIN_PROVIDER [ double precision, ao_integrals_threshold ] if (has) then call ezfio_get_bielec_integrals_threshold_ao(ao_integrals_threshold) else - ao_integrals_threshold = 1.d-15 - call ezfio_set_bielec_integrals_threshold_ao(ao_integrals_threshold) + ao_integrals_threshold = 1.d-12 endif END_PROVIDER @@ -102,7 +97,6 @@ BEGIN_PROVIDER [ double precision, mo_integrals_threshold ] call ezfio_get_bielec_integrals_threshold_mo(mo_integrals_threshold) else mo_integrals_threshold = 1.d-11 - call ezfio_set_bielec_integrals_threshold_mo(mo_integrals_threshold) endif END_PROVIDER @@ -121,7 +115,6 @@ BEGIN_PROVIDER [ logical, do_direct_integrals ] call ezfio_get_bielec_integrals_direct(do_direct_integrals) else do_direct_integrals = .False. - call ezfio_set_bielec_integrals_direct(do_direct_integrals) endif END_PROVIDER diff --git a/src/Bitmask/bitmasks.irp.f b/src/Bitmask/bitmasks.irp.f index 17d33c54..bec60e53 100644 --- a/src/Bitmask/bitmasks.irp.f +++ b/src/Bitmask/bitmasks.irp.f @@ -80,9 +80,6 @@ BEGIN_PROVIDER [ integer, N_generators_bitmask ] endif else N_generators_bitmask = 1 - call ezfio_set_bitmasks_N_int(N_int) - call ezfio_set_bitmasks_bit_kind(bit_kind) - call ezfio_set_bitmasks_N_mask_gen(N_generators_bitmask) endif ASSERT (N_generators_bitmask > 0) @@ -118,7 +115,6 @@ BEGIN_PROVIDER [ integer(bit_kind), generators_bitmask, (N_int,2,6,N_generators_ generators_bitmask(:,ispin,d_part2,k) = full_ijkl_bitmask(:,d_part2) enddo enddo - call ezfio_set_bitmasks_generators(generators_bitmask) endif END_PROVIDER @@ -148,9 +144,6 @@ BEGIN_PROVIDER [ integer, N_reference_bitmask ] endif else N_reference_bitmask = 1 - call ezfio_set_bitmasks_N_int(N_int) - call ezfio_set_bitmasks_bit_kind(bit_kind) - call ezfio_set_bitmasks_N_mask_ref(N_reference_bitmask) endif ASSERT (N_reference_bitmask > 0) @@ -174,7 +167,6 @@ BEGIN_PROVIDER [ integer(bit_kind), reference_bitmask, (N_int,2,2,N_reference_bi reference_bitmask(:,:,d_part1,1) = iand(not(HF_bitmask(:,:)),full_ijkl_bitmask(:,:)) reference_bitmask(:,:,d_hole2,1) = HF_bitmask reference_bitmask(:,:,d_part2,1) = iand(not(HF_bitmask(:,:)),full_ijkl_bitmask(:,:)) - call ezfio_set_bitmasks_reference(reference_bitmask) endif END_PROVIDER diff --git a/src/CIS_dressed/options.irp.f b/src/CIS_dressed/options.irp.f index 59b67c4f..50872abc 100644 --- a/src/CIS_dressed/options.irp.f +++ b/src/CIS_dressed/options.irp.f @@ -11,7 +11,6 @@ BEGIN_PROVIDER [ integer , n_state_cis ] call ezfio_get_cis_dressed_n_state_cis(n_state_cis) else n_state_cis = 5 - call ezfio_set_cis_dressed_n_state_cis(n_state_cis) endif END_PROVIDER @@ -29,7 +28,6 @@ BEGIN_PROVIDER [ integer , n_core_cis] call ezfio_get_cis_dressed_n_core_cis(n_core_cis) else n_core_cis = 0 - call ezfio_set_cis_dressed_n_core_cis(n_core_cis) endif END_PROVIDER @@ -47,7 +45,6 @@ BEGIN_PROVIDER [ integer , n_act_cis] call ezfio_get_cis_dressed_n_act_cis(n_act_cis) else n_act_cis = mo_tot_num - call ezfio_set_cis_dressed_n_act_cis(n_act_cis) endif END_PROVIDER @@ -65,7 +62,6 @@ BEGIN_PROVIDER [ logical , mp2_dressing] call ezfio_get_cis_dressed_mp2_dressing(mp2_dressing) else mp2_dressing = .False. - call ezfio_set_cis_dressed_mp2_dressing(mp2_dressing) endif END_PROVIDER @@ -83,7 +79,6 @@ BEGIN_PROVIDER [ logical , standard_doubles] call ezfio_get_cis_dressed_standard_doubles(standard_doubles) else standard_doubles = .True. - call ezfio_set_cis_dressed_standard_doubles(standard_doubles) endif END_PROVIDER diff --git a/src/Dets/H_apply.irp.f b/src/Dets/H_apply.irp.f index 6e240a4b..74a581d9 100644 --- a/src/Dets/H_apply.irp.f +++ b/src/Dets/H_apply.irp.f @@ -53,7 +53,6 @@ BEGIN_PROVIDER [ double precision, H_apply_threshold ] call ezfio_get_determinants_H_apply_threshold(H_apply_threshold) else H_apply_threshold = 1.d-10 - call ezfio_set_determinants_H_apply_threshold(H_apply_threshold) endif call write_time(output_Dets) call write_double(output_Dets, H_apply_threshold, & diff --git a/src/Dets/README.rst b/src/Dets/README.rst index 0b972cd9..35c61523 100644 --- a/src/Dets/README.rst +++ b/src/Dets/README.rst @@ -152,7 +152,7 @@ Documentation `davidson_threshold `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] -`det_search_key `_ +`det_search_key `_ Return an integer*8 corresponding to a determinant index for searching `n_det `_ @@ -164,20 +164,20 @@ Documentation `n_states `_ Number of states to consider -`psi_average_norm_contrib `_ +`psi_average_norm_contrib `_ Contribution of determinants to the state-averaged density -`psi_average_norm_contrib_sorted `_ +`psi_average_norm_contrib_sorted `_ Wave function sorted by determinants contribution to the norm (state-averaged) -`psi_coef `_ +`psi_coef `_ The wave function coefficients. Initialized with Hartree-Fock if the EZFIO file is empty -`psi_coef_sorted `_ +`psi_coef_sorted `_ Wave function sorted by determinants contribution to the norm (state-averaged) -`psi_coef_sorted_bit `_ +`psi_coef_sorted_bit `_ Determinants on which we apply for perturbation. o They are sorted by determinants interpreted as integers. Useful to accelerate the search of a determinant @@ -189,14 +189,20 @@ Documentation `psi_det_size `_ Size of the psi_det/psi_coef arrays -`psi_det_sorted `_ +`psi_det_sorted `_ Wave function sorted by determinants contribution to the norm (state-averaged) -`psi_det_sorted_bit `_ +`psi_det_sorted_bit `_ Determinants on which we apply for perturbation. o They are sorted by determinants interpreted as integers. Useful to accelerate the search of a determinant +`read_dets `_ + Reads the determinants from the EZFIO file + +`save_wavefunction `_ + Save the wave function into the EZFIO file + `double_exc_bitmask `_ double_exc_bitmask(:,1,i) is the bitmask for holes of excitation 1 double_exc_bitmask(:,2,i) is the bitmask for particles of excitation 1 diff --git a/src/Dets/determinants.ezfio_config b/src/Dets/determinants.ezfio_config index a6e2f4c2..0fedee17 100644 --- a/src/Dets/determinants.ezfio_config +++ b/src/Dets/determinants.ezfio_config @@ -1,10 +1,10 @@ determinants - N_int integer + n_int integer bit_kind integer n_det integer n_states integer psi_coef double precision (determinants_n_det,determinants_n_states) - psi_det integer*8 (determinants_N_int*determinants_bit_kind/8,2,determinants_n_det) + psi_det integer*8 (determinants_n_int*determinants_bit_kind/8,2,determinants_n_det) H_apply_threshold double precision n_det_max_jacobi integer threshold_generators double precision diff --git a/src/Dets/determinants.irp.f b/src/Dets/determinants.irp.f index bf30e434..46249e5f 100644 --- a/src/Dets/determinants.irp.f +++ b/src/Dets/determinants.irp.f @@ -12,7 +12,6 @@ BEGIN_PROVIDER [ integer, N_states ] call ezfio_get_determinants_n_states(N_states) else N_states = 1 - call ezfio_set_determinants_n_states(N_states) endif ASSERT (N_states > 0) END_PROVIDER @@ -29,7 +28,6 @@ BEGIN_PROVIDER [ integer, N_det ] call ezfio_get_determinants_n_det(N_det) else N_det = 1 - call ezfio_set_determinants_n_det(N_det) endif ASSERT (N_det > 0) END_PROVIDER @@ -46,8 +44,7 @@ BEGIN_PROVIDER [ integer, N_det_max_jacobi ] if (exists) then call ezfio_get_determinants_n_det_max_jacobi(N_det_max_jacobi) else - N_det_max_jacobi = 1500 - call ezfio_set_determinants_n_det_max_jacobi(N_det_max_jacobi) + N_det_max_jacobi = 2000 endif ASSERT (N_det_max_jacobi > 0) END_PROVIDER @@ -61,47 +58,125 @@ BEGIN_PROVIDER [ integer, psi_det_size ] psi_det_size = 1000*N_states END_PROVIDER - BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ] +BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ] implicit none BEGIN_DOC ! The wave function determinants. Initialized with Hartree-Fock if the EZFIO file ! is empty END_DOC + integer*8, allocatable :: psi_det_read(:,:,:) + double precision, allocatable :: psi_coef_read(:,:) + integer*8 :: det_8(100) + integer(bit_kind) :: det_bk((100*8)/bit_kind) + integer :: N_int2, i + logical :: exists + equivalence (det_8, det_bk) - integer, save :: ifirst = 0 + call ezfio_has_determinants_N_int(exists) + if (exists) then + call ezfio_has_determinants_bit_kind(exists) + if (exists) then + call ezfio_has_determinants_N_det(exists) + if (exists) then + call ezfio_has_determinants_N_states(exists) + if (exists) then + call ezfio_has_determinants_psi_coef(exists) + if (exists) then + call ezfio_has_determinants_psi_det(exists) + endif + endif + endif + endif + endif - if (ifirst == 0) then - ifirst = 1 - psi_det = 0_bit_kind - endif - - integer :: i - do i=1,N_int - psi_det(i,1,1) = HF_bitmask(i,1) - psi_det(i,2,1) = HF_bitmask(i,2) - enddo + if (exists) then + call read_dets(psi_det,N_int,N_det) + else + psi_det = 0_bit_kind + do i=1,N_int + psi_det(i,1,1) = HF_bitmask(i,1) + psi_det(i,2,1) = HF_bitmask(i,2) + enddo + endif END_PROVIDER +subroutine read_dets(det,Nint,Ndet) + implicit none + BEGIN_DOC + ! Reads the determinants from the EZFIO file + END_DOC + + integer, intent(in) :: Nint,Ndet + integer(bit_kind), intent(out) :: det(Nint,2,Ndet) + integer*8, allocatable :: psi_det_read(:,:,:) + double precision, allocatable :: psi_coef_read(:,:) + integer*8 :: det_8(100) + integer(bit_kind) :: det_bk((100*8)/bit_kind) + integer :: N_int2 + integer :: i,k + equivalence (det_8, det_bk) + + call ezfio_get_determinants_N_int(N_int2) + ASSERT (N_int2 == N_int) + call ezfio_get_determinants_bit_kind(k) + ASSERT (k == bit_kind) + + N_int2 = (N_int*bit_kind)/8 + allocate (psi_det_read(N_int2,2,N_det)) + call ezfio_get_determinants_psi_det (psi_det_read) + do i=1,N_det + do k=1,N_int2 + det_8(k) = psi_det_read(k,1,i) + enddo + do k=1,N_int + det(k,1,i) = det_bk(k) + enddo + do k=1,N_int2 + det_8(k) = psi_det_read(k,2,i) + enddo + do k=1,N_int + det(k,2,i) = det_bk(k) + enddo + enddo + deallocate(psi_det_read) + +end + + BEGIN_PROVIDER [ double precision, psi_coef, (psi_det_size,N_states) ] - implicit none - BEGIN_DOC - ! The wave function coefficients. Initialized with Hartree-Fock if the EZFIO file - ! is empty - END_DOC - - integer, save :: ifirst = 0 - integer :: i - - if (ifirst == 0) then - ifirst = 1 + implicit none + BEGIN_DOC + ! The wave function coefficients. Initialized with Hartree-Fock if the EZFIO file + ! is empty + END_DOC + + integer :: i,k, N_int2 + logical :: exists + double precision, allocatable :: psi_coef_read(:,:) + + call ezfio_has_determinants_psi_coef(exists) + + if (exists) then + + allocate (psi_coef_read(N_det,N_states)) + call ezfio_get_determinants_psi_coef(psi_coef_read) + do k=1,N_states + do i=1,N_det + psi_coef(i,k) = psi_coef_read(i,k) + enddo + enddo + deallocate(psi_coef_read) + + else + psi_coef = 0.d0 - endif - - do i=1,N_states - psi_coef(i,i) = 1.d0 - enddo - + do i=1,N_states + psi_coef(i,i) = 1.d0 + enddo + + endif + END_PROVIDER @@ -206,3 +281,52 @@ integer*8 function det_search_key(det,Nint) det_search_key = ieor(det_search_key,iand(det(i,1),det(i,2))) enddo end + +subroutine save_wavefunction + implicit none + BEGIN_DOC +! Save the wave function into the EZFIO file + END_DOC + integer*8, allocatable :: psi_det_save(:,:,:) + double precision, allocatable :: psi_coef_save(:,:) + integer*8 :: det_8(100) + integer(bit_kind) :: det_bk((100*8)/bit_kind) + integer :: N_int2 + equivalence (det_8, det_bk) + + integer :: i,k + + call ezfio_set_determinants_N_int(N_int) + call ezfio_set_determinants_bit_kind(bit_kind) + call ezfio_set_determinants_N_det(N_det) + call ezfio_set_determinants_N_states(N_states) + + N_int2 = (N_int*bit_kind)/8 + allocate (psi_det_save(N_int2,2,N_det)) + do i=1,N_det + do k=1,N_int + det_bk(k) = psi_det_sorted(k,1,i) + enddo + do k=1,N_int2 + psi_det_save(k,1,i) = det_8(k) + enddo + do k=1,N_int + det_bk(k) = psi_det(k,2,i) + enddo + do k=1,N_int2 + psi_det_save(k,2,i) = det_8(k) + enddo + enddo + call ezfio_set_determinants_psi_det(psi_det_save) + deallocate (psi_det_save) + + allocate (psi_coef_save(N_det,N_states)) + do k=1,N_states + do i=1,N_det + psi_coef_save(i,k) = psi_coef_sorted(i,k) + enddo + enddo + call ezfio_set_determinants_psi_coef(psi_coef_save) + deallocate (psi_coef_save) +end + diff --git a/src/Full_CI/full_ci.irp.f b/src/Full_CI/full_ci.irp.f index 8b30b577..bef1b05b 100644 --- a/src/Full_CI/full_ci.irp.f +++ b/src/Full_CI/full_ci.irp.f @@ -14,6 +14,7 @@ program cisd do while (maxval(abs(pt2(1:N_st))) > 1.d-3) call H_apply_FCI(pt2, norm_pert, H_pert_diag, N_st) call diagonalize_CI + call save_wavefunction print *, 'N_det = ', N_det print *, 'N_states = ', N_states print *, 'PT2 = ', pt2 diff --git a/src/Generators_full/generators.irp.f b/src/Generators_full/generators.irp.f index d2f6307a..3f3fba86 100644 --- a/src/Generators_full/generators.irp.f +++ b/src/Generators_full/generators.irp.f @@ -13,7 +13,6 @@ BEGIN_PROVIDER [ double precision, threshold_generators ] call ezfio_get_determinants_threshold_generators(threshold_generators) else threshold_generators = 0.99d0 - call ezfio_set_determinants_threshold_generators(threshold_generators) endif ASSERT (N_det > 0) call write_double(output_Dets,threshold_generators,'Threshold on generators') diff --git a/src/Hartree_Fock/options.irp.f b/src/Hartree_Fock/options.irp.f index f0a8659e..6576e36c 100644 --- a/src/Hartree_Fock/options.irp.f +++ b/src/Hartree_Fock/options.irp.f @@ -11,7 +11,6 @@ BEGIN_PROVIDER [ double precision,thresh_SCF ] call ezfio_get_Hartree_Fock_thresh_SCF(thresh_SCF) else thresh_SCF = 1.d-10 - call ezfio_set_Hartree_Fock_thresh_SCF(thresh_SCF) endif call write_time(output_Hartree_Fock) call write_double(output_Hartree_Fock, thresh_SCF, & @@ -32,7 +31,6 @@ BEGIN_PROVIDER [ integer, n_it_scf_max] call ezfio_get_Hartree_Fock_n_it_scf_max(n_it_scf_max) else n_it_scf_max = 30 - call ezfio_set_Hartree_Fock_n_it_scf_max(n_it_scf_max) endif END_PROVIDER @@ -51,7 +49,6 @@ BEGIN_PROVIDER [ logical, do_DIIS ] call ezfio_get_Hartree_Fock_DIIS(do_DIIS) else do_DIIS = .False. - call ezfio_set_Hartree_Fock_DIIS(do_DIIS) endif END_PROVIDER diff --git a/src/MOs/mos.irp.f b/src/MOs/mos.irp.f index 494b157c..b081d8ce 100644 --- a/src/MOs/mos.irp.f +++ b/src/MOs/mos.irp.f @@ -39,7 +39,6 @@ END_PROVIDER call ezfio_get_mo_basis_mo_label(mo_label) else mo_label = 'no_label' - call ezfio_set_mo_basis_mo_label(mo_label) endif ! Coefs diff --git a/src/Makefile.common b/src/Makefile.common index 488d1bf5..f71fe9f0 100644 --- a/src/Makefile.common +++ b/src/Makefile.common @@ -125,3 +125,7 @@ test: # Dummy rule to enable to force recompilation FORCE: +clena: clean + +vercylean: veryclean +veryclena: veryclean diff --git a/src/Makefile.config.ifort b/src/Makefile.config.ifort index 021083aa..866b08bc 100644 --- a/src/Makefile.config.ifort +++ b/src/Makefile.config.ifort @@ -5,7 +5,7 @@ DEBUG = 0 IRPF90_FLAGS+= --align=32 FC = ifort -g FCFLAGS= -FCFLAGS+= -axAVX,SSE4.3 +FCFLAGS+= -axAVX,SSE4.2 FCFLAGS+= -O2 FCFLAGS+= -ip FCFLAGS+= -opt-prefetch diff --git a/src/Selectors_full/selectors.irp.f b/src/Selectors_full/selectors.irp.f index e430f591..85fad182 100644 --- a/src/Selectors_full/selectors.irp.f +++ b/src/Selectors_full/selectors.irp.f @@ -13,7 +13,6 @@ BEGIN_PROVIDER [ double precision, threshold_selectors ] call ezfio_get_determinants_threshold_selectors(threshold_selectors) else threshold_selectors = 0.99d0 - call ezfio_set_determinants_threshold_selectors(threshold_selectors) endif ASSERT (N_det > 0) call write_double(output_Dets,threshold_selectors,'Threshold on selectors') From 0385ded0e419d939505ae2830797d4d3aae6f8ae Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sun, 8 Jun 2014 00:22:33 +0200 Subject: [PATCH 3/4] Restart does not work --- src/Dets/H_apply_template.f | 6 ++---- src/Dets/determinants.irp.f | 35 +++++++++++++++++++---------------- src/Full_CI/README.rst | 3 --- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/Dets/H_apply_template.f b/src/Dets/H_apply_template.f index 39f85033..27afc8e5 100644 --- a/src/Dets/H_apply_template.f +++ b/src/Dets/H_apply_template.f @@ -31,10 +31,9 @@ subroutine $subroutine_diexc(key_in, hole_1,particl_1, hole_2, particl_2, i_gene integer :: iproc integer(omp_lock_kind), save :: lck, ifirst=0 if (ifirst == 0) then - ifirst=1 !$ call omp_init_lock(lck) + ifirst=1 endif - PROVIDE H_apply_threshold $initialization @@ -279,7 +278,6 @@ subroutine $subroutine_monoexc(key_in, hole_1,particl_1,i_generator $parameters ifirst=1 !$ call omp_init_lock(lck) endif - PROVIDE H_apply_threshold $initialization @@ -383,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 + PROVIDE psi_det_sorted_bit coef_hf_selector psi_det psi_coef H_apply_threshold nmax = ( N_det_generators/nproc ) *nproc call wall_time(wall_1) diff --git a/src/Dets/determinants.irp.f b/src/Dets/determinants.irp.f index 46249e5f..979386f1 100644 --- a/src/Dets/determinants.irp.f +++ b/src/Dets/determinants.irp.f @@ -55,7 +55,16 @@ BEGIN_PROVIDER [ integer, psi_det_size ] BEGIN_DOC ! Size of the psi_det/psi_coef arrays END_DOC - psi_det_size = 1000*N_states + PROVIDE ezfio_filename + logical :: exists + call ezfio_has_determinants_n_det(exists) + if (exists) then + call ezfio_get_determinants_n_det(psi_det_size) + else + psi_det_size = 1 + endif + psi_det_size = max(psi_det_size,10000) + END_PROVIDER BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ] @@ -64,13 +73,8 @@ BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ] ! The wave function determinants. Initialized with Hartree-Fock if the EZFIO file ! is empty END_DOC - integer*8, allocatable :: psi_det_read(:,:,:) - double precision, allocatable :: psi_coef_read(:,:) - integer*8 :: det_8(100) - integer(bit_kind) :: det_bk((100*8)/bit_kind) - integer :: N_int2, i + integer :: i logical :: exists - equivalence (det_8, det_bk) call ezfio_has_determinants_N_int(exists) if (exists) then @@ -80,10 +84,7 @@ 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_coef(exists) - if (exists) then call ezfio_has_determinants_psi_det(exists) - endif endif endif endif @@ -102,6 +103,7 @@ BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ] END_PROVIDER subroutine read_dets(det,Nint,Ndet) + use bitmasks implicit none BEGIN_DOC ! Reads the determinants from the EZFIO file @@ -118,24 +120,24 @@ subroutine read_dets(det,Nint,Ndet) equivalence (det_8, det_bk) call ezfio_get_determinants_N_int(N_int2) - ASSERT (N_int2 == N_int) + ASSERT (N_int2 == Nint) call ezfio_get_determinants_bit_kind(k) ASSERT (k == bit_kind) - N_int2 = (N_int*bit_kind)/8 - allocate (psi_det_read(N_int2,2,N_det)) + N_int2 = (Nint*bit_kind)/8 + allocate (psi_det_read(N_int2,2,Ndet)) call ezfio_get_determinants_psi_det (psi_det_read) - do i=1,N_det + do i=1,Ndet do k=1,N_int2 det_8(k) = psi_det_read(k,1,i) enddo - do k=1,N_int + do k=1,Nint det(k,1,i) = det_bk(k) enddo do k=1,N_int2 det_8(k) = psi_det_read(k,2,i) enddo - do k=1,N_int + do k=1,Nint det(k,2,i) = det_bk(k) enddo enddo @@ -176,6 +178,7 @@ BEGIN_PROVIDER [ double precision, psi_coef, (psi_det_size,N_states) ] enddo endif + END_PROVIDER diff --git a/src/Full_CI/README.rst b/src/Full_CI/README.rst index 5f0ae69c..f63f5a06 100644 --- a/src/Full_CI/README.rst +++ b/src/Full_CI/README.rst @@ -10,9 +10,6 @@ Documentation .. Do not edit this section. It was auto-generated from the .. NEEDED_MODULES file. -`cisd `_ - Undocumented - Needed Modules From 5818f4f2551f8e66afce319eb545452a2fd11e44 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 9 Jun 2014 00:15:48 +0200 Subject: [PATCH 4/4] 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