10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-05 10:55:59 +02:00

Added key -> i,j,k,l function in maps

This commit is contained in:
Anthony Scemama 2014-09-19 11:32:45 +02:00
parent ef46f87bc6
commit 1316735589
4 changed files with 678 additions and 598 deletions

View File

@ -19,11 +19,13 @@ END_PROVIDER
BEGIN_PROVIDER [ integer, ao_power, (ao_num_align,3) ]
&BEGIN_PROVIDER [ double precision, ao_expo, (ao_num_align,ao_prim_num_max) ]
&BEGIN_PROVIDER [ double precision, ao_coef, (ao_num_align,ao_prim_num_max) ]
&BEGIN_PROVIDER [ integer, ao_l, (ao_num) ]
implicit none
BEGIN_DOC
! Coefficients, exponents and powers of x,y and z
! ao_coef(i,j) = coefficient of the jth primitive on the ith ao
! ao_l = l value of the AO: a+b+c in x^a y^b z^c
END_DOC
PROVIDE ezfio_filename
@ -91,8 +93,13 @@ END_PROVIDER
ao_coef(i,j) = d(j,2)
enddo
enddo
do i=1,ao_num
ao_l(i) = ao_power(i,1) + ao_power(i,2) + ao_power(i,3)
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_coef_transp, (ao_prim_num_max_align,ao_num) ]
&BEGIN_PROVIDER [ double precision, ao_expo_transp, (ao_prim_num_max_align,ao_num) ]
implicit none

View File

@ -139,8 +139,14 @@ double precision function ao_bielec_integral(i,j,k,l)
end
integer function ao_l4(i,j,k,l)
implicit none
BEGIN_DOC
! Computes the product of l values of i,j,k,and l
END_DOC
integer, intent(in) :: i,j,k,l
ao_l4 = ao_l(i)*ao_l(j)*ao_l(k)*ao_l(l)
end

View File

@ -30,6 +30,26 @@ subroutine bielec_integrals_index(i,j,k,l,i1)
i1 = i1+ishft(i2*i2-i2,-1)
end
subroutine bielec_integrals_index_reverse(i,j,k,l,i1)
implicit none
integer, intent(out) :: i,j,k,l
integer*8, intent(in) :: i1
integer*8 :: i2,i3
real :: x
x = 0.5*(sqrt(8.*real(i1)+1.)-1.)
i2 = ceiling(x)
i3 = i1 - ishft(i2*i2-i2,-1)
l = 0.5*(sqrt(8.*real(i2)+1.)-1.)
l = ceiling(x)
j = i2 - ishft(l*l-l,-1)
x = 0.5*(sqrt(8.*real(i3)+1.)-1.)
k = ceiling(x)
i = i3 - ishft(k*k-k,-1)
end
double precision function get_ao_bielec_integral(i,j,k,l,map)
use map_module
implicit none

View File

@ -1,5 +1,17 @@
module map_module
! A map is an array of maps (cache_maps)
! A cache map is an array of keys and values sorted by keys
! A cache map has its own OpenMP lock
! To access a (key,value) pair in the map, the
! index of the cache_map in the map array is obtained
! by removing the first 15 bits of the key.
! The key in the cache_map is composed of the first
! 15 bits of the key. Therefore, it can be stored
! as integer*2 and is found by applying the map_mask
! to the initial key. The element are found in the
! cache_map using a binary search
use omp_lib
integer, parameter :: integral_kind = 8
@ -678,3 +690,38 @@ subroutine search_key_big_interval(key,X,sze,idx,ibegin_in,iend_in)
end
subroutine get_cache_map_n_elements_max(map,n_elements_max)
use map_module
implicit none
! Returns the size of the largest cache_map
type (map_type), intent(in) :: map
integer(cache_map_size_kind), intent(out) :: n_elements_max
integer(map_size_kind) :: i
n_elements_max = 0_cache_map_size_kind
do i=1,map%map_size
n_elements_max = max(n_elements_max, map%map(i)%n_elements)
enddo
end
subroutine get_cache_map(map,map_idx,keys,values,n_elements)
use map_module
implicit none
type (map_type), intent(in) :: map
integer(map_size_kind), intent(in) :: map_idx
integer(cache_map_size_kind), intent(inout) :: n_elements
integer(key_kind), intent(out) :: keys(n_elements)
double precision, intent(out) :: values(n_elements)
integer(cache_map_size_kind) :: i
integer(key_kind) :: shift
shift = ishft(map_idx,-map_shift)
n_elements = map%map(map_idx)%n_elements
do i=1,n_elements
keys(i) = map%map(map_idx)%key(i) + shift
values(i) = map%map(map_idx)%value(i)
enddo
end