mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-23 12:56:14 +01:00
Updated lambda MRCC
This commit is contained in:
parent
6b3ba6a99e
commit
37f091845c
@ -31,7 +31,7 @@ OPENMP : 1 ; Append OpenMP flags
|
|||||||
# -ftz : Flushes denormal results to zero
|
# -ftz : Flushes denormal results to zero
|
||||||
#
|
#
|
||||||
[OPT]
|
[OPT]
|
||||||
FCFLAGS : -xHost -O2 -ip -ftz -g
|
FCFLAGS : -xSSE4.2 -O2 -ip -ftz -g
|
||||||
|
|
||||||
# Profiling flags
|
# Profiling flags
|
||||||
#################
|
#################
|
||||||
|
@ -2,20 +2,20 @@ use bitmasks
|
|||||||
BEGIN_SHELL [ /usr/bin/env python ]
|
BEGIN_SHELL [ /usr/bin/env python ]
|
||||||
from generate_h_apply import *
|
from generate_h_apply import *
|
||||||
|
|
||||||
s = H_apply_zmq("FCI")
|
s = H_apply("FCI")
|
||||||
s.set_selection_pt2("epstein_nesbet_2x2")
|
s.set_selection_pt2("epstein_nesbet_2x2")
|
||||||
s.unset_openmp()
|
#s.unset_openmp()
|
||||||
print s
|
print s
|
||||||
|
|
||||||
s = H_apply_zmq("FCI_PT2")
|
s = H_apply_zmq("FCI_PT2")
|
||||||
s.set_perturbation("epstein_nesbet_2x2")
|
s.set_perturbation("epstein_nesbet_2x2")
|
||||||
s.unset_openmp()
|
#s.unset_openmp()
|
||||||
print s
|
print s
|
||||||
|
|
||||||
s = H_apply_zmq("FCI_no_skip")
|
s = H_apply("FCI_no_skip")
|
||||||
s.set_selection_pt2("epstein_nesbet_2x2")
|
s.set_selection_pt2("epstein_nesbet_2x2")
|
||||||
s.unset_skip()
|
s.unset_skip()
|
||||||
s.unset_openmp()
|
#s.unset_openmp()
|
||||||
print s
|
print s
|
||||||
|
|
||||||
s = H_apply("FCI_mono")
|
s = H_apply("FCI_mono")
|
||||||
|
@ -2,3 +2,16 @@
|
|||||||
type: double precision
|
type: double precision
|
||||||
doc: Calculated energy
|
doc: Calculated energy
|
||||||
interface: ezfio
|
interface: ezfio
|
||||||
|
|
||||||
|
[thresh_mrcc]
|
||||||
|
type: Threshold
|
||||||
|
doc: Threshold on the convergence of the MRCC energy
|
||||||
|
interface: ezfio,provider,ocaml
|
||||||
|
default: 1.e-7
|
||||||
|
|
||||||
|
[n_it_mrcc_max]
|
||||||
|
type: Strictly_positive_int
|
||||||
|
doc: Maximum number of MRCC iterations
|
||||||
|
interface: ezfio,provider,ocaml
|
||||||
|
default: 20
|
||||||
|
|
||||||
|
@ -1,99 +1,32 @@
|
|||||||
BEGIN_PROVIDER [integer, pert_determinants, (N_states, psi_det_size) ]
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ double precision, lambda_mrcc, (N_states,psi_det_size) ]
|
BEGIN_PROVIDER [ double precision, lambda_mrcc, (N_states,psi_det_size) ]
|
||||||
&BEGIN_PROVIDER [ double precision, lambda_pert, (N_states,psi_det_size) ]
|
|
||||||
implicit none
|
implicit none
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
! cm/<Psi_0|H|D_m> or perturbative 1/Delta_E(m)
|
! cm/<Psi_0|H|D_m> or perturbative 1/Delta_E(m)
|
||||||
END_DOC
|
END_DOC
|
||||||
integer :: i,k,j
|
integer :: i,k
|
||||||
double precision :: ihpsi(N_states), hii,delta_e_eff,ihpsi_current(N_states),hij
|
double precision :: ihpsi(N_states),ihpsi_current(N_states)
|
||||||
integer :: i_ok,i_pert,i_pert_count
|
integer :: i_pert_count
|
||||||
i_ok = 0
|
|
||||||
|
|
||||||
double precision :: phase_restart(N_states),tmp
|
|
||||||
do k = 1, N_states
|
|
||||||
phase_restart(k) = dsign(1.d0,psi_ref_coef_restart(1,k)/psi_ref_coef(1,k))
|
|
||||||
enddo
|
|
||||||
i_pert_count = 0
|
i_pert_count = 0
|
||||||
|
lambda_mrcc = 0.d0
|
||||||
|
|
||||||
do i=1,N_det_non_ref
|
do i=1,N_det_non_ref
|
||||||
call i_h_psi(psi_non_ref(1,1,i), psi_ref_restart, psi_ref_coef_restart, N_int, N_det_ref,&
|
|
||||||
size(psi_ref_coef_restart,1), n_states, ihpsi)
|
|
||||||
call i_H_j(psi_non_ref(1,1,i),psi_non_ref(1,1,i),N_int,hii)
|
|
||||||
! TODO --- Test perturbatif ------
|
|
||||||
do k=1,N_states
|
|
||||||
lambda_pert(k,i) = 1.d0 / (psi_ref_energy_diagonalized(k)-hii)
|
|
||||||
! TODO : i_h_psi peut sortir de la boucle?
|
|
||||||
call i_h_psi(psi_non_ref(1,1,i), psi_ref, psi_ref_coef, N_int, N_det_ref,size(psi_ref_coef,1), n_states, ihpsi_current)
|
call i_h_psi(psi_non_ref(1,1,i), psi_ref, psi_ref_coef, N_int, N_det_ref,size(psi_ref_coef,1), n_states, ihpsi_current)
|
||||||
|
do k=1,N_states
|
||||||
if (ihpsi_current(k) == 0.d0) then
|
if (ihpsi_current(k) == 0.d0) then
|
||||||
ihpsi_current(k) = 1.d-32
|
ihpsi_current(k) = 1.d-32
|
||||||
endif
|
endif
|
||||||
tmp = psi_non_ref_coef(i,k)/ihpsi_current(k)
|
if(dabs(ihpsi_current(k) * psi_non_ref_coef(i,k)) < 1d-5) then
|
||||||
i_pert = 0
|
|
||||||
! Perturbation only if 1st order < 0.5 x second order
|
|
||||||
if((ihpsi(k) * lambda_pert(k,i)) < 0.5d0 * psi_non_ref_coef_restart(i,k) )then
|
|
||||||
i_pert = 1
|
|
||||||
else
|
|
||||||
do j = 1, N_det_ref
|
|
||||||
call i_H_j(psi_non_ref(1,1,i),psi_ref(1,1,j),N_int,hij)
|
|
||||||
! Perturbation diverges when hij*tmp > 0.5
|
|
||||||
if(dabs(hij * tmp).ge.0.5d0)then
|
|
||||||
i_pert_count +=1
|
i_pert_count +=1
|
||||||
i_pert = 1
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
if( i_pert == 1)then
|
|
||||||
pert_determinants(k,i) = i_pert
|
|
||||||
endif
|
|
||||||
if(pert_determinants(k,i) == 1)then
|
|
||||||
i_ok +=1
|
|
||||||
lambda_mrcc(k,i) = lambda_pert(k,i)
|
|
||||||
else
|
else
|
||||||
lambda_mrcc(k,i) = psi_non_ref_coef(i,k)/ihpsi_current(k)
|
lambda_mrcc(k,i) = psi_non_ref_coef(i,k)/ihpsi_current(k)
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
! TODO --- Fin test perturbatif ------
|
|
||||||
enddo
|
enddo
|
||||||
!if(oscillations)then
|
|
||||||
! print*,'AVERAGING the lambda_mrcc with those of the previous iterations'
|
|
||||||
! do i = 1, N_det_non_ref
|
|
||||||
! do k = 1, N_states
|
|
||||||
|
|
||||||
! double precision :: tmp
|
|
||||||
! tmp = lambda_mrcc(k,i)
|
|
||||||
! lambda_mrcc(k,i) += lambda_mrcc_tmp(k,i)
|
|
||||||
! lambda_mrcc(k,i) = lambda_mrcc(k,i) * 0.5d0
|
|
||||||
! if(dabs(tmp - lambda_mrcc(k,i)).ge.1.d-9)then
|
|
||||||
! print*,''
|
|
||||||
! print*,'i = ',i
|
|
||||||
! print*,'psi_non_ref_coef(i,k) = ',psi_non_ref_coef(i,k)
|
|
||||||
! print*,'lambda_mrcc(k,i) = ',lambda_mrcc(k,i)
|
|
||||||
! print*,' tmp = ',tmp
|
|
||||||
! endif
|
|
||||||
! enddo
|
|
||||||
! enddo
|
|
||||||
!endif
|
|
||||||
print*,'N_det_non_ref = ',N_det_non_ref
|
print*,'N_det_non_ref = ',N_det_non_ref
|
||||||
print*,'Number of Perturbatively treated determinants = ',i_ok
|
print*,'Number of ignored determinants = ',i_pert_count
|
||||||
print*,'i_pert_count = ',i_pert_count
|
|
||||||
print*,'psi_coef_ref_ratio = ',psi_ref_coef(2,1)/psi_ref_coef(1,1)
|
print*,'psi_coef_ref_ratio = ',psi_ref_coef(2,1)/psi_ref_coef(1,1)
|
||||||
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ double precision, lambda_mrcc_tmp, (N_states,psi_det_size) ]
|
|
||||||
implicit none
|
|
||||||
lambda_mrcc_tmp = 0.d0
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ logical, oscillations ]
|
|
||||||
implicit none
|
|
||||||
oscillations = .False.
|
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user