2023-04-21 20:50:00 +02:00
|
|
|
|
|
|
|
! ---
|
|
|
|
|
2024-01-15 12:02:38 +01:00
|
|
|
BEGIN_PROVIDER [double precision, grad1_u12_num, (n_points_extra_final_grid, n_points_final_grid, 3)]
|
|
|
|
&BEGIN_PROVIDER [double precision, grad1_u12_squared_num, (n_points_extra_final_grid, n_points_final_grid)]
|
2023-04-21 20:50:00 +02:00
|
|
|
|
|
|
|
BEGIN_DOC
|
|
|
|
!
|
|
|
|
!
|
2024-01-15 12:02:38 +01:00
|
|
|
! grad_1 u(r1,r2)
|
|
|
|
! numerical integration over r1 & r2
|
2023-04-21 20:50:00 +02:00
|
|
|
!
|
|
|
|
END_DOC
|
|
|
|
|
|
|
|
implicit none
|
2023-05-07 12:44:59 +02:00
|
|
|
integer :: ipoint, jpoint
|
|
|
|
double precision :: r1(3), r2(3)
|
2024-01-15 12:02:38 +01:00
|
|
|
double precision :: v_r1, v_r2, u2b_r12
|
|
|
|
double precision :: grad1_v(3), grad1_u2b(3)
|
2023-05-07 12:44:59 +02:00
|
|
|
double precision :: dx, dy, dz
|
2023-09-15 11:30:10 +02:00
|
|
|
double precision :: time0, time1
|
2024-01-15 12:02:38 +01:00
|
|
|
double precision, external :: j12_mu, env_nucl
|
2023-04-21 20:50:00 +02:00
|
|
|
|
2024-01-15 12:02:38 +01:00
|
|
|
PROVIDE env_type
|
2023-04-21 20:50:00 +02:00
|
|
|
PROVIDE final_grid_points_extra
|
|
|
|
|
2023-09-15 11:30:10 +02:00
|
|
|
print*, ' providing grad1_u12_num & grad1_u12_squared_num ...'
|
|
|
|
call wall_time(time0)
|
|
|
|
|
2023-04-21 20:50:00 +02:00
|
|
|
grad1_u12_num = 0.d0
|
|
|
|
grad1_u12_squared_num = 0.d0
|
|
|
|
|
2024-01-15 12:02:38 +01:00
|
|
|
if( ((j2e_type .eq. "rs-dft") .and. (env_type .eq. "none")) .or. &
|
|
|
|
(j2e_type .eq. "rs-dft-murho") ) then
|
2023-04-21 20:50:00 +02:00
|
|
|
|
2023-05-07 12:44:59 +02:00
|
|
|
!$OMP PARALLEL &
|
|
|
|
!$OMP DEFAULT (NONE) &
|
2024-01-15 12:02:38 +01:00
|
|
|
!$OMP PRIVATE (ipoint, jpoint, r1, r2, v_r1, v_r2, u2b_r12, grad1_v, grad1_u2b, dx, dy, dz) &
|
2023-05-07 12:44:59 +02:00
|
|
|
!$OMP SHARED (n_points_final_grid, n_points_extra_final_grid, final_grid_points, &
|
|
|
|
!$OMP final_grid_points_extra, grad1_u12_num, grad1_u12_squared_num)
|
|
|
|
!$OMP DO SCHEDULE (static)
|
|
|
|
do ipoint = 1, n_points_final_grid ! r1
|
|
|
|
|
|
|
|
r1(1) = final_grid_points(1,ipoint)
|
|
|
|
r1(2) = final_grid_points(2,ipoint)
|
|
|
|
r1(3) = final_grid_points(3,ipoint)
|
|
|
|
|
2023-09-22 16:26:58 +02:00
|
|
|
do jpoint = 1, n_points_extra_final_grid ! r2
|
2023-05-07 12:44:59 +02:00
|
|
|
|
|
|
|
r2(1) = final_grid_points_extra(1,jpoint)
|
|
|
|
r2(2) = final_grid_points_extra(2,jpoint)
|
|
|
|
r2(3) = final_grid_points_extra(3,jpoint)
|
|
|
|
|
2023-10-18 23:53:47 +02:00
|
|
|
call grad1_j12_mu(r2, r1, grad1_u2b)
|
2023-05-07 12:44:59 +02:00
|
|
|
|
|
|
|
dx = grad1_u2b(1)
|
|
|
|
dy = grad1_u2b(2)
|
|
|
|
dz = grad1_u2b(3)
|
|
|
|
|
2023-09-22 16:26:58 +02:00
|
|
|
grad1_u12_num(jpoint,ipoint,1) = dx
|
|
|
|
grad1_u12_num(jpoint,ipoint,2) = dy
|
|
|
|
grad1_u12_num(jpoint,ipoint,3) = dz
|
2023-05-07 12:44:59 +02:00
|
|
|
|
|
|
|
grad1_u12_squared_num(jpoint,ipoint) = dx*dx + dy*dy + dz*dz
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
!$OMP END DO
|
|
|
|
!$OMP END PARALLEL
|
|
|
|
|
2024-01-15 12:02:38 +01:00
|
|
|
elseif((j2e_type .eq. "rs-dft") .and. (env_type .ne. "none")) then
|
2023-04-21 20:50:00 +02:00
|
|
|
|
2023-06-28 18:57:41 +02:00
|
|
|
PROVIDE final_grid_points
|
|
|
|
|
2024-01-15 12:02:38 +01:00
|
|
|
!$OMP PARALLEL &
|
|
|
|
!$OMP DEFAULT (NONE) &
|
|
|
|
!$OMP PRIVATE (ipoint, jpoint, r1, r2, v_r1, v_r2, u2b_r12, grad1_v, grad1_u2b, dx, dy, dz) &
|
|
|
|
!$OMP SHARED (n_points_final_grid, n_points_extra_final_grid, final_grid_points, &
|
2023-04-21 22:22:25 +02:00
|
|
|
!$OMP final_grid_points_extra, grad1_u12_num, grad1_u12_squared_num)
|
|
|
|
!$OMP DO SCHEDULE (static)
|
2023-04-21 20:50:00 +02:00
|
|
|
do ipoint = 1, n_points_final_grid ! r1
|
|
|
|
|
|
|
|
r1(1) = final_grid_points(1,ipoint)
|
|
|
|
r1(2) = final_grid_points(2,ipoint)
|
|
|
|
r1(3) = final_grid_points(3,ipoint)
|
|
|
|
|
2024-01-15 12:02:38 +01:00
|
|
|
v_r1 = env_nucl(r1)
|
|
|
|
call grad1_env_nucl(r1, grad1_v)
|
2023-04-21 20:50:00 +02:00
|
|
|
|
2023-09-22 16:26:58 +02:00
|
|
|
do jpoint = 1, n_points_extra_final_grid ! r2
|
2023-04-21 20:50:00 +02:00
|
|
|
|
|
|
|
r2(1) = final_grid_points_extra(1,jpoint)
|
|
|
|
r2(2) = final_grid_points_extra(2,jpoint)
|
|
|
|
r2(3) = final_grid_points_extra(3,jpoint)
|
|
|
|
|
2024-01-15 12:02:38 +01:00
|
|
|
v_r2 = env_nucl(r2)
|
2023-04-21 20:50:00 +02:00
|
|
|
u2b_r12 = j12_mu(r1, r2)
|
2023-10-18 23:53:47 +02:00
|
|
|
call grad1_j12_mu(r2, r1, grad1_u2b)
|
2023-04-21 20:50:00 +02:00
|
|
|
|
2024-01-15 12:02:38 +01:00
|
|
|
dx = (grad1_u2b(1) * v_r1 + u2b_r12 * grad1_v(1)) * v_r2
|
|
|
|
dy = (grad1_u2b(2) * v_r1 + u2b_r12 * grad1_v(2)) * v_r2
|
|
|
|
dz = (grad1_u2b(3) * v_r1 + u2b_r12 * grad1_v(3)) * v_r2
|
2023-04-21 20:50:00 +02:00
|
|
|
|
2023-09-22 16:26:58 +02:00
|
|
|
grad1_u12_num(jpoint,ipoint,1) = dx
|
|
|
|
grad1_u12_num(jpoint,ipoint,2) = dy
|
|
|
|
grad1_u12_num(jpoint,ipoint,3) = dz
|
2023-04-21 22:22:25 +02:00
|
|
|
|
|
|
|
grad1_u12_squared_num(jpoint,ipoint) = dx*dx + dy*dy + dz*dz
|
2023-04-21 20:50:00 +02:00
|
|
|
enddo
|
|
|
|
enddo
|
2023-04-21 22:22:25 +02:00
|
|
|
!$OMP END DO
|
|
|
|
!$OMP END PARALLEL
|
2023-04-21 20:50:00 +02:00
|
|
|
|
2024-01-15 12:02:38 +01:00
|
|
|
elseif(j2e_type .eq. "champ") then
|
2023-09-15 11:30:10 +02:00
|
|
|
|
|
|
|
double precision :: f
|
|
|
|
f = 1.d0 / dble(elec_num - 1)
|
|
|
|
|
2023-09-27 11:21:47 +02:00
|
|
|
integer*8 :: n_points, n_points_max, k
|
|
|
|
integer :: ipoint_block, ipoint_end
|
|
|
|
|
|
|
|
n_points_max = n_points_extra_final_grid * n_points_final_grid
|
|
|
|
n_points = 100_8*n_points_extra_final_grid
|
2023-09-22 16:26:58 +02:00
|
|
|
|
2023-09-15 11:30:10 +02:00
|
|
|
double precision, allocatable :: rij(:,:,:)
|
2023-09-22 16:26:58 +02:00
|
|
|
allocate( rij(3, 2, n_points) )
|
2023-09-15 11:30:10 +02:00
|
|
|
|
|
|
|
use qmckl
|
|
|
|
integer(qmckl_exit_code) :: rc
|
|
|
|
|
|
|
|
double precision, allocatable :: gl(:,:,:)
|
|
|
|
|
2023-09-27 11:21:47 +02:00
|
|
|
allocate( gl(2,4,n_points) )
|
2023-09-15 11:30:10 +02:00
|
|
|
|
2023-09-27 11:21:47 +02:00
|
|
|
do ipoint_block = 1, n_points_final_grid, 100 ! r1
|
2023-10-17 00:28:47 +02:00
|
|
|
ipoint_end = min(n_points_final_grid, ipoint_block+99)
|
2023-09-15 11:30:10 +02:00
|
|
|
|
2023-09-27 11:21:47 +02:00
|
|
|
k=0
|
|
|
|
do ipoint = ipoint_block, ipoint_end
|
|
|
|
do jpoint = 1, n_points_extra_final_grid ! r2
|
|
|
|
k=k+1
|
|
|
|
rij(1:3, 1, k) = final_grid_points (1:3, ipoint)
|
|
|
|
rij(1:3, 2, k) = final_grid_points_extra(1:3, jpoint)
|
|
|
|
end do
|
|
|
|
enddo
|
2023-09-15 11:30:10 +02:00
|
|
|
|
2023-09-27 11:21:47 +02:00
|
|
|
rc = qmckl_set_electron_coord(qmckl_ctx_jastrow, 'N', n_points, rij, n_points*6_8)
|
2023-09-15 11:30:10 +02:00
|
|
|
if (rc /= QMCKL_SUCCESS) then
|
|
|
|
print *, irp_here, 'qmckl error in set_electron_coord'
|
2023-09-27 11:21:47 +02:00
|
|
|
rc = qmckl_check(qmckl_ctx_jastrow, rc)
|
2023-09-15 11:30:10 +02:00
|
|
|
stop -1
|
|
|
|
endif
|
|
|
|
|
|
|
|
! ---
|
|
|
|
! e-e term
|
|
|
|
|
2023-09-27 11:21:47 +02:00
|
|
|
rc = qmckl_get_jastrow_champ_factor_ee_gl(qmckl_ctx_jastrow, gl, 8_8*n_points)
|
2023-09-15 11:30:10 +02:00
|
|
|
if (rc /= QMCKL_SUCCESS) then
|
2023-09-27 11:21:47 +02:00
|
|
|
print *, irp_here, ' qmckl error in fact_ee_gl'
|
|
|
|
rc = qmckl_check(qmckl_ctx_jastrow, rc)
|
2023-09-15 11:30:10 +02:00
|
|
|
stop -1
|
|
|
|
endif
|
|
|
|
|
2023-09-27 11:21:47 +02:00
|
|
|
k=0
|
|
|
|
do ipoint = ipoint_block, ipoint_end
|
|
|
|
do jpoint = 1, n_points_extra_final_grid ! r2
|
|
|
|
k=k+1
|
|
|
|
grad1_u12_num(jpoint,ipoint,1) = gl(1,1,k)
|
|
|
|
grad1_u12_num(jpoint,ipoint,2) = gl(1,2,k)
|
|
|
|
grad1_u12_num(jpoint,ipoint,3) = gl(1,3,k)
|
|
|
|
enddo
|
2023-09-15 11:30:10 +02:00
|
|
|
enddo
|
|
|
|
|
2023-09-27 11:21:47 +02:00
|
|
|
! ---
|
|
|
|
! e-e-n term
|
|
|
|
|
|
|
|
! rc = qmckl_get_jastrow_champ_factor_een_gl(qmckl_ctx_jastrow, gl, 8_8*n_points)
|
|
|
|
! if (rc /= QMCKL_SUCCESS) then
|
|
|
|
! print *, irp_here, 'qmckl error in fact_een_gl'
|
|
|
|
! rc = qmckl_check(qmckl_ctx_jastrow, rc)
|
|
|
|
! stop -1
|
|
|
|
! endif
|
2023-09-15 11:30:10 +02:00
|
|
|
!
|
2023-09-27 11:21:47 +02:00
|
|
|
! k=0
|
|
|
|
! do ipoint = 1, n_points_final_grid ! r1
|
|
|
|
! do jpoint = 1, n_points_extra_final_grid ! r2
|
|
|
|
! k=k+1
|
|
|
|
! grad1_u12_num(jpoint,ipoint,1) = grad1_u12_num(jpoint,ipoint,1) + gl(1,1,k)
|
|
|
|
! grad1_u12_num(jpoint,ipoint,2) = grad1_u12_num(jpoint,ipoint,2) + gl(1,2,k)
|
|
|
|
! grad1_u12_num(jpoint,ipoint,3) = grad1_u12_num(jpoint,ipoint,3) + gl(1,3,k)
|
|
|
|
! enddo
|
|
|
|
! enddo
|
2023-09-15 11:30:10 +02:00
|
|
|
|
|
|
|
! ---
|
|
|
|
! e-n term
|
|
|
|
|
2023-09-27 11:21:47 +02:00
|
|
|
rc = qmckl_get_jastrow_champ_factor_en_gl(qmckl_ctx_jastrow, gl, 8_8*n_points)
|
2023-09-15 11:30:10 +02:00
|
|
|
if (rc /= QMCKL_SUCCESS) then
|
|
|
|
print *, irp_here, 'qmckl error in fact_en_gl'
|
2023-09-27 11:21:47 +02:00
|
|
|
rc = qmckl_check(qmckl_ctx_jastrow, rc)
|
2023-09-15 11:30:10 +02:00
|
|
|
stop -1
|
|
|
|
endif
|
|
|
|
|
2023-09-27 11:21:47 +02:00
|
|
|
k=0
|
|
|
|
do ipoint = ipoint_block, ipoint_end ! r1
|
|
|
|
do jpoint = 1, n_points_extra_final_grid ! r2
|
|
|
|
k = k+1
|
|
|
|
grad1_u12_num(jpoint,ipoint,1) = grad1_u12_num(jpoint,ipoint,1) + f * gl(1,1,k)
|
|
|
|
grad1_u12_num(jpoint,ipoint,2) = grad1_u12_num(jpoint,ipoint,2) + f * gl(1,2,k)
|
|
|
|
grad1_u12_num(jpoint,ipoint,3) = grad1_u12_num(jpoint,ipoint,3) + f * gl(1,3,k)
|
|
|
|
|
|
|
|
dx = grad1_u12_num(jpoint,ipoint,1)
|
|
|
|
dy = grad1_u12_num(jpoint,ipoint,2)
|
|
|
|
dz = grad1_u12_num(jpoint,ipoint,3)
|
|
|
|
grad1_u12_squared_num(jpoint,ipoint) = dx*dx + dy*dy + dz*dz
|
|
|
|
enddo
|
2023-09-15 11:30:10 +02:00
|
|
|
enddo
|
|
|
|
|
2023-09-27 11:21:47 +02:00
|
|
|
enddo !ipoint_block
|
|
|
|
|
2023-09-15 11:30:10 +02:00
|
|
|
deallocate(gl, rij)
|
|
|
|
|
2023-09-04 22:27:18 +02:00
|
|
|
else
|
2023-05-04 01:42:06 +02:00
|
|
|
|
2024-01-15 12:02:38 +01:00
|
|
|
print *, ' Error in grad1_u12_num & grad1_u12_squared_num: Unknown Jastrow'
|
2023-09-04 22:27:18 +02:00
|
|
|
stop
|
2023-05-04 01:42:06 +02:00
|
|
|
|
2024-01-15 12:02:38 +01:00
|
|
|
endif ! j2e_type
|
2023-05-04 01:42:06 +02:00
|
|
|
|
2023-09-15 11:30:10 +02:00
|
|
|
call wall_time(time1)
|
2024-01-15 12:02:38 +01:00
|
|
|
print*, ' Wall time for grad1_u12_num & grad1_u12_squared_num (min) = ', (time1-time0)/60.d0
|
2023-09-15 11:30:10 +02:00
|
|
|
|
2023-09-04 22:27:18 +02:00
|
|
|
END_PROVIDER
|
2023-05-04 01:42:06 +02:00
|
|
|
|
2023-09-04 22:27:18 +02:00
|
|
|
! ---
|
2023-05-04 01:42:06 +02:00
|
|
|
|