diff --git a/src/cp_control_types.F b/src/cp_control_types.F index 3a66586d19..b4471bab6e 100644 --- a/src/cp_control_types.F +++ b/src/cp_control_types.F @@ -328,6 +328,7 @@ MODULE cp_control_types INTEGER :: do_ppl_method INTEGER :: wf_interpolation_method_nr INTEGER :: wf_extrapolation_order + INTEGER :: periodicity REAL(KIND=dp) :: cutoff REAL(KIND=dp), DIMENSION(:), POINTER :: e_cutoff TYPE(mulliken_restraint_type), & @@ -443,9 +444,12 @@ MODULE cp_control_types INTEGER :: nprocs !> type of kernel function/approximation to use INTEGER :: kernel - !> fro full kernel, do we have HFX/ADMM + !> for full kernel, do we have HFX/ADMM LOGICAL :: do_hfx LOGICAL :: do_admm + !> for full kernel, do we have long-range HFX and/or Kxc potential + LOGICAL :: do_hfxlr + LOGICAL :: do_exck !> options used in sTDA calculation (Kernel) TYPE(stda_control_type) :: stda_control !> algorithm to correct orbital energies diff --git a/src/cp_control_utils.F b/src/cp_control_utils.F index 3a08f0aec3..48e5f7645e 100644 --- a/src/cp_control_utils.F +++ b/src/cp_control_utils.F @@ -1056,8 +1056,13 @@ CONTAINS l_val=qs_control%dftb_control%hb_sr_damp) CALL section_vals_val_get(dftb_section, "EPS_DISP", & r_val=qs_control%dftb_control%eps_disp) - CALL section_vals_val_get(dftb_section, "DO_EWALD", & - l_val=qs_control%dftb_control%do_ewald) + CALL section_vals_val_get(dftb_section, "DO_EWALD", explicit=explicit) + IF (explicit) THEN + CALL section_vals_val_get(dftb_section, "DO_EWALD", & + l_val=qs_control%dftb_control%do_ewald) + ELSE + qs_control%dftb_control%do_ewald = (qs_control%periodicity /= 0) + END IF CALL section_vals_val_get(dftb_parameter, "PARAM_FILE_PATH", & c_val=qs_control%dftb_control%sk_file_path) CALL section_vals_val_get(dftb_parameter, "PARAM_FILE_NAME", & @@ -1095,8 +1100,13 @@ CONTAINS ! xTB code IF (qs_control%xtb) THEN - CALL section_vals_val_get(xtb_section, "DO_EWALD", & - l_val=qs_control%xtb_control%do_ewald) + CALL section_vals_val_get(xtb_section, "DO_EWALD", explicit=explicit) + IF (explicit) THEN + CALL section_vals_val_get(xtb_section, "DO_EWALD", & + l_val=qs_control%xtb_control%do_ewald) + ELSE + qs_control%xtb_control%do_ewald = (qs_control%periodicity /= 0) + END IF CALL section_vals_val_get(xtb_section, "STO_NG", i_val=ngauss) qs_control%xtb_control%sto_ng = ngauss CALL section_vals_val_get(xtb_section, "HYDROGEN_STO_NG", i_val=ngauss) @@ -1405,7 +1415,19 @@ CONTAINS t_control%stda_control%hfx_fraction = 0.0_dp t_control%stda_control%do_exchange = .TRUE. t_control%stda_control%eps_td_filter = 1.e-10_dp - t_control%stda_control%do_ewald = .FALSE. + ! set default for Ewald method (on/off) dependent on periodicity + SELECT CASE (qs_control%periodicity) + CASE (0) + t_control%stda_control%do_ewald = .FALSE. + CASE (1) + t_control%stda_control%do_ewald = .TRUE. + CASE (2) + t_control%stda_control%do_ewald = .TRUE. + CASE (3) + t_control%stda_control%do_ewald = .TRUE. + CASE DEFAULT + CPABORT("Illegal value for periodiciy") + END SELECT END IF CALL section_vals_get(stda_section, explicit=explicit) IF (explicit) THEN diff --git a/src/input_cp2k_dft.F b/src/input_cp2k_dft.F index d4d1d90ebb..b7053d0a04 100644 --- a/src/input_cp2k_dft.F +++ b/src/input_cp2k_dft.F @@ -16,14 +16,13 @@ MODULE input_cp2k_dft basis_sort_zet USE bibliography, ONLY: & Andermatt2016, Andreussi2012, Avezac2005, BaniHashemian2016, Becke1988b, Bengtsson1999, & - Blochl1995, Brehm2018, Brehm2020, Brehm2021, Brelaz1979, Dewar1977, Dewar1985, & - Dudarev1997, Dudarev1998, Ehrhardt1985, Fattebert2002, Golze2017a, Golze2017b, Guidon2010, & - Heinzmann1976, Holmberg2017, Holmberg2018, Iannuzzi2005, Iannuzzi2006, Iannuzzi2007, & - Kolafa2004, Krack2000, Krack2002, Kuhne2007, Kunert2003, Lippert1997, Lippert1999, Lu2004, & - Perdew1981, Repasky2002, Rocha2006, Rycroft2009, Schenter2008, Schiffmann2015, & - Shigeta2001, Stewart1982, Stewart1989, Stewart2007, Thiel1992, Thomas2015, VanVoorhis2015, & - VandeVondele2003, VandeVondele2005a, VandeVondele2005b, VandeVondele2006, Weber2008, & - Yin2017 + Blochl1995, Brehm2018, Brelaz1979, Dewar1977, Dewar1985, Dudarev1997, Dudarev1998, & + Ehrhardt1985, Fattebert2002, Golze2017a, Golze2017b, Guidon2010, Heinzmann1976, & + Holmberg2017, Holmberg2018, Iannuzzi2005, Iannuzzi2006, Iannuzzi2007, Kolafa2004, & + Krack2000, Krack2002, Kuhne2007, Kunert2003, Lippert1997, Lippert1999, Lu2004, Perdew1981, & + Repasky2002, Rocha2006, Schenter2008, Schiffmann2015, Shigeta2001, Stewart1982, & + Stewart1989, Stewart2007, Thiel1992, VanVoorhis2015, VandeVondele2003, VandeVondele2005a, & + VandeVondele2005b, VandeVondele2006, Weber2008, Yin2017 USE cp_output_handling, ONLY: add_last_numeric,& cp_print_key_section_create,& debug_print_level,& @@ -92,15 +91,14 @@ MODULE input_cp2k_dft slater, smear_energy_window, smear_fermi_dirac, smear_list, sparse_guess, tddfpt_davidson, & tddfpt_excitations, tddfpt_lanczos, tddfpt_singlet, tddfpt_spin_cons, tddfpt_spin_flip, & tddfpt_triplet, use_mom_ref_coac, use_mom_ref_com, use_mom_ref_user, use_mom_ref_zero, & - use_restart_wfn, use_rt_restart, use_scf_wfn, voro_radii_cov, voro_radii_unity, & - voro_radii_user, voro_radii_vdw, wannier_projection, weight_type_mass, weight_type_unit, & - wfi_aspc_nr, wfi_frozen_method_nr, wfi_linear_p_method_nr, wfi_linear_ps_method_nr, & - wfi_linear_wf_method_nr, wfi_ps_method_nr, wfi_use_guess_method_nr, & - wfi_use_prev_p_method_nr, wfi_use_prev_rho_r_method_nr, wfi_use_prev_wf_method_nr, & - xas_1s_type, xas_2p_type, xas_2s_type, xas_3d_type, xas_3p_type, xas_3s_type, xas_4d_type, & - xas_4f_type, xas_4p_type, xas_4s_type, xas_dip_len, xas_dip_vel, xas_dscf, xas_none, & - xas_not_excited, xas_tdp_by_index, xas_tdp_by_kind, xas_tp_fh, xas_tp_flex, xas_tp_hh, & - xas_tp_xfh, xas_tp_xhh, xes_tp_val + use_restart_wfn, use_rt_restart, use_scf_wfn, wannier_projection, weight_type_mass, & + weight_type_unit, wfi_aspc_nr, wfi_frozen_method_nr, wfi_linear_p_method_nr, & + wfi_linear_ps_method_nr, wfi_linear_wf_method_nr, wfi_ps_method_nr, & + wfi_use_guess_method_nr, wfi_use_prev_p_method_nr, wfi_use_prev_rho_r_method_nr, & + wfi_use_prev_wf_method_nr, xas_1s_type, xas_2p_type, xas_2s_type, xas_3d_type, & + xas_3p_type, xas_3s_type, xas_4d_type, xas_4f_type, xas_4p_type, xas_4s_type, xas_dip_len, & + xas_dip_vel, xas_dscf, xas_none, xas_not_excited, xas_tdp_by_index, xas_tdp_by_kind, & + xas_tp_fh, xas_tp_flex, xas_tp_hh, xas_tp_xfh, xas_tp_xhh, xes_tp_val USE input_cp2k_almo, ONLY: create_almo_scf_section USE input_cp2k_distribution, ONLY: create_distribution_section USE input_cp2k_ec, ONLY: create_ec_section @@ -122,6 +120,7 @@ MODULE input_cp2k_dft USE input_cp2k_tb, ONLY: create_dftb_control_section,& create_xtb_control_section USE input_cp2k_transport, ONLY: create_transport_section + USE input_cp2k_voronoi, ONLY: create_print_voronoi_section USE input_cp2k_xc, ONLY: create_xc_fun_section,& create_xc_section USE input_keyword_types, ONLY: keyword_create,& @@ -1311,95 +1310,16 @@ CONTAINS CALL section_release(print_key) ! Voronoi Integration via LibVori - CALL cp_print_key_section_create(print_key, __LOCATION__, name="VORONOI", & - description="Controls the Voronoi integration of the total electron density"// & - " for the computation of electromagnetic moments, see [Thomas2015],"// & - " [Brehm2020], and [Brehm2021] (via LibVori,"// & - " see "// & - " https://brehm-research.de/voronoi ).", & - print_level=debug_print_level + 1, filename="", & - citations=(/Rycroft2009, Thomas2015, Brehm2018, Brehm2020, Brehm2021/)) - - CALL keyword_create(keyword, __LOCATION__, name="APPEND", & - description="Appends frames to already existing .voronoi file.", & - default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="SANITY_CHECK", & - description="Performs a sanity check before each Voronoi integration, i.e.,"// & - " checks if every grid point is located in exactly one Voronoi cell.", & - usage="SANITY_CHECK T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="OVERWRITE", & - description="Specify this keyword to overwrite any existing ""properties.emp"" file if"// & - " it already exists. By default, the data is appended to an existing .emp file.", & - usage="OVERWRITE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="SKIP_FIRST", & - description="Skips the first step of a MD run (avoids duplicate step if restarted).", & - usage="SKIP_FIRST T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="VERBOSE", & - description="Switches on verbose screen output of the Voronoi integration.", & - usage="VERBOSE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="OUTPUT_EMP", & - description="Writes the resulting electromagnetic moments to a binary file ""properties.emp""."// & - " The file name cannot be changed.", & - usage="OUTPUT_EMP T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="OUTPUT_TEXT", & - description="Writes the resulting electromagnetic moments to text files (*.voronoi)."// & - " The file name is specified via FILENAME.", & - usage="OUTPUT_TEXT T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="REFINEMENT_FACTOR", & - description="Sets the refinement factor for the Voronoi integration.", & - usage="REFINEMENT 2", n_var=1, default_i_val=1, type_of_var=integer_t) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="VORONOI_RADII", & - description="Which atomic radii to use for the radical Voronoi tessellation.", & - usage="VORONOI_RADII {UNITY,VDW,COVALENT,USER}", repeats=.FALSE., n_var=1, & - default_i_val=voro_radii_vdw, & - enum_c_vals=s2a("UNITY", "VDW", "COVALENT", "USER"), & - enum_desc=s2a("Use unity radii (non-radical Voronoi tessellation)", "Use VdW atom radii", & - "Use covalent atom radii", "Use user-specified atom radii"), & - enum_i_vals=(/voro_radii_unity, voro_radii_vdw, voro_radii_cov, voro_radii_user/)) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="USER_RADII", & - description="Defines user atom radii for the radical Voronoi tessellation (one per atom).", & - usage="USER_RADII {real} {real} {real}", repeats=.FALSE., & - unit_str="angstrom", & - type_of_var=real_t, n_var=-1) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - + CALL create_print_voronoi_section(print_key) CALL section_add_subsection(section, print_key) CALL section_release(print_key) -! cube files for data generated by the implicit (generalized) Poisson solver + ! cube files for data generated by the implicit (generalized) Poisson solver CALL create_implicit_psolver_section(subsection) CALL section_add_subsection(section, subsection) CALL section_release(subsection) -! ZMP adding the print section for the v_xc cube + ! ZMP adding the print section for the v_xc cube CALL cp_print_key_section_create(print_key, __LOCATION__, "v_xc_cube", & description="Controls the printing of a cube file with xc "// & " potential generated by the ZMP method (for the moment). It is "// & diff --git a/src/input_cp2k_ec.F b/src/input_cp2k_ec.F index 215c510c4a..bddebeed95 100644 --- a/src/input_cp2k_ec.F +++ b/src/input_cp2k_ec.F @@ -14,11 +14,7 @@ MODULE input_cp2k_ec USE bibliography, ONLY: Niklasson2003,& VandeVondele2012,& - brehm2018,& - brehm2020,& - brehm2021,& - rycroft2009,& - thomas2015 + brehm2018 USE cp_output_handling, ONLY: cp_print_key_section_create,& debug_print_level,& high_print_level @@ -30,9 +26,9 @@ MODULE input_cp2k_ec ls_s_inversion_sign_sqrt, ls_s_preconditioner_atomic, ls_s_preconditioner_molecular, & ls_s_preconditioner_none, ls_s_sqrt_ns, ls_s_sqrt_proot, ls_scf_sign_ns, & ls_scf_sign_proot, ot_precond_full_all, ot_precond_full_kinetic, ot_precond_full_single, & - ot_precond_full_single_inverse, ot_precond_none, ot_precond_s_inverse, precond_mlp, & - voro_radii_cov, voro_radii_unity, voro_radii_user, voro_radii_vdw + ot_precond_full_single_inverse, ot_precond_none, ot_precond_s_inverse, precond_mlp USE input_cp2k_mm, ONLY: create_dipoles_section + USE input_cp2k_voronoi, ONLY: create_print_voronoi_section USE input_cp2k_xc, ONLY: create_xc_section USE input_keyword_types, ONLY: keyword_create,& keyword_release,& @@ -43,8 +39,7 @@ MODULE input_cp2k_ec section_release,& section_type USE input_val_types, ONLY: char_t,& - integer_t,& - real_t + integer_t USE kinds, ONLY: dp USE string_utilities, ONLY: s2a #include "./base/base_uses.f90" @@ -595,86 +590,8 @@ CONTAINS CALL section_release(print_key) ! Voronoi Integration via LibVori - CALL cp_print_key_section_create(print_key, __LOCATION__, name="VORONOI", & - description="Controls the Voronoi integration of the total electron density"// & - " for the computation of electromagnetic moments, see [Thomas2015],"// & - " [Brehm2020], and [Brehm2021] (via LibVori,"// & - " see "// & - " https://brehm-research.de/voronoi ).", & - print_level=debug_print_level + 1, filename="", & - citations=(/Rycroft2009, Thomas2015, Brehm2018, Brehm2020, Brehm2021/)) - - CALL keyword_create(keyword, __LOCATION__, name="APPEND", & - description="Appends frames to already existing .voronoi file.", & - default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="SANITY_CHECK", & - description="Performs a sanity check before each Voronoi integration, i.e.,"// & - " checks if every grid point is located in exactly one Voronoi cell.", & - usage="SANITY_CHECK T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="OVERWRITE", & - description="Specify this keyword to overwrite any existing ""properties.emp"" file if"// & - " it already exists. By default, the data is appended to an existing .emp file.", & - usage="OVERWRITE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="SKIP_FIRST", & - description="Skips the first step of a MD run (avoids duplicate step if restarted).", & - usage="SKIP_FIRST T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="VERBOSE", & - description="Switches on verbose screen output of the Voronoi integration.", & - usage="VERBOSE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="OUTPUT_EMP", & - description="Writes the resulting electromagnetic moments to a binary file ""properties.emp""."// & - " The file name cannot be changed.", & - usage="OUTPUT_EMP T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="OUTPUT_TEXT", & - description="Writes the resulting electromagnetic moments to text files (*.voronoi)."// & - " The file name is specified via FILENAME.", & - usage="OUTPUT_TEXT T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="REFINEMENT_FACTOR", & - description="Sets the refinement factor for the Voronoi integration.", & - usage="REFINEMENT 2", n_var=1, default_i_val=1, type_of_var=integer_t) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="VORONOI_RADII", & - description="Which atomic radii to use for the radical Voronoi tessellation.", & - usage="VORONOI_RADII {UNITY,VDW,COVALENT,USER}", repeats=.FALSE., n_var=1, & - default_i_val=voro_radii_vdw, & - enum_c_vals=s2a("UNITY", "VDW", "COVALENT", "USER"), & - enum_desc=s2a("Use unity radii (non-radical Voronoi tessellation)", "Use VdW atom radii", & - "Use covalent atom radii", "Use user-specified atom radii"), & - enum_i_vals=(/voro_radii_unity, voro_radii_vdw, voro_radii_cov, voro_radii_user/)) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - - CALL keyword_create(keyword, __LOCATION__, name="USER_RADII", & - description="Defines user atom radii for the radical Voronoi tessellation (one per atom).", & - usage="USER_RADII {real} {real} {real}", repeats=.FALSE., & - unit_str="angstrom", & - type_of_var=real_t, n_var=-1) - CALL section_add_keyword(print_key, keyword) - CALL keyword_release(keyword) - + NULLIFY (print_key) + CALL create_print_voronoi_section(print_key) CALL section_add_subsection(section, print_key) CALL section_release(print_key) diff --git a/src/input_cp2k_voronoi.F b/src/input_cp2k_voronoi.F new file mode 100644 index 0000000000..da924443af --- /dev/null +++ b/src/input_cp2k_voronoi.F @@ -0,0 +1,156 @@ +!--------------------------------------------------------------------------------------------------! +! CP2K: A general program to perform molecular dynamics simulations ! +! Copyright 2000-2022 CP2K developers group ! +! ! +! SPDX-License-Identifier: GPL-2.0-or-later ! +!--------------------------------------------------------------------------------------------------! + +! ************************************************************************************************** +!> \brief function that build the dft section of the input +!> \par History +!> 10.2005 moved out of input_cp2k [fawzi] +!> \author fawzi +! ************************************************************************************************** +MODULE input_cp2k_voronoi + USE bibliography, ONLY: Brehm2018,& + Brehm2020,& + Brehm2021,& + Rycroft2009,& + Thomas2015 + USE cp_output_handling, ONLY: cp_print_key_section_create,& + debug_print_level + USE input_constants, ONLY: voro_radii_cov,& + voro_radii_unity,& + voro_radii_user,& + voro_radii_vdw + USE input_keyword_types, ONLY: keyword_create,& + keyword_release,& + keyword_type + USE input_section_types, ONLY: section_add_keyword,& + section_type + USE input_val_types, ONLY: integer_t,& + lchar_t,& + real_t + USE string_utilities, ONLY: s2a +#include "./base/base_uses.f90" + + IMPLICIT NONE + PRIVATE + + CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_voronoi' + + PUBLIC :: create_print_voronoi_section + +CONTAINS + +! ************************************************************************************************** +!> \brief Create the print voronoi section +!> \param print_key ... +!> \author Martin Brehm +! ************************************************************************************************** + SUBROUTINE create_print_voronoi_section(print_key) + TYPE(section_type), POINTER :: print_key + + TYPE(keyword_type), POINTER :: keyword + + CPASSERT(.NOT. ASSOCIATED(print_key)) + + ! Voronoi Integration via LibVori + CALL cp_print_key_section_create(print_key, __LOCATION__, name="VORONOI", & + description="Controls the Voronoi integration of the total electron density"// & + " for the computation of electromagnetic moments, see [Thomas2015],"// & + " [Brehm2020], and [Brehm2021] (via LibVori,"// & + " see "// & + " https://brehm-research.de/voronoi ).", & + print_level=debug_print_level + 1, filename="", & + citations=(/Rycroft2009, Thomas2015, Brehm2018, Brehm2020, Brehm2021/)) + + NULLIFY (keyword) + CALL keyword_create(keyword, __LOCATION__, name="APPEND", & + description="Appends frames to already existing .voronoi file.", & + default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + CALL keyword_create(keyword, __LOCATION__, name="SANITY_CHECK", & + description="Performs a sanity check before each Voronoi integration, i.e.,"// & + " checks if every grid point is located in exactly one Voronoi cell.", & + usage="SANITY_CHECK T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + CALL keyword_create(keyword, __LOCATION__, name="OVERWRITE", & + description="Specify this keyword to overwrite any existing ""properties.emp"" file if"// & + " it already exists. By default, the data is appended to an existing .emp file.", & + usage="OVERWRITE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + CALL keyword_create(keyword, __LOCATION__, name="SKIP_FIRST", & + description="Skips the first step of a MD run (avoids duplicate step if restarted).", & + usage="SKIP_FIRST T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + CALL keyword_create(keyword, __LOCATION__, name="VERBOSE", & + description="Switches on verbose screen output of the Voronoi integration.", & + usage="VERBOSE T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + CALL keyword_create(keyword, __LOCATION__, name="OUTPUT_EMP", & + description="Writes the resulting electromagnetic moments to a binary file ""properties.emp""."// & + " The file name cannot be changed.", & + usage="OUTPUT_EMP T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + CALL keyword_create(keyword, __LOCATION__, name="OUTPUT_TEXT", & + description="Writes the resulting electromagnetic moments to text files (*.voronoi)."// & + " The file name is specified via FILENAME.", & + usage="OUTPUT_TEXT T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + CALL keyword_create(keyword, __LOCATION__, name="REFINEMENT_FACTOR", & + description="Sets the refinement factor for the Voronoi integration.", & + usage="REFINEMENT 2", n_var=1, default_i_val=1, type_of_var=integer_t) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + CALL keyword_create(keyword, __LOCATION__, name="VORONOI_RADII", & + description="Which atomic radii to use for the radical Voronoi tessellation.", & + usage="VORONOI_RADII {UNITY,VDW,COVALENT,USER}", repeats=.FALSE., n_var=1, & + default_i_val=voro_radii_vdw, & + enum_c_vals=s2a("UNITY", "VDW", "COVALENT", "USER"), & + enum_desc=s2a("Use unity radii (non-radical Voronoi tessellation)", "Use VdW atom radii", & + "Use covalent atom radii", "Use user-specified atom radii"), & + enum_i_vals=(/voro_radii_unity, voro_radii_vdw, voro_radii_cov, voro_radii_user/)) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + CALL keyword_create(keyword, __LOCATION__, name="USER_RADII", & + description="Defines user atom radii for the radical Voronoi tessellation (one per atom).", & + usage="USER_RADII {real} {real} {real}", repeats=.FALSE., & + unit_str="angstrom", & + type_of_var=real_t, n_var=-1) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + CALL keyword_create(keyword, __LOCATION__, name="MOLECULAR_PROPERTIES", & + description="Calculation of molecular properties from Voronoi integration.", & + usage="MOLECULAR_PROPERTIES T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + CALL keyword_create(keyword, __LOCATION__, name="MOLPROP_FILE_NAME", & + description="Root of the file name where to print molecular properties."// & + " filename.molprop is used.", & + usage="MOLPROP_FILE_NAME ", & + default_lc_val="__STD_OUT__", type_of_var=lchar_t) + CALL section_add_keyword(print_key, keyword) + CALL keyword_release(keyword) + + END SUBROUTINE create_print_voronoi_section + +END MODULE input_cp2k_voronoi diff --git a/src/input_cp2k_xc.F b/src/input_cp2k_xc.F index d0ea045e07..d162a50a8e 100644 --- a/src/input_cp2k_xc.F +++ b/src/input_cp2k_xc.F @@ -837,6 +837,94 @@ CONTAINS END SUBROUTINE create_xc_potential_section ! ************************************************************************************************** +!> \brief creates the structure of the section needed to select an xc kernel +!> \param section the section that will be created +!> \author JGH +! ************************************************************************************************** + SUBROUTINE create_xc_kernel_section(section) + TYPE(section_type), POINTER :: section + + TYPE(keyword_type), POINTER :: keyword + TYPE(section_type), POINTER :: subsection + + CPASSERT(.NOT. ASSOCIATED(section)) + CALL section_create(section, __LOCATION__, name="XC_KERNEL", & + description="The xc kernel to use (CAREFUL: xc kernel here refers "// & + "to kernels that are not derived from an xc functional, but rather are "// & + "modelled directly. This kernel will be used in a TDDFPT calculation. "// & + "Cannot be combined with XC_FUNCTIONAL or XC_POTENTIAL.", & + n_keywords=1, n_subsections=1, repeats=.FALSE.) + + NULLIFY (subsection, keyword) + CALL section_create(subsection, __LOCATION__, name="UZH2022", & + description="Uses the UZH2022 xc kernel", & + n_keywords=3, n_subsections=0, repeats=.TRUE.) + CALL keyword_create(keyword, __LOCATION__, name="ALPHA", & + description="Value of the alpha parameter (default = 1.19).", & + usage="ALPHA 1.19", default_r_val=1.19_dp) + CALL section_add_keyword(subsection, keyword) + CALL keyword_release(keyword) + CALL keyword_create(keyword, __LOCATION__, name="BETA", & + description="Value of the beta parameter (default = 0.01).", & + usage="BETA 0.01", default_r_val=0.01_dp) + CALL section_add_keyword(subsection, keyword) + CALL keyword_release(keyword) + CALL section_add_subsection(section, subsection) + CALL section_release(subsection) + + CALL keyword_create(keyword, __LOCATION__, name="SCALE_X", & + description="Scaling parameter for exchange kernel.", & + usage="SCALE_X 0.2", default_r_val=1.0_dp) + CALL section_add_keyword(section, keyword) + CALL keyword_release(keyword) + CALL keyword_create(keyword, __LOCATION__, name="SCALE_C", & + description="Scaling parameter for correlation kernel.", & + usage="SCALE_C 0.2", default_r_val=1.0_dp) + CALL section_add_keyword(section, keyword) + CALL keyword_release(keyword) + + END SUBROUTINE create_xc_kernel_section + +! ************************************************************************************************** +!> \brief creates the structure of the section needed to select an hfx kernel +!> \param section the section that will be created +!> \author JGH +! ************************************************************************************************** + SUBROUTINE create_hfx_kernel_section(section) + TYPE(section_type), POINTER :: section + + TYPE(keyword_type), POINTER :: keyword + TYPE(section_type), POINTER :: subsection + + CPASSERT(.NOT. ASSOCIATED(section)) + CALL section_create(section, __LOCATION__, name="HFX_KERNEL", & + description="The hfx kernel to use. Cannot be combined with HF section.", & + n_keywords=1, n_subsections=1, repeats=.FALSE.) + + NULLIFY (subsection, keyword) + CALL section_create(subsection, __LOCATION__, name="HFXLR", & + description="Uses the HFXLR (longrange) kernel", & + n_keywords=3, n_subsections=0, repeats=.TRUE.) + CALL keyword_create(keyword, __LOCATION__, name="ALPHA", & + description="Value of the alpha parameter (default = 1.19).", & + usage="ALPHA 1.19", default_r_val=1.19_dp) + CALL section_add_keyword(subsection, keyword) + CALL keyword_release(keyword) + CALL keyword_create(keyword, __LOCATION__, name="BETA", & + description="Value of the beta parameter (default = 0.01).", & + usage="BETA 0.01", default_r_val=0.01_dp) + CALL section_add_keyword(subsection, keyword) + CALL keyword_release(keyword) + CALL keyword_create(keyword, __LOCATION__, name="SCALE", & + description="Scaling parameter for HFX kernel.", & + usage="SCALE 0.2", default_r_val=1.0_dp) + CALL section_add_keyword(section, keyword) + CALL keyword_release(keyword) + CALL section_add_subsection(section, subsection) + CALL section_release(subsection) + + END SUBROUTINE create_hfx_kernel_section +! ************************************************************************************************** !> \brief creates the structure of the section needed for vdW potentials !> \param section the section that will be created !> \author jgh @@ -1281,6 +1369,14 @@ CONTAINS CALL section_add_subsection(section, subsection) CALL section_release(subsection) + CALL create_xc_kernel_section(subsection) + CALL section_add_subsection(section, subsection) + CALL section_release(subsection) + + CALL create_hfx_kernel_section(subsection) + CALL section_add_subsection(section, subsection) + CALL section_release(subsection) + CALL create_vdw_potential_section(subsection) CALL section_add_subsection(section, subsection) CALL section_release(subsection) diff --git a/src/molden_utils.F b/src/molden_utils.F index 3ed6715121..5e5d82487b 100644 --- a/src/molden_utils.F +++ b/src/molden_utils.F @@ -33,6 +33,7 @@ MODULE molden_utils USE orbital_transformation_matrices, ONLY: orbtramat USE particle_types, ONLY: particle_type USE periodic_table, ONLY: get_ptable_info + USE physcon, ONLY: massunit USE qs_kind_types, ONLY: get_qs_kind,& get_qs_kind_set,& qs_kind_type @@ -410,6 +411,7 @@ CONTAINS CHARACTER(LEN=2) :: element_symbol INTEGER :: handle, i, iw, j, k, l, z INTEGER, ALLOCATABLE, DIMENSION(:) :: my_list + REAL(KIND=dp) :: fint CALL timeset(routineN, handle) @@ -472,9 +474,11 @@ CONTAINS END IF END DO IF (calc_intens) THEN + fint = massunit + ! intensity units are a.u./amu WRITE (iw, '(T2,A)') "[INT]" DO i = 1, SIZE(intensities) - IF ((.NOT. dump_only_positive) .OR. (freq(i) >= 0._dp)) WRITE (iw, '(3X,F18.6)') intensities(i) + IF ((.NOT. dump_only_positive) .OR. (freq(i) >= 0._dp)) WRITE (iw, '(3X,F18.6)') fint*intensities(i)**2 END DO END IF DEALLOCATE (my_list) diff --git a/src/motion/vibrational_analysis.F b/src/motion/vibrational_analysis.F index 2938b5427c..dd1af315df 100644 --- a/src/motion/vibrational_analysis.F +++ b/src/motion/vibrational_analysis.F @@ -70,8 +70,8 @@ MODULE vibrational_analysis USE particle_methods, ONLY: write_particle_matrix USE particle_types, ONLY: particle_type USE physcon, ONLY: & - a_bohr, boltzmann, e_mass, h_bar, hertz, kelvin, kjmol, massunit, n_avogadro, pascal, & - vibfac, wavenumbers + a_bohr, bohr, boltzmann, debye, e_mass, h_bar, hertz, kelvin, kjmol, massunit, n_avogadro, & + pascal, vibfac, wavenumbers USE replica_methods, ONLY: rep_env_calc_e_f,& rep_env_create USE replica_types, ONLY: rep_env_release,& @@ -656,7 +656,9 @@ CONTAINS CHARACTER(LEN=2) :: element_symbol INTEGER :: from, iatom, icol, j, jatom, katom, & natom, to + REAL(KIND=dp) :: fint + fint = 42.255_dp*massunit*debye**2*bohr**2 natom = SIZE(D, 1) WRITE (UNIT=iw, FMT="(/,T2,'VIB|',T30,'NORMAL MODES - CARTESIAN DISPLACEMENTS')") WRITE (UNIT=iw, FMT="(T2,'VIB|')") @@ -668,8 +670,8 @@ CONTAINS WRITE (UNIT=iw, FMT="(T2,'VIB|Frequency (cm^-1)',3(1X,F12.6,8X))") & (freq(icol), icol=from, to) IF (ASSOCIATED(intensities)) THEN - WRITE (UNIT=iw, FMT="(T2,'VIB|Intensities ',3(1X,F12.6,8X))") & - (intensities(icol), icol=from, to) + WRITE (UNIT=iw, FMT="(T2,'VIB|IR int (KM/Mole) ',3(1X,F12.6,8X))") & + (fint*intensities(icol)**2, icol=from, to) END IF WRITE (UNIT=iw, FMT="(T2,'VIB|Red.Masses (a.u.)',3(1X,F12.6,8X))") & (m(icol), icol=from, to) @@ -727,7 +729,9 @@ CONTAINS D(:, i) = mat(:, i) DO j = i + 1, dof norm = DOT_PRODUCT(mat(:, i), mat(:, j)) - CPASSERT(ABS(norm) < thrs_motion) + IF (ABS(norm) > thrs_motion) THEN + CPWARN("Orthogonality error in transformation matrix") + END IF END DO END DO ! Generate the nvib orthogonal vectors diff --git a/src/motion_utils.F b/src/motion_utils.F index afd77718e6..332da9e2dc 100644 --- a/src/motion_utils.F +++ b/src/motion_utils.F @@ -57,7 +57,7 @@ MODULE motion_utils get_output_format, rot_ana CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'motion_utils' - REAL(KIND=dp), PARAMETER, PUBLIC :: thrs_motion = 1.0E4_dp*EPSILON(0.0_dp) + REAL(KIND=dp), PARAMETER, PUBLIC :: thrs_motion = 5.0E-10_dp CONTAINS @@ -211,7 +211,7 @@ CONTAINS lrot = 1 DO i = 1, 3 norm = SQRT(DOT_PRODUCT(Rot(:, i), Rot(:, i))) - IF (norm <= thrs_motion) THEN + IF (norm <= SQRT(thrs_motion)) THEN lrot(i) = 0 CYCLE END IF diff --git a/src/qs_environment.F b/src/qs_environment.F index 9938795aab..0fba62b981 100644 --- a/src/qs_environment.F +++ b/src/qs_environment.F @@ -640,6 +640,9 @@ CONTAINS "PRINT%PROGRAM_BANNER") END IF + ! set periodicity flag + dft_control%qs_control%periodicity = SUM(cell%perd) + ! *** Read the input section with the Quickstep control parameters *** CALL read_qs_section(dft_control%qs_control, qs_section) CALL get_qs_env(qs_env=qs_env, do_kpoints=do_kpoints) diff --git a/src/qs_tddfpt2_fhxc.F b/src/qs_tddfpt2_fhxc.F index 47f4f7e1d3..71a4cfb8aa 100644 --- a/src/qs_tddfpt2_fhxc.F +++ b/src/qs_tddfpt2_fhxc.F @@ -9,6 +9,7 @@ MODULE qs_tddfpt2_fhxc USE cp_control_types, ONLY: stda_control_type USE cp_dbcsr_cp2k_link, ONLY: cp_dbcsr_alloc_block_from_nbl USE cp_dbcsr_operations, ONLY: copy_fm_to_dbcsr,& + cp_dbcsr_plus_fm_fm_t,& cp_dbcsr_sm_fm_multiply USE cp_fm_types, ONLY: cp_fm_create,& cp_fm_get_info,& @@ -142,18 +143,15 @@ CONTAINS IF (ALLOCATED(work_matrices%evects_sub)) THEN IF (ASSOCIATED(work_matrices%evects_sub(1, ivect)%matrix)) THEN DO ispin = 1, nspins - ! Can this be done using cp_dbcsr_plus_fm_fm_t ? - CALL cp_gemm('N', 'T', nao, nao, nactive(ispin), & - 0.5_dp, sub_env%mos_occ(ispin)%matrix, & - work_matrices%evects_sub(ispin, ivect)%matrix, & - 0.0_dp, work_matrices%rho_ao_orb_fm_sub) - CALL cp_gemm('N', 'T', nao, nao, nactive(ispin), & - 0.5_dp, work_matrices%evects_sub(ispin, ivect)%matrix, & - sub_env%mos_occ(ispin)%matrix, & - 1.0_dp, work_matrices%rho_ao_orb_fm_sub) - - CALL copy_fm_to_dbcsr(work_matrices%rho_ao_orb_fm_sub, & - rho_ia_ao(ispin)%matrix, keep_sparsity=.TRUE.) + CALL dbcsr_set(rho_ia_ao(ispin)%matrix, 0.0_dp) + CALL cp_dbcsr_plus_fm_fm_t(rho_ia_ao(ispin)%matrix, & + matrix_v=sub_env%mos_occ(ispin)%matrix, & + matrix_g=work_matrices%evects_sub(ispin, ivect)%matrix, & + ncol=nactive(ispin), alpha=0.5_dp) + CALL cp_dbcsr_plus_fm_fm_t(rho_ia_ao(ispin)%matrix, & + matrix_v=work_matrices%evects_sub(ispin, ivect)%matrix, & + matrix_g=sub_env%mos_occ(ispin)%matrix, & + ncol=nactive(ispin), alpha=0.5_dp) END DO ELSE ! skip trial vectors which are assigned to different parallel groups @@ -161,14 +159,15 @@ CONTAINS END IF ELSE DO ispin = 1, nspins - ! Can this be done using cp_dbcsr_plus_fm_fm_t ? - CALL cp_gemm('N', 'T', nao, nao, nactive(ispin), 0.5_dp, sub_env%mos_occ(ispin)%matrix, & - evects(ispin, ivect)%matrix, 0.0_dp, work_matrices%rho_ao_orb_fm_sub) - CALL cp_gemm('N', 'T', nao, nao, nactive(ispin), 0.5_dp, evects(ispin, ivect)%matrix, & - sub_env%mos_occ(ispin)%matrix, 1.0_dp, work_matrices%rho_ao_orb_fm_sub) - - CALL copy_fm_to_dbcsr(work_matrices%rho_ao_orb_fm_sub, & - rho_ia_ao(ispin)%matrix, keep_sparsity=.TRUE.) + CALL dbcsr_set(rho_ia_ao(ispin)%matrix, 0.0_dp) + CALL cp_dbcsr_plus_fm_fm_t(rho_ia_ao(ispin)%matrix, & + matrix_v=sub_env%mos_occ(ispin)%matrix, & + matrix_g=evects(ispin, ivect)%matrix, & + ncol=nactive(ispin), alpha=0.5_dp) + CALL cp_dbcsr_plus_fm_fm_t(rho_ia_ao(ispin)%matrix, & + matrix_v=evects(ispin, ivect)%matrix, & + matrix_g=sub_env%mos_occ(ispin)%matrix, & + ncol=nactive(ispin), alpha=0.5_dp) END DO END IF diff --git a/src/qs_tddfpt2_methods.F b/src/qs_tddfpt2_methods.F index 4c9bfde48f..a1465b64ab 100644 --- a/src/qs_tddfpt2_methods.F +++ b/src/qs_tddfpt2_methods.F @@ -99,6 +99,7 @@ MODULE qs_tddfpt2_methods tddfpt_oecorr,& tddfpt_release_ground_state_mos USE string_utilities, ONLY: integer_to_string + USE xc_write_output, ONLY: xc_write #include "./base/base_uses.f90" IMPLICIT NONE @@ -139,7 +140,8 @@ CONTAINS iter, log_unit, mult, nao, niters, & nspins, nstates, nstates_read INTEGER, DIMENSION(maxspins) :: nactive - LOGICAL :: do_admm, do_hfx, is_restarted + LOGICAL :: do_admm, do_exck, do_hfx, do_hfxlr, & + is_restarted REAL(kind=dp) :: conv REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: evals TYPE(admm_type), POINTER :: admm_env @@ -173,13 +175,16 @@ CONTAINS ! input section print/xc NULLIFY (tddfpt_section) tddfpt_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%TDDFPT") - CALL tddfpt_input(qs_env, do_hfx, do_admm, xc_section, tddfpt_print_section, lri_section) + CALL tddfpt_input(qs_env, do_hfx, do_admm, do_exck, do_hfxlr, & + xc_section, tddfpt_print_section, lri_section) CALL get_qs_env(qs_env, blacs_env=blacs_env, cell=cell, dft_control=dft_control, & matrix_ks=matrix_ks, matrix_s=matrix_s, mos=mos, scf_env=scf_env) tddfpt_control => dft_control%tddfpt2_control tddfpt_control%do_hfx = do_hfx tddfpt_control%do_admm = do_admm + tddfpt_control%do_hfxlr = do_hfxlr + tddfpt_control%do_exck = do_exck CALL cite_reference(Iannuzzi2005) IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN @@ -189,6 +194,7 @@ CONTAINS log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, "PROGRAM_BANNER", extension=".tddfptLog") CALL tddfpt_header(log_unit) + CALL kernel_info(log_unit, dft_control, tddfpt_control, xc_section) CALL cp_print_key_finished_output(log_unit, logger, tddfpt_print_section, "PROGRAM_BANNER") ! obtain occupied and virtual (unoccupied) ground-state Kohn-Sham orbitals @@ -613,21 +619,26 @@ CONTAINS !> \param qs_env Quickstep environment !> \param do_hfx ... !> \param do_admm ... +!> \param do_exck ... +!> \param do_hfxlr ... !> \param xc_section ... !> \param tddfpt_print_section ... !> \param lri_section ... ! ************************************************************************************************** - SUBROUTINE tddfpt_input(qs_env, do_hfx, do_admm, xc_section, tddfpt_print_section, lri_section) + SUBROUTINE tddfpt_input(qs_env, do_hfx, do_admm, do_exck, do_hfxlr, & + xc_section, tddfpt_print_section, lri_section) TYPE(qs_environment_type), POINTER :: qs_env - LOGICAL, INTENT(INOUT) :: do_hfx, do_admm + LOGICAL, INTENT(INOUT) :: do_hfx, do_admm, do_exck, do_hfxlr TYPE(section_vals_type), POINTER :: xc_section, tddfpt_print_section, & lri_section CHARACTER(len=20) :: nstates_str - LOGICAL :: explicit_xc + LOGICAL :: exar, exf, exgcp, exhf, exhfxk, exk, & + explicit_root, expot, exvdw, exwfn REAL(kind=dp) :: C_hf TYPE(dft_control_type), POINTER :: dft_control - TYPE(section_vals_type), POINTER :: hfx_section, input, tddfpt_section + TYPE(section_vals_type), POINTER :: hfx_section, input, tddfpt_section, & + xc_root, xc_sub TYPE(tddfpt2_control_type), POINTER :: tddfpt_control NULLIFY (dft_control, input) @@ -649,34 +660,115 @@ CONTAINS tddfpt_print_section => section_vals_get_subs_vals(tddfpt_section, "PRINT") IF ((tddfpt_control%kernel == tddfpt_kernel_full) .OR. (tddfpt_control%kernel == tddfpt_kernel_flex)) THEN + NULLIFY (xc_root) + xc_root => section_vals_get_subs_vals(tddfpt_section, "XC") + CALL section_vals_get(xc_root, explicit=explicit_root) NULLIFY (xc_section) - xc_section => section_vals_get_subs_vals(tddfpt_section, "XC%XC_FUNCTIONAL") - CALL section_vals_get(xc_section, explicit=explicit_xc) - IF (explicit_xc) THEN - xc_section => section_vals_get_subs_vals(tddfpt_section, "XC") - ELSE - xc_section => section_vals_get_subs_vals(input, "DFT%XC") - END IF - hfx_section => section_vals_get_subs_vals(xc_section, "HF") - - CALL section_vals_get(hfx_section, explicit=do_hfx) - IF (do_hfx) THEN - CALL section_vals_val_get(hfx_section, "FRACTION", r_val=C_hf) - do_hfx = (C_hf /= 0.0_dp) - END IF - do_admm = do_hfx .AND. dft_control%do_admm - - IF (do_admm) THEN - IF (explicit_xc) THEN + IF (explicit_root) THEN + ! No ADIABATIC_RESCALING option possible + NULLIFY (xc_sub) + xc_sub => section_vals_get_subs_vals(xc_root, "ADIABATIC_RESCALING") + CALL section_vals_get(xc_sub, explicit=exar) + IF (exar) THEN + CALL cp_warn(__LOCATION__, "TDDFPT Kernel with ADIABATIC_RESCALING not possible.") + CPABORT("TDDFPT Input") + END IF + ! No GCP_POTENTIAL option possible + NULLIFY (xc_sub) + xc_sub => section_vals_get_subs_vals(xc_root, "GCP_POTENTIAL") + CALL section_vals_get(xc_sub, explicit=exgcp) + IF (exgcp) THEN + CALL cp_warn(__LOCATION__, "TDDFPT Kernel with GCP_POTENTIAL not possible.") + CPABORT("TDDFPT Input") + END IF + ! No VDW_POTENTIAL option possible + NULLIFY (xc_sub) + xc_sub => section_vals_get_subs_vals(xc_root, "VDW_POTENTIAL") + CALL section_vals_get(xc_sub, explicit=exvdw) + IF (exvdw) THEN + CALL cp_warn(__LOCATION__, "TDDFPT Kernel with VDW_POTENTIAL not possible.") + CPABORT("TDDFPT Input") + END IF + ! No WF_CORRELATION option possible + NULLIFY (xc_sub) + xc_sub => section_vals_get_subs_vals(xc_root, "WF_CORRELATION") + CALL section_vals_get(xc_sub, explicit=exwfn) + IF (exwfn) THEN + CALL cp_warn(__LOCATION__, "TDDFPT Kernel with WF_CORRELATION not possible.") + CPABORT("TDDFPT Input") + END IF + ! No XC_POTENTIAL option possible + NULLIFY (xc_sub) + xc_sub => section_vals_get_subs_vals(xc_root, "XC_POTENTIAL") + CALL section_vals_get(xc_sub, explicit=expot) + IF (expot) THEN + CALL cp_warn(__LOCATION__, "TDDFPT Kernel with XC_POTENTIAL not possible.") + CPABORT("TDDFPT Input") + END IF + ! + NULLIFY (xc_sub) + xc_sub => section_vals_get_subs_vals(xc_root, "XC_FUNCTIONAL") + CALL section_vals_get(xc_sub, explicit=exf) + NULLIFY (xc_sub) + xc_sub => section_vals_get_subs_vals(xc_root, "XC_KERNEL") + CALL section_vals_get(xc_sub, explicit=exk) + IF ((exf .AND. exk) .OR. .NOT. (exf .OR. exk)) THEN + CALL cp_warn(__LOCATION__, "TDDFPT Kernel needs XC_FUNCTIONAL or XC_KERNEL section.") + CPABORT("TDDFPT Input") + END IF + NULLIFY (xc_sub) + xc_sub => section_vals_get_subs_vals(xc_root, "HF") + CALL section_vals_get(xc_sub, explicit=exhf) + NULLIFY (xc_sub) + xc_sub => section_vals_get_subs_vals(xc_root, "HFX_KERNEL") + CALL section_vals_get(xc_sub, explicit=exhfxk) + IF (exhf .AND. exhfxk) THEN + CALL cp_warn(__LOCATION__, "TDDFPT Kernel: HF and HFX_KERNEL are exclusive.") + CPABORT("TDDFPT Input") + END IF + ! + xc_section => xc_root + hfx_section => section_vals_get_subs_vals(xc_section, "HF") + CALL section_vals_get(hfx_section, explicit=do_hfx) + IF (do_hfx) THEN + CALL section_vals_val_get(hfx_section, "FRACTION", r_val=C_hf) + do_hfx = (C_hf /= 0.0_dp) + END IF + do_admm = do_hfx .AND. dft_control%do_admm + IF (do_admm) THEN ! 'admm_env%xc_section_primary' and 'admm_env%xc_section_aux' need to be redefined CALL cp_abort(__LOCATION__, & "ADMM is not implemented for a TDDFT kernel XC-functional which is different from "// & "the one used for the ground-state calculation. A ground-state 'admm_env' cannot be reused.") END IF + ! SET HFX_KERNEL and/or XC_KERNEL + IF (exhfxk) THEN + do_exck = .TRUE. + ELSE + do_exck = .FALSE. + END IF + IF (exk) THEN + do_hfxlr = .TRUE. + ELSE + do_hfxlr = .FALSE. + END IF + ELSE + xc_section => section_vals_get_subs_vals(input, "DFT%XC") + hfx_section => section_vals_get_subs_vals(xc_section, "HF") + CALL section_vals_get(hfx_section, explicit=do_hfx) + IF (do_hfx) THEN + CALL section_vals_val_get(hfx_section, "FRACTION", r_val=C_hf) + do_hfx = (C_hf /= 0.0_dp) + END IF + do_admm = do_hfx .AND. dft_control%do_admm + do_exck = .FALSE. + do_hfxlr = .FALSE. END IF ELSE do_hfx = .FALSE. do_admm = .FALSE. + do_exck = .FALSE. + do_hfxlr = .FALSE. END IF ! reset rks_triplets if UKS is in use @@ -692,4 +784,84 @@ CONTAINS END SUBROUTINE tddfpt_input +! ************************************************************************************************** +!> \brief ... +!> \param log_unit ... +!> \param dft_control ... +!> \param tddfpt_control ... +!> \param xc_section ... +! ************************************************************************************************** + SUBROUTINE kernel_info(log_unit, dft_control, tddfpt_control, xc_section) + INTEGER, INTENT(IN) :: log_unit + TYPE(dft_control_type), POINTER :: dft_control + TYPE(tddfpt2_control_type), POINTER :: tddfpt_control + TYPE(section_vals_type), POINTER :: xc_section + + CHARACTER(LEN=4) :: ktype + LOGICAL :: lsd + + lsd = (dft_control%nspins > 1) + IF (tddfpt_control%kernel == tddfpt_kernel_full) THEN + ktype = "FULL" + IF (log_unit > 0) THEN + WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", TRIM(ktype) + CALL xc_write(log_unit, xc_section, lsd) + IF (tddfpt_control%do_hfx) THEN + IF (tddfpt_control%do_admm) THEN + WRITE (log_unit, "(T2,A,T62,A19)") "KERNEL|", "ADMM exact exchange" + IF (tddfpt_control%admm_symm) THEN + WRITE (log_unit, "(T2,A,T60,A21)") "KERNEL|", "symmetric ADMM kernel" + END IF + ELSE + WRITE (log_unit, "(T2,A,T67,A14)") "KERNEL|", "exact exchange" + END IF + END IF + IF (tddfpt_control%do_lrigpw) THEN + WRITE (log_unit, "(T2,A,T43,A38)") "KERNEL|", "LRI approximation of transition density" + END IF + END IF + ELSE IF (tddfpt_control%kernel == tddfpt_kernel_stda) THEN + ktype = "sTDA" + IF (log_unit > 0) THEN + WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", TRIM(ktype) + IF (tddfpt_control%stda_control%do_ewald) THEN + WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Coulomb term uses Ewald summation" + ELSE + WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Coulomb term uses direct summation (MIC)" + END IF + IF (tddfpt_control%stda_control%do_exchange) THEN + WRITE (log_unit, "(T2,A,T78,A3)") "KERNEL| Exact exchange term", "YES" + WRITE (log_unit, "(T2,A,T71,F10.3)") "KERNEL| Short range HFX fraction:", & + tddfpt_control%stda_control%hfx_fraction + ELSE + WRITE (log_unit, "(T2,A,T79,A2)") "KERNEL| Exact exchange term", "NO" + END IF + WRITE (log_unit, "(T2,A,T66,E15.3)") "KERNEL| Transition density filter", & + tddfpt_control%stda_control%eps_td_filter + END IF + ELSE IF (tddfpt_control%kernel == tddfpt_kernel_none) THEN + ktype = "NONE" + IF (log_unit > 0) THEN + WRITE (log_unit, "(T2,A,T77,A4)") "KERNEL|", TRIM(ktype) + END IF + ELSE + !CPABORT("Unknown kernel") + END IF + ! + IF (log_unit > 0) THEN + IF (tddfpt_control%rks_triplets) THEN + WRITE (log_unit, "(T2,A,T74,A7)") "KERNEL| Spin symmetry of excitations", "Triplet" + ELSE IF (lsd) THEN + WRITE (log_unit, "(T2,A,T69,A12)") "KERNEL| Spin symmetry of excitations", "Unrestricted" + ELSE + WRITE (log_unit, "(T2,A,T74,A7)") "KERNEL| Spin symmetry of excitations", "Singlet" + END IF + WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Number of states calculated", tddfpt_control%nstates + WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Number of Davidson iterations", tddfpt_control%niters + WRITE (log_unit, "(T2,A,T66,E15.3)") "TDDFPT| Davidson iteration convergence", tddfpt_control%conv + WRITE (log_unit, "(T2,A,T73,I8)") "TDDFPT| Max. number of Krylov space vectors", tddfpt_control%nkvs + END IF + + END SUBROUTINE kernel_info + END MODULE qs_tddfpt2_methods diff --git a/src/voronoi_interface.F b/src/voronoi_interface.F index b5585aa01e..650030c8f1 100644 --- a/src/voronoi_interface.F +++ b/src/voronoi_interface.F @@ -20,16 +20,21 @@ MODULE voronoi_interface USE bibliography, ONLY: Rycroft2009, Thomas2015, Brehm2018, Brehm2020, & Brehm2021, cite_reference USE kinds, ONLY: dp, default_path_length - USE cell_types, ONLY: cell_type + USE cell_types, ONLY: cell_type, pbc USE pw_types, ONLY: pw_p_type, pw_type + USE physcon, ONLY: bohr, debye USE qs_environment_types, ONLY: get_qs_env, & qs_environment_type + USE molecule_kind_types, ONLY: molecule_kind_type, & + write_molecule_kind_set + USE molecule_types, ONLY: molecule_type USE qs_rho_types, ONLY: qs_rho_get, & qs_rho_type USE atomic_kind_types, ONLY: atomic_kind_type, & get_atomic_kind USE particle_list_types, ONLY: particle_list_type USE particle_types, ONLY: particle_type + USE cp_files, ONLY: file_exists, close_file, open_file USE qs_kind_types, ONLY: get_qs_kind, & qs_kind_type USE cp_para_types, ONLY: cp_para_env_type @@ -302,7 +307,7 @@ CONTAINS bqb_history LOGICAL :: outemp, bqb_skip_first, voro_skip_first, & bqb_store_step, bqb_check, voro_sanity, & - bqb_overwrite, vori_overwrite + bqb_overwrite, vori_overwrite, ionode, molprop REAL(KIND=dp) :: zeff TYPE(qs_rho_type), POINTER :: rho TYPE(cp_logger_type), POINTER :: logger @@ -331,7 +336,7 @@ CONTAINS REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: voro_wrapped_pos REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: voro_charge_center REAL(KIND=dp), DIMENSION(:), POINTER :: user_radii - CHARACTER(len=default_path_length) :: bqb_file_name + CHARACTER(len=default_path_length) :: bqb_file_name, mp_file_name CHARACTER(len=128) :: bqb_parm_string #if defined(__HAS_IEEE_EXCEPTIONS) LOGICAL, DIMENSION(5) :: halt @@ -347,6 +352,7 @@ CONTAINS nkind=nkind, natom=natom, subsys=subsys, dft_control=dft_control, & cell=cell) + ionode = para_env%ionode my_rank = para_env%mepos num_pe = para_env%num_pe gid = para_env%group @@ -373,6 +379,9 @@ CONTAINS CALL cite_reference(Brehm2018) CALL cite_reference(Brehm2020) CALL cite_reference(Brehm2021) + ! + CALL section_vals_val_get(input_voro, "MOLECULAR_PROPERTIES", l_val=molprop) + CALL section_vals_val_get(input_voro, "MOLPROP_FILE_NAME", c_val=mp_file_name) END IF IF (do_bqb /= 0) THEN @@ -410,7 +419,7 @@ CONTAINS CALL ieee_set_halting_mode(IEEE_ALL, .FALSE.) #endif - IF (my_rank == 0) THEN + IF (ionode) THEN IF (iounit > 0) THEN WRITE (iounit, *) "" @@ -567,7 +576,7 @@ CONTAINS DEALLOCATE (buf) - IF (my_rank == 0) THEN + IF (ionode) THEN IF (do_voro /= 0) THEN @@ -672,6 +681,12 @@ CONTAINS END DO END IF + IF (molprop) THEN + CALL molecular_properties(subsys, cell, sim_step, sim_time, iounit, & + particles_r, particles_c, & + voro_charge, voro_charge_center, mp_file_name) + END IF + DEALLOCATE (voro_radii) DEALLOCATE (voro_charge) DEALLOCATE (voro_volume) @@ -709,7 +724,7 @@ CONTAINS END IF - IF (my_rank == 0) THEN + IF (ionode) THEN DEALLOCATE (particles_z) DEALLOCATE (particles_c) DEALLOCATE (particles_r) @@ -749,6 +764,98 @@ CONTAINS ret = libvori_finalize() #endif END SUBROUTINE + +! ************************************************************************************************** +!> \brief ... +!> \param subsys ... +!> \param cell ... +!> \param sim_step ... +!> \param sim_time ... +!> \param iounit ... +!> \param particles_r ... +!> \param particles_c ... +!> \param voro_charge ... +!> \param voro_charge_center ... +!> \param mp_file_name ... +! ************************************************************************************************** + SUBROUTINE molecular_properties(subsys, cell, sim_step, sim_time, iounit, & + particles_r, particles_c, voro_charge, & + voro_charge_center, mp_file_name) + TYPE(qs_subsys_type), POINTER :: subsys + TYPE(cell_type), POINTER :: cell + INTEGER, INTENT(IN) :: sim_step + REAL(KIND=dp), INTENT(IN) :: sim_time + INTEGER, INTENT(IN) :: iounit + REAL(KIND=dp), DIMENSION(:, :) :: particles_r + REAL(KIND=dp), DIMENSION(:) :: particles_c, voro_charge + REAL(KIND=dp), DIMENSION(:, :) :: voro_charge_center + CHARACTER(len=default_path_length) :: mp_file_name + + CHARACTER(len=3) :: fstatus + CHARACTER(len=default_path_length) :: fname + INTEGER :: ia, imol, mk, mpunit, na, na1, na2, & + nmolecule + REAL(KIND=dp) :: cm, ddip + REAL(KIND=dp), DIMENSION(3) :: dipm, posa, posc, ref + TYPE(molecule_kind_type), POINTER :: molecule_kind + TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set + + IF (iounit > 0) THEN + WRITE (iounit, *) "VORONOI| Start Calculation of Molecular Properties from Voronoi Integration" + END IF + CALL qs_subsys_get(subsys, molecule_set=molecule_set) + + IF (INDEX(mp_file_name, "__STD_OUT__") /= 0) THEN + mpunit = iounit + ELSE + fname = ADJUSTL(mp_file_name) + IF (fname(1:2) /= "./") THEN + fname = TRIM(fname)//".molprop" + END IF + IF (file_exists(fname)) THEN + fstatus = "old" + ELSE + fstatus = "new" + END IF + CALL open_file(file_name=fname, file_status=fstatus, file_action="write", & + file_position="append", unit_number=mpunit) + END IF + nmolecule = SIZE(molecule_set) + WRITE (mpunit, FMT="(T2,I0)") nmolecule + WRITE (mpunit, FMT="(A,I8,A,F12.4,A)") " # Step ", sim_step, ", Time ", & + sim_time*femtoseconds, " fs" + WRITE (mpunit, FMT="(A,T25,A)") " # Mol Type Charge", & + " Dipole[Debye] Total Dipole[Debye]" + DO imol = 1, nmolecule + molecule_kind => molecule_set(imol)%molecule_kind + mk = molecule_kind%kind_number + na1 = molecule_set(imol)%first_atom + na2 = molecule_set(imol)%last_atom + na = na2 - na1 + 1 + ref(1:3) = 0.0_dp + DO ia = na1, na2 + ref(1:3) = ref(1:3) + particles_r(1:3, ia) + END DO + ref(1:3) = ref(1:3)/REAL(na, KIND=dp) + dipm = 0.0_dp + DO ia = na1, na2 + posa(1:3) = particles_r(1:3, ia) - ref(1:3) + posa(1:3) = pbc(posa, cell) + posc(1:3) = posa(1:3) + bohr*voro_charge_center(ia, 1:3)/100.0_dp + posc(1:3) = pbc(posc, cell) + cm = -particles_c(ia) + voro_charge(ia) + dipm(1:3) = dipm(1:3) + posa(1:3)*particles_c(ia) + posc(1:3)*cm + END DO + dipm(1:3) = dipm(1:3)*debye + ddip = SQRT(SUM(dipm**2)) + cm = SUM(voro_charge(na1:na2)) + WRITE (mpunit, FMT="(I8,I6,F12.4,T25,3F12.4,8X,F12.4)") imol, mk, cm, dipm(1:3), ddip + END DO + IF (mpunit /= iounit) THEN + CALL close_file(mpunit) + END IF + + END SUBROUTINE molecular_properties + END MODULE voronoi_interface - diff --git a/src/xc_write_output.F b/src/xc_write_output.F index 7895a20ae6..fd2653cbe0 100644 --- a/src/xc_write_output.F +++ b/src/xc_write_output.F @@ -12,8 +12,7 @@ MODULE xc_write_output USE input_constants, ONLY: xc_none USE input_cp2k_check, ONLY: xc_functionals_expand - USE input_section_types, ONLY: section_get_keyword_index,& - section_vals_duplicate,& + USE input_section_types, ONLY: section_vals_duplicate,& section_vals_get,& section_vals_get_subs_vals,& section_vals_get_subs_vals2,& @@ -39,12 +38,12 @@ CONTAINS ! ************************************************************************************************** !> \brief ... -!> \param output_unit ... +!> \param iounit ... !> \param xc_section ... !> \param lsd ... ! ************************************************************************************************** - SUBROUTINE xc_write(output_unit, xc_section, lsd) - INTEGER, INTENT(IN) :: output_unit + SUBROUTINE xc_write(iounit, xc_section, lsd) + INTEGER, INTENT(IN) :: iounit TYPE(section_vals_type), POINTER :: xc_section LOGICAL, INTENT(IN) :: lsd @@ -54,7 +53,7 @@ CONTAINS INTEGER :: i_rep, ifun, il, myfun, n_rep TYPE(section_vals_type), POINTER :: libxc_fun, xc_fun, xc_fun_section - IF (output_unit > 0) THEN + IF (iounit > 0) THEN xc_fun_section => section_vals_get_subs_vals(xc_section, & "XC_FUNCTIONAL") @@ -62,12 +61,12 @@ CONTAINS IF (myfun /= xc_none) THEN !check if FUNCTIONAL_ROUTINE keyword present - IF (section_get_keyword_index(xc_section%section, "FUNCTIONAL_ROUTINE") .NE. -2) THEN - CALL section_vals_val_get(xc_section, "FUNCTIONAL_ROUTINE", & - c_val=tmpStr) - WRITE (output_unit, fmt="(' FUNCTIONAL| ROUTINE=',a)") & - TRIM(tmpStr) - END IF + !IF (section_get_keyword_index(xc_section%section, "FUNCTIONAL_ROUTINE") .NE. -2) THEN + ! CALL section_vals_val_get(xc_section, "FUNCTIONAL_ROUTINE", & + ! c_val=tmpStr) + ! WRITE (iounit, fmt="(' FUNCTIONAL| ROUTINE=',a)") & + ! TRIM(tmpStr) + !END IF CALL xc_functionals_expand(xc_fun_section, xc_section) ifun = 0 @@ -82,10 +81,10 @@ CONTAINS ALLOCATE (CHARACTER(LEN=20*default_string_length) :: reference) END IF CALL xc_functional_get_info(xc_fun, lsd=lsd, reference=reference, shortform=shortform) - WRITE (output_unit, fmt="(' FUNCTIONAL| ',a,':')") & + WRITE (iounit, fmt="(' FUNCTIONAL| ',a,':')") & TRIM(xc_fun%section%name) DO il = 1, LEN_TRIM(reference), 67 - WRITE (output_unit, fmt="(' FUNCTIONAL| ',a67)") reference(il:) + WRITE (iounit, fmt="(' FUNCTIONAL| ',a67)") reference(il:) END DO DEALLOCATE (reference) ELSE @@ -100,18 +99,18 @@ CONTAINS CALL xc_functional_get_info(libxc_fun, lsd=lsd, reference=reference, shortform=shortform, print_warn=.TRUE.) CALL section_vals_release(libxc_fun) CALL libxc_version_info(tmpStr) - WRITE (output_unit, fmt="(A,A,A)") ' FUNCTIONAL| LIBXC Vers. ', TRIM(tmpStr(1:5)), & + WRITE (iounit, fmt="(A,A,A)") ' FUNCTIONAL| LIBXC Vers. ', TRIM(tmpStr(1:5)), & ' (Marques, Oliveira, Burnus, CPC 183, 2272 (2012))' - WRITE (output_unit, fmt="(' FUNCTIONAL| ',a,':')") TRIM(shortform) + WRITE (iounit, fmt="(' FUNCTIONAL| ',a,':')") TRIM(shortform) DO il = 1, LEN_TRIM(reference), 67 - WRITE (output_unit, fmt="(' FUNCTIONAL| ',a67)") reference(il:) + WRITE (iounit, fmt="(' FUNCTIONAL| ',a67)") reference(il:) END DO DEALLOCATE (reference) END DO END IF END DO ELSE - WRITE (output_unit, fmt="(' FUNCTIONAL| NO EXCHANGE-CORRELATION FUNCTIONAL USED.')") + WRITE (iounit, fmt="(' FUNCTIONAL| NO EXCHANGE-CORRELATION FUNCTIONAL USED.')") END IF END IF diff --git a/tests/QS/regtest-ec/HF2_ec_voronoi.inp b/tests/QS/regtest-ec/HF2_ec_voronoi.inp new file mode 100644 index 0000000000..ba412978a6 --- /dev/null +++ b/tests/QS/regtest-ec/HF2_ec_voronoi.inp @@ -0,0 +1,69 @@ +&FORCE_EVAL + METHOD Quickstep + &DFT + BASIS_SET_FILE_NAME BASIS_SET + POTENTIAL_FILE_NAME GTH_POTENTIALS + &MGRID + CUTOFF 400 + &END MGRID + &QS + EPS_DEFAULT 1.E-14 + &END QS + &ENERGY_CORRECTION + ENERGY_FUNCTIONAL HARRIS + HARRIS_BASIS ORBITAL + &XC + &XC_FUNCTIONAL + &PBE + &END + &END + &END XC + &PRINT + &MOMENTS ON + PERIODIC .FALSE. + REFERENCE COM + &END + &VORONOI + SANITY_CHECK T + VERBOSE T + REFINEMENT_FACTOR 1 + MOLECULAR_PROPERTIES + &END + &END + &END ENERGY_CORRECTION + &SCF + EPS_SCF 1.0E-7 + SCF_GUESS ATOMIC + &END + &XC + &XC_FUNCTIONAL + &PADE + &END + &END + &END XC + &END DFT + &SUBSYS + &CELL + ABC 6.0 6.0 6.0 + &END CELL + &COORD + H 0.000000 0.000000 0.000000 HF + F 0.000000 0.000000 1.050000 HF + H 0.000000 3.000000 1.050000 HF + F 0.000000 3.000000 0.000000 HF + &END COORD + &KIND H + BASIS_SET ORB DZVP-GTH-BLYP + POTENTIAL GTH-PADE-q1 + &END KIND + &KIND F + BASIS_SET ORB DZVP-GTH-BLYP + POTENTIAL GTH-PADE-q7 + &END KIND + &END SUBSYS +&END FORCE_EVAL +&GLOBAL + PROJECT HF + RUN_TYPE ENERGY_FORCE + PRINT_LEVEL LOW +&END GLOBAL diff --git a/tests/QS/regtest-ec/TEST_FILES b/tests/QS/regtest-ec/TEST_FILES index cc70815a42..67aa8a9324 100644 --- a/tests/QS/regtest-ec/TEST_FILES +++ b/tests/QS/regtest-ec/TEST_FILES @@ -15,6 +15,8 @@ H2_H2O_ecprim.inp 11 1e-10 HF_ec_dipole.inp 11 1e-08 -24.8917060368 # ENERGY : LS + KG embed + Harris (Diag) dipole HF_ec_voronoi.inp 11 1e-08 -24.8917060368 +# ENERGY : LS + KG embed + Harris (Diag) molecular dipole +HF2_ec_voronoi.inp 11 1e-08 -49.7897161711 # ENERGY : LS + KG embed + Harris (Diag) efield HF_ec_field.inp 11 1e-08 -24.8908706031 # ENERGY: Test Harris functional solvers diff --git a/tests/QS/regtest-gpw-1/TEST_FILES b/tests/QS/regtest-gpw-1/TEST_FILES index 6ce42a1c6d..83174bf016 100644 --- a/tests/QS/regtest-gpw-1/TEST_FILES +++ b/tests/QS/regtest-gpw-1/TEST_FILES @@ -72,4 +72,6 @@ hf.inp 1 1.0E-10 He_PBE.inp 1 1.0E-13 -1.14398524502663 # h2q.inp 1 1.0E-10 -0.76162210587786 +# Mol Dipole Voronoi +moldip_voronoi.inp 1 1.0E-10 -41.88176215391840 #EOF diff --git a/tests/QS/regtest-gpw-1/moldip_voronoi.inp b/tests/QS/regtest-gpw-1/moldip_voronoi.inp new file mode 100644 index 0000000000..c11770a081 --- /dev/null +++ b/tests/QS/regtest-gpw-1/moldip_voronoi.inp @@ -0,0 +1,65 @@ +&GLOBAL + PROJECT moldip + RUN_TYPE ENERGY + PRINT_LEVEL LOW +&END GLOBAL +&FORCE_EVAL + METHOD QS + &DFT + BASIS_SET_FILE_NAME GTH_BASIS_SETS + POTENTIAL_FILE_NAME POTENTIAL + &MGRID + CUTOFF 150 + &END MGRID + &QS + EPS_DEFAULT 1.0E-8 + &END QS + &SCF + EPS_SCF 1.0E-5 + MAX_SCF 20 + &OT + MINIMIZER DIIS + PRECONDITIONER FULL_ALL + &END + &END SCF + &XC + &XC_FUNCTIONAL Pade + &END XC_FUNCTIONAL + &END XC + &PRINT + &MOMENTS + MAX_MOMENT 1 + PERIODIC F + REFERENCE USER_DEFINED + REF_POINT [angstrom] 2. 0. 0. + &END MOMENTS + &VORONOI + MOLECULAR_PROPERTIES + &END + &END PRINT + &END DFT + &SUBSYS + &CELL + ABC 10.58 10.58 10.58 + &END CELL + &COORD + O 0.000000 0.000000 0.119040 H2O + H 0.000000 0.768000 -0.476160 H2O + H 0.000000 -0.768000 -0.476160 H2O + H 4.000000 0.000000 0.000000 HF + F 5.050000 0.000000 0.000000 HF + &END COORD + &KIND H + BASIS_SET ORB DZVP-GTH + POTENTIAL GTH-PADE-q1 + &END KIND + &KIND O + BASIS_SET ORB DZVP-GTH + POTENTIAL GTH-PADE-q6 + &END KIND + &KIND F + BASIS_SET ORB DZVP-GTH + POTENTIAL GTH-PADE-q7 + &END KIND + &END SUBSYS +&END FORCE_EVAL diff --git a/tests/QS/regtest-mp2-grad/HF_dipole.inp b/tests/QS/regtest-mp2-grad/HF_dipole.inp new file mode 100644 index 0000000000..26fb665c8d --- /dev/null +++ b/tests/QS/regtest-mp2-grad/HF_dipole.inp @@ -0,0 +1,99 @@ +&GLOBAL + PROJECT DIPOLE_HF_gpw + PRINT_LEVEL LOW + RUN_TYPE ENERGY_FORCE +&END GLOBAL +&FORCE_EVAL + METHOD Quickstep + &DFT + POTENTIAL_FILE_NAME POTENTIAL + &MGRID + CUTOFF 150 + REL_CUTOFF 30 + &END MGRID + &PRINT + &MOMENTS ON + PERIODIC .FALSE. + REFERENCE COM + &END + &VORONOI + SANITY_CHECK T + VERBOSE T + REFINEMENT_FACTOR 1 + MOLECULAR_PROPERTIES + &END + &END + &QS + METHOD GPW + EPS_DEFAULT 1.0E-12 + &END QS + &SCF + SCF_GUESS ATOMIC + EPS_SCF 1.0E-6 + MAX_SCF 100 + &END SCF + &XC + &XC_FUNCTIONAL NONE + &END XC_FUNCTIONAL + &HF + FRACTION 1.0000000 + &SCREENING + SCREEN_ON_INITIAL_P .FALSE. + EPS_SCHWARZ 1.0E-6 + EPS_SCHWARZ_FORCES 1.0E-6 + &END SCREENING + &INTERACTION_POTENTIAL + POTENTIAL_TYPE TRUNCATED + CUTOFF_RADIUS 1.5 + T_C_G_DATA t_c_g.dat + &END + &END HF + &WF_CORRELATION + &RI_MP2 + BLOCK_SIZE 1 + EPS_CANONICAL 0.0001 + FREE_HFX_BUFFER .TRUE. + &CPHF + EPS_CONV 1.0E-4 + MAX_ITER 10 + &END + &END + &INTEGRALS + &WFC_GPW + CUTOFF 50 + REL_CUTOFF 20 + EPS_FILTER 1.0E-12 + EPS_GRID 1.0E-8 + &END WFC_GPW + &END INTEGRALS + MEMORY 1.00 + NUMBER_PROC 1 + &END + &END XC + &END DFT + &PRINT + &FORCES + &END + &END + &SUBSYS + &CELL + ABC [angstrom] 5.0 5.0 5.0 + &END CELL + &KIND H + BASIS_SET DZVP-GTH-PADE + POTENTIAL GTH-PADE-q1 + &END KIND + &KIND F + BASIS_SET DZVP-GTH-PADE + POTENTIAL GTH-PADE-q7 + &END KIND + &COORD + F 0.000000 0.000000 0.000000 HF + H 0.000000 0.000000 1.050000 HF + &END + &TOPOLOGY + &CENTER_COORDINATES + &END + &END TOPOLOGY + &END SUBSYS +&END FORCE_EVAL diff --git a/tests/QS/regtest-mp2-grad/TEST_FILES b/tests/QS/regtest-mp2-grad/TEST_FILES index f8b5f5c2a0..32b7085dfc 100644 --- a/tests/QS/regtest-mp2-grad/TEST_FILES +++ b/tests/QS/regtest-mp2-grad/TEST_FILES @@ -1,5 +1,6 @@ H2O_grad_mme.inp 11 6e-09 -16.766973026874989 H2O_grad_gpw.inp 11 7e-08 -16.990048927268898 +HF_dipole.inp 11 7e-08 -24.660454660161022 H2_H2_no_freeHFX.inp 11 2e-13 -2.307710999246907 O2_dyn.inp 11 2e-11 -31.519148246527102 O2_dyn_mme.inp 72 1e-8 0.50585576 diff --git a/tests/QS/regtest-polar/TEST_FILES b/tests/QS/regtest-polar/TEST_FILES index f9c7b0997e..a673354804 100644 --- a/tests/QS/regtest-polar/TEST_FILES +++ b/tests/QS/regtest-polar/TEST_FILES @@ -7,7 +7,7 @@ h2o_LRraman.inp 60 1e-04 h2o_LRraman_loc.inp 60 1e-04 0.009153812508 h2o_LRraman_noort.inp 60 2e-05 0.023303680948 H2O_md_polar.inp 60 6e-04 0.614320139535 -xTB_LRraman.inp 60 2e-05 0.804852847403 -xTB_LRraman_loc.inp 60 2e-05 0.804852847403 +xTB_LRraman.inp 60 2e-05 0.807352993847 +xTB_LRraman_loc.inp 60 2e-05 0.807352993847 h2o_LRraman_LRI.inp 60 4e-04 0.004262309795 #EOF diff --git a/tests/QS/regtest-polar/xTB_LRraman.inp b/tests/QS/regtest-polar/xTB_LRraman.inp index 2ab60c038e..8c83da2220 100644 --- a/tests/QS/regtest-polar/xTB_LRraman.inp +++ b/tests/QS/regtest-polar/xTB_LRraman.inp @@ -26,6 +26,7 @@ &SUBSYS &CELL ABC [bohr] 10. 10. 10. + PERIODIC NONE &END CELL &COORD UNIT bohr diff --git a/tests/QS/regtest-polar/xTB_LRraman_loc.inp b/tests/QS/regtest-polar/xTB_LRraman_loc.inp index 441a52f068..446b36bf53 100644 --- a/tests/QS/regtest-polar/xTB_LRraman_loc.inp +++ b/tests/QS/regtest-polar/xTB_LRraman_loc.inp @@ -27,6 +27,7 @@ &SUBSYS &CELL ABC [bohr] 10. 10. 10. + PERIODIC NONE &END CELL &COORD UNIT bohr diff --git a/tests/QS/regtest-tddfpt-stda/TEST_FILES b/tests/QS/regtest-tddfpt-stda/TEST_FILES index 54a0d9959c..e2ef27f55e 100644 --- a/tests/QS/regtest-tddfpt-stda/TEST_FILES +++ b/tests/QS/regtest-tddfpt-stda/TEST_FILES @@ -3,8 +3,8 @@ # e.g. 0 means do not compare anything, running is enough # 1 compares the last total energy in the file # for details see cp2k/tools/do_regtest -CH2O_tddfpt_stda-s-1.inp 37 1.0E-05 0.349917E+00 -CH2Oplus_tddfpt_stda-lsd.inp 37 1.0E-05 0.212156E+00 +CH2O_tddfpt_stda-s-1.inp 37 1.0E-05 0.349892E+00 +CH2Oplus_tddfpt_stda-lsd.inp 37 1.0E-05 0.212147E+00 CH2O_tddfpt_stda-pbe-s.inp 37 1.0E-05 0.125452E+00 CH2O_tddfpt_stda-pbe-s_doexchange.inp 37 1.0E-05 0.155105E+00 CH2O_tddfpt_stda-xtb-s.inp 37 1.0E-05 0.150482E+00 @@ -14,7 +14,7 @@ H2Oplus_tddfpt_stda-pbe-lsd.inp 37 1.0E-05 H2O_tddfpt_stda-pbe-t.inp 37 1.0E-05 0.595565E+00 H2O_tddfpt_stda-pbe0-s.inp 37 1.0E-05 0.637391E+00 H2O_tddfpt_stda-pbe0-t.inp 37 1.0E-05 0.633489E+00 -H2O_tddfpt_stda-s-1.inp 37 1.0E-05 0.173064E+00 +H2O_tddfpt_stda-s-1.inp 37 1.0E-05 0.173021E+00 NO_tddfpt_stda-s-1.inp 37 1.0E-05 0.375613E+00 water_xTB.inp 37 2.0E-05 0.185374E+00 water_xTBi_NTO.inp 37 2.0E-05 0.185374E+00 diff --git a/tests/TEST_DIRS b/tests/TEST_DIRS index 230cdaa557..e278af8084 100644 --- a/tests/TEST_DIRS +++ b/tests/TEST_DIRS @@ -76,7 +76,7 @@ QS/regtest-p-efield QS/regtest-mp2-stress libint QS/regtest-ri-rpa libint QS/regtest-kg libxc -QS/regtest-ec libint +QS/regtest-ec libint libvori QS/regtest-ec-force libint QS/regtest-gpw-4 QS/regtest-gpw-2-3 @@ -91,7 +91,7 @@ Fist/regtest-7-1 QMMM/SE/regtest-force-mixing QS/regtest-gpw-8 QS/regtest-ot -QS/regtest-mp2-grad libint +QS/regtest-mp2-grad libint libvori QS/regtest-plus_u QS/regtest-gpw-3 QS/regtest-ps-implicit-1-3 fftw3 @@ -122,7 +122,7 @@ QS/regtest-tddfpt-stda libint QS/regtest-tddfpt-lri libint Fist/regtest-opt QS/regtest-nmr-6 -QS/regtest-gpw-1 libint +QS/regtest-gpw-1 libint libvori QS/regtest-gapw-4 libint MC/regtest QS/regtest-ri-mp2 libint @@ -148,7 +148,6 @@ QS/regtest-dft-vdw-corr-2 libxc libint QS/regtest-epr-1 QS/regtest-lrigpw Fist/regtest-5 -xTB/regtest-3 Fist/regtest-6 QS/regtest-hybrid-4 libint libxc QS/regtest-mom-2 libint diff --git a/tests/xTB/regtest-2/H2O-field-gopt.inp b/tests/xTB/regtest-2/H2O-field-gopt.inp index 419d6adc62..dc710283cd 100644 --- a/tests/xTB/regtest-2/H2O-field-gopt.inp +++ b/tests/xTB/regtest-2/H2O-field-gopt.inp @@ -13,6 +13,9 @@ &QS METHOD xTB EPS_DEFAULT 1.0E-12 + &xTB + DO_EWALD T + &END xTB &END QS &KPOINTS SCHEME GAMMA diff --git a/tests/xTB/regtest-2/HF-field-gopt.inp b/tests/xTB/regtest-2/HF-field-gopt.inp index 6683eda3b0..c82f8c773b 100644 --- a/tests/xTB/regtest-2/HF-field-gopt.inp +++ b/tests/xTB/regtest-2/HF-field-gopt.inp @@ -12,6 +12,9 @@ &END &QS METHOD xTB + &xTB + DO_EWALD T + &END xTB &END QS &SCF EPS_SCF 1.0E-8 diff --git a/tests/xTB/regtest-2/HF-loc-field-debug.inp b/tests/xTB/regtest-2/HF-loc-field-debug.inp index 9dfeb031b9..63acfbe97f 100644 --- a/tests/xTB/regtest-2/HF-loc-field-debug.inp +++ b/tests/xTB/regtest-2/HF-loc-field-debug.inp @@ -12,6 +12,9 @@ &END &QS METHOD xTB + &xTB + DO_EWALD F + &END xTB &END QS &SCF EPS_SCF 1.0E-8 diff --git a/tests/xTB/regtest-2/TEST_FILES b/tests/xTB/regtest-2/TEST_FILES index 3a076b56d8..e3c7da8672 100644 --- a/tests/xTB/regtest-2/TEST_FILES +++ b/tests/xTB/regtest-2/TEST_FILES @@ -4,18 +4,18 @@ # 1 compares the last total energy in the file # for details see cp2k/tools/do_regtest # test mulliken constraints -H2O-field-gopt.inp 1 3e-11 -5.76900010512329 +H2O-field-gopt.inp 1 3e-11 -5.76960964769063 H2O-field-gopt-lsd.inp 1 4e-12 -5.76960970095199 H2O-field.inp 0 4e-13 H2O-field-lsd.inp 1 4e-14 -5.76948986131183 HF-field.inp 1 1e-12 -5.62817044142137 -HF-field-gopt.inp 1 5e-09 -5.66007154383399 +HF-field-gopt.inp 1 5e-09 -5.66333179696722 HF-field-debug.inp 0 1e-12 HF-dfilter-debug.inp 0 1e-12 HF-dfield-gopt.inp 1 1e-09 -5.66113975858277 HF-dfield.inp 1 1e-12 -5.66099020966660 HF-dfield-debug.inp 0 1e-12 HF-loc-field.inp 1 1e-12 -5.65286303322644 -HF-loc-field-gopt.inp 1 5e-09 -5.66976248371100 +HF-loc-field-gopt.inp 1 5e-09 -5.67065466488875 HF-loc-field-debug.inp 0 1e-12 #EOF diff --git a/tests/xTB/regtest-3/H2O-geo-pdos.inp b/tests/xTB/regtest-3/H2O-geo-pdos.inp index 6222fffd15..7873177090 100644 --- a/tests/xTB/regtest-3/H2O-geo-pdos.inp +++ b/tests/xTB/regtest-3/H2O-geo-pdos.inp @@ -22,6 +22,7 @@ &SUBSYS &CELL ABC 6.0 6.0 6.0 + PERIODIC NONE &END CELL &COORD O 0.000000 0.000000 -0.065587 diff --git a/tests/xTB/regtest-3/TEST_FILES b/tests/xTB/regtest-3/TEST_FILES index b15bf0cffe..58bb56963b 100644 --- a/tests/xTB/regtest-3/TEST_FILES +++ b/tests/xTB/regtest-3/TEST_FILES @@ -17,7 +17,7 @@ ch2o_loc.inp 1 1.0E-12 -13.55045387 ch2o_mos.inp 1 1.0E-12 -7.84456570305607 si_print.inp 1 1.0E-12 -14.75266668154365 si_band.inp 1 1.0E-12 -14.75266668154365 -H2O-geo-pdos.inp 1 1.0E-12 -5.76984102056605 +H2O-geo-pdos.inp 1 1.0E-12 -5.76872484344198 graphite-stm.inp 1 1.0E-12 -7.91352193418221 si_dos.inp 1 1.0E-12 -14.75266668154365 #EOF