From da0ce1e11fc375bd60722fe46a7b6eb15edf0659 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 11 Jun 2019 10:47:03 +0200 Subject: [PATCH 1/6] Added bibtex entry --- README.md | 21 ++++++++++++++++++--- docs/source/research.bib | 10 +++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3e85b4cc..e7fab0c9 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,28 @@ # Quantum Package 2.0 + + [*Quantum package 2.0: an open-source determinant-driven suite of programs*](https://pubs.acs.org/doi/10.1021/acs.jctc.9b00176)\ Y. Garniron, K. Gasperich, T. Applencourt, A. Benali, A. Ferté, J. Paquier, B. Pradines, R. Assaraf, P. Reinhardt, J. Toulouse, P. Barbaresco, N. Renon, G. David, J. P. Malrieu, M. Véril, M. Caffarel, P. F. Loos, E. Giner and A. Scemama\ -J. Chem. Theory Comput. (2019)\ +J. Chem. Theory Comput., 15:6, 3591--3609, (2019)\ https://arxiv.org/abs/1902.08154 - - +``` +@article{doi:10.1021/acs.jctc.9b00176, + author = {Garniron, Yann and Applencourt, Thomas and Gasperich, Kevin and Benali, Anouar and Ferté, Anthony and Paquier, Julien and Pradines, Barthélémy and Assaraf, Roland and Reinhardt, Peter and Toulouse, Julien and Barbaresco, Pierrette and Renon, Nicolas and David, Grégoire and Malrieu, Jean-Paul and Véril, Mickaël and Caffarel, Michel and Loos, Pierre-François and Giner, Emmanuel and Scemama, Anthony}, + title = {Quantum Package 2.0: An Open-Source Determinant-Driven Suite of Programs}, + journal = {Journal of Chemical Theory and Computation}, + volume = {15}, + number = {6}, + pages = {3591-3609}, + year = {2019}, + doi = {10.1021/acs.jctc.9b00176}, + note ={PMID: 31082265}, + URL = { https://doi.org/10.1021/acs.jctc.9b00176 }, + eprint = { https://doi.org/10.1021/acs.jctc.9b00176 } +} +``` # Getting started diff --git a/docs/source/research.bib b/docs/source/research.bib index df7d1b54..67a40766 100644 --- a/docs/source/research.bib +++ b/docs/source/research.bib @@ -28,18 +28,22 @@ year = 2019, month = {may}, publisher = {American Chemical Society ({ACS})}, - author = {Pierre-Francois Loos and Bartélémy Pradines and Anthony Scemama and Julien Toulouse and Emmanuel Giner}, - title = {A Density-Based Basis-Set Correction For Wave Function Theory}, + volume = {10}, + number = {11}, + pages = {2931--2937}, + author = {Pierre-Fran{\c{c}}ois Loos and Barth{\'{e}}l{\'{e}}my Pradines and Anthony Scemama and Julien Toulouse and Emmanuel Giner}, + title = {A Density-Based Basis-Set Correction for Wave Function Theory}, journal = {The Journal of Physical Chemistry Letters} } + @article{Garniron_2019, doi = {10.1021/acs.jctc.9b00176}, url = {https://doi.org/10.1021%2Facs.jctc.9b00176}, year = 2019, month = {may}, publisher = {American Chemical Society ({ACS})}, - author = {Yann Garniron and Thomas Applencourt and Kevin Gasperich and Anouar Benali and Anthony Ferte and Julien Paquier and Bartélémy Pradines and Roland Assaraf and Peter Reinhardt and Julien Toulouse and Pierrette Barbaresco and Nicolas Renon and Gregoire David and Jean-Paul Malrieu and Mickael Veril and Michel Caffarel and Pierre-Francois Loos and Emmanuel Giner and Anthony Scemama}, + author = {Yann Garniron and Thomas Applencourt and Kevin Gasperich and Anouar Benali and Anthony Fert{\'{e}} and Julien Paquier and Barth{\'{e}}l{\'{e}}my Pradines and Roland Assaraf and Peter Reinhardt and Julien Toulouse and Pierrette Barbaresco and Nicolas Renon and Gr{\'{e}}goire David and Jean-Paul Malrieu and Mickaël V{\'{e}}ril and Michel Caffarel and Pierre-Fran{\c{c}}ois Loos and Emmanuel Giner and Anthony Scemama}, title = {Quantum Package 2.0: An Open-Source Determinant-Driven Suite of Programs}, journal = {Journal of Chemical Theory and Computation} } From 51f81843a60cd42fc34aa2fa31c49b0a8f8df81f Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 15 Jun 2019 00:20:35 +0200 Subject: [PATCH 2/6] Updated documentation --- INSTALL.rst | 2 +- docs/source/modules/ao_two_e_erf_ints.rst | 3 + docs/source/modules/ao_two_e_ints.rst | 66 +++++ docs/source/modules/becke_numerical_grid.rst | 255 +++++++++++++++++- docs/source/modules/cipsi.rst | 75 +++++- docs/source/modules/davidson.rst | 34 +++ docs/source/modules/determinants.rst | 17 +- docs/source/modules/dft_utils_in_r.rst | 64 +++++ docs/source/modules/ezfio_files.rst | 16 +- docs/source/modules/mpi.rst | 4 +- .../programmers_guide/index_providers.rst | 18 ++ docs/source/programs/fci.rst | 1 + man/cis.1 | 2 +- man/cisd.1 | 2 +- man/configure.1 | 2 +- man/diagonalize_h.1 | 2 +- man/excited_states.1 | 2 +- man/fci.1 | 4 +- man/fcidump.1 | 2 +- man/four_idx_transform.1 | 2 +- man/interfaces.1 | 2 +- man/ks_scf.1 | 2 +- man/molden.1 | 2 +- man/natural_orbitals.1 | 2 +- man/plugins.1 | 2 +- man/print_ci_vectors.1 | 2 +- man/print_e_conv.1 | 2 +- man/print_wf.1 | 2 +- man/printing.1 | 2 +- man/pt2.1 | 2 +- man/qp_convert_output_to_ezfio.1 | 2 +- man/qp_create_ezfio.1 | 2 +- man/qp_edit.1 | 2 +- man/qp_export_as_tgz.1 | 2 +- man/qp_plugins.1 | 2 +- man/qp_reset.1 | 2 +- man/qp_run.1 | 2 +- man/qp_set_frozen_core.1 | 2 +- man/qp_set_mo_class.1 | 2 +- man/qp_stop.1 | 2 +- man/qp_update.1 | 2 +- man/qpsh.1 | 2 +- man/rs_ks_scf.1 | 2 +- man/save_natorb.1 | 2 +- man/save_one_e_dm.1 | 2 +- man/save_ortho_mos.1 | 2 +- man/scf.1 | 2 +- man/write_integrals_erf.1 | 2 +- 48 files changed, 580 insertions(+), 49 deletions(-) diff --git a/INSTALL.rst b/INSTALL.rst index baf7f051..c91b184f 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -46,7 +46,7 @@ Requirements - `GMP `_ : Gnu Multiple Precision Arithmetic Library - |OCaml| compiler with |OPAM| package manager - `Bubblewrap `_ : Sandboxing tool required by Opam -- `libcap https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git`_ : POSIX capabilities required by Bubblewrap +- `libcap `_ : POSIX capabilities required by Bubblewrap - |Ninja| : a parallel build system diff --git a/docs/source/modules/ao_two_e_erf_ints.rst b/docs/source/modules/ao_two_e_erf_ints.rst index 7ee24a88..f6b9108a 100644 --- a/docs/source/modules/ao_two_e_erf_ints.rst +++ b/docs/source/modules/ao_two_e_erf_ints.rst @@ -176,6 +176,7 @@ Providers * :c:data:`ao_num` * :c:data:`ao_power` * :c:data:`ao_prim_num` + * :c:data:`mu_erf` * :c:data:`n_pt_max_integrals` * :c:data:`nucl_coord` @@ -214,6 +215,7 @@ Providers * :c:data:`ao_prim_num` * :c:data:`ezfio_filename` * :c:data:`io_ao_two_e_integrals_erf` + * :c:data:`mu_erf` * :c:data:`n_pt_max_integrals` * :c:data:`nproc` * :c:data:`nucl_coord` @@ -290,6 +292,7 @@ Subroutines / functions * :c:data:`ao_power` * :c:data:`ao_expo_ordered_transp` * :c:data:`ao_prim_num` + * :c:data:`mu_erf` * :c:data:`ao_nucl` * :c:data:`nucl_coord` diff --git a/docs/source/modules/ao_two_e_ints.rst b/docs/source/modules/ao_two_e_ints.rst index 64a942f4..4975bd04 100644 --- a/docs/source/modules/ao_two_e_ints.rst +++ b/docs/source/modules/ao_two_e_ints.rst @@ -1016,6 +1016,70 @@ Subroutines / functions * :c:func:`two_e_integrals_index` +.. c:function:: get_ao_two_e_integrals_non_zero_jl: + + + File : :file:`ao_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + subroutine get_ao_two_e_integrals_non_zero_jl(j,l,thresh,sze_max,sze,out_val,out_val_index,non_zero_int) + + + Gets multiple AO bi-electronic integral from the AO map . + All non-zero i are retrieved for j,k,l fixed. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_map` + * :c:data:`ao_overlap_abs` + * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`ao_two_e_integrals_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`map_get` + * :c:func:`two_e_integrals_index` + + +.. c:function:: get_ao_two_e_integrals_non_zero_jl_from_list: + + + File : :file:`ao_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + subroutine get_ao_two_e_integrals_non_zero_jl_from_list(j,l,thresh,list,n_list,sze_max,out_val,out_val_index,non_zero_int) + + + Gets multiple AO two-electron integrals from the AO map . + All non-zero i are retrieved for j,k,l fixed. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_map` + * :c:data:`ao_overlap_abs` + * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`ao_two_e_integrals_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`map_get` + * :c:func:`two_e_integrals_index` + + .. c:function:: give_polynom_mult_center_x: @@ -1243,6 +1307,8 @@ Subroutines / functions * :c:func:`get_ao_two_e_integral_erf` * :c:func:`get_ao_two_e_integrals_erf_non_zero` * :c:func:`get_ao_two_e_integrals_non_zero` + * :c:func:`get_ao_two_e_integrals_non_zero_jl` + * :c:func:`get_ao_two_e_integrals_non_zero_jl_from_list` * :c:func:`get_mo_two_e_integral_erf` * :c:func:`get_mo_two_e_integrals_coulomb_ii` * :c:func:`get_mo_two_e_integrals_erf` diff --git a/docs/source/modules/becke_numerical_grid.rst b/docs/source/modules/becke_numerical_grid.rst index d0ea3351..7a0c7411 100644 --- a/docs/source/modules/becke_numerical_grid.rst +++ b/docs/source/modules/becke_numerical_grid.rst @@ -93,6 +93,12 @@ EZFIO parameters Total number of grid points +.. option:: thresh_grid + + threshold on the weight of a given grid point + + Default: 1.e-20 + Providers --------- @@ -210,6 +216,7 @@ Providers * :c:data:`n_points_final_grid` * :c:data:`n_points_radial_grid` * :c:data:`nucl_num` + * :c:data:`thresh_grid` Needed by: @@ -244,6 +251,40 @@ Providers * :c:data:`one_e_dm_no_core_and_grad_alpha_in_r` +.. c:var:: final_grid_points_per_atom + + + File : :file:`becke_numerical_grid/grid_becke_per_atom.irp.f` + + .. code:: fortran + + double precision, allocatable :: final_grid_points_per_atom (3,n_pts_max_per_atom,nucl_num) + double precision, allocatable :: final_weight_at_r_vector_per_atom (n_pts_max_per_atom,nucl_num) + integer, allocatable :: index_final_points_per_atom (3,n_pts_max_per_atom,nucl_num) + integer, allocatable :: index_final_points_per_atom_reverse (n_points_integration_angular,n_points_radial_grid,nucl_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`final_weight_at_r` + * :c:data:`grid_points_per_atom` + * :c:data:`n_points_radial_grid` + * :c:data:`n_pts_per_atom` + * :c:data:`nucl_num` + * :c:data:`thresh_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`aos_in_r_array_per_atom` + + .. c:var:: final_weight_at_r @@ -263,10 +304,10 @@ Providers * :c:data:`alpha_knowles` * :c:data:`angular_quadrature_points` + * :c:data:`grid_atomic_number` * :c:data:`grid_points_radial` * :c:data:`m_knowles` * :c:data:`n_points_radial_grid` - * :c:data:`nucl_charge` * :c:data:`nucl_num` * :c:data:`weight_at_r` @@ -276,6 +317,9 @@ Providers :columns: 3 * :c:data:`final_grid_points` + * :c:data:`final_grid_points_per_atom` + * :c:data:`n_points_final_grid` + * :c:data:`n_pts_per_atom` .. c:var:: final_weight_at_r_vector @@ -309,6 +353,7 @@ Providers * :c:data:`n_points_final_grid` * :c:data:`n_points_radial_grid` * :c:data:`nucl_num` + * :c:data:`thresh_grid` Needed by: @@ -343,6 +388,69 @@ Providers * :c:data:`one_e_dm_no_core_and_grad_alpha_in_r` +.. c:var:: final_weight_at_r_vector_per_atom + + + File : :file:`becke_numerical_grid/grid_becke_per_atom.irp.f` + + .. code:: fortran + + double precision, allocatable :: final_grid_points_per_atom (3,n_pts_max_per_atom,nucl_num) + double precision, allocatable :: final_weight_at_r_vector_per_atom (n_pts_max_per_atom,nucl_num) + integer, allocatable :: index_final_points_per_atom (3,n_pts_max_per_atom,nucl_num) + integer, allocatable :: index_final_points_per_atom_reverse (n_points_integration_angular,n_points_radial_grid,nucl_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`final_weight_at_r` + * :c:data:`grid_points_per_atom` + * :c:data:`n_points_radial_grid` + * :c:data:`n_pts_per_atom` + * :c:data:`nucl_num` + * :c:data:`thresh_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`aos_in_r_array_per_atom` + + +.. c:var:: grid_atomic_number + + + File : :file:`becke_numerical_grid/atomic_number.irp.f` + + .. code:: fortran + + integer, allocatable :: grid_atomic_number (nucl_num) + + + Atomic number used to adjust the grid + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`nucl_charge` + * :c:data:`nucl_num` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`final_weight_at_r` + * :c:data:`grid_points_per_atom` + + .. c:var:: grid_points_per_atom @@ -362,10 +470,10 @@ Providers * :c:data:`alpha_knowles` * :c:data:`angular_quadrature_points` + * :c:data:`grid_atomic_number` * :c:data:`grid_points_radial` * :c:data:`m_knowles` * :c:data:`n_points_radial_grid` - * :c:data:`nucl_charge` * :c:data:`nucl_coord` * :c:data:`nucl_num` @@ -375,6 +483,7 @@ Providers :columns: 3 * :c:data:`final_grid_points` + * :c:data:`final_grid_points_per_atom` * :c:data:`one_e_dm_alpha_in_r` * :c:data:`weight_at_r` @@ -439,6 +548,7 @@ Providers * :c:data:`n_points_final_grid` * :c:data:`n_points_radial_grid` * :c:data:`nucl_num` + * :c:data:`thresh_grid` Needed by: @@ -473,6 +583,74 @@ Providers * :c:data:`one_e_dm_no_core_and_grad_alpha_in_r` +.. c:var:: index_final_points_per_atom + + + File : :file:`becke_numerical_grid/grid_becke_per_atom.irp.f` + + .. code:: fortran + + double precision, allocatable :: final_grid_points_per_atom (3,n_pts_max_per_atom,nucl_num) + double precision, allocatable :: final_weight_at_r_vector_per_atom (n_pts_max_per_atom,nucl_num) + integer, allocatable :: index_final_points_per_atom (3,n_pts_max_per_atom,nucl_num) + integer, allocatable :: index_final_points_per_atom_reverse (n_points_integration_angular,n_points_radial_grid,nucl_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`final_weight_at_r` + * :c:data:`grid_points_per_atom` + * :c:data:`n_points_radial_grid` + * :c:data:`n_pts_per_atom` + * :c:data:`nucl_num` + * :c:data:`thresh_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`aos_in_r_array_per_atom` + + +.. c:var:: index_final_points_per_atom_reverse + + + File : :file:`becke_numerical_grid/grid_becke_per_atom.irp.f` + + .. code:: fortran + + double precision, allocatable :: final_grid_points_per_atom (3,n_pts_max_per_atom,nucl_num) + double precision, allocatable :: final_weight_at_r_vector_per_atom (n_pts_max_per_atom,nucl_num) + integer, allocatable :: index_final_points_per_atom (3,n_pts_max_per_atom,nucl_num) + integer, allocatable :: index_final_points_per_atom_reverse (n_points_integration_angular,n_points_radial_grid,nucl_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`final_weight_at_r` + * :c:data:`grid_points_per_atom` + * :c:data:`n_points_radial_grid` + * :c:data:`n_pts_per_atom` + * :c:data:`nucl_num` + * :c:data:`thresh_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`aos_in_r_array_per_atom` + + .. c:var:: index_final_points_reverse @@ -504,6 +682,7 @@ Providers * :c:data:`n_points_final_grid` * :c:data:`n_points_radial_grid` * :c:data:`nucl_num` + * :c:data:`thresh_grid` Needed by: @@ -576,8 +755,10 @@ Providers .. hlist:: :columns: 3 + * :c:data:`final_weight_at_r` * :c:data:`n_points_radial_grid` * :c:data:`nucl_num` + * :c:data:`thresh_grid` Needed by: @@ -681,11 +862,13 @@ Providers * :c:data:`angular_quadrature_points` * :c:data:`final_grid_points` + * :c:data:`final_grid_points_per_atom` * :c:data:`final_weight_at_r` * :c:data:`grid_points_per_atom` * :c:data:`grid_points_radial` * :c:data:`n_points_final_grid` * :c:data:`n_points_grid_per_atom` + * :c:data:`n_pts_per_atom` * :c:data:`one_e_dm_alpha_in_r` * :c:data:`weight_at_r` @@ -721,15 +904,81 @@ Providers * :c:data:`angular_quadrature_points` * :c:data:`final_grid_points` + * :c:data:`final_grid_points_per_atom` * :c:data:`final_weight_at_r` * :c:data:`grid_points_per_atom` * :c:data:`grid_points_radial` * :c:data:`n_points_final_grid` * :c:data:`n_points_grid_per_atom` + * :c:data:`n_pts_per_atom` * :c:data:`one_e_dm_alpha_in_r` * :c:data:`weight_at_r` +.. c:var:: n_pts_max_per_atom + + + File : :file:`becke_numerical_grid/grid_becke_per_atom.irp.f` + + .. code:: fortran + + integer, allocatable :: n_pts_per_atom (nucl_num) + integer :: n_pts_max_per_atom + + + Number of points which are non zero + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`final_weight_at_r` + * :c:data:`n_points_radial_grid` + * :c:data:`nucl_num` + * :c:data:`thresh_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`aos_in_r_array_per_atom` + * :c:data:`final_grid_points_per_atom` + + +.. c:var:: n_pts_per_atom + + + File : :file:`becke_numerical_grid/grid_becke_per_atom.irp.f` + + .. code:: fortran + + integer, allocatable :: n_pts_per_atom (nucl_num) + integer :: n_pts_max_per_atom + + + Number of points which are non zero + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`final_weight_at_r` + * :c:data:`n_points_radial_grid` + * :c:data:`nucl_num` + * :c:data:`thresh_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`aos_in_r_array_per_atom` + * :c:data:`final_grid_points_per_atom` + + .. c:var:: weight_at_r @@ -754,7 +1003,6 @@ Providers * :c:data:`grid_points_per_atom` * :c:data:`n_points_radial_grid` - * :c:data:`nucl_charge` * :c:data:`nucl_coord_transp` * :c:data:`nucl_dist_inv` * :c:data:`nucl_num` @@ -824,7 +1072,6 @@ Subroutines / functions * :c:data:`nucl_dist_inv` * :c:data:`slater_bragg_type_inter_distance_ua` * :c:data:`nucl_coord_transp` - * :c:data:`nucl_charge` * :c:data:`nucl_num` diff --git a/docs/source/modules/cipsi.rst b/docs/source/modules/cipsi.rst index a03b2e3c..cb5fb19d 100644 --- a/docs/source/modules/cipsi.rst +++ b/docs/source/modules/cipsi.rst @@ -727,9 +727,40 @@ Providers * :c:data:`c0_weight` * :c:data:`n_states` * :c:data:`pt2_match_weight` + * :c:data:`state_average_weight` + * :c:data:`variance_match_weight` + * :c:data:`weight_selection` +.. c:var:: variance_match_weight + + + File : :file:`cipsi/selection.irp.f` + + .. code:: fortran + + double precision, allocatable :: variance_match_weight (N_states) + + + Weights adjusted along the selection to make the variances + of each state coincide. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_states` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`selection_weight` + + Subroutines / functions ----------------------- @@ -879,6 +910,7 @@ Subroutines / functions * :c:data:`selection_weight` * :c:data:`mo_num` * :c:data:`n_states` + * :c:data:`weight_selection` * :c:data:`n_int` * :c:data:`psi_det_hii` * :c:data:`do_only_1h1p` @@ -1551,6 +1583,7 @@ Subroutines / functions * :c:data:`correlation_energy_ratio_max` * :c:data:`n_iter` * :c:data:`psi_energy_with_nucl_rep` + * :c:data:`selection_factor` * :c:data:`psi_occ_pattern` * :c:data:`n_det_max` * :c:data:`n_states` @@ -1619,6 +1652,7 @@ Subroutines / functions * :c:data:`pt2_stoch_istate` * :c:data:`state_average_weight` * :c:data:`threshold_generators` + * :c:data:`variance_match_weight` .. c:function:: run_pt2_slave: @@ -1959,6 +1993,7 @@ Subroutines / functions * :c:data:`correlation_energy_ratio_max` * :c:data:`n_iter` * :c:data:`psi_energy_with_nucl_rep` + * :c:data:`selection_factor` * :c:data:`psi_occ_pattern` * :c:data:`pt2_max` * :c:data:`n_det_max` @@ -2028,6 +2063,7 @@ Subroutines / functions * :c:data:`pt2_stoch_istate` * :c:data:`state_average_weight` * :c:data:`threshold_generators` + * :c:data:`variance_match_weight` .. c:function:: select_connected: @@ -2351,6 +2387,42 @@ Subroutines / functions * :c:func:`check_mem` +.. c:function:: update_pt2_and_variance_weights: + + + File : :file:`cipsi/selection.irp.f` + + .. code:: fortran + + subroutine update_pt2_and_variance_weights(pt2, variance, norm, N_st) + + + Updates the rPT2- and Variance- matching weights. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`pt2_match_weight` + * :c:data:`variance_match_weight` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`zmq_pt2` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`pt2_match_weight` + * :c:data:`variance_match_weight` + + .. c:function:: zmq_pt2: @@ -2378,7 +2450,6 @@ Subroutines / functions * :c:data:`state_average_weight` * :c:data:`n_det` * :c:data:`s2_eig` - * :c:data:`pt2_match_weight` * :c:data:`pt2_j` * :c:data:`mo_two_e_integrals_in_map` * :c:data:`psi_bilinear_matrix_transp_values` @@ -2434,6 +2505,7 @@ Subroutines / functions * :c:func:`pt2_slave_inproc` * :c:func:`remove_duplicates_in_selection_buffer` * :c:func:`resident_memory` + * :c:func:`update_pt2_and_variance_weights` * :c:func:`write_double` * :c:func:`write_int` * :c:func:`zmq_selection` @@ -2453,6 +2525,7 @@ Subroutines / functions * :c:data:`pt2_match_weight` * :c:data:`pt2_stoch_istate` * :c:data:`state_average_weight` + * :c:data:`variance_match_weight` .. c:function:: zmq_selection: diff --git a/docs/source/modules/davidson.rst b/docs/source/modules/davidson.rst index 9de1a0a7..ae06e247 100644 --- a/docs/source/modules/davidson.rst +++ b/docs/source/modules/davidson.rst @@ -1756,6 +1756,40 @@ Subroutines / functions * :c:func:`i_wee_j_single` +.. c:function:: print_energy_components: + + + File : :file:`davidson/print_e_components.irp.f` + + .. code:: fortran + + subroutine print_energy_components() + + + Prints the different components of the energy. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_n_e` + * :c:data:`n_states` + * :c:data:`mo_pseudo_integrals` + * :c:data:`mo_kinetic_integrals` + * :c:data:`mo_num` + * :c:data:`nuclear_repulsion` + * :c:data:`psi_energy` + * :c:data:`one_e_dm_mo_alpha` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`print_summary` + + .. c:function:: u_0_h_u_0: diff --git a/docs/source/modules/determinants.rst b/docs/source/modules/determinants.rst index 9b0fab33..bc0f7434 100644 --- a/docs/source/modules/determinants.rst +++ b/docs/source/modules/determinants.rst @@ -61,12 +61,18 @@ EZFIO parameters Default: True -.. option:: used_weight +.. option:: weight_one_e_dm Weight used in the calculation of the one-electron density matrix. 0: 1./(c_0^2), 1: 1/N_states, 2: input state-average weight, 3: 1/(Norm_L3(Psi)) Default: 1 +.. option:: weight_selection + + Weight used in the selection. 0: input state-average weight, 1: 1./(c_0^2), 2: rPT2 matching, 3: variance matching, 4: variance and rPT2 matching, 5: variance minimization and matching + + Default: 2 + .. option:: threshold_generators Thresholds on generators (fraction of the square of the norm) @@ -119,6 +125,12 @@ EZFIO parameters Weight of the states in state-average calculations. +.. option:: selection_factor + + f such that the number of determinants to add is f * N_det * sqrt(N_states) + + Default: 1. + .. option:: thresh_sym Thresholds to check if a determinant is connected with HF @@ -3638,7 +3650,7 @@ Providers * :c:data:`c0_weight` * :c:data:`n_states` - * :c:data:`used_weight` + * :c:data:`weight_one_e_dm` Needed by: @@ -3648,6 +3660,7 @@ Providers * :c:data:`det_alpha_norm` * :c:data:`one_e_dm_mo_alpha_average` * :c:data:`psi_average_norm_contrib` + * :c:data:`selection_weight` .. c:var:: weight_occ_pattern diff --git a/docs/source/modules/dft_utils_in_r.rst b/docs/source/modules/dft_utils_in_r.rst index 0cfa30d6..a6630626 100644 --- a/docs/source/modules/dft_utils_in_r.rst +++ b/docs/source/modules/dft_utils_in_r.rst @@ -199,6 +199,70 @@ Providers * :c:data:`potential_xc_alpha_ao_sr_lda` +.. c:var:: aos_in_r_array_per_atom + + + File : :file:`dft_utils_in_r/ao_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: aos_in_r_array_per_atom (ao_num,n_pts_max_per_atom,nucl_num) + double precision, allocatable :: aos_in_r_array_per_atom_transp (n_pts_max_per_atom,ao_num,nucl_num) + + + aos_in_r_array_per_atom(i,j,k) = value of the ith ao on the jth grid point attached on the kth atom + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` + * :c:data:`ao_expo_ordered_transp_per_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power_ordered_transp_per_nucl` + * :c:data:`ao_prim_num` + * :c:data:`final_grid_points_per_atom` + * :c:data:`n_pts_per_atom` + * :c:data:`nucl_aos_transposed` + * :c:data:`nucl_coord` + * :c:data:`nucl_n_aos` + * :c:data:`nucl_num` + + + +.. c:var:: aos_in_r_array_per_atom_transp + + + File : :file:`dft_utils_in_r/ao_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: aos_in_r_array_per_atom (ao_num,n_pts_max_per_atom,nucl_num) + double precision, allocatable :: aos_in_r_array_per_atom_transp (n_pts_max_per_atom,ao_num,nucl_num) + + + aos_in_r_array_per_atom(i,j,k) = value of the ith ao on the jth grid point attached on the kth atom + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` + * :c:data:`ao_expo_ordered_transp_per_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power_ordered_transp_per_nucl` + * :c:data:`ao_prim_num` + * :c:data:`final_grid_points_per_atom` + * :c:data:`n_pts_per_atom` + * :c:data:`nucl_aos_transposed` + * :c:data:`nucl_coord` + * :c:data:`nucl_n_aos` + * :c:data:`nucl_num` + + + .. c:var:: aos_in_r_array_transp diff --git a/docs/source/modules/ezfio_files.rst b/docs/source/modules/ezfio_files.rst index 22329d4f..d7079295 100644 --- a/docs/source/modules/ezfio_files.rst +++ b/docs/source/modules/ezfio_files.rst @@ -146,6 +146,7 @@ Providers * :c:data:`read_wf` * :c:data:`s2_eig` * :c:data:`scf_algorithm` + * :c:data:`selection_factor` * :c:data:`state_following` * :c:data:`target_energy` * :c:data:`thresh_scf` @@ -153,8 +154,9 @@ Providers * :c:data:`threshold_davidson` * :c:data:`threshold_diis` * :c:data:`threshold_generators` - * :c:data:`used_weight` * :c:data:`variance_max` + * :c:data:`weight_one_e_dm` + * :c:data:`weight_selection` .. c:var:: ezfio_work_dir @@ -296,6 +298,7 @@ Providers * :c:data:`read_wf` * :c:data:`s2_eig` * :c:data:`scf_algorithm` + * :c:data:`selection_factor` * :c:data:`state_following` * :c:data:`target_energy` * :c:data:`thresh_scf` @@ -303,8 +306,9 @@ Providers * :c:data:`threshold_davidson` * :c:data:`threshold_diis` * :c:data:`threshold_generators` - * :c:data:`used_weight` * :c:data:`variance_max` + * :c:data:`weight_one_e_dm` + * :c:data:`weight_selection` .. c:var:: output_wall_time_0 @@ -411,6 +415,7 @@ Providers * :c:data:`read_wf` * :c:data:`s2_eig` * :c:data:`scf_algorithm` + * :c:data:`selection_factor` * :c:data:`state_following` * :c:data:`target_energy` * :c:data:`thresh_scf` @@ -418,8 +423,9 @@ Providers * :c:data:`threshold_davidson` * :c:data:`threshold_diis` * :c:data:`threshold_generators` - * :c:data:`used_weight` * :c:data:`variance_max` + * :c:data:`weight_one_e_dm` + * :c:data:`weight_selection` .. c:var:: qp_kill_filename @@ -764,6 +770,7 @@ Subroutines / functions * :c:func:`roothaan_hall_scf` * :c:data:`s2_eig` * :c:data:`scf_algorithm` + * :c:data:`selection_factor` * :c:data:`state_following` * :c:data:`target_energy` * :c:data:`thresh_scf` @@ -771,8 +778,9 @@ Subroutines / functions * :c:data:`threshold_davidson` * :c:data:`threshold_diis` * :c:data:`threshold_generators` - * :c:data:`used_weight` * :c:data:`variance_max` + * :c:data:`weight_one_e_dm` + * :c:data:`weight_selection` Calls: diff --git a/docs/source/modules/mpi.rst b/docs/source/modules/mpi.rst index 3711b26c..2f25799e 100644 --- a/docs/source/modules/mpi.rst +++ b/docs/source/modules/mpi.rst @@ -174,6 +174,7 @@ Providers * :c:data:`read_wf` * :c:data:`s2_eig` * :c:data:`scf_algorithm` + * :c:data:`selection_factor` * :c:data:`state_following` * :c:data:`target_energy` * :c:data:`thresh_scf` @@ -181,8 +182,9 @@ Providers * :c:data:`threshold_davidson` * :c:data:`threshold_diis` * :c:data:`threshold_generators` - * :c:data:`used_weight` * :c:data:`variance_max` + * :c:data:`weight_one_e_dm` + * :c:data:`weight_selection` .. c:var:: mpi_rank diff --git a/docs/source/programmers_guide/index_providers.rst b/docs/source/programmers_guide/index_providers.rst index a491f509..c6fd0147 100644 --- a/docs/source/programmers_guide/index_providers.rst +++ b/docs/source/programmers_guide/index_providers.rst @@ -103,6 +103,8 @@ Index of Providers * :c:data:`aos_grad_in_r_array_transp` * :c:data:`aos_grad_in_r_array_transp_xyz` * :c:data:`aos_in_r_array` + * :c:data:`aos_in_r_array_per_atom` + * :c:data:`aos_in_r_array_per_atom_transp` * :c:data:`aos_in_r_array_transp` * :c:data:`aos_lapl_in_r_array` * :c:data:`aos_lapl_in_r_array_transp` @@ -251,8 +253,10 @@ Index of Providers * :c:data:`fact_inv` * :c:data:`file_lock` * :c:data:`final_grid_points` + * :c:data:`final_grid_points_per_atom` * :c:data:`final_weight_at_r` * :c:data:`final_weight_at_r_vector` + * :c:data:`final_weight_at_r_vector_per_atom` * :c:data:`fock_matrix_alpha_no_xc_ao` * :c:data:`fock_matrix_ao` * :c:data:`fock_matrix_ao_alpha` @@ -282,6 +286,7 @@ Index of Providers * :c:data:`give_polynomial_mult_center_one_e_erf_opt` * :c:data:`global_selection_buffer` * :c:data:`global_selection_buffer_lock` + * :c:data:`grid_atomic_number` * :c:data:`grid_points_per_atom` * :c:data:`grid_points_radial` * :c:data:`grid_type_sgn` @@ -313,6 +318,8 @@ Index of Providers * :c:data:`inact_bitmask` * :c:data:`inact_virt_bitmask` * :c:data:`index_final_points` + * :c:data:`index_final_points_per_atom` + * :c:data:`index_final_points_per_atom_reverse` * :c:data:`index_final_points_reverse` * :c:data:`index_holes_bitmask` * :c:data:`index_particl_bitmask` @@ -460,6 +467,8 @@ Index of Providers * :c:data:`n_points_radial_grid` * :c:data:`n_pt_max_i_x` * :c:data:`n_pt_max_integrals` + * :c:data:`n_pts_max_per_atom` + * :c:data:`n_pts_per_atom` * :c:data:`n_single_exc_bitmasks` * :c:data:`n_states` * :c:data:`n_states_diag` @@ -754,6 +763,7 @@ Index of Providers * :c:data:`selection_criterion` * :c:data:`selection_criterion_factor` * :c:data:`selection_criterion_min` + * :c:data:`selection_factor` * :c:data:`selection_weight` * :c:data:`short_range_hartree` * :c:data:`short_range_hartree_operator` @@ -775,6 +785,7 @@ Index of Providers * :c:data:`state_following` * :c:data:`target_energy` * :c:data:`theta_angular_integration_lebedev` + * :c:data:`thresh_grid` * :c:data:`thresh_scf` * :c:data:`thresh_sym` * :c:data:`threshold_davidson` @@ -792,11 +803,14 @@ Index of Providers * :c:data:`unpaired_alpha_electrons` * :c:data:`used_weight` * :c:data:`var_pt2_ratio` + * :c:data:`variance_match_weight` * :c:data:`variance_max` * :c:data:`virt_bitmask` * :c:data:`virt_bitmask_4` * :c:data:`weight_at_r` * :c:data:`weight_occ_pattern` + * :c:data:`weight_one_e_dm` + * :c:data:`weight_selection` * :c:data:`weights_angular_integration_lebedev` * :c:data:`weights_angular_points` * :c:data:`write_ao_integrals_e_n` @@ -1033,6 +1047,8 @@ Index of Subroutines/Functions * :c:func:`get_ao_two_e_integrals_erf` * :c:func:`get_ao_two_e_integrals_erf_non_zero` * :c:func:`get_ao_two_e_integrals_non_zero` + * :c:func:`get_ao_two_e_integrals_non_zero_jl` + * :c:func:`get_ao_two_e_integrals_non_zero_jl_from_list` * :c:func:`get_d0` * :c:func:`get_d1` * :c:func:`get_d2` @@ -1280,6 +1296,7 @@ Index of Subroutines/Functions * :c:func:`print_ci_vectors` * :c:func:`print_det` * :c:func:`print_e_conv` + * :c:func:`print_energy_components` * :c:func:`print_extrapolated_energy` * :c:func:`print_generators_bitmasks_holes` * :c:func:`print_generators_bitmasks_holes_for_one_generator` @@ -1418,6 +1435,7 @@ Index of Subroutines/Functions * :c:func:`u_0_s2_u_0` * :c:func:`u_dot_u` * :c:func:`u_dot_v` + * :c:func:`update_pt2_and_variance_weights` * :c:func:`v_e_n` * :c:func:`v_grad_rho_oc_to_v_grad_rho_ab` * :c:func:`v_phi` diff --git a/docs/source/programs/fci.rst b/docs/source/programs/fci.rst index e037c974..e0441d91 100644 --- a/docs/source/programs/fci.rst +++ b/docs/source/programs/fci.rst @@ -91,3 +91,4 @@ fci * :c:data:`read_wf` * :c:data:`state_average_weight` * :c:data:`threshold_generators` + * :c:data:`variance_match_weight` diff --git a/man/cis.1 b/man/cis.1 index d533b377..e3a61b62 100644 --- a/man/cis.1 +++ b/man/cis.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "CIS" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "CIS" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME cis \- | Quantum Package > . diff --git a/man/cisd.1 b/man/cisd.1 index 33d6212e..47f3da3c 100644 --- a/man/cisd.1 +++ b/man/cisd.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "CISD" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "CISD" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME cisd \- | Quantum Package > . diff --git a/man/configure.1 b/man/configure.1 index c3ec2bd8..ad877074 100644 --- a/man/configure.1 +++ b/man/configure.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "CONFIGURE" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "CONFIGURE" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME configure \- | Quantum Package > . diff --git a/man/diagonalize_h.1 b/man/diagonalize_h.1 index 3f4a3a30..3592f2fd 100644 --- a/man/diagonalize_h.1 +++ b/man/diagonalize_h.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "DIAGONALIZE_H" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "DIAGONALIZE_H" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME diagonalize_h \- | Quantum Package > . diff --git a/man/excited_states.1 b/man/excited_states.1 index 37d343d2..cf2d15f0 100644 --- a/man/excited_states.1 +++ b/man/excited_states.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "EXCITED_STATES" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "EXCITED_STATES" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME excited_states \- | Quantum Package > . diff --git a/man/fci.1 b/man/fci.1 index 5312866e..9f565169 100644 --- a/man/fci.1 +++ b/man/fci.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "FCI" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "FCI" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME fci \- | Quantum Package > . @@ -159,6 +159,8 @@ Touches: \fBstate_average_weight\fP .IP \(bu 2 \fBthreshold_generators\fP +.IP \(bu 2 +\fBvariance_match_weight\fP .UNINDENT .UNINDENT .UNINDENT diff --git a/man/fcidump.1 b/man/fcidump.1 index e3ad0d11..1300cdbb 100644 --- a/man/fcidump.1 +++ b/man/fcidump.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "FCIDUMP" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "FCIDUMP" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME fcidump \- | Quantum Package > . diff --git a/man/four_idx_transform.1 b/man/four_idx_transform.1 index 9188fe72..e11fbfbe 100644 --- a/man/four_idx_transform.1 +++ b/man/four_idx_transform.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "FOUR_IDX_TRANSFORM" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "FOUR_IDX_TRANSFORM" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME four_idx_transform \- | Quantum Package > . diff --git a/man/interfaces.1 b/man/interfaces.1 index 9cd6a115..b4da19ad 100644 --- a/man/interfaces.1 +++ b/man/interfaces.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "INTERFACES" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "INTERFACES" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME interfaces \- | Quantum Package > . diff --git a/man/ks_scf.1 b/man/ks_scf.1 index b57a3342..c7f9c8e2 100644 --- a/man/ks_scf.1 +++ b/man/ks_scf.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "KS_SCF" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "KS_SCF" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME ks_scf \- | Quantum Package > . diff --git a/man/molden.1 b/man/molden.1 index d92a75e3..686d5f30 100644 --- a/man/molden.1 +++ b/man/molden.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "MOLDEN" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "MOLDEN" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME molden \- | Quantum Package > . diff --git a/man/natural_orbitals.1 b/man/natural_orbitals.1 index 5aa70b42..0a771ed9 100644 --- a/man/natural_orbitals.1 +++ b/man/natural_orbitals.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "NATURAL_ORBITALS" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "NATURAL_ORBITALS" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME natural_orbitals \- | Quantum Package > . diff --git a/man/plugins.1 b/man/plugins.1 index 4a680ec6..a5307fd1 100644 --- a/man/plugins.1 +++ b/man/plugins.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PLUGINS" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "PLUGINS" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME plugins \- | Quantum Package > . diff --git a/man/print_ci_vectors.1 b/man/print_ci_vectors.1 index 3905e63e..f2dbf63e 100644 --- a/man/print_ci_vectors.1 +++ b/man/print_ci_vectors.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PRINT_CI_VECTORS" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "PRINT_CI_VECTORS" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME print_ci_vectors \- | Quantum Package > . diff --git a/man/print_e_conv.1 b/man/print_e_conv.1 index 4fc03a3d..4a2e8712 100644 --- a/man/print_e_conv.1 +++ b/man/print_e_conv.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PRINT_E_CONV" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "PRINT_E_CONV" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME print_e_conv \- | Quantum Package > . diff --git a/man/print_wf.1 b/man/print_wf.1 index a1ae9233..7e4ca82d 100644 --- a/man/print_wf.1 +++ b/man/print_wf.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PRINT_WF" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "PRINT_WF" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME print_wf \- | Quantum Package > . diff --git a/man/printing.1 b/man/printing.1 index 7b0e2514..7fce0705 100644 --- a/man/printing.1 +++ b/man/printing.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PRINTING" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "PRINTING" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME printing \- | Quantum Package > . diff --git a/man/pt2.1 b/man/pt2.1 index de04c26d..2c70c66e 100644 --- a/man/pt2.1 +++ b/man/pt2.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "PT2" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "PT2" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME pt2 \- | Quantum Package > . diff --git a/man/qp_convert_output_to_ezfio.1 b/man/qp_convert_output_to_ezfio.1 index 7378da9f..21987702 100644 --- a/man/qp_convert_output_to_ezfio.1 +++ b/man/qp_convert_output_to_ezfio.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_CONVERT_OUTPUT_TO_EZFIO" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QP_CONVERT_OUTPUT_TO_EZFIO" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qp_convert_output_to_ezfio \- | Quantum Package > . diff --git a/man/qp_create_ezfio.1 b/man/qp_create_ezfio.1 index 0fe7ffaf..f6edcdbf 100644 --- a/man/qp_create_ezfio.1 +++ b/man/qp_create_ezfio.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_CREATE_EZFIO" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QP_CREATE_EZFIO" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qp_create_ezfio \- | Quantum Package > . diff --git a/man/qp_edit.1 b/man/qp_edit.1 index 20167ac3..302f5612 100644 --- a/man/qp_edit.1 +++ b/man/qp_edit.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_EDIT" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QP_EDIT" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qp_edit \- | Quantum Package > . diff --git a/man/qp_export_as_tgz.1 b/man/qp_export_as_tgz.1 index d0b5a58b..52f33096 100644 --- a/man/qp_export_as_tgz.1 +++ b/man/qp_export_as_tgz.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_EXPORT_AS_TGZ" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QP_EXPORT_AS_TGZ" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qp_export_as_tgz \- | Quantum Package > . diff --git a/man/qp_plugins.1 b/man/qp_plugins.1 index cf1f94a9..4eb1edb5 100644 --- a/man/qp_plugins.1 +++ b/man/qp_plugins.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_PLUGINS" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QP_PLUGINS" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qp_plugins \- | Quantum Package > . diff --git a/man/qp_reset.1 b/man/qp_reset.1 index bfa38f6f..62ffbba4 100644 --- a/man/qp_reset.1 +++ b/man/qp_reset.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_RESET" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QP_RESET" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qp_reset \- | Quantum Package > . diff --git a/man/qp_run.1 b/man/qp_run.1 index 7f1f106e..92aec660 100644 --- a/man/qp_run.1 +++ b/man/qp_run.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_RUN" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QP_RUN" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qp_run \- | Quantum Package > . diff --git a/man/qp_set_frozen_core.1 b/man/qp_set_frozen_core.1 index 9f40b0b2..cbf90ccc 100644 --- a/man/qp_set_frozen_core.1 +++ b/man/qp_set_frozen_core.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_SET_FROZEN_CORE" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QP_SET_FROZEN_CORE" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qp_set_frozen_core \- | Quantum Package > . diff --git a/man/qp_set_mo_class.1 b/man/qp_set_mo_class.1 index 7cc5b84d..9c5cb4a1 100644 --- a/man/qp_set_mo_class.1 +++ b/man/qp_set_mo_class.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_SET_MO_CLASS" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QP_SET_MO_CLASS" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qp_set_mo_class \- | Quantum Package > . diff --git a/man/qp_stop.1 b/man/qp_stop.1 index 6ee8be22..3833f8a8 100644 --- a/man/qp_stop.1 +++ b/man/qp_stop.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_STOP" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QP_STOP" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qp_stop \- | Quantum Package > . diff --git a/man/qp_update.1 b/man/qp_update.1 index 89808d41..89e5a523 100644 --- a/man/qp_update.1 +++ b/man/qp_update.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QP_UPDATE" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QP_UPDATE" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qp_update \- | Quantum Package > . diff --git a/man/qpsh.1 b/man/qpsh.1 index b8f777e8..dedbbe24 100644 --- a/man/qpsh.1 +++ b/man/qpsh.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "QPSH" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "QPSH" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME qpsh \- | Quantum Package > . diff --git a/man/rs_ks_scf.1 b/man/rs_ks_scf.1 index d09e993a..0f7acd29 100644 --- a/man/rs_ks_scf.1 +++ b/man/rs_ks_scf.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "RS_KS_SCF" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "RS_KS_SCF" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME rs_ks_scf \- | Quantum Package > . diff --git a/man/save_natorb.1 b/man/save_natorb.1 index 930bc613..e924a78c 100644 --- a/man/save_natorb.1 +++ b/man/save_natorb.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "SAVE_NATORB" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "SAVE_NATORB" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME save_natorb \- | Quantum Package > . diff --git a/man/save_one_e_dm.1 b/man/save_one_e_dm.1 index cd8b665d..659300e8 100644 --- a/man/save_one_e_dm.1 +++ b/man/save_one_e_dm.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "SAVE_ONE_E_DM" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "SAVE_ONE_E_DM" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME save_one_e_dm \- | Quantum Package > . diff --git a/man/save_ortho_mos.1 b/man/save_ortho_mos.1 index 1f168802..4a6af300 100644 --- a/man/save_ortho_mos.1 +++ b/man/save_ortho_mos.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "SAVE_ORTHO_MOS" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "SAVE_ORTHO_MOS" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME save_ortho_mos \- | Quantum Package > . diff --git a/man/scf.1 b/man/scf.1 index 4274f341..ed6d098b 100644 --- a/man/scf.1 +++ b/man/scf.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "SCF" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "SCF" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME scf \- | Quantum Package > . diff --git a/man/write_integrals_erf.1 b/man/write_integrals_erf.1 index 26f7b984..a6276336 100644 --- a/man/write_integrals_erf.1 +++ b/man/write_integrals_erf.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH "WRITE_INTEGRALS_ERF" "1" "May 28, 2019" "2.0" "Quantum Package" +.TH "WRITE_INTEGRALS_ERF" "1" "Jun 15, 2019" "2.0" "Quantum Package" .SH NAME write_integrals_erf \- | Quantum Package > . From 6479c294e85d15c754640877faff596db502d854 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 15 Jun 2019 00:28:29 +0200 Subject: [PATCH 3/6] Updated documentation --- docs/source/modules/cipsi.rst | 26 ++++-- docs/source/modules/iterations.rst | 7 ++ docs/source/programs/fci.rst | 1 + docs/source/programs/pt2.rst | 1 + docs/source/programs/rotate_mos.rst | 37 ++++++++ .../source/programs/sort_by_fock_energies.rst | 39 ++++++++ docs/source/programs/swap_mos.rst | 27 ++++++ docs/source/programs/test.rst | 19 ++++ man/fci.1 | 10 ++- man/pt2.1 | 2 + man/rotate_mos.1 | 85 ++++++++++++++++++ man/sort_by_fock_energies.1 | 89 +++++++++++++++++++ man/swap_mos.1 | 69 ++++++++++++++ src/tools/rotate_mos.irp.f | 39 ++++---- src/tools/sort_by_fock_energies.irp.f | 64 +++++++------ src/tools/swap_mos.irp.f | 9 +- 16 files changed, 467 insertions(+), 57 deletions(-) create mode 100644 docs/source/programs/rotate_mos.rst create mode 100644 docs/source/programs/sort_by_fock_energies.rst create mode 100644 docs/source/programs/swap_mos.rst create mode 100644 docs/source/programs/test.rst create mode 100644 man/rotate_mos.1 create mode 100644 man/sort_by_fock_energies.1 create mode 100644 man/swap_mos.1 diff --git a/docs/source/modules/cipsi.rst b/docs/source/modules/cipsi.rst index cb5fb19d..5415a4e2 100644 --- a/docs/source/modules/cipsi.rst +++ b/docs/source/modules/cipsi.rst @@ -1213,6 +1213,7 @@ Subroutines / functions :columns: 3 * :c:data:`generators_bitmask` + * :c:data:`selection_weight` * :c:data:`pt2_stoch_istate` * :c:data:`psi_selectors` * :c:data:`psi_det` @@ -1235,6 +1236,7 @@ Subroutines / functions * :c:data:`n_det_generators` * :c:data:`psi_det_generators` * :c:data:`n_int` + * :c:data:`pseudo_sym` * :c:data:`psi_det_generators` Called by: @@ -1590,6 +1592,7 @@ Subroutines / functions * :c:data:`h_apply_buffer_allocated` * :c:data:`n_det` * :c:data:`s2_eig` + * :c:data:`variance_max` * :c:data:`do_pt2` * :c:data:`psi_energy` * :c:data:`pt2_relative_error` @@ -1810,16 +1813,18 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`mo_num` + * :c:data:`psi_det_sorted` * :c:data:`psi_bilinear_matrix_transp_rows_loc` * :c:data:`n_states` * :c:data:`pt2_f` - * :c:data:`psi_bilinear_matrix_values` * :c:data:`elec_alpha_num` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`weight_selection` * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`n_int` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_sorted` - * :c:data:`psi_det_sorted` + * :c:data:`pseudo_sym` * :c:data:`psi_bilinear_matrix_columns_loc` * :c:data:`psi_selectors_coef_transp` @@ -1893,6 +1898,7 @@ Subroutines / functions * :c:data:`pt2_e0_denominator` * :c:data:`pt2_stoch_istate` * :c:data:`read_wf` + * :c:data:`selection_weight` * :c:data:`state_average_weight` * :c:data:`threshold_generators` @@ -1913,6 +1919,7 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`selection_weight` * :c:data:`pt2_stoch_istate` * :c:data:`psi_det` * :c:data:`zmq_state` @@ -1969,6 +1976,7 @@ Subroutines / functions * :c:data:`pt2_e0_denominator` * :c:data:`pt2_stoch_istate` + * :c:data:`selection_weight` * :c:data:`state_average_weight` * :c:data:`threshold_generators` @@ -2413,6 +2421,7 @@ Subroutines / functions :columns: 3 * :c:func:`zmq_pt2` + * :c:func:`zmq_selection` Touches: @@ -2440,6 +2449,7 @@ Subroutines / functions :columns: 3 * :c:data:`psi_det_sorted` + * :c:data:`selection_weight` * :c:data:`pt2_stoch_istate` * :c:data:`psi_selectors` * :c:data:`psi_bilinear_matrix_values` @@ -2450,6 +2460,7 @@ Subroutines / functions * :c:data:`state_average_weight` * :c:data:`n_det` * :c:data:`s2_eig` + * :c:data:`psi_det_sorted` * :c:data:`pt2_j` * :c:data:`mo_two_e_integrals_in_map` * :c:data:`psi_bilinear_matrix_transp_values` @@ -2467,7 +2478,7 @@ Subroutines / functions * :c:data:`threshold_generators` * :c:data:`psi_det_beta_unique` * :c:data:`det_to_occ_pattern` - * :c:data:`psi_det_sorted` + * :c:data:`global_selection_buffer` * :c:data:`psi_bilinear_matrix_transp_rows_loc` * :c:data:`n_states` * :c:data:`pt2_f` @@ -2476,7 +2487,7 @@ Subroutines / functions * :c:data:`n_int` * :c:data:`psi_det_hii` * :c:data:`pt2_j` - * :c:data:`global_selection_buffer` + * :c:data:`pseudo_sym` * :c:data:`pt2_w` * :c:data:`pt2_u` @@ -2545,12 +2556,12 @@ Subroutines / functions :columns: 3 * :c:data:`psi_det_sorted` + * :c:data:`selection_weight` * :c:data:`psi_selectors` * :c:data:`psi_bilinear_matrix_values` * :c:data:`n_det` * :c:data:`psi_bilinear_matrix_columns_loc` * :c:data:`n_det_selectors` - * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`state_average_weight` @@ -2566,8 +2577,9 @@ Subroutines / functions * :c:data:`n_states` * :c:data:`pt2_f` * :c:data:`n_det_generators` - * :c:data:`pt2_match_weight` + * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`n_int` + * :c:data:`pseudo_sym` Called by: @@ -2592,6 +2604,7 @@ Subroutines / functions * :c:func:`save_wavefunction` * :c:func:`selection_collector` * :c:func:`selection_slave_inproc` + * :c:func:`update_pt2_and_variance_weights` * :c:func:`write_double` Touches: @@ -2607,4 +2620,5 @@ Subroutines / functions * :c:data:`psi_det_size` * :c:data:`psi_det_sorted_bit` * :c:data:`pt2_match_weight` + * :c:data:`variance_match_weight` diff --git a/docs/source/modules/iterations.rst b/docs/source/modules/iterations.rst index ab1d5065..81adc6a9 100644 --- a/docs/source/modules/iterations.rst +++ b/docs/source/modules/iterations.rst @@ -160,6 +160,13 @@ Subroutines / functions * :c:func:`run_cipsi` * :c:func:`run_stochastic_cipsi` + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`print_energy_components` + .. c:function:: save_iterations: diff --git a/docs/source/programs/fci.rst b/docs/source/programs/fci.rst index e0441d91..5979c28d 100644 --- a/docs/source/programs/fci.rst +++ b/docs/source/programs/fci.rst @@ -89,6 +89,7 @@ fci * :c:data:`pt2_match_weight` * :c:data:`pt2_stoch_istate` * :c:data:`read_wf` + * :c:data:`selection_weight` * :c:data:`state_average_weight` * :c:data:`threshold_generators` * :c:data:`variance_match_weight` diff --git a/docs/source/programs/pt2.rst b/docs/source/programs/pt2.rst index 45726526..4878bb4d 100644 --- a/docs/source/programs/pt2.rst +++ b/docs/source/programs/pt2.rst @@ -55,5 +55,6 @@ pt2 * :c:data:`pt2_e0_denominator` * :c:data:`pt2_stoch_istate` * :c:data:`read_wf` + * :c:data:`selection_weight` * :c:data:`state_average_weight` * :c:data:`threshold_generators` diff --git a/docs/source/programs/rotate_mos.rst b/docs/source/programs/rotate_mos.rst new file mode 100644 index 00000000..e5b4353c --- /dev/null +++ b/docs/source/programs/rotate_mos.rst @@ -0,0 +1,37 @@ +.. _rotate_mos: + +.. program:: rotate_mos + +========== +rotate_mos +========== + + + + + Rotates molecular orbitals i and j by combining them as + $1/\sqrt{2} ( \phi_i + \phi_j )$ and + $1/\sqrt{2} ( \phi_i - \phi_j )$. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`mo_num` + * :c:data:`mo_coef` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`save_mos` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_coef` diff --git a/docs/source/programs/sort_by_fock_energies.rst b/docs/source/programs/sort_by_fock_energies.rst new file mode 100644 index 00000000..5d0e0d9f --- /dev/null +++ b/docs/source/programs/sort_by_fock_energies.rst @@ -0,0 +1,39 @@ +.. _sort_by_fock_energies: + +.. program:: sort_by_fock_energies + +===================== +sort_by_fock_energies +===================== + + + + + Program that saves the current |MOs| ordered by diagonal element of the Fock operator. + + Warning : the Fock operator, and therefore its matrix elements, depends on the occupancy. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`fock_matrix_mo` + * :c:data:`ao_num` + * :c:data:`mo_num` + * :c:data:`mo_coef` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dsort` + * :c:func:`save_mos` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_coef` diff --git a/docs/source/programs/swap_mos.rst b/docs/source/programs/swap_mos.rst new file mode 100644 index 00000000..c2d3440e --- /dev/null +++ b/docs/source/programs/swap_mos.rst @@ -0,0 +1,27 @@ +.. _swap_mos: + +.. program:: swap_mos + +======== +swap_mos +======== + + + + + Swaps the indices of two molecular orbitals + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`mo_coef` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`save_mos` diff --git a/docs/source/programs/test.rst b/docs/source/programs/test.rst new file mode 100644 index 00000000..6595f24d --- /dev/null +++ b/docs/source/programs/test.rst @@ -0,0 +1,19 @@ +.. _test: + +.. program:: test + +==== +test +==== + + + + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`two_e_integrals_index` + * :c:func:`two_e_integrals_index_reverse` diff --git a/man/fci.1 b/man/fci.1 index 9f565169..e4b4dd50 100644 --- a/man/fci.1 +++ b/man/fci.1 @@ -125,10 +125,10 @@ Touches: \fBpsi_occ_pattern\fP .IP \(bu 2 \fBc0_weight\fP -.UNINDENT -.INDENT 2.0 .IP \(bu 2 \fBdistributed_davidson\fP +.UNINDENT +.INDENT 2.0 .IP \(bu 2 \fBpsi_coef\fP .IP \(bu 2 @@ -143,10 +143,10 @@ Touches: \fBpsi_energy\fP .IP \(bu 2 \fBpsi_occ_pattern\fP -.UNINDENT -.INDENT 2.0 .IP \(bu 2 \fBpsi_energy\fP +.UNINDENT +.INDENT 2.0 .IP \(bu 2 \fBpt2_e0_denominator\fP .IP \(bu 2 @@ -156,6 +156,8 @@ Touches: .IP \(bu 2 \fBread_wf\fP .IP \(bu 2 +\fBselection_weight\fP +.IP \(bu 2 \fBstate_average_weight\fP .IP \(bu 2 \fBthreshold_generators\fP diff --git a/man/pt2.1 b/man/pt2.1 index 2c70c66e..5902f81a 100644 --- a/man/pt2.1 +++ b/man/pt2.1 @@ -104,6 +104,8 @@ Touches: .IP \(bu 2 \fBread_wf\fP .IP \(bu 2 +\fBselection_weight\fP +.IP \(bu 2 \fBstate_average_weight\fP .IP \(bu 2 \fBthreshold_generators\fP diff --git a/man/rotate_mos.1 b/man/rotate_mos.1 new file mode 100644 index 00000000..54acbc0d --- /dev/null +++ b/man/rotate_mos.1 @@ -0,0 +1,85 @@ +.\" Man page generated from reStructuredText. +. +.TH "ROTATE_MOS" "1" "Jun 15, 2019" "2.0" "Quantum Package" +.SH NAME +rotate_mos \- | Quantum Package > +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.INDENT 0.0 +.INDENT 3.5 +Rotates molecular orbitals i and j by combining them as +$1/sqrt{2} ( phi_i + phi_j )$ and +$1/sqrt{2} ( phi_i \- phi_j )$. +.sp +Needs: +.INDENT 0.0 +.INDENT 2.0 +.IP \(bu 2 +\fBao_num\fP +.UNINDENT +.INDENT 2.0 +.IP \(bu 2 +\fBmo_num\fP +.UNINDENT +.INDENT 2.0 +.IP \(bu 2 +\fBmo_coef\fP +.UNINDENT +.UNINDENT +.sp +Calls: +.INDENT 0.0 +.INDENT 2.0 +.IP \(bu 2 +\fBsave_mos()\fP +.UNINDENT +.INDENT 2.0 +.UNINDENT +.INDENT 2.0 +.UNINDENT +.UNINDENT +.sp +Touches: +.INDENT 0.0 +.INDENT 2.0 +.IP \(bu 2 +\fBmo_coef\fP +.UNINDENT +.INDENT 2.0 +.UNINDENT +.INDENT 2.0 +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.SH AUTHOR +A. Scemama, E. Giner +.SH COPYRIGHT +2019, A. Scemama, E. Giner +.\" Generated by docutils manpage writer. +. diff --git a/man/sort_by_fock_energies.1 b/man/sort_by_fock_energies.1 new file mode 100644 index 00000000..ac6dd64c --- /dev/null +++ b/man/sort_by_fock_energies.1 @@ -0,0 +1,89 @@ +.\" Man page generated from reStructuredText. +. +.TH "SORT_BY_FOCK_ENERGIES" "1" "Jun 15, 2019" "2.0" "Quantum Package" +.SH NAME +sort_by_fock_energies \- | Quantum Package > +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.INDENT 0.0 +.INDENT 3.5 +Program that saves the current MOs ordered by diagonal element of the Fock operator. +.sp +Warning : the Fock operator, and therefore its matrix elements, depends on the occupancy. +.sp +Needs: +.INDENT 0.0 +.INDENT 2.0 +.IP \(bu 2 +\fBfock_matrix_mo\fP +.IP \(bu 2 +\fBao_num\fP +.UNINDENT +.INDENT 2.0 +.IP \(bu 2 +\fBmo_num\fP +.UNINDENT +.INDENT 2.0 +.IP \(bu 2 +\fBmo_coef\fP +.UNINDENT +.UNINDENT +.sp +Calls: +.INDENT 0.0 +.INDENT 2.0 +.IP \(bu 2 +\fBdsort()\fP +.UNINDENT +.INDENT 2.0 +.IP \(bu 2 +\fBsave_mos()\fP +.UNINDENT +.INDENT 2.0 +.UNINDENT +.UNINDENT +.sp +Touches: +.INDENT 0.0 +.INDENT 2.0 +.IP \(bu 2 +\fBmo_coef\fP +.UNINDENT +.INDENT 2.0 +.UNINDENT +.INDENT 2.0 +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.SH AUTHOR +A. Scemama, E. Giner +.SH COPYRIGHT +2019, A. Scemama, E. Giner +.\" Generated by docutils manpage writer. +. diff --git a/man/swap_mos.1 b/man/swap_mos.1 new file mode 100644 index 00000000..73bfc4b0 --- /dev/null +++ b/man/swap_mos.1 @@ -0,0 +1,69 @@ +.\" Man page generated from reStructuredText. +. +.TH "SWAP_MOS" "1" "Jun 15, 2019" "2.0" "Quantum Package" +.SH NAME +swap_mos \- | Quantum Package > +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.INDENT 0.0 +.INDENT 3.5 +Swaps the indices of two molecular orbitals +.sp +Needs: +.INDENT 0.0 +.INDENT 2.0 +.IP \(bu 2 +\fBao_num\fP +.UNINDENT +.INDENT 2.0 +.IP \(bu 2 +\fBmo_coef\fP +.UNINDENT +.INDENT 2.0 +.UNINDENT +.UNINDENT +.sp +Calls: +.INDENT 0.0 +.INDENT 2.0 +.IP \(bu 2 +\fBsave_mos()\fP +.UNINDENT +.INDENT 2.0 +.UNINDENT +.INDENT 2.0 +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.SH AUTHOR +A. Scemama, E. Giner +.SH COPYRIGHT +2019, A. Scemama, E. Giner +.\" Generated by docutils manpage writer. +. diff --git a/src/tools/rotate_mos.irp.f b/src/tools/rotate_mos.irp.f index 3e79c4f7..30185474 100644 --- a/src/tools/rotate_mos.irp.f +++ b/src/tools/rotate_mos.irp.f @@ -1,18 +1,27 @@ program rotate_mos - implicit none - integer :: iorb,jorb - read(5,*)iorb,jorb - double precision, allocatable :: mo_coef_tmp(:,:) - allocate(mo_coef_tmp(ao_num,mo_num)) - mo_coef_tmp = mo_coef - integer :: i,j - double precision :: dsqrt2_inv - dsqrt2_inv = 1.d0/dsqrt(2.d0) - do i = 1, ao_num - mo_coef(i,iorb) = dsqrt2_inv * ( mo_coef_tmp(i,iorb) + mo_coef_tmp(i,jorb) ) - mo_coef(i,jorb) = dsqrt2_inv * ( mo_coef_tmp(i,iorb) - mo_coef_tmp(i,jorb) ) - enddo - touch mo_coef - call save_mos + implicit none + BEGIN_DOC + ! Rotates molecular orbitals i and j by combining them as + ! $1/\sqrt{2} ( \phi_i + \phi_j )$ and + ! $1/\sqrt{2} ( \phi_i - \phi_j )$. + END_DOC + integer :: iorb,jorb + integer :: i,j + double precision :: dsqrt2_inv + double precision, allocatable :: mo_coef_tmp(:,:) + read(5,*)iorb,jorb + + allocate(mo_coef_tmp(ao_num,mo_num)) + mo_coef_tmp = mo_coef + + dsqrt2_inv = 1.d0/dsqrt(2.d0) + do i = 1, ao_num + mo_coef(i,iorb) = dsqrt2_inv * ( mo_coef_tmp(i,iorb) + mo_coef_tmp(i,jorb) ) + mo_coef(i,jorb) = dsqrt2_inv * ( mo_coef_tmp(i,iorb) - mo_coef_tmp(i,jorb) ) + enddo + + touch mo_coef + call save_mos + end diff --git a/src/tools/sort_by_fock_energies.irp.f b/src/tools/sort_by_fock_energies.irp.f index 89b30780..4f903c7b 100644 --- a/src/tools/sort_by_fock_energies.irp.f +++ b/src/tools/sort_by_fock_energies.irp.f @@ -1,32 +1,38 @@ program sort_by_fock_energies - BEGIN_DOC -! programs that save the current mos ordered by Diagonal element of the Fock operator. -! -! Warning : the Fock operator, and therefore its matrix elements, depends on the occupancy. - END_DOC - implicit none - integer :: i,j,k - integer, allocatable :: iorder(:) - double precision, allocatable :: fock_energies_tmp(:), new_mo_coef(:,:) - allocate(iorder(mo_num), fock_energies_tmp(mo_num),new_mo_coef(ao_num,mo_num)) - do i = 1, mo_num - fock_energies_tmp(i) = Fock_matrix_diag_mo(i) - print*,'fock_energies_tmp(i) = ',fock_energies_tmp(i) - iorder(i) = i - enddo - print*,'' - print*,'Sorting by Fock energies' - print*,'' - call dsort(fock_energies_tmp,iorder,mo_num) - do i = 1, mo_num - k = iorder(i) - print*,'fock_energies_new(i) = ',fock_energies_tmp(i) - do j = 1, ao_num - new_mo_coef(j,i) = mo_coef(j,k) - enddo - enddo - mo_coef = new_mo_coef - touch mo_coef - call save_mos + BEGIN_DOC + ! Program that saves the current |MOs| ordered by diagonal element of the Fock operator. + ! + ! Warning : the Fock operator, and therefore its matrix elements, depends on the occupancy. + END_DOC + implicit none + integer :: i,j,k + integer, allocatable :: iorder(:) + double precision, allocatable :: fock_energies_tmp(:), new_mo_coef(:,:) + allocate(iorder(mo_num), fock_energies_tmp(mo_num),new_mo_coef(ao_num,mo_num)) + + do i = 1, mo_num + fock_energies_tmp(i) = Fock_matrix_diag_mo(i) + print*,'fock_energies_tmp(i) = ',fock_energies_tmp(i) + iorder(i) = i + enddo + + print*,'' + print*,'Sorting by Fock energies' + print*,'' + + call dsort(fock_energies_tmp,iorder,mo_num) + + do i = 1, mo_num + k = iorder(i) + print*,'fock_energies_new(i) = ',fock_energies_tmp(i) + do j = 1, ao_num + new_mo_coef(j,i) = mo_coef(j,k) + enddo + enddo + + mo_coef = new_mo_coef + touch mo_coef + call save_mos + end diff --git a/src/tools/swap_mos.irp.f b/src/tools/swap_mos.irp.f index 80a29965..bba9cb34 100644 --- a/src/tools/swap_mos.irp.f +++ b/src/tools/swap_mos.irp.f @@ -1,7 +1,10 @@ program swap_mos implicit none - integer :: i,j, i1, i2 - double precision :: x + BEGIN_DOC + ! Swaps the indices of two molecular orbitals + END_DOC + integer :: i,j, i1, i2 + double precision :: x print *, 'MOs to swap?' read(*,*) i1, i2 do i=1,ao_num @@ -10,5 +13,5 @@ program swap_mos mo_coef(i,i2) = x enddo call save_mos - + end From 191d8ff0af7989644ce035b571e22ee7b1a8b2bf Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 15 Jun 2019 00:43:09 +0200 Subject: [PATCH 4/6] Added qp_tunnel --- bin/qp_tunnel | 71 ----- docs/source/users_guide/qp_tunnel.rst | 89 ++++++ man/qp_tunnel.1 | 139 +++++++++ man/rotate_mos.1 | 2 +- man/test.1 | 55 ++++ ocaml/.merlin | 2 +- ocaml/qp_tunnel.ml | 402 ++++++++++++++++++++++++++ src/zmq/utils.irp.f | 5 - 8 files changed, 687 insertions(+), 78 deletions(-) delete mode 100755 bin/qp_tunnel create mode 100644 docs/source/users_guide/qp_tunnel.rst create mode 100644 man/qp_tunnel.1 create mode 100644 man/test.1 create mode 100644 ocaml/qp_tunnel.ml diff --git a/bin/qp_tunnel b/bin/qp_tunnel deleted file mode 100755 index 554c28ae..00000000 --- a/bin/qp_tunnel +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python2 - - -""" -Creates an ssh tunnel for using slaves on another network. -Launch a server on the front-end node of the cluster on which the master -process runs. Then start a client ont the front-end node of the distant -cluster. - -Usage: - qp_tunnel server EZFIO_DIR - qp_tunnel client
EZFIO_DIR - -Options: - -h --help - -""" - -import os -import sys -import zmq - -try: - import qp_path -except ImportError: - print "source .quantum_package.rc" - raise - -from docopt import docopt -from ezfio import ezfio - - -def get_address(filename): - with open(os.path.join(filename,'work','qp_run_address'),'r') as f: - a = f.readlines()[0].strip() - return a - - -def set_address(filename,address): - with open(os.path.join(filename,'work','qp_run_address'),'r') as f: - backup = f.readlines() - - with open(os.path.join(filename,'work','qp_run_address'),'w') as f: - f.write('\n'.join([address]+backup)) - - -def main_server(arguments,filename): - destination = get_address(filename) - print destination - - -def main_client(arguments,filename): - destination = arguments["
"] - print destination - - -def main(arguments): - """Main function""" - - print arguments - filename = arguments["EZFIO_DIR"] - - if arguments["server"]: - return main_server(arguments, filename) - if arguments["client"]: - return main_client(arguments, filename) - - -if __name__ == '__main__': - ARGUMENTS = docopt(__doc__) - main(ARGUMENTS) diff --git a/docs/source/users_guide/qp_tunnel.rst b/docs/source/users_guide/qp_tunnel.rst new file mode 100644 index 00000000..254216fa --- /dev/null +++ b/docs/source/users_guide/qp_tunnel.rst @@ -0,0 +1,89 @@ +.. _qp_tunnel: + +========= +qp_tunnel +========= + +.. TODO + +.. program:: qp_tunnel + +Establishes a tunnel to allow communications between machines within +different networks, for example multiple MPI slave jobs running on +different clusters. + + +Usage +----- + +.. code:: bash + + qp_tunnel [-g] (ADDRESS|EZFIO_DIR) + +``EZFIO_DIR`` is the name of the |EZFIO| directory containing the data, +and ``ADDRESS`` is the address of another tunnel. + + +.. option:: -h, --help + + Displays the help message + + +.. option:: -g, --get-input + + Download the EZFIO directory from the remote instance of qp_tunnel. + + +Example +------- + +.. code:: text + + +-------------------+ +------------------+ + | | | | + | N1_1 N1_2 N1_3 | | N2_1 N2_2 N2_3 | + | | | | | | | | | | + | +----+----+ | | +----+----+ | + | | | | | | + | C1 F1 | | F2 C2 | + | +---------=----=--------+ | + | | | | + +-------------------+ +------------------+ + + +Imagine you have two clusters, C1 and C2. Each cluster is accessible via SSH +on a front-end named respectively F1 and F2. Groups of nodes N1 and N2 have +been reserved by the batch scheduling system on both clusters. +Each node in N1 is on the same network as the other nodes of N1, but they +can't access the network on which the nodes of N2 are. + +1) Start a parallel simulation on the cluster C1, running on nodes N1. + We assume that there is a shared file system, such that F1 can access + the EZFIO directory. We also assume that F1 can communicate with the + nodes of N1. + +2) Run a tunnel on the front-end F1 and keep it running: + +.. code:: bash + + me@f1 $ qp_tunnel my_directory.ezfio + Connect to: + tcp://31.122.230.47:42379 + Ready + +3) On the front-end F2, run another instance connecting to the other one, + which will fetch the |EZFIO| directory: + +.. code:: bash + + me@f2 $ qp_tunnel --get-input tcp://31.122.230.47:42379 + Connect to: + tcp://31.122.209.139:42379 + Communication [ OK ] + Getting input... my_directory.ezfio ...done + Ready + +4) Keep the tunnel running, and you can now run a slave simulation within the + nodes N2. + + diff --git a/man/qp_tunnel.1 b/man/qp_tunnel.1 new file mode 100644 index 00000000..42fa9288 --- /dev/null +++ b/man/qp_tunnel.1 @@ -0,0 +1,139 @@ +.\" Man page generated from reStructuredText. +. +.TH "QP_TUNNEL" "1" "Jun 15, 2019" "2.0" "Quantum Package" +.SH NAME +qp_tunnel \- | Quantum Package > +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +Establishes a tunnel to allow communications between machines within +different networks, for example multiple MPI slave jobs running on +different clusters. +.SH USAGE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +qp_tunnel [\-g] (ADDRESS|EZFIO_DIR) +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBEZFIO_DIR\fP is the name of the \fI\%EZFIO\fP directory containing the data, +and \fBADDRESS\fP is the address of another tunnel. +.INDENT 0.0 +.TP +.B \-h, \-\-help +Displays the help message +.UNINDENT +.INDENT 0.0 +.TP +.B \-g, \-\-get\-input +Download the EZFIO directory from the remote instance of qp_tunnel. +.UNINDENT +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +| | | | +| N1_1 N1_2 N1_3 | | N2_1 N2_2 N2_3 | +| | | | | | | | | | +| +\-\-\-\-+\-\-\-\-+ | | +\-\-\-\-+\-\-\-\-+ | +| | | | | | +| C1 F1 | | F2 C2 | +| +\-\-\-\-\-\-\-\-\-=\-\-\-\-=\-\-\-\-\-\-\-\-+ | +| | | | ++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Imagine you have two clusters, C1 and C2. Each cluster is accessible via SSH +on a front\-end named respectively F1 and F2. Groups of nodes N1 and N2 have +been reserved by the batch scheduling system on both clusters. +Each node in N1 is on the same network as the other nodes of N1, but they +can’t access the network on which the nodes of N2 are. +.INDENT 0.0 +.IP 1. 3 +Start a parallel simulation on the cluster C1, running on nodes N1. +We assume that there is a shared file system, such that F1 can access +the EZFIO directory. We also assume that F1 can communicate with the +nodes of N1. +.IP 2. 3 +Run a tunnel on the front\-end F1 and keep it running: +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +me@f1 $ qp_tunnel my_directory.ezfio +Connect to: +tcp://31.122.230.47:42379 +Ready +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.IP 3. 3 +On the front\-end F2, run another instance connecting to the other one, +which will fetch the \fI\%EZFIO\fP directory: +.UNINDENT +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +me@f2 $ qp_tunnel \-\-get\-input tcp://31.122.230.47:42379 +Connect to: +tcp://31.122.209.139:42379 +Communication [ OK ] +Getting input... my_directory.ezfio ...done +Ready +.ft P +.fi +.UNINDENT +.UNINDENT +.INDENT 0.0 +.IP 4. 3 +Keep the tunnel running, and you can now run a slave simulation within the +nodes N2. +.UNINDENT +.SH AUTHOR +A. Scemama, E. Giner +.SH COPYRIGHT +2019, A. Scemama, E. Giner +.\" Generated by docutils manpage writer. +. diff --git a/man/rotate_mos.1 b/man/rotate_mos.1 index 54acbc0d..27dcaedb 100644 --- a/man/rotate_mos.1 +++ b/man/rotate_mos.1 @@ -34,7 +34,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .INDENT 3.5 Rotates molecular orbitals i and j by combining them as $1/sqrt{2} ( phi_i + phi_j )$ and -$1/sqrt{2} ( phi_i \- phi_j )$. +$1/sqrt{2} ( phi_i - phi_j )$. .sp Needs: .INDENT 0.0 diff --git a/man/test.1 b/man/test.1 new file mode 100644 index 00000000..33d2dc79 --- /dev/null +++ b/man/test.1 @@ -0,0 +1,55 @@ +.\" Man page generated from reStructuredText. +. +.TH "TEST" "1" "Jun 15, 2019" "2.0" "Quantum Package" +.SH NAME +test \- | Quantum Package > +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.INDENT 0.0 +.INDENT 3.5 +Calls: +.INDENT 0.0 +.INDENT 2.0 +.IP \(bu 2 +\fBtwo_e_integrals_index()\fP +.UNINDENT +.INDENT 2.0 +.IP \(bu 2 +\fBtwo_e_integrals_index_reverse()\fP +.UNINDENT +.INDENT 2.0 +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.SH AUTHOR +A. Scemama, E. Giner +.SH COPYRIGHT +2019, A. Scemama, E. Giner +.\" Generated by docutils manpage writer. +. diff --git a/ocaml/.merlin b/ocaml/.merlin index 3683fed6..84403fc0 100644 --- a/ocaml/.merlin +++ b/ocaml/.merlin @@ -1,4 +1,4 @@ -PKG core ZMQ cryptokit +PKG core zmq cryptokit B _build/ diff --git a/ocaml/qp_tunnel.ml b/ocaml/qp_tunnel.ml new file mode 100644 index 00000000..c35a2bac --- /dev/null +++ b/ocaml/qp_tunnel.ml @@ -0,0 +1,402 @@ +open Qputils +open Qptypes + +type ezfio_or_address = EZFIO of string | ADDRESS of string +type req_or_sub = REQ | SUB + +let localport = 42379 + +let () = + let open Command_line in + begin + "Creates an ssh tunnel for using slaves on another network. Launch a server on the front-end node of the cluster on which the master process runs. Then start a client ont the front-end node of the distant cluster." + + |> set_footer_doc ; + + [ { short='g' ; long="get-input" ; opt=Optional ; + doc="Downloads the EZFIO directory." ; + arg=Without_arg; } ; + + anonymous + "(EZFIO_DIR|ADDRESS)" + Mandatory + "EZFIO directory or address."; + ] |> set_specs + end; + + let arg = + let x = + match Command_line.anon_args () with + | [x] -> x + | _ -> begin + Command_line.help () ; + failwith "EZFIO_FILE or ADDRESS is missing" + end + in + if Sys.file_exists x && Sys.is_directory x then + EZFIO x + else + ADDRESS x + in + + + + + let localhost = + Lazy.force TaskServer.ip_address + in + + + let long_address = + match arg with + | ADDRESS x -> x + | EZFIO x -> + let ic = + Filename.concat (Qpackage.ezfio_work x) "qp_run_address" + |> open_in + in + let result = + input_line ic + |> String.trim + in + close_in ic; + result + in + + let protocol, address, port = + match String.split_on_char ':' long_address with + | t :: a :: p :: [] -> t, a, int_of_string p + | _ -> failwith @@ + Printf.sprintf "%s : Malformed address" long_address + in + + + let zmq_context = + Zmq.Context.create () + in + + + (** Check availability of the ports *) + let localport = + let dummy_socket = + Zmq.Socket.create zmq_context Zmq.Socket.rep + in + let rec try_new_port port_number = + try + List.iter (fun i -> + let address = + Printf.sprintf "tcp://%s:%d" localhost (port_number+i) + in + Zmq.Socket.bind dummy_socket address; + Zmq.Socket.unbind dummy_socket address + ) [ 0;1;2;3;4;5;6;7;8;9 ] ; + port_number + with + | Unix.Unix_error _ -> try_new_port (port_number+100) + in + let result = + try_new_port localport + in + Zmq.Socket.close dummy_socket; + result + in + + + let create_socket sock_type bind_or_connect addr = + let socket = + Zmq.Socket.create zmq_context sock_type + in + let () = + try + bind_or_connect socket addr + with + | _ -> failwith @@ + Printf.sprintf "Unable to establish connection to %s." addr + in + socket + in + + + (* Handle termination *) + let run_status = ref true in + let handler = + Sys.Signal_handle (fun signum -> + run_status := false; + Sys.set_signal signum Sys.Signal_default + ) + in + Sys.set_signal Sys.sigusr1 handler; + Sys.set_signal Sys.sigint handler; + + + let new_thread req_or_sub addr_in addr_out = + let socket_in, socket_out = + match req_or_sub with + | REQ -> + create_socket Zmq.Socket.rep Zmq.Socket.bind addr_in, + create_socket Zmq.Socket.req Zmq.Socket.connect addr_out + | SUB -> + create_socket Zmq.Socket.sub Zmq.Socket.connect addr_in, + create_socket Zmq.Socket.pub Zmq.Socket.bind addr_out + in + + if req_or_sub = SUB then + Zmq.Socket.subscribe socket_in ""; + + + let action = + match req_or_sub with + | REQ -> (fun () -> + Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out; + Zmq.Socket.recv_all socket_out |> Zmq.Socket.send_all socket_in ) + | SUB -> (fun () -> + Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out) + in + + + let pollitem = + Zmq.Poll.mask_of + [| (socket_in, Zmq.Poll.In) |] + in + + + while !run_status do + + let polling = + Zmq.Poll.poll ~timeout:1000 pollitem + in + + match polling.(0) with + | Some Zmq.Poll.In -> action () + | None -> () + | Some Zmq.Poll.In_out + | Some Zmq.Poll.Out -> () + + done; + + Zmq.Socket.close socket_in; + Zmq.Socket.close socket_out; + in + + + + let ocaml_thread = + let addr_out = + Printf.sprintf "tcp:%s:%d" address port + in + + let addr_in = + Printf.sprintf "tcp://*:%d" localport + in + + let f () = + new_thread REQ addr_in addr_out + in + + (Thread.create f) () + in + Printf.printf "Connect to:\ntcp://%s:%d\n%!" localhost localport; + + + let fortran_thread = + let addr_out = + Printf.sprintf "tcp:%s:%d" address (port+2) + in + + let addr_in = + Printf.sprintf "tcp://*:%d" (localport+2) + in + + let f () = + new_thread REQ addr_in addr_out + in + (Thread.create f) () + in + + + let pub_thread = + let addr_in = + Printf.sprintf "tcp:%s:%d" address (port+1) + in + + let addr_out = + Printf.sprintf "tcp://*:%d" (localport+1) + in + + let f () = + new_thread SUB addr_in addr_out + in + (Thread.create f) () + in + + + + let input_thread = + let f () = + let addr_out = + match arg with + | EZFIO _ -> None + | ADDRESS _ -> Some ( + Printf.sprintf "tcp:%s:%d" address (port+9) ) + in + + let addr_in = + Printf.sprintf "tcp://*:%d" (localport+9) + in + + let socket_in = + create_socket Zmq.Socket.rep Zmq.Socket.bind addr_in + in + + let socket_out = + match addr_out with + | Some addr_out -> Some ( + create_socket Zmq.Socket.req Zmq.Socket.connect addr_out) + | None -> None + in + + let temp_file = + Filename.temp_file "qp_tunnel" ".tar.gz" + in + + let get_ezfio_filename () = + match arg with + | EZFIO x -> x + | ADDRESS _ -> + begin + match socket_out with + | None -> assert false + | Some socket_out -> ( + Zmq.Socket.send socket_out "get_ezfio_filename" ; + Zmq.Socket.recv socket_out +) + end + in + + let get_input () = + match arg with + | EZFIO x -> + begin + Printf.sprintf "tar -zcf %s %s" temp_file x + |> Sys.command |> ignore; + let fd = + Unix.openfile temp_file [Unix.O_RDONLY] 0o640 + in + let len = + Unix.lseek fd 0 Unix.SEEK_END + in + ignore @@ Unix.lseek fd 0 Unix.SEEK_SET ; + let bstr = + Unix.map_file fd Bigarray.char + Bigarray.c_layout false [| len |] + |> Bigarray.array1_of_genarray + in + let result = + String.init len (fun i -> bstr.{i}) ; + in + Unix.close fd; + Sys.remove temp_file; + result + end + | ADDRESS _ -> + begin + match socket_out with + | None -> assert false + | Some socket_out -> ( + Zmq.Socket.send socket_out "get_input" ; + Zmq.Socket.recv socket_out +) + end + in + + let () = + match socket_out with + | None -> () + | Some socket_out -> + Zmq.Socket.send socket_out "test"; + Printf.printf "Communication [ %s ]\n%!" (Zmq.Socket.recv socket_out); + in + + (* Download input if asked *) + if Command_line.get_bool "get-input" then + begin + match arg with + | EZFIO _ -> () + | ADDRESS _ -> + begin + Printf.printf "Getting input... %!"; + let ezfio_filename = + get_ezfio_filename () + in + Printf.printf "%s%!" ezfio_filename; + let oc = + open_out temp_file + in + get_input () + |> output_string oc; + close_out oc; + Printf.sprintf "tar -zxf %s" temp_file + |> Sys.command |> ignore ; + let oc = + Filename.concat (Qpackage.ezfio_work ezfio_filename) "qp_run_address" + |> open_out + in + Printf.fprintf oc "tcp://%s:%d\n" localhost localport; + close_out oc; + Printf.printf " ...done\n%!" + end + end; + + (* Main loop *) + let pollitem = + Zmq.Poll.mask_of [| (socket_in, Zmq.Poll.In) |] + in + + let action () = + match Zmq.Socket.recv socket_in with + | "get_input" -> get_input () + |> Zmq.Socket.send socket_in + | "get_ezfio_filename" -> get_ezfio_filename () + |> Zmq.Socket.send socket_in + | "test" -> Zmq.Socket.send socket_in "OK" + | x -> Printf.sprintf "Message '%s' not understood" x + |> Zmq.Socket.send socket_in + in + + Printf.printf "Ready\n%!"; + while !run_status do + + let polling = + Zmq.Poll.poll ~timeout:1000 pollitem + in + + match polling.(0) with + | Some Zmq.Poll.In -> action () + | None -> () + | Some Zmq.Poll.In_out + | Some Zmq.Poll.Out -> () + + done; + + let () = + match socket_out with + | Some socket_out -> Zmq.Socket.close socket_out + | None -> () + in + Zmq.Socket.close socket_in + in + + (Thread.create f) () + in + + (* Termination *) + Thread.join input_thread; + Thread.join fortran_thread; + Thread.join pub_thread; + Thread.join ocaml_thread; + Zmq.Context.terminate zmq_context; + Printf.printf "qp_tunnel exited properly.\n" + + + + diff --git a/src/zmq/utils.irp.f b/src/zmq/utils.irp.f index 1205e09e..2a0c1d2e 100644 --- a/src/zmq/utils.irp.f +++ b/src/zmq/utils.irp.f @@ -301,7 +301,6 @@ function new_zmq_push_socket(thread) END_DOC integer, intent(in) :: thread integer :: rc - character*(8), external :: zmq_port integer(ZMQ_PTR) :: new_zmq_push_socket call omp_set_lock(zmq_lock) @@ -425,7 +424,6 @@ subroutine end_zmq_pair_socket(zmq_socket_pair) END_DOC integer(ZMQ_PTR), intent(in) :: zmq_socket_pair integer :: rc - character*(8), external :: zmq_port call omp_set_lock(zmq_lock) rc = f77_zmq_close(zmq_socket_pair) @@ -445,7 +443,6 @@ subroutine end_zmq_pull_socket(zmq_socket_pull) END_DOC integer(ZMQ_PTR), intent(in) :: zmq_socket_pull integer :: rc - character*(8), external :: zmq_port ! rc = f77_zmq_setsockopt(zmq_socket_pull,ZMQ_LINGER,0,4) ! if (rc /= 0) then @@ -472,7 +469,6 @@ subroutine end_zmq_push_socket(zmq_socket_push,thread) integer, intent(in) :: thread integer(ZMQ_PTR), intent(in) :: zmq_socket_push integer :: rc - character*(8), external :: zmq_port rc = f77_zmq_setsockopt(zmq_socket_push,ZMQ_LINGER,300000,4) if (rc /= 0) then @@ -1032,7 +1028,6 @@ subroutine end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) ! Terminate the socket from the application to qp_run END_DOC integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket - character*(8), external :: zmq_port integer :: rc rc = f77_zmq_setsockopt(zmq_to_qp_run_socket,ZMQ_LINGER,300000,4) From 35f7f7b773fb3a63f73d4087b3c790eac7ded98a Mon Sep 17 00:00:00 2001 From: Emmanuel Giner LCT Date: Thu, 13 Jun 2019 15:58:04 +0200 Subject: [PATCH 5/6] added scan functional --- src/dft_utils_in_r/mo_in_r.irp.f | 30 +++++++++ src/dft_utils_one_e/ec_lyp.irp.f | 36 ++++++----- src/dft_utils_one_e/ec_scan.irp.f | 102 ++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 16 deletions(-) create mode 100644 src/dft_utils_one_e/ec_scan.irp.f diff --git a/src/dft_utils_in_r/mo_in_r.irp.f b/src/dft_utils_in_r/mo_in_r.irp.f index 9c92481c..60cd59f2 100644 --- a/src/dft_utils_in_r/mo_in_r.irp.f +++ b/src/dft_utils_in_r/mo_in_r.irp.f @@ -22,6 +22,7 @@ BEGIN_PROVIDER[double precision, mos_grad_in_r_array,(mo_num,n_points_final_grid,3)] +&BEGIN_PROVIDER[double precision, mos_grad_in_r_array_tranp,(3,mo_num,n_points_final_grid)] implicit none BEGIN_DOC ! mos_grad_in_r_array(i,j,k) = value of the kth component of the gradient of ith mo on the jth grid point @@ -35,8 +36,37 @@ do m=1,3 call dgemm('N','N',mo_num,n_points_final_grid,ao_num,1.d0,mo_coef_transp,mo_num,aos_grad_in_r_array(1,1,m),ao_num,0.d0,mos_grad_in_r_array(1,1,m),mo_num) enddo + integer :: i,j + do i = 1, n_points_final_grid + do j = 1, mo_num + do m = 1, 3 + mos_grad_in_r_array_tranp(m,j,i) = mos_grad_in_r_array(j,i,m) + enddo + enddo + enddo END_PROVIDER + BEGIN_PROVIDER [double precision, alpha_dens_kin_in_r, (n_points_final_grid)] +&BEGIN_PROVIDER [double precision, beta_dens_kin_in_r, (n_points_final_grid)] + implicit none + integer :: i,m,j + alpha_dens_kin_in_r = 0.d0 + beta_dens_kin_in_r = 0.d0 + do i = 1, n_points_final_grid + do j = 1, elec_alpha_num + do m = 1, 3 + alpha_dens_kin_in_r(i) += 0.5d0 * mos_grad_in_r_array_tranp(m,j,i)**2.d0 + enddo + enddo + do j = 1, elec_beta_num + do m = 1, 3 + beta_dens_kin_in_r(i) += 0.5d0 * mos_grad_in_r_array_tranp(m,j,i)**2.d0 + enddo + enddo + enddo + + END_PROVIDER + BEGIN_PROVIDER[double precision, mos_lapl_in_r_array,(mo_num,n_points_final_grid,3)] implicit none BEGIN_DOC diff --git a/src/dft_utils_one_e/ec_lyp.irp.f b/src/dft_utils_one_e/ec_lyp.irp.f index 0e3daa65..22d15a9c 100644 --- a/src/dft_utils_one_e/ec_lyp.irp.f +++ b/src/dft_utils_one_e/ec_lyp.irp.f @@ -35,11 +35,8 @@ double precision function ec_lyp_88(rho,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,gr include 'constants.include.F' ! Input variables - double precision, intent(in) :: rho,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,grad_rho_2 - ! Local variables - double precision :: a,b,c,d,c_f,omega,delta double precision :: rho_13,rho_inv_13,rho_83,rho_113,rho_inv_113,denom double precision :: thr,huge_num,rho_inv @@ -47,8 +44,6 @@ double precision function ec_lyp_88(rho,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,gr double precision :: tmp1,tmp2,tmp3,tmp4 double precision :: big1,big2,big3 -! Output variables - ! Constants of the LYP correlation functional @@ -57,15 +52,25 @@ double precision function ec_lyp_88(rho,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,gr c = 0.2533d0 d = 0.349d0 - thr = 1d-10 + ec_lyp_88 = 0.d0 + + thr = 1d-15 huge_num = 1.d0/thr + if(dabs(rho_a).lt.thr)then + return + endif + + if(dabs(rho_b).lt.thr)then + return + endif if(rho.lt.0.d0)then print*,'pb !! rho.lt.0.d0' stop endif - rho_13 = rho**(1d0/3d0) - rho_113 = rho**(11d0/3d0) + + rho_13 = rho**(1.d0/3.d0) + rho_113 = rho**(11.d0/3.d0) if(dabs(rho_13) < thr) then rho_inv_13 = huge_num @@ -76,13 +81,13 @@ double precision function ec_lyp_88(rho,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,gr if (dabs(rho_113) < thr) then rho_inv_113 = huge_num else - rho_inv_113 = 1d0/rho_113 + rho_inv_113 = 1.d0/rho_113 endif if (dabs(rho) < thr) then rho_inv = huge_num else - rho_inv = 1d0/rho + rho_inv = 1.d0/rho endif ! Useful quantities to predefine @@ -90,21 +95,21 @@ double precision function ec_lyp_88(rho,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,gr denom = 1d0/(1d0 + d*rho_inv_13) omega = rho_inv_113*exp(-c*rho_inv_13)*denom delta = c*rho_inv_13 + d*rho_inv_13*denom - c_f = 0.3d0*(3d0*pi*pi)**(2d0/3d0) + c_f = 0.3d0*(3.d0*pi*pi)**(2.d0/3.d0) rho_2 = rho *rho rho_a_2 = rho_a*rho_a rho_b_2 = rho_b*rho_b - cst_2_113 = 2d0**(11d0/3d0) - cst_8_3 = 8d0/3d0 + cst_2_113 = 2.d0**(11.d0/3.d0) + cst_8_3 = 8.d0/3.d0 ! first term in the equation (2) of Preuss CPL, 1989 - big1 = 4d0*denom*rho_a*rho_b*rho_inv + big1 = 4.d0*denom*rho_a*rho_b*rho_inv tmp1 = cst_2_113*c_f*(rho_a**cst_8_3 + rho_b**cst_8_3) - tmp2 = (47d0/18d0 - 7d0/18d0*delta)*grad_rho_2 + tmp2 = (47.d0/18.d0 - 7.d0/18.d0*delta)*grad_rho_2 tmp3 = - (5d0/2d0 - 1.d0/18d0*delta)*(grad_rho_a_2 + grad_rho_b_2) tmp4 = - (delta - 11d0)/9d0*(rho_a*rho_inv*grad_rho_a_2 + rho_b*rho_inv*grad_rho_b_2) big2 = rho_a*rho_b*(tmp1 + tmp2 + tmp3 + tmp4) @@ -114,7 +119,6 @@ double precision function ec_lyp_88(rho,rho_a,rho_b,grad_rho_a_2,grad_rho_b_2,gr tmp3 = grad_rho_a_2*(2d0/3d0*rho_2 - rho_b_2) big3 = tmp1 + tmp2 + tmp3 - ec_lyp_88 = -a*big1 -a*b*omega*big2 -a*b*omega*big3 end diff --git a/src/dft_utils_one_e/ec_scan.irp.f b/src/dft_utils_one_e/ec_scan.irp.f new file mode 100644 index 00000000..0aa4b5ca --- /dev/null +++ b/src/dft_utils_one_e/ec_scan.irp.f @@ -0,0 +1,102 @@ +double precision function ec_scan(rho_a,rho_b,tau,grad_rho_2) + include 'constants.include.F' + implicit none + double precision, intent(in) :: rho_a,rho_b,tau,grad_rho_2 + double precision :: cst_13,cst_23,cst_43,cst_53,rho_inv,cst_18,cst_3pi2 + double precision :: thr,nup,ndo,xi,s,spin_d,drho,drho2,rho,inv_1alph,e_c_lsda1,h0 + double precision :: rs,t_w,t_unif,ds_xi,alpha,fc_alpha,step_f,cst_1alph,beta_inf + double precision :: c_1c,c_2c,d_c,e_c_ldsa1,h1,phi,t,beta_rs,gama,a,w_1,g_at2,phi_3,e_c_1 + double precision :: b_1c,b_2c,b_3c,dx_xi,gc_xi,e_c_lsda0,w_0,g_inf,cx_xi,x_inf,f0,e_c_0 + thr = 1.d-12 + nup = max(rho_a,thr) + ndo = max(rho_b,thr) + rho = nup + ndo + ec_scan = 0.d0 + if((rho).lt.thr)return + ! constants ... + rho_inv = 1.d0/rho + cst_13 = 1.d0/3.d0 + cst_23 = 2.d0 * cst_13 + cst_43 = 4.d0 * cst_13 + cst_53 = 5.d0 * cst_13 + cst_18 = 1.d0/8.d0 + cst_3pi2 = 3.d0 * pi*pi + drho2 = max(grad_rho_2,thr) + drho = dsqrt(drho2) + spin_d = max(nup-ndo,thr) + c_1c = 0.64d0 + c_2c = 1.5d0 + d_c = 0.7d0 + b_1c = 0.0285764d0 + b_2c = 0.0889d0 + b_3c = 0.125541d0 + gama = 0.031091d0 + ! correlation energy lsda1 + call ec_only_lda_sr(0.d0,nup,ndo,e_c_lsda1) + + xi = spin_d/rho + rs = (cst_43 * pi * rho)**(-cst_13) + s = drho/( 2.d0 * cst_3pi2**(cst_13) * rho**cst_43 ) + t_w = drho2 * cst_18 + ds_xi = 0.5d0 * ( (1.d0+xi)**cst_53 + (1.d0 - xi)**cst_53) + t_unif = 0.3d0 * (cst_3pi2)**cst_23 * rho**cst_53*ds_xi + t_unif = max(t_unif,thr) + alpha = (tau - t_w)/t_unif + cst_1alph= 1.d0 - alpha + cst_1alph= max(cst_1alph,thr) + inv_1alph= 1.d0/cst_1alph + phi = 0.5d0 * ( (1.d0+xi)**cst_23 + (1.d0 - xi)**cst_23) + phi_3 = phi*phi*phi + t = (cst_3pi2/16.d0)**cst_13 * s / (phi * rs**0.5d0) + w_1 = dexp(-e_c_lsda1/(gama * phi_3)) + a = beta_rs(rs) /(gama * w_1) + g_at2 = 1.d0/(1.d0 + 4.d0 * a*t*t) + h1 = gama * phi_3 * dlog(1.d0 + w_1 * (1.d0 - g_at2)) + ! interpolation function + fc_alpha = dexp(-c_1c * alpha * inv_1alph) * step_f(cst_1alph) - d_c * dexp(c_2c * inv_1alph) * step_f(-cst_1alph) + ! first part of the correlation energy + e_c_1 = e_c_lsda1 + h1 + + dx_xi = 0.5d0 * ( (1.d0+xi)**cst_43 + (1.d0 - xi)**cst_43) + gc_xi = (1.d0 - 2.3631d0 * (dx_xi - 1.d0) ) * (1.d0 - xi**12.d0) + e_c_lsda0= - b_1c / (1.d0 + b_2c * rs**0.5d0 + b_3c * rs) + w_0 = dexp(-e_c_lsda0/b_1c) - 1.d0 + beta_inf = 0.066725d0 * 0.1d0 / 0.1778d0 + cx_xi = -3.d0/(4.d0*pi) * (9.d0 * pi/4.d0)**cst_13 * dx_xi + + if(dabs(xi).lt.thr)then + x_inf = 0.128026d0 + else + x_inf = (cst_3pi2/16.d0)**cst_23 * beta_inf * phi/(cx_xi - f0) + endif + f0 = -0.9d0 + g_inf = 1.d0/(1.d0 + 4.d0 * x_inf * s*s)**0.25d0 + + h0 = b_1c * dlog(1.d0 + w_0 * (1.d0 * g_inf)) + e_c_0 = (e_c_lsda0 + h0) * gc_xi + + ec_scan = e_c_1 + fc_alpha * (e_c_0 - e_c_1) + if(isnan(ec_scan))then + print*,'isnan(ec_scan)' + print*,'e_c_1 + fc_alpha * e_c_0' + print*, e_c_1 , fc_alpha , e_c_0 + stop + endif +end + +double precision function step_f(x) + implicit none + double precision, intent(in) :: x + if(x.lt.0.d0)then + step_f = 0.d0 + else + step_f = 1.d0 + endif +end + +double precision function beta_rs(rs) + implicit none + double precision, intent(in) ::rs + beta_rs(rs) = 0.066725d0 * (1.d0 + 0.1d0 * rs)/(1.d0 + 0.1778d0 * rs) + +end From f877b41ef545b56bcdf85184531e2e9934175c44 Mon Sep 17 00:00:00 2001 From: Emmanuel Giner LCT Date: Thu, 13 Jun 2019 19:07:01 +0200 Subject: [PATCH 6/6] added kinetic density --- src/dft_utils_in_r/kin_dens.irp.f | 15 +++++++++++++++ src/dft_utils_one_e/ec_scan.irp.f | 32 +++++++++++++++---------------- 2 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 src/dft_utils_in_r/kin_dens.irp.f diff --git a/src/dft_utils_in_r/kin_dens.irp.f b/src/dft_utils_in_r/kin_dens.irp.f new file mode 100644 index 00000000..008d6b2d --- /dev/null +++ b/src/dft_utils_in_r/kin_dens.irp.f @@ -0,0 +1,15 @@ +BEGIN_PROVIDER [double precision, kinetic_density_generalized, (n_points_final_grid)] + implicit none + integer :: i,j,m,i_point + kinetic_density_generalized = 0.d0 + do i_point = 1, n_points_final_grid + do i = 1, mo_num + do j = 1, mo_num + do m = 1, 3 + kinetic_density_generalized(i_point) += 0.5d0 * mos_grad_in_r_array_tranp(m,j,i_point) * mos_grad_in_r_array_tranp(m,i,i_point) * one_e_dm_mo_for_dft(j,i,1) + enddo + enddo + enddo + enddo + +END_PROVIDER diff --git a/src/dft_utils_one_e/ec_scan.irp.f b/src/dft_utils_one_e/ec_scan.irp.f index 0aa4b5ca..7a4b587b 100644 --- a/src/dft_utils_one_e/ec_scan.irp.f +++ b/src/dft_utils_one_e/ec_scan.irp.f @@ -23,7 +23,11 @@ double precision function ec_scan(rho_a,rho_b,tau,grad_rho_2) cst_3pi2 = 3.d0 * pi*pi drho2 = max(grad_rho_2,thr) drho = dsqrt(drho2) - spin_d = max(nup-ndo,thr) + if((nup-ndo).gt.0.d0)then + spin_d = max(nup-ndo,thr) + else + spin_d = min(nup-ndo,-thr) + endif c_1c = 0.64d0 c_2c = 1.5d0 d_c = 0.7d0 @@ -37,20 +41,24 @@ double precision function ec_scan(rho_a,rho_b,tau,grad_rho_2) xi = spin_d/rho rs = (cst_43 * pi * rho)**(-cst_13) s = drho/( 2.d0 * cst_3pi2**(cst_13) * rho**cst_43 ) - t_w = drho2 * cst_18 + t_w = drho2 * cst_18 * rho_inv ds_xi = 0.5d0 * ( (1.d0+xi)**cst_53 + (1.d0 - xi)**cst_53) t_unif = 0.3d0 * (cst_3pi2)**cst_23 * rho**cst_53*ds_xi t_unif = max(t_unif,thr) alpha = (tau - t_w)/t_unif cst_1alph= 1.d0 - alpha - cst_1alph= max(cst_1alph,thr) + if(cst_1alph.gt.0.d0)then + cst_1alph= max(cst_1alph,thr) + else + cst_1alph= min(cst_1alph,-thr) + endif inv_1alph= 1.d0/cst_1alph phi = 0.5d0 * ( (1.d0+xi)**cst_23 + (1.d0 - xi)**cst_23) phi_3 = phi*phi*phi t = (cst_3pi2/16.d0)**cst_13 * s / (phi * rs**0.5d0) - w_1 = dexp(-e_c_lsda1/(gama * phi_3)) + w_1 = dexp(-e_c_lsda1/(gama * phi_3)) - 1.d0 a = beta_rs(rs) /(gama * w_1) - g_at2 = 1.d0/(1.d0 + 4.d0 * a*t*t) + g_at2 = 1.d0/(1.d0 + 4.d0 * a*t*t)**0.25d0 h1 = gama * phi_3 * dlog(1.d0 + w_1 * (1.d0 - g_at2)) ! interpolation function fc_alpha = dexp(-c_1c * alpha * inv_1alph) * step_f(cst_1alph) - d_c * dexp(c_2c * inv_1alph) * step_f(-cst_1alph) @@ -64,24 +72,14 @@ double precision function ec_scan(rho_a,rho_b,tau,grad_rho_2) beta_inf = 0.066725d0 * 0.1d0 / 0.1778d0 cx_xi = -3.d0/(4.d0*pi) * (9.d0 * pi/4.d0)**cst_13 * dx_xi - if(dabs(xi).lt.thr)then - x_inf = 0.128026d0 - else - x_inf = (cst_3pi2/16.d0)**cst_23 * beta_inf * phi/(cx_xi - f0) - endif + x_inf = 0.128026d0 f0 = -0.9d0 g_inf = 1.d0/(1.d0 + 4.d0 * x_inf * s*s)**0.25d0 - h0 = b_1c * dlog(1.d0 + w_0 * (1.d0 * g_inf)) + h0 = b_1c * dlog(1.d0 + w_0 * (1.d0 - g_inf)) e_c_0 = (e_c_lsda0 + h0) * gc_xi ec_scan = e_c_1 + fc_alpha * (e_c_0 - e_c_1) - if(isnan(ec_scan))then - print*,'isnan(ec_scan)' - print*,'e_c_1 + fc_alpha * e_c_0' - print*, e_c_1 , fc_alpha , e_c_0 - stop - endif end double precision function step_f(x)