mirror of
https://github.com/LCPQ/quantum_package
synced 2024-09-16 17:35:42 +02:00
Introduced MPI for EZFIO accesses
This commit is contained in:
parent
6b0b988ee8
commit
1a5a4d5ff2
@ -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(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket
|
||||||
integer, intent(in) :: worker_id
|
integer, intent(in) :: worker_id
|
||||||
integer :: rc
|
integer :: rc
|
||||||
character*(64) :: msg
|
character*(256) :: msg
|
||||||
|
|
||||||
write(msg,'(A8,1X,I8,1X,A230)') 'get_data', worker_id, '$X'
|
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)
|
rc = f77_zmq_send(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),0)
|
||||||
|
@ -22,6 +22,7 @@ BEGIN_PROVIDER [ %(type)s, %(name)s %(size)s ]
|
|||||||
|
|
||||||
logical :: has
|
logical :: has
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
if (mpi_master) then
|
||||||
%(test_null_size)s
|
%(test_null_size)s
|
||||||
call ezfio_has_%(ezfio_dir)s_%(ezfio_name)s(has)
|
call ezfio_has_%(ezfio_dir)s_%(ezfio_name)s(has)
|
||||||
if (has) then
|
if (has) then
|
||||||
@ -30,6 +31,15 @@ BEGIN_PROVIDER [ %(type)s, %(name)s %(size)s ]
|
|||||||
print *, '%(ezfio_dir)s/%(ezfio_name)s not found in EZFIO file'
|
print *, '%(ezfio_dir)s/%(ezfio_name)s not found in EZFIO file'
|
||||||
stop 1
|
stop 1
|
||||||
endif
|
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
|
%(write)s
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
""".strip()
|
""".strip()
|
||||||
@ -38,6 +48,12 @@ END_PROVIDER
|
|||||||
"logical": "write_bool",
|
"logical": "write_bool",
|
||||||
"double precision": "write_double"}
|
"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):
|
def __init__(self):
|
||||||
self.values = "type doc name ezfio_dir ezfio_name write output".split()
|
self.values = "type doc name ezfio_dir ezfio_name write output".split()
|
||||||
for v in self.values:
|
for v in self.values:
|
||||||
@ -66,10 +82,11 @@ END_PROVIDER
|
|||||||
|
|
||||||
def set_write(self):
|
def set_write(self):
|
||||||
self.write = ""
|
self.write = ""
|
||||||
|
self.type_mpi = self.mpi_correspondance[self.type]
|
||||||
if "size" in self.__dict__:
|
if "size" in self.__dict__:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if self.type in self.write_correspondance:
|
if self.type in self.mpi_correspondance:
|
||||||
write = self.write_correspondance[self.type]
|
write = self.write_correspondance[self.type]
|
||||||
output = self.output
|
output = self.output
|
||||||
name = self.name
|
name = self.name
|
||||||
@ -101,7 +118,9 @@ END_PROVIDER
|
|||||||
self.output = t
|
self.output = t
|
||||||
|
|
||||||
def set_size(self, 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":
|
if t != "1":
|
||||||
self.size = ", " + t
|
self.size = ", " + t
|
||||||
else:
|
else:
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
BEGIN_PROVIDER [ integer, ao_prim_num_max ]
|
BEGIN_PROVIDER [ integer, ao_prim_num_max ]
|
||||||
implicit none
|
implicit none
|
||||||
ao_prim_num_max = 0
|
BEGIN_DOC
|
||||||
PROVIDE ezfio_filename
|
! max number of primitives
|
||||||
call ezfio_get_ao_basis_ao_prim_num_max(ao_prim_num_max)
|
END_DOC
|
||||||
|
ao_prim_num_max = maxval(ao_prim_num)
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
BEGIN_PROVIDER [ double precision, ao_coef_normalized, (ao_num,ao_prim_num_max) ]
|
BEGIN_PROVIDER [ double precision, ao_coef_normalized, (ao_num,ao_prim_num_max) ]
|
||||||
|
@ -102,6 +102,7 @@ BEGIN_PROVIDER [ integer, N_generators_bitmask ]
|
|||||||
logical :: exists
|
logical :: exists
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
|
||||||
|
if (mpi_master) then
|
||||||
call ezfio_has_bitmasks_N_mask_gen(exists)
|
call ezfio_has_bitmasks_N_mask_gen(exists)
|
||||||
if (exists) then
|
if (exists) then
|
||||||
call ezfio_get_bitmasks_N_mask_gen(N_generators_bitmask)
|
call ezfio_get_bitmasks_N_mask_gen(N_generators_bitmask)
|
||||||
@ -121,6 +122,24 @@ BEGIN_PROVIDER [ integer, N_generators_bitmask ]
|
|||||||
N_generators_bitmask = 1
|
N_generators_bitmask = 1
|
||||||
endif
|
endif
|
||||||
ASSERT (N_generators_bitmask > 0)
|
ASSERT (N_generators_bitmask > 0)
|
||||||
|
endif
|
||||||
|
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
|
END_PROVIDER
|
||||||
|
|
||||||
@ -133,6 +152,7 @@ BEGIN_PROVIDER [ integer, N_generators_bitmask_restart ]
|
|||||||
logical :: exists
|
logical :: exists
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
|
||||||
|
if (mpi_master) then
|
||||||
call ezfio_has_bitmasks_N_mask_gen(exists)
|
call ezfio_has_bitmasks_N_mask_gen(exists)
|
||||||
if (exists) then
|
if (exists) then
|
||||||
call ezfio_get_bitmasks_N_mask_gen(N_generators_bitmask_restart)
|
call ezfio_get_bitmasks_N_mask_gen(N_generators_bitmask_restart)
|
||||||
@ -152,6 +172,20 @@ BEGIN_PROVIDER [ integer, N_generators_bitmask_restart ]
|
|||||||
N_generators_bitmask_restart = 1
|
N_generators_bitmask_restart = 1
|
||||||
endif
|
endif
|
||||||
ASSERT (N_generators_bitmask_restart > 0)
|
ASSERT (N_generators_bitmask_restart > 0)
|
||||||
|
endif
|
||||||
|
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
|
END_PROVIDER
|
||||||
|
|
||||||
@ -182,6 +216,7 @@ BEGIN_PROVIDER [ integer(bit_kind), generators_bitmask_restart, (N_int,2,6,N_gen
|
|||||||
logical :: exists
|
logical :: exists
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
|
||||||
|
if (mpi_master) then
|
||||||
call ezfio_has_bitmasks_generators(exists)
|
call ezfio_has_bitmasks_generators(exists)
|
||||||
if (exists) then
|
if (exists) then
|
||||||
call ezfio_get_bitmasks_generators(generators_bitmask_restart)
|
call ezfio_get_bitmasks_generators(generators_bitmask_restart)
|
||||||
@ -214,6 +249,16 @@ BEGIN_PROVIDER [ integer(bit_kind), generators_bitmask_restart, (N_int,2,6,N_gen
|
|||||||
enddo
|
enddo
|
||||||
enddo
|
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
|
||||||
|
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
||||||
@ -241,6 +286,7 @@ BEGIN_PROVIDER [ integer(bit_kind), generators_bitmask, (N_int,2,6,N_generators_
|
|||||||
logical :: exists
|
logical :: exists
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
|
||||||
|
if (mpi_master) then
|
||||||
call ezfio_has_bitmasks_generators(exists)
|
call ezfio_has_bitmasks_generators(exists)
|
||||||
if (exists) then
|
if (exists) then
|
||||||
call ezfio_get_bitmasks_generators(generators_bitmask)
|
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
|
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
|
END_PROVIDER
|
||||||
|
|
||||||
BEGIN_PROVIDER [ integer, N_cas_bitmask ]
|
BEGIN_PROVIDER [ integer, N_cas_bitmask ]
|
||||||
@ -282,6 +338,7 @@ BEGIN_PROVIDER [ integer, N_cas_bitmask ]
|
|||||||
logical :: exists
|
logical :: exists
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
|
||||||
|
if (mpi_master) then
|
||||||
call ezfio_has_bitmasks_N_mask_cas(exists)
|
call ezfio_has_bitmasks_N_mask_cas(exists)
|
||||||
if (exists) then
|
if (exists) then
|
||||||
call ezfio_get_bitmasks_N_mask_cas(N_cas_bitmask)
|
call ezfio_get_bitmasks_N_mask_cas(N_cas_bitmask)
|
||||||
@ -300,7 +357,16 @@ BEGIN_PROVIDER [ integer, N_cas_bitmask ]
|
|||||||
else
|
else
|
||||||
N_cas_bitmask = 1
|
N_cas_bitmask = 1
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
ASSERT (N_cas_bitmask > 0)
|
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
|
END_PROVIDER
|
||||||
|
|
||||||
@ -313,6 +379,7 @@ BEGIN_PROVIDER [ integer(bit_kind), cas_bitmask, (N_int,2,N_cas_bitmask) ]
|
|||||||
integer :: i,i_part,i_gen,j,k
|
integer :: i,i_part,i_gen,j,k
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
|
||||||
|
if (mpi_master) then
|
||||||
call ezfio_has_bitmasks_cas(exists)
|
call ezfio_has_bitmasks_cas(exists)
|
||||||
if (exists) then
|
if (exists) then
|
||||||
call ezfio_get_bitmasks_cas(cas_bitmask)
|
call ezfio_get_bitmasks_cas(cas_bitmask)
|
||||||
@ -342,6 +409,16 @@ BEGIN_PROVIDER [ integer(bit_kind), cas_bitmask, (N_int,2,N_cas_bitmask) ]
|
|||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
endif
|
||||||
|
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
|
END_PROVIDER
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ BEGIN_PROVIDER [ integer, N_det ]
|
|||||||
character*(64) :: label
|
character*(64) :: label
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
PROVIDE nproc
|
PROVIDE nproc
|
||||||
|
if (mpi_master) then
|
||||||
if (read_wf) then
|
if (read_wf) then
|
||||||
call ezfio_has_determinants_n_det(exists)
|
call ezfio_has_determinants_n_det(exists)
|
||||||
if (exists) then
|
if (exists) then
|
||||||
@ -43,6 +44,16 @@ BEGIN_PROVIDER [ integer, N_det ]
|
|||||||
else
|
else
|
||||||
N_det = 1
|
N_det = 1
|
||||||
endif
|
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')
|
call write_int(output_determinants,N_det,'Number of determinants')
|
||||||
ASSERT (N_det > 0)
|
ASSERT (N_det > 0)
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
@ -69,6 +80,7 @@ BEGIN_PROVIDER [ integer, psi_det_size ]
|
|||||||
END_DOC
|
END_DOC
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
logical :: exists
|
logical :: exists
|
||||||
|
if (mpi_master) then
|
||||||
call ezfio_has_determinants_n_det(exists)
|
call ezfio_has_determinants_n_det(exists)
|
||||||
if (exists) then
|
if (exists) then
|
||||||
call ezfio_get_determinants_n_det(psi_det_size)
|
call ezfio_get_determinants_n_det(psi_det_size)
|
||||||
@ -77,6 +89,16 @@ BEGIN_PROVIDER [ integer, psi_det_size ]
|
|||||||
endif
|
endif
|
||||||
psi_det_size = max(psi_det_size,100000)
|
psi_det_size = max(psi_det_size,100000)
|
||||||
call write_int(output_determinants,psi_det_size,'Dimension of the psi arrays')
|
call write_int(output_determinants,psi_det_size,'Dimension of the psi arrays')
|
||||||
|
endif
|
||||||
|
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
|
END_PROVIDER
|
||||||
|
|
||||||
@ -91,6 +113,7 @@ BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ]
|
|||||||
character*(64) :: label
|
character*(64) :: label
|
||||||
|
|
||||||
psi_det = 0_bit_kind
|
psi_det = 0_bit_kind
|
||||||
|
if (mpi_master) then
|
||||||
if (read_wf) then
|
if (read_wf) then
|
||||||
call ezfio_has_determinants_N_int(exists)
|
call ezfio_has_determinants_N_int(exists)
|
||||||
if (exists) then
|
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)
|
psi_det(i,2,1) = HF_bitmask(i,2)
|
||||||
enddo
|
enddo
|
||||||
endif
|
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
|
END_PROVIDER
|
||||||
|
|
||||||
@ -146,6 +179,7 @@ BEGIN_PROVIDER [ double precision, psi_coef, (psi_det_size,N_states) ]
|
|||||||
double precision, allocatable :: psi_coef_read(:,:)
|
double precision, allocatable :: psi_coef_read(:,:)
|
||||||
character*(64) :: label
|
character*(64) :: label
|
||||||
|
|
||||||
|
if (mpi_master) then
|
||||||
psi_coef = 0.d0
|
psi_coef = 0.d0
|
||||||
do i=1,min(N_states,psi_det_size)
|
do i=1,min(N_states,psi_det_size)
|
||||||
psi_coef(i,i) = 1.d0
|
psi_coef(i,i) = 1.d0
|
||||||
@ -175,6 +209,16 @@ BEGIN_PROVIDER [ double precision, psi_coef, (psi_det_size,N_states) ]
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
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
|
END_PROVIDER
|
||||||
@ -444,7 +488,9 @@ subroutine save_wavefunction
|
|||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
! Save the wave function into the EZFIO file
|
! Save the wave function into the EZFIO file
|
||||||
END_DOC
|
END_DOC
|
||||||
|
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)
|
call save_wavefunction_general(N_det,min(N_states,N_det),psi_det_sorted,size(psi_coef_sorted,1),psi_coef_sorted)
|
||||||
|
endif
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -454,7 +500,9 @@ subroutine save_wavefunction_unsorted
|
|||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
! Save the wave function into the EZFIO file
|
! Save the wave function into the EZFIO file
|
||||||
END_DOC
|
END_DOC
|
||||||
|
if (mpi_master) then
|
||||||
call save_wavefunction_general(N_det,min(N_states,N_det),psi_det,size(psi_coef,1),psi_coef)
|
call save_wavefunction_general(N_det,min(N_states,N_det),psi_det,size(psi_coef,1),psi_coef)
|
||||||
|
endif
|
||||||
end
|
end
|
||||||
|
|
||||||
subroutine save_wavefunction_general(ndet,nstates,psidet,dim_psicoef,psicoef)
|
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
|
integer :: i,j,k
|
||||||
|
|
||||||
|
if (mpi_master) then
|
||||||
call ezfio_set_determinants_N_int(N_int)
|
call ezfio_set_determinants_N_int(N_int)
|
||||||
call ezfio_set_determinants_bit_kind(bit_kind)
|
call ezfio_set_determinants_bit_kind(bit_kind)
|
||||||
call ezfio_set_determinants_N_det(ndet)
|
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)
|
call ezfio_set_determinants_psi_coef(psi_coef_save)
|
||||||
deallocate (psi_coef_save)
|
deallocate (psi_coef_save)
|
||||||
call write_int(output_determinants,ndet,'Saved determinants')
|
call write_int(output_determinants,ndet,'Saved determinants')
|
||||||
|
endif
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ subroutine occ_pattern_to_dets_size(o,sze,n_alpha,Nint)
|
|||||||
amax -= popcnt( o(k,2) )
|
amax -= popcnt( o(k,2) )
|
||||||
enddo
|
enddo
|
||||||
sze = int( min(binom_func(bmax, amax), 1.d8) )
|
sze = int( min(binom_func(bmax, amax), 1.d8) )
|
||||||
sze = 2*sze*sze + 16
|
sze = 2*sze*sze + 64
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ subroutine make_s2_eigenfunction
|
|||||||
!$OMP PRIVATE(s,ithread, d, det_buffer, smax, N_det_new,i,j,k)
|
!$OMP PRIVATE(s,ithread, d, det_buffer, smax, N_det_new,i,j,k)
|
||||||
N_det_new = 0
|
N_det_new = 0
|
||||||
call occ_pattern_to_dets_size(psi_occ_pattern(1,1,1),s,elec_alpha_num,N_int)
|
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
|
smax = s
|
||||||
ithread=0
|
ithread=0
|
||||||
!$ ithread = omp_get_thread_num()
|
!$ ithread = omp_get_thread_num()
|
||||||
@ -274,7 +274,7 @@ subroutine make_s2_eigenfunction
|
|||||||
s += 1
|
s += 1
|
||||||
if (s > smax) then
|
if (s > smax) then
|
||||||
deallocate(d)
|
deallocate(d)
|
||||||
allocate ( d(N_int,2,s+16) )
|
allocate ( d(N_int,2,s+64) )
|
||||||
smax = s
|
smax = s
|
||||||
endif
|
endif
|
||||||
call occ_pattern_to_dets(psi_occ_pattern(1,1,i),d,s,elec_alpha_num,N_int)
|
call occ_pattern_to_dets(psi_occ_pattern(1,1,i),d,s,elec_alpha_num,N_int)
|
||||||
|
@ -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(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket
|
||||||
integer, intent(in) :: worker_id
|
integer, intent(in) :: worker_id
|
||||||
integer :: rc
|
integer :: rc
|
||||||
character*(64) :: msg
|
character*(256) :: msg
|
||||||
|
|
||||||
write(msg,'(A8,1X,I8,1X,A230)') 'get_data', worker_id, '$X'
|
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)
|
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
|
END_DOC
|
||||||
integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket
|
integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket
|
||||||
integer, intent(in) :: worker_id
|
integer, intent(in) :: worker_id
|
||||||
character*(64) :: msg
|
|
||||||
|
|
||||||
call zmq_get_N_states(zmq_to_qp_run_socket, worker_id)
|
call zmq_get_N_states(zmq_to_qp_run_socket, worker_id)
|
||||||
call zmq_get_N_det(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, intent(in) :: worker_id
|
||||||
integer :: rc
|
integer :: rc
|
||||||
integer*8 :: rc8
|
integer*8 :: rc8
|
||||||
character*(64) :: msg
|
character*(256) :: msg
|
||||||
|
|
||||||
|
|
||||||
write(msg,'(A8,1X,I8,1X,A230)') 'get_data', worker_id, 'psi_det'
|
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, intent(in) :: worker_id
|
||||||
integer :: rc
|
integer :: rc
|
||||||
integer*8 :: rc8
|
integer*8 :: rc8
|
||||||
character*(64) :: msg
|
character*(256) :: msg
|
||||||
|
|
||||||
|
|
||||||
write(msg,'(A8,1X,I8,1X,A230)') 'get_data', worker_id, 'psi_coef'
|
write(msg,'(A8,1X,I8,1X,A230)') 'get_data', worker_id, 'psi_coef'
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
END_DOC
|
END_DOC
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
|
||||||
call ezfio_get_electrons_elec_num(elec_num)
|
|
||||||
elec_num_tab(1) = elec_alpha_num
|
elec_num_tab(1) = elec_alpha_num
|
||||||
elec_num_tab(2) = elec_beta_num
|
elec_num_tab(2) = elec_beta_num
|
||||||
|
elec_num = elec_alpha_num+elec_beta_num
|
||||||
|
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ BEGIN_PROVIDER [ logical, ao_bielec_integrals_in_map ]
|
|||||||
|
|
||||||
ao_bielec_integrals_in_map = .True.
|
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 ezfio_set_work_empty(.False.)
|
||||||
call map_save_to_disk(trim(ezfio_filename)//'/work/ao_ints',ao_integrals_map)
|
call map_save_to_disk(trim(ezfio_filename)//'/work/ao_ints',ao_integrals_map)
|
||||||
call ezfio_set_integrals_bielec_disk_access_ao_integrals("Read")
|
call ezfio_set_integrals_bielec_disk_access_ao_integrals("Read")
|
||||||
|
@ -599,6 +599,9 @@ subroutine dump_$ao_integrals(filename)
|
|||||||
integer(cache_key_kind), pointer :: key(:)
|
integer(cache_key_kind), pointer :: key(:)
|
||||||
real(integral_kind), pointer :: val(:)
|
real(integral_kind), pointer :: val(:)
|
||||||
integer*8 :: i,j, n
|
integer*8 :: i,j, n
|
||||||
|
if (.not.mpi_master) then
|
||||||
|
return
|
||||||
|
endif
|
||||||
call ezfio_set_work_empty(.False.)
|
call ezfio_set_work_empty(.False.)
|
||||||
open(unit=66,file=filename,FORM='unformatted')
|
open(unit=66,file=filename,FORM='unformatted')
|
||||||
write(66) integral_kind, key_kind
|
write(66) integral_kind, key_kind
|
||||||
|
@ -134,7 +134,7 @@ BEGIN_PROVIDER [ logical, mo_bielec_integrals_in_map ]
|
|||||||
|
|
||||||
print*,'Molecular integrals provided'
|
print*,'Molecular integrals provided'
|
||||||
endif
|
endif
|
||||||
if (write_mo_integrals) then
|
if (write_mo_integrals.and.mpi_master) then
|
||||||
call ezfio_set_work_empty(.False.)
|
call ezfio_set_work_empty(.False.)
|
||||||
call map_save_to_disk(trim(ezfio_filename)//'/work/mo_ints',mo_integrals_map)
|
call map_save_to_disk(trim(ezfio_filename)//'/work/mo_ints',mo_integrals_map)
|
||||||
call ezfio_set_integrals_bielec_disk_access_mo_integrals("Read")
|
call ezfio_set_integrals_bielec_disk_access_mo_integrals("Read")
|
||||||
|
@ -1,18 +1,32 @@
|
|||||||
BEGIN_PROVIDER [ integer, mo_tot_num ]
|
BEGIN_PROVIDER [ integer, mo_tot_num ]
|
||||||
implicit none
|
implicit none
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
! Total number of molecular orbitals and the size of the keys corresponding
|
! Number of MOs
|
||||||
END_DOC
|
END_DOC
|
||||||
|
|
||||||
|
logical :: has
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
logical :: exists
|
if (mpi_master) then
|
||||||
call ezfio_has_mo_basis_mo_tot_num(exists)
|
call ezfio_has_mo_basis_mo_tot_num(has)
|
||||||
if (exists) then
|
if (has) then
|
||||||
call ezfio_get_mo_basis_mo_tot_num(mo_tot_num)
|
|
||||||
else
|
|
||||||
mo_tot_num = ao_ortho_canonical_num
|
mo_tot_num = ao_ortho_canonical_num
|
||||||
|
else
|
||||||
|
print *, 'mo_basis/mo_tot_num not found in EZFIO file'
|
||||||
|
stop 1
|
||||||
endif
|
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')
|
call write_int(6,mo_tot_num,'mo_tot_num')
|
||||||
ASSERT (mo_tot_num > 0)
|
ASSERT (mo_tot_num > 0)
|
||||||
|
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
||||||
@ -29,6 +43,7 @@ BEGIN_PROVIDER [ double precision, mo_coef, (ao_num,mo_tot_num) ]
|
|||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
|
||||||
|
|
||||||
|
if (mpi_master) then
|
||||||
! Coefs
|
! Coefs
|
||||||
call ezfio_has_mo_basis_mo_coef(exists)
|
call ezfio_has_mo_basis_mo_coef(exists)
|
||||||
if (exists) then
|
if (exists) then
|
||||||
@ -41,6 +56,16 @@ BEGIN_PROVIDER [ double precision, mo_coef, (ao_num,mo_tot_num) ]
|
|||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
endif
|
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
|
END_PROVIDER
|
||||||
|
|
||||||
BEGIN_PROVIDER [ double precision, mo_coef_in_ao_ortho_basis, (ao_num, mo_tot_num) ]
|
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
|
logical :: exists
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
if (mpi_master) then
|
||||||
call ezfio_has_mo_basis_mo_label(exists)
|
call ezfio_has_mo_basis_mo_label(exists)
|
||||||
if (exists) then
|
if (exists) then
|
||||||
call ezfio_get_mo_basis_mo_label(mo_label)
|
call ezfio_get_mo_basis_mo_label(mo_label)
|
||||||
else
|
else
|
||||||
mo_label = 'no_label'
|
mo_label = 'no_label'
|
||||||
endif
|
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
|
END_PROVIDER
|
||||||
|
|
||||||
BEGIN_PROVIDER [ double precision, mo_coef_transp, (mo_tot_num,ao_num) ]
|
BEGIN_PROVIDER [ double precision, mo_coef_transp, (mo_tot_num,ao_num) ]
|
||||||
@ -109,6 +145,7 @@ BEGIN_PROVIDER [ double precision, mo_occ, (mo_tot_num) ]
|
|||||||
! MO occupation numbers
|
! MO occupation numbers
|
||||||
END_DOC
|
END_DOC
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
if (mpi_master) then
|
||||||
logical :: exists
|
logical :: exists
|
||||||
call ezfio_has_mo_basis_mo_occ(exists)
|
call ezfio_has_mo_basis_mo_occ(exists)
|
||||||
if (exists) then
|
if (exists) then
|
||||||
@ -123,6 +160,16 @@ BEGIN_PROVIDER [ double precision, mo_occ, (mo_tot_num) ]
|
|||||||
mo_occ(i) = 1.d0
|
mo_occ(i) = 1.d0
|
||||||
enddo
|
enddo
|
||||||
endif
|
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
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Utils
|
|
||||||
|
@ -6,6 +6,7 @@ BEGIN_PROVIDER [ double precision, nucl_coord, (nucl_num,3) ]
|
|||||||
END_DOC
|
END_DOC
|
||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
|
|
||||||
|
if (mpi_master) then
|
||||||
double precision, allocatable :: buffer(:,:)
|
double precision, allocatable :: buffer(:,:)
|
||||||
nucl_coord = 0.d0
|
nucl_coord = 0.d0
|
||||||
allocate (buffer(nucl_num,3))
|
allocate (buffer(nucl_num,3))
|
||||||
@ -29,6 +30,18 @@ BEGIN_PROVIDER [ double precision, nucl_coord, (nucl_num,3) ]
|
|||||||
character*(64), parameter :: f = '(A16, 4(1X,F12.6))'
|
character*(64), parameter :: f = '(A16, 4(1X,F12.6))'
|
||||||
character*(64), parameter :: ft= '(A16, 4(1X,A12 ))'
|
character*(64), parameter :: ft= '(A16, 4(1X,A12 ))'
|
||||||
double precision, parameter :: a0= 0.529177249d0
|
double precision, parameter :: a0= 0.529177249d0
|
||||||
|
endif
|
||||||
|
|
||||||
|
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)
|
call write_time(output_Nuclei)
|
||||||
write(output_Nuclei,'(A)') ''
|
write(output_Nuclei,'(A)') ''
|
||||||
write(output_Nuclei,'(A)') 'Nuclear Coordinates (Angstroms)'
|
write(output_Nuclei,'(A)') 'Nuclear Coordinates (Angstroms)'
|
||||||
@ -135,6 +148,7 @@ BEGIN_PROVIDER [ double precision, nuclear_repulsion ]
|
|||||||
IF (disk_access_nuclear_repulsion.EQ.'Read') THEN
|
IF (disk_access_nuclear_repulsion.EQ.'Read') THEN
|
||||||
print*, 'nuclear_repulsion read from disk'
|
print*, 'nuclear_repulsion read from disk'
|
||||||
LOGICAL :: has
|
LOGICAL :: has
|
||||||
|
if (mpi_master) then
|
||||||
call ezfio_has_nuclei_nuclear_repulsion(has)
|
call ezfio_has_nuclei_nuclear_repulsion(has)
|
||||||
if (has) then
|
if (has) then
|
||||||
call ezfio_get_nuclei_nuclear_repulsion(nuclear_repulsion)
|
call ezfio_get_nuclei_nuclear_repulsion(nuclear_repulsion)
|
||||||
@ -142,6 +156,16 @@ BEGIN_PROVIDER [ double precision, nuclear_repulsion ]
|
|||||||
print *, 'nuclei/nuclear_repulsion not found in EZFIO file'
|
print *, 'nuclei/nuclear_repulsion not found in EZFIO file'
|
||||||
stop 1
|
stop 1
|
||||||
endif
|
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
|
ELSE
|
||||||
|
|
||||||
@ -169,7 +193,9 @@ BEGIN_PROVIDER [ double precision, nuclear_repulsion ]
|
|||||||
'Nuclear repulsion energy')
|
'Nuclear repulsion energy')
|
||||||
|
|
||||||
IF (disk_access_nuclear_repulsion.EQ.'Write') THEN
|
IF (disk_access_nuclear_repulsion.EQ.'Write') THEN
|
||||||
|
if (mpi_master) then
|
||||||
call ezfio_set_nuclei_nuclear_repulsion(nuclear_repulsion)
|
call ezfio_set_nuclei_nuclear_repulsion(nuclear_repulsion)
|
||||||
|
endif
|
||||||
END IF
|
END IF
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user