From f985e072118449448d826d71b7f18746d63920c5 Mon Sep 17 00:00:00 2001 From: Manu Date: Thu, 5 Jun 2014 02:45:31 +0200 Subject: [PATCH] Better selection --- setup_environment.sh | 6 +++++- src/CISD_SC2_selected/H_apply.irp.f | 10 ++++++++++ src/CISD_SC2_selected/cisd_sc2_selection.irp.f | 11 ++++++++--- src/Perturbation/pert_sc2.irp.f | 15 ++++++++------- 4 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 src/CISD_SC2_selected/H_apply.irp.f diff --git a/setup_environment.sh b/setup_environment.sh index 62b579ed..23f689dd 100755 --- a/setup_environment.sh +++ b/setup_environment.sh @@ -5,6 +5,9 @@ # 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 @@ -16,6 +19,7 @@ then exit 1 fi fi +echo $IRPF90 cat << EOF > quantum_package.rc export IRPF90=${IRPF90} @@ -34,6 +38,6 @@ fi if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]] then - echo "Error in IRPF90 installation" + echo "Error in EZFIO installation" exit 1 fi diff --git a/src/CISD_SC2_selected/H_apply.irp.f b/src/CISD_SC2_selected/H_apply.irp.f new file mode 100644 index 00000000..29248bc5 --- /dev/null +++ b/src/CISD_SC2_selected/H_apply.irp.f @@ -0,0 +1,10 @@ +use bitmasks +BEGIN_SHELL [ /usr/bin/env python ] +from generate_h_apply import * +from perturbation import perturbations + +s = H_apply("PT2",openmp=True) +s.set_perturbation("epstein_nesbet_sc2_projected") +print s +END_SHELL + diff --git a/src/CISD_SC2_selected/cisd_sc2_selection.irp.f b/src/CISD_SC2_selected/cisd_sc2_selection.irp.f index 2eec29eb..b90dc9ea 100644 --- a/src/CISD_SC2_selected/cisd_sc2_selection.irp.f +++ b/src/CISD_SC2_selected/cisd_sc2_selection.irp.f @@ -13,7 +13,7 @@ program cisd_sc2_selected pt2 = 1.d0 perturbation = "epstein_nesbet_sc2_projected" E_old(1) = HF_energy - do while (maxval(abs(pt2(1:N_st))) > 1.d-10) + do while (maxval(abs(pt2(1:N_st))) > 1.d-2) print*,'----' print*,'' call H_apply_cisd_selection(perturbation,pt2, norm_pert, H_pert_diag, N_st) @@ -34,6 +34,10 @@ program cisd_sc2_selected exit endif enddo + + print*,'coucou' + pt2 = 0.d0 + call H_apply_PT2(pt2, norm_pert, H_pert_diag, N_st) do i = 1, N_st max = 0.d0 @@ -51,9 +55,9 @@ program cisd_sc2_selected integer :: imax print *, 'PT2(SC2) = ', pt2(i) print *, 'E(SC2) = ', CI_SC2_energy(i) - print *, 'E_before(SC2)+PT2(SC2) = ', (E_old(i)+pt2(i)) + print *, 'E_before(SC2)+PT2(SC2) = ', (CI_SC2_energy(i)+pt2(i)) if(i==1)then - print *, 'E(SC2)+PT2(projctd)SC2 = ', (E_old(i)+H_pert_diag(i)) + print *, 'E(SC2)+PT2(projctd)SC2 = ', (CI_SC2_energy(i)+H_pert_diag(i)) endif print*,'greater coeficient of the state : ',dabs(psi_coef(imax,i)) @@ -61,5 +65,6 @@ program cisd_sc2_selected print*,'degree of excitation of such determinant : ',degree enddo + print*,'coucou' deallocate(pt2,norm_pert,H_pert_diag) end diff --git a/src/Perturbation/pert_sc2.irp.f b/src/Perturbation/pert_sc2.irp.f index 15b81377..bfeac1d9 100644 --- a/src/Perturbation/pert_sc2.irp.f +++ b/src/Perturbation/pert_sc2.irp.f @@ -55,14 +55,15 @@ subroutine pt2_epstein_nesbet_SC2_projected(det_pert,c_pert,e_2_pert,H_pert_diag do i =2,N_st H_pert_diag(i) = h - if(CI_SC2_electronic_energy(i)>h.and.CI_SC2_electronic_energy(i).ne.0.d0)then - c_pert(i) = -1.d0 - e_2_pert(i) = -2.d0 - else if (dabs(CI_SC2_electronic_energy(i) - h) > 1.d-6) then - c_pert(i) = i_H_psi_array(i) / (CI_SC2_electronic_energy(i) - h) - e_2_pert(i) = c_pert(i) * i_H_psi_array(i) +! if(CI_SC2_electronic_energy(i)>h.and.CI_SC2_electronic_energy(i).ne.0.d0)then +! c_pert(i) = -1.d0 +! e_2_pert(i) = -2.d0 +! else if (dabs(CI_SC2_electronic_energy(i) - h) > 1.d-6) then + if (dabs(CI_SC2_electronic_energy(i) - h) > 1.d-6) then + c_pert(i) = i_H_psi_array(i) / (-dabs(CI_SC2_electronic_energy(i) - h)) + e_2_pert(i) = (c_pert(i) * i_H_psi_array(i)) else - c_pert(i) = -1.d0 + c_pert(i) = i_H_psi_array(i) e_2_pert(i) = -dabs(i_H_psi_array(i)) endif enddo