mirror of
https://github.com/LCPQ/quantum_package
synced 2025-01-05 11:00:10 +01:00
Accelerated S^2
This commit is contained in:
parent
4dbe5dcd5d
commit
b6d8531583
2
plugins/MRCC_CASSD/.gitignore
vendored
2
plugins/MRCC_CASSD/.gitignore
vendored
@ -28,5 +28,5 @@ Utils
|
|||||||
ezfio_interface.irp.f
|
ezfio_interface.irp.f
|
||||||
irpf90.make
|
irpf90.make
|
||||||
irpf90_entities
|
irpf90_entities
|
||||||
mrcc
|
mrcc_cassd
|
||||||
tags
|
tags
|
@ -24,10 +24,10 @@ Documentation
|
|||||||
.. Do not edit this section. It was auto-generated from the
|
.. Do not edit this section. It was auto-generated from the
|
||||||
.. by the `update_README.py` script.
|
.. by the `update_README.py` script.
|
||||||
|
|
||||||
`mrcc <http://github.com/LCPQ/quantum_package/tree/master/src/MRCC_CASSD/mrcc.irp.f#L1>`_
|
`mrcc <http://github.com/LCPQ/quantum_package/tree/master/src/MRCC_CASSD/mrcc_cassd.irp.f#L1>`_
|
||||||
Undocumented
|
Undocumented
|
||||||
|
|
||||||
|
|
||||||
`print_cas_coefs <http://github.com/LCPQ/quantum_package/tree/master/src/MRCC_CASSD/mrcc.irp.f#L7>`_
|
`print_cas_coefs <http://github.com/LCPQ/quantum_package/tree/master/src/MRCC_CASSD/mrcc_cassd.irp.f#L11>`_
|
||||||
Undocumented
|
Undocumented
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path = [ os.environ["QP_ROOT"]+"/EZFIO/Python" ] + sys.path
|
sys.path = [ os.environ["QP_ROOT"]+"/install/EZFIO/Python" ] + sys.path
|
||||||
from ezfio import ezfio
|
from ezfio import ezfio
|
||||||
|
|
||||||
ezfio.set_filename(sys.argv[1])
|
ezfio.set_filename(sys.argv[1])
|
||||||
|
@ -217,7 +217,7 @@ Documentation
|
|||||||
det_coef
|
det_coef
|
||||||
|
|
||||||
|
|
||||||
`det_connections <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1139>`_
|
`det_connections <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1138>`_
|
||||||
Build connection proxy between determinants
|
Build connection proxy between determinants
|
||||||
|
|
||||||
|
|
||||||
@ -391,7 +391,11 @@ Documentation
|
|||||||
Returns <S^2>
|
Returns <S^2>
|
||||||
|
|
||||||
|
|
||||||
`get_s2_u0 <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/s2.irp.f#L82>`_
|
`get_s2_u0 <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/s2.irp.f#L109>`_
|
||||||
|
Undocumented
|
||||||
|
|
||||||
|
|
||||||
|
`get_s2_u0_old <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/s2.irp.f#L82>`_
|
||||||
Undocumented
|
Undocumented
|
||||||
|
|
||||||
|
|
||||||
@ -508,7 +512,7 @@ Documentation
|
|||||||
Energy of the reference bitmask used in Slater rules
|
Energy of the reference bitmask used in Slater rules
|
||||||
|
|
||||||
|
|
||||||
`n_con_int <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1131>`_
|
`n_con_int <http://github.com/LCPQ/quantum_package/tree/master/src/Determinants/slater_rules.irp.f#L1130>`_
|
||||||
Number of integers to represent the connections between determinants
|
Number of integers to represent the connections between determinants
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ BEGIN_PROVIDER [ double precision, s2_values, (N_states) ]
|
|||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
||||||
subroutine get_s2_u0(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2)
|
subroutine get_s2_u0_old(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2)
|
||||||
implicit none
|
implicit none
|
||||||
use bitmasks
|
use bitmasks
|
||||||
integer(bit_kind), intent(in) :: psi_keys_tmp(N_int,2,nmax)
|
integer(bit_kind), intent(in) :: psi_keys_tmp(N_int,2,nmax)
|
||||||
@ -89,32 +89,60 @@ subroutine get_s2_u0(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2)
|
|||||||
integer :: i,j,l
|
integer :: i,j,l
|
||||||
double precision :: s2_tmp
|
double precision :: s2_tmp
|
||||||
s2 = 0.d0
|
s2 = 0.d0
|
||||||
!print*,'IN get_s2_u0'
|
|
||||||
!print*,'n,nmax = ',n,nmax
|
|
||||||
double precision :: accu
|
|
||||||
accu = 0.d0
|
|
||||||
do i = 1,n
|
|
||||||
accu += psi_coefs_tmp(i) * psi_coefs_tmp(i)
|
|
||||||
! print*,'psi_coef = ',psi_coefs_tmp(i)
|
|
||||||
enddo
|
|
||||||
!print*,'accu = ',accu
|
|
||||||
!print*,''
|
|
||||||
!$OMP PARALLEL DO DEFAULT(NONE) &
|
!$OMP PARALLEL DO DEFAULT(NONE) &
|
||||||
!$OMP PRIVATE(i,j,s2_tmp) SHARED(n,psi_coefs_tmp,psi_keys_tmp,N_int) REDUCTION(+:s2) SCHEDULE(dynamic)
|
!$OMP PRIVATE(i,j,s2_tmp) SHARED(n,psi_coefs_tmp,psi_keys_tmp,N_int) REDUCTION(+:s2) SCHEDULE(dynamic)
|
||||||
do i=1,n
|
do i=1,n
|
||||||
do j=i+1,n
|
do j=i+1,n
|
||||||
call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,j),s2_tmp,N_int)
|
call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,j),s2_tmp,N_int)
|
||||||
s2 += (psi_coefs_tmp(i)+psi_coefs_tmp(i))*psi_coefs_tmp(j)*s2_tmp
|
s2 += psi_coefs_tmp(i)*psi_coefs_tmp(j)*s2_tmp
|
||||||
! s2 = s2 + 2.d0 * psi_coefs_tmp(i)*psi_coefs_tmp(j)*s2_tmp
|
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
!$OMP END PARALLEL DO
|
!$OMP END PARALLEL DO
|
||||||
|
s2 = s2+s2
|
||||||
do i=1,n
|
do i=1,n
|
||||||
call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,i),s2_tmp,N_int)
|
call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,i),s2_tmp,N_int)
|
||||||
s2 += psi_coefs_tmp(i)*psi_coefs_tmp(i)*s2_tmp
|
s2 += psi_coefs_tmp(i)*psi_coefs_tmp(i)*s2_tmp
|
||||||
enddo
|
enddo
|
||||||
s2 += S_z2_Sz
|
s2 += S_z2_Sz
|
||||||
!print*,'s2 = ',s2
|
end
|
||||||
!print*,''
|
|
||||||
|
subroutine get_s2_u0(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2)
|
||||||
|
implicit none
|
||||||
|
use bitmasks
|
||||||
|
integer(bit_kind), intent(in) :: psi_keys_tmp(N_int,2,nmax)
|
||||||
|
integer, intent(in) :: n,nmax
|
||||||
|
double precision, intent(in) :: psi_coefs_tmp(nmax)
|
||||||
|
double precision, intent(out) :: s2
|
||||||
|
double precision :: s2_tmp
|
||||||
|
integer :: i,j,l,jj
|
||||||
|
integer, allocatable :: idx(:)
|
||||||
|
s2 = 0.d0
|
||||||
|
!$OMP PARALLEL DEFAULT(NONE) &
|
||||||
|
!$OMP PRIVATE(i,j,s2_tmp,idx) &
|
||||||
|
!$OMP SHARED(n,psi_coefs_tmp,psi_keys_tmp,N_int,davidson_threshold)&
|
||||||
|
!$OMP REDUCTION(+:s2)
|
||||||
|
allocate(idx(0:n))
|
||||||
|
!$OMP DO SCHEDULE(dynamic)
|
||||||
|
do i=1,n
|
||||||
|
idx(0) = i
|
||||||
|
call filter_connected_davidson(psi_keys_tmp,psi_keys_tmp(1,1,i),N_int,i-1,idx)
|
||||||
|
do jj=1,idx(0)
|
||||||
|
j = idx(jj)
|
||||||
|
if ( dabs(psi_coefs_tmp(j)) + dabs(psi_coefs_tmp(i)) &
|
||||||
|
> davidson_threshold ) then
|
||||||
|
call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,j),s2_tmp,N_int)
|
||||||
|
s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(j)*s2_tmp
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
!$OMP END DO
|
||||||
|
deallocate(idx)
|
||||||
|
!$OMP END PARALLEL
|
||||||
|
s2 = s2+s2
|
||||||
|
do i=1,n
|
||||||
|
call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,i),s2_tmp,N_int)
|
||||||
|
s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(i)*s2_tmp
|
||||||
|
enddo
|
||||||
|
s2 = s2 + S_z2_Sz
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1092,10 +1092,9 @@ subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,Nint)
|
|||||||
ASSERT (Nint == N_int)
|
ASSERT (Nint == N_int)
|
||||||
ASSERT (n>0)
|
ASSERT (n>0)
|
||||||
PROVIDE ref_bitmask_energy
|
PROVIDE ref_bitmask_energy
|
||||||
integer, parameter :: block_size = 157
|
|
||||||
!$OMP PARALLEL DEFAULT(NONE) &
|
!$OMP PARALLEL DEFAULT(NONE) &
|
||||||
!$OMP PRIVATE(i,hij,j,k,idx,jj,vt) &
|
!$OMP PRIVATE(i,hij,j,k,idx,jj,vt) &
|
||||||
!$OMP SHARED(n,H_jj,u_0,keys_tmp,Nint,v_0)
|
!$OMP SHARED(n,H_jj,u_0,keys_tmp,Nint,v_0,davidson_threshold)
|
||||||
!$OMP DO SCHEDULE(static)
|
!$OMP DO SCHEDULE(static)
|
||||||
do i=1,n
|
do i=1,n
|
||||||
v_0(i) = H_jj(i) * u_0(i)
|
v_0(i) = H_jj(i) * u_0(i)
|
||||||
@ -1109,7 +1108,7 @@ subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,Nint)
|
|||||||
call filter_connected_davidson(keys_tmp,keys_tmp(1,1,i),Nint,i-1,idx)
|
call filter_connected_davidson(keys_tmp,keys_tmp(1,1,i),Nint,i-1,idx)
|
||||||
do jj=1,idx(0)
|
do jj=1,idx(0)
|
||||||
j = idx(jj)
|
j = idx(jj)
|
||||||
if ( (dabs(u_0(j)) > 1.d-7).or.((dabs(u_0(i)) > 1.d-7)) ) then
|
if ( dabs(u_0(j)) + dabs(u_0(i)) > davidson_threshold ) then
|
||||||
call i_H_j(keys_tmp(1,1,j),keys_tmp(1,1,i),Nint,hij)
|
call i_H_j(keys_tmp(1,1,j),keys_tmp(1,1,i),Nint,hij)
|
||||||
vt (i) = vt (i) + hij*u_0(j)
|
vt (i) = vt (i) + hij*u_0(j)
|
||||||
vt (j) = vt (j) + hij*u_0(i)
|
vt (j) = vt (j) + hij*u_0(i)
|
||||||
|
@ -90,12 +90,12 @@ Documentation
|
|||||||
Output file for MOGuess
|
Output file for MOGuess
|
||||||
|
|
||||||
|
|
||||||
`output_mrcc <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files/output.irp.f_shell_40#L281>`_
|
`output_mrcc_cassd <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files/output.irp.f_shell_40#L281>`_
|
||||||
Output file for MRCC
|
Output file for MRCC_CASSD
|
||||||
|
|
||||||
|
|
||||||
`output_mrcc_general <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files/output.irp.f_shell_40#L301>`_
|
`output_mrcc_utils <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files/output.irp.f_shell_40#L301>`_
|
||||||
Output file for MRCC_general
|
Output file for MRCC_Utils
|
||||||
|
|
||||||
|
|
||||||
`output_nuclei <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files/output.irp.f_shell_40#L321>`_
|
`output_nuclei <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files/output.irp.f_shell_40#L321>`_
|
||||||
|
Loading…
Reference in New Issue
Block a user