From 8a5026af683acef49678f7e7de23d112a8c42728 Mon Sep 17 00:00:00 2001 From: eginer Date: Sun, 23 Oct 2022 20:51:33 +0200 Subject: [PATCH] added davidson_keywords --- src/davidson_keywords/EZFIO.cfg | 54 +++++++++++++++++++++++++++++++ src/davidson_keywords/NEED | 1 + src/davidson_keywords/README.rst | 4 +++ src/davidson_keywords/input.irp.f | 43 ++++++++++++++++++++++++ src/davidson_keywords/usef.irp.f | 33 +++++++++++++++++++ 5 files changed, 135 insertions(+) create mode 100644 src/davidson_keywords/EZFIO.cfg create mode 100644 src/davidson_keywords/NEED create mode 100644 src/davidson_keywords/README.rst create mode 100644 src/davidson_keywords/input.irp.f create mode 100644 src/davidson_keywords/usef.irp.f diff --git a/src/davidson_keywords/EZFIO.cfg b/src/davidson_keywords/EZFIO.cfg new file mode 100644 index 00000000..5df761f3 --- /dev/null +++ b/src/davidson_keywords/EZFIO.cfg @@ -0,0 +1,54 @@ +[threshold_davidson] +type: Threshold +doc: Thresholds of Davidson's algorithm if threshold_davidson_from_pt2 is false. +interface: ezfio,provider,ocaml +default: 1.e-10 + +[threshold_nonsym_davidson] +type: Threshold +doc: Thresholds of non-symetric Davidson's algorithm +interface: ezfio,provider,ocaml +default: 1.e-12 + +[davidson_sze_max] +type: Strictly_positive_int +doc: Number of micro-iterations before re-contracting +default: 15 +interface: ezfio,provider,ocaml + +[state_following] +type: logical +doc: If |true|, the states are re-ordered to match the input states +default: False +interface: ezfio,provider,ocaml + +[disk_based_davidson] +type: logical +doc: If |true|, a memory-mapped file may be used to store the W and S2 vectors if not enough RAM is availabl +default: True +interface: ezfio,provider,ocaml + +[n_states_diag] +type: States_number +doc: Controls the number of states to consider during the Davdison diagonalization. The number of states is n_states * n_states_diag +default: 4 +interface: ezfio,ocaml + +[n_det_max_full] +type: Det_number_max +doc: Maximum number of determinants where |H| is fully diagonalized +interface: ezfio,provider,ocaml +default: 1000 + +[threshold_davidson_from_pt2] +type: logical +doc: Thresholds of Davidson's algorithm is set to E(rPT2)*threshold_davidson_from_pt2 +interface: ezfio,provider,ocaml +default: false + +[distributed_davidson] +type: logical +doc: If |true|, use the distributed algorithm +default: True +interface: ezfio,provider,ocaml + diff --git a/src/davidson_keywords/NEED b/src/davidson_keywords/NEED new file mode 100644 index 00000000..5a3182ed --- /dev/null +++ b/src/davidson_keywords/NEED @@ -0,0 +1 @@ +ezfio_files diff --git a/src/davidson_keywords/README.rst b/src/davidson_keywords/README.rst new file mode 100644 index 00000000..cdc7cc1f --- /dev/null +++ b/src/davidson_keywords/README.rst @@ -0,0 +1,4 @@ +================= +davidson_keywords +================= + diff --git a/src/davidson_keywords/input.irp.f b/src/davidson_keywords/input.irp.f new file mode 100644 index 00000000..4bd79036 --- /dev/null +++ b/src/davidson_keywords/input.irp.f @@ -0,0 +1,43 @@ + +! --- + +BEGIN_PROVIDER [ integer, n_states_diag ] + implicit none + BEGIN_DOC +! Number of states to consider during the Davdison diagonalization + END_DOC + + logical :: has + PROVIDE ezfio_filename + if (mpi_master) then + + call ezfio_has_davidson_keywords_n_states_diag(has) + if (has) then + call ezfio_get_davidson_keywords_n_states_diag(n_states_diag) + else + print *, 'davidson_keywords/n_states_diag not found in EZFIO file' + stop 1 + endif + n_states_diag = max(2,N_states * N_states_diag) + endif + IRP_IF MPI_DEBUG + print *, irp_here, mpi_rank + call MPI_BARRIER(MPI_COMM_WORLD, ierr) + IRP_ENDIF + IRP_IF MPI + include 'mpif.h' + integer :: ierr + call MPI_BCAST( n_states_diag, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + stop 'Unable to read n_states_diag with MPI' + endif + IRP_ENDIF + + call write_time(6) + if (mpi_master) then + write(6, *) 'Read n_states_diag' + endif + +END_PROVIDER + +! --- diff --git a/src/davidson_keywords/usef.irp.f b/src/davidson_keywords/usef.irp.f new file mode 100644 index 00000000..fed2ba9b --- /dev/null +++ b/src/davidson_keywords/usef.irp.f @@ -0,0 +1,33 @@ +use bitmasks +use f77_zmq + + +! --- + +BEGIN_PROVIDER [ integer, nthreads_davidson ] + implicit none + BEGIN_DOC + ! Number of threads for Davidson + END_DOC + nthreads_davidson = nproc + character*(32) :: env + call getenv('QP_NTHREADS_DAVIDSON',env) + if (trim(env) /= '') then + read(env,*) nthreads_davidson + call write_int(6,nthreads_davidson,'Target number of threads for ') + endif +END_PROVIDER + +! --- + +BEGIN_PROVIDER [ double precision, threshold_davidson_pt2 ] + implicit none + BEGIN_DOC + ! Threshold of Davidson's algorithm, using PT2 as a guide + END_DOC + threshold_davidson_pt2 = threshold_davidson + +END_PROVIDER + +! --- +