10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-12-21 20:03:31 +01:00

Merge Abdallah

This commit is contained in:
Anthony Scemama 2022-01-14 12:40:31 +01:00
parent bb64e47ac9
commit 40ce1bceb2
7 changed files with 202 additions and 73 deletions

View File

@ -23,7 +23,7 @@ electrons
elec_walk_num integer elec_walk_num integer
elec_coord_pool real (electrons_elec_num+1,3,electrons_elec_coord_pool_size) elec_coord_pool real (electrons_elec_num+1,3,electrons_elec_coord_pool_size)
elec_coord_pool_size integer elec_coord_pool_size integer
elec_fitcusp_radius real elec_fitcusp_radius real
nuclei nuclei
nucl_num integer nucl_num integer
@ -64,7 +64,7 @@ simulation
equilibration logical equilibration logical
http_server character*(128) http_server character*(128)
do_jast logical do_jast logical
nucl_fitcusp_factor real nucl_fitcusp_factor real
method character*(32) method character*(32)
block_time integer block_time integer
sampling character*(32) sampling character*(32)
@ -83,7 +83,7 @@ jastrow
jast_a_up_dn real jast_a_up_dn real
jast_b_up_up real jast_b_up_up real
jast_b_up_dn real jast_b_up_dn real
mu_erf real mu_erf real
jast_pen real (nuclei_nucl_num) jast_pen real (nuclei_nucl_num)
jast_eeN_e_a real (nuclei_nucl_num) jast_eeN_e_a real (nuclei_nucl_num)
jast_eeN_e_b real (nuclei_nucl_num) jast_eeN_e_b real (nuclei_nucl_num)
@ -92,9 +92,13 @@ jastrow
jast_core_a2 real (nuclei_nucl_num) jast_core_a2 real (nuclei_nucl_num)
jast_core_b1 real (nuclei_nucl_num) jast_core_b1 real (nuclei_nucl_num)
jast_core_b2 real (nuclei_nucl_num) jast_core_b2 real (nuclei_nucl_num)
jast_1b_type integer
jast_1btanh_pen real (nuclei_nucl_num)
jast_1berf_pen real (nuclei_nucl_num)
jast_1bgauss_pen real (nuclei_nucl_num)
blocks blocks
empty integer empty integer
pseudo pseudo
ao_pseudo_grid double precision (ao_basis_ao_num,pseudo_pseudo_lmax+pseudo_pseudo_lmax+1,pseudo_pseudo_lmax-0+1,nuclei_nucl_num,pseudo_pseudo_grid_size) ao_pseudo_grid double precision (ao_basis_ao_num,pseudo_pseudo_lmax+pseudo_pseudo_lmax+1,pseudo_pseudo_lmax-0+1,nuclei_nucl_num,pseudo_pseudo_grid_size)

View File

@ -8,10 +8,11 @@ CPU_TYPE="-mavx"
FC="gfortran -ffree-line-length-none" FC="gfortran -ffree-line-length-none"
FCFLAGS="-O2 -g ${CPU_TYPE}" FCFLAGS="-O2 -g ${CPU_TYPE}"
LIB="-lblas -llapack -lpthread" LIB="-lblas -llapack -lpthread"
ARCHIVE="ar crf"
## IRPF90 ## IRPF90
IRPF90="${QMCCHEM_PATH}/bin/irpf90" IRPF90="${QMCCHEM_PATH}/bin/irpf90"
IRPF90_FLAGS="--align=16" IRPF90_FLAGS="--align=16"
export FC FCFLAGS LIB IRPF90 IRPF90_FLAGS export FC FCFLAGS LIB IRPF90 IRPF90_FLAGS AR

View File

@ -12,10 +12,11 @@ ALIGN="32"
FC="ifort" FC="ifort"
FCFLAGS="-O2 -g -ip -ftz -finline ${CPU_TYPE} -qopenmp-simd" #-traceback FCFLAGS="-O2 -g -ip -ftz -finline ${CPU_TYPE} -qopenmp-simd" #-traceback
LIB="-mkl=sequential" LIB="-mkl=sequential"
ARCHIVE="ar crf"
## IRPF90 ## IRPF90
IRPF90="${QMCCHEM_PATH}/bin/irpf90" IRPF90="${QMCCHEM_PATH}/bin/irpf90"
IRPF90_FLAGS="--align=${ALIGN}" IRPF90_FLAGS="--align=${ALIGN}"
export FC FCFLAGS LIB IRPF90 IRPF90_FLAGS export FC FCFLAGS LIB IRPF90 IRPF90_FLAGS ARCHIVE

View File

@ -156,3 +156,38 @@ END_PROVIDER
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ integer, jast_1b_type ]
implicit none
include '../types.F'
jast_1b_type = 0 ! no 1body Jastrow
!jast_1b_type = 2 ! add 1body-Tanh Jastrow
!jast_1b_type = 3 ! add 1body-Simple Jastrow
!jast_1b_type = 4 ! add 1body-RSDFT Jastrow
!jast_1b_type = 5 ! add 1body-erf Jastrow
!jast_1b_type = 6 ! add 1body-Gauss Jastrow
call get_jastrow_jast_1b_type(jast_1b_type)
END_PROVIDER
! useful if jast_1b_type = 2
BEGIN_PROVIDER [ real, jast_1btanh_pen, (nucl_num) ]
implicit none
include '../types.F'
jast_1btanh_pen(:) = 1.0
call get_jastrow_jast_1btanh_pen(jast_1btanh_pen)
END_PROVIDER
! useful if jast_1b_type = 5
BEGIN_PROVIDER [ real, jast_1berf_pen, (nucl_num) ]
implicit none
include '../types.F'
jast_1berf_pen(:) = 1.0
call get_jastrow_jast_1berf_pen(jast_1berf_pen)
END_PROVIDER
! useful if jast_1b_type = 6
BEGIN_PROVIDER [ real, jast_1bGauss_pen, (nucl_num) ]
implicit none
include '../types.F'
jast_1bGauss_pen(:) = 1.0
call get_jastrow_jast_1bgauss_pen(jast_1bGauss_pen)
END_PROVIDER

View File

@ -1,18 +1,34 @@
BEGIN_PROVIDER [ double precision, Energy_mu ]
BEGIN_PROVIDER [ double precision, emudiff ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! E mu ! E mu
! Eq.(26-30)
END_DOC END_DOC
integer :: i !emudiff = e_loc - energy_mu * jast_value_inv * jast_value_inv
energy_mu = E_nucl emudiff = ( e_loc - energy_mu ) * jast_value_inv * jast_value_inv
emudiff_min = min(emudiff_min,emudiff)
emudiff_max = max(emudiff_max,emudiff)
SOFT_TOUCH emudiff_min emudiff_max
END_PROVIDER
BEGIN_PROVIDER [ double precision, Energy_mu ]
BEGIN_DOC
! E mu = < H_mu \Phi / \Phi >_{\Phi^2}
END_DOC
implicit none
integer :: i
Energy_mu = E_nucl
!DIR$ VECTOR ALIGNED !DIR$ VECTOR ALIGNED
!DIR$ LOOP COUNT(200) !DIR$ LOOP COUNT(200)
do i=1,elec_num do i = 1, elec_num
energy_mu += E_kin_elec(i) Energy_mu += E_kin_elec_psidet(i)
enddo enddo
energy_mu += Eff_pot_mu + eff_pot_deriv_mu + E_nucl_elec - three_body_mu Energy_mu += Eff_pot_mu + Eff_pot_deriv_mu + E_nucl_elec - three_body_mu
energy_mu_min = min(energy_mu_min,energy_mu) energy_mu_min = min(energy_mu_min,energy_mu)
energy_mu_max = max(energy_mu_max,energy_mu) energy_mu_max = max(energy_mu_max,energy_mu)
@ -21,8 +37,6 @@ END_PROVIDER
BEGIN_PROVIDER [double precision, E_nucl_elec] BEGIN_PROVIDER [double precision, E_nucl_elec]
implicit none implicit none
!TODO
integer :: i,j integer :: i,j
E_nucl_elec = 0.d0 E_nucl_elec = 0.d0
do i = 1, elec_num do i = 1, elec_num
@ -36,41 +50,63 @@ END_PROVIDER
BEGIN_PROVIDER [double precision, Eff_pot_mu_elec, (elec_num)] BEGIN_PROVIDER [double precision, Eff_pot_mu_elec, (elec_num)]
&BEGIN_PROVIDER [double precision, Eff_pot_mu_elec_simple, (elec_num)] &BEGIN_PROVIDER [double precision, Eff_pot_mu_elec_simple, (elec_num)]
implicit none
include '../constants.F' include '../constants.F'
BEGIN_DOC
! Eq.(32) implicit none
END_DOC integer :: i,j
integer :: i,j double precision :: rij, mu
double precision :: rij, mu
mu = mu_erf mu = mu_erf
Eff_pot_mu_elec = 0.d0 ! mu = jast_mu_erf
do i=1,elec_num Eff_pot_mu_elec = 0.d0
!DIR$ VECTOR ALIGNED
!DIR$ LOOP COUNT(50)
do j=1,elec_num ! 2body-Jastrow:
rij = elec_dist(j,i) !
if(i==j)cycle ! \Delta_i u_ij + \Delta_j u_ij = 2 [ (1-erf(mu r_ij))/r_ij - mu exp(-(mu r_ij)^2)/sqrt(pi) ]
Eff_pot_mu_elec(i) = Eff_pot_mu_elec(i) + 0.5d0 * derf(mu * rij) * elec_dist_inv(j,i) !
Eff_pot_mu_elec(i) = Eff_pot_mu_elec(i) + 0.5d0 * mu/dsqpi * dexp(-mu*mu*rij*rij) ! (grad_i u_ij)^2 + (grad_j u_ij)^2 = (1-erf(mu r_ij))^2 / 2
Eff_pot_mu_elec_simple(i) = Eff_pot_mu_elec(i)
Eff_pot_mu_elec(i) = Eff_pot_mu_elec(i) + 0.5d0 * (- 0.25d0 * (1.d0 - derf(mu*rij))**2.d0 ) do i = 1, elec_num
!DIR$ VECTOR ALIGNED
!DIR$ LOOP COUNT(50)
do j = 1, elec_num
rij = elec_dist(j,i)
if(i==j)cycle
Eff_pot_mu_elec(i) = Eff_pot_mu_elec(i) + 0.5d0 * derf(mu * rij) * elec_dist_inv(j,i)
Eff_pot_mu_elec(i) = Eff_pot_mu_elec(i) + 0.5d0 * mu/dsqpi * dexp(-mu*mu*rij*rij)
Eff_pot_mu_elec_simple(i) = Eff_pot_mu_elec(i)
Eff_pot_mu_elec(i) = Eff_pot_mu_elec(i) + 0.5d0 * (- 0.25d0 * (1.d0 - derf(mu*rij))**2.d0 )
enddo enddo
enddo enddo
! 1-body Jastrow
! if( jast_1b_type .gt. 0 ) then
! do i = 1, elec_num
! Eff_pot_mu_elec(i) -= 0.5d0 * jast_1b_lapl(i)
! Eff_pot_mu_elec(i) -= 0.5d0 * jast_1b_grad_sq(i)
! do j = 1, elec_num
! if(i==j) cycle
! Eff_pot_mu_elec(i) -= ( jast_elec_Mu_grad_x(i) * ( jast_1b_grad_x(i) - jast_1b_grad_x(j) ) &
! + jast_elec_Mu_grad_y(i) * ( jast_1b_grad_y(i) - jast_1b_grad_y(j) ) &
! + jast_elec_Mu_grad_z(i) * ( jast_1b_grad_z(i) - jast_1b_grad_z(j) ) )
! enddo
! enddo
! endif
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, Eff_pot_mu ] BEGIN_PROVIDER [double precision, Eff_pot_mu ]
implicit none implicit none
include '../constants.F' include '../constants.F'
BEGIN_DOC
! Eq.(32)
END_DOC
integer :: i integer :: i
Eff_pot_mu = 0.d0 Eff_pot_mu = 0.d0
do i=1,elec_num do i=1,elec_num
Eff_pot_mu += eff_pot_mu_elec(i) Eff_pot_mu += Eff_pot_mu_elec(i)
enddo enddo
Eff_pot_mu_min = min(Eff_pot_mu_min,Eff_pot_mu) Eff_pot_mu_min = min(Eff_pot_mu_min,Eff_pot_mu)
Eff_pot_mu_max = max(Eff_pot_mu_max,Eff_pot_mu) Eff_pot_mu_max = max(Eff_pot_mu_max,Eff_pot_mu)
@ -80,9 +116,6 @@ END_PROVIDER
BEGIN_PROVIDER [double precision, Eff_pot_mu_simple ] BEGIN_PROVIDER [double precision, Eff_pot_mu_simple ]
implicit none implicit none
BEGIN_DOC
! Eq.(32)
END_DOC
include '../constants.F' include '../constants.F'
integer :: i integer :: i
Eff_pot_mu_simple = 0.d0 Eff_pot_mu_simple = 0.d0
@ -95,34 +128,58 @@ BEGIN_PROVIDER [double precision, Eff_pot_mu_simple ]
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, eff_pot_deriv_mu_elec, (elec_num) ]
implicit none
BEGIN_DOC BEGIN_PROVIDER [double precision, Eff_pot_deriv_mu_elec, (elec_num) ]
! Eq.(33)
END_DOC BEGIN_DOC
integer :: i,j !
double precision :: rij, mu ! non-Hermitian term:
mu = mu_erf ! - grad_i(tau) . grad_i(\Phi) / \Phi
eff_pot_deriv_mu_elec = 0.d0 !
do i = 1, elec_num END_DOC
do j = 1, elec_num
if(i==j)cycle implicit none
rij = elec_dist(i,j) integer :: i, j
eff_pot_deriv_mu_elec(i) += 0.5d0 * ( derf(mu * rij) - 1.d0 ) * elec_dist_inv(j,i) & double precision :: rij, mu
* ( - elec_dist_vec_x(j,i) * psidet_grad_lapl(1,i) &
- elec_dist_vec_y(j,i) * psidet_grad_lapl(2,i) & ! mu = jast_mu_erf
- elec_dist_vec_z(j,i) * psidet_grad_lapl(3,i) ) * psidet_inv mu = mu_erf
Eff_pot_deriv_mu_elec = 0.d0
! 2body-Jastrow: (eq A4)
! - [ grad_i(tau_mu) . grad_i(\Phi) + grad_j(tau_mu) . grad_j(\Phi) ] / \Phi =
! ( erf(mu r_ij) - 1 ) / ( 2 r_ij \Phi) * [
! ( x_i - x_j ) * ( \partial_{x_i} - \partial_{x_j} ) +
! ( y_i - y_j ) * ( \partial_{y_i} - \partial_{y_j} ) +
! ( z_i - z_j ) * ( \partial_{z_i} - \partial_{z_j} ) ]
!
do i = 1, elec_num
do j = 1, elec_num
if(i==j)cycle
rij = elec_dist(i,j)
Eff_pot_deriv_mu_elec(i) += 0.5d0 * ( derf(mu * rij) - 1.d0 ) * elec_dist_inv(j,i) &
* ( - elec_dist_vec_x(j,i) * psidet_grad_lapl(1,i) &
- elec_dist_vec_y(j,i) * psidet_grad_lapl(2,i) &
- elec_dist_vec_z(j,i) * psidet_grad_lapl(3,i) ) * psidet_inv
enddo
enddo enddo
enddo
! 1-body Jastrow
if( jast_1b_type .gt. 0 ) then
do i = 1, elec_num
Eff_pot_deriv_mu_elec(i) -= ( jast_1b_grad_x(i) * psidet_grad_lapl(1,i) &
+ jast_1b_grad_y(i) * psidet_grad_lapl(2,i) &
+ jast_1b_grad_z(i) * psidet_grad_lapl(3,i) ) * psidet_inv
enddo
endif
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, three_body_mu ] BEGIN_PROVIDER [double precision, three_body_mu ]
implicit none implicit none
BEGIN_DOC
! Eq.(30)
END_DOC
integer :: i,j,k integer :: i,j,k
three_body_mu = 0.d0 three_body_mu = 0.d0
do i = 1, elec_num do i = 1, elec_num
@ -147,18 +204,36 @@ BEGIN_PROVIDER [double precision, three_body_mu ]
SOFT_TOUCH three_body_mu_min three_body_mu_max SOFT_TOUCH three_body_mu_min three_body_mu_max
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, eff_pot_deriv_mu] BEGIN_PROVIDER [double precision, Eff_pot_deriv_mu]
implicit none implicit none
BEGIN_DOC
! Eq.(33)
END_DOC
integer :: i integer :: i
eff_pot_deriv_mu = 0.d0 Eff_pot_deriv_mu = 0.d0
do i = 1, elec_num do i = 1, elec_num
eff_pot_deriv_mu += eff_pot_deriv_mu_elec(i) Eff_pot_deriv_mu += Eff_pot_deriv_mu_elec(i)
enddo enddo
eff_pot_deriv_mu_min = min(eff_pot_deriv_mu_min,eff_pot_deriv_mu) eff_pot_deriv_mu_min = min(eff_pot_deriv_mu_min,eff_pot_deriv_mu)
eff_pot_deriv_mu_max = max(eff_pot_deriv_mu_max,eff_pot_deriv_mu) eff_pot_deriv_mu_max = max(eff_pot_deriv_mu_max,eff_pot_deriv_mu)
SOFT_TOUCH eff_pot_deriv_mu_min eff_pot_deriv_mu_max SOFT_TOUCH eff_pot_deriv_mu_min eff_pot_deriv_mu_max
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ double precision, ci_dress_mu, (size_ci_dress_mu) ]
BEGIN_DOC
! Dimensions : det_num
END_DOC
implicit none
integer :: i, j, k, l
double precision :: T, dij, f, E_noJ, dE
! energy_mu = H_mu \Phi / \Phi
dE = (E_loc - energy_mu) * psi_value_inv * jast_value_inv
do k = 1, det_num
i = det_coef_matrix_rows( k)
j = det_coef_matrix_columns(k)
f = det_alpha_value(i) * det_beta_value(j)
ci_dress_mu(k) = dE * f
enddo
ci_dress_mu_min = min(ci_dress_mu_min, minval(ci_dress_mu))
ci_dress_mu_max = max(ci_dress_mu_max, maxval(ci_dress_mu))
SOFT_TOUCH ci_dress_mu_min ci_dress_mu_max
END_PROVIDER

View File

@ -2161,11 +2161,21 @@ BEGIN_PROVIDER [ double precision, psidet_lapl ]
BEGIN_DOC BEGIN_DOC
! Laplacian of the wave functionwithout Jastrow ! Laplacian of the wave functionwithout Jastrow
END_DOC END_DOC
integer :: i, j integer :: i, j
psidet_lapl = 0.d0 psidet_lapl = 0.d0
do j=1,elec_num do j=1,elec_num
psidet_lapl = psidet_lapl + psidet_grad_lapl(4,j) psidet_lapl = psidet_lapl + psidet_grad_lapl(4,j)
enddo enddo
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ double precision, E_kin_elec_psidet, (elec_num) ]
implicit none
BEGIN_DOC
! Electronic Kinetic energy of the determinantal part only: -1/2 (Lapl.Psidet)/Psidet
END_DOC
integer :: i
do i=1,elec_num
E_kin_elec_psidet(i) = -0.5d0*psidet_grad_lapl(4,i) * psidet_inv
enddo
END_PROVIDER

View File

@ -83,7 +83,10 @@ data_no_set = [\
("spindeterminants_psi_coef_matrix_rows" , "integer" , "(det_num_input)"), ("spindeterminants_psi_coef_matrix_rows" , "integer" , "(det_num_input)"),
("spindeterminants_psi_coef_matrix_columns" , "integer" , "(det_num_input)"), ("spindeterminants_psi_coef_matrix_columns" , "integer" , "(det_num_input)"),
("spindeterminants_psi_coef_matrix_values" , "double precision" , "(det_num_input,N_states)"), ("spindeterminants_psi_coef_matrix_values" , "double precision" , "(det_num_input,N_states)"),
("jastrow_jast_1b_type" , "integer" , "" ),
("jastrow_jast_1btanh_pen" , "real" , "(nucl_num)" ),
("jastrow_jast_1berf_pen" , "real" , "(nucl_num)" ),
("jastrow_jast_1bgauss_pen" , "real" , "(nucl_num)" ),
] ]