10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-11-15 02:23:38 +01:00

General diag

This commit is contained in:
Anthony Scemama 2016-05-09 09:21:10 +02:00
parent ca21d44409
commit 09bf6140c8
3 changed files with 33 additions and 26 deletions

View File

@ -264,14 +264,15 @@ BEGIN_PROVIDER [ double precision, E_loc ]
END_PROVIDER
BEGIN_PROVIDER [ double precision, E_loc_zv, (3) ]
BEGIN_PROVIDER [ double precision, E_loc_zv, ((pdmc_n_diag+1)*2) ]
implicit none
BEGIN_DOC
! Zero-variance parameter on E_loc
END_DOC
E_loc_zv(1) = E_loc + (E_trial-E_loc) * dmc_zv_weight_half
E_loc_zv(2) = E_loc + (E_trial-E_loc) * dmc_zv_weight
E_loc_zv(3) = dmc_zv_weight_half
! E_loc_zv(1) = E_loc + (E_trial-E_loc) * dmc_zv_weight_half
! E_loc_zv(2) = E_loc + (E_trial-E_loc) * dmc_zv_weight
! E_loc_zv(3) = dmc_zv_weight_half
E_loc_zv(:) = 0.d0
END_PROVIDER

View File

@ -56,7 +56,7 @@ BEGIN_PROVIDER [ double precision, pop_weight ]
if (qmc_method == t_SRMC) then
pop_weight = srmc_pop_weight_mult
else if (qmc_method == t_PDMC) then
pop_weight = pdmc_pop_weight_mult(1)
pop_weight = pdmc_pop_weight_mult(pdmc_n_diag)
endif
pop_weight_min = min(pop_weight,pop_weight_min)
pop_weight_max = max(pop_weight,pop_weight_max)

View File

@ -111,7 +111,7 @@ END_SHELL
endif
integer :: info
double precision :: H(0:pdmc_n_diag/2,0:pdmc_n_diag/2), S(0:pdmc_n_diag/2,0:pdmc_n_diag/2), w(0:pdmc_n_diag/2), work(3*pdmc_n_diag+1)
double precision :: H(0:pdmc_n_diag/2,0:pdmc_n_diag/2), S(0:pdmc_n_diag/2,0:pdmc_n_diag/2), w(0:pdmc_n_diag/2), work(3*pdmc_n_diag+1)
H = 0.d0
S = 0.d0
@ -150,7 +150,7 @@ END_SHELL
logical :: accepted
call brownian_step(p,q,accepted,delta_x)
if ( psi_value * psi_value_save(i_walk) >= 0.d0 ) then
! if ( psi_value * psi_value_save(i_walk) >= 0.d0 ) then
delta = ((E_loc+E_loc_save(i_walk))*0.5d0 - E_ref) * p
if ( delta > thr ) then
pdmc_weight(i_walk) = dexp(-dtime_step*thr)
@ -185,6 +185,11 @@ END_SHELL
endif
TOUCH dmc_zv_weight dmc_zv_weight_half
do i=1,pdmc_n_diag+1
E_loc_zv(i) = E_loc * pdmc_pop_weight_mult(i-1) * pdmc_weight(i_walk) * dmc_zv_weight + (E_trial-E_loc) * dmc_zv_weight
E_loc_zv(i+pdmc_n_diag+1) = pdmc_pop_weight_mult(i-1) * pdmc_weight(i_walk) * dmc_zv_weight
enddo
BEGIN_SHELL [ /usr/bin/python ]
from properties import *
t = """
@ -221,9 +226,6 @@ END_SHELL
block_weight += pdmc_pop_weight_mult(pdmc_n_diag) * pdmc_weight(i_walk)
H(0,0) += E_loc
S(0,0) += 1.d0
pdmc_pop_weight_mult(0) = 1.d0/pdmc_weight(i_walk)
do k=0,pdmc_n_diag/2
do l=0,pdmc_n_diag/2
@ -231,14 +233,13 @@ END_SHELL
S(k,l) += pdmc_pop_weight_mult(k+l) * pdmc_weight(i_walk)
enddo
enddo
H = H + (E_trial - E_loc)
H = H+E_trial-E_loc
else
pdmc_weight(i_walk) = 1.d0
pdmc_pop_weight(:,:) = 1.d0
pdmc_pop_weight_mult(:) = 1.d0
endif
! else
! pdmc_weight(i_walk) = 1.d0
! pdmc_pop_weight(:,:) = 1.d0
! pdmc_pop_weight_mult(:) = 1.d0
! endif
do k=1,pdmc_n_diag
@ -303,17 +304,22 @@ for p in properties:
print t.replace("$X",p[1])
END_SHELL
H = 0.d0
H(0,0) = E_loc_zv_pdmc_block_walk(1)
H(1,0) = E_loc_zv_pdmc_block_walk(3)
H(0,1) = E_loc_zv_pdmc_block_walk(3)
H(1,1) = E_loc_zv_pdmc_block_walk(5)
S = 0.d0
S(0,0) = E_loc_zv_pdmc_block_walk(6)
S(1,0) = E_loc_zv_pdmc_block_walk(8)
S(0,1) = E_loc_zv_pdmc_block_walk(8)
S(1,1) = E_loc_zv_pdmc_block_walk(10)
S(2,2) = 1.d0
call dsygv(1, 'N', 'U', pdmc_n_diag/2+1, H, pdmc_n_diag/2+1, S, pdmc_n_diag/2+1, w, work, 3*(pdmc_n_diag+1), info)
E_loc_zv_diag_pdmc_block_walk = w(0)
print *, info, w
! E_loc_zv_diag_pdmc_block_walk = 0.5d0 * (sqrt( &
! E_loc_zv_pdmc_block_walk(2)*E_loc_zv_pdmc_block_walk(2) &
! - 2.d0*E_trial*E_loc_zv_pdmc_block_walk(2) &
! + 5.d0*E_trial*E_trial &
! - 8.d0*E_loc_zv_pdmc_block_walk(1)*E_trial &
! + 4.d0*E_loc_zv_pdmc_block_walk(1)*E_loc_zv_pdmc_block_walk(1) &
! ) - E_loc_zv_pdmc_block_walk(2) - E_trial)
deallocate ( elec_coord_tmp, psi_grad_psi_inv_save, psi_grad_psi_inv_save_tmp )
@ -359,7 +365,7 @@ BEGIN_PROVIDER [ integer, pdmc_n_diag ]
BEGIN_DOC
! Size of the matrix to diagonalize
END_DOC
pdmc_n_diag = 2
pdmc_n_diag = 8
END_PROVIDER