9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-06-27 23:12:05 +02:00

Merge branch 'develop' into develop-manus

This commit is contained in:
Anthony Scemama 2019-02-21 09:33:21 +01:00 committed by GitHub
commit 2783eabec3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 185 additions and 15 deletions

View File

@ -43,6 +43,7 @@ Requirements
- `Zlib`_ - `Zlib`_
- `GNU Patch`_ - `GNU Patch`_
- |ZeroMQ| : networking library - |ZeroMQ| : networking library
- `GMP <https://gmplib.org/>`_ : Gnu Multiple Precision Arithmetic Library
- |OCaml| compiler with |OPAM| package manager - |OCaml| compiler with |OPAM| package manager
- |Ninja| : a parallel build system - |Ninja| : a parallel build system
@ -84,6 +85,7 @@ The following packages are supported by the :command:`configure` installer:
* irpf90 * irpf90
* zeromq * zeromq
* f77zmq * f77zmq
* gmp
* ocaml ( :math:`\approx` 10 minutes) * ocaml ( :math:`\approx` 10 minutes)
* ezfio * ezfio
* docopt * docopt
@ -110,11 +112,11 @@ If the :command:`configure` executable fails to install a specific dependency
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
If the :command:`configure` executable does not succeed to install a specific dependency, If the :command:`configure` executable does not succeed to install a specific dependency,
there are some proposition of how to download and install the minimal dependencies to compile and use the |QP| there are some proposition of how to download and install the minimal dependencies to compile and use the |QP|.
Before doing anything below, try to install the packages with your package manager Before doing anything below, try to install the packages with your package manager
(:command:`apt`, :command:`yum`, etc) (:command:`apt`, :command:`yum`, etc).
Ninja Ninja
@ -216,6 +218,29 @@ With Debian or Ubuntu, you can use
sudo apt install zlib1g-dev sudo apt install zlib1g-dev
GMP
---
GMP is the GNU Multiple Precision Arithmetic Library.
* Download the latest version of gmp here:
`<ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2>`_
and move it in the :file:`${QP_ROOT}/external` directory
* Extract the archive, go into the :file:`gmp-*` directory and run
the following commands
.. code:: bash
./configure --prefix=${QP_ROOT}
make
make install
With Debian or Ubuntu, you can use
.. code:: bash
sudo apt install libgmp-dev
OCaml OCaml

9
TODO
View File

@ -57,6 +57,13 @@ Doc: plugins et qp_plugins
Ajouter les symetries dans devel Ajouter les symetries dans devel
Compiler ezfio avec openmp
# Parallelize i_H_psi # Parallelize i_H_psi
IMPORTANT:
Davidson Diagonalization
------------------------
Not enough memory: aborting in davidson_diag_hjj_sjj

67
config/cray.cfg Normal file
View File

@ -0,0 +1,67 @@
# Common flags
##############
#
# -mkl=[parallel|sequential] : Use the MKL library
# --ninja : Allow the utilisation of ninja. It is mandatory !
# --align=32 : Align all provided arrays on a 32-byte boundary
#
[COMMON]
FC : ftn -dynamic -fpic
LAPACK_LIB :
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI
# For KNL, use:
#IRPF90_FLAGS : --ninja --align=64 -DMPI
# Global options
################
#
# 1 : Activate
# 0 : Deactivate
#
[OPTION]
MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 0 ; Enable cache_compile.py
OPENMP : 1 ; Append OpenMP flags
# Optimization flags
####################
#
# -xHost : Compile a binary optimized for the current architecture
# -O2 : O3 not better than O2.
# -ip : Inter-procedural optimizations
# -ftz : Flushes denormal results to zero
#
[OPT]
FCFLAGS : -xCORE-AVX2 -O2 -ip -ftz -g -traceback -qopt-prefetch=5 -qopt-prefetch-issue-excl-hint -unroll-aggressive
#
#For KNL, use:
#FCFLAGS : -xMIC-AVX512 -O2 -ip -ftz -g -traceback -qopt-prefetch=5 -qopt-prefetch-issue-excl-hint -unroll-aggressive
#
# Profiling flags
#################
#
[PROFILE]
FC : -p -g
FCFLAGS : -xSSE4.2 -O2 -ip -ftz -qopt-prefetch
# Debugging flags
#################
#
# -traceback : Activate backtrace on runtime
# -fpe0 : All floating point exaceptions
# -C : Checks uninitialized variables, array subscripts, etc...
# -g : Extra debugging information
# -xSSE2 : Valgrind needs a very simple x86 executable
#
[DEBUG]
FC : -g -traceback
FCFLAGS : -xCORE-AVX2 -C -fpe0 -traceback
# OpenMP flags
#################
#
[OPENMP]
FC : -qopenmp
IRPF90_FLAGS : --openmp

23
configure vendored
View File

@ -183,7 +183,7 @@ if [[ "${PACKAGES}.x" != ".x" ]] ; then
fi fi
if [[ ${PACKAGES} = all ]] ; then if [[ ${PACKAGES} = all ]] ; then
PACKAGES="zlib ninja irpf90 zeromq f77zmq ocaml ezfio docopt resultsFile bats" PACKAGES="zlib ninja irpf90 zeromq f77zmq gmp ocaml ezfio docopt resultsFile bats"
fi fi
@ -200,6 +200,21 @@ for PACKAGE in ${PACKAGES} ; do
EOF EOF
elif [[ ${PACKAGE} = gmp ]] ; then
download \
"ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2" \
"${QP_ROOT}"/external/gmp.tar.bz2
execute << EOF
cd "\${QP_ROOT}"/external
tar --bzip2 --extract --file gmp.tar.bz2
rm gmp.tar.bz2
cd gmp*
./configure --prefix=$QP_ROOT && make -j 8
make install
EOF
elif [[ ${PACKAGE} = irpf90 ]] ; then elif [[ ${PACKAGE} = irpf90 ]] ; then
# When changing version of irpf90, don't forget to update etc/irpf90.rc # When changing version of irpf90, don't forget to update etc/irpf90.rc
@ -388,6 +403,12 @@ if [[ ${F77ZMQ} = $(not_found) ]] ; then
fail fail
fi fi
GMP=$(find_lib -lgmp)
if [[ ${ZLIB} = $(not_found) ]] ; then
error "GMP (gmp) is not installed."
fail
fi
OPAM=$(find_exe opam) OPAM=$(find_exe opam)
if [[ ${OPAM} = $(not_found) ]] ; then if [[ ${OPAM} = $(not_found) ]] ; then
error "OPAM (ocaml) package manager is not installed." error "OPAM (ocaml) package manager is not installed."

View File

@ -35,6 +35,17 @@
%%%% PUBLISHED PAPERS %%%% PUBLISHED PAPERS
@phdthesis{yann_garniron_2019_2558127,
author = {Yann Garniron},
title = {{Development and parallel implementation of
selected configuration interaction methods}},
school = {Université de Toulouse},
year = 2019,
month = feb,
doi = {10.5281/zenodo.2558127},
url = {https://doi.org/10.5281/zenodo.2558127}
}
@article{Giner_2018, @article{Giner_2018,
doi = {10.1063/1.5052714}, doi = {10.1063/1.5052714},
url = {https://doi.org/10.1063%2F1.5052714}, url = {https://doi.org/10.1063%2F1.5052714},

View File

@ -10,10 +10,10 @@
# export QP_NTHREADS_PT2=32 # export QP_NTHREADS_PT2=32
# Number of threads for MKL # Number of threads for MKL
# exort MKL_NUM_THREADS=16 # export MKL_NUM_THREADS=16
# Number of threads for OpenMP # Number of threads for OpenMP
# exort OMP_NUM_THREADS=16 # export OMP_NUM_THREADS=16
# Name of the network interface to be chosen # Name of the network interface to be chosen
# export QP_NIC=ib0 # export QP_NIC=ib0

View File

@ -163,7 +163,7 @@ _qp_Complete()
create_ezfio) create_ezfio)
case "${prev}" in case "${prev}" in
create_ezfio) create_ezfio)
COMPREPLY=( $(compgen -W "-b -a -c -d -h -m -o -p -x" -- $cur ) ) COMPREPLY=( $(compgen -W "-b -a -c -d -h -m -o -p -x $(\ls)" -- $cur ) )
return 0 return 0
;; ;;
-m|-d|-c) -m|-d|-c)

1
ocaml/.gitignore vendored
View File

@ -9,6 +9,7 @@ Input_ao_two_e_erf_ints.ml
Input_ao_two_e_ints.ml Input_ao_two_e_ints.ml
Input_auto_generated.ml Input_auto_generated.ml
Input_becke_numerical_grid.ml Input_becke_numerical_grid.ml
Input_champ.ml
Input_davidson.ml Input_davidson.ml
Input_density_for_dft.ml Input_density_for_dft.ml
Input_determinants.ml Input_determinants.ml

View File

@ -11,7 +11,7 @@ END_PROVIDER
implicit none implicit none
logical, external :: testTeethBuilding logical, external :: testTeethBuilding
integer :: i,j integer :: i,j
pt2_n_tasks_max = elec_beta_num*elec_beta_num + elec_alpha_num*elec_beta_num - n_core_orb*2 pt2_n_tasks_max = elec_alpha_num*elec_alpha_num + elec_alpha_num*elec_beta_num - n_core_orb*2
pt2_n_tasks_max = min(pt2_n_tasks_max,1+N_det_generators/10000) pt2_n_tasks_max = min(pt2_n_tasks_max,1+N_det_generators/10000)
call write_int(6,pt2_n_tasks_max,'pt2_n_tasks_max') call write_int(6,pt2_n_tasks_max,'pt2_n_tasks_max')
@ -609,6 +609,12 @@ BEGIN_PROVIDER[ double precision, pt2_u, (N_det_generators)]
BEGIN_PROVIDER[ integer, pt2_J, (N_det_generators)] BEGIN_PROVIDER[ integer, pt2_J, (N_det_generators)]
&BEGIN_PROVIDER[ integer, pt2_R, (N_det_generators)] &BEGIN_PROVIDER[ integer, pt2_R, (N_det_generators)]
implicit none implicit none
BEGIN_DOC
! pt2_J contains the list of generators after ordering them according to the
! Monte Carlo sampling.
!
! pt2_R(i) is the number of combs drawn when determinant i is computed.
END_DOC
integer :: N_c, N_j integer :: N_c, N_j
integer :: U, t, i integer :: U, t, i
double precision :: v double precision :: v

View File

@ -286,7 +286,11 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
end if end if
end do end do
deallocate(indices) deallocate(indices)
! !$OMP CRITICAL
! print *, 'Step1: ', i_generator, preinteresting(0)
! !$OMP END CRITICAL
allocate(banned(mo_num, mo_num,2), bannedOrb(mo_num, 2)) allocate(banned(mo_num, mo_num,2), bannedOrb(mo_num, 2))
allocate (mat(N_states, mo_num, mo_num)) allocate (mat(N_states, mo_num, mo_num))
maskInd = -1 maskInd = -1
@ -485,6 +489,9 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
call spot_isinwf(mask, fullminilist, i_generator, fullinteresting(0), banned, fullMatch, fullinteresting) call spot_isinwf(mask, fullminilist, i_generator, fullinteresting(0), banned, fullMatch, fullinteresting)
if(fullMatch) cycle if(fullMatch) cycle
! !$OMP CRITICAL
! print *, 'Step3: ', i_generator, h1, interesting(0)
! !$OMP END CRITICAL
call splash_pq(mask, sp, minilist, i_generator, interesting(0), bannedOrb, banned, mat, interesting) call splash_pq(mask, sp, minilist, i_generator, interesting(0), bannedOrb, banned, mat, interesting)
@ -623,6 +630,11 @@ end
subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, interesting) subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, interesting)
use bitmasks use bitmasks
implicit none implicit none
BEGIN_DOC
! Computes the contributions A(r,s) by
! comparing the external determinant to all the internal determinants det(i).
! an applying two particles (r,s) to the mask.
END_DOC
integer, intent(in) :: sp, i_gen, N_sel integer, intent(in) :: sp, i_gen, N_sel
integer, intent(in) :: interesting(0:N_sel) integer, intent(in) :: interesting(0:N_sel)
@ -1198,6 +1210,10 @@ end
subroutine spot_isinwf(mask, det, i_gen, N, banned, fullMatch, interesting) subroutine spot_isinwf(mask, det, i_gen, N, banned, fullMatch, interesting)
use bitmasks use bitmasks
implicit none implicit none
BEGIN_DOC
! Identify the determinants in det which are in the internal space. These are
! the determinants that can be produced by creating two particles on the mask.
END_DOC
integer, intent(in) :: i_gen, N integer, intent(in) :: i_gen, N
integer, intent(in) :: interesting(0:N) integer, intent(in) :: interesting(0:N)
@ -1217,16 +1233,19 @@ subroutine spot_isinwf(mask, det, i_gen, N, banned, fullMatch, interesting)
end do end do
genl : do i=1, N genl : do i=1, N
! If det(i) can't be generated by the mask, cycle
do j=1, N_int do j=1, N_int
if(iand(det(j,1,i), mask(j,1)) /= mask(j, 1)) cycle genl if(iand(det(j,1,i), mask(j,1)) /= mask(j, 1)) cycle genl
if(iand(det(j,2,i), mask(j,2)) /= mask(j, 2)) cycle genl if(iand(det(j,2,i), mask(j,2)) /= mask(j, 2)) cycle genl
end do end do
! If det(i) < det(i_gen), it hs already been considered
if(interesting(i) < i_gen) then if(interesting(i) < i_gen) then
fullMatch = .true. fullMatch = .true.
return return
end if end if
! Identify the particles
do j=1, N_int do j=1, N_int
myMask(j, 1) = iand(det(j, 1, i), negMask(j, 1)) myMask(j, 1) = iand(det(j, 1, i), negMask(j, 1))
myMask(j, 2) = iand(det(j, 2, i), negMask(j, 2)) myMask(j, 2) = iand(det(j, 2, i), negMask(j, 2))

View File

@ -29,7 +29,7 @@ subroutine run_stochastic_cipsi
pt2 = -huge(1.e0) pt2 = -huge(1.e0)
rpt2 = -huge(1.e0) rpt2 = -huge(1.e0)
norm = 0.d0 norm = 0.d0
variance = 0.d0 variance = huge(1.e0)
if (s2_eig) then if (s2_eig) then
call make_s2_eigenfunction call make_s2_eigenfunction
@ -64,6 +64,7 @@ subroutine run_stochastic_cipsi
do while ( & do while ( &
(N_det < N_det_max) .and. & (N_det < N_det_max) .and. &
(maxval(abs(pt2(1:N_states))) > pt2_max) .and. & (maxval(abs(pt2(1:N_states))) > pt2_max) .and. &
(maxval(abs(variance(1:N_states))) > variance_max) .and. &
(correlation_energy_ratio <= correlation_energy_ratio_max) & (correlation_energy_ratio <= correlation_energy_ratio_max) &
) )
write(*,'(A)') '--------------------------------------------------------------------------------' write(*,'(A)') '--------------------------------------------------------------------------------'

View File

@ -90,7 +90,7 @@ subroutine ZMQ_selection(N_in, pt2, variance, norm)
mem = 8.d0 * N_det * (N_int * 2.d0 * 3.d0 + 3.d0 + 5.d0) / (1024.d0**3) mem = 8.d0 * N_det * (N_int * 2.d0 * 3.d0 + 3.d0 + 5.d0) / (1024.d0**3)
call write_double(6,mem,'Estimated memory/thread (Gb)') call write_double(6,mem,'Estimated memory/thread (Gb)')
if (qp_max_mem > 0) then if (qp_max_mem > 0) then
nproc_target = max(1,int(dble(qp_max_mem)/mem)) nproc_target = max(1,int(dble(qp_max_mem)/(0.1d0 + mem)))
nproc_target = min(nproc_target,nproc) nproc_target = min(nproc_target,nproc)
endif endif

View File

@ -4,7 +4,7 @@
use map_module use map_module
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Alpha Fock matrix in AO basis set ! Alpha and Beta Fock matrices in AO basis set
END_DOC END_DOC
integer :: i,j,k,l,k1,r,s integer :: i,j,k,l,k1,r,s

View File

@ -20,9 +20,15 @@ subroutine save_iterations(e_, pt2_,n_)
END_DOC END_DOC
integer, intent(in) :: n_ integer, intent(in) :: n_
double precision, intent(in) :: e_(N_states), pt2_(N_states) double precision, intent(in) :: e_(N_states), pt2_(N_states)
integer :: i
if (N_iter > 100) then if (N_iter == 101) then
return do i=2,N_iter-1
energy_iterations(1:N_states,N_iter-1) = energy_iterations(1:N_states,N_iter)
pt2_iterations(1:N_states,N_iter-1) = pt2_iterations(1:N_states,N_iter)
enddo
N_iter = N_iter-1
TOUCH N_iter
endif endif
energy_iterations(1:N_states,N_iter) = e_(1:N_states) energy_iterations(1:N_states,N_iter) = e_(1:N_states)

View File

@ -10,6 +10,12 @@ doc: The selection process stops when the largest |PT2| (for all the state) is l
interface: ezfio,provider,ocaml interface: ezfio,provider,ocaml
default: 0.0001 default: 0.0001
[variance_max]
type: Positive_float
doc: The selection process stops when the largest variance (for all the state) is lower than `variance_max` in absolute value
interface: ezfio,provider,ocaml
default: 0.0
[pt2_relative_error] [pt2_relative_error]
type: Normalized_float type: Normalized_float
doc: Stop stochastic |PT2| when the relative error is smaller than `pT2_relative_error` doc: Stop stochastic |PT2| when the relative error is smaller than `pT2_relative_error`

View File

@ -1,7 +1,7 @@
BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num,mo_num) ] BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num,mo_num) ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Eigenvector of the Fock matrix in the MO basis obtained with level shift. ! Eigenvectors of the Fock matrix in the MO basis obtained with level shift.
END_DOC END_DOC
integer :: i,j integer :: i,j