WIP Transcorrelated

This commit is contained in:
Anthony Scemama 2021-07-30 18:18:18 +02:00
parent 2437ffe6e4
commit 5910d853a1
3 changed files with 101 additions and 4 deletions

View File

@ -47,6 +47,10 @@ def main():
def get_params_pen():
d = ezfio.jastrow_jast_pen
print(atom_map)
for m in atom_map:
print(m[0])
print (d[m[0]])
return np.array([d[m[0]] for m in atom_map])
@ -128,8 +132,8 @@ def main():
variance, v_err = get_variance()
if e is None or variance is None:
continue
energy = e + variance
err = sqrt(e_err*e_err+v_err*v_err)
energy = e #+ variance
err = e_err #sqrt(e_err*e_err+v_err*v_err)
print(" %f %f %f %f %f %f"%(e, e_err, variance, v_err, energy, err))
if (energy-2.*err) > memo_energy['fmin']+thresh:
local_thresh = 10.*thresh

25
src/MAIN/vmc_test.irp.f Normal file
View File

@ -0,0 +1,25 @@
program vmc_test
real :: t1,t2
print *, 'Ndet=',det_num
print *, 'Ndet alpha beta =',det_alpha_num, det_beta_num
if (do_prepare) then
stop 'No walkers'
endif
print *, 'E_loc = ', E_loc
call step2
call ezfio_finish
end
subroutine step2
implicit none
real :: accep_rate
print *, '---'
print *, '<E_loc> = ', E_loc_block_walk
print *, '<E_loc_2> = ', E_loc_2_block_walk
print *, 'w = ', block_weight
print *, 'Accept', accep_rate()
print *, ''
print *, ci_dress_vmc_block_walk
end

View File

@ -1,3 +1,15 @@
BEGIN_PROVIDER [ double precision, psi_norm ]
implicit none
BEGIN_DOC
! <1/J^2>
END_DOC
psi_norm = jast_value_inv*jast_value_inv
psi_norm_min = min(psi_norm_min,psi_norm)
psi_norm_max = max(psi_norm_max,psi_norm)
SOFT_TOUCH psi_norm_min psi_norm_max
END_PROVIDER
BEGIN_PROVIDER [ double precision, ci_overlap_psidet, (size_ci_overlap_psidet) ]
implicit none
BEGIN_DOC
@ -29,7 +41,7 @@ BEGIN_PROVIDER [ double precision, ci_h_psidet, (size_ci_h_psidet) ]
END_DOC
integer :: i, j, k, l
double precision :: T, tmp
double precision :: T
do k=1,det_num
i = det_coef_matrix_rows(k)
@ -42,7 +54,7 @@ BEGIN_PROVIDER [ double precision, ci_h_psidet, (size_ci_h_psidet) ]
T += det_beta_grad_lapl (4,l,j)*det_alpha_value(i)
enddo
ci_h_psidet(k) = -0.5d0*T + E_pot * det_alpha_value(i)*det_beta_value (j)
ci_h_psidet(k) *= psidet_inv
ci_h_psidet(k) *= psi_value_inv * jast_value_inv
enddo
ci_h_psidet_min = min(ci_h_psidet_min,minval(ci_h_psidet))
@ -217,3 +229,59 @@ BEGIN_PROVIDER [ double precision, ci_h_matrix_diag, (size_ci_h_matrix_diag) ]
END_PROVIDER
BEGIN_PROVIDER [ double precision, ci_h_transcor_psi, (size_ci_h_transcor_psi) ]
implicit none
BEGIN_DOC
! < det(i) e^{-J} |H| Psi >
!
! Dimensions : det_num
END_DOC
integer :: i, j, k
do k=1,det_num
i = det_coef_matrix_rows(k)
j = det_coef_matrix_columns(k)
ci_h_transcor_psi(k) = E_loc * jast_value_inv * &
det_alpha_value(i)*det_beta_value(j) * psi_value_inv
enddo
ci_h_transcor_psi_min = min(ci_h_transcor_psi_min,minval(ci_h_transcor_psi))
ci_h_transcor_psi_max = max(ci_h_transcor_psi_max,maxval(ci_h_transcor_psi))
SOFT_TOUCH ci_h_transcor_psi_min ci_h_transcor_psi_max
END_PROVIDER
BEGIN_PROVIDER [ double precision, ci_dress, (size_ci_dress) ]
implicit none
BEGIN_DOC
! < det(i) e^{-J} |H| Psi >
!
! Dimensions : det_num
END_DOC
integer :: i, j, k, l
double precision :: T, h_psidet
do k=1,det_num
i = det_coef_matrix_rows(k)
j = det_coef_matrix_columns(k)
T = 0.d0
do l=1,elec_alpha_num
T += det_alpha_grad_lapl(4,l,i)*det_beta_value (j)
enddo
do l=1,elec_beta_num
T += det_beta_grad_lapl (4,l,j)*det_alpha_value(i)
enddo
h_psidet = -0.5d0*T + E_pot * det_alpha_value(i)*det_beta_value(j)
h_psidet *= psi_value_inv * jast_value_inv
ci_dress(k) = E_loc * det_alpha_value(i)*det_beta_value(j) * psi_value_inv * jast_value_inv &
- h_psidet
enddo
ci_dress_min = min(ci_dress_min,minval(ci_dress))
ci_dress_max = max(ci_dress_max,maxval(ci_dress))
SOFT_TOUCH ci_dress_min ci_dress_max
END_PROVIDER