mirror of
https://gitlab.com/scemama/qmcchem.git
synced 2025-01-03 01:55:39 +01:00
SRMC acceleration
This commit is contained in:
parent
97c663e520
commit
0bb99ed8db
@ -84,13 +84,8 @@ subroutine brownian_step(p,q,accepted,delta_x)
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: xdiff_y
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: xdiff_z
|
||||
double precision :: gauss
|
||||
! integer :: k
|
||||
! k=0
|
||||
do l=1,3
|
||||
do i=1,elec_num
|
||||
!k=k+1
|
||||
!double precision :: halton_gauss
|
||||
!xbrown(i,l) = halton_gauss(k)*time_step_sq
|
||||
xbrown(i,l) = gauss()*time_step_sq
|
||||
enddo
|
||||
enddo
|
||||
|
@ -49,12 +49,18 @@ END_SHELL
|
||||
double precision :: psi_value_save(walk_num)
|
||||
double precision :: psi_value_save_tmp(walk_num)
|
||||
double precision :: srmc_weight(walk_num)
|
||||
double precision, allocatable :: psi_grad_psi_inv_save(:,:,:)
|
||||
double precision, allocatable :: psi_grad_psi_inv_save_tmp(:,:,:)
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: psi_grad_psi_inv_save
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: psi_grad_psi_inv_save_tmp
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: E_loc_save
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: E_loc_save_tmp
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: psi_value_save
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: psi_value_save_tmp
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: srmc_weight
|
||||
allocate ( elec_coord_tmp(mod_align(elec_num+1),3,walk_num) )
|
||||
allocate ( psi_grad_psi_inv_save(elec_num_8,3,walk_num) , &
|
||||
psi_grad_psi_inv_save_tmp(elec_num_8,3,walk_num) , &
|
||||
elec_coord_tmp(mod_align(elec_num+1),3,walk_num) )
|
||||
psi_value_save = 0.d0
|
||||
psi_value_save_tmp = 0.d0
|
||||
srmc_weight = 1.d0
|
||||
@ -98,19 +104,37 @@ END_SHELL
|
||||
|
||||
thr = 2.d0/time_step_sq
|
||||
|
||||
logical :: first_loop
|
||||
first_loop = .True.
|
||||
|
||||
do while (loop)
|
||||
|
||||
! Every walker makes a step
|
||||
do i_walk=1,walk_num
|
||||
|
||||
if (.not.first_loop) then
|
||||
integer :: i,j,l
|
||||
do l=1,3
|
||||
do i=1,elec_num+1
|
||||
elec_coord(i,l) = elec_coord_full(i,l,i_walk)
|
||||
enddo
|
||||
do i=1,elec_num
|
||||
psi_grad_psi_inv_x(i) = psi_grad_psi_inv_save(i,1,i_walk)
|
||||
psi_grad_psi_inv_y(i) = psi_grad_psi_inv_save(i,2,i_walk)
|
||||
psi_grad_psi_inv_z(i) = psi_grad_psi_inv_save(i,3,i_walk)
|
||||
enddo
|
||||
TOUCH elec_coord
|
||||
|
||||
psi_value = psi_value_save(i_walk)
|
||||
E_loc = E_loc_save(i_walk)
|
||||
enddo
|
||||
SOFT_TOUCH elec_coord psi_grad_psi_inv_x psi_grad_psi_inv_y psi_grad_psi_inv_z psi_value E_loc
|
||||
else
|
||||
do l=1,3
|
||||
do i=1,elec_num+1
|
||||
elec_coord(i,l) = elec_coord_full(i,l,i_walk)
|
||||
enddo
|
||||
enddo
|
||||
SOFT_TOUCH elec_coord
|
||||
endif
|
||||
|
||||
double precision :: p,q
|
||||
real :: delta_x
|
||||
@ -126,10 +150,6 @@ END_SHELL
|
||||
else
|
||||
srmc_weight(i_walk) = dexp(-dtime_step*delta)
|
||||
endif
|
||||
else
|
||||
srmc_weight(i_walk) = 0.d0
|
||||
endif
|
||||
|
||||
elec_coord(elec_num+1,1) += p*time_step
|
||||
elec_coord(elec_num+1,2) = E_loc
|
||||
elec_coord(elec_num+1,3) = srmc_weight(i_walk)
|
||||
@ -138,6 +158,11 @@ END_SHELL
|
||||
elec_coord_full(i,l,i_walk) = elec_coord(i,l)
|
||||
enddo
|
||||
enddo
|
||||
do i=1,elec_num
|
||||
psi_grad_psi_inv_save(i,1,i_walk) = psi_grad_psi_inv_x(i)
|
||||
psi_grad_psi_inv_save(i,2,i_walk) = psi_grad_psi_inv_y(i)
|
||||
psi_grad_psi_inv_save(i,3,i_walk) = psi_grad_psi_inv_z(i)
|
||||
enddo
|
||||
|
||||
psi_value_save(i_walk) = psi_value
|
||||
E_loc_save(i_walk) = E_loc
|
||||
@ -178,6 +203,11 @@ END_SHELL
|
||||
|
||||
block_weight += pop_weight_mult * srmc_weight(i_walk)
|
||||
|
||||
else
|
||||
srmc_weight(i_walk) = 0.d0
|
||||
endif
|
||||
|
||||
|
||||
enddo
|
||||
|
||||
! Move to the next projection step
|
||||
@ -220,6 +250,9 @@ END_SHELL
|
||||
do i=1,elec_num+1
|
||||
elec_coord_tmp(i,l,k) = elec_coord_full(i,l,k)
|
||||
enddo
|
||||
do i=1,elec_num
|
||||
psi_grad_psi_inv_save_tmp(i,l,k) = psi_grad_psi_inv_save(i,l,k)
|
||||
enddo
|
||||
enddo
|
||||
psi_value_save_tmp(k) = psi_value_save(k)
|
||||
E_loc_save_tmp(k) = E_loc_save(k)
|
||||
@ -232,6 +265,9 @@ END_SHELL
|
||||
do i=1,elec_num+1
|
||||
elec_coord_full(i,l,k) = elec_coord_tmp(i,l,ipm)
|
||||
enddo
|
||||
do i=1,elec_num
|
||||
psi_grad_psi_inv_save(i,l,k) = psi_grad_psi_inv_save_tmp(i,l,ipm)
|
||||
enddo
|
||||
enddo
|
||||
psi_value_save(k) = psi_value_save_tmp(ipm)
|
||||
E_loc_save(k) = E_loc_save_tmp(ipm)
|
||||
@ -249,7 +285,9 @@ END_SHELL
|
||||
cpu2 = cpu1
|
||||
endif
|
||||
|
||||
SOFT_TOUCH elec_coord_full psi_value psi_grad_psi_inv_x psi_grad_psi_inv_y psi_grad_psi_inv_z elec_coord pop_weight_mult
|
||||
SOFT_TOUCH elec_coord_full pop_weight_mult
|
||||
|
||||
first_loop = .False.
|
||||
|
||||
enddo
|
||||
|
||||
@ -269,7 +307,7 @@ for p in properties:
|
||||
print t.replace("$X",p[1])
|
||||
END_SHELL
|
||||
|
||||
deallocate ( elec_coord_tmp )
|
||||
deallocate ( elec_coord_tmp, psi_grad_psi_inv_save, psi_grad_psi_inv_save_tmp )
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user