diff --git a/src/ao_two_e_ints/cholesky.irp.f b/src/ao_two_e_ints/cholesky.irp.f index f4746144..ce05de5b 100644 --- a/src/ao_two_e_ints/cholesky.irp.f +++ b/src/ao_two_e_ints/cholesky.irp.f @@ -339,8 +339,16 @@ BEGIN_PROVIDER [ integer, cholesky_ao_num ] call omp_destroy_lock(lock(k)) enddo - allocate(cholesky_ao(ao_num,ao_num,rank)) - call dcopy(ndim*rank, L, 1, cholesky_ao, 1) + allocate(cholesky_ao(ao_num,ao_num,rank), stat=ierr) + if (ierr /= 0) then + print *, irp_here, ': Allocation failed' + stop -1 + endif + !$OMP PARALLEL DO PRIVATE(k) + do k=1,rank + call dcopy(ndim, L(1,k), 1, cholesky_ao(1,1,k), 1) + enddo + !$OMP END PARALLEL DO deallocate(L) cholesky_ao_num = rank diff --git a/src/mo_two_e_ints/cholesky.irp.f b/src/mo_two_e_ints/cholesky.irp.f index 7cfbaa58..3a868cbe 100644 --- a/src/mo_two_e_ints/cholesky.irp.f +++ b/src/mo_two_e_ints/cholesky.irp.f @@ -26,9 +26,13 @@ BEGIN_PROVIDER [ double precision, cholesky_mo_transp, (cholesky_ao_num, mo_num, END_DOC double precision, allocatable :: X(:,:,:) + integer :: ierr print *, 'AO->MO Transformation of Cholesky vectors' - allocate(X(mo_num,cholesky_ao_num,ao_num)) + allocate(X(mo_num,cholesky_ao_num,ao_num), stat=ierr) + if (ierr /= 0) then + print *, irp_here, ': Allocation failed' + endif call dgemm('T','N', ao_num*cholesky_ao_num, mo_num, ao_num, 1.d0, & cholesky_ao, ao_num, mo_coef, ao_num, 0.d0, X, ao_num*cholesky_ao_num) call dgemm('T','N', cholesky_ao_num*mo_num, mo_num, ao_num, 1.d0, & diff --git a/src/mo_two_e_ints/mo_bi_integrals.irp.f b/src/mo_two_e_ints/mo_bi_integrals.irp.f index af40e571..0ed6f373 100644 --- a/src/mo_two_e_ints/mo_bi_integrals.irp.f +++ b/src/mo_two_e_ints/mo_bi_integrals.irp.f @@ -90,6 +90,10 @@ subroutine four_idx_dgemm double precision, allocatable :: a1(:,:,:,:) double precision, allocatable :: a2(:,:,:,:) + if (ao_num > 1289) then + print *, irp_here, ': Integer overflow in ao_num**3' + endif + allocate (a1(ao_num,ao_num,ao_num,ao_num)) print *, 'Getting AOs' @@ -103,6 +107,7 @@ subroutine four_idx_dgemm enddo !$OMP END PARALLEL DO + print *, '1st transformation' ! 1st transformation allocate (a2(ao_num,ao_num,ao_num,mo_num)) @@ -456,7 +461,7 @@ subroutine add_integrals_to_map_cholesky integer :: i,j,k,l,m integer :: size_buffer, n_integrals - size_buffer = min(mo_num*mo_num,16000000) + size_buffer = min(mo_num*mo_num*mo_num,16000000) double precision, allocatable :: Vtmp(:,:,:) integer(key_kind) , allocatable :: buffer_i(:) @@ -575,6 +580,9 @@ subroutine add_integrals_to_map_three_indices(mask_ijk) return endif + if (ao_num > 1289) then + print *, irp_here, ': Integer overflow in ao_num**3' + endif size_buffer = min(ao_num*ao_num*ao_num,16000000) print*, 'Providing the molecular integrals ' print*, 'Buffers : ', 8.*(mo_num*(n_j)*(n_k+1) + mo_num+& @@ -850,6 +858,9 @@ subroutine add_integrals_to_map_no_exit_34(mask_ijkl) call bitstring_to_list( mask_ijkl(1,3), list_ijkl(1,3), n_k, N_int ) call bitstring_to_list( mask_ijkl(1,4), list_ijkl(1,4), n_l, N_int ) + if (ao_num > 1289) then + print *, irp_here, ': Integer overflow in ao_num**3' + endif size_buffer = min(ao_num*ao_num*ao_num,16000000) print*, 'Providing the molecular integrals ' print*, 'Buffers : ', 8.*(mo_num*(n_j)*(n_k+1) + mo_num+& diff --git a/src/utils/map_functions.irp.f b/src/utils/map_functions.irp.f index cd3b28a8..97d0e8bf 100644 --- a/src/utils/map_functions.irp.f +++ b/src/utils/map_functions.irp.f @@ -11,6 +11,10 @@ subroutine map_save_to_disk(filename,map) integer*8 :: n_elements n_elements = int(map % n_elements,8) + if (n_elements <= 0) then + print *, 'Unable to write map to disk: n_elements = ', n_elements + stop -1 + endif if (map % consolidated) then diff --git a/src/utils/mmap.f90 b/src/utils/mmap.f90 index caabc6f1..41e60224 100644 --- a/src/utils/mmap.f90 +++ b/src/utils/mmap.f90 @@ -52,7 +52,6 @@ module mmap_module do i=1,size(shape) length = length * shape(i) enddo -print *, 'map_length: ', length if (read_only) then map = c_mmap_fortran( trim(filename)//char(0), length, fd_, 1) @@ -79,7 +78,6 @@ print *, 'map_length: ', length do i=1,size(shape) length = length * shape(i) enddo -print *, 'map_length: ', length fd_ = fd call c_munmap_fortran( length, fd_, map) end subroutine @@ -101,7 +99,6 @@ print *, 'map_length: ', length do i=1,size(shape) length = length * shape(i) enddo -print *, 'map_length: ', length fd_ = fd call c_msync_fortran( length, fd_, map) end subroutine