10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-26 07:02:14 +02:00

Introduced MPI for EZFIO accesses

This commit is contained in:
Anthony Scemama 2017-11-28 00:54:22 +01:00
parent 6b0b988ee8
commit 1a5a4d5ff2
15 changed files with 427 additions and 205 deletions

View File

@ -42,7 +42,7 @@ subroutine zmq_get_$X(zmq_to_qp_run_socket, worker_id)
integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket
integer, intent(in) :: worker_id
integer :: rc
character*(64) :: msg
character*(256) :: msg
write(msg,'(A8,1X,I8,1X,A230)') 'get_data', worker_id, '$X'
rc = f77_zmq_send(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),0)

View File

@ -22,14 +22,24 @@ BEGIN_PROVIDER [ %(type)s, %(name)s %(size)s ]
logical :: has
PROVIDE ezfio_filename
%(test_null_size)s
call ezfio_has_%(ezfio_dir)s_%(ezfio_name)s(has)
if (has) then
call ezfio_get_%(ezfio_dir)s_%(ezfio_name)s(%(name)s)
else
print *, '%(ezfio_dir)s/%(ezfio_name)s not found in EZFIO file'
stop 1
if (mpi_master) then
%(test_null_size)s
call ezfio_has_%(ezfio_dir)s_%(ezfio_name)s(has)
if (has) then
call ezfio_get_%(ezfio_dir)s_%(ezfio_name)s(%(name)s)
else
print *, '%(ezfio_dir)s/%(ezfio_name)s not found in EZFIO file'
stop 1
endif
endif
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( %(name)s, %(size_mpi)s, %(type_mpi)s, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read %(name)s with MPI'
endif
IRP_ENDIF
%(write)s
END_PROVIDER
""".strip()
@ -38,6 +48,12 @@ END_PROVIDER
"logical": "write_bool",
"double precision": "write_double"}
mpi_correspondance = {"integer": "MPI_INTEGER",
"integer*8": "MPI_INTEGER8",
"character*(32)": "MPI_CHARACTER",
"logical": "MPI_LOGICAL",
"double precision": "MPI_DOUBLE_PRECISION"}
def __init__(self):
self.values = "type doc name ezfio_dir ezfio_name write output".split()
for v in self.values:
@ -66,10 +82,11 @@ END_PROVIDER
def set_write(self):
self.write = ""
self.type_mpi = self.mpi_correspondance[self.type]
if "size" in self.__dict__:
return
else:
if self.type in self.write_correspondance:
if self.type in self.mpi_correspondance:
write = self.write_correspondance[self.type]
output = self.output
name = self.name
@ -101,7 +118,9 @@ END_PROVIDER
self.output = t
def set_size(self, t):
self.size_mpi = t.replace(',',')*(').replace('0:','1+')
if (self.type == "character*(32)"):
self.size_mpi += "*32"
if t != "1":
self.size = ", " + t
else:

View File

@ -1,8 +1,9 @@
BEGIN_PROVIDER [ integer, ao_prim_num_max ]
implicit none
ao_prim_num_max = 0
PROVIDE ezfio_filename
call ezfio_get_ao_basis_ao_prim_num_max(ao_prim_num_max)
BEGIN_DOC
! max number of primitives
END_DOC
ao_prim_num_max = maxval(ao_prim_num)
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_coef_normalized, (ao_num,ao_prim_num_max) ]

View File

@ -102,25 +102,44 @@ BEGIN_PROVIDER [ integer, N_generators_bitmask ]
logical :: exists
PROVIDE ezfio_filename
call ezfio_has_bitmasks_N_mask_gen(exists)
if (exists) then
call ezfio_get_bitmasks_N_mask_gen(N_generators_bitmask)
integer :: N_int_check
integer :: bit_kind_check
call ezfio_get_bitmasks_bit_kind(bit_kind_check)
if (bit_kind_check /= bit_kind) then
print *, bit_kind_check, bit_kind
print *, 'Error: bit_kind is not correct in EZFIO file'
endif
call ezfio_get_bitmasks_N_int(N_int_check)
if (N_int_check /= N_int) then
print *, N_int_check, N_int
print *, 'Error: N_int is not correct in EZFIO file'
endif
else
N_generators_bitmask = 1
if (mpi_master) then
call ezfio_has_bitmasks_N_mask_gen(exists)
if (exists) then
call ezfio_get_bitmasks_N_mask_gen(N_generators_bitmask)
integer :: N_int_check
integer :: bit_kind_check
call ezfio_get_bitmasks_bit_kind(bit_kind_check)
if (bit_kind_check /= bit_kind) then
print *, bit_kind_check, bit_kind
print *, 'Error: bit_kind is not correct in EZFIO file'
endif
call ezfio_get_bitmasks_N_int(N_int_check)
if (N_int_check /= N_int) then
print *, N_int_check, N_int
print *, 'Error: N_int is not correct in EZFIO file'
endif
else
N_generators_bitmask = 1
endif
ASSERT (N_generators_bitmask > 0)
endif
ASSERT (N_generators_bitmask > 0)
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( N_generators_bitmask, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read N_generators_bitmask with MPI'
endif
call MPI_BCAST( bit_kind, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read bit_kind with MPI'
endif
call MPI_BCAST( N_int, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read N_int with MPI'
endif
IRP_ENDIF
END_PROVIDER
@ -133,25 +152,40 @@ BEGIN_PROVIDER [ integer, N_generators_bitmask_restart ]
logical :: exists
PROVIDE ezfio_filename
call ezfio_has_bitmasks_N_mask_gen(exists)
if (exists) then
call ezfio_get_bitmasks_N_mask_gen(N_generators_bitmask_restart)
integer :: N_int_check
integer :: bit_kind_check
call ezfio_get_bitmasks_bit_kind(bit_kind_check)
if (bit_kind_check /= bit_kind) then
print *, bit_kind_check, bit_kind
print *, 'Error: bit_kind is not correct in EZFIO file'
endif
call ezfio_get_bitmasks_N_int(N_int_check)
if (N_int_check /= N_int) then
print *, N_int_check, N_int
print *, 'Error: N_int is not correct in EZFIO file'
endif
else
N_generators_bitmask_restart = 1
if (mpi_master) then
call ezfio_has_bitmasks_N_mask_gen(exists)
if (exists) then
call ezfio_get_bitmasks_N_mask_gen(N_generators_bitmask_restart)
integer :: N_int_check
integer :: bit_kind_check
call ezfio_get_bitmasks_bit_kind(bit_kind_check)
if (bit_kind_check /= bit_kind) then
print *, bit_kind_check, bit_kind
print *, 'Error: bit_kind is not correct in EZFIO file'
endif
call ezfio_get_bitmasks_N_int(N_int_check)
if (N_int_check /= N_int) then
print *, N_int_check, N_int
print *, 'Error: N_int is not correct in EZFIO file'
endif
else
N_generators_bitmask_restart = 1
endif
ASSERT (N_generators_bitmask_restart > 0)
endif
ASSERT (N_generators_bitmask_restart > 0)
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( bit_kind, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read bit_kind with MPI'
endif
call MPI_BCAST( N_generators_bitmask_restart, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read N_generators_bitmask_restart with MPI'
endif
IRP_ENDIF
END_PROVIDER
@ -182,38 +216,49 @@ BEGIN_PROVIDER [ integer(bit_kind), generators_bitmask_restart, (N_int,2,6,N_gen
logical :: exists
PROVIDE ezfio_filename
call ezfio_has_bitmasks_generators(exists)
if (exists) then
call ezfio_get_bitmasks_generators(generators_bitmask_restart)
else
integer :: k, ispin
do k=1,N_generators_bitmask
do ispin=1,2
do i=1,N_int
generators_bitmask_restart(i,ispin,s_hole ,k) = full_ijkl_bitmask(i)
generators_bitmask_restart(i,ispin,s_part ,k) = full_ijkl_bitmask(i)
generators_bitmask_restart(i,ispin,d_hole1,k) = full_ijkl_bitmask(i)
generators_bitmask_restart(i,ispin,d_part1,k) = full_ijkl_bitmask(i)
generators_bitmask_restart(i,ispin,d_hole2,k) = full_ijkl_bitmask(i)
generators_bitmask_restart(i,ispin,d_part2,k) = full_ijkl_bitmask(i)
if (mpi_master) then
call ezfio_has_bitmasks_generators(exists)
if (exists) then
call ezfio_get_bitmasks_generators(generators_bitmask_restart)
else
integer :: k, ispin
do k=1,N_generators_bitmask
do ispin=1,2
do i=1,N_int
generators_bitmask_restart(i,ispin,s_hole ,k) = full_ijkl_bitmask(i)
generators_bitmask_restart(i,ispin,s_part ,k) = full_ijkl_bitmask(i)
generators_bitmask_restart(i,ispin,d_hole1,k) = full_ijkl_bitmask(i)
generators_bitmask_restart(i,ispin,d_part1,k) = full_ijkl_bitmask(i)
generators_bitmask_restart(i,ispin,d_hole2,k) = full_ijkl_bitmask(i)
generators_bitmask_restart(i,ispin,d_part2,k) = full_ijkl_bitmask(i)
enddo
enddo
enddo
enddo
endif
enddo
endif
integer :: i
do k=1,N_generators_bitmask
do ispin=1,2
do i=1,N_int
generators_bitmask_restart(i,ispin,s_hole ,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,s_hole,k) )
generators_bitmask_restart(i,ispin,s_part ,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,s_part,k) )
generators_bitmask_restart(i,ispin,d_hole1,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,d_hole1,k) )
generators_bitmask_restart(i,ispin,d_part1,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,d_part1,k) )
generators_bitmask_restart(i,ispin,d_hole2,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,d_hole2,k) )
generators_bitmask_restart(i,ispin,d_part2,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,d_part2,k) )
enddo
enddo
enddo
endif
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( generators_bitmask_restart, N_int*2*6*N_generators_bitmask_restart, MPI_BIT_KIND, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read generators_bitmask_restart with MPI'
endif
IRP_ENDIF
integer :: i
do k=1,N_generators_bitmask
do ispin=1,2
do i=1,N_int
generators_bitmask_restart(i,ispin,s_hole ,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,s_hole,k) )
generators_bitmask_restart(i,ispin,s_part ,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,s_part,k) )
generators_bitmask_restart(i,ispin,d_hole1,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,d_hole1,k) )
generators_bitmask_restart(i,ispin,d_part1,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,d_part1,k) )
generators_bitmask_restart(i,ispin,d_hole2,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,d_hole2,k) )
generators_bitmask_restart(i,ispin,d_part2,k) = iand(full_ijkl_bitmask(i),generators_bitmask_restart(i,ispin,d_part2,k) )
enddo
enddo
enddo
END_PROVIDER
@ -241,6 +286,7 @@ BEGIN_PROVIDER [ integer(bit_kind), generators_bitmask, (N_int,2,6,N_generators_
logical :: exists
PROVIDE ezfio_filename
if (mpi_master) then
call ezfio_has_bitmasks_generators(exists)
if (exists) then
call ezfio_get_bitmasks_generators(generators_bitmask)
@ -272,6 +318,16 @@ BEGIN_PROVIDER [ integer(bit_kind), generators_bitmask, (N_int,2,6,N_generators_
enddo
enddo
enddo
endif
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( generators_bitmask, N_int*2*6*N_generators_bitmask, MPI_BIT_KIND, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read generators_bitmask with MPI'
endif
IRP_ENDIF
END_PROVIDER
BEGIN_PROVIDER [ integer, N_cas_bitmask ]
@ -282,25 +338,35 @@ BEGIN_PROVIDER [ integer, N_cas_bitmask ]
logical :: exists
PROVIDE ezfio_filename
call ezfio_has_bitmasks_N_mask_cas(exists)
if (exists) then
call ezfio_get_bitmasks_N_mask_cas(N_cas_bitmask)
integer :: N_int_check
integer :: bit_kind_check
call ezfio_get_bitmasks_bit_kind(bit_kind_check)
if (bit_kind_check /= bit_kind) then
print *, bit_kind_check, bit_kind
print *, 'Error: bit_kind is not correct in EZFIO file'
endif
call ezfio_get_bitmasks_N_int(N_int_check)
if (N_int_check /= N_int) then
print *, N_int_check, N_int
print *, 'Error: N_int is not correct in EZFIO file'
endif
else
N_cas_bitmask = 1
if (mpi_master) then
call ezfio_has_bitmasks_N_mask_cas(exists)
if (exists) then
call ezfio_get_bitmasks_N_mask_cas(N_cas_bitmask)
integer :: N_int_check
integer :: bit_kind_check
call ezfio_get_bitmasks_bit_kind(bit_kind_check)
if (bit_kind_check /= bit_kind) then
print *, bit_kind_check, bit_kind
print *, 'Error: bit_kind is not correct in EZFIO file'
endif
call ezfio_get_bitmasks_N_int(N_int_check)
if (N_int_check /= N_int) then
print *, N_int_check, N_int
print *, 'Error: N_int is not correct in EZFIO file'
endif
else
N_cas_bitmask = 1
endif
endif
ASSERT (N_cas_bitmask > 0)
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( N_cas_bitmask, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read N_cas_bitmask with MPI'
endif
IRP_ENDIF
END_PROVIDER
@ -313,35 +379,46 @@ BEGIN_PROVIDER [ integer(bit_kind), cas_bitmask, (N_int,2,N_cas_bitmask) ]
integer :: i,i_part,i_gen,j,k
PROVIDE ezfio_filename
call ezfio_has_bitmasks_cas(exists)
if (exists) then
call ezfio_get_bitmasks_cas(cas_bitmask)
else
if(N_generators_bitmask == 1)then
do j=1, N_cas_bitmask
do i=1, N_int
cas_bitmask(i,1,j) = iand(not(HF_bitmask(i,1)),full_ijkl_bitmask(i))
cas_bitmask(i,2,j) = iand(not(HF_bitmask(i,2)),full_ijkl_bitmask(i))
if (mpi_master) then
call ezfio_has_bitmasks_cas(exists)
if (exists) then
call ezfio_get_bitmasks_cas(cas_bitmask)
else
if(N_generators_bitmask == 1)then
do j=1, N_cas_bitmask
do i=1, N_int
cas_bitmask(i,1,j) = iand(not(HF_bitmask(i,1)),full_ijkl_bitmask(i))
cas_bitmask(i,2,j) = iand(not(HF_bitmask(i,2)),full_ijkl_bitmask(i))
enddo
enddo
enddo
else
i_part = 2
i_gen = 1
do j=1, N_cas_bitmask
do i=1, N_int
cas_bitmask(i,1,j) = generators_bitmask_restart(i,1,i_part,i_gen)
cas_bitmask(i,2,j) = generators_bitmask_restart(i,2,i_part,i_gen)
else
i_part = 2
i_gen = 1
do j=1, N_cas_bitmask
do i=1, N_int
cas_bitmask(i,1,j) = generators_bitmask_restart(i,1,i_part,i_gen)
cas_bitmask(i,2,j) = generators_bitmask_restart(i,2,i_part,i_gen)
enddo
enddo
enddo
endif
endif
do i=1,N_cas_bitmask
do j = 1, N_cas_bitmask
do k=1,N_int
cas_bitmask(k,j,i) = iand(cas_bitmask(k,j,i),full_ijkl_bitmask(k))
enddo
enddo
enddo
endif
do i=1,N_cas_bitmask
do j = 1, N_cas_bitmask
do k=1,N_int
cas_bitmask(k,j,i) = iand(cas_bitmask(k,j,i),full_ijkl_bitmask(k))
enddo
enddo
enddo
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( cas_bitmask, N_int*2*N_cas_bitmask, MPI_BIT_KIND, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read cas_bitmask with MPI'
endif
IRP_ENDIF
END_PROVIDER

View File

@ -26,6 +26,7 @@ BEGIN_PROVIDER [ integer, N_det ]
character*(64) :: label
PROVIDE ezfio_filename
PROVIDE nproc
if (mpi_master) then
if (read_wf) then
call ezfio_has_determinants_n_det(exists)
if (exists) then
@ -43,6 +44,16 @@ BEGIN_PROVIDER [ integer, N_det ]
else
N_det = 1
endif
endif
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( N_det, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read N_det with MPI'
endif
IRP_ENDIF
call write_int(output_determinants,N_det,'Number of determinants')
ASSERT (N_det > 0)
END_PROVIDER
@ -69,14 +80,25 @@ BEGIN_PROVIDER [ integer, psi_det_size ]
END_DOC
PROVIDE ezfio_filename
logical :: exists
call ezfio_has_determinants_n_det(exists)
if (exists) then
call ezfio_get_determinants_n_det(psi_det_size)
else
psi_det_size = 1
if (mpi_master) then
call ezfio_has_determinants_n_det(exists)
if (exists) then
call ezfio_get_determinants_n_det(psi_det_size)
else
psi_det_size = 1
endif
psi_det_size = max(psi_det_size,100000)
call write_int(output_determinants,psi_det_size,'Dimension of the psi arrays')
endif
psi_det_size = max(psi_det_size,100000)
call write_int(output_determinants,psi_det_size,'Dimension of the psi arrays')
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( psi_det_size, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read psi_det_size with MPI'
endif
IRP_ENDIF
END_PROVIDER
@ -91,6 +113,7 @@ BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ]
character*(64) :: label
psi_det = 0_bit_kind
if (mpi_master) then
if (read_wf) then
call ezfio_has_determinants_N_int(exists)
if (exists) then
@ -129,6 +152,16 @@ BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ]
psi_det(i,2,1) = HF_bitmask(i,2)
enddo
endif
endif
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( psi_det, N_int*2*N_det, MPI_BIT_KIND, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read psi_det with MPI'
endif
IRP_ENDIF
END_PROVIDER
@ -146,6 +179,7 @@ BEGIN_PROVIDER [ double precision, psi_coef, (psi_det_size,N_states) ]
double precision, allocatable :: psi_coef_read(:,:)
character*(64) :: label
if (mpi_master) then
psi_coef = 0.d0
do i=1,min(N_states,psi_det_size)
psi_coef(i,i) = 1.d0
@ -175,6 +209,16 @@ BEGIN_PROVIDER [ double precision, psi_coef, (psi_det_size,N_states) ]
endif
endif
endif
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( psi_coef, N_states*psi_det_size, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read psi_coef with MPI'
endif
IRP_ENDIF
END_PROVIDER
@ -444,7 +488,9 @@ subroutine save_wavefunction
BEGIN_DOC
! Save the wave function into the EZFIO file
END_DOC
call save_wavefunction_general(N_det,min(N_states,N_det),psi_det_sorted,size(psi_coef_sorted,1),psi_coef_sorted)
if (mpi_master) then
call save_wavefunction_general(N_det,min(N_states,N_det),psi_det_sorted,size(psi_coef_sorted,1),psi_coef_sorted)
endif
end
@ -454,7 +500,9 @@ subroutine save_wavefunction_unsorted
BEGIN_DOC
! Save the wave function into the EZFIO file
END_DOC
call save_wavefunction_general(N_det,min(N_states,N_det),psi_det,size(psi_coef,1),psi_coef)
if (mpi_master) then
call save_wavefunction_general(N_det,min(N_states,N_det),psi_det,size(psi_coef,1),psi_coef)
endif
end
subroutine save_wavefunction_general(ndet,nstates,psidet,dim_psicoef,psicoef)
@ -472,6 +520,7 @@ subroutine save_wavefunction_general(ndet,nstates,psidet,dim_psicoef,psicoef)
integer :: i,j,k
if (mpi_master) then
call ezfio_set_determinants_N_int(N_int)
call ezfio_set_determinants_bit_kind(bit_kind)
call ezfio_set_determinants_N_det(ndet)
@ -513,6 +562,7 @@ subroutine save_wavefunction_general(ndet,nstates,psidet,dim_psicoef,psicoef)
call ezfio_set_determinants_psi_coef(psi_coef_save)
deallocate (psi_coef_save)
call write_int(output_determinants,ndet,'Saved determinants')
endif
end

View File

@ -36,7 +36,7 @@ subroutine occ_pattern_to_dets_size(o,sze,n_alpha,Nint)
amax -= popcnt( o(k,2) )
enddo
sze = int( min(binom_func(bmax, amax), 1.d8) )
sze = 2*sze*sze + 16
sze = 2*sze*sze + 64
end
@ -264,7 +264,7 @@ subroutine make_s2_eigenfunction
!$OMP PRIVATE(s,ithread, d, det_buffer, smax, N_det_new,i,j,k)
N_det_new = 0
call occ_pattern_to_dets_size(psi_occ_pattern(1,1,1),s,elec_alpha_num,N_int)
allocate (d(N_int,2,s+16), det_buffer(N_int,2,bufsze) )
allocate (d(N_int,2,s+64), det_buffer(N_int,2,bufsze) )
smax = s
ithread=0
!$ ithread = omp_get_thread_num()
@ -274,7 +274,7 @@ subroutine make_s2_eigenfunction
s += 1
if (s > smax) then
deallocate(d)
allocate ( d(N_int,2,s+16) )
allocate ( d(N_int,2,s+64) )
smax = s
endif
call occ_pattern_to_dets(psi_occ_pattern(1,1,i),d,s,elec_alpha_num,N_int)

View File

@ -62,7 +62,7 @@ subroutine zmq_get_$X(zmq_to_qp_run_socket, worker_id)
integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket
integer, intent(in) :: worker_id
integer :: rc
character*(64) :: msg
character*(256) :: msg
write(msg,'(A8,1X,I8,1X,A230)') 'get_data', worker_id, '$X'
rc = f77_zmq_send(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),0)
@ -171,7 +171,6 @@ subroutine zmq_get_psi(zmq_to_qp_run_socket, worker_id)
END_DOC
integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket
integer, intent(in) :: worker_id
character*(64) :: msg
call zmq_get_N_states(zmq_to_qp_run_socket, worker_id)
call zmq_get_N_det(zmq_to_qp_run_socket, worker_id)
@ -195,7 +194,7 @@ subroutine zmq_get_psi_det(zmq_to_qp_run_socket, worker_id)
integer, intent(in) :: worker_id
integer :: rc
integer*8 :: rc8
character*(64) :: msg
character*(256) :: msg
write(msg,'(A8,1X,I8,1X,A230)') 'get_data', worker_id, 'psi_det'
@ -230,7 +229,7 @@ subroutine zmq_get_psi_coef(zmq_to_qp_run_socket, worker_id)
integer, intent(in) :: worker_id
integer :: rc
integer*8 :: rc8
character*(64) :: msg
character*(256) :: msg
write(msg,'(A8,1X,I8,1X,A230)') 'get_data', worker_id, 'psi_coef'

View File

@ -12,4 +12,4 @@ interface: ezfio, provider
type: Positive_int
doc: Numbers total of electrons (alpha + beta)
default: = electrons.elec_alpha_num + electrons.elec_beta_num
interface: ezfio
interface: ezfio

View File

@ -1,4 +1,4 @@
BEGIN_PROVIDER [ integer, elec_num]
BEGIN_PROVIDER [ integer, elec_num ]
&BEGIN_PROVIDER [ integer, elec_num_tab, (2)]
implicit none
@ -7,9 +7,9 @@
END_DOC
PROVIDE ezfio_filename
call ezfio_get_electrons_elec_num(elec_num)
elec_num_tab(1) = elec_alpha_num
elec_num_tab(2) = elec_beta_num
elec_num = elec_alpha_num+elec_beta_num
END_PROVIDER

View File

@ -407,7 +407,7 @@ BEGIN_PROVIDER [ logical, ao_bielec_integrals_in_map ]
ao_bielec_integrals_in_map = .True.
if (write_ao_integrals) then
if (write_ao_integrals.and.mpi_master) then
call ezfio_set_work_empty(.False.)
call map_save_to_disk(trim(ezfio_filename)//'/work/ao_ints',ao_integrals_map)
call ezfio_set_integrals_bielec_disk_access_ao_integrals("Read")

View File

@ -599,6 +599,9 @@ subroutine dump_$ao_integrals(filename)
integer(cache_key_kind), pointer :: key(:)
real(integral_kind), pointer :: val(:)
integer*8 :: i,j, n
if (.not.mpi_master) then
return
endif
call ezfio_set_work_empty(.False.)
open(unit=66,file=filename,FORM='unformatted')
write(66) integral_kind, key_kind

View File

@ -134,7 +134,7 @@ BEGIN_PROVIDER [ logical, mo_bielec_integrals_in_map ]
print*,'Molecular integrals provided'
endif
if (write_mo_integrals) then
if (write_mo_integrals.and.mpi_master) then
call ezfio_set_work_empty(.False.)
call map_save_to_disk(trim(ezfio_filename)//'/work/mo_ints',mo_integrals_map)
call ezfio_set_integrals_bielec_disk_access_mo_integrals("Read")

View File

@ -1,18 +1,32 @@
BEGIN_PROVIDER [ integer, mo_tot_num ]
implicit none
BEGIN_DOC
! Total number of molecular orbitals and the size of the keys corresponding
! Number of MOs
END_DOC
logical :: has
PROVIDE ezfio_filename
logical :: exists
call ezfio_has_mo_basis_mo_tot_num(exists)
if (exists) then
call ezfio_get_mo_basis_mo_tot_num(mo_tot_num)
else
mo_tot_num = ao_ortho_canonical_num
if (mpi_master) then
call ezfio_has_mo_basis_mo_tot_num(has)
if (has) then
mo_tot_num = ao_ortho_canonical_num
else
print *, 'mo_basis/mo_tot_num not found in EZFIO file'
stop 1
endif
endif
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( mo_tot_num, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read mo_tot_num with MPI'
endif
IRP_ENDIF
call write_int(6,mo_tot_num,'mo_tot_num')
ASSERT (mo_tot_num > 0)
END_PROVIDER
@ -29,18 +43,29 @@ BEGIN_PROVIDER [ double precision, mo_coef, (ao_num,mo_tot_num) ]
PROVIDE ezfio_filename
! Coefs
call ezfio_has_mo_basis_mo_coef(exists)
if (exists) then
call ezfio_get_mo_basis_mo_coef(mo_coef)
else
! Orthonormalized AO basis
do i=1,mo_tot_num
do j=1,ao_num
mo_coef(j,i) = ao_ortho_canonical_coef(j,i)
if (mpi_master) then
! Coefs
call ezfio_has_mo_basis_mo_coef(exists)
if (exists) then
call ezfio_get_mo_basis_mo_coef(mo_coef)
else
! Orthonormalized AO basis
do i=1,mo_tot_num
do j=1,ao_num
mo_coef(j,i) = ao_ortho_canonical_coef(j,i)
enddo
enddo
enddo
endif
endif
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( mo_coef, mo_tot_num*ao_num, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read mo_coef with MPI'
endif
IRP_ENDIF
END_PROVIDER
BEGIN_PROVIDER [ double precision, mo_coef_in_ao_ortho_basis, (ao_num, mo_tot_num) ]
@ -67,12 +92,23 @@ BEGIN_PROVIDER [ character*(64), mo_label ]
logical :: exists
PROVIDE ezfio_filename
call ezfio_has_mo_basis_mo_label(exists)
if (exists) then
call ezfio_get_mo_basis_mo_label(mo_label)
else
mo_label = 'no_label'
if (mpi_master) then
call ezfio_has_mo_basis_mo_label(exists)
if (exists) then
call ezfio_get_mo_basis_mo_label(mo_label)
else
mo_label = 'no_label'
endif
endif
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( mo_label, 64, MPI_CHARACTER, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read mo_label with MPI'
endif
IRP_ENDIF
END_PROVIDER
BEGIN_PROVIDER [ double precision, mo_coef_transp, (mo_tot_num,ao_num) ]
@ -109,20 +145,31 @@ BEGIN_PROVIDER [ double precision, mo_occ, (mo_tot_num) ]
! MO occupation numbers
END_DOC
PROVIDE ezfio_filename
logical :: exists
call ezfio_has_mo_basis_mo_occ(exists)
if (exists) then
call ezfio_get_mo_basis_mo_occ(mo_occ)
else
mo_occ = 0.d0
integer :: i
do i=1,elec_beta_num
mo_occ(i) = 2.d0
enddo
do i=elec_beta_num+1,elec_alpha_num
mo_occ(i) = 1.d0
enddo
if (mpi_master) then
logical :: exists
call ezfio_has_mo_basis_mo_occ(exists)
if (exists) then
call ezfio_get_mo_basis_mo_occ(mo_occ)
else
mo_occ = 0.d0
integer :: i
do i=1,elec_beta_num
mo_occ(i) = 2.d0
enddo
do i=elec_beta_num+1,elec_alpha_num
mo_occ(i) = 1.d0
enddo
endif
endif
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( mo_occ, mo_tot_num, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read mo_occ with MPI'
endif
IRP_ENDIF
END_PROVIDER

View File

@ -1 +1 @@
Utils

View File

@ -6,29 +6,42 @@ BEGIN_PROVIDER [ double precision, nucl_coord, (nucl_num,3) ]
END_DOC
PROVIDE ezfio_filename
double precision, allocatable :: buffer(:,:)
nucl_coord = 0.d0
allocate (buffer(nucl_num,3))
buffer = 0.d0
logical :: has
call ezfio_has_nuclei_nucl_coord(has)
if (.not.has) then
print *, irp_here
stop 1
if (mpi_master) then
double precision, allocatable :: buffer(:,:)
nucl_coord = 0.d0
allocate (buffer(nucl_num,3))
buffer = 0.d0
logical :: has
call ezfio_has_nuclei_nucl_coord(has)
if (.not.has) then
print *, irp_here
stop 1
endif
call ezfio_get_nuclei_nucl_coord(buffer)
integer :: i,j
do i=1,3
do j=1,nucl_num
nucl_coord(j,i) = buffer(j,i)
enddo
enddo
deallocate(buffer)
character*(64), parameter :: f = '(A16, 4(1X,F12.6))'
character*(64), parameter :: ft= '(A16, 4(1X,A12 ))'
double precision, parameter :: a0= 0.529177249d0
endif
call ezfio_get_nuclei_nucl_coord(buffer)
integer :: i,j
do i=1,3
do j=1,nucl_num
nucl_coord(j,i) = buffer(j,i)
enddo
enddo
deallocate(buffer)
character*(64), parameter :: f = '(A16, 4(1X,F12.6))'
character*(64), parameter :: ft= '(A16, 4(1X,A12 ))'
double precision, parameter :: a0= 0.529177249d0
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( nucl_coord, 3*nucl_num, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read nucl_coord with MPI'
endif
IRP_ENDIF
call write_time(output_Nuclei)
write(output_Nuclei,'(A)') ''
write(output_Nuclei,'(A)') 'Nuclear Coordinates (Angstroms)'
@ -135,13 +148,24 @@ BEGIN_PROVIDER [ double precision, nuclear_repulsion ]
IF (disk_access_nuclear_repulsion.EQ.'Read') THEN
print*, 'nuclear_repulsion read from disk'
LOGICAL :: has
call ezfio_has_nuclei_nuclear_repulsion(has)
if (has) then
call ezfio_get_nuclei_nuclear_repulsion(nuclear_repulsion)
else
print *, 'nuclei/nuclear_repulsion not found in EZFIO file'
stop 1
if (mpi_master) then
call ezfio_has_nuclei_nuclear_repulsion(has)
if (has) then
call ezfio_get_nuclei_nuclear_repulsion(nuclear_repulsion)
else
print *, 'nuclei/nuclear_repulsion not found in EZFIO file'
stop 1
endif
endif
IRP_IF MPI
include 'mpif.h'
integer :: ierr
call MPI_BCAST( nuclear_repulsion, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
if (ierr /= MPI_SUCCESS) then
stop 'Unable to read nuclear_repulsion with MPI'
endif
IRP_ENDIF
ELSE
@ -169,7 +193,9 @@ BEGIN_PROVIDER [ double precision, nuclear_repulsion ]
'Nuclear repulsion energy')
IF (disk_access_nuclear_repulsion.EQ.'Write') THEN
if (mpi_master) then
call ezfio_set_nuclei_nuclear_repulsion(nuclear_repulsion)
endif
END IF
END_PROVIDER