10
0
mirror of https://gitlab.com/scemama/eplf synced 2024-07-30 17:14:22 +02:00

Reduce memory and correct bug with qcio

This commit is contained in:
Anthony Scemama 2009-05-18 15:00:54 +02:00
parent 03565ea88b
commit 5069a720a0
30 changed files with 72 additions and 62 deletions

View File

@ -1,7 +1,10 @@
IRPF90 = irpf90 -DMPI #-a -d IRPF90 = irpf90 -DMPI#-a -d
FC = mpif90 FC = mpif90
FCFLAGS= -O3 -xT FCFLAGS= -O3 -xT
#FC = gfortran -g -ffree-line-length-none
#FCFLAGS=
SRC= SRC=
OBJ= OBJ=
LIB=-lqcio LIB=-lqcio

View File

@ -3,6 +3,11 @@ program debug
PROVIDE ao_prim_num_max PROVIDE ao_prim_num_max
integer :: i,j integer :: i,j
integer :: k integer :: k
print *, ''
print *, 'Occupation numbers'
do k=1,mo_num
print *, k, mo_occ(k)
enddo
read(*,*) i,j read(*,*) i,j
print *, '' print *, ''
@ -44,4 +49,5 @@ program debug
print *, 'EPLF grid Npoints :', grid_eplf_x_num, grid_eplf_y_num, grid_eplf_z_num print *, 'EPLF grid Npoints :', grid_eplf_x_num, grid_eplf_y_num, grid_eplf_z_num
print *, 'EPLF grid step :', grid_eplf_step(:) print *, 'EPLF grid step :', grid_eplf_step(:)
print *, 'EPLF grid origin :', grid_eplf_origin(:) print *, 'EPLF grid origin :', grid_eplf_origin(:)
end end

View File

@ -3,7 +3,7 @@ BEGIN_PROVIDER [ real, eplf_gamma ]
BEGIN_DOC BEGIN_DOC
! Value of the gaussian for the EPLF ! Value of the gaussian for the EPLF
END_DOC END_DOC
eplf_gamma = 1000. eplf_gamma = 10.
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_eplf_integral_matrix, (ao_num,ao_num) ] BEGIN_PROVIDER [ double precision, ao_eplf_integral_matrix, (ao_num,ao_num) ]
@ -21,7 +21,7 @@ BEGIN_PROVIDER [ double precision, ao_eplf_integral_matrix, (ao_num,ao_num) ]
enddo enddo
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ double precision, mo_eplf_integral_matrix, (mo_occ_num,mo_occ_num) ] BEGIN_PROVIDER [ double precision, mo_eplf_integral_matrix, (mo_num,mo_num) ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Array of all the <chi_i chi_j | exp(-gamma r^2)> for EPLF ! Array of all the <chi_i chi_j | exp(-gamma r^2)> for EPLF
@ -29,14 +29,14 @@ BEGIN_PROVIDER [ double precision, mo_eplf_integral_matrix, (mo_occ_num,mo_occ_n
integer :: i, j, k, l integer :: i, j, k, l
PROVIDE ao_eplf_integral_matrix PROVIDE ao_eplf_integral_matrix
PROVIDE mo_coef PROVIDE mo_coef
do i=1,mo_occ_num do i=1,mo_num
do j=i,mo_occ_num do j=i,mo_num
mo_eplf_integral_matrix(j,i) = 0. mo_eplf_integral_matrix(j,i) = 0.
enddo enddo
do k=1,ao_num do k=1,ao_num
if (mo_coef(k,i) /= 0.) then if (mo_coef(k,i) /= 0.) then
do j=i,mo_occ_num do j=i,mo_num
do l=1,ao_num do l=1,ao_num
mo_eplf_integral_matrix(j,i) = mo_eplf_integral_matrix(j,i) + & mo_eplf_integral_matrix(j,i) = mo_eplf_integral_matrix(j,i) + &
mo_coef(k,i)*mo_coef(l,j)*ao_eplf_integral_matrix(k,l) mo_coef(k,i)*mo_coef(l,j)*ao_eplf_integral_matrix(k,l)
@ -45,7 +45,7 @@ BEGIN_PROVIDER [ double precision, mo_eplf_integral_matrix, (mo_occ_num,mo_occ_n
endif endif
enddo enddo
do j=i,mo_occ_num do j=i,mo_num
mo_eplf_integral_matrix(i,j) = mo_eplf_integral_matrix(j,i) mo_eplf_integral_matrix(i,j) = mo_eplf_integral_matrix(j,i)
enddo enddo
enddo enddo
@ -111,10 +111,10 @@ BEGIN_PROVIDER [ real, eplf_value ]
ab = eplf_up_dn ab = eplf_up_dn
aa = min(1.d0,aa) aa = min(1.d0,aa)
ab = min(1.d0,ab) ab = min(1.d0,ab)
aa = max(1.d-30,aa) aa = max(tiny(1.d0),aa)
ab = max(1.d-30,ab) ab = max(tiny(1.d0),ab)
aa = -dlog(aa)/eplf_gamma aa = -(dlog(aa)/eplf_gamma)+tiny(1.d0)
ab = -dlog(ab)/eplf_gamma ab = -(dlog(ab)/eplf_gamma)+tiny(1.d0)
aa = dsqrt(aa) aa = dsqrt(aa)
ab = dsqrt(ab) ab = dsqrt(ab)
@ -161,13 +161,15 @@ double precision function ao_eplf_integral_numeric(i,j,gmma,center)
implicit none implicit none
integer, intent(in) :: i, j integer, intent(in) :: i, j
integer :: p,q,k integer :: p,q,k
double precision :: integral(ao_prim_num_max,ao_prim_num_max) double precision :: integral
double precision :: ao_eplf_integral_primitive_oneD_numeric double precision :: ao_eplf_integral_primitive_oneD_numeric
real :: gmma, center(3) real :: gmma, center(3)
ao_eplf_integral_numeric = 0.
do q=1,ao_prim_num(j) do q=1,ao_prim_num(j)
do p=1,ao_prim_num(i) do p=1,ao_prim_num(i)
integral(p,q) = & integral = &
ao_eplf_integral_primitive_oneD_numeric( & ao_eplf_integral_primitive_oneD_numeric( &
ao_expo(p,i), & ao_expo(p,i), &
nucl_coord(ao_nucl(i),1), & nucl_coord(ao_nucl(i),1), &
@ -195,19 +197,7 @@ double precision function ao_eplf_integral_numeric(i,j,gmma,center)
ao_power(j,3), & ao_power(j,3), &
gmma, & gmma, &
center(3)) center(3))
enddo ao_eplf_integral_numeric = ao_eplf_integral_numeric + integral*ao_coef(p,i)*ao_coef(q,j)
enddo
do q=1,ao_prim_num(j)
do p=1,ao_prim_num(i)
integral(p,q) = integral(p,q)*ao_coef(p,i)*ao_coef(q,j)
enddo
enddo
ao_eplf_integral_numeric = 0.
do q=1,ao_prim_num(j)
do p=1,ao_prim_num(i)
ao_eplf_integral_numeric = ao_eplf_integral_numeric + integral(p,q)
enddo enddo
enddo enddo
@ -277,7 +267,7 @@ double precision function ao_eplf_integral(i,j,gmma,center)
implicit none implicit none
integer, intent(in) :: i, j integer, intent(in) :: i, j
integer :: p,q,k integer :: p,q,k
double precision :: integral(ao_prim_num_max,ao_prim_num_max) double precision :: integral
double precision :: ao_eplf_integral_primitive_oneD double precision :: ao_eplf_integral_primitive_oneD
real :: gmma, center(3) real :: gmma, center(3)
@ -286,10 +276,11 @@ double precision function ao_eplf_integral(i,j,gmma,center)
ASSERT(i<=ao_num) ASSERT(i<=ao_num)
ASSERT(j<=ao_num) ASSERT(j<=ao_num)
ao_eplf_integral = 0.
do q=1,ao_prim_num(j) do q=1,ao_prim_num(j)
do p=1,ao_prim_num(i) do p=1,ao_prim_num(i)
integral(p,q) = & integral = &
ao_eplf_integral_primitive_oneD( & ao_eplf_integral_primitive_oneD( &
ao_expo(p,i), & ao_expo(p,i), &
nucl_coord(ao_nucl(i),1), & nucl_coord(ao_nucl(i),1), &
ao_power(i,1), & ao_power(i,1), &
@ -298,7 +289,7 @@ double precision function ao_eplf_integral(i,j,gmma,center)
ao_power(j,1), & ao_power(j,1), &
gmma, & gmma, &
center(1)) * & center(1)) * &
ao_eplf_integral_primitive_oneD( & ao_eplf_integral_primitive_oneD( &
ao_expo(p,i), & ao_expo(p,i), &
nucl_coord(ao_nucl(i),2), & nucl_coord(ao_nucl(i),2), &
ao_power(i,2), & ao_power(i,2), &
@ -307,7 +298,7 @@ double precision function ao_eplf_integral(i,j,gmma,center)
ao_power(j,2), & ao_power(j,2), &
gmma, & gmma, &
center(2)) * & center(2)) * &
ao_eplf_integral_primitive_oneD( & ao_eplf_integral_primitive_oneD( &
ao_expo(p,i), & ao_expo(p,i), &
nucl_coord(ao_nucl(i),3), & nucl_coord(ao_nucl(i),3), &
ao_power(i,3), & ao_power(i,3), &
@ -316,19 +307,7 @@ double precision function ao_eplf_integral(i,j,gmma,center)
ao_power(j,3), & ao_power(j,3), &
gmma, & gmma, &
center(3)) center(3))
enddo ao_eplf_integral = ao_eplf_integral + integral*ao_coef(p,i)*ao_coef(q,j)
enddo
do q=1,ao_prim_num(j)
do p=1,ao_prim_num(i)
integral(p,q) = integral(p,q)*ao_coef(p,i)*ao_coef(q,j)
enddo
enddo
ao_eplf_integral = 0.
do q=1,ao_prim_num(j)
do p=1,ao_prim_num(i)
ao_eplf_integral = ao_eplf_integral + integral(p,q)
enddo enddo
enddo enddo

View File

@ -28,6 +28,26 @@ BEGIN_PROVIDER [ integer, mo_active_num ]
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ real, mo_occ, (mo_num) ]
implicit none
BEGIN_DOC
! Occupation numbers of molecular orbitals
END_DOC
double precision, allocatable :: buffer(:)
allocate ( buffer(mo_tot_num) )
!$OMP CRITICAL (qcio_critical)
call qcio_get_mo_occupation(buffer)
!$OMP END CRITICAL (qcio_critical)
integer :: i
do i=1,mo_num
mo_occ(i) = buffer(i)
enddo
deallocate(buffer)
END_PROVIDER
BEGIN_PROVIDER [ integer, mo_num ] BEGIN_PROVIDER [ integer, mo_num ]
implicit none implicit none
@ -40,15 +60,6 @@ BEGIN_PROVIDER [ integer, mo_num ]
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ integer, mo_occ_num ]
implicit none
BEGIN_DOC
! Number of occupied molecular orbitals
END_DOC
mo_occ_num = mo_closed_num + mo_active_num
END_PROVIDER
BEGIN_PROVIDER [ real, mo_coef, (ao_num,mo_num) ] BEGIN_PROVIDER [ real, mo_coef, (ao_num,mo_num) ]
implicit none implicit none
@ -57,7 +68,8 @@ BEGIN_PROVIDER [ real, mo_coef, (ao_num,mo_num) ]
END_DOC END_DOC
integer :: i, j integer :: i, j
double precision :: buffer(ao_num,mo_tot_num) double precision, allocatable :: buffer(:,:)
allocate (buffer(ao_num,mo_tot_num))
!$OMP CRITICAL (qcio_critical) !$OMP CRITICAL (qcio_critical)
call qcio_get_mo_matrix(buffer) call qcio_get_mo_matrix(buffer)
@ -67,6 +79,7 @@ BEGIN_PROVIDER [ real, mo_coef, (ao_num,mo_num) ]
mo_coef(i,j) = buffer(i,j) mo_coef(i,j) = buffer(i,j)
enddo enddo
enddo enddo
deallocate (buffer)
END_PROVIDER END_PROVIDER
@ -113,7 +126,11 @@ BEGIN_PROVIDER [ logical, mo_is_closed, (mo_num) ]
! mo_is_active : True if mo(i) is an active orbital ! mo_is_active : True if mo(i) is an active orbital
END_DOC END_DOC
character :: buffer(mo_tot_num) character, allocatable :: buffer(:)
allocate (buffer(mo_num))
!$OMP CRITICAL (qcio_critical)
call qcio_get_mo_classif(buffer)
!$OMP END CRITICAL
integer :: i integer :: i
do i=1,mo_num do i=1,mo_num
@ -128,6 +145,7 @@ BEGIN_PROVIDER [ logical, mo_is_closed, (mo_num) ]
mo_is_active(i) = .False. mo_is_active(i) = .False.
endif endif
enddo enddo
deallocate (buffer)
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ integer, mo_tot_num ] BEGIN_PROVIDER [ integer, mo_tot_num ]

View File

@ -19,7 +19,8 @@ BEGIN_PROVIDER [ real, nucl_charge, (nucl_num) ]
! Nuclear charge ! Nuclear charge
END_DOC END_DOC
double precision :: buffer(nucl_num) double precision,allocatable :: buffer(:)
allocate(buffer(nucl_num))
!$OMP CRITICAL (qcio_critical) !$OMP CRITICAL (qcio_critical)
call qcio_get_geometry_charge(buffer) call qcio_get_geometry_charge(buffer)
!$OMP END CRITICAL (qcio_critical) !$OMP END CRITICAL (qcio_critical)
@ -28,6 +29,7 @@ BEGIN_PROVIDER [ real, nucl_charge, (nucl_num) ]
do i=1,nucl_num do i=1,nucl_num
nucl_charge(i) = buffer(i) nucl_charge(i) = buffer(i)
enddo enddo
deallocate(buffer)
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ real, nucl_coord, (nucl_num,3) ] BEGIN_PROVIDER [ real, nucl_coord, (nucl_num,3) ]
@ -36,7 +38,8 @@ BEGIN_PROVIDER [ real, nucl_coord, (nucl_num,3) ]
BEGIN_DOC BEGIN_DOC
! Nuclear coordinates ! Nuclear coordinates
END_DOC END_DOC
double precision :: buffer(3,nucl_num) double precision, allocatable :: buffer(:,:)
allocate (buffer(3,nucl_num))
!$OMP CRITICAL (qcio_critical) !$OMP CRITICAL (qcio_critical)
call qcio_get_geometry_coord(buffer) call qcio_get_geometry_coord(buffer)
@ -48,6 +51,7 @@ BEGIN_PROVIDER [ real, nucl_coord, (nucl_num,3) ]
nucl_coord(j,i) = buffer(i,j) nucl_coord(j,i) = buffer(i,j)
enddo enddo
enddo enddo
deallocate(buffer)
END_PROVIDER END_PROVIDER

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
T F

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
0.539373520750000E+11 0.549308735950000E+11

Binary file not shown.

View File

@ -1 +1 @@
0.596046447753906E+00 2.000000000000000E-01

Binary file not shown.

View File

@ -1 +1 @@
10 10

Binary file not shown.