mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-29 06:35:28 -04:00
Constrained DFT implementation - see section QS%CDFT (Nico Holmberg)
svn-origin-rev: 17718
This commit is contained in:
parent
357ef085b3
commit
2459fb474a
96 changed files with 13891 additions and 1043 deletions
|
|
@ -78,7 +78,8 @@ MODULE bibliography
|
|||
Ceriotti2010, Walewski2014, Monkhorst1976, MacDonald1978, &
|
||||
Gilbert2008, Schonherr2014, Ceriotti2014, BaniHashemian2016, &
|
||||
Kapil2016, Heinzmann1976, Ehrhardt1985, Rybkin2016, West2006, &
|
||||
Bates2013, Andermatt2016, Zhu2016, Schuett2016, Lu2004
|
||||
Bates2013, Andermatt2016, Zhu2016, Schuett2016, Lu2004, &
|
||||
Becke1988b, Migliore2009, Mavros2015, Holmberg2017
|
||||
|
||||
CONTAINS
|
||||
|
||||
|
|
@ -3574,6 +3575,52 @@ CONTAINS
|
|||
"EP 2637", &
|
||||
"PY 2004"), &
|
||||
DOI="10.1063/1.1638731")
|
||||
CALL add_reference(key=Migliore2009, ISI_record=s2a( &
|
||||
"AU Migliore, A", &
|
||||
"TI Full-electron calculation of effective electronic couplings and", &
|
||||
" excitation energies of charge transfer states: Application to hole", &
|
||||
" transfer in DNA pi-stacks", &
|
||||
"SO The Journal of Chemical Physics", &
|
||||
"PY 2009", &
|
||||
"VL 131", &
|
||||
"IS 11", &
|
||||
"ER"), &
|
||||
DOI="10.1063/1.3232007")
|
||||
|
||||
CALL add_reference(key=Mavros2015, ISI_record=s2a( &
|
||||
"AU Mavros, MG", &
|
||||
" Van Voorhis, T", &
|
||||
"TI Communication: CDFT-CI couplings can be unreliable when there is fractional charge transfer", &
|
||||
"SO The Journal of Chemical Physics", &
|
||||
"PY 2015", &
|
||||
"VL 143", &
|
||||
"IS 23", &
|
||||
"ER"), &
|
||||
DOI="10.1063/1.4938103")
|
||||
|
||||
CALL add_reference(key=Becke1988b, ISI_record=s2a( &
|
||||
"AU Becke, AD", &
|
||||
"TI A multicenter numerical integration scheme for polyatomic molecules", &
|
||||
"SO JOURNAL OF CHEMICAL PHYSICS", &
|
||||
"PY 1988", &
|
||||
"BP 2547", &
|
||||
"EP 2553", &
|
||||
"VL 88", &
|
||||
"IS 4", &
|
||||
"ER"), &
|
||||
DOI="10.1063/1.454033")
|
||||
|
||||
CALL add_reference(key=Holmberg2017, ISI_record=s2a( &
|
||||
"AU Holmberg, N", &
|
||||
" Laasonen, K", &
|
||||
"TI Efficient Constrained Density Functional Theory Implementation for Simulation of", &
|
||||
" Condensed Phase Electron Transfer Reactions", &
|
||||
"SO Journal of Chemical Theory and Computation", &
|
||||
"PY 2017", &
|
||||
"VL 0", &
|
||||
"IS 0", &
|
||||
"ER"), &
|
||||
DOI="10.1021/acs.jctc.6b01085")
|
||||
|
||||
END SUBROUTINE add_all_references
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ MODULE kahan_sum
|
|||
|
||||
IMPLICIT NONE
|
||||
PRIVATE
|
||||
PUBLIC :: accurate_sum
|
||||
PUBLIC :: accurate_sum, accurate_sum_arrays_product
|
||||
INTEGER, PARAMETER :: sp = KIND(0.0), dp = KIND(0.0D0)
|
||||
REAL(KIND=sp), PARAMETER :: szero = 0.0_sp
|
||||
REAL(KIND=dp), PARAMETER :: dzero = 0.0_dp
|
||||
|
|
@ -44,6 +44,9 @@ MODULE kahan_sum
|
|||
kahan_sum_s6, kahan_sum_d6, kahan_sum_c6, kahan_sum_z6, &
|
||||
kahan_sum_s7, kahan_sum_d7, kahan_sum_c7, kahan_sum_z7
|
||||
END INTERFACE accurate_sum
|
||||
INTERFACE accurate_sum_arrays_product
|
||||
MODULE PROCEDURE kahan_sum_arrays_product_masked_d3
|
||||
END INTERFACE
|
||||
CONTAINS
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
|
|
@ -427,6 +430,42 @@ CONTAINS
|
|||
ENDIF
|
||||
END FUNCTION kahan_sum_d3
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief computes the accurate sum of an array that is the element wise product of two input arrays.
|
||||
!> a mask array determines which product array points to include in the sum
|
||||
!> \param array1 the first input array to compute the product array
|
||||
!> \param array2 the second input array to compute the product array
|
||||
!> \param mask the mask array
|
||||
!> \param th screening threshold: only array points where the value of mask is greater than th are
|
||||
!> included in the sum
|
||||
!> \retval ks the result of the summation
|
||||
! **************************************************************************************************
|
||||
FUNCTION kahan_sum_arrays_product_masked_d3(array1, array2, mask, th) RESULT(ks)
|
||||
REAL(KIND=dp), DIMENSION(:, :, :), INTENT(IN), &
|
||||
POINTER :: array1, array2, mask
|
||||
REAL(KIND=dp), INTENT(in) :: th
|
||||
REAL(KIND=dp) :: ks
|
||||
|
||||
INTEGER :: i1, i2, i3, nflops
|
||||
REAL(KIND=dp) :: c, t, y
|
||||
|
||||
ks = dzero; t = dzero; y = dzero; c = dzero
|
||||
DO i3 = LBOUND(mask, 3), UBOUND(mask, 3)
|
||||
DO i2 = LBOUND(mask, 2), UBOUND(mask, 2)
|
||||
DO i1 = LBOUND(mask, 1), UBOUND(mask, 1)
|
||||
IF (mask(i1, i2, i3) .GT. th) THEN
|
||||
y = array1(i1, i2, i3)*array2(i1, i2, i3)-c
|
||||
t = ks+y
|
||||
c = (t-ks)-y
|
||||
ks = t
|
||||
nflops = nflops+1
|
||||
END IF
|
||||
ENDDO
|
||||
ENDDO
|
||||
ENDDO
|
||||
|
||||
END FUNCTION kahan_sum_arrays_product_masked_d3
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param array ...
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -8,10 +8,10 @@
|
|||
! **************************************************************************************************
|
||||
MODULE cp_control_utils
|
||||
USE bibliography, ONLY: &
|
||||
Andreussi2012, Dewar1977, Dewar1985, Elstner1998, Fattebert2002, Hu2007, Krack2000, &
|
||||
Lippert1997, Lippert1999, Porezag1995, Repasky2002, Rocha2006, Schenter2008, Seifert1996, &
|
||||
Souza2002, Stengel2009, Stewart1989, Stewart2007, Thiel1992, Umari2002, VandeVondele2005a, &
|
||||
VandeVondele2005b, Zhechkov2005, cite_reference
|
||||
Andreussi2012, Becke1988b, Dewar1977, Dewar1985, Elstner1998, Fattebert2002, Holmberg2017, &
|
||||
Hu2007, Krack2000, Lippert1997, Lippert1999, Porezag1995, Repasky2002, Rocha2006, &
|
||||
Schenter2008, Seifert1996, Souza2002, Stengel2009, Stewart1989, Stewart2007, Thiel1992, &
|
||||
Umari2002, VandeVondele2005a, VandeVondele2005b, Zhechkov2005, cite_reference
|
||||
USE cp_control_types, ONLY: &
|
||||
admm_control_create, admm_control_type, ddapc_control_create, ddapc_restraint_type, &
|
||||
dft_control_create, dft_control_type, efield_type, qs_control_type, sccs_control_create, &
|
||||
|
|
@ -24,21 +24,28 @@ MODULE cp_control_utils
|
|||
cp_print_key_unit_nr
|
||||
USE cp_units, ONLY: cp_unit_from_cp2k,&
|
||||
cp_unit_to_cp2k
|
||||
USE hirshfeld_types, ONLY: create_hirshfeld_type,&
|
||||
set_hirshfeld_info
|
||||
USE input_constants, ONLY: &
|
||||
constant_env, custom_env, do_admm_basis_projection, do_admm_blocked_projection, &
|
||||
do_admm_blocking_purify_full, do_admm_charge_constrained_projection, &
|
||||
do_admm_exch_scaling_merlot, do_admm_purify_mcweeny, do_admm_purify_mo_diag, &
|
||||
do_admm_purify_mo_no_diag, do_admm_purify_none, do_admm_purify_none_dm, &
|
||||
do_ddapc_constraint, do_ddapc_restraint, do_method_am1, do_method_dftb, do_method_gapw, &
|
||||
do_method_gapw_xc, do_method_gpw, do_method_lrigpw, do_method_mndo, do_method_mndod, &
|
||||
do_method_ofgpw, do_method_pdg, do_method_pm3, do_method_pm6, do_method_pnnl, &
|
||||
do_method_rm1, do_method_scptb, do_pwgrid_ns_fullspace, do_pwgrid_ns_halfspace, &
|
||||
do_pwgrid_spherical, do_s2_constraint, do_s2_restraint, do_se_is_kdso, do_se_is_kdso_d, &
|
||||
do_se_is_slater, do_se_lr_ewald, do_se_lr_ewald_gks, do_se_lr_ewald_r3, do_se_lr_none, &
|
||||
gaussian_env, numerical, ramp_env, real_time_propagation, sccs_andreussi, &
|
||||
sccs_derivative_cd3, sccs_derivative_cd5, sccs_derivative_cd7, sccs_derivative_fft, &
|
||||
sccs_fattebert_gygi, sic_ad, sic_eo, sic_list_all, sic_list_unpaired, sic_mauri_spz, &
|
||||
sic_mauri_us, sic_none, slater, tddfpt_excitations, use_mom_ref_user, xas_dip_len
|
||||
becke_cavity_conf, becke_cutoff_element, becke_cutoff_global, becke_dynamic_conf, &
|
||||
becke_mixed_conf, becke_none_conf, becke_static_conf, cdft_combined_constraint, &
|
||||
cdft_density_constraint, cdft_magnetization_constraint, constant_env, custom_env, &
|
||||
do_admm_basis_projection, do_admm_blocked_projection, do_admm_blocking_purify_full, &
|
||||
do_admm_charge_constrained_projection, do_admm_exch_scaling_merlot, &
|
||||
do_admm_purify_mcweeny, do_admm_purify_mo_diag, do_admm_purify_mo_no_diag, &
|
||||
do_admm_purify_none, do_admm_purify_none_dm, do_ddapc_constraint, do_ddapc_restraint, &
|
||||
do_method_am1, do_method_dftb, do_method_gapw, do_method_gapw_xc, do_method_gpw, &
|
||||
do_method_lrigpw, do_method_mndo, do_method_mndod, do_method_ofgpw, do_method_pdg, &
|
||||
do_method_pm3, do_method_pm6, do_method_pnnl, do_method_rm1, do_method_scptb, &
|
||||
do_pwgrid_ns_fullspace, do_pwgrid_ns_halfspace, do_pwgrid_spherical, do_s2_constraint, &
|
||||
do_s2_restraint, do_se_is_kdso, do_se_is_kdso_d, do_se_is_slater, do_se_lr_ewald, &
|
||||
do_se_lr_ewald_gks, do_se_lr_ewald_r3, do_se_lr_none, gaussian_env, numerical, &
|
||||
outer_scf_becke_constraint, outer_scf_cdft_constraint, outer_scf_hirshfeld_constraint, &
|
||||
outer_scf_none, radius_covalent, radius_user, ramp_env, real_time_propagation, &
|
||||
sccs_andreussi, sccs_derivative_cd3, sccs_derivative_cd5, sccs_derivative_cd7, &
|
||||
sccs_derivative_fft, sccs_fattebert_gygi, shape_function_gaussian, sic_ad, sic_eo, &
|
||||
sic_list_all, sic_list_unpaired, sic_mauri_spz, sic_mauri_us, sic_none, slater, &
|
||||
tddfpt_excitations, use_mom_ref_user, xas_dip_len
|
||||
USE input_cp2k_dft, ONLY: create_dft_section,&
|
||||
create_qs_section
|
||||
USE input_enumeration_types, ONLY: enum_i2c,&
|
||||
|
|
@ -557,14 +564,16 @@ CONTAINS
|
|||
TYPE(enumeration_type), POINTER :: enum
|
||||
TYPE(keyword_type), POINTER :: keyword
|
||||
TYPE(section_type), POINTER :: section
|
||||
TYPE(section_vals_type), POINTER :: becke_restraint_section, ddapc_restraint_section, &
|
||||
dftb_parameter, dftb_section, lri_optbas_section, mull_section, s2_restraint_section, &
|
||||
scptb_section, se_section
|
||||
TYPE(section_vals_type), POINTER :: becke_restraint_section, cdft_control_section, &
|
||||
ddapc_restraint_section, dftb_parameter, dftb_section, lri_optbas_section, mull_section, &
|
||||
s2_restraint_section, scptb_section, se_section
|
||||
|
||||
CALL timeset(routineN, handle)
|
||||
|
||||
was_present = .FALSE.
|
||||
NULLIFY (mull_section, se_section, dftb_section, scptb_section, lri_optbas_section)
|
||||
NULLIFY (mull_section, ddapc_restraint_section, s2_restraint_section, becke_restraint_section, &
|
||||
se_section, dftb_section, dftb_parameter, scptb_section, lri_optbas_section, &
|
||||
cdft_control_section)
|
||||
|
||||
mull_section => section_vals_get_subs_vals(qs_section, "MULLIKEN_RESTRAINT")
|
||||
ddapc_restraint_section => section_vals_get_subs_vals(qs_section, "DDAPC_RESTRAINT")
|
||||
|
|
@ -575,6 +584,7 @@ CONTAINS
|
|||
dftb_parameter => section_vals_get_subs_vals(dftb_section, "PARAMETER")
|
||||
scptb_section => section_vals_get_subs_vals(qs_section, "SCPTB")
|
||||
lri_optbas_section => section_vals_get_subs_vals(qs_section, "OPTIMIZE_LRI_BASIS")
|
||||
cdft_control_section => section_vals_get_subs_vals(qs_section, "CDFT")
|
||||
|
||||
! Setup all defaults values and overwrite input parameters
|
||||
! EPS_DEFAULT should set the target accuracy in the total energy (~per electron) or a closely related value
|
||||
|
|
@ -809,6 +819,11 @@ CONTAINS
|
|||
CALL read_becke_section(qs_control, becke_restraint_section)
|
||||
ENDIF
|
||||
|
||||
CALL section_vals_get(cdft_control_section, explicit=qs_control%cdft)
|
||||
IF (qs_control%cdft) THEN
|
||||
CALL read_cdft_control_section(qs_control, cdft_control_section)
|
||||
ENDIF
|
||||
|
||||
! Semi-empirical code
|
||||
IF (qs_control%semi_empirical) THEN
|
||||
CALL section_vals_val_get(se_section, "ORTHOGONAL_BASIS", &
|
||||
|
|
@ -1697,8 +1712,8 @@ CONTAINS
|
|||
|
||||
! **************************************************************************************************
|
||||
!> \brief reads the input parameters needed for evaluating a becke weight population constraint
|
||||
!> \param qs_control ...
|
||||
!> \param becke_section ...
|
||||
!> \param qs_control the qs_control which holds the Becke control type
|
||||
!> \param becke_section the input section containing Becke constraint information
|
||||
!> \author fschiff
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE read_becke_section(qs_control, becke_section)
|
||||
|
|
@ -1709,16 +1724,97 @@ CONTAINS
|
|||
CHARACTER(len=*), PARAMETER :: routineN = 'read_becke_section', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: j, jj, k, n_rep
|
||||
INTEGER :: j, jj, k, n_rep, nvar
|
||||
INTEGER, DIMENSION(:), POINTER :: tmplist
|
||||
LOGICAL :: exists
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: rtmplist
|
||||
|
||||
CALL section_vals_val_get(becke_section, "STRENGTH", &
|
||||
r_val=qs_control%becke_control%strength)
|
||||
CALL section_vals_val_get(becke_section, "TARGET", &
|
||||
r_val=qs_control%becke_control%target)
|
||||
CALL section_vals_val_get(becke_section, "TYPE_OF_DENSITY", &
|
||||
i_val=qs_control%becke_control%density_type)
|
||||
NULLIFY (tmplist, rtmplist)
|
||||
CALL section_vals_val_get(becke_section, "CONSTRAINT_TYPE", &
|
||||
i_val=qs_control%becke_control%constraint_type)
|
||||
|
||||
SELECT CASE (qs_control%becke_control%constraint_type)
|
||||
CASE (cdft_density_constraint, cdft_magnetization_constraint)
|
||||
nvar = 1
|
||||
CASE (cdft_combined_constraint)
|
||||
nvar = 2
|
||||
CALL section_vals_val_get(becke_section, "COMBINED_TYPE", &
|
||||
i_val=qs_control%becke_control%combined_type)
|
||||
END SELECT
|
||||
|
||||
ALLOCATE (qs_control%becke_control%strength(nvar))
|
||||
ALLOCATE (qs_control%becke_control%becke_order_p(nvar))
|
||||
ALLOCATE (qs_control%becke_control%target(nvar))
|
||||
CALL section_vals_val_get(becke_section, "STRENGTH", r_vals=rtmplist)
|
||||
DO j = 1, nvar
|
||||
qs_control%becke_control%strength(j) = rtmplist(j)
|
||||
END DO
|
||||
CALL section_vals_val_get(becke_section, "TARGET", r_vals=rtmplist)
|
||||
DO j = 1, nvar
|
||||
qs_control%becke_control%target(j) = rtmplist(j)
|
||||
END DO
|
||||
|
||||
CALL section_vals_val_get(becke_section, "ADJUST_SIZE", &
|
||||
l_val=qs_control%becke_control%adjust)
|
||||
|
||||
IF (qs_control%becke_control%adjust) THEN
|
||||
CALL section_vals_val_get(becke_section, "ATOMIC_RADII", explicit=exists)
|
||||
IF (.NOT. exists) CPABORT("Keyword ATOMIC_RADII is missing.")
|
||||
CALL section_vals_val_get(becke_section, "ATOMIC_RADII", r_vals=rtmplist)
|
||||
CPASSERT(SIZE(rtmplist) > 0)
|
||||
ALLOCATE (qs_control%becke_control%radii_tmp(SIZE(rtmplist)))
|
||||
DO j = 1, SIZE(rtmplist)
|
||||
qs_control%becke_control%radii_tmp(j) = rtmplist(j)
|
||||
END DO
|
||||
END IF
|
||||
|
||||
CALL section_vals_val_get(becke_section, "ATOMIC_CHARGES", &
|
||||
l_val=qs_control%becke_control%atomic_charges)
|
||||
CALL section_vals_val_get(becke_section, "SHOULD_SKIP", &
|
||||
l_val=qs_control%becke_control%should_skip)
|
||||
CALL section_vals_val_get(becke_section, "CONFINE", &
|
||||
i_val=qs_control%becke_control%confine_method)
|
||||
CALL section_vals_val_get(becke_section, "CUTOFF_TYPE", &
|
||||
i_val=qs_control%becke_control%cutoff_type)
|
||||
|
||||
SELECT CASE (qs_control%becke_control%cutoff_type)
|
||||
CASE (becke_cutoff_global)
|
||||
CALL section_vals_val_get(becke_section, "GLOBAL_CUTOFF", &
|
||||
r_val=qs_control%becke_control%rglobal)
|
||||
CASE (becke_cutoff_element)
|
||||
CALL section_vals_val_get(becke_section, "ELEMENT_CUTOFF", r_vals=rtmplist)
|
||||
CPASSERT(SIZE(rtmplist) > 0)
|
||||
ALLOCATE (qs_control%becke_control%cutoffs_tmp(SIZE(rtmplist)))
|
||||
DO j = 1, SIZE(rtmplist)
|
||||
qs_control%becke_control%cutoffs_tmp(j) = rtmplist(j)
|
||||
END DO
|
||||
END SELECT
|
||||
|
||||
SELECT CASE (qs_control%becke_control%confine_method)
|
||||
CASE (becke_none_conf)
|
||||
qs_control%becke_control%confine = .FALSE.
|
||||
qs_control%becke_control%dynamic_confine = .FALSE.
|
||||
qs_control%becke_control%cavity_confine = .FALSE.
|
||||
CASE (becke_static_conf)
|
||||
qs_control%becke_control%confine = .TRUE.
|
||||
qs_control%becke_control%dynamic_confine = .FALSE.
|
||||
qs_control%becke_control%cavity_confine = .FALSE.
|
||||
CASE (becke_dynamic_conf)
|
||||
qs_control%becke_control%confine = .FALSE.
|
||||
qs_control%becke_control%dynamic_confine = .TRUE.
|
||||
qs_control%becke_control%cavity_confine = .FALSE.
|
||||
CASE (becke_cavity_conf)
|
||||
qs_control%becke_control%confine = .FALSE.
|
||||
qs_control%becke_control%dynamic_confine = .FALSE.
|
||||
qs_control%becke_control%cavity_confine = .TRUE.
|
||||
CASE (becke_mixed_conf)
|
||||
qs_control%becke_control%confine = .FALSE.
|
||||
qs_control%becke_control%dynamic_confine = .TRUE.
|
||||
qs_control%becke_control%cavity_confine = .TRUE.
|
||||
END SELECT
|
||||
|
||||
CALL section_vals_val_get(becke_section, "IN_MEMORY", &
|
||||
l_val=qs_control%becke_control%in_memory)
|
||||
CALL section_vals_val_get(becke_section, "ATOMS", &
|
||||
n_rep_val=n_rep)
|
||||
jj = 0
|
||||
|
|
@ -1728,7 +1824,8 @@ CONTAINS
|
|||
jj = jj+1
|
||||
END DO
|
||||
END DO
|
||||
IF (jj < 1) CPABORT("Need at least 1 atom to use ddapc contraints.")
|
||||
IF (jj < 1) CPABORT("Need at least 1 atom to use Becke constraints.")
|
||||
|
||||
qs_control%becke_control%natoms = jj
|
||||
IF (ASSOCIATED(qs_control%becke_control%atoms)) DEALLOCATE (qs_control%becke_control%atoms)
|
||||
ALLOCATE (qs_control%becke_control%atoms(qs_control%becke_control%natoms))
|
||||
|
|
@ -1746,8 +1843,52 @@ CONTAINS
|
|||
ALLOCATE (qs_control%becke_control%coeff(qs_control%becke_control%natoms))
|
||||
qs_control%becke_control%coeff = 1.0_dp
|
||||
|
||||
CALL section_vals_val_get(becke_section, "COEFF", &
|
||||
n_rep_val=n_rep)
|
||||
IF (qs_control%becke_control%atomic_charges) THEN
|
||||
IF (ASSOCIATED(qs_control%becke_control%charge)) &
|
||||
DEALLOCATE (qs_control%becke_control%charge)
|
||||
ALLOCATE (qs_control%becke_control%charge(qs_control%becke_control%natoms))
|
||||
END IF
|
||||
|
||||
IF (qs_control%becke_control%confine) THEN
|
||||
CALL section_vals_val_get(becke_section, "CONFINE_DIR", &
|
||||
i_val=qs_control%becke_control%confine_dir)
|
||||
jj = 0
|
||||
CALL section_vals_val_get(becke_section, "CONFINE_BOUNDS", r_vals=rtmplist)
|
||||
DO j = 1, SIZE(rtmplist)
|
||||
jj = jj+1
|
||||
IF (jj .GT. 2) CPABORT("Need exactly two values to define confinement.")
|
||||
qs_control%becke_control%confine_bounds(jj) = rtmplist(j)
|
||||
END DO
|
||||
IF (jj .LT. 2) CPABORT("Need exactly two values to define confinement.")
|
||||
END IF
|
||||
|
||||
IF (qs_control%becke_control%dynamic_confine) THEN
|
||||
CALL section_vals_val_get(becke_section, "CONFINE_DIR", &
|
||||
i_val=qs_control%becke_control%confine_dir)
|
||||
jj = 0
|
||||
CALL section_vals_val_get(becke_section, "DYNAMIC_RADIUS", &
|
||||
r_val=qs_control%becke_control%dynamic_radius)
|
||||
END IF
|
||||
|
||||
IF (qs_control%becke_control%cavity_confine) THEN
|
||||
CALL section_vals_val_get(becke_section, "CAVITY_SHAPE", &
|
||||
i_val=qs_control%becke_control%cavity_shape)
|
||||
CALL section_vals_val_get(becke_section, "CAVITY_RADIUS", &
|
||||
r_val=qs_control%becke_control%rcavity)
|
||||
CALL section_vals_val_get(becke_section, "EPS_CAVITY", &
|
||||
r_val=qs_control%becke_control%eps_cavity)
|
||||
CALL section_vals_val_get(becke_section, "CAVITY_PRINT", &
|
||||
l_val=qs_control%becke_control%print_cavity)
|
||||
CALL section_vals_val_get(becke_section, "CAVITY_USE_BOHR", &
|
||||
l_val=qs_control%becke_control%use_bohr)
|
||||
CALL create_hirshfeld_type(qs_control%becke_control%cavity_env)
|
||||
CALL set_hirshfeld_info(qs_control%becke_control%cavity_env, &
|
||||
shape_function_type=shape_function_gaussian, iterative=.FALSE., &
|
||||
radius_type=qs_control%becke_control%cavity_shape, &
|
||||
use_bohr=qs_control%becke_control%use_bohr)
|
||||
END IF
|
||||
|
||||
CALL section_vals_val_get(becke_section, "COEFF", n_rep_val=n_rep)
|
||||
jj = 0
|
||||
DO k = 1, n_rep
|
||||
CALL section_vals_val_get(becke_section, "COEFF", i_rep_val=k, r_vals=rtmplist)
|
||||
|
|
@ -1760,8 +1901,222 @@ CONTAINS
|
|||
END DO
|
||||
IF (jj < qs_control%becke_control%natoms .AND. jj .NE. 0) &
|
||||
CPABORT("Need no or the same number of coeff as there are atoms.")
|
||||
|
||||
IF (qs_control%becke_control%confine) THEN
|
||||
IF (qs_control%becke_control%confine_bounds(1) /= qs_control%becke_control%confine_bounds(2)) &
|
||||
CPABORT("Static confinement was requested but the bounds were not defined.")
|
||||
END IF
|
||||
|
||||
CALL section_vals_val_get(becke_section, "FRAGMENT_DENSITIES", &
|
||||
l_val=qs_control%becke_control%fragment_density)
|
||||
|
||||
IF (qs_control%becke_control%fragment_density) THEN
|
||||
CALL section_vals_val_get(becke_section, "FRAGMENT_A_FILE_NAME", &
|
||||
c_val=qs_control%becke_control%fragment_a_fname)
|
||||
CALL section_vals_val_get(becke_section, "FRAGMENT_B_FILE_NAME", &
|
||||
c_val=qs_control%becke_control%fragment_b_fname)
|
||||
END IF
|
||||
|
||||
CALL cite_reference(Becke1988b)
|
||||
|
||||
END SUBROUTINE read_becke_section
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief reads the input parameters needed for CDFT with OT
|
||||
!> \param qs_control the qs_control which holds the CDFT control type
|
||||
!> \param cdft_control_section the input section for CDFT
|
||||
!> \author Nico Holmberg [12.2015]
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE read_cdft_control_section(qs_control, cdft_control_section)
|
||||
TYPE(qs_control_type), INTENT(INOUT) :: qs_control
|
||||
TYPE(section_vals_type), POINTER :: cdft_control_section
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'read_cdft_control_section', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
LOGICAL :: exists
|
||||
TYPE(section_vals_type), POINTER :: hirshfeld_constraint_section, &
|
||||
outer_scf_section
|
||||
|
||||
NULLIFY (outer_scf_section, hirshfeld_constraint_section)
|
||||
CALL section_vals_val_get(cdft_control_section, "TYPE_OF_CONSTRAINT", &
|
||||
i_val=qs_control%cdft_control%type)
|
||||
IF (qs_control%cdft_control%type /= outer_scf_none) THEN
|
||||
CALL section_vals_val_get(cdft_control_section, "REUSE_PRECOND", &
|
||||
l_val=qs_control%cdft_control%reuse_precond)
|
||||
CALL section_vals_val_get(cdft_control_section, "PRECOND_FREQ", &
|
||||
i_val=qs_control%cdft_control%precond_freq)
|
||||
CALL section_vals_val_get(cdft_control_section, "MAX_REUSE", &
|
||||
i_val=qs_control%cdft_control%max_reuse)
|
||||
CALL section_vals_val_get(cdft_control_section, "PURGE_HISTORY", &
|
||||
l_val=qs_control%cdft_control%purge_history)
|
||||
CALL section_vals_val_get(cdft_control_section, "PURGE_FREQ", &
|
||||
i_val=qs_control%cdft_control%purge_freq)
|
||||
CALL section_vals_val_get(cdft_control_section, "PURGE_OFFSET", &
|
||||
i_val=qs_control%cdft_control%purge_offset)
|
||||
outer_scf_section => section_vals_get_subs_vals(cdft_control_section, "OUTER_SCF")
|
||||
CALL section_vals_val_get(outer_scf_section, "_SECTION_PARAMETERS_", &
|
||||
l_val=qs_control%cdft_control%constraint_control%have_scf)
|
||||
IF (qs_control%cdft_control%constraint_control%have_scf) THEN
|
||||
CALL section_vals_val_get(outer_scf_section, "TYPE", &
|
||||
i_val=qs_control%cdft_control%constraint_control%type)
|
||||
|
||||
IF (qs_control%cdft_control%constraint_control%type /= outer_scf_becke_constraint .AND. &
|
||||
qs_control%cdft_control%constraint_control%type /= outer_scf_cdft_constraint) &
|
||||
CPABORT("Unsupported CDFT constraint.")
|
||||
|
||||
CALL section_vals_val_get(outer_scf_section, "EPS_SCF", &
|
||||
r_val=qs_control%cdft_control%constraint_control%eps_scf)
|
||||
CALL section_vals_val_get(outer_scf_section, "STEP_SIZE", &
|
||||
r_val=qs_control%cdft_control%constraint_control%step_size)
|
||||
CALL section_vals_val_get(outer_scf_section, "DIIS_BUFFER_LENGTH", &
|
||||
i_val=qs_control%cdft_control%constraint_control%diis_buffer_length)
|
||||
CALL section_vals_val_get(outer_scf_section, "BISECT_TRUST_COUNT", &
|
||||
i_val=qs_control%cdft_control%constraint_control%bisect_trust_count)
|
||||
CALL section_vals_val_get(outer_scf_section, "OPTIMIZER", &
|
||||
i_val=qs_control%cdft_control%constraint_control%optimizer)
|
||||
CALL section_vals_val_get(outer_scf_section, "MAX_SCF", &
|
||||
i_val=qs_control%cdft_control%constraint_control%max_scf)
|
||||
CALL section_vals_val_get(outer_scf_section, "EXTRAPOLATION_ORDER", &
|
||||
i_val=qs_control%cdft_control%constraint_control%extrapolation_order)
|
||||
CALL section_vals_val_get(outer_scf_section, "JACOBIAN_TYPE", &
|
||||
i_val=qs_control%cdft_control%constraint_control%jacobian_type)
|
||||
CALL section_vals_val_get(outer_scf_section, "JACOBIAN_STEP", &
|
||||
r_val=qs_control%cdft_control%constraint_control%jacobian_step)
|
||||
SELECT CASE (qs_control%cdft_control%type)
|
||||
CASE (outer_scf_hirshfeld_constraint)
|
||||
IF (qs_control%cdft_control%constraint_control%type == outer_scf_cdft_constraint) THEN
|
||||
hirshfeld_constraint_section => section_vals_get_subs_vals(cdft_control_section, "HIRSHFELD_CONSTRAINT")
|
||||
CALL section_vals_get(hirshfeld_constraint_section, explicit=exists)
|
||||
IF (exists) THEN
|
||||
CALL read_hirshfeld_constraint_section(qs_control, hirshfeld_constraint_section)
|
||||
qs_control%cdft_control%constraint_type = qs_control%cdft_control%hirshfeld_control%constraint_type
|
||||
qs_control%cdft_control%combined_type = qs_control%cdft_control%hirshfeld_control%combined_type
|
||||
ELSE
|
||||
CPABORT("HIRSHFELD_CONSTRAINT section is missing.")
|
||||
END IF
|
||||
ELSE
|
||||
CPABORT("Mismatch in defining constraint.")
|
||||
END IF
|
||||
CASE (outer_scf_becke_constraint)
|
||||
! Do nothing, yet. For now, constraint is defined QS%BECKE_RESTRAINT
|
||||
END SELECT
|
||||
|
||||
CALL cite_reference(Holmberg2017)
|
||||
ELSE
|
||||
qs_control%cdft = .FALSE.
|
||||
END IF
|
||||
ELSE
|
||||
qs_control%cdft = .FALSE.
|
||||
END IF
|
||||
|
||||
END SUBROUTINE read_cdft_control_section
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief reads the input parameters needed for Hirshfeld constraint
|
||||
!> \param qs_control the qs_control which holds the Hirshfeld constraint
|
||||
!> \param hirshfeld_constraint_section the input section for a Hirshfeld constraint
|
||||
!> \author Nico Holmberg [12.2015]
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE read_hirshfeld_constraint_section(qs_control, hirshfeld_constraint_section)
|
||||
TYPE(qs_control_type), INTENT(INOUT) :: qs_control
|
||||
TYPE(section_vals_type), POINTER :: hirshfeld_constraint_section
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'read_hirshfeld_constraint_section', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: j, jj, k, n_rep, nvar, radius_type, &
|
||||
refc, shapef
|
||||
INTEGER, DIMENSION(:), POINTER :: tmplist
|
||||
LOGICAL :: do_radius, do_sc
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: rtmplist
|
||||
|
||||
NULLIFY (tmplist, rtmplist)
|
||||
CPASSERT(.NOT. ASSOCIATED(qs_control%cdft_control%hirshfeld_control))
|
||||
ALLOCATE (qs_control%cdft_control%hirshfeld_control)
|
||||
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "ATOMS", n_rep_val=n_rep)
|
||||
jj = 0
|
||||
DO k = 1, n_rep
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "ATOMS", i_rep_val=k, i_vals=tmplist)
|
||||
DO j = 1, SIZE(tmplist)
|
||||
jj = jj+1
|
||||
END DO
|
||||
END DO
|
||||
IF (jj < 1) CPABORT("Need at least 1 atom to use Hirshfeld constraints.")
|
||||
qs_control%cdft_control%hirshfeld_control%natoms = jj
|
||||
ALLOCATE (qs_control%cdft_control%hirshfeld_control%atoms( &
|
||||
qs_control%cdft_control%hirshfeld_control%natoms))
|
||||
jj = 0
|
||||
DO k = 1, n_rep
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "ATOMS", i_rep_val=k, i_vals=tmplist)
|
||||
DO j = 1, SIZE(tmplist)
|
||||
jj = jj+1
|
||||
qs_control%cdft_control%hirshfeld_control%atoms(jj) = tmplist(j)
|
||||
END DO
|
||||
END DO
|
||||
|
||||
ALLOCATE (qs_control%cdft_control%hirshfeld_control%coeff(qs_control%cdft_control%hirshfeld_control%natoms))
|
||||
qs_control%cdft_control%hirshfeld_control%coeff = 1.0_dp
|
||||
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "COEFF", n_rep_val=n_rep)
|
||||
jj = 0
|
||||
DO k = 1, n_rep
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "COEFF", i_rep_val=k, r_vals=rtmplist)
|
||||
DO j = 1, SIZE(rtmplist)
|
||||
jj = jj+1
|
||||
IF (jj > qs_control%cdft_control%hirshfeld_control%natoms) &
|
||||
CPABORT("Need the same number of coeff as there are atoms.")
|
||||
qs_control%cdft_control%hirshfeld_control%coeff(jj) = rtmplist(j)
|
||||
IF (ABS(rtmplist(j)) /= 1.0_dp) &
|
||||
CPABORT("Illegal coefficient. Only -1.0 or 1.0 allowed.")
|
||||
END DO
|
||||
END DO
|
||||
IF (jj < qs_control%cdft_control%hirshfeld_control%natoms .AND. jj .NE. 0) &
|
||||
CPABORT("Need no or the same number of coeff as there are atoms.")
|
||||
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "CONSTRAINT_TYPE", &
|
||||
i_val=qs_control%cdft_control%hirshfeld_control%constraint_type)
|
||||
SELECT CASE (qs_control%cdft_control%hirshfeld_control%constraint_type)
|
||||
CASE (cdft_density_constraint, cdft_magnetization_constraint)
|
||||
nvar = 1
|
||||
CASE (cdft_combined_constraint)
|
||||
nvar = 1
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "COMBINED_TYPE", &
|
||||
i_val=qs_control%cdft_control%hirshfeld_control%constraint_type)
|
||||
END SELECT
|
||||
|
||||
IF (qs_control%cdft_control%hirshfeld_control%constraint_type /= cdft_density_constraint) &
|
||||
CPABORT("Hirshfeld magnetization density/combined constraint NYI.")
|
||||
|
||||
ALLOCATE (qs_control%cdft_control%target(nvar))
|
||||
ALLOCATE (qs_control%cdft_control%strength(nvar))
|
||||
ALLOCATE (qs_control%cdft_control%value(nvar))
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "STRENGTH", r_vals=rtmplist)
|
||||
DO j = 1, nvar
|
||||
qs_control%cdft_control%strength(j) = rtmplist(j)
|
||||
END DO
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "TARGET", r_vals=rtmplist)
|
||||
DO j = 1, nvar
|
||||
qs_control%cdft_control%target(j) = rtmplist(j)
|
||||
END DO
|
||||
|
||||
NULLIFY (qs_control%cdft_control%hirshfeld_control%hirshfeld_env)
|
||||
CALL create_hirshfeld_type(qs_control%cdft_control%hirshfeld_control%hirshfeld_env)
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "SELF_CONSISTENT", l_val=do_sc)
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "USER_RADIUS", l_val=do_radius)
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "SHAPE_FUNCTION", i_val=shapef)
|
||||
CALL section_vals_val_get(hirshfeld_constraint_section, "REFERENCE_CHARGE", i_val=refc)
|
||||
IF (do_radius) THEN
|
||||
radius_type = radius_user
|
||||
ELSE
|
||||
radius_type = radius_covalent
|
||||
END IF
|
||||
CALL set_hirshfeld_info(qs_control%cdft_control%hirshfeld_control%hirshfeld_env, &
|
||||
shape_function_type=shapef, iterative=do_sc, ref_charge=refc, radius_type=radius_type)
|
||||
|
||||
END SUBROUTINE read_hirshfeld_constraint_section
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param dft_control ...
|
||||
|
|
|
|||
2497
src/et_coupling.F
2497
src/et_coupling.F
File diff suppressed because it is too large
Load diff
|
|
@ -14,7 +14,8 @@ MODULE cp_fm_basic_linalg
|
|||
USE cp_fm_struct, ONLY: cp_fm_struct_equivalent
|
||||
USE cp_fm_types, ONLY: &
|
||||
cp_fm_create, cp_fm_get_element, cp_fm_get_info, cp_fm_get_submatrix, cp_fm_p_type, &
|
||||
cp_fm_release, cp_fm_set_all, cp_fm_set_submatrix, cp_fm_to_fm, cp_fm_type
|
||||
cp_fm_release, cp_fm_set_all, cp_fm_set_element, cp_fm_set_submatrix, cp_fm_to_fm, &
|
||||
cp_fm_type
|
||||
USE cp_log_handling, ONLY: cp_to_string
|
||||
USE kahan_sum, ONLY: accurate_sum
|
||||
USE kinds, ONLY: dp,&
|
||||
|
|
@ -1205,116 +1206,168 @@ CONTAINS
|
|||
END SUBROUTINE cp_fm_column_scale
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param matrix_a ...
|
||||
!> \param matrix_inverse ...
|
||||
!> \param det_a ...
|
||||
!> \author Florian Schiffmann(02.2007)
|
||||
!> \note of Jan Wilhelm (12.2015)
|
||||
!> \brief Inverts a cp_fm_type matrix, optionally returning the determinant of the input matrix
|
||||
!> \param matrix_a the matrix to invert
|
||||
!> \param matrix_inverse the inverse of matrix_a
|
||||
!> \param det_a the determinant of matrix_a
|
||||
!> \param eps_svd optional parameter to active SVD based inversion, singular values below eps_svd
|
||||
!> are screened
|
||||
!> \par History
|
||||
!> note of Jan Wilhelm (12.2015)
|
||||
!> - computation of determinant corrected
|
||||
!> - determinant only computed if det_a is present
|
||||
!> 12.2016 added option to use SVD instead of LU [Nico Holmberg]
|
||||
!> \author Florian Schiffmann(02.2007)
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE cp_fm_invert(matrix_a, matrix_inverse, det_a)
|
||||
SUBROUTINE cp_fm_invert(matrix_a, matrix_inverse, det_a, eps_svd)
|
||||
|
||||
TYPE(cp_fm_type), POINTER :: matrix_a, matrix_inverse
|
||||
REAL(KIND=dp), INTENT(OUT), OPTIONAL :: det_a
|
||||
REAL(KIND=dp), INTENT(IN), OPTIONAL :: eps_svd
|
||||
|
||||
CHARACTER(LEN=*), PARAMETER :: routineN = 'cp_fm_invert', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: n
|
||||
INTEGER, ALLOCATABLE, DIMENSION(:) :: ipivot
|
||||
REAL(KIND=dp) :: determinant
|
||||
REAL(KIND=dp) :: determinant, my_eps_svd
|
||||
REAL(KIND=dp), DIMENSION(:, :), POINTER :: a
|
||||
TYPE(cp_fm_type), POINTER :: matrix_B, matrix_lu
|
||||
TYPE(cp_fm_type), POINTER :: matrix_lu, &
|
||||
u, vt, sigma, inv_sigma_ut
|
||||
#if defined(__SCALAPACK)
|
||||
INTEGER :: i, info, liwork, lwork, group, exponent_of_minus_one
|
||||
INTEGER, DIMENSION(9) :: desca
|
||||
INTEGER, ALLOCATABLE, DIMENSION(:) :: iwork
|
||||
REAL(KIND=dp) :: alpha, beta
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: diag
|
||||
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: berr, ferr, work
|
||||
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: work
|
||||
#else
|
||||
LOGICAL :: sign
|
||||
REAL(KIND=dp) :: eps1
|
||||
#endif
|
||||
|
||||
my_eps_svd = 0.0_dp
|
||||
IF (PRESENT(eps_svd)) my_eps_svd = eps_svd
|
||||
|
||||
CALL cp_fm_create(matrix=matrix_lu, &
|
||||
matrix_struct=matrix_a%matrix_struct, &
|
||||
name="A_lu"//TRIM(ADJUSTL(cp_to_string(1)))//"MATRIX")
|
||||
CALL cp_fm_to_fm(matrix_a, matrix_lu)
|
||||
|
||||
CALL cp_fm_create(matrix=matrix_B, &
|
||||
matrix_struct=matrix_a%matrix_struct, &
|
||||
name="B_mat"//TRIM(ADJUSTL(cp_to_string(1)))//"MATRIX")
|
||||
a => matrix_lu%local_data
|
||||
n = matrix_lu%matrix_struct%nrow_global
|
||||
ALLOCATE (ipivot(n+matrix_a%matrix_struct%nrow_block))
|
||||
ipivot(:) = 0
|
||||
#if defined(__SCALAPACK)
|
||||
ALLOCATE (ferr(n))
|
||||
ALLOCATE (berr(n))
|
||||
ALLOCATE (work(3*n))
|
||||
ALLOCATE (iwork(3*N))
|
||||
lwork = 3*n
|
||||
liwork = 3*n
|
||||
desca(:) = matrix_lu%matrix_struct%descriptor(:)
|
||||
CALL pdgetrf(n, n, a(1, 1), 1, 1, desca, ipivot, info)
|
||||
IF (my_eps_svd .EQ. 0.0_dp) THEN
|
||||
! Use LU decomposition
|
||||
lwork = 3*n
|
||||
liwork = 3*n
|
||||
desca(:) = matrix_lu%matrix_struct%descriptor(:)
|
||||
CALL pdgetrf(n, n, a(1, 1), 1, 1, desca, ipivot, info)
|
||||
|
||||
IF (PRESENT(det_a)) THEN
|
||||
IF (PRESENT(det_a)) THEN
|
||||
|
||||
ALLOCATE (diag(n))
|
||||
diag(:) = 0.0_dp
|
||||
DO i = 1, n
|
||||
CALL cp_fm_get_element(matrix_lu, i, i, diag(i)) ! not completely optimal in speed i would say
|
||||
ENDDO
|
||||
|
||||
exponent_of_minus_one = 0
|
||||
determinant = 1.0_dp
|
||||
DO i = 1, n
|
||||
determinant = determinant*diag(i)
|
||||
IF (ipivot(i) .NE. i) THEN
|
||||
exponent_of_minus_one = exponent_of_minus_one+1
|
||||
END IF
|
||||
ENDDO
|
||||
DEALLOCATE (diag)
|
||||
|
||||
group = matrix_lu%matrix_struct%para_env%group
|
||||
CALL mp_sum(exponent_of_minus_one, group)
|
||||
|
||||
determinant = determinant*(-1.0_dp)**exponent_of_minus_one
|
||||
|
||||
END IF
|
||||
|
||||
alpha = 0.0_dp
|
||||
beta = 1.0_dp
|
||||
CALL cp_fm_set_all(matrix_inverse, alpha, beta)
|
||||
CALL pdgetrs('N', n, n, matrix_lu%local_data, 1, 1, desca, ipivot, matrix_inverse%local_data, 1, 1, desca, info)
|
||||
ELSE
|
||||
! Use singular value decomposition
|
||||
CALL cp_fm_create(matrix=u, &
|
||||
matrix_struct=matrix_a%matrix_struct, &
|
||||
name="LEFT_SINGULAR_MATRIX")
|
||||
CALL cp_fm_set_all(u, alpha=0.0_dp)
|
||||
CALL cp_fm_create(matrix=vt, &
|
||||
matrix_struct=matrix_a%matrix_struct, &
|
||||
name="RIGHT_SINGULAR_MATRIX")
|
||||
CALL cp_fm_set_all(vt, alpha=0.0_dp)
|
||||
ALLOCATE (diag(n))
|
||||
diag(:) = 0.0_dp
|
||||
DO i = 1, n
|
||||
CALL cp_fm_get_element(matrix_lu, i, i, diag(i)) ! not completely optimal in speed i would say
|
||||
ENDDO
|
||||
|
||||
exponent_of_minus_one = 0
|
||||
desca(:) = matrix_lu%matrix_struct%descriptor(:)
|
||||
ALLOCATE (work(1))
|
||||
! Workspace query
|
||||
lwork = -1
|
||||
CALL pdgesvd('V', 'V', n, n, matrix_lu%local_data, 1, 1, desca, diag, u%local_data, &
|
||||
1, 1, desca, vt%local_data, 1, 1, desca, work, lwork, info)
|
||||
lwork = INT(work(1))
|
||||
DEALLOCATE (work)
|
||||
ALLOCATE (work(lwork))
|
||||
! SVD
|
||||
CALL pdgesvd('V', 'V', n, n, matrix_lu%local_data, 1, 1, desca, diag, u%local_data, &
|
||||
1, 1, desca, vt%local_data, 1, 1, desca, work, lwork, info)
|
||||
! info == n+1 implies homogeneity error when the number of procs is large
|
||||
! this likely isnt a problem, but maybe we should handle it separately
|
||||
IF (info /= 0 .AND. info /= n+1) &
|
||||
CPABORT("Singular value decomposition of matrix failed.")
|
||||
! (Pseudo)inverse and (pseudo)determinant
|
||||
CALL cp_fm_create(matrix=sigma, &
|
||||
matrix_struct=matrix_a%matrix_struct, &
|
||||
name="SINGULAR_VALUE_MATRIX")
|
||||
CALL cp_fm_set_all(sigma, alpha=0.0_dp)
|
||||
determinant = 1.0_dp
|
||||
! TODO: Notify if some singular values fall below my_eps_svd
|
||||
DO i = 1, n
|
||||
determinant = determinant*diag(i)
|
||||
IF (ipivot(i) .NE. i) THEN
|
||||
exponent_of_minus_one = exponent_of_minus_one+1
|
||||
END IF
|
||||
ENDDO
|
||||
IF (diag(i) < my_eps_svd) THEN
|
||||
diag(i) = 0.0_dp
|
||||
ELSE
|
||||
determinant = determinant*diag(i)
|
||||
diag(i) = 1.0_dp/diag(i)
|
||||
ENDIF
|
||||
CALL cp_fm_set_element(sigma, i, i, diag(i))
|
||||
END DO
|
||||
DEALLOCATE (diag)
|
||||
|
||||
group = matrix_lu%matrix_struct%para_env%group
|
||||
CALL mp_sum(exponent_of_minus_one, group)
|
||||
|
||||
determinant = determinant*(-1.0_dp)**exponent_of_minus_one
|
||||
|
||||
! Sigma^-1 * U^T
|
||||
CALL cp_fm_create(matrix=inv_sigma_ut, &
|
||||
matrix_struct=matrix_a%matrix_struct, &
|
||||
name="SINGULAR_VALUE_MATRIX")
|
||||
CALL cp_fm_set_all(inv_sigma_ut, alpha=0.0_dp)
|
||||
CALL pdgemm('N', 'T', n, n, n, 1.0_dp, sigma%local_data, 1, 1, desca, &
|
||||
u%local_data, 1, 1, desca, 0.0_dp, inv_sigma_ut%local_data, 1, 1, desca)
|
||||
! A^-1 = V * (Sigma^-1 * U^T)
|
||||
CALL cp_fm_set_all(matrix_inverse, alpha=0.0_dp)
|
||||
CALL pdgemm('T', 'N', n, n, n, 1.0_dp, vt%local_data, 1, 1, desca, &
|
||||
inv_sigma_ut%local_data, 1, 1, desca, 0.0_dp, matrix_inverse%local_data, 1, 1, desca)
|
||||
! Clean up
|
||||
DEALLOCATE (work)
|
||||
CALL cp_fm_release(u)
|
||||
CALL cp_fm_release(vt)
|
||||
CALL cp_fm_release(sigma)
|
||||
CALL cp_fm_release(inv_sigma_ut)
|
||||
END IF
|
||||
|
||||
alpha = 0.0_dp
|
||||
beta = 1.0_dp
|
||||
CALL cp_fm_set_all(matrix_inverse, alpha, beta)
|
||||
CALL pdgetrs('N', n, n, matrix_lu%local_data, 1, 1, desca, ipivot, matrix_inverse%local_data, 1, 1, desca, info)
|
||||
! CALL cp_fm_set_all(matrix_B,alpha,beta)
|
||||
! DO iter=1,10
|
||||
! CALL pdgerfs('N',n,n,matrix_a%local_data,1,1,desca,matrix_lu%local_data,&
|
||||
! 1,1,desca,ipivot,matrix_B%local_data,&
|
||||
! 1,1,desca,matrix_inverse%local_data,1,1,&
|
||||
! desca,ferr,berr,work,lwork,iwork,liwork,info)
|
||||
! eps1=eps2
|
||||
! eps2=MAXVAL(ferr)
|
||||
! IF (ABS( eps2 - eps1) <= EPSILON(1.0_dp))THEN
|
||||
! EXIT
|
||||
! END IF
|
||||
! END DO
|
||||
DEALLOCATE (ferr)
|
||||
DEALLOCATE (berr)
|
||||
DEALLOCATE (work)
|
||||
DEALLOCATE (iwork)
|
||||
|
||||
#else
|
||||
sign = .TRUE.
|
||||
CALL invert_matrix(matrix_a%local_data, matrix_inverse%local_data, &
|
||||
eval_error=eps1)
|
||||
CALL cp_fm_lu_decompose(matrix_lu, determinant, correct_sign=sign)
|
||||
IF (my_eps_svd .EQ. 0.0_dp) THEN
|
||||
sign = .TRUE.
|
||||
CALL invert_matrix(matrix_a%local_data, matrix_inverse%local_data, &
|
||||
eval_error=eps1)
|
||||
CALL cp_fm_lu_decompose(matrix_lu, determinant, correct_sign=sign)
|
||||
ELSE
|
||||
CPABORT("Matrix inversion using SVD NYI without SCALAPACK.")
|
||||
END IF
|
||||
#endif
|
||||
CALL cp_fm_release(matrix_lu)
|
||||
CALL cp_fm_release(matrix_B)
|
||||
DEALLOCATE (ipivot)
|
||||
IF (PRESENT(det_a)) det_a = determinant
|
||||
END SUBROUTINE cp_fm_invert
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ MODULE force_env_methods
|
|||
scaled_to_real
|
||||
USE constraint_fxd, ONLY: fix_atom_control
|
||||
USE constraint_vsite, ONLY: vsite_force_control
|
||||
USE cp_control_types, ONLY: dft_control_type
|
||||
USE cp_iter_types, ONLY: cp_iteration_info_copy_iter
|
||||
USE cp_log_handling, ONLY: cp_add_default_logger,&
|
||||
cp_get_default_logger,&
|
||||
|
|
@ -81,7 +82,8 @@ MODULE force_env_methods
|
|||
mix_restrained,&
|
||||
use_bazant_eip,&
|
||||
use_lenosky_eip
|
||||
USE input_section_types, ONLY: section_vals_get_subs_vals,&
|
||||
USE input_section_types, ONLY: section_vals_get,&
|
||||
section_vals_get_subs_vals,&
|
||||
section_vals_retain,&
|
||||
section_vals_type,&
|
||||
section_vals_val_get
|
||||
|
|
@ -95,6 +97,9 @@ MODULE force_env_methods
|
|||
mp_sync
|
||||
USE metadynamics_types, ONLY: meta_env_retain,&
|
||||
meta_env_type
|
||||
USE mixed_cdft_methods, ONLY: mixed_cdft_build_weight,&
|
||||
mixed_cdft_calculate_coupling,&
|
||||
mixed_cdft_init
|
||||
USE mixed_energy_types, ONLY: mixed_energy_type,&
|
||||
mixed_force_type
|
||||
USE mixed_environment_types, ONLY: get_mixed_env,&
|
||||
|
|
@ -108,10 +113,12 @@ MODULE force_env_methods
|
|||
USE qmmm_force, ONLY: qmmm_calc_energy_force
|
||||
USE qmmm_types, ONLY: qmmm_env_retain,&
|
||||
qmmm_env_type
|
||||
USE qmmm_util, ONLY: apply_qmmm_translate
|
||||
USE qmmmx_force, ONLY: qmmmx_calc_energy_force
|
||||
USE qmmmx_types, ONLY: qmmmx_env_retain,&
|
||||
qmmmx_env_type
|
||||
USE qs_environment_types, ONLY: qs_env_retain,&
|
||||
USE qs_environment_types, ONLY: get_qs_env,&
|
||||
qs_env_retain,&
|
||||
qs_environment_type
|
||||
USE qs_force, ONLY: qs_calc_energy_force
|
||||
USE restraint, ONLY: restraint_control
|
||||
|
|
@ -747,14 +754,15 @@ CONTAINS
|
|||
!> \brief ****f* force_env_methods/mixed_energy_forces [1.0]
|
||||
!>
|
||||
!> Computes energy and forces for a mixed force_env type
|
||||
!> \param force_env ...
|
||||
!> \param calculate_forces ...
|
||||
!> \param force_env the force_env that holds the mixed_env type
|
||||
!> \param calculate_forces decides if forces should be calculated
|
||||
!> \par History
|
||||
!> 11.06 created [fschiff]
|
||||
!> 04.07 generalization to an illimited number of force_eval [tlaino]
|
||||
!> 04.07 further generalization to force_eval with different geometrical
|
||||
!> structures [tlaino]
|
||||
!> 04.08 reorganizing the genmix structure (collecting common code)
|
||||
!> 01.16 added CDFT [Nico Holmberg]
|
||||
!> \author Florian Schiffmann
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE mixed_energy_forces(force_env, calculate_forces)
|
||||
|
|
@ -767,11 +775,11 @@ CONTAINS
|
|||
|
||||
CHARACTER(LEN=default_path_length) :: coupling_function
|
||||
CHARACTER(LEN=default_string_length) :: def_error, description, this_error
|
||||
INTEGER :: iforce_eval, iparticle, jparticle, &
|
||||
mixing_type, my_group, natom, &
|
||||
nforce_eval, source, unit_nr
|
||||
INTEGER :: et_freq, iforce_eval, iparticle, &
|
||||
jparticle, mixing_type, my_group, &
|
||||
natom, nforce_eval, source, unit_nr
|
||||
INTEGER, DIMENSION(:), POINTER :: glob_natoms, map_index
|
||||
LOGICAL :: dip_exists
|
||||
LOGICAL :: dip_exists, do_mixed_cdft, explicit
|
||||
REAL(KIND=dp) :: coupling_parameter, dedf, der_1, der_2, &
|
||||
dx, energy, err, lambda, lerr, &
|
||||
restraint_strength, restraint_target, &
|
||||
|
|
@ -784,10 +792,12 @@ CONTAINS
|
|||
TYPE(cp_result_type), POINTER :: loc_results, results_mix
|
||||
TYPE(cp_subsys_p_type), DIMENSION(:), POINTER :: subsystems
|
||||
TYPE(cp_subsys_type), POINTER :: subsys_mix
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(mixed_energy_type), POINTER :: mixed_energy
|
||||
TYPE(mixed_force_type), DIMENSION(:), POINTER :: global_forces
|
||||
TYPE(particle_list_p_type), DIMENSION(:), POINTER :: particles
|
||||
TYPE(particle_list_type), POINTER :: particles_mix
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
TYPE(section_vals_type), POINTER :: force_env_section, gen_section, &
|
||||
mapping_section, mixed_section, &
|
||||
root_section
|
||||
|
|
@ -806,7 +816,7 @@ CONTAINS
|
|||
particles=particles_mix, &
|
||||
virial=virial_mix, &
|
||||
results=results_mix)
|
||||
NULLIFY (map_index, glob_natoms, global_forces)
|
||||
NULLIFY (map_index, glob_natoms, global_forces, qs_env, dft_control)
|
||||
|
||||
nforce_eval = SIZE(force_env%sub_force_env)
|
||||
mixed_section => section_vals_get_subs_vals(force_env_section, "MIXED")
|
||||
|
|
@ -822,66 +832,189 @@ CONTAINS
|
|||
ALLOCATE (results(nforce_eval))
|
||||
energies = 0.0_dp
|
||||
glob_natoms = 0
|
||||
DO iforce_eval = 1, nforce_eval
|
||||
NULLIFY (subsystems(iforce_eval)%subsys, particles(iforce_eval)%list)
|
||||
NULLIFY (results(iforce_eval)%results, virials(iforce_eval)%virial)
|
||||
CALL virial_create(virials(iforce_eval)%virial)
|
||||
CALL cp_result_create(results(iforce_eval)%results)
|
||||
IF (.NOT. ASSOCIATED(force_env%sub_force_env(iforce_eval)%force_env)) CYCLE
|
||||
! From this point on the error is the sub_error
|
||||
my_group = force_env%mixed_env%group_distribution(force_env%para_env%mepos)
|
||||
my_logger => force_env%mixed_env%sub_logger(my_group+1)%p
|
||||
! Copy iterations info (they are updated only in the main mixed_env)
|
||||
CALL cp_iteration_info_copy_iter(logger%iter_info, my_logger%iter_info)
|
||||
CALL cp_add_default_logger(my_logger)
|
||||
! Check if mixed CDFT calculation is requested and initialize
|
||||
CALL section_vals_val_get(mixed_section, "MIXING_TYPE", i_val=mixing_type)
|
||||
IF (mixing_type == mix_linear_combination .AND. &
|
||||
.NOT. ASSOCIATED(force_env%mixed_env%cdft_control)) THEN
|
||||
CALL section_vals_val_get(mixed_section, "LINEAR%MIXED_CDFT", l_val=do_mixed_cdft)
|
||||
force_env%mixed_env%do_mixed_cdft = do_mixed_cdft
|
||||
IF (force_env%mixed_env%do_mixed_cdft) THEN
|
||||
! Enforce some limitations
|
||||
CPASSERT(force_env%mixed_env%ngroups == 2)
|
||||
CPASSERT(nforce_eval == 2)
|
||||
CALL section_vals_get(mapping_section, explicit=explicit)
|
||||
! The sub_force_envs must share the same geometrical structure
|
||||
CPASSERT(.NOT. explicit)
|
||||
CALL section_vals_val_get(mixed_section, "LINEAR%MIXED_CDFT_COUPLING", i_val=et_freq)
|
||||
IF (et_freq .LT. 0) THEN
|
||||
force_env%mixed_env%do_mixed_et = .FALSE.
|
||||
ELSE
|
||||
force_env%mixed_env%do_mixed_et = .TRUE.
|
||||
IF (et_freq == 0) THEN
|
||||
force_env%mixed_env%et_freq = 1
|
||||
ELSE
|
||||
force_env%mixed_env%et_freq = et_freq
|
||||
END IF
|
||||
END IF
|
||||
CALL mixed_cdft_init(force_env, calculate_forces)
|
||||
END IF
|
||||
END IF
|
||||
IF (.NOT. force_env%mixed_env%do_mixed_cdft) THEN
|
||||
DO iforce_eval = 1, nforce_eval
|
||||
NULLIFY (subsystems(iforce_eval)%subsys, particles(iforce_eval)%list)
|
||||
NULLIFY (results(iforce_eval)%results, virials(iforce_eval)%virial)
|
||||
CALL virial_create(virials(iforce_eval)%virial)
|
||||
CALL cp_result_create(results(iforce_eval)%results)
|
||||
IF (.NOT. ASSOCIATED(force_env%sub_force_env(iforce_eval)%force_env)) CYCLE
|
||||
! From this point on the error is the sub_error
|
||||
my_group = force_env%mixed_env%group_distribution(force_env%para_env%mepos)
|
||||
my_logger => force_env%mixed_env%sub_logger(my_group+1)%p
|
||||
! Copy iterations info (they are updated only in the main mixed_env)
|
||||
CALL cp_iteration_info_copy_iter(logger%iter_info, my_logger%iter_info)
|
||||
CALL cp_add_default_logger(my_logger)
|
||||
|
||||
! Get all available subsys
|
||||
CALL force_env_get(force_env=force_env%sub_force_env(iforce_eval)%force_env, &
|
||||
subsys=subsystems(iforce_eval)%subsys)
|
||||
! Get all available subsys
|
||||
CALL force_env_get(force_env=force_env%sub_force_env(iforce_eval)%force_env, &
|
||||
subsys=subsystems(iforce_eval)%subsys)
|
||||
|
||||
! all force_env share the same cell
|
||||
CALL cp_subsys_set(subsystems(iforce_eval)%subsys, cell=cell_mix)
|
||||
! all force_env share the same cell
|
||||
CALL cp_subsys_set(subsystems(iforce_eval)%subsys, cell=cell_mix)
|
||||
|
||||
! Get available particles
|
||||
CALL cp_subsys_get(subsys=subsystems(iforce_eval)%subsys, &
|
||||
particles=particles(iforce_eval)%list)
|
||||
! Get available particles
|
||||
CALL cp_subsys_get(subsys=subsystems(iforce_eval)%subsys, &
|
||||
particles=particles(iforce_eval)%list)
|
||||
|
||||
! Get Mapping index array
|
||||
natom = SIZE(particles(iforce_eval)%list%els)
|
||||
CALL get_subsys_map_index(mapping_section, natom, iforce_eval, nforce_eval, &
|
||||
map_index)
|
||||
! Get Mapping index array
|
||||
natom = SIZE(particles(iforce_eval)%list%els)
|
||||
|
||||
! Mapping particles from iforce_eval environment to the mixed env
|
||||
DO iparticle = 1, natom
|
||||
jparticle = map_index(iparticle)
|
||||
particles(iforce_eval)%list%els(iparticle)%r = particles_mix%els(jparticle)%r
|
||||
CALL get_subsys_map_index(mapping_section, natom, iforce_eval, nforce_eval, &
|
||||
map_index)
|
||||
|
||||
! Mapping particles from iforce_eval environment to the mixed env
|
||||
DO iparticle = 1, natom
|
||||
jparticle = map_index(iparticle)
|
||||
particles(iforce_eval)%list%els(iparticle)%r = particles_mix%els(jparticle)%r
|
||||
END DO
|
||||
|
||||
! Calculate energy and forces for each sub_force_env
|
||||
CALL force_env_calc_energy_force(force_env%sub_force_env(iforce_eval)%force_env, &
|
||||
calc_force=calculate_forces, &
|
||||
skip_external_control=.TRUE.)
|
||||
! Only the rank 0 process collect info for each computation
|
||||
IF (force_env%sub_force_env(iforce_eval)%force_env%para_env%mepos == &
|
||||
force_env%sub_force_env(iforce_eval)%force_env%para_env%source) THEN
|
||||
CALL force_env_get(force_env%sub_force_env(iforce_eval)%force_env, &
|
||||
potential_energy=energy)
|
||||
CALL cp_subsys_get(subsystems(iforce_eval)%subsys, &
|
||||
virial=loc_virial, results=loc_results)
|
||||
energies(iforce_eval) = energy
|
||||
glob_natoms(iforce_eval) = natom
|
||||
CALL cp_virial(loc_virial, virials(iforce_eval)%virial)
|
||||
CALL cp_result_copy(loc_results, results(iforce_eval)%results)
|
||||
END IF
|
||||
! Deallocate map_index array
|
||||
IF (ASSOCIATED(map_index)) THEN
|
||||
DEALLOCATE (map_index)
|
||||
END IF
|
||||
CALL cp_rm_default_logger()
|
||||
END DO
|
||||
ELSE
|
||||
DO iforce_eval = 1, nforce_eval
|
||||
NULLIFY (subsystems(iforce_eval)%subsys, particles(iforce_eval)%list)
|
||||
NULLIFY (results(iforce_eval)%results, virials(iforce_eval)%virial)
|
||||
CALL virial_create(virials(iforce_eval)%virial)
|
||||
CALL cp_result_create(results(iforce_eval)%results)
|
||||
IF (.NOT. ASSOCIATED(force_env%sub_force_env(iforce_eval)%force_env)) CYCLE
|
||||
! From this point on the error is the sub_error
|
||||
my_group = force_env%mixed_env%group_distribution(force_env%para_env%mepos)
|
||||
my_logger => force_env%mixed_env%sub_logger(my_group+1)%p
|
||||
! Copy iterations info (they are updated only in the main mixed_env)
|
||||
CALL cp_iteration_info_copy_iter(logger%iter_info, my_logger%iter_info)
|
||||
|
||||
! Get all available subsys
|
||||
CALL force_env_get(force_env=force_env%sub_force_env(iforce_eval)%force_env, &
|
||||
subsys=subsystems(iforce_eval)%subsys)
|
||||
|
||||
! all force_env share the same cell
|
||||
CALL cp_subsys_set(subsystems(iforce_eval)%subsys, cell=cell_mix)
|
||||
|
||||
! Get available particles
|
||||
CALL cp_subsys_get(subsys=subsystems(iforce_eval)%subsys, &
|
||||
particles=particles(iforce_eval)%list)
|
||||
|
||||
! Get Mapping index array
|
||||
natom = SIZE(particles(iforce_eval)%list%els)
|
||||
|
||||
CALL get_subsys_map_index(mapping_section, natom, iforce_eval, nforce_eval, &
|
||||
map_index)
|
||||
|
||||
! Mapping particles from iforce_eval environment to the mixed env
|
||||
DO iparticle = 1, natom
|
||||
jparticle = map_index(iparticle)
|
||||
particles(iforce_eval)%list%els(iparticle)%r = particles_mix%els(jparticle)%r
|
||||
END DO
|
||||
! Mixed CDFT + QMMM: Need to translate now
|
||||
IF (force_env%mixed_env%do_mixed_qmmm_cdft) &
|
||||
CALL apply_qmmm_translate(force_env%sub_force_env(iforce_eval)%force_env%qmmm_env)
|
||||
END DO
|
||||
|
||||
! Calculate energy and forces for each sub_force_env
|
||||
CALL force_env_calc_energy_force(force_env%sub_force_env(iforce_eval)%force_env, &
|
||||
calc_force=calculate_forces, &
|
||||
skip_external_control=.TRUE.)
|
||||
! Only the rank 0 process collect info for each computation
|
||||
IF (force_env%sub_force_env(iforce_eval)%force_env%para_env%mepos == &
|
||||
force_env%sub_force_env(iforce_eval)%force_env%para_env%source) THEN
|
||||
CALL force_env_get(force_env%sub_force_env(iforce_eval)%force_env, &
|
||||
potential_energy=energy)
|
||||
CALL cp_subsys_get(subsystems(iforce_eval)%subsys, &
|
||||
virial=loc_virial, results=loc_results)
|
||||
energies(iforce_eval) = energy
|
||||
glob_natoms(iforce_eval) = natom
|
||||
CALL cp_virial(loc_virial, virials(iforce_eval)%virial)
|
||||
CALL cp_result_copy(loc_results, results(iforce_eval)%results)
|
||||
! For mixed CDFT, build weight and gradient on all processors before splitting into groups and
|
||||
! starting energy calculation
|
||||
IF (force_env%mixed_env%do_mixed_cdft) THEN
|
||||
CALL mixed_cdft_build_weight(force_env, calculate_forces)
|
||||
END IF
|
||||
! Deallocate map_index array
|
||||
IF (ASSOCIATED(map_index)) THEN
|
||||
DEALLOCATE (map_index)
|
||||
END IF
|
||||
CALL cp_rm_default_logger()
|
||||
END DO
|
||||
|
||||
DO iforce_eval = 1, nforce_eval
|
||||
IF (.NOT. ASSOCIATED(force_env%sub_force_env(iforce_eval)%force_env)) CYCLE
|
||||
CALL cp_add_default_logger(my_logger)
|
||||
! Calculate energy and forces for each sub_force_env
|
||||
CALL force_env_calc_energy_force(force_env%sub_force_env(iforce_eval)%force_env, &
|
||||
calc_force=calculate_forces, &
|
||||
skip_external_control=.TRUE.)
|
||||
! Only the rank 0 process collect info for each computation
|
||||
IF (force_env%sub_force_env(iforce_eval)%force_env%para_env%mepos == &
|
||||
force_env%sub_force_env(iforce_eval)%force_env%para_env%source) THEN
|
||||
CALL force_env_get(force_env%sub_force_env(iforce_eval)%force_env, &
|
||||
potential_energy=energy)
|
||||
CALL cp_subsys_get(subsystems(iforce_eval)%subsys, &
|
||||
virial=loc_virial, results=loc_results)
|
||||
energies(iforce_eval) = energy
|
||||
glob_natoms(iforce_eval) = natom
|
||||
CALL cp_virial(loc_virial, virials(iforce_eval)%virial)
|
||||
CALL cp_result_copy(loc_results, results(iforce_eval)%results)
|
||||
END IF
|
||||
! Deallocate map_index array
|
||||
IF (ASSOCIATED(map_index)) THEN
|
||||
DEALLOCATE (map_index)
|
||||
END IF
|
||||
CALL cp_rm_default_logger()
|
||||
END DO
|
||||
END IF
|
||||
! Handling Parallel execution
|
||||
CALL mp_sync(force_env%para_env%group)
|
||||
! Transfer cdft strengths for writing restart
|
||||
IF (force_env%mixed_env%do_mixed_cdft) THEN
|
||||
IF (.NOT. ASSOCIATED(force_env%mixed_env%strength)) &
|
||||
ALLOCATE (force_env%mixed_env%strength(2))
|
||||
force_env%mixed_env%strength = 0.0_dp
|
||||
DO iforce_eval = 1, nforce_eval
|
||||
IF (.NOT. ASSOCIATED(force_env%sub_force_env(iforce_eval)%force_env)) CYCLE
|
||||
IF (force_env%mixed_env%do_mixed_qmmm_cdft) THEN
|
||||
qs_env => force_env%sub_force_env(iforce_eval)%force_env%qmmm_env%qs_env
|
||||
ELSE
|
||||
CALL force_env_get(force_env%sub_force_env(iforce_eval)%force_env, qs_env=qs_env)
|
||||
END IF
|
||||
CALL get_qs_env(qs_env, dft_control=dft_control)
|
||||
IF (force_env%sub_force_env(iforce_eval)%force_env%para_env%mepos == &
|
||||
force_env%sub_force_env(iforce_eval)%force_env%para_env%source) &
|
||||
force_env%mixed_env%strength(iforce_eval) = dft_control%qs_control%cdft_control%strength(1)
|
||||
END DO
|
||||
CALL mp_sum(force_env%mixed_env%strength, force_env%para_env%group)
|
||||
END IF
|
||||
! Mixed CDFT: calculate ET coupling
|
||||
IF (force_env%mixed_env%do_mixed_et) THEN
|
||||
IF (MODULO(force_env%mixed_env%cdft_control%sim_step, force_env%mixed_env%et_freq) == 0) &
|
||||
CALL mixed_cdft_calculate_coupling(force_env)
|
||||
END IF
|
||||
! Let's transfer energy, natom, forces, virials
|
||||
CALL mp_sum(energies, force_env%para_env%group)
|
||||
CALL mp_sum(glob_natoms, force_env%para_env%group)
|
||||
|
|
|
|||
|
|
@ -17,11 +17,17 @@ MODULE hirshfeld_methods
|
|||
pbc
|
||||
USE cp_control_types, ONLY: dft_control_type
|
||||
USE cp_para_types, ONLY: cp_para_env_type
|
||||
USE cp_units, ONLY: cp_unit_to_cp2k
|
||||
USE cube_utils, ONLY: cube_info_type
|
||||
USE hirshfeld_types, ONLY: get_hirshfeld_info,&
|
||||
hirshfeld_type,&
|
||||
set_hirshfeld_info
|
||||
USE input_constants, ONLY: shape_function_density,&
|
||||
USE input_constants, ONLY: radius_covalent,&
|
||||
radius_default,&
|
||||
radius_single,&
|
||||
radius_user,&
|
||||
radius_vdw,&
|
||||
shape_function_density,&
|
||||
shape_function_gaussian
|
||||
USE kinds, ONLY: dp,&
|
||||
int_8
|
||||
|
|
@ -126,15 +132,19 @@ CONTAINS
|
|||
END SUBROUTINE write_hirshfeld_charges
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param hirshfeld_env ...
|
||||
!> \param qs_kind_set ...
|
||||
!> \param atomic_kind_set ...
|
||||
!> \brief creates kind specific shape functions for Hirshfeld charges
|
||||
!> \param hirshfeld_env the env that holds information about Hirshfeld
|
||||
!> \param qs_kind_set the qs_kind_set
|
||||
!> \param atomic_kind_set the atomic_kind_set
|
||||
!> \param radius optional radius parameter to use for all atomic kinds
|
||||
!> \param radii_list optional list of radii to use for different atomic kinds
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE create_shape_function(hirshfeld_env, qs_kind_set, atomic_kind_set)
|
||||
SUBROUTINE create_shape_function(hirshfeld_env, qs_kind_set, atomic_kind_set, radius, radii_list)
|
||||
TYPE(hirshfeld_type), POINTER :: hirshfeld_env
|
||||
TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
|
||||
TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
|
||||
REAL(KIND=dp), OPTIONAL :: radius
|
||||
REAL(KIND=dp), DIMENSION(:), OPTIONAL, POINTER :: radii_list
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'create_shape_function', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
|
@ -161,8 +171,36 @@ CONTAINS
|
|||
ALLOCATE (hirshfeld_env%kind_shape_fn(ikind)%coef(1))
|
||||
CALL get_qs_kind(qs_kind_set(ikind), element_symbol=esym)
|
||||
rco = 2.0_dp
|
||||
CALL get_ptable_info(symbol=esym, covalent_radius=rco, found=found)
|
||||
rco = MAX(rco, 1.0_dp)
|
||||
SELECT CASE (hirshfeld_env%radius_type)
|
||||
CASE (radius_default)
|
||||
CALL get_ptable_info(symbol=esym, covalent_radius=rco, found=found)
|
||||
rco = MAX(rco, 1.0_dp)
|
||||
CASE (radius_user)
|
||||
CPASSERT(PRESENT(radii_list))
|
||||
CPASSERT(ASSOCIATED(radii_list))
|
||||
CPASSERT(SIZE(radii_list) == nkind)
|
||||
! Note we assume that radii_list is correctly ordered
|
||||
rco = radii_list(ikind)
|
||||
CASE (radius_vdw)
|
||||
CALL get_ptable_info(symbol=esym, vdw_radius=rco, found=found)
|
||||
IF (.NOT. found) THEN
|
||||
rco = MAX(rco, 1.0_dp)
|
||||
ELSE
|
||||
IF (hirshfeld_env%use_bohr) &
|
||||
rco = cp_unit_to_cp2k(rco, "angstrom")
|
||||
END IF
|
||||
CASE (radius_covalent)
|
||||
CALL get_ptable_info(symbol=esym, covalent_radius=rco, found=found)
|
||||
IF (.NOT. found) THEN
|
||||
rco = MAX(rco, 1.0_dp)
|
||||
ELSE
|
||||
IF (hirshfeld_env%use_bohr) &
|
||||
rco = cp_unit_to_cp2k(rco, "angstrom")
|
||||
END IF
|
||||
CASE (radius_single)
|
||||
CPASSERT(PRESENT(radius))
|
||||
rco = radius
|
||||
END SELECT
|
||||
al = 0.5_dp/rco**2
|
||||
hirshfeld_env%kind_shape_fn(ikind)%zet(1) = al
|
||||
hirshfeld_env%kind_shape_fn(ikind)%coef(1) = (al/pi)**1.5_dp
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
! **************************************************************************************************
|
||||
MODULE hirshfeld_types
|
||||
|
||||
USE input_constants, ONLY: shape_function_gaussian
|
||||
USE input_constants, ONLY: radius_default,&
|
||||
shape_function_gaussian
|
||||
USE kinds, ONLY: dp
|
||||
USE pw_types, ONLY: pw_p_type,&
|
||||
pw_release
|
||||
|
|
@ -28,13 +29,15 @@ MODULE hirshfeld_types
|
|||
PUBLIC :: get_hirshfeld_info, set_hirshfeld_info
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief quantities needed for a Hischfeld based partitioning of real space
|
||||
!> \brief quantities needed for a Hirshfeld based partitioning of real space
|
||||
!> \author JGH
|
||||
! **************************************************************************************************
|
||||
TYPE hirshfeld_type
|
||||
LOGICAL :: iterative
|
||||
LOGICAL :: iterative, &
|
||||
use_bohr
|
||||
INTEGER :: shape_function_type
|
||||
INTEGER :: ref_charge
|
||||
INTEGER :: ref_charge, &
|
||||
radius_type
|
||||
TYPE(shape_fn), DIMENSION(:), &
|
||||
POINTER :: kind_shape_fn
|
||||
REAL(KIND=dp), DIMENSION(:), &
|
||||
|
|
@ -71,7 +74,9 @@ CONTAINS
|
|||
ALLOCATE (hirshfeld_env)
|
||||
|
||||
hirshfeld_env%iterative = .FALSE.
|
||||
hirshfeld_env%use_bohr = .FALSE.
|
||||
hirshfeld_env%shape_function_type = shape_function_gaussian
|
||||
hirshfeld_env%radius_type = radius_default
|
||||
NULLIFY (hirshfeld_env%kind_shape_fn)
|
||||
NULLIFY (hirshfeld_env%charges)
|
||||
NULLIFY (hirshfeld_env%fnorm)
|
||||
|
|
@ -122,20 +127,25 @@ CONTAINS
|
|||
END SUBROUTINE release_hirshfeld_type
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param hirshfeld_env ...
|
||||
!> \param shape_function_type ...
|
||||
!> \param iterative ...
|
||||
!> \param ref_charge ...
|
||||
!> \param fnorm ...
|
||||
!> \brief Get information from a Hirshfeld env
|
||||
!> \param hirshfeld_env the env that holds the information
|
||||
!> \param shape_function_type the type of shape function used
|
||||
!> \param iterative logical which determins if iterative Hirshfeld charges should be computed
|
||||
!> \param ref_charge the reference charge type (core charge or mulliken)
|
||||
!> \param fnorm normalization of the shape function
|
||||
!> \param radius_type the type of radius used for building the shape functions
|
||||
!> \param use_bohr logical which determines if angstrom or bohr units are used to build the
|
||||
!> shape functions
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE get_hirshfeld_info(hirshfeld_env, shape_function_type, iterative, &
|
||||
ref_charge, fnorm)
|
||||
ref_charge, fnorm, radius_type, use_bohr)
|
||||
TYPE(hirshfeld_type), POINTER :: hirshfeld_env
|
||||
INTEGER, INTENT(OUT), OPTIONAL :: shape_function_type
|
||||
LOGICAL, INTENT(OUT), OPTIONAL :: iterative
|
||||
INTEGER, INTENT(OUT), OPTIONAL :: ref_charge
|
||||
TYPE(pw_p_type), OPTIONAL, POINTER :: fnorm
|
||||
INTEGER, INTENT(OUT), OPTIONAL :: radius_type
|
||||
LOGICAL, INTENT(OUT), OPTIONAL :: use_bohr
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'get_hirshfeld_info', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
|
@ -148,6 +158,12 @@ CONTAINS
|
|||
IF (PRESENT(iterative)) THEN
|
||||
iterative = hirshfeld_env%iterative
|
||||
END IF
|
||||
IF (PRESENT(use_bohr)) THEN
|
||||
use_bohr = hirshfeld_env%use_bohr
|
||||
END IF
|
||||
IF (PRESENT(radius_type)) THEN
|
||||
radius_type = hirshfeld_env%radius_type
|
||||
END IF
|
||||
IF (PRESENT(ref_charge)) THEN
|
||||
ref_charge = hirshfeld_env%ref_charge
|
||||
END IF
|
||||
|
|
@ -158,20 +174,25 @@ CONTAINS
|
|||
END SUBROUTINE get_hirshfeld_info
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param hirshfeld_env ...
|
||||
!> \param shape_function_type ...
|
||||
!> \param iterative ...
|
||||
!> \param ref_charge ...
|
||||
!> \param fnorm ...
|
||||
!> \brief Set values of a Hirshfeld env
|
||||
!> \param hirshfeld_env the env that holds the information
|
||||
!> \param shape_function_type the type of shape function used
|
||||
!> \param iterative logical which determins if iterative Hirshfeld charges should be computed
|
||||
!> \param ref_charge the reference charge type (core charge or mulliken)
|
||||
!> \param fnorm normalization of the shape function
|
||||
!> \param radius_type the type of radius used for building the shape functions
|
||||
!> \param use_bohr logical which determines if angstrom or bohr units are used to build the
|
||||
!> shape functions
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE set_hirshfeld_info(hirshfeld_env, shape_function_type, iterative, &
|
||||
ref_charge, fnorm)
|
||||
ref_charge, fnorm, radius_type, use_bohr)
|
||||
TYPE(hirshfeld_type), POINTER :: hirshfeld_env
|
||||
INTEGER, INTENT(IN), OPTIONAL :: shape_function_type
|
||||
LOGICAL, INTENT(IN), OPTIONAL :: iterative
|
||||
INTEGER, INTENT(IN), OPTIONAL :: ref_charge
|
||||
TYPE(pw_p_type), OPTIONAL, POINTER :: fnorm
|
||||
INTEGER, INTENT(IN), OPTIONAL :: radius_type
|
||||
LOGICAL, INTENT(IN), OPTIONAL :: use_bohr
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'set_hirshfeld_info', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
|
@ -184,6 +205,12 @@ CONTAINS
|
|||
IF (PRESENT(iterative)) THEN
|
||||
hirshfeld_env%iterative = iterative
|
||||
END IF
|
||||
IF (PRESENT(use_bohr)) THEN
|
||||
hirshfeld_env%use_bohr = use_bohr
|
||||
END IF
|
||||
IF (PRESENT(radius_type)) THEN
|
||||
hirshfeld_env%radius_type = radius_type
|
||||
END IF
|
||||
IF (PRESENT(ref_charge)) THEN
|
||||
hirshfeld_env%ref_charge = ref_charge
|
||||
END IF
|
||||
|
|
|
|||
|
|
@ -583,6 +583,11 @@ MODULE input_constants
|
|||
shape_function_density = 2
|
||||
INTEGER, PARAMETER, PUBLIC :: ref_charge_atomic = 100, &
|
||||
ref_charge_mulliken = 200
|
||||
INTEGER, PARAMETER, PUBLIC :: radius_covalent = 10, &
|
||||
radius_user = 11, &
|
||||
radius_single = 12, &
|
||||
radius_vdw = 13, &
|
||||
radius_default = 14
|
||||
|
||||
! MAO
|
||||
INTEGER, PARAMETER, PUBLIC :: mao_basis_orb = 2000, &
|
||||
|
|
@ -632,18 +637,54 @@ MODULE input_constants
|
|||
outer_scf_s2_constraint = 124, &
|
||||
outer_scf_becke_constraint = 125, &
|
||||
outer_scf_none = 126, &
|
||||
outer_scf_basis_center_opt = 127
|
||||
outer_scf_basis_center_opt = 127, &
|
||||
outer_scf_cdft_constraint = 128, &
|
||||
outer_scf_hirshfeld_constraint = 129
|
||||
|
||||
! outer scf optimizers
|
||||
INTEGER, PARAMETER, PUBLIC :: outer_scf_optimizer_sd = 1001, &
|
||||
outer_scf_optimizer_diis = 1002, &
|
||||
outer_scf_optimizer_none = 1003, &
|
||||
outer_scf_optimizer_bisect = 1004
|
||||
outer_scf_optimizer_bisect = 1004, &
|
||||
outer_scf_optimizer_broyden = 1005, &
|
||||
outer_scf_optimizer_newton = 1006
|
||||
|
||||
! outer scf broyden optimizer types
|
||||
INTEGER, PARAMETER, PUBLIC :: broyden_type_1 = 1101, &
|
||||
broyden_type_2 = 1102, &
|
||||
broyden_type_3 = 1103, &
|
||||
broyden_type_4 = 1104
|
||||
|
||||
! finite difference types for calculation of inverse jacobian
|
||||
INTEGER, PARAMETER, PUBLIC :: jacobian_fd1 = 1, &
|
||||
jacobian_fd1_backward = 2, &
|
||||
jacobian_fd2 = 3, &
|
||||
jacobian_fd2_backward = 4, &
|
||||
jacobian_fd1_central = 5
|
||||
|
||||
! s2 restraint forms
|
||||
INTEGER, PARAMETER, PUBLIC :: do_s2_restraint = 872, &
|
||||
do_s2_constraint = 873
|
||||
|
||||
! Becke cutoff and confinement methods
|
||||
INTEGER, PARAMETER, PUBLIC :: becke_none_conf = 776, &
|
||||
becke_static_conf = 777, &
|
||||
becke_dynamic_conf = 778, &
|
||||
becke_cavity_conf = 779, &
|
||||
becke_mixed_conf = 780, &
|
||||
becke_cutoff_global = 790, &
|
||||
becke_cutoff_element = 791
|
||||
|
||||
! CDFT constraint and control types
|
||||
INTEGER, PARAMETER, PUBLIC :: cdft_density_constraint = 1, &
|
||||
cdft_magnetization_constraint = 2, &
|
||||
cdft_combined_constraint = 3, &
|
||||
cdft_combined_all = 10, &
|
||||
cdft_combined_donor = 11, &
|
||||
cdft_combined_acceptor = 12, &
|
||||
ot2cdft = 101, &
|
||||
cdft2ot = 102
|
||||
|
||||
! ROKS schemes
|
||||
INTEGER, PARAMETER, PUBLIC :: general_roks = 1, &
|
||||
high_spin_roks = 2
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@
|
|||
! **************************************************************************************************
|
||||
MODULE input_cp2k_dft
|
||||
USE bibliography, ONLY: &
|
||||
Andermatt2016, Andreussi2012, Avezac2005, BaniHashemian2016, Bengtsson1999, Blochl1995, &
|
||||
Brelaz1979, Dewar1977, Dewar1985, Dudarev1997, Dudarev1998, Ehrhardt1985, Elstner1998, &
|
||||
Fattebert2002, Guidon2010, Heinzmann1976, Hu2007, Hunt2003, Iannuzzi2005, Iannuzzi2006, &
|
||||
Iannuzzi2007, Kolafa2004, Krack2000, Krack2002, Kunert2003, Lippert1997, Lippert1999, &
|
||||
Lu2004, Perdew1981, Porezag1995, Repasky2002, Rocha2006, Schenter2008, Schiffmann2015, &
|
||||
Seifert1996, Souza2002, Stengel2009, Stewart1982, Stewart1989, Stewart2007, Thiel1992, &
|
||||
Tozer1996, Umari2002, VandeVondele2003, VandeVondele2005a, VandeVondele2005b, &
|
||||
VandeVondele2006, Weber2008, Zhao1994, Zhechkov2005
|
||||
Andermatt2016, Andreussi2012, Avezac2005, BaniHashemian2016, Becke1988b, Bengtsson1999, &
|
||||
Blochl1995, Brelaz1979, Dewar1977, Dewar1985, Dudarev1997, Dudarev1998, Ehrhardt1985, &
|
||||
Elstner1998, Fattebert2002, Guidon2010, Heinzmann1976, Holmberg2017, Hu2007, Hunt2003, &
|
||||
Iannuzzi2005, Iannuzzi2006, Iannuzzi2007, Kolafa2004, Krack2000, Krack2002, Kunert2003, &
|
||||
Lippert1997, Lippert1999, Lu2004, Perdew1981, Porezag1995, Repasky2002, Rocha2006, &
|
||||
Schenter2008, Schiffmann2015, Seifert1996, Souza2002, Stengel2009, Stewart1982, &
|
||||
Stewart1989, Stewart2007, Thiel1992, Tozer1996, Umari2002, VandeVondele2003, &
|
||||
VandeVondele2005a, VandeVondele2005b, VandeVondele2006, Weber2008, Zhao1994, Zhechkov2005
|
||||
USE cp_output_handling, ONLY: add_last_numeric,&
|
||||
cp_print_key_section_create,&
|
||||
debug_print_level,&
|
||||
|
|
@ -26,10 +26,14 @@ MODULE input_cp2k_dft
|
|||
low_print_level,&
|
||||
medium_print_level,&
|
||||
silent_print_level
|
||||
USE cp_units, ONLY: cp_unit_to_cp2k
|
||||
USE cp_units, ONLY: cp_unit_from_cp2k,&
|
||||
cp_unit_to_cp2k
|
||||
USE input_constants, ONLY: &
|
||||
atomic_guess, casci_canonical, cholesky_dbcsr, cholesky_inverse, cholesky_off, &
|
||||
cholesky_reduce, cholesky_restore, constant_env, core_guess, custom_env, &
|
||||
atomic_guess, becke_cavity_conf, becke_cutoff_element, becke_cutoff_global, &
|
||||
becke_dynamic_conf, becke_mixed_conf, becke_none_conf, becke_static_conf, casci_canonical, &
|
||||
cdft_combined_acceptor, cdft_combined_all, cdft_combined_constraint, cdft_combined_donor, &
|
||||
cdft_density_constraint, cdft_magnetization_constraint, cholesky_dbcsr, cholesky_inverse, &
|
||||
cholesky_off, cholesky_reduce, cholesky_restore, constant_env, core_guess, custom_env, &
|
||||
diag_block_davidson, diag_block_krylov, diag_filter_matrix, diag_ot, diag_standard, &
|
||||
dispersion_d3, dispersion_uff, dmft_model, do_admm_aux_exch_func_bee, &
|
||||
do_admm_aux_exch_func_default, do_admm_aux_exch_func_none, do_admm_aux_exch_func_opt, &
|
||||
|
|
@ -51,37 +55,40 @@ MODULE input_cp2k_dft
|
|||
do_se_lr_ewald, do_se_lr_ewald_gks, do_se_lr_ewald_r3, do_se_lr_none, do_spin_density, &
|
||||
do_taylor, ehrenfest, eri_method_full_gpw, eri_method_gpw_ht, eri_operator_coulomb, &
|
||||
eri_operator_erf, eri_operator_erfc, eri_operator_gaussian, eri_operator_yukawa, gaussian, &
|
||||
gaussian_env, general_roks, hf_model, high_spin_roks, history_guess, kg_cholesky, &
|
||||
kg_color_dsatur, kg_color_greedy, kg_ec_diagonalization, kg_ec_functional_harris, &
|
||||
kg_tnadd_atomic, kg_tnadd_embed, ls_2pnt, ls_3pnt, ls_gold, ls_none, mao_basis_ext, &
|
||||
mao_basis_orb, mao_basis_prim, mao_projection, mopac_guess, no_excitations, no_guess, &
|
||||
numerical, oe_gllb, oe_lb, oe_none, oe_saop, oe_sic, op_loc_berry, op_loc_boys, &
|
||||
op_loc_pipek, orb_dx2, orb_dxy, orb_dy2, orb_dyz, orb_dz2, orb_dzx, orb_px, orb_py, &
|
||||
orb_pz, orb_s, ot_algo_irac, ot_algo_taylor_or_diag, ot_chol_irac, ot_lwdn_irac, &
|
||||
ot_mini_broyden, ot_mini_cg, ot_mini_diis, ot_mini_sd, ot_poly_irac, ot_precond_full_all, &
|
||||
ot_precond_full_kinetic, ot_precond_full_single, ot_precond_full_single_inverse, &
|
||||
ot_precond_none, ot_precond_s_inverse, ot_precond_solver_default, &
|
||||
ot_precond_solver_direct, ot_precond_solver_inv_chol, ot_precond_solver_update, &
|
||||
outer_scf_basis_center_opt, outer_scf_becke_constraint, outer_scf_ddapc_constraint, &
|
||||
outer_scf_none, outer_scf_optimizer_bisect, outer_scf_optimizer_diis, &
|
||||
outer_scf_optimizer_none, outer_scf_optimizer_sd, outer_scf_s2_constraint, plus_u_lowdin, &
|
||||
plus_u_mulliken, plus_u_mulliken_charges, pw_interp, ramp_env, random_guess, &
|
||||
real_time_propagation, ref_charge_atomic, ref_charge_mulliken, rel_dkh, rel_none, &
|
||||
rel_pot_erfc, rel_pot_full, rel_sczora_mp, rel_trans_atom, rel_trans_full, &
|
||||
rel_trans_molecule, rel_zora, rel_zora_full, rel_zora_mp, restart_guess, rsdft_model, &
|
||||
sccs_andreussi, sccs_derivative_cd3, sccs_derivative_cd5, sccs_derivative_cd7, &
|
||||
sccs_derivative_fft, sccs_fattebert_gygi, shape_function_density, shape_function_gaussian, &
|
||||
sic_ad, sic_eo, sic_list_all, sic_list_unpaired, sic_mauri_spz, sic_mauri_us, sic_none, &
|
||||
slater, smear_energy_window, smear_fermi_dirac, smear_list, sparse_guess, &
|
||||
spline3_nopbc_interp, spline3_pbc_interp, tddfpt_davidson, tddfpt_excitations, &
|
||||
tddfpt_lanczos, tddfpt_singlet, tddfpt_triplet, use_coulomb, use_diff, use_no, &
|
||||
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_dip_len, &
|
||||
xas_dip_vel, xas_dscf, xas_none, xas_tp_fh, xas_tp_flex, xas_tp_hh, xas_tp_xfh, &
|
||||
xas_tp_xhh, xes_tp_val
|
||||
gaussian_env, general_roks, hf_model, high_spin_roks, history_guess, jacobian_fd1, &
|
||||
jacobian_fd1_backward, jacobian_fd1_central, jacobian_fd2, jacobian_fd2_backward, &
|
||||
kg_cholesky, kg_color_dsatur, kg_color_greedy, kg_ec_diagonalization, &
|
||||
kg_ec_functional_harris, kg_tnadd_atomic, kg_tnadd_embed, ls_2pnt, ls_3pnt, ls_gold, &
|
||||
ls_none, mao_basis_ext, mao_basis_orb, mao_basis_prim, mao_projection, mopac_guess, &
|
||||
no_excitations, no_guess, numerical, oe_gllb, oe_lb, oe_none, oe_saop, oe_sic, &
|
||||
op_loc_berry, op_loc_boys, op_loc_pipek, orb_dx2, orb_dxy, orb_dy2, orb_dyz, orb_dz2, &
|
||||
orb_dzx, orb_px, orb_py, orb_pz, orb_s, ot_algo_irac, ot_algo_taylor_or_diag, &
|
||||
ot_chol_irac, ot_lwdn_irac, ot_mini_broyden, ot_mini_cg, ot_mini_diis, ot_mini_sd, &
|
||||
ot_poly_irac, ot_precond_full_all, ot_precond_full_kinetic, ot_precond_full_single, &
|
||||
ot_precond_full_single_inverse, ot_precond_none, ot_precond_s_inverse, &
|
||||
ot_precond_solver_default, ot_precond_solver_direct, ot_precond_solver_inv_chol, &
|
||||
ot_precond_solver_update, outer_scf_basis_center_opt, outer_scf_becke_constraint, &
|
||||
outer_scf_cdft_constraint, outer_scf_ddapc_constraint, outer_scf_hirshfeld_constraint, &
|
||||
outer_scf_none, outer_scf_optimizer_bisect, outer_scf_optimizer_broyden, &
|
||||
outer_scf_optimizer_diis, outer_scf_optimizer_newton, outer_scf_optimizer_none, &
|
||||
outer_scf_optimizer_sd, outer_scf_s2_constraint, plus_u_lowdin, plus_u_mulliken, &
|
||||
plus_u_mulliken_charges, pw_interp, radius_covalent, radius_default, radius_single, &
|
||||
radius_user, radius_vdw, ramp_env, random_guess, real_time_propagation, ref_charge_atomic, &
|
||||
ref_charge_mulliken, rel_dkh, rel_none, rel_pot_erfc, rel_pot_full, rel_sczora_mp, &
|
||||
rel_trans_atom, rel_trans_full, rel_trans_molecule, rel_zora, rel_zora_full, rel_zora_mp, &
|
||||
restart_guess, rsdft_model, sccs_andreussi, sccs_derivative_cd3, sccs_derivative_cd5, &
|
||||
sccs_derivative_cd7, sccs_derivative_fft, sccs_fattebert_gygi, shape_function_density, &
|
||||
shape_function_gaussian, sic_ad, sic_eo, sic_list_all, sic_list_unpaired, sic_mauri_spz, &
|
||||
sic_mauri_us, sic_none, slater, smear_energy_window, smear_fermi_dirac, smear_list, &
|
||||
sparse_guess, spline3_nopbc_interp, spline3_pbc_interp, tddfpt_davidson, &
|
||||
tddfpt_excitations, tddfpt_lanczos, tddfpt_singlet, tddfpt_triplet, use_coulomb, use_diff, &
|
||||
use_no, 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_dip_len, xas_dip_vel, xas_dscf, xas_none, 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_kpoints, ONLY: create_kpoints_section
|
||||
|
|
@ -132,6 +139,7 @@ MODULE input_cp2k_dft
|
|||
PUBLIC :: create_bsse_section, create_qs_section
|
||||
PUBLIC :: create_scf_section
|
||||
PUBLIC :: create_interp_section, create_localize_section
|
||||
PUBLIC :: create_becke_restraint_section, create_ddapc_restraint_section
|
||||
PUBLIC :: create_mgrid_section
|
||||
|
||||
CONTAINS
|
||||
|
|
@ -1616,6 +1624,20 @@ CONTAINS
|
|||
enum_i_vals=(/ref_charge_atomic, ref_charge_mulliken/))
|
||||
CALL section_add_keyword(print_key, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
CALL keyword_create(keyword, name="USER_RADIUS", &
|
||||
description="Use user defined radii to generate Gaussians."// &
|
||||
" These radii are defined by the keyword ATOMIC_RADII", &
|
||||
usage="USER_RADIUS yes", repeats=.FALSE., n_var=1, &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(print_key, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
CALL keyword_create(keyword, name="ATOMIC_RADII", &
|
||||
description="Defines custom radii to setup the spherical Gaussians.", &
|
||||
usage="ATOMIC_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 section_add_subsection(section, print_key)
|
||||
CALL section_release(print_key)
|
||||
|
||||
|
|
@ -2969,11 +2991,15 @@ CONTAINS
|
|||
CALL section_add_subsection(section, subsection)
|
||||
CALL section_release(subsection)
|
||||
|
||||
CALL create_ddapc_restraint_section(subsection)
|
||||
CALL create_ddapc_restraint_section(subsection, "DDAPC_RESTRAINT")
|
||||
CALL section_add_subsection(section, subsection)
|
||||
CALL section_release(subsection)
|
||||
|
||||
CALL create_becke_restraint_section(subsection)
|
||||
CALL create_becke_restraint_section(subsection, "BECKE_RESTRAINT")
|
||||
CALL section_add_subsection(section, subsection)
|
||||
CALL section_release(subsection)
|
||||
|
||||
CALL create_cdft_control_section(subsection)
|
||||
CALL section_add_subsection(section, subsection)
|
||||
CALL section_release(subsection)
|
||||
|
||||
|
|
@ -3926,9 +3952,11 @@ CONTAINS
|
|||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param section ...
|
||||
!> \param section_name ...
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE create_ddapc_restraint_section(section)
|
||||
SUBROUTINE create_ddapc_restraint_section(section, section_name)
|
||||
TYPE(section_type), POINTER :: section
|
||||
CHARACTER(len=*), INTENT(in) :: section_name
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'create_ddapc_restraint_section', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
|
@ -3938,7 +3966,7 @@ CONTAINS
|
|||
|
||||
NULLIFY (keyword, print_key)
|
||||
CPASSERT(.NOT. ASSOCIATED(section))
|
||||
CALL section_create(section, "DDAPC_RESTRAINT", &
|
||||
CALL section_create(section, TRIM(ADJUSTL(section_name)), &
|
||||
description="Use DDAPC charges in a restraint (check code for details)", &
|
||||
n_keywords=7, n_subsections=0, repeats=.TRUE.)
|
||||
|
||||
|
|
@ -3999,9 +4027,11 @@ CONTAINS
|
|||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param section ...
|
||||
!> \param section_name ...
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE create_becke_restraint_section(section)
|
||||
SUBROUTINE create_becke_restraint_section(section, section_name)
|
||||
TYPE(section_type), POINTER :: section
|
||||
CHARACTER(len=*), INTENT(in) :: section_name
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'create_becke_restraint_section', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
|
@ -4011,64 +4041,507 @@ CONTAINS
|
|||
|
||||
NULLIFY (keyword, print_key)
|
||||
CPASSERT(.NOT. ASSOCIATED(section))
|
||||
CALL section_create(section, "BECKE_RESTRAINT", &
|
||||
description="Use Becke weight population in a restraint/constraint ", &
|
||||
n_keywords=7, n_subsections=0, repeats=.FALSE.)
|
||||
CALL section_create(section, TRIM(ADJUSTL(section_name)), &
|
||||
description="Use Becke weight population in a constraint ", &
|
||||
n_keywords=26, n_subsections=0, repeats=.FALSE., &
|
||||
citations=(/Becke1988b/))
|
||||
|
||||
CALL keyword_create(keyword, name="STRENGTH", &
|
||||
description="force constant of the restraint", &
|
||||
usage="STRENGTH {real} ", default_r_val=0.1_dp)
|
||||
description="Force constants of the constraints. "// &
|
||||
"Second value is for combined constraint and is optional.", &
|
||||
usage="STRENGTH {real} {real}", repeats=.FALSE., &
|
||||
type_of_var=real_t, n_var=-1, &
|
||||
default_r_val=0.0_dp)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="TARGET", &
|
||||
description="target value of the restraint", &
|
||||
usage="TARGET {real} ", default_r_val=1._dp)
|
||||
description="Target values of the constraints. "// &
|
||||
"Second value is for combined constraint and is optional.", &
|
||||
usage="TARGET {real}", repeats=.FALSE., &
|
||||
type_of_var=real_t, n_var=-1, &
|
||||
default_r_val=0.0_dp)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="ATOMS", &
|
||||
description="Specifies the list of atoms that is summed in the restraint", &
|
||||
description="Specifies the list of atoms that are included in the constraint", &
|
||||
usage="ATOMS {integer} {integer} .. {integer}", &
|
||||
n_var=-1, type_of_var=integer_t)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="COEFF", &
|
||||
description="Defines the the coefficient of the atom in the atom list (default is one)", &
|
||||
usage="COEFF 1.0 -1.0", &
|
||||
description="Defines coefficients for atoms in the atom list (default is one).", &
|
||||
usage="COEFF 1.0 -1.0", repeats=.TRUE., &
|
||||
type_of_var=real_t, n_var=-1)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="FUNCTIONAL_FORM", &
|
||||
description="Specifies the functional form of the term added", &
|
||||
usage="FUNCTIONAL_FORM RESTRAINT", &
|
||||
enum_c_vals=s2a("RESTRAINT", "CONSTRAINT"), &
|
||||
enum_i_vals=(/do_ddapc_restraint, do_ddapc_constraint/), &
|
||||
enum_desc=s2a("Harmonic potential: s*(q-t)**2", "Constraint form: s*(q-t)"), &
|
||||
default_i_val=do_ddapc_restraint)
|
||||
CALL keyword_create(keyword, name="CONSTRAINT_TYPE", &
|
||||
description="Specifies the type of constraint used.", &
|
||||
usage="CONSTRAINT_TYPE (TOTAL|MAGNETIZATION|COMBINED)", &
|
||||
enum_c_vals=s2a("TOTAL", "MAGNETIZATION", "COMBINED"), &
|
||||
enum_i_vals=(/cdft_density_constraint, cdft_magnetization_constraint, &
|
||||
cdft_combined_constraint/), &
|
||||
enum_desc=s2a("Constrain the total density (rho_alpha + rho_beta).", &
|
||||
"Constrain the magnetization density (rho_alpha - rho_beta).", &
|
||||
"Constrain both densities. The magnetization density constraint "// &
|
||||
" is applied to atoms defined in COMBINED_TYPE."), &
|
||||
default_i_val=cdft_density_constraint)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="TYPE_OF_DENSITY", &
|
||||
description="Specifies the type of density used for the fitting", &
|
||||
usage="TYPE_OF_DENSITY (FULL|SPIN)", &
|
||||
enum_c_vals=s2a("FULL", "SPIN"), &
|
||||
enum_i_vals=(/do_full_density, do_spin_density/), &
|
||||
enum_desc=s2a("Full density", "Spin density"), &
|
||||
default_i_val=do_full_density)
|
||||
CALL keyword_create(keyword, name="COMBINED_TYPE", &
|
||||
description="Specifies which atoms to apply the magnetization density constraint"// &
|
||||
"when using CONSTRAINT_TYPE COMBINED.", &
|
||||
usage="COMBINED_TYPE (ALL|ACCEPTOR|DONOR)", &
|
||||
enum_c_vals=s2a("TOTAL", "ACCEPTOR", "DONOR"), &
|
||||
enum_i_vals=(/cdft_combined_all, cdft_combined_acceptor, cdft_combined_donor/), &
|
||||
enum_desc=s2a("Use all atoms defined with keywords ATOMS and COEFF.", &
|
||||
"Use all acceptor atoms i.e. atoms with a COEFF of -1.0.", &
|
||||
"Use all donor atoms i.e. atoms with a COEFF of +1.0."), &
|
||||
default_i_val=cdft_combined_all)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL cp_print_key_section_create(print_key, "program_run_info", &
|
||||
description="Controls the printing basic info about the method", &
|
||||
CALL keyword_create(keyword, name="ADJUST_SIZE", &
|
||||
description="Adjust cell boundaries with covalent atomic"// &
|
||||
" radii to generate a heteronuclear cutoff profile. These"// &
|
||||
" radii are defined in the keyword ATOMIC_RADII.", &
|
||||
usage="ADJUST_SIZE", &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="ATOMIC_RADII", &
|
||||
description="Defines atomic radii to generate a heteronuclear cutoff profile."// &
|
||||
" Give one value per element in the same order as they"// &
|
||||
" appear in the input coordinates.", &
|
||||
usage="ATOMIC_RADII {real} {real} {real}", repeats=.FALSE., &
|
||||
unit_str="angstrom", &
|
||||
type_of_var=real_t, n_var=-1)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="SHOULD_SKIP", &
|
||||
description="If grid point is farther than GLOBAL_CUTOFF from all constraint atoms, "// &
|
||||
" move directly to next grid point, thus saving computational resources.", &
|
||||
usage="SHOULD_SKIP", &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="ATOMIC_CHARGES", &
|
||||
description="Calculate atomic Becke charges. Note:"// &
|
||||
" If the number of atoms is greater than the default"// &
|
||||
" pw_pool max cache, calculation of atomic charges"// &
|
||||
" will prompt a warning during deallocation of atomic grids.", &
|
||||
usage="ATOMIC_CHARGES", &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="CONFINE", &
|
||||
description="Specifies the type of confinement used", &
|
||||
usage="CONFINE (NONE|STATIC|DYNAMIC|CAVITY|MIXED)", &
|
||||
enum_c_vals=s2a("NONE", "STATIC", "DYNAMIC", "CAVITY", "MIXED"), &
|
||||
enum_i_vals=(/becke_none_conf, becke_static_conf, becke_dynamic_conf, &
|
||||
becke_cavity_conf, becke_mixed_conf/), &
|
||||
enum_desc=s2a("No confinement", &
|
||||
"Confine Becke partitioning to a region of space"// &
|
||||
" along CONFINE_DIR axis. Does not honor PBC: ATOMS must be far"// &
|
||||
" away from cell boundary along CONFINE_DIR for meaningful results.", &
|
||||
"Dynamically confine Becke partitioning to a region of space"// &
|
||||
" along CONFINE_DIR axis. Confinement bounds are (re)generated "// &
|
||||
" each step so that only points within DYNAMIC_RADIUS are included in"// &
|
||||
" the partitioning. Does not honor PBC: ATOMS must be far"// &
|
||||
" away from cell boundary along CONFINE_DIR for meaningful results.", &
|
||||
"Form a cavity using constraint atom centered spherical Gaussians", &
|
||||
"Mixed dynamic and cavity confinement"), &
|
||||
default_i_val=becke_none_conf)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="CAVITY_SHAPE", &
|
||||
description="Specifies the type of Gaussian cavity used", &
|
||||
usage="CAVITY_SHAPE (SINGLE|VDW|COVALENT|USER)", &
|
||||
enum_c_vals=s2a("DEFAULT", "SINGLE", "VDW", "COVALENT", "USER"), &
|
||||
enum_i_vals=(/radius_default, radius_single, radius_vdw, radius_covalent, radius_user/), &
|
||||
enum_desc=s2a("Use covalent radii (in angstrom) to construct Gaussians, but fixed"// &
|
||||
" 1.0_dp radius for elements with a radius smaller than this value.", &
|
||||
"Single Gaussian for all atom types with radius given by CAVITY_RADIUS", &
|
||||
"Use van der Waals radii to construct Gaussians", &
|
||||
"Use covalent radii to construct Gaussians", &
|
||||
"Use user defined radii (keyword ATOMIC_RADII) to construct Gaussians"), &
|
||||
default_i_val=radius_default)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="CAVITY_USE_BOHR", &
|
||||
description="Convert the cavity radius from angstrom to bohr. This results in a larger"// &
|
||||
"confinement cavity than without unit conversion.", &
|
||||
usage="CAVITY_USE_BOHR (SINGLE|VDW|COVALENT|USER)", &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="CAVITY_PRINT", &
|
||||
description="Print cavity in Gaussian cube file format. Currently, printing options"// &
|
||||
" are hardcoded.", &
|
||||
usage="CAVITY_PRINT", &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="CONFINE_DIR", &
|
||||
description="Confinement direction.", &
|
||||
usage="CONFINE_DIR (X|Y|Z)", &
|
||||
enum_c_vals=s2a("X", "Y", "Z"), &
|
||||
enum_i_vals=(/1, 2, 3/), &
|
||||
enum_desc=s2a("Along x", "Along y", "Along z"), &
|
||||
n_var=1, default_i_val=3)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="CONFINE_BOUNDS", &
|
||||
description="Confinement bounds.", &
|
||||
usage="CONFINE_BOUNDS <REAL> <REAL>", &
|
||||
unit_str="angstrom", &
|
||||
default_r_vals=(/cp_unit_to_cp2k(0.0_dp, "angstrom"), &
|
||||
cp_unit_to_cp2k(0.0_dp, "angstrom")/), &
|
||||
type_of_var=real_t, n_var=2)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="DYNAMIC_RADIUS", &
|
||||
description="Parameter controlling the creation of dynamic confinement"// &
|
||||
" bounds.", &
|
||||
usage="DYNAMIC_RADIUS <REAL>", &
|
||||
unit_str="angstrom", &
|
||||
default_r_val=cp_unit_to_cp2k(6.0_dp, "angstrom"), &
|
||||
type_of_var=real_t, n_var=1)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="CAVITY_RADIUS", &
|
||||
description="Parameter controlling the creation of Gaussian cavity confinement", &
|
||||
usage="CAVITY_RADIUS <REAL>", &
|
||||
unit_str="angstrom", &
|
||||
default_r_val=cp_unit_to_cp2k(3.0_dp, "angstrom"), &
|
||||
type_of_var=real_t, n_var=1)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="EPS_CAVITY", &
|
||||
description="Density threshold for cavity creation. Grid points where the Gaussian"// &
|
||||
" density falls below the threshold are ignored.", &
|
||||
usage="EPS_CAVITY {real} ", default_r_val=1.0e-6_dp)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="CUTOFF_TYPE", &
|
||||
description="Specifies the type of cutoff used", &
|
||||
usage="CUTOFF_TYPE (GLOBAL|ELEMENT)", &
|
||||
enum_c_vals=s2a("GLOBAL", "ELEMENT"), &
|
||||
enum_i_vals=(/becke_cutoff_global, becke_cutoff_element/), &
|
||||
enum_desc=s2a("Use a single value for all elements. Read from GLOBAL_CUTOFF.", &
|
||||
"Use a different value for all elements. Values read from ELEMENT_CUTOFF"), &
|
||||
default_i_val=becke_cutoff_global)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="GLOBAL_CUTOFF", &
|
||||
description="Parameter used to select which atoms contribute to the"// &
|
||||
" weight function at each real space grid point.", &
|
||||
usage="GLOBAL_CUTOFF <REAL>", &
|
||||
unit_str="angstrom", &
|
||||
default_r_val=cp_unit_from_cp2k(6.0_dp, "angstrom"), &
|
||||
type_of_var=real_t, n_var=1)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="ELEMENT_CUTOFF", &
|
||||
description="Defines element specific cutoffs to elect which atoms contribute to the"// &
|
||||
" weight function at each real space grid point. Give one value per element in the same "// &
|
||||
" order as they appear in the coordinates.", &
|
||||
usage="ELEMENT_CUTOFF {real} {real} {real}", repeats=.FALSE., &
|
||||
unit_str="angstrom", &
|
||||
type_of_var=real_t, n_var=-1)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="IN_MEMORY", &
|
||||
description="Precompute gradients due to Becke constraint during"// &
|
||||
" initial formation of constraint and store them in memory. Useful"// &
|
||||
" in combination with confinement, memory intensive otherwise. Does"// &
|
||||
" nothing if forces are not calculated.", &
|
||||
usage="IN_MEMORY", &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="FRAGMENT_DENSITIES", &
|
||||
description="Use fragment densities as the target value of the constraint."// &
|
||||
" Takes as input the electron densities of two isolated fragments in the "// &
|
||||
" same geometry that they have in the full system."// &
|
||||
" The isolated fragment densities are read from cube files defined in FRAGMENT_{A,B}_FILE."// &
|
||||
" With this keyword active, the constraint enforces that the number of electrons for both"// &
|
||||
" fragments is the same as they would have in the superposition of the isolated fragments."// &
|
||||
" Supports only static calculations. Weight must be defined for one fragment only!", &
|
||||
usage="IN_MEMORY", &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="FRAGMENT_A_FILE_NAME", &
|
||||
description="Name of the reference electron density cube file for fragment A."// &
|
||||
" May include a path. The reference electron density needs to be outputted"// &
|
||||
" on the same grid as the full system (same cutoff and cell, output stride 1).", &
|
||||
usage="FRAGMENT_A_FILE_NAME <FILENAME>", &
|
||||
default_lc_val="fragment_a.cube")
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="FRAGMENT_B_FILE_NAME", &
|
||||
description="Name of the reference electron density cube file for fragment A."// &
|
||||
" May include a path. The reference electron density needs to be outputted"// &
|
||||
" on the same grid as the full system (same cutoff and cell, output stride 1).", &
|
||||
default_lc_val="fragment_b.cube")
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL cp_print_key_section_create(print_key, "PROGRAM_RUN_INFO", &
|
||||
description="Controls the printing of basic info about the method", &
|
||||
print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
|
||||
CALL section_add_subsection(section, print_key)
|
||||
CALL section_release(print_key)
|
||||
|
||||
END SUBROUTINE create_becke_restraint_section
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief ...
|
||||
!> \param section ...
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE create_cdft_control_section(section)
|
||||
TYPE(section_type), POINTER :: section
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'create_cdft_control_section', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
TYPE(keyword_type), POINTER :: keyword
|
||||
TYPE(section_type), POINTER :: subsection
|
||||
|
||||
NULLIFY (keyword, subsection)
|
||||
|
||||
CPASSERT(.NOT. ASSOCIATED(section))
|
||||
CALL section_create(section, "CDFT", &
|
||||
description="Parameters needed to set up a CDFT calculation with OT."// &
|
||||
" Constraint is converged in a separate external SCF loop with settings"// &
|
||||
" read from the OUTER_SCF section. Supported constraints: Gaussian Hirshfeld (partial)"// &
|
||||
" Becke.", n_keywords=7, n_subsections=2, &
|
||||
repeats=.FALSE., citations=(/Holmberg2017/))
|
||||
|
||||
NULLIFY (subsection, keyword)
|
||||
CALL create_outer_scf_section(subsection)
|
||||
CALL section_add_subsection(section, subsection)
|
||||
CALL section_release(subsection)
|
||||
|
||||
CALL create_hirshfeld_constraint_section(subsection)
|
||||
CALL section_add_subsection(section, subsection)
|
||||
CALL section_release(subsection)
|
||||
|
||||
CALL keyword_create(keyword, name="TYPE_OF_CONSTRAINT", &
|
||||
description="Specifies the type of constraint used", &
|
||||
usage="TYPE_OF_CONSTRAINT (NONE|HIRSHFELD|BECKE)", &
|
||||
enum_c_vals=s2a("NONE", "HIRSHFELD", "BECKE"), &
|
||||
enum_i_vals=(/outer_scf_none, outer_scf_hirshfeld_constraint, &
|
||||
outer_scf_becke_constraint/), &
|
||||
enum_desc=s2a("No constraint (disables section)", &
|
||||
"Hirshfeld-type constraint defined by constraint atom centered spherical Gaussians"// &
|
||||
" Partial implementation: no forces or coupling. Requires corresponding section.", &
|
||||
"Becke constraint. Requires corresponding section in &QS)"), &
|
||||
default_i_val=outer_scf_none)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="REUSE_PRECOND", &
|
||||
description="Reuse previously built OT preconditioner if SCF converged in PRECOND_FREQ steps or less.", &
|
||||
usage="REUSE_PRECOND yes", repeats=.FALSE., n_var=1, &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="PRECOND_FREQ", &
|
||||
description="See REUSE_PRECOND.", &
|
||||
usage="PRECOND_FREQ {int} ", default_i_val=0)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="MAX_REUSE", &
|
||||
description="Determines how many times a previously built preconditioner can be reused.", &
|
||||
usage="MAX_REUSE {int} ", default_i_val=0)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="PURGE_HISTORY", &
|
||||
description="Purge wavefunction and constraint history to improve SCF convergence during MD."// &
|
||||
"Counts how often the convergence of the first CDFT SCF iteration takes 2 or more outer SCF"// &
|
||||
" iterations and purges the history if the counter exceeds PURGE_FREQ and PURGE_OFFSET "// &
|
||||
" MD steps have passed since the last purge."// &
|
||||
" The counter is zeroed after each purge.", &
|
||||
usage="PURGE_HISTORY yes", repeats=.FALSE., n_var=1, &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="PURGE_FREQ", &
|
||||
description="See PURGE_HISTORY.", &
|
||||
usage="PURGE_FREQ {int} ", default_i_val=1)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="PURGE_OFFSET", &
|
||||
description="See PURGE_HISTORY.", &
|
||||
usage="PURGE_OFFSET {int} ", default_i_val=1)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
END SUBROUTINE create_cdft_control_section
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief ...
|
||||
!> \param section ...
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE create_hirshfeld_constraint_section(section)
|
||||
TYPE(section_type), POINTER :: section
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'create_hirshfeld_constraint_section', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
TYPE(keyword_type), POINTER :: keyword
|
||||
TYPE(section_type), POINTER :: print_key
|
||||
|
||||
NULLIFY (keyword, print_key)
|
||||
|
||||
CPASSERT(.NOT. ASSOCIATED(section))
|
||||
CALL section_create(section, "HIRSHFELD_CONSTRAINT", &
|
||||
description="Parameters for CDFT with Hirshfeld constraint", &
|
||||
n_keywords=11, n_subsections=0, repeats=.FALSE.)
|
||||
|
||||
CALL keyword_create(keyword, name="STRENGTH", &
|
||||
description="Force constants of the constraints. "// &
|
||||
"Second value is for combined constraint and is optional.", &
|
||||
usage="STRENGTH {real} {real}", repeats=.FALSE., &
|
||||
type_of_var=real_t, n_var=-1, &
|
||||
default_r_val=0.0_dp)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="TARGET", &
|
||||
description="Target values of the constraints. "// &
|
||||
"Second value is for combined constraint and is optional.", &
|
||||
usage="TARGET {real}", repeats=.FALSE., &
|
||||
type_of_var=real_t, n_var=-1, &
|
||||
default_r_val=0.0_dp)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="ATOMS", &
|
||||
description="Specifies the list of atoms that are included in the constraint", &
|
||||
usage="ATOMS {integer} {integer} .. {integer}", &
|
||||
n_var=-1, type_of_var=integer_t)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="COEFF", &
|
||||
description="Defines coefficients for atoms included in the constraint (default is one)"// &
|
||||
" Use +1.0 for donor atoms and -1.0 for acceptor atoms.", &
|
||||
usage="COEFF 1.0 -1.0", repeats=.TRUE., &
|
||||
type_of_var=real_t, n_var=-1)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="CONSTRAINT_TYPE", &
|
||||
description="Specifies the type of constraint used.", &
|
||||
usage="CONSTRAINT_TYPE (TOTAL|MAGNETIZATION|COMBINED)", &
|
||||
enum_c_vals=s2a("TOTAL", "MAGNETIZATION", "COMBINED"), &
|
||||
enum_i_vals=(/cdft_density_constraint, cdft_magnetization_constraint, &
|
||||
cdft_combined_constraint/), &
|
||||
enum_desc=s2a("Constrain the total density (rho_alpha + rho_beta).", &
|
||||
"Constrain the magnetization density (rho_alpha - rho_beta). NYI", &
|
||||
"Constrain both densities. The magnetization density constraint is applied "// &
|
||||
" to atoms defined in COMBINED_TYPE. NYI"), &
|
||||
default_i_val=cdft_density_constraint)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="COMBINED_TYPE", &
|
||||
description="Specifies which atoms to apply the magnetization density constraint "// &
|
||||
"when using CONSTRAINT_TYPE COMBINED.", &
|
||||
usage="COMBINED_TYPE (ALL|ACCEPTOR|DONOR)", &
|
||||
enum_c_vals=s2a("TOTAL", "ACCEPTOR", "DONOR"), &
|
||||
enum_i_vals=(/cdft_combined_all, cdft_combined_acceptor, cdft_combined_donor/), &
|
||||
enum_desc=s2a("Use all atoms defined with keywords ATOMS and COEFF.", &
|
||||
"Use all acceptor atoms i.e. atoms with a COEFF of -1.0.", &
|
||||
"Use all donor atoms i.e. atoms with a COEFF of +1.0."), &
|
||||
default_i_val=cdft_combined_all)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="SELF_CONSISTENT", &
|
||||
description="Calculate charges from the Hirsheld-I (self_consistent) method."// &
|
||||
" This scales only the full shape function, not the added charge as in the original scheme. NYI.", &
|
||||
usage="SELF_CONSISTENT yes", repeats=.FALSE., n_var=1, &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="SHAPE_FUNCTION", &
|
||||
description="Type of shape function used for Hirshfeld partitioning.", &
|
||||
usage="SHAPE_FUNCTION {Gaussian,Density}", repeats=.FALSE., n_var=1, &
|
||||
default_i_val=shape_function_gaussian, &
|
||||
enum_c_vals=s2a("GAUSSIAN", "DENSITY"), &
|
||||
enum_desc=s2a("Single Gaussian with Colvalent radius", &
|
||||
"Atomic density expanded in multiple Gaussians (NYI)"), &
|
||||
enum_i_vals=(/shape_function_gaussian, shape_function_density/))
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="REFERENCE_CHARGE", &
|
||||
description="Charge of atomic partitioning function for Hirshfeld method.", &
|
||||
usage="REFERENCE_CHARGE {Atomic,Mulliken}", repeats=.FALSE., n_var=1, &
|
||||
default_i_val=ref_charge_atomic, &
|
||||
enum_c_vals=s2a("ATOMIC", "MULLIKEN"), &
|
||||
enum_desc=s2a("Use atomic core charges", "Calculate Mulliken charges (NYI)"), &
|
||||
enum_i_vals=(/ref_charge_atomic, ref_charge_mulliken/))
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="USER_RADIUS", &
|
||||
description="Use user defined covalent radii for single Gaussian Hirshfeld partitioning."// &
|
||||
" These radii are defined by the keyword ATOMIC_RADII", &
|
||||
usage="USER_RADIUS yes", repeats=.FALSE., n_var=1, &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="ATOMIC_RADII", &
|
||||
description="Defines custom radii to setup the spherical Gaussians.", &
|
||||
usage="ATOMIC_RADII {real} {real} {real}", repeats=.FALSE., &
|
||||
unit_str="angstrom", &
|
||||
type_of_var=real_t, n_var=-1)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL cp_print_key_section_create(print_key, "PROGRAM_RUN_INFO", &
|
||||
description="Controls the printing of basic info about the method", &
|
||||
print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
|
||||
CALL section_add_subsection(section, print_key)
|
||||
CALL section_release(print_key)
|
||||
|
||||
END SUBROUTINE create_hirshfeld_constraint_section
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param section ...
|
||||
|
|
@ -4865,7 +5338,7 @@ CONTAINS
|
|||
CPASSERT(.NOT. ASSOCIATED(section))
|
||||
CALL section_create(section, "OUTER_SCF", &
|
||||
description="parameters controlling the outer SCF loop", &
|
||||
n_keywords=9, n_subsections=0, repeats=.FALSE.)
|
||||
n_keywords=11, n_subsections=0, repeats=.FALSE.)
|
||||
|
||||
NULLIFY (keyword)
|
||||
|
||||
|
|
@ -4879,28 +5352,61 @@ CONTAINS
|
|||
description="Specifies which kind of outer SCF should be employed", &
|
||||
usage="TYPE DDAPC_CONSTRAINT ", &
|
||||
default_i_val=outer_scf_none, &
|
||||
enum_c_vals=s2a("DDAPC_CONSTRAINT", "S2_CONSTRAINT", "BECKE_CONSTRAINT", "BASIS_CENTER_OPT", "NONE"), &
|
||||
enum_c_vals=s2a("DDAPC_CONSTRAINT", "S2_CONSTRAINT", "BECKE_CONSTRAINT", &
|
||||
"BASIS_CENTER_OPT", "CDFT_CONSTRAINT", "NONE"), &
|
||||
enum_desc=s2a("Enforce a constraint on the DDAPC, requires the corresponding section", &
|
||||
"Enforce a constraint on the S2, requires the corresponding section", &
|
||||
"Enforce a constraint on the Becke weight population,requires the corresponding section", &
|
||||
"Optimize positions of basis functions, if atom types FLOATING_BASIS_CENTER are defined", &
|
||||
"Enforce a constraint on the Becke weight population, "// &
|
||||
"requires the corresponding section", &
|
||||
"Enforce a constraint on a generic CDFT weight population, "// &
|
||||
"requires the corresponding section"// &
|
||||
" which determines the type of weight used "// &
|
||||
"(currently only Gaussian Hirshfeld supported)", &
|
||||
"Optimize positions of basis functions, if atom types FLOATING_BASIS_CENTER "// &
|
||||
" are defined", &
|
||||
"Do nothing in the outer loop, useful for resetting the inner loop,"), &
|
||||
enum_i_vals=(/outer_scf_ddapc_constraint, outer_scf_s2_constraint, &
|
||||
outer_scf_becke_constraint, outer_scf_basis_center_opt, outer_scf_none/))
|
||||
outer_scf_becke_constraint, outer_scf_basis_center_opt, &
|
||||
outer_scf_cdft_constraint, outer_scf_none/))
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create( &
|
||||
keyword, name="OPTIMIZER", &
|
||||
description="Method used to bring the outer loop to a stationary point", &
|
||||
usage="OPTIMIZER SD", &
|
||||
default_i_val=outer_scf_optimizer_none, &
|
||||
enum_c_vals=s2a("SD", "DIIS", "NONE", "BISECT"), &
|
||||
enum_desc=s2a("Takes steps in the direction of the gradient, multiplied by step_size", &
|
||||
"Uses a Direct Inversion in the Iterative Subspace method", &
|
||||
"Do nothing, useful only with the none type", &
|
||||
"Bisection on the gradient, useful for difficult one dimensional cases"), &
|
||||
enum_i_vals=(/outer_scf_optimizer_sd, outer_scf_optimizer_diis, outer_scf_optimizer_none, outer_scf_optimizer_bisect/))
|
||||
CALL keyword_create(keyword, name="OPTIMIZER", &
|
||||
description="Method used to bring the outer loop to a stationary point", &
|
||||
usage="OPTIMIZER SD", &
|
||||
default_i_val=outer_scf_optimizer_none, &
|
||||
enum_c_vals=s2a("SD", "DIIS", "NONE", "BISECT", "BROYDEN", "NEWTON"), &
|
||||
enum_desc=s2a("Takes steps in the direction of the gradient, multiplied by step_size", &
|
||||
"Uses a Direct Inversion in the Iterative Subspace method", &
|
||||
"Do nothing, useful only with the none type", &
|
||||
"Bisection of the gradient, useful for difficult one dimensional cases", &
|
||||
"Broyden's method. Variant defined in BROYDEN_TYPE.", &
|
||||
"Newton's method."), &
|
||||
enum_i_vals=(/outer_scf_optimizer_sd, outer_scf_optimizer_diis, outer_scf_optimizer_none, &
|
||||
outer_scf_optimizer_bisect, outer_scf_optimizer_broyden, &
|
||||
outer_scf_optimizer_newton/))
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="JACOBIAN_TYPE", &
|
||||
description="Finite difference method used to calculate the inverse Jacobian "// &
|
||||
"needed by some optimizers.", &
|
||||
usage="JACOBIAN_TYPE FD1", &
|
||||
default_i_val=jacobian_fd1, &
|
||||
enum_c_vals=s2a("FD1", "FD1_BACKWARD", "FD2", "FD2_BACKWARD", "FD1_CENTRAL"), &
|
||||
enum_desc=s2a("First order forward difference (one extra energy evaluation per constraint)", &
|
||||
"First order backward difference (one extra energy evaluation per constraint)", &
|
||||
"Second order forward difference (two extra energy evaluations per constraint)", &
|
||||
"Second order backward difference (two extra energy evaluations per constraint)", &
|
||||
"First order central difference (two extra energy evaluations per constraint)"), &
|
||||
enum_i_vals=(/jacobian_fd1, jacobian_fd1_backward, jacobian_fd2, &
|
||||
jacobian_fd2_backward, jacobian_fd1_central/))
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="JACOBIAN_STEP", &
|
||||
description="Step size to use in the calculation of the inverse Jacobian with finite differences.", &
|
||||
usage="JACOBIAN_STEP 1.0E-4 ", default_r_val=1.0E-4_dp)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@
|
|||
!> \author Teodoro Laino [tlaino] - University of Zurich
|
||||
! **************************************************************************************************
|
||||
MODULE input_cp2k_mixed
|
||||
USE bibliography, ONLY: Holmberg2017,&
|
||||
Mavros2015,&
|
||||
Migliore2009
|
||||
USE cp_output_handling, ONLY: add_last_numeric,&
|
||||
cp_print_key_section_create,&
|
||||
low_print_level,&
|
||||
|
|
@ -30,6 +33,7 @@ MODULE input_cp2k_mixed
|
|||
USE input_val_types, ONLY: char_t,&
|
||||
integer_t,&
|
||||
lchar_t,&
|
||||
logical_t,&
|
||||
real_t
|
||||
USE kinds, ONLY: dp
|
||||
USE string_utilities, ONLY: s2a
|
||||
|
|
@ -106,15 +110,108 @@ CONTAINS
|
|||
! Double force_eval
|
||||
CALL section_create(subsection, name="LINEAR", &
|
||||
description="Linear combination between two force_eval: F= lambda F1 + (1-lambda) F2", &
|
||||
n_keywords=1, n_subsections=0, repeats=.FALSE.)
|
||||
n_keywords=11, n_subsections=0, repeats=.FALSE.)
|
||||
|
||||
CALL keyword_create(keyword, name="LAMBDA", &
|
||||
description="Specify the mixing parameter lambda in the formula.", &
|
||||
usage="lambda <REAL>", type_of_var=real_t)
|
||||
CALL section_add_keyword(subsection, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="MIXED_CDFT", &
|
||||
description="Controls the activation of a mixed CDFT calculation. "// &
|
||||
"The two force_evals determine"// &
|
||||
" the involved CDFT states (requires the corresponding sections).", &
|
||||
usage="MIXED_CDFT", type_of_var=logical_t, &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE., citations=(/Holmberg2017/))
|
||||
CALL section_add_keyword(subsection, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="MIXED_CDFT_COUPLING", &
|
||||
description="Parameter determining how often the CDFT electronic coupling element "// &
|
||||
" is calculated. Use a negative number to disable and 0 means every step.", &
|
||||
usage="MIXED_CDFT_COUPLING <INT>", &
|
||||
default_i_val=-1, &
|
||||
type_of_var=integer_t, n_var=1)
|
||||
CALL section_add_keyword(subsection, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="MIXED_CDFT_DLB", &
|
||||
description="Controls the activation of dynamic load balancing during a mixed CDFT calculation."// &
|
||||
" Requires Gaussian cavity confinement.", &
|
||||
usage="MIXED_CDFT_DLB", type_of_var=logical_t, &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
|
||||
CALL section_add_keyword(subsection, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="MIXED_CDFT_METRIC", &
|
||||
description="Compute reliability metric for the CDFT electronic coupling element by diagonalizing"// &
|
||||
" the difference density matrix.", &
|
||||
usage="MIXED_CDFT_METRIC", type_of_var=logical_t, &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE., &
|
||||
citations=(/Mavros2015/))
|
||||
CALL section_add_keyword(subsection, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="MIXED_CDFT_WFN_OVERLAP", &
|
||||
description="Compute CDFT electronic coupling element using the wavefunction overlap "// &
|
||||
" method in addition to the standard orthogonalization procedure "// &
|
||||
" (MIXED_CDFT_COUPLING). In this method, the unconstrained KS ground state"// &
|
||||
" wavefunction (WFN_RESTART_FILE_NAME) is represented as a linear combination"// &
|
||||
" of the two CDFT states.", &
|
||||
usage="MIXED_CDFT_WFN_OVERLAP", type_of_var=logical_t, &
|
||||
default_l_val=.FALSE., lone_keyword_l_val=.TRUE., &
|
||||
citations=(/Migliore2009/))
|
||||
CALL section_add_keyword(subsection, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="WFN_RESTART_FILE_NAME", &
|
||||
description="Name of the wavefunction restart file that defines the unconstrained "// &
|
||||
" KS ground state, which is used to compute the electronic coupling with"// &
|
||||
" the wavefunction overlap method. May include a path.", &
|
||||
usage="WFN_RESTART_FILE_NAME <FILENAME>", &
|
||||
type_of_var=lchar_t)
|
||||
CALL section_add_keyword(subsection, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="EPS_SVD", &
|
||||
description="Determines the matrix inversion solver needed by the orthogonalization procedure. "// &
|
||||
" Default value implies LU decomposition, while values between 0.0 and 1.0 "// &
|
||||
"imply SVD decomposition. For SVD, the value acts as a threshold"// &
|
||||
" for screening singular values so that only values above it are included"// &
|
||||
" in the matrix pseudoinverse.", &
|
||||
usage="EPS_SVD <REAL>", type_of_var=real_t, &
|
||||
default_r_val=0.0_dp, repeats=.FALSE.)
|
||||
CALL section_add_keyword(subsection, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="LOAD_SCALE", &
|
||||
description="Control parameter for dynamic load balancing during a mixed CDFT calculation."// &
|
||||
" See code for details.", &
|
||||
usage="LOAD_SCALE <REAL>", type_of_var=real_t, &
|
||||
default_r_val=2.0_dp)
|
||||
CALL section_add_keyword(subsection, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="MORE_WORK", &
|
||||
description="Control parameter for dynamic load balancing during a mixed CDFT calculation."// &
|
||||
" See code for details.", &
|
||||
usage="MORE_WORK <INT>", type_of_var=integer_t, &
|
||||
default_i_val=0, repeats=.FALSE.)
|
||||
CALL section_add_keyword(subsection, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="VERY_OVERLOADED", &
|
||||
description="Control parameter for dynamic load balancing during a mixed CDFT calculation."// &
|
||||
" See code for details.", &
|
||||
usage="VERY_OVERLOADED <REAL>", type_of_var=real_t, &
|
||||
default_r_val=0.0_dp, repeats=.FALSE.)
|
||||
CALL section_add_keyword(subsection, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL section_add_subsection(section, subsection)
|
||||
CALL section_release(subsection)
|
||||
|
||||
!
|
||||
CALL section_create(subsection, name="COUPLING", &
|
||||
description="Coupling between two force_eval: E=(E1+E2 - sqrt((E1-E2)**2+4*H12**2))/2", &
|
||||
n_keywords=1, n_subsections=0, repeats=.FALSE.)
|
||||
|
|
|
|||
|
|
@ -26,13 +26,14 @@ MODULE input_cp2k_properties_dft
|
|||
USE input_constants, ONLY: &
|
||||
current_gauge_atom, current_gauge_r, current_gauge_r_and_step_func, &
|
||||
current_orb_center_atom, current_orb_center_box, current_orb_center_common, &
|
||||
current_orb_center_wannier, do_ddapc_constraint, do_ddapc_restraint, do_et_becke, &
|
||||
do_et_ddapc, do_full_density, do_no_et, do_spin_density, ot_precond_full_all, &
|
||||
ot_precond_full_kinetic, ot_precond_full_single, ot_precond_full_single_inverse, &
|
||||
ot_precond_none, ot_precond_s_inverse, use_mom_ref_coac, use_mom_ref_com, &
|
||||
use_mom_ref_user, use_mom_ref_zero, xas_dip_len, xas_dip_vel
|
||||
current_orb_center_wannier, do_et_becke, do_et_ddapc, do_full_density, do_no_et, &
|
||||
do_spin_density, ot_precond_full_all, ot_precond_full_kinetic, ot_precond_full_single, &
|
||||
ot_precond_full_single_inverse, ot_precond_none, ot_precond_s_inverse, use_mom_ref_coac, &
|
||||
use_mom_ref_com, use_mom_ref_user, use_mom_ref_zero, xas_dip_len, xas_dip_vel
|
||||
USE input_cp2k_atprop, ONLY: create_atprop_section
|
||||
USE input_cp2k_dft, ONLY: create_interp_section,&
|
||||
USE input_cp2k_dft, ONLY: create_becke_restraint_section,&
|
||||
create_ddapc_restraint_section,&
|
||||
create_interp_section,&
|
||||
create_localize_section,&
|
||||
create_mgrid_section
|
||||
USE input_cp2k_resp, ONLY: create_resp_section
|
||||
|
|
@ -930,22 +931,22 @@ CONTAINS
|
|||
n_keywords=1, n_subsections=4, repeats=.FALSE.)
|
||||
|
||||
NULLIFY (subsection)
|
||||
CALL create_restraint_A(subsection, "DDAPC_RESTRAINT_A")
|
||||
CALL create_ddapc_restraint_section(subsection, "DDAPC_RESTRAINT_A")
|
||||
CALL section_add_subsection(section, subsection)
|
||||
CALL section_release(subsection)
|
||||
|
||||
NULLIFY (subsection)
|
||||
CALL create_restraint_A(subsection, "DDAPC_RESTRAINT_B")
|
||||
CALL create_ddapc_restraint_section(subsection, "DDAPC_RESTRAINT_B")
|
||||
CALL section_add_subsection(section, subsection)
|
||||
CALL section_release(subsection)
|
||||
|
||||
NULLIFY (subsection)
|
||||
CALL create_restraint_A(subsection, "BECKE_RESTRAINT_A")
|
||||
CALL create_becke_restraint_section(subsection, "BECKE_RESTRAINT_A")
|
||||
CALL section_add_subsection(section, subsection)
|
||||
CALL section_release(subsection)
|
||||
|
||||
NULLIFY (subsection)
|
||||
CALL create_restraint_A(subsection, "BECKE_RESTRAINT_B")
|
||||
CALL create_becke_restraint_section(subsection, "BECKE_RESTRAINT_B")
|
||||
CALL section_add_subsection(section, subsection)
|
||||
CALL section_release(subsection)
|
||||
|
||||
|
|
@ -954,7 +955,7 @@ CONTAINS
|
|||
usage="TYPE_OF_CONSTRAINT DDAPC", &
|
||||
enum_c_vals=s2a("NONE", "DDAPC", "BECKE"), &
|
||||
enum_i_vals=(/do_no_et, do_et_ddapc, do_et_becke/), &
|
||||
enum_desc=s2a("NONE", "ddapc_restraint", "Sperical potential"), &
|
||||
enum_desc=s2a("NONE", "DDAPC Constraint", "Becke constraint"), &
|
||||
default_i_val=do_no_et)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
|
@ -968,83 +969,6 @@ CONTAINS
|
|||
|
||||
END SUBROUTINE create_et_coupling_section
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param section ...
|
||||
!> \param section_name ...
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE create_restraint_A(section, section_name)
|
||||
TYPE(section_type), POINTER :: section
|
||||
CHARACTER(len=*), INTENT(in) :: section_name
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'create_restraint_A', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
TYPE(keyword_type), POINTER :: keyword
|
||||
TYPE(section_type), POINTER :: print_key
|
||||
|
||||
NULLIFY (keyword, print_key)
|
||||
CPASSERT(.NOT. ASSOCIATED(section))
|
||||
CALL section_create(section, TRIM(ADJUSTL(section_name)), &
|
||||
description="Use DDAPC charges in a restraint (check code for details),"// &
|
||||
" section can be repeated, but only one constraint is possible at the moment.", &
|
||||
n_keywords=7, n_subsections=0, repeats=.FALSE.)
|
||||
|
||||
CALL keyword_create(keyword, name="STRENGTH", &
|
||||
description="force constant of the restraint", &
|
||||
usage="STRENGTH {real} ", default_r_val=0.1_dp)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="TYPE_OF_DENSITY", &
|
||||
description="Specifies the type of density used for the fitting", &
|
||||
usage="TYPE_OF_DENSITY (FULL|SPIN)", &
|
||||
enum_c_vals=s2a("FULL", "SPIN"), &
|
||||
enum_i_vals=(/do_full_density, do_spin_density/), &
|
||||
enum_desc=s2a("Full density", "Spin density"), &
|
||||
default_i_val=do_full_density)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="TARGET", &
|
||||
description="target value of the restraint", &
|
||||
usage="TARGET {real} ", default_r_val=1._dp)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="ATOMS", &
|
||||
description="Specifies the list of atoms that is summed in the restraint", &
|
||||
usage="ATOMS {integer} {integer} .. {integer}", &
|
||||
n_var=-1, type_of_var=integer_t)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create( &
|
||||
keyword, name="COEFF", &
|
||||
description="Defines the the coefficient of the atom in the atom list (default is one), currently DDAPC only ", &
|
||||
usage="COEFF 1.0 -1.0", &
|
||||
type_of_var=real_t, n_var=-1)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL keyword_create(keyword, name="FUNCTIONAL_FORM", &
|
||||
description="Specifies the functional form of the term added", &
|
||||
usage="FUNCTIONAL_FORM RESTRAINT", &
|
||||
enum_c_vals=s2a("RESTRAINT", "CONSTRAINT"), &
|
||||
enum_i_vals=(/do_ddapc_restraint, do_ddapc_constraint/), &
|
||||
enum_desc=s2a("Harmonic potential: s*(q-t)**2", "Constraint form: s*(q-t)"), &
|
||||
default_i_val=do_ddapc_restraint)
|
||||
CALL section_add_keyword(section, keyword)
|
||||
CALL keyword_release(keyword)
|
||||
|
||||
CALL cp_print_key_section_create(print_key, "program_run_info", &
|
||||
description="Controls the printing basic info about the method", &
|
||||
print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
|
||||
CALL section_add_subsection(section, print_key)
|
||||
CALL section_release(print_key)
|
||||
|
||||
END SUBROUTINE create_restraint_A
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief creates an input section for tddfpt calculation
|
||||
!> \param section section to create
|
||||
|
|
|
|||
|
|
@ -92,9 +92,9 @@ CONTAINS
|
|||
LOGICAL :: multiple_subsys, skip_vel_section
|
||||
TYPE(cell_type), POINTER :: cell
|
||||
TYPE(cp_subsys_type), POINTER :: subsys
|
||||
TYPE(section_vals_type), POINTER :: cell_section, force_env_sections, &
|
||||
qmmm_section, rng_section, &
|
||||
subsys_section
|
||||
TYPE(section_vals_type), POINTER :: cell_section, dft_section, &
|
||||
force_env_sections, qmmm_section, &
|
||||
rng_section, subsys_section
|
||||
TYPE(virial_type), POINTER :: virial
|
||||
|
||||
NULLIFY (rng_section, subsys_section, cell_section, virial, subsys, cell)
|
||||
|
|
@ -150,6 +150,17 @@ CONTAINS
|
|||
CALL update_cell_section(cell, cell_section)
|
||||
END DO
|
||||
END IF
|
||||
! With mixed CDFT, update value of constraint Lagrangian
|
||||
IF (ASSOCIATED(force_env%mixed_env)) THEN
|
||||
IF (force_env%mixed_env%do_mixed_cdft) THEN
|
||||
DO iforce_eval = 2, nforce_eval
|
||||
dft_section => section_vals_get_subs_vals3(force_env_sections, "DFT", &
|
||||
i_rep_section=i_force_eval(iforce_eval))
|
||||
CALL section_vals_val_set(dft_section, "QS%BECKE_RESTRAINT%STRENGTH", &
|
||||
r_val=force_env%mixed_env%strength(iforce_eval-1))
|
||||
END DO
|
||||
END IF
|
||||
END IF
|
||||
END IF
|
||||
|
||||
IF (myid == ehrenfest) CALL section_vals_val_set(root_section, "FORCE_EVAL%DFT%REAL_TIME_PROPAGATION%INITIAL_WFN", &
|
||||
|
|
|
|||
4010
src/mixed_cdft_methods.F
Normal file
4010
src/mixed_cdft_methods.F
Normal file
File diff suppressed because it is too large
Load diff
350
src/mixed_cdft_types.F
Normal file
350
src/mixed_cdft_types.F
Normal file
|
|
@ -0,0 +1,350 @@
|
|||
!--------------------------------------------------------------------------------------------------!
|
||||
! CP2K: A general program to perform molecular dynamics simulations !
|
||||
! Copyright (C) 2000 - 2017 CP2K developers group !
|
||||
!--------------------------------------------------------------------------------------------------!
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Types for mixed CDFT calculations
|
||||
!> \par History
|
||||
!> Separated CDFT routines from mixed_environment_types
|
||||
!> \author Nico Holmberg [01.2017]
|
||||
! **************************************************************************************************
|
||||
MODULE mixed_cdft_types
|
||||
USE cp_blacs_env, ONLY: cp_blacs_env_release,&
|
||||
cp_blacs_env_type
|
||||
USE cp_control_types, ONLY: becke_control_release,&
|
||||
becke_restraint_type
|
||||
USE kinds, ONLY: dp
|
||||
USE pw_env_types, ONLY: pw_env_release,&
|
||||
pw_env_type
|
||||
USE qs_kind_types, ONLY: deallocate_qs_kind_set,&
|
||||
qs_kind_type
|
||||
#include "./base/base_uses.f90"
|
||||
|
||||
IMPLICIT NONE
|
||||
PRIVATE
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Buffers for load balancing
|
||||
!> \param rank indices of the processors the data in this buffer should be sent to
|
||||
!> \param tag mpi tags for the messages to send
|
||||
!> \param cavity the cavity to send
|
||||
!> \param weight the weight to send
|
||||
!> \param gradients the gradients to send
|
||||
! **************************************************************************************************
|
||||
TYPE buffers
|
||||
INTEGER :: rank(2), tag(2)
|
||||
REAL(KIND=dp), POINTER, &
|
||||
DIMENSION(:, :, :) :: cavity, weight
|
||||
REAL(KIND=dp), POINTER, &
|
||||
DIMENSION(:, :, :, :) :: gradients
|
||||
END TYPE buffers
|
||||
! **************************************************************************************************
|
||||
!> \brief To build array of buffers
|
||||
!> \param buffs the pointer to the buffers type
|
||||
! **************************************************************************************************
|
||||
TYPE p_buffers
|
||||
TYPE(buffers), DIMENSION(:), POINTER :: buffs
|
||||
END TYPE p_buffers
|
||||
! **************************************************************************************************
|
||||
!> \brief Information about load balancing
|
||||
!> \param matrix_info size of the target_list array to receive and grid point bounds of the data
|
||||
!> \param target_list the target_list array of the processor that sends me data
|
||||
! **************************************************************************************************
|
||||
TYPE repl_info
|
||||
INTEGER, DIMENSION(:), POINTER :: matrix_info
|
||||
INTEGER, DIMENSION(:, :), POINTER :: target_list
|
||||
END TYPE repl_info
|
||||
! **************************************************************************************************
|
||||
!> \brief Load balancing control for mixed CDFT calculation
|
||||
!> \param my_source index of the processor which will send this processor data
|
||||
!> \param distributed bounds that determine which grid points this processor will compute after
|
||||
!> applying load balancing (is_special = .FALSE.)
|
||||
!> \param my_dest_repl the dest_list arrays of all processors which send additional work to this
|
||||
!> processor (indices of the processors where the redistributed slices should be
|
||||
!> returned)
|
||||
!> \param dest_tags_repl tags for the send messages (is_special = .FALSE.)
|
||||
!> \param more_work allow heavily overloaded processors to redistribute more_work slices
|
||||
!> \param bo bounds of the data that this processor will send to other processors which tells the
|
||||
!> receivers how to rearrange the data correctly
|
||||
!> \param expected_work a list of the estimated work per processor
|
||||
!> \param prediction_error the difference between the estimated and actual work per processor
|
||||
!> \param target_list a list of processors to send data and the size of data to send
|
||||
!> \param recv_work flag that determines if this processor will receive data from others
|
||||
!> \param send_work flag that determines if this processor will send data to others
|
||||
!> \param recv_work_repl list of processor indices where this processor will send data during load
|
||||
!> balancing
|
||||
!> \param load_scale allow underloaded processors to accept load_scale additional work
|
||||
!> \param very_overloaded value to determine which processors are heavily overloaded
|
||||
!> \param cavity the cavity that this processor builds in addition to its own cavity defined
|
||||
!> on the grid points which were redistributed to this processor
|
||||
!> \param weight the weight that this processor builds in addition to its own weight
|
||||
!> \param gradients the gradients that this processor builds in addition to its own gradients
|
||||
!> \param sendbuffer buffer to hold the data this processor will send
|
||||
!> \param sendbuffer buffer to hold the data this processor will receive
|
||||
!> \param recv_info additional information on the data this processor will receive
|
||||
! **************************************************************************************************
|
||||
TYPE mixed_cdft_dlb_type
|
||||
INTEGER :: my_source, distributed(2), &
|
||||
my_dest_repl(2), dest_tags_repl(2), &
|
||||
more_work
|
||||
INTEGER, DIMENSION(:), POINTER :: bo, expected_work, &
|
||||
prediction_error
|
||||
INTEGER, DIMENSION(:, :), POINTER :: target_list
|
||||
LOGICAL :: recv_work, send_work
|
||||
LOGICAL, DIMENSION(:), POINTER :: recv_work_repl
|
||||
REAL(KIND=dp) :: load_scale, very_overloaded
|
||||
REAL(KIND=dp), POINTER, &
|
||||
DIMENSION(:, :, :) :: cavity, weight
|
||||
REAL(KIND=dp), POINTER, &
|
||||
DIMENSION(:, :, :, :) :: gradients
|
||||
! Should convert to TYPE(p_buffers), POINTER
|
||||
TYPE(buffers), DIMENSION(:), POINTER :: sendbuff
|
||||
TYPE(p_buffers), DIMENSION(:), POINTER :: recvbuff
|
||||
TYPE(repl_info), DIMENSION(:), POINTER :: recv_info
|
||||
END TYPE mixed_cdft_dlb_type
|
||||
! **************************************************************************************************
|
||||
!> \brief Main mixed CDFT control type
|
||||
!> \param sim_step counter to keep track of the simulation step for MD
|
||||
!> \param multiplicity spin multiplicity
|
||||
!> \param constraint_type determins what kind of constraint to use
|
||||
!> \param combined_type for combined density+spin constraint, determines which atoms to apply the
|
||||
!> spin constraint
|
||||
!> \param source_list a list of processors which will send this processor data
|
||||
!> \param dest_list a list of processors which this processor will send data to
|
||||
!> \param recv_bo bounds of the data which this processor will receive (is_special = .FALSE.)
|
||||
!> \param source_list_save permanent copy of source_list which might get reallocated during
|
||||
!> load balancing
|
||||
!> \param dest_list_save permanent copy of dest_list which might get reallocated during
|
||||
!> load balancing
|
||||
!> \param source_list_bo bounds of the data which this processor will receive (is_special = .TRUE.)
|
||||
!> \param dest_list_bo bounds of the data this processor will send (is_special = .TRUE.)
|
||||
!> \param source_bo_save permanent copy of source_list_bo
|
||||
!> \param deset_bo_save permanent copy of dest_list_bo
|
||||
!> \param is_pencil flag controlling which scheme to use for constraint replication
|
||||
!> \param dlb flag to enable dynamic load balancing
|
||||
!> \param is_special another flag controlling which scheme to use for constraint replication
|
||||
!> \param first_iteration flag to mark the first iteration e.g. during MD to output information
|
||||
!> \param calculate_metric flag which determines if the coupling reliablity metric should be computed
|
||||
!> \param wnf_ovelap_method flag to enable the wavefunction overlap method for computing the coupling
|
||||
!> \param has_unit_metric flag to determine if the basis set has unit metric
|
||||
!> \param eps_rho_rspace threshold to determine when the realspace density can be considered zero
|
||||
!> \param sim_dt timestep of the MD simulation
|
||||
!> \param eps_svd value that controls which matrix inversion method to use
|
||||
!> \param weight the constraint weight function
|
||||
!> \param cavity the confinement cavity: the weight function is nonzero only within the cavity
|
||||
!> \param becke_control container for becke_restraint_type
|
||||
!> \param sendbuff buffer that holds the data to be replicated
|
||||
!> \param blacs_env the blacs_env needed to redistribute arrays during a coupling calculation
|
||||
!> \param dlb_control container for load balancing structures
|
||||
!> \param qs_kind_set the qs_kind_set needed to setup a confinement cavity
|
||||
!> \param pw_env the pw_env that holds the fully distributed realspace grid
|
||||
! **************************************************************************************************
|
||||
TYPE mixed_cdft_type
|
||||
INTEGER :: sim_step, multiplicity, &
|
||||
constraint_type, combined_type
|
||||
INTEGER, POINTER, DIMENSION(:) :: source_list, dest_list, &
|
||||
recv_bo, source_list_save, &
|
||||
dest_list_save
|
||||
INTEGER, POINTER, DIMENSION(:, :) :: source_list_bo, dest_list_bo, &
|
||||
source_bo_save, dest_bo_save
|
||||
LOGICAL :: is_pencil, dlb, &
|
||||
is_special, first_iteration, &
|
||||
calculate_metric, &
|
||||
wfn_overlap_method, &
|
||||
has_unit_metric
|
||||
REAL(KIND=dp) :: eps_rho_rspace, sim_dt, &
|
||||
eps_svd
|
||||
REAL(KIND=dp), POINTER, DIMENSION(:, :, :) :: weight, cavity
|
||||
TYPE(becke_restraint_type), POINTER :: becke_control
|
||||
TYPE(buffers), DIMENSION(:), POINTER :: sendbuff
|
||||
TYPE(cp_blacs_env_type), POINTER :: blacs_env
|
||||
TYPE(mixed_cdft_dlb_type), POINTER :: dlb_control
|
||||
TYPE(qs_kind_type), DIMENSION(:), &
|
||||
POINTER :: qs_kind_set
|
||||
TYPE(pw_env_type), POINTER :: pw_env
|
||||
END TYPE mixed_cdft_type
|
||||
|
||||
! *** Public data types ***
|
||||
|
||||
PUBLIC :: mixed_cdft_type
|
||||
|
||||
! *** Public subroutines ***
|
||||
|
||||
PUBLIC :: mixed_cdft_type_create, &
|
||||
mixed_cdft_type_release
|
||||
|
||||
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mixed_cdft_types'
|
||||
|
||||
CONTAINS
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief inits the given mixed_cdft_type
|
||||
!> \param cdft_control the object to init
|
||||
!> \author Nico Holmberg [01.2017]
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE mixed_cdft_type_create(cdft_control)
|
||||
TYPE(mixed_cdft_type), POINTER :: cdft_control
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mixed_cdft_type_create', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
NULLIFY (cdft_control%pw_env, cdft_control%blacs_env, cdft_control%qs_kind_set)
|
||||
NULLIFY (cdft_control%dlb_control, cdft_control%dest_list_bo, cdft_control%dest_list)
|
||||
NULLIFY (cdft_control%dest_bo_save, cdft_control%dest_list_save, cdft_control%source_list)
|
||||
NULLIFY (cdft_control%source_list_save, cdft_control%source_bo_save, cdft_control%source_list_bo)
|
||||
NULLIFY (cdft_control%cavity, cdft_control%weight, cdft_control%sendbuff)
|
||||
NULLIFY (cdft_control%becke_control, cdft_control%recv_bo)
|
||||
|
||||
END SUBROUTINE mixed_cdft_type_create
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief releases the given mixed_cdft_type
|
||||
!> \param cdft_control the object to release
|
||||
!> \author Nico Holmberg [01.2017]
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE mixed_cdft_type_release(cdft_control)
|
||||
TYPE(mixed_cdft_type), POINTER :: cdft_control
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mixed_cdft_type_release', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: i
|
||||
|
||||
CALL pw_env_release(cdft_control%pw_env)
|
||||
IF (ASSOCIATED(cdft_control%dest_list)) &
|
||||
DEALLOCATE (cdft_control%dest_list)
|
||||
IF (ASSOCIATED(cdft_control%dest_list_save)) &
|
||||
DEALLOCATE (cdft_control%dest_list_save)
|
||||
IF (ASSOCIATED(cdft_control%dest_list_bo)) &
|
||||
DEALLOCATE (cdft_control%dest_list_bo)
|
||||
IF (ASSOCIATED(cdft_control%dest_bo_save)) &
|
||||
DEALLOCATE (cdft_control%dest_bo_save)
|
||||
IF (ASSOCIATED(cdft_control%source_list)) &
|
||||
DEALLOCATE (cdft_control%source_list)
|
||||
IF (ASSOCIATED(cdft_control%source_list_save)) &
|
||||
DEALLOCATE (cdft_control%source_list_save)
|
||||
IF (ASSOCIATED(cdft_control%source_list_bo)) &
|
||||
DEALLOCATE (cdft_control%source_list_bo)
|
||||
IF (ASSOCIATED(cdft_control%source_bo_save)) &
|
||||
DEALLOCATE (cdft_control%source_bo_save)
|
||||
IF (ASSOCIATED(cdft_control%recv_bo)) &
|
||||
DEALLOCATE (cdft_control%recv_bo)
|
||||
IF (ASSOCIATED(cdft_control%weight)) &
|
||||
DEALLOCATE (cdft_control%weight)
|
||||
IF (ASSOCIATED(cdft_control%cavity)) &
|
||||
DEALLOCATE (cdft_control%cavity)
|
||||
IF (ASSOCIATED(cdft_control%dlb_control)) &
|
||||
CALL mixed_cdft_dlb_release(cdft_control%dlb_control)
|
||||
IF (ASSOCIATED(cdft_control%sendbuff)) THEN
|
||||
DO i = 1, SIZE(cdft_control%sendbuff)
|
||||
CALL mixed_cdft_buffers_release(cdft_control%sendbuff(i))
|
||||
END DO
|
||||
DEALLOCATE (cdft_control%sendbuff)
|
||||
END IF
|
||||
CALL becke_control_release(cdft_control%becke_control)
|
||||
IF (ASSOCIATED(cdft_control%blacs_env)) &
|
||||
CALL cp_blacs_env_release(cdft_control%blacs_env)
|
||||
IF (ASSOCIATED(cdft_control%qs_kind_set)) &
|
||||
CALL deallocate_qs_kind_set(cdft_control%qs_kind_set)
|
||||
DEALLOCATE (cdft_control)
|
||||
|
||||
END SUBROUTINE mixed_cdft_type_release
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief releases the given load balancing control
|
||||
!> \param dlb_control the object to release
|
||||
!> \author Nico Holmberg [01.2017]
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE mixed_cdft_dlb_release(dlb_control)
|
||||
TYPE(mixed_cdft_dlb_type), POINTER :: dlb_control
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mixed_cdft_dlb_release', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: i
|
||||
|
||||
IF (ASSOCIATED(dlb_control%recv_work_repl)) &
|
||||
DEALLOCATE (dlb_control%recv_work_repl)
|
||||
IF (ASSOCIATED(dlb_control%sendbuff)) THEN
|
||||
DO i = 1, SIZE(dlb_control%sendbuff)
|
||||
CALL mixed_cdft_buffers_release(dlb_control%sendbuff(i))
|
||||
END DO
|
||||
DEALLOCATE (dlb_control%sendbuff)
|
||||
END IF
|
||||
IF (ASSOCIATED(dlb_control%recvbuff)) THEN
|
||||
DO i = 1, SIZE(dlb_control%recvbuff)
|
||||
CALL mixed_cdft_p_buffers_release(dlb_control%recvbuff(i))
|
||||
END DO
|
||||
DEALLOCATE (dlb_control%recvbuff)
|
||||
END IF
|
||||
IF (ASSOCIATED(dlb_control%recv_info)) THEN
|
||||
DO i = 1, SIZE(dlb_control%recv_info)
|
||||
IF (ASSOCIATED(dlb_control%recv_info(i)%matrix_info)) &
|
||||
DEALLOCATE (dlb_control%recv_info(i)%matrix_info)
|
||||
IF (ASSOCIATED(dlb_control%recv_info(i)%target_list)) &
|
||||
DEALLOCATE (dlb_control%recv_info(i)%target_list)
|
||||
END DO
|
||||
DEALLOCATE (dlb_control%recv_info)
|
||||
END IF
|
||||
IF (ASSOCIATED(dlb_control%bo)) &
|
||||
DEALLOCATE (dlb_control%bo)
|
||||
IF (ASSOCIATED(dlb_control%expected_work)) &
|
||||
DEALLOCATE (dlb_control%expected_work)
|
||||
IF (ASSOCIATED(dlb_control%prediction_error)) &
|
||||
DEALLOCATE (dlb_control%prediction_error)
|
||||
IF (ASSOCIATED(dlb_control%target_list)) &
|
||||
DEALLOCATE (dlb_control%target_list)
|
||||
IF (ASSOCIATED(dlb_control%cavity)) &
|
||||
DEALLOCATE (dlb_control%cavity)
|
||||
IF (ASSOCIATED(dlb_control%weight)) &
|
||||
DEALLOCATE (dlb_control%weight)
|
||||
IF (ASSOCIATED(dlb_control%gradients)) &
|
||||
DEALLOCATE (dlb_control%gradients)
|
||||
DEALLOCATE (dlb_control)
|
||||
|
||||
END SUBROUTINE mixed_cdft_dlb_release
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief releases the given buffers
|
||||
!> \param buffer the object to release
|
||||
!> \author Nico Holmberg [01.2017]
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE mixed_cdft_buffers_release(buffer)
|
||||
TYPE(buffers) :: buffer
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mixed_cdft_buffers_release', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
IF (ASSOCIATED(buffer%cavity)) &
|
||||
DEALLOCATE (buffer%cavity)
|
||||
IF (ASSOCIATED(buffer%weight)) &
|
||||
DEALLOCATE (buffer%weight)
|
||||
IF (ASSOCIATED(buffer%gradients)) &
|
||||
DEALLOCATE (buffer%gradients)
|
||||
|
||||
END SUBROUTINE mixed_cdft_buffers_release
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief releases the given pointer of buffers
|
||||
!> \param p_buffer the object to release
|
||||
!> \author Nico Holmberg [01.2017]
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE mixed_cdft_p_buffers_release(p_buffer)
|
||||
TYPE(p_buffers) :: p_buffer
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mixed_cdft_p_buffers_release', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: i
|
||||
|
||||
IF (ASSOCIATED(p_buffer%buffs)) THEN
|
||||
DO i = 1, SIZE(p_buffer%buffs)
|
||||
CALL mixed_cdft_buffers_release(p_buffer%buffs(i))
|
||||
END DO
|
||||
DEALLOCATE (p_buffer%buffs)
|
||||
END IF
|
||||
|
||||
END SUBROUTINE mixed_cdft_p_buffers_release
|
||||
|
||||
END MODULE mixed_cdft_types
|
||||
|
|
@ -33,6 +33,8 @@ MODULE mixed_environment_types
|
|||
USE kinds, ONLY: default_path_length,&
|
||||
default_string_length,&
|
||||
dp
|
||||
USE mixed_cdft_types, ONLY: mixed_cdft_type,&
|
||||
mixed_cdft_type_release
|
||||
USE mixed_energy_types, ONLY: deallocate_mixed_energy,&
|
||||
mixed_energy_type
|
||||
USE molecule_kind_list_types, ONLY: molecule_kind_list_create,&
|
||||
|
|
@ -55,27 +57,33 @@ MODULE mixed_environment_types
|
|||
! **************************************************************************************************
|
||||
!> \param mixed_env the pointer to the mixed_env
|
||||
!> \par History
|
||||
!> 11/06
|
||||
!> \author fschiff
|
||||
!> 11/06 Created [fschiff]
|
||||
!> 12/15-12/16 Mixed CDFT [Nico Holmberg]
|
||||
! **************************************************************************************************
|
||||
TYPE mixed_environment_type
|
||||
INTEGER :: id_nr, ref_count
|
||||
TYPE(cell_type), POINTER :: cell_ref
|
||||
TYPE(mixed_energy_type), POINTER :: mixed_energy
|
||||
TYPE(cp_para_env_type), POINTER :: para_env
|
||||
TYPE(cp_subsys_type), POINTER :: subsys
|
||||
INTEGER :: id_nr, ref_count
|
||||
TYPE(cell_type), POINTER :: cell_ref
|
||||
TYPE(mixed_energy_type), POINTER :: mixed_energy
|
||||
TYPE(cp_para_env_type), POINTER :: para_env
|
||||
TYPE(cp_subsys_type), POINTER :: subsys
|
||||
TYPE(section_vals_type), POINTER :: input
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: energies
|
||||
! Parallelization of multiple force_eval
|
||||
INTEGER :: new_group, ngroups
|
||||
INTEGER, DIMENSION(:), POINTER :: group_distribution
|
||||
TYPE(cp_para_env_p_type), DIMENSION(:), POINTER :: sub_para_env
|
||||
TYPE(cp_logger_p_type), DIMENSION(:), POINTER :: sub_logger
|
||||
TYPE(cp_logger_p_type), DIMENSION(:), POINTER :: sub_logger
|
||||
REAL(KIND=dp), POINTER, DIMENSION(:) :: val
|
||||
CHARACTER(LEN=default_string_length), &
|
||||
DIMENSION(:), POINTER :: par
|
||||
DIMENSION(:), POINTER :: par
|
||||
REAL(KIND=dp) :: dx, lerr
|
||||
CHARACTER(default_path_length) :: coupling_function
|
||||
! Mixed CDFT control parameters
|
||||
LOGICAL :: do_mixed_cdft, do_mixed_et, &
|
||||
do_mixed_qmmm_cdft
|
||||
INTEGER :: et_freq
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: strength
|
||||
TYPE(mixed_cdft_type), POINTER :: cdft_control
|
||||
END TYPE mixed_environment_type
|
||||
|
||||
! **************************************************************************************************
|
||||
|
|
@ -123,12 +131,13 @@ CONTAINS
|
|||
!> \param subsys ...
|
||||
!> \param input ...
|
||||
!> \param results ...
|
||||
!> \param cdft_control ...
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE get_mixed_env(mixed_env, atomic_kind_set, particle_set, &
|
||||
local_particles, local_molecules, molecule_kind_set, &
|
||||
molecule_set, cell, cell_ref, &
|
||||
mixed_energy, para_env, sub_para_env, subsys, &
|
||||
input, results)
|
||||
input, results, cdft_control)
|
||||
|
||||
TYPE(mixed_environment_type), INTENT(IN) :: mixed_env
|
||||
TYPE(atomic_kind_type), OPTIONAL, POINTER :: atomic_kind_set(:)
|
||||
|
|
@ -144,6 +153,7 @@ CONTAINS
|
|||
TYPE(cp_subsys_type), OPTIONAL, POINTER :: subsys
|
||||
TYPE(section_vals_type), OPTIONAL, POINTER :: input
|
||||
TYPE(cp_result_type), OPTIONAL, POINTER :: results
|
||||
TYPE(mixed_cdft_type), OPTIONAL, POINTER :: cdft_control
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'get_mixed_env', routineP = moduleN//':'//routineN
|
||||
|
||||
|
|
@ -160,6 +170,7 @@ CONTAINS
|
|||
IF (PRESENT(mixed_energy)) mixed_energy => mixed_env%mixed_energy
|
||||
IF (PRESENT(para_env)) para_env => mixed_env%para_env
|
||||
IF (PRESENT(sub_para_env)) sub_para_env => mixed_env%sub_para_env
|
||||
IF (PRESENT(cdft_control)) cdft_control => mixed_env%cdft_control
|
||||
IF (PRESENT(subsys)) subsys => mixed_env%subsys
|
||||
CALL cp_subsys_get(mixed_env%subsys, &
|
||||
atomic_kinds=atomic_kinds, &
|
||||
|
|
@ -197,6 +208,12 @@ CONTAINS
|
|||
NULLIFY (mixed_env%par)
|
||||
NULLIFY (mixed_env%val)
|
||||
NULLIFY (mixed_env%subsys)
|
||||
NULLIFY (mixed_env%cdft_control)
|
||||
NULLIFY (mixed_env%strength)
|
||||
mixed_env%do_mixed_cdft = .FALSE.
|
||||
mixed_env%do_mixed_et = .FALSE.
|
||||
mixed_env%do_mixed_qmmm_cdft = .FALSE.
|
||||
mixed_env%et_freq = -1
|
||||
CALL cp_para_env_retain(para_env)
|
||||
mixed_env%para_env => para_env
|
||||
mixed_env%ref_count = 1
|
||||
|
|
@ -219,11 +236,12 @@ CONTAINS
|
|||
!> \param subsys ...
|
||||
!> \param input ...
|
||||
!> \param sub_para_env ...
|
||||
!> \param cdft_control ...
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE set_mixed_env(mixed_env, atomic_kind_set, particle_set, &
|
||||
local_particles, local_molecules, molecule_kind_set, &
|
||||
molecule_set, cell_ref, mixed_energy, subsys, &
|
||||
input, sub_para_env)
|
||||
input, sub_para_env, cdft_control)
|
||||
|
||||
TYPE(mixed_environment_type), POINTER :: mixed_env
|
||||
TYPE(atomic_kind_type), OPTIONAL, POINTER :: atomic_kind_set(:)
|
||||
|
|
@ -237,6 +255,7 @@ CONTAINS
|
|||
TYPE(section_vals_type), OPTIONAL, POINTER :: input
|
||||
TYPE(cp_para_env_p_type), DIMENSION(:), OPTIONAL, &
|
||||
POINTER :: sub_para_env
|
||||
TYPE(mixed_cdft_type), OPTIONAL, POINTER :: cdft_control
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'set_mixed_env', routineP = moduleN//':'//routineN
|
||||
|
||||
|
|
@ -266,6 +285,7 @@ CONTAINS
|
|||
IF (PRESENT(sub_para_env)) THEN
|
||||
mixed_env%sub_para_env => sub_para_env
|
||||
END IF
|
||||
IF (PRESENT(cdft_control)) mixed_env%cdft_control => cdft_control
|
||||
IF (PRESENT(atomic_kind_set)) THEN
|
||||
CALL atomic_kind_list_create(atomic_kinds, &
|
||||
els_ptr=atomic_kind_set)
|
||||
|
|
@ -375,6 +395,10 @@ CONTAINS
|
|||
IF (ASSOCIATED(mixed_env%group_distribution)) THEN
|
||||
DEALLOCATE (mixed_env%group_distribution)
|
||||
END IF
|
||||
IF (ASSOCIATED(mixed_env%cdft_control)) &
|
||||
CALL mixed_cdft_type_release(mixed_env%cdft_control)
|
||||
IF (ASSOCIATED(mixed_env%strength)) &
|
||||
DEALLOCATE (mixed_env%strength)
|
||||
DEALLOCATE (mixed_env)
|
||||
END IF
|
||||
END IF
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ MODULE message_passing
|
|||
PUBLIC :: mp_gather, mp_alltoall, mp_sendrecv, mp_allgather, mp_iallgather
|
||||
PUBLIC :: mp_isend, mp_irecv, mp_ibcast
|
||||
PUBLIC :: mp_shift, mp_isendrecv, mp_wait, mp_waitall, mp_waitany, mp_testany
|
||||
PUBLIC :: mp_testall, mp_iscatter
|
||||
PUBLIC :: mp_testall, mp_iscatter, mp_test
|
||||
PUBLIC :: mp_gatherv
|
||||
PUBLIC :: mp_send, mp_recv
|
||||
|
||||
|
|
@ -185,7 +185,11 @@ MODULE message_passing
|
|||
END INTERFACE
|
||||
|
||||
INTERFACE mp_testall
|
||||
MODULE PROCEDURE mp_testall_t2
|
||||
MODULE PROCEDURE mp_testall_tv
|
||||
END INTERFACE
|
||||
|
||||
INTERFACE mp_test
|
||||
MODULE PROCEDURE mp_test_1
|
||||
END INTERFACE
|
||||
|
||||
INTERFACE mp_testany
|
||||
|
|
@ -474,22 +478,24 @@ MODULE message_passing
|
|||
END INTERFACE
|
||||
|
||||
INTERFACE mp_isend
|
||||
MODULE PROCEDURE mp_isend_iv, mp_isend_im2, mp_isend_im3, &
|
||||
mp_isend_lv, mp_isend_lm2, mp_isend_lm3, &
|
||||
mp_isend_rv, mp_isend_rm2, mp_isend_rm3, &
|
||||
mp_isend_dv, mp_isend_dm2, mp_isend_dm3, &
|
||||
mp_isend_cv, mp_isend_cm2, mp_isend_cm3, &
|
||||
mp_isend_zv, mp_isend_zm2, mp_isend_zm3
|
||||
MODULE PROCEDURE mp_isend_iv, mp_isend_im2, mp_isend_im3, mp_isend_im4, &
|
||||
mp_isend_lv, mp_isend_lm2, mp_isend_lm3, mp_isend_lm4, &
|
||||
mp_isend_rv, mp_isend_rm2, mp_isend_rm3, mp_isend_rm4, &
|
||||
mp_isend_dv, mp_isend_dm2, mp_isend_dm3, mp_isend_dm4, &
|
||||
mp_isend_cv, mp_isend_cm2, mp_isend_cm3, mp_isend_cm4, &
|
||||
mp_isend_zv, mp_isend_zm2, mp_isend_zm3, mp_isend_zm4
|
||||
MODULE PROCEDURE mp_isend_bv, mp_isend_bm3
|
||||
MODULE PROCEDURE mp_isend_custom
|
||||
END INTERFACE
|
||||
|
||||
INTERFACE mp_irecv
|
||||
MODULE PROCEDURE mp_irecv_iv, mp_irecv_im2, mp_irecv_im3, &
|
||||
mp_irecv_lv, mp_irecv_lm2, mp_irecv_lm3, &
|
||||
mp_irecv_rv, mp_irecv_rm2, mp_irecv_rm3, &
|
||||
mp_irecv_dv, mp_irecv_dm2, mp_irecv_dm3, &
|
||||
mp_irecv_cv, mp_irecv_cm2, mp_irecv_cm3, &
|
||||
mp_irecv_zv, mp_irecv_zm2, mp_irecv_zm3
|
||||
MODULE PROCEDURE mp_irecv_iv, mp_irecv_im2, mp_irecv_im3, mp_irecv_im4, &
|
||||
mp_irecv_lv, mp_irecv_lm2, mp_irecv_lm3, mp_irecv_lm4, &
|
||||
mp_irecv_rv, mp_irecv_rm2, mp_irecv_rm3, mp_irecv_rm4, &
|
||||
mp_irecv_dv, mp_irecv_dm2, mp_irecv_dm3, mp_irecv_dm4, &
|
||||
mp_irecv_cv, mp_irecv_cm2, mp_irecv_cm3, mp_irecv_cm4, &
|
||||
mp_irecv_zv, mp_irecv_zm2, mp_irecv_zm3, mp_irecv_zm4
|
||||
MODULE PROCEDURE mp_irecv_bv, mp_irecv_bm3
|
||||
MODULE PROCEDURE mp_irecv_custom
|
||||
END INTERFACE
|
||||
|
||||
|
|
@ -1731,37 +1737,60 @@ CONTAINS
|
|||
! **************************************************************************************************
|
||||
!> \brief Tests for completion of the given requests.
|
||||
!> \brief We use mpi_test so that we can use a single status.
|
||||
!> \param requests ...
|
||||
!> \retval flag ...
|
||||
!> \param requests the list of requests to test
|
||||
!> \retval flag logical which determines if requests are complete
|
||||
!> \par History
|
||||
!> 24.2016 created
|
||||
!> 3.2016 adapted to any shape [Nico Holmberg]
|
||||
!> \author Alfio Lazzaro
|
||||
! **************************************************************************************************
|
||||
FUNCTION mp_testall_t2(requests) RESULT(flag)
|
||||
INTEGER, DIMENSION(2), INTENT(inout) :: requests
|
||||
FUNCTION mp_testall_tv(requests) RESULT(flag)
|
||||
INTEGER, DIMENSION(:) :: requests
|
||||
LOGICAL :: flag
|
||||
|
||||
INTEGER :: ierr
|
||||
|
||||
#if defined(__parallel)
|
||||
LOGICAL :: flag1
|
||||
INTEGER :: i
|
||||
LOGICAL, DIMENSION(:), POINTER :: flags
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
flag = .TRUE.
|
||||
|
||||
#if defined(__parallel)
|
||||
CALL mpi_test(requests(1), flag, MPI_STATUS_IGNORE, ierr)
|
||||
IF (ierr /= 0) CALL mp_stop(ierr, "mpi_testall @ mp_testall_t2")
|
||||
!
|
||||
CALL mpi_test(requests(2), flag1, MPI_STATUS_IGNORE, ierr)
|
||||
IF (ierr /= 0) CALL mp_stop(ierr, "mpi_testall @ mp_testall_t2")
|
||||
!
|
||||
flag = flag .AND. flag1
|
||||
ALLOCATE (flags(SIZE(requests)))
|
||||
DO i = 1, SIZE(requests)
|
||||
CALL mpi_test(requests(i), flags(i), MPI_STATUS_IGNORE, ierr)
|
||||
IF (ierr /= 0) CALL mp_stop(ierr, "mpi_testall @ mp_testall_tv")
|
||||
flag = flag .AND. flags(i)
|
||||
END DO
|
||||
DEALLOCATE (flags)
|
||||
#else
|
||||
requests = mp_request_null
|
||||
#endif
|
||||
END FUNCTION mp_testall_t2
|
||||
END FUNCTION mp_testall_tv
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Tests for completion of the given request.
|
||||
!> \param request the request
|
||||
!> \param flag logical which determines if the request is completed
|
||||
!> \par History
|
||||
!> 3.2016 created
|
||||
!> \author Nico Holmberg
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE mp_test_1(request, flag)
|
||||
INTEGER, INTENT(inout) :: request
|
||||
LOGICAL, INTENT(out) :: flag
|
||||
|
||||
INTEGER :: ierr
|
||||
|
||||
ierr = 0
|
||||
|
||||
#if defined(__parallel)
|
||||
CALL mpi_test(request, flag, MPI_STATUS_IGNORE, ierr)
|
||||
IF (ierr /= 0) CALL mp_stop(ierr, "mpi_test @ mp_test_1")
|
||||
#endif
|
||||
END SUBROUTINE mp_test_1
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief tests for completion of the given requests
|
||||
|
|
@ -2160,6 +2189,250 @@ CONTAINS
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_bcast_bv
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Non-blocking send of logical vector data
|
||||
!> \param msgin the input message
|
||||
!> \param dest the destination processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request communication request index
|
||||
!> \param tag message tag
|
||||
!> \par History
|
||||
!> 3.2016 added _bv subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_irecv_iv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE mp_isend_bv(msgin, dest, comm, request, tag)
|
||||
LOGICAL, DIMENSION(:) :: msgin
|
||||
INTEGER, INTENT(IN) :: dest, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_isend_bv', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
LOGICAL :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN, handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime()
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag = tag
|
||||
|
||||
msglen = SIZE(msgin, 1)
|
||||
IF (msglen > 0) THEN
|
||||
CALL mpi_isend(msgin(1), msglen, MPI_LOGICAL, dest, my_tag, &
|
||||
comm, request, ierr)
|
||||
ELSE
|
||||
CALL mpi_isend(foo, msglen, MPI_LOGICAL, dest, my_tag, &
|
||||
comm, request, ierr)
|
||||
END IF
|
||||
IF (ierr /= 0) CALL mp_stop(ierr, "mpi_isend @ "//routineN)
|
||||
|
||||
t_end = m_walltime()
|
||||
CALL add_perf(perf_id=11, count=1, time=t_end-t_start, msg_size=msglen*loglen)
|
||||
#else
|
||||
CPABORT("mp_isend called in non parallel case")
|
||||
MARK_USED(msgin)
|
||||
MARK_USED(dest)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
request = 0
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_bv
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Non-blocking recieve of logical vector data
|
||||
!> \param msgout the received message
|
||||
!> \param source the source processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request communication request index
|
||||
!> \param tag message tag
|
||||
!> \par History
|
||||
!> 3.2016 added _bv subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_irecv_iv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE mp_irecv_bv(msgout, source, comm, request, tag)
|
||||
LOGICAL, DIMENSION(:) :: msgout
|
||||
INTEGER, INTENT(IN) :: source, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_irecv_bv', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
LOGICAL :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN, handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime()
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag = tag
|
||||
|
||||
msglen = SIZE(msgout, 1)
|
||||
IF (msglen > 0) THEN
|
||||
CALL mpi_irecv(msgout(1), msglen, MPI_LOGICAL, source, my_tag, &
|
||||
comm, request, ierr)
|
||||
ELSE
|
||||
CALL mpi_irecv(foo, msglen, MPI_LOGICAL, source, my_tag, &
|
||||
comm, request, ierr)
|
||||
END IF
|
||||
IF (ierr /= 0) CALL mp_stop(ierr, "mpi_ircv @ "//routineN)
|
||||
|
||||
t_end = m_walltime()
|
||||
CALL add_perf(perf_id=12, count=1, time=t_end-t_start, msg_size=msglen*loglen)
|
||||
#else
|
||||
CPABORT("mp_irecv called in non parallel case")
|
||||
MARK_USED(msgout)
|
||||
MARK_USED(source)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
request = 0
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_bv
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Non-blocking send of rank-3 logical data
|
||||
!> \param msgin the input message
|
||||
!> \param dest the destination processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request communication request index
|
||||
!> \param tag message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _bm3 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_irecv_iv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE mp_isend_bm3(msgin, dest, comm, request, tag)
|
||||
LOGICAL, DIMENSION(:, :, :) :: msgin
|
||||
INTEGER, INTENT(IN) :: dest, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_isend_bm3', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
LOGICAL :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN, handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime()
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag = tag
|
||||
|
||||
msglen = SIZE(msgin, 1)*SIZE(msgin, 2)*SIZE(msgin, 3)
|
||||
IF (msglen > 0) THEN
|
||||
CALL mpi_isend(msgin(1, 1, 1), msglen, MPI_LOGICAL, dest, my_tag, &
|
||||
comm, request, ierr)
|
||||
ELSE
|
||||
CALL mpi_isend(foo, msglen, MPI_LOGICAL, dest, my_tag, &
|
||||
comm, request, ierr)
|
||||
END IF
|
||||
IF (ierr /= 0) CALL mp_stop(ierr, "mpi_isend @ "//routineN)
|
||||
|
||||
t_end = m_walltime()
|
||||
CALL add_perf(perf_id=11, count=1, time=t_end-t_start, msg_size=msglen*loglen)
|
||||
#else
|
||||
CPABORT("mp_isend called in non parallel case")
|
||||
MARK_USED(msgin)
|
||||
MARK_USED(dest)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
request = 0
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_bm3
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Non-blocking receive of rank-3 logical data
|
||||
!> \param msgout the received message
|
||||
!> \param source the source processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request communication request index
|
||||
!> \param tag message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _bm3 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_irecv_iv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE mp_irecv_bm3(msgout, source, comm, request, tag)
|
||||
LOGICAL, DIMENSION(:, :, :) :: msgout
|
||||
INTEGER, INTENT(IN) :: source, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_irecv_bm3', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
LOGICAL :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN, handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime()
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag = tag
|
||||
|
||||
msglen = SIZE(msgout, 1)*SIZE(msgout, 2)*SIZE(msgout, 3)
|
||||
IF (msglen > 0) THEN
|
||||
CALL mpi_irecv(msgout(1, 1, 1), msglen, MPI_LOGICAL, source, my_tag, &
|
||||
comm, request, ierr)
|
||||
ELSE
|
||||
CALL mpi_irecv(foo, msglen, MPI_LOGICAL, source, my_tag, &
|
||||
comm, request, ierr)
|
||||
END IF
|
||||
IF (ierr /= 0) CALL mp_stop(ierr, "mpi_ircv @ "//routineN)
|
||||
|
||||
t_end = m_walltime()
|
||||
CALL add_perf(perf_id=12, count=1, time=t_end-t_start, msg_size=msglen*loglen)
|
||||
#else
|
||||
CPABORT("mp_irecv called in non parallel case")
|
||||
MARK_USED(msgout)
|
||||
MARK_USED(source)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
request = 0
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_bm3
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param msg ...
|
||||
|
|
|
|||
|
|
@ -3169,6 +3169,68 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_[nametype1]m3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking send of rank-4 data
|
||||
!> \param msgin the input message
|
||||
!> \param dest the destination processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _[nametype1]m4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_isend_[nametype1]v
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_isend_[nametype1]m4(msgin,dest,comm,request,tag)
|
||||
[type1], DIMENSION(:, :, :, :) :: msgin
|
||||
INTEGER, INTENT(IN) :: dest, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_isend_[nametype1]m4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
[type1] :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgin,1)*SIZE(msgin,2)*SIZE(msgin,3)*SIZE(msgin,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_isend(msgin(1,1,1,1),msglen,[mpi_type1],dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_isend(foo,msglen,[mpi_type1],dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_isend @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=11,count=1,time=t_end-t_start,msg_size=msglen*[bytes1])
|
||||
#else
|
||||
MARK_USED(msgin)
|
||||
MARK_USED(dest)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
ierr=1
|
||||
request=0
|
||||
CALL mp_stop( ierr, "mp_isend called in non parallel case" )
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_[nametype1]m4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of vector data
|
||||
!> \param msgout ...
|
||||
|
|
@ -3356,6 +3418,67 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_[nametype1]m3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of rank-4 data
|
||||
!> \param msgout the output message
|
||||
!> \param source the source processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _[nametype1]m4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_irecv_[nametype1]v
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_irecv_[nametype1]m4(msgout,source,comm,request,tag)
|
||||
[type1], DIMENSION(:, :, :, :) :: msgout
|
||||
INTEGER, INTENT(IN) :: source, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_irecv_[nametype1]m4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
[type1] :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgout,1)*SIZE(msgout,2)*SIZE(msgout,3)*SIZE(msgout,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_irecv(msgout(1,1,1,1),msglen,[mpi_type1],source, my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_irecv(foo,msglen,[mpi_type1],source, my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_ircv @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=12,count=1,time=t_end-t_start,msg_size=msglen*[bytes1])
|
||||
#else
|
||||
MARK_USED(msgout)
|
||||
MARK_USED(source)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
request=0
|
||||
CPABORT("mp_irecv called in non parallel case")
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_[nametype1]m4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Window initialization function for vector data
|
||||
!> \param base ...
|
||||
|
|
|
|||
|
|
@ -3169,6 +3169,68 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_cm3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking send of rank-4 data
|
||||
!> \param msgin the input message
|
||||
!> \param dest the destination processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _cm4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_isend_cv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_isend_cm4(msgin,dest,comm,request,tag)
|
||||
COMPLEX(kind=real_4), DIMENSION(:, :, :, :) :: msgin
|
||||
INTEGER, INTENT(IN) :: dest, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_isend_cm4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
COMPLEX(kind=real_4) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgin,1)*SIZE(msgin,2)*SIZE(msgin,3)*SIZE(msgin,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_isend(msgin(1,1,1,1),msglen,MPI_COMPLEX,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_isend(foo,msglen,MPI_COMPLEX,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_isend @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=11,count=1,time=t_end-t_start,msg_size=msglen*(2*real_4_size))
|
||||
#else
|
||||
MARK_USED(msgin)
|
||||
MARK_USED(dest)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
ierr=1
|
||||
request=0
|
||||
CALL mp_stop( ierr, "mp_isend called in non parallel case" )
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_cm4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of vector data
|
||||
!> \param msgout ...
|
||||
|
|
@ -3356,6 +3418,67 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_cm3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of rank-4 data
|
||||
!> \param msgout the output message
|
||||
!> \param source the source processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _cm4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_irecv_cv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_irecv_cm4(msgout,source,comm,request,tag)
|
||||
COMPLEX(kind=real_4), DIMENSION(:, :, :, :) :: msgout
|
||||
INTEGER, INTENT(IN) :: source, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_irecv_cm4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
COMPLEX(kind=real_4) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgout,1)*SIZE(msgout,2)*SIZE(msgout,3)*SIZE(msgout,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_irecv(msgout(1,1,1,1),msglen,MPI_COMPLEX,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_irecv(foo,msglen,MPI_COMPLEX,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_ircv @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=12,count=1,time=t_end-t_start,msg_size=msglen*(2*real_4_size))
|
||||
#else
|
||||
MARK_USED(msgout)
|
||||
MARK_USED(source)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
request=0
|
||||
CPABORT("mp_irecv called in non parallel case")
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_cm4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Window initialization function for vector data
|
||||
!> \param base ...
|
||||
|
|
|
|||
|
|
@ -3169,6 +3169,68 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_dm3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking send of rank-4 data
|
||||
!> \param msgin the input message
|
||||
!> \param dest the destination processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _dm4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_isend_dv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_isend_dm4(msgin,dest,comm,request,tag)
|
||||
REAL(kind=real_8), DIMENSION(:, :, :, :) :: msgin
|
||||
INTEGER, INTENT(IN) :: dest, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_isend_dm4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
REAL(kind=real_8) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgin,1)*SIZE(msgin,2)*SIZE(msgin,3)*SIZE(msgin,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_isend(msgin(1,1,1,1),msglen,MPI_DOUBLE_PRECISION,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_isend(foo,msglen,MPI_DOUBLE_PRECISION,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_isend @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=11,count=1,time=t_end-t_start,msg_size=msglen*real_8_size)
|
||||
#else
|
||||
MARK_USED(msgin)
|
||||
MARK_USED(dest)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
ierr=1
|
||||
request=0
|
||||
CALL mp_stop( ierr, "mp_isend called in non parallel case" )
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_dm4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of vector data
|
||||
!> \param msgout ...
|
||||
|
|
@ -3356,6 +3418,67 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_dm3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of rank-4 data
|
||||
!> \param msgout the output message
|
||||
!> \param source the source processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _dm4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_irecv_dv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_irecv_dm4(msgout,source,comm,request,tag)
|
||||
REAL(kind=real_8), DIMENSION(:, :, :, :) :: msgout
|
||||
INTEGER, INTENT(IN) :: source, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_irecv_dm4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
REAL(kind=real_8) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgout,1)*SIZE(msgout,2)*SIZE(msgout,3)*SIZE(msgout,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_irecv(msgout(1,1,1,1),msglen,MPI_DOUBLE_PRECISION,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_irecv(foo,msglen,MPI_DOUBLE_PRECISION,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_ircv @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=12,count=1,time=t_end-t_start,msg_size=msglen*real_8_size)
|
||||
#else
|
||||
MARK_USED(msgout)
|
||||
MARK_USED(source)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
request=0
|
||||
CPABORT("mp_irecv called in non parallel case")
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_dm4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Window initialization function for vector data
|
||||
!> \param base ...
|
||||
|
|
|
|||
|
|
@ -3169,6 +3169,68 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_im3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking send of rank-4 data
|
||||
!> \param msgin the input message
|
||||
!> \param dest the destination processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _im4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_isend_iv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_isend_im4(msgin,dest,comm,request,tag)
|
||||
INTEGER(KIND=int_4), DIMENSION(:, :, :, :) :: msgin
|
||||
INTEGER, INTENT(IN) :: dest, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_isend_im4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
INTEGER(KIND=int_4) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgin,1)*SIZE(msgin,2)*SIZE(msgin,3)*SIZE(msgin,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_isend(msgin(1,1,1,1),msglen,MPI_INTEGER,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_isend(foo,msglen,MPI_INTEGER,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_isend @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=11,count=1,time=t_end-t_start,msg_size=msglen*int_4_size)
|
||||
#else
|
||||
MARK_USED(msgin)
|
||||
MARK_USED(dest)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
ierr=1
|
||||
request=0
|
||||
CALL mp_stop( ierr, "mp_isend called in non parallel case" )
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_im4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of vector data
|
||||
!> \param msgout ...
|
||||
|
|
@ -3356,6 +3418,67 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_im3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of rank-4 data
|
||||
!> \param msgout the output message
|
||||
!> \param source the source processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _im4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_irecv_iv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_irecv_im4(msgout,source,comm,request,tag)
|
||||
INTEGER(KIND=int_4), DIMENSION(:, :, :, :) :: msgout
|
||||
INTEGER, INTENT(IN) :: source, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_irecv_im4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
INTEGER(KIND=int_4) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgout,1)*SIZE(msgout,2)*SIZE(msgout,3)*SIZE(msgout,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_irecv(msgout(1,1,1,1),msglen,MPI_INTEGER,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_irecv(foo,msglen,MPI_INTEGER,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_ircv @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=12,count=1,time=t_end-t_start,msg_size=msglen*int_4_size)
|
||||
#else
|
||||
MARK_USED(msgout)
|
||||
MARK_USED(source)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
request=0
|
||||
CPABORT("mp_irecv called in non parallel case")
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_im4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Window initialization function for vector data
|
||||
!> \param base ...
|
||||
|
|
|
|||
|
|
@ -3169,6 +3169,68 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_lm3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking send of rank-4 data
|
||||
!> \param msgin the input message
|
||||
!> \param dest the destination processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _lm4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_isend_lv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_isend_lm4(msgin,dest,comm,request,tag)
|
||||
INTEGER(KIND=int_8), DIMENSION(:, :, :, :) :: msgin
|
||||
INTEGER, INTENT(IN) :: dest, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_isend_lm4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
INTEGER(KIND=int_8) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgin,1)*SIZE(msgin,2)*SIZE(msgin,3)*SIZE(msgin,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_isend(msgin(1,1,1,1),msglen,MPI_INTEGER8,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_isend(foo,msglen,MPI_INTEGER8,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_isend @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=11,count=1,time=t_end-t_start,msg_size=msglen*int_8_size)
|
||||
#else
|
||||
MARK_USED(msgin)
|
||||
MARK_USED(dest)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
ierr=1
|
||||
request=0
|
||||
CALL mp_stop( ierr, "mp_isend called in non parallel case" )
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_lm4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of vector data
|
||||
!> \param msgout ...
|
||||
|
|
@ -3356,6 +3418,67 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_lm3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of rank-4 data
|
||||
!> \param msgout the output message
|
||||
!> \param source the source processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _lm4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_irecv_lv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_irecv_lm4(msgout,source,comm,request,tag)
|
||||
INTEGER(KIND=int_8), DIMENSION(:, :, :, :) :: msgout
|
||||
INTEGER, INTENT(IN) :: source, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_irecv_lm4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
INTEGER(KIND=int_8) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgout,1)*SIZE(msgout,2)*SIZE(msgout,3)*SIZE(msgout,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_irecv(msgout(1,1,1,1),msglen,MPI_INTEGER8,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_irecv(foo,msglen,MPI_INTEGER8,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_ircv @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=12,count=1,time=t_end-t_start,msg_size=msglen*int_8_size)
|
||||
#else
|
||||
MARK_USED(msgout)
|
||||
MARK_USED(source)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
request=0
|
||||
CPABORT("mp_irecv called in non parallel case")
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_lm4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Window initialization function for vector data
|
||||
!> \param base ...
|
||||
|
|
|
|||
|
|
@ -3169,6 +3169,68 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_rm3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking send of rank-4 data
|
||||
!> \param msgin the input message
|
||||
!> \param dest the destination processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _rm4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_isend_rv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_isend_rm4(msgin,dest,comm,request,tag)
|
||||
REAL(kind=real_4), DIMENSION(:, :, :, :) :: msgin
|
||||
INTEGER, INTENT(IN) :: dest, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_isend_rm4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
REAL(kind=real_4) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgin,1)*SIZE(msgin,2)*SIZE(msgin,3)*SIZE(msgin,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_isend(msgin(1,1,1,1),msglen,MPI_REAL,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_isend(foo,msglen,MPI_REAL,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_isend @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=11,count=1,time=t_end-t_start,msg_size=msglen*real_4_size)
|
||||
#else
|
||||
MARK_USED(msgin)
|
||||
MARK_USED(dest)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
ierr=1
|
||||
request=0
|
||||
CALL mp_stop( ierr, "mp_isend called in non parallel case" )
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_rm4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of vector data
|
||||
!> \param msgout ...
|
||||
|
|
@ -3356,6 +3418,67 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_rm3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of rank-4 data
|
||||
!> \param msgout the output message
|
||||
!> \param source the source processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _rm4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_irecv_rv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_irecv_rm4(msgout,source,comm,request,tag)
|
||||
REAL(kind=real_4), DIMENSION(:, :, :, :) :: msgout
|
||||
INTEGER, INTENT(IN) :: source, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_irecv_rm4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
REAL(kind=real_4) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgout,1)*SIZE(msgout,2)*SIZE(msgout,3)*SIZE(msgout,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_irecv(msgout(1,1,1,1),msglen,MPI_REAL,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_irecv(foo,msglen,MPI_REAL,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_ircv @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=12,count=1,time=t_end-t_start,msg_size=msglen*real_4_size)
|
||||
#else
|
||||
MARK_USED(msgout)
|
||||
MARK_USED(source)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
request=0
|
||||
CPABORT("mp_irecv called in non parallel case")
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_rm4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Window initialization function for vector data
|
||||
!> \param base ...
|
||||
|
|
|
|||
|
|
@ -3169,6 +3169,68 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_zm3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking send of rank-4 data
|
||||
!> \param msgin the input message
|
||||
!> \param dest the destination processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _zm4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_isend_zv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_isend_zm4(msgin,dest,comm,request,tag)
|
||||
COMPLEX(kind=real_8), DIMENSION(:, :, :, :) :: msgin
|
||||
INTEGER, INTENT(IN) :: dest, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_isend_zm4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
COMPLEX(kind=real_8) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgin,1)*SIZE(msgin,2)*SIZE(msgin,3)*SIZE(msgin,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_isend(msgin(1,1,1,1),msglen,MPI_DOUBLE_COMPLEX,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_isend(foo,msglen,MPI_DOUBLE_COMPLEX,dest,my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_isend @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=11,count=1,time=t_end-t_start,msg_size=msglen*(2*real_8_size))
|
||||
#else
|
||||
MARK_USED(msgin)
|
||||
MARK_USED(dest)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
ierr=1
|
||||
request=0
|
||||
CALL mp_stop( ierr, "mp_isend called in non parallel case" )
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_isend_zm4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of vector data
|
||||
!> \param msgout ...
|
||||
|
|
@ -3356,6 +3418,67 @@
|
|||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_zm3
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Non-blocking receive of rank-4 data
|
||||
!> \param msgout the output message
|
||||
!> \param source the source processor
|
||||
!> \param comm the communicator object
|
||||
!> \param request the communication request id
|
||||
!> \param tag the message tag
|
||||
!> \par History
|
||||
!> 2.2016 added _zm4 subroutine [Nico Holmberg]
|
||||
!> \author fawzi
|
||||
!> \note see mp_irecv_zv
|
||||
!> \note
|
||||
!> arrays can be pointers or assumed shape, but they must be contiguous!
|
||||
! *****************************************************************************
|
||||
SUBROUTINE mp_irecv_zm4(msgout,source,comm,request,tag)
|
||||
COMPLEX(kind=real_8), DIMENSION(:, :, :, :) :: msgout
|
||||
INTEGER, INTENT(IN) :: source, comm
|
||||
INTEGER, INTENT(out) :: request
|
||||
INTEGER, INTENT(in), OPTIONAL :: tag
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'mp_irecv_zm4', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ierr
|
||||
#if defined(__parallel)
|
||||
INTEGER :: msglen, my_tag
|
||||
COMPLEX(kind=real_8) :: foo(1)
|
||||
#endif
|
||||
|
||||
ierr = 0
|
||||
CALL mp_timeset(routineN,handle)
|
||||
|
||||
#if defined(__parallel)
|
||||
t_start = m_walltime ( )
|
||||
my_tag = 0
|
||||
IF (PRESENT(tag)) my_tag=tag
|
||||
|
||||
msglen = SIZE(msgout,1)*SIZE(msgout,2)*SIZE(msgout,3)*SIZE(msgout,4)
|
||||
IF (msglen>0) THEN
|
||||
CALL mpi_irecv(msgout(1,1,1,1),msglen,MPI_DOUBLE_COMPLEX,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
ELSE
|
||||
CALL mpi_irecv(foo,msglen,MPI_DOUBLE_COMPLEX,source, my_tag,&
|
||||
comm,request,ierr)
|
||||
END IF
|
||||
IF ( ierr /= 0 ) CALL mp_stop( ierr, "mpi_ircv @ "//routineN )
|
||||
|
||||
t_end = m_walltime ( )
|
||||
CALL add_perf(perf_id=12,count=1,time=t_end-t_start,msg_size=msglen*(2*real_8_size))
|
||||
#else
|
||||
MARK_USED(msgout)
|
||||
MARK_USED(source)
|
||||
MARK_USED(comm)
|
||||
MARK_USED(request)
|
||||
MARK_USED(tag)
|
||||
request=0
|
||||
CPABORT("mp_irecv called in non parallel case")
|
||||
#endif
|
||||
CALL mp_timestop(handle)
|
||||
END SUBROUTINE mp_irecv_zm4
|
||||
|
||||
! *****************************************************************************
|
||||
!> \brief Window initialization function for vector data
|
||||
!> \param base ...
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ MODULE pw_methods
|
|||
PUBLIC :: pw_derive, pw_dr2, pw_write
|
||||
PUBLIC :: pw_integral_ab, pw_integral_a2b
|
||||
PUBLIC :: pw_dr2_gg, pw_integrate_function
|
||||
PUBLIC :: pw_set
|
||||
|
||||
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'pw_methods'
|
||||
LOGICAL, PARAMETER, PRIVATE :: debug_this_module = .FALSE.
|
||||
|
|
@ -1953,5 +1954,51 @@ CONTAINS
|
|||
|
||||
END FUNCTION pw_integrate_function
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Initialize pw values using values from a real array data, which might be defined on a
|
||||
!> smaller grid than pw but which is contained in it
|
||||
!> \param pw the pw to initialize
|
||||
!> \param values the array holding the input data
|
||||
!> \par History
|
||||
!> Created 12.2016
|
||||
!> \author Nico Holmberg
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE pw_set(pw, values)
|
||||
|
||||
TYPE(pw_type), INTENT(INOUT) :: pw
|
||||
REAL(KIND=dp), DIMENSION(:, :, :), INTENT(IN), &
|
||||
POINTER :: values
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'pw_set', routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, i, j, k
|
||||
LOGICAL :: is_match
|
||||
|
||||
CALL timeset(routineN, handle)
|
||||
CPASSERT(pw%ref_count > 0)
|
||||
IF (pw%in_use == REALDATA3D) THEN
|
||||
is_match = .TRUE.
|
||||
is_match = is_match .AND. (LBOUND(values, 1) .GE. LBOUND(pw%cr3d, 1))
|
||||
is_match = is_match .AND. (UBOUND(values, 1) .LE. UBOUND(pw%cr3d, 1))
|
||||
is_match = is_match .AND. (LBOUND(values, 2) .GE. LBOUND(pw%cr3d, 2))
|
||||
is_match = is_match .AND. (UBOUND(values, 2) .LE. UBOUND(pw%cr3d, 2))
|
||||
is_match = is_match .AND. (LBOUND(values, 3) .GE. LBOUND(pw%cr3d, 3))
|
||||
is_match = is_match .AND. (UBOUND(values, 3) .LE. UBOUND(pw%cr3d, 3))
|
||||
IF (.NOT. is_match) &
|
||||
CPABORT("Incompatible data fields")
|
||||
DO i = LBOUND(values, 3), UBOUND(values, 3)
|
||||
DO j = LBOUND(values, 2), UBOUND(values, 2)
|
||||
DO k = LBOUND(values, 1), UBOUND(values, 1)
|
||||
pw%cr3d(k, j, i) = values(k, j, i)
|
||||
END DO
|
||||
END DO
|
||||
END DO
|
||||
ELSE
|
||||
CPABORT("Illegal pw type, should be REALDATA3D.")
|
||||
END IF
|
||||
CALL timestop(handle)
|
||||
|
||||
END SUBROUTINE pw_set
|
||||
|
||||
END MODULE pw_methods
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ MODULE qs_energy_init
|
|||
dbcsr_type
|
||||
USE efield_utils, ONLY: calculate_ecore_efield
|
||||
USE input_constants, ONLY: kg_tnadd_atomic,&
|
||||
kg_tnadd_embed
|
||||
kg_tnadd_embed,&
|
||||
outer_scf_hirshfeld_constraint
|
||||
USE input_section_types, ONLY: section_vals_type
|
||||
USE kg_environment, ONLY: kg_build_neighborlist,&
|
||||
kg_build_subsets
|
||||
|
|
@ -251,7 +252,12 @@ CONTAINS
|
|||
CALL kpoint_init_cell_index(kpoints, sab_nl, para_env, dft_control)
|
||||
ENDIF
|
||||
|
||||
dft_control%qs_control%becke_control%need_pot = .TRUE.
|
||||
IF (.NOT. dft_control%qs_control%becke_control%external_control) &
|
||||
dft_control%qs_control%becke_control%need_pot = .TRUE.
|
||||
IF (dft_control%qs_control%cdft) THEN
|
||||
IF (dft_control%qs_control%cdft_control%type == outer_scf_hirshfeld_constraint) &
|
||||
dft_control%qs_control%cdft_control%need_pot = .TRUE.
|
||||
END IF
|
||||
|
||||
! Calculate the overlap and the core Hamiltonian integral matrix
|
||||
IF (dft_control%qs_control%semi_empirical) THEN
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ MODULE qs_energy_types
|
|||
qmmm_nu, &
|
||||
mulliken, &
|
||||
becke, &
|
||||
cdft, &
|
||||
ee, &
|
||||
ee_core, &
|
||||
efield, &
|
||||
|
|
@ -172,6 +173,7 @@ CONTAINS
|
|||
qs_energy%image_charge = 0.0_dp
|
||||
qs_energy%mulliken = 0.0_dp
|
||||
qs_energy%becke = 0.0_dp
|
||||
qs_energy%cdft = 0.0_dp
|
||||
qs_energy%efield = 0.0_dp
|
||||
qs_energy%efield_core = 0.0_dp
|
||||
qs_energy%ee = 0.0_dp
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ MODULE qs_environment_types
|
|||
set_hartree_local
|
||||
USE hfx_types, ONLY: hfx_release,&
|
||||
hfx_type
|
||||
USE input_constants, ONLY: energy_force_run,&
|
||||
energy_run
|
||||
USE input_section_types, ONLY: section_vals_release,&
|
||||
section_vals_retain,&
|
||||
section_vals_type
|
||||
|
|
@ -219,6 +221,7 @@ MODULE qs_environment_types
|
|||
LOGICAL :: linres_run
|
||||
LOGICAL :: calc_image_preconditioner
|
||||
LOGICAL :: do_transport
|
||||
LOGICAL :: single_point_run
|
||||
REAL(KIND=dp) :: sim_time
|
||||
REAL(KIND=dp) :: start_time, target_time
|
||||
REAL(KIND=dp), DIMENSION(:, :), POINTER :: image_matrix
|
||||
|
|
@ -871,6 +874,7 @@ CONTAINS
|
|||
qs_env%id_nr = last_qs_env_id_nr
|
||||
qs_env%run_rtp = .FALSE.
|
||||
qs_env%linres_run = .FALSE.
|
||||
qs_env%single_point_run = .FALSE.
|
||||
qs_env%qmmm = .FALSE.
|
||||
qs_env%qmmm_periodic = .FALSE.
|
||||
qs_env%requires_mo_derivs = .FALSE.
|
||||
|
|
@ -881,6 +885,8 @@ CONTAINS
|
|||
IF (PRESENT(globenv)) THEN
|
||||
qs_env%target_time = globenv%cp2k_target_time
|
||||
qs_env%start_time = globenv%cp2k_start_time
|
||||
qs_env%single_point_run = (globenv%run_type_id == energy_run .OR. &
|
||||
globenv%run_type_id == energy_force_run)
|
||||
ELSE
|
||||
qs_env%target_time = 0.0_dp
|
||||
qs_env%start_time = 0.0_dp
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ MODULE qs_force
|
|||
dbcsr_set
|
||||
USE dft_plus_u, ONLY: plus_u
|
||||
USE efield_utils, ONLY: calculate_ecore_efield
|
||||
USE input_constants, ONLY: do_admm_purify_none
|
||||
USE input_constants, ONLY: do_admm_purify_none,&
|
||||
outer_scf_hirshfeld_constraint
|
||||
USE input_section_types, ONLY: section_vals_get_subs_vals,&
|
||||
section_vals_type,&
|
||||
section_vals_val_get
|
||||
|
|
@ -179,10 +180,11 @@ CONTAINS
|
|||
atom_of_kind=atom_of_kind, &
|
||||
kind_of=kind_of)
|
||||
|
||||
NULLIFY (force, subsys)
|
||||
NULLIFY (force, subsys, dft_control)
|
||||
CALL get_qs_env(qs_env, &
|
||||
force=force, &
|
||||
subsys=subsys)
|
||||
subsys=subsys, &
|
||||
dft_control=dft_control)
|
||||
IF (.NOT. ASSOCIATED(force)) THEN
|
||||
! *** Allocate the force data structure ***
|
||||
nkind = SIZE(atomic_kind_set)
|
||||
|
|
@ -195,15 +197,23 @@ CONTAINS
|
|||
END IF
|
||||
CALL zero_qs_force(force)
|
||||
|
||||
! Check if Becke potential is needed and save it until forces have been calculated
|
||||
IF (dft_control%qs_control%becke_restraint) &
|
||||
dft_control%qs_control%becke_control%save_pot = .TRUE.
|
||||
|
||||
IF (dft_control%qs_control%cdft) THEN
|
||||
IF (dft_control%qs_control%cdft_control%type == outer_scf_hirshfeld_constraint) &
|
||||
dft_control%qs_control%cdft_control%save_pot = .TRUE.
|
||||
END IF
|
||||
|
||||
! Set parameter for P screening with MP2
|
||||
IF (ASSOCIATED(qs_env%mp2_env)) qs_env%mp2_env%not_last_hfx = .TRUE.
|
||||
|
||||
! recalculate energy with forces
|
||||
CALL qs_energies(qs_env, calc_forces=.TRUE.)
|
||||
|
||||
NULLIFY (dft_control, para_env)
|
||||
NULLIFY (para_env)
|
||||
CALL get_qs_env(qs_env, &
|
||||
dft_control=dft_control, &
|
||||
para_env=para_env)
|
||||
|
||||
! Now we handle some special cases
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
! **************************************************************************************************
|
||||
MODULE qs_ks_apply_restraints
|
||||
USE cp_control_types, ONLY: becke_restraint_type,&
|
||||
cdft_control_type,&
|
||||
dft_control_type
|
||||
USE cp_dbcsr_operations, ONLY: copy_dbcsr_to_fm,&
|
||||
copy_fm_to_dbcsr
|
||||
|
|
@ -18,7 +19,14 @@ MODULE qs_ks_apply_restraints
|
|||
USE dbcsr_api, ONLY: dbcsr_copy,&
|
||||
dbcsr_p_type,&
|
||||
dbcsr_set
|
||||
USE et_coupling, ONLY: becke_restraint
|
||||
USE et_coupling, ONLY: becke_restraint,&
|
||||
hirshfeld_constraint
|
||||
USE input_constants, ONLY: cdft_combined_acceptor,&
|
||||
cdft_combined_all,&
|
||||
cdft_combined_constraint,&
|
||||
cdft_combined_donor,&
|
||||
outer_scf_becke_constraint,&
|
||||
outer_scf_hirshfeld_constraint
|
||||
USE kinds, ONLY: dp
|
||||
USE mulliken, ONLY: mulliken_restraint
|
||||
USE pw_methods, ONLY: pw_scale
|
||||
|
|
@ -45,16 +53,17 @@ MODULE qs_ks_apply_restraints
|
|||
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_ks_apply_restraints'
|
||||
|
||||
PUBLIC :: qs_ks_becke_restraint, qs_ks_mulliken_restraint, qs_ks_s2_restraint
|
||||
PUBLIC :: qs_ks_cdft_constraint
|
||||
|
||||
CONTAINS
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param qs_env ...
|
||||
!> \param auxbas_pw_pool ...
|
||||
!> \param calculate_forces ...
|
||||
!> \param matrix_s ...
|
||||
!> \param becke ...
|
||||
!> \brief Apply a Becke constraint
|
||||
!> \param qs_env the qs_env where to apply the constraint
|
||||
!> \param auxbas_pw_pool the pool that owns the real space grid where the Becke potential is defined
|
||||
!> \param calculate_forces if forces should be calculated
|
||||
!> \param matrix_s the overlap matrix
|
||||
!> \param becke the Becke control type
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE qs_ks_becke_restraint(qs_env, auxbas_pw_pool, calculate_forces, matrix_s, becke)
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
|
|
@ -66,6 +75,7 @@ CONTAINS
|
|||
CHARACTER(LEN=*), PARAMETER :: routineN = 'qs_ks_becke_restraint', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: iatom
|
||||
REAL(KIND=dp) :: inv_vol
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
|
||||
|
|
@ -77,22 +87,56 @@ CONTAINS
|
|||
CPASSERT(SIZE(matrix_s, 2) == 1)
|
||||
!***** Check if becke potential is needed to constrain charges *****
|
||||
becke => dft_control%qs_control%becke_control
|
||||
IF (becke%need_pot .OR. calculate_forces) THEN
|
||||
CALL pw_pool_create_pw(auxbas_pw_pool, becke%becke_pot%pw, use_data=REALDATA3D, &
|
||||
in_space=REALSPACE)
|
||||
CALL becke_restraint(qs_env, becke_const=becke%becke_pot, calc_pot=.TRUE., &
|
||||
calculate_forces=calculate_forces)
|
||||
IF (becke%need_pot) THEN
|
||||
CALL pw_pool_create_pw(auxbas_pw_pool, becke%becke_pot%pw, &
|
||||
use_data=REALDATA3D, in_space=REALSPACE)
|
||||
IF (becke%atomic_charges) THEN
|
||||
DO iatom = 1, becke%natoms
|
||||
CALL pw_pool_create_pw(auxbas_pw_pool, becke%charge(iatom)%pw, &
|
||||
use_data=REALDATA3D, in_space=REALSPACE)
|
||||
END DO
|
||||
END IF
|
||||
CALL becke_restraint(qs_env, becke_const=becke%becke_pot, charge=becke%charge, &
|
||||
calc_pot=.TRUE., calculate_forces=calculate_forces)
|
||||
CALL pw_scale(becke%becke_pot%pw, becke%becke_pot%pw%pw_grid%dvol)
|
||||
IF (dft_control%qs_control%becke_control%constraint_type == cdft_combined_constraint) THEN
|
||||
SELECT CASE (dft_control%qs_control%becke_control%combined_type)
|
||||
CASE (cdft_combined_all)
|
||||
! Do nothing
|
||||
CASE (cdft_combined_acceptor, cdft_combined_donor)
|
||||
CALL pw_scale(becke%combined_weight%pw, becke%becke_pot%pw%pw_grid%dvol)
|
||||
END SELECT
|
||||
END IF
|
||||
becke%need_pot = .FALSE.
|
||||
ELSE
|
||||
inv_vol = 1.0_dp/becke%becke_pot%pw%pw_grid%dvol
|
||||
CALL pw_scale(becke%becke_pot%pw, inv_vol)
|
||||
CALL becke_restraint(qs_env, becke%becke_pot, calc_pot=.FALSE., &
|
||||
IF (dft_control%qs_control%becke_control%constraint_type == cdft_combined_constraint) THEN
|
||||
SELECT CASE (dft_control%qs_control%becke_control%combined_type)
|
||||
CASE (cdft_combined_all)
|
||||
! Do nothing
|
||||
CASE (cdft_combined_acceptor, cdft_combined_donor)
|
||||
IF (.NOT. ASSOCIATED(becke%combined_mat)) &
|
||||
CALL pw_scale(becke%combined_weight%pw, inv_vol)
|
||||
END SELECT
|
||||
END IF
|
||||
CALL becke_restraint(qs_env, becke%becke_pot, charge=becke%charge, calc_pot=.FALSE., &
|
||||
calculate_forces=calculate_forces)
|
||||
CALL pw_scale(becke%becke_pot%pw, becke%becke_pot%pw%pw_grid%dvol)
|
||||
ENDIF
|
||||
IF (dft_control%qs_control%becke_control%constraint_type == cdft_combined_constraint) THEN
|
||||
SELECT CASE (dft_control%qs_control%becke_control%combined_type)
|
||||
CASE (cdft_combined_all)
|
||||
! Do nothing
|
||||
CASE (cdft_combined_acceptor, cdft_combined_donor)
|
||||
CALL pw_scale(becke%combined_weight%pw, becke%becke_pot%pw%pw_grid%dvol)
|
||||
END SELECT
|
||||
END IF
|
||||
END IF
|
||||
|
||||
IF (dft_control%qs_control%et_coupling_calc) THEN
|
||||
! Combined constraint not allowed
|
||||
IF (becke%constraint_type == cdft_combined_constraint) &
|
||||
CPABORT("Use MIXED_CDFT for ET coupling calculation with combined constraint.")
|
||||
IF (qs_env%et_coupling%keep_matrix) THEN
|
||||
IF (qs_env%et_coupling%first_run) THEN
|
||||
NULLIFY (qs_env%et_coupling%rest_mat(1)%matrix)
|
||||
|
|
@ -103,8 +147,8 @@ CONTAINS
|
|||
CALL integrate_v_rspace(becke%becke_pot, &
|
||||
hmat=qs_env%et_coupling%rest_mat(1), &
|
||||
qs_env=qs_env, calculate_forces=.FALSE.)
|
||||
qs_env%et_coupling%order_p = dft_control%qs_control%becke_control%becke_order_p
|
||||
qs_env%et_coupling%e1 = dft_control%qs_control%becke_control%strength
|
||||
qs_env%et_coupling%order_p = dft_control%qs_control%becke_control%becke_order_p(1)
|
||||
qs_env%et_coupling%e1 = dft_control%qs_control%becke_control%strength(1)
|
||||
qs_env%et_coupling%keep_matrix = .FALSE.
|
||||
ELSE
|
||||
NULLIFY (qs_env%et_coupling%rest_mat(2)%matrix)
|
||||
|
|
@ -122,6 +166,52 @@ CONTAINS
|
|||
END IF
|
||||
END SUBROUTINE qs_ks_becke_restraint
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Apply a CDFT constraint
|
||||
!> \param qs_env the qs_env where to apply the constraint
|
||||
!> \param auxbas_pw_pool the pool that owns the real space grid where the CDFT potential is defined
|
||||
!> \param calculate_forces if forces should be calculated
|
||||
!> \param cdft_control the CDFT control type
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE qs_ks_cdft_constraint(qs_env, auxbas_pw_pool, calculate_forces, cdft_control)
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
|
||||
LOGICAL, INTENT(in) :: calculate_forces
|
||||
TYPE(cdft_control_type), POINTER :: cdft_control
|
||||
|
||||
CHARACTER(LEN=*), PARAMETER :: routineN = 'qs_ks_cdft_constraint', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
REAL(KIND=dp) :: inv_vol
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
|
||||
NULLIFY (dft_control)
|
||||
CALL get_qs_env(qs_env, dft_control=dft_control)
|
||||
IF (dft_control%qs_control%cdft) THEN
|
||||
cdft_control => dft_control%qs_control%cdft_control
|
||||
SELECT CASE (cdft_control%type)
|
||||
CASE (outer_scf_hirshfeld_constraint)
|
||||
IF (cdft_control%need_pot) THEN
|
||||
CALL pw_pool_create_pw(auxbas_pw_pool, cdft_control%weight%pw, use_data=REALDATA3D, &
|
||||
in_space=REALSPACE)
|
||||
CALL hirshfeld_constraint(qs_env, cdft_control, calc_pot=.TRUE., &
|
||||
calculate_forces=calculate_forces)
|
||||
CALL pw_scale(cdft_control%weight%pw, cdft_control%weight%pw%pw_grid%dvol)
|
||||
cdft_control%need_pot = .FALSE.
|
||||
ELSE
|
||||
inv_vol = 1.0_dp/cdft_control%weight%pw%pw_grid%dvol
|
||||
CALL pw_scale(cdft_control%weight%pw, inv_vol)
|
||||
CALL hirshfeld_constraint(qs_env, cdft_control, calc_pot=.FALSE., &
|
||||
calculate_forces=calculate_forces)
|
||||
CALL pw_scale(cdft_control%weight%pw, cdft_control%weight%pw%pw_grid%dvol)
|
||||
END IF
|
||||
CASE (outer_scf_becke_constraint)
|
||||
! Do nothing, yet. Case handled by separate call to qs_ks_becke_restraint
|
||||
END SELECT
|
||||
END IF
|
||||
|
||||
END SUBROUTINE qs_ks_cdft_constraint
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param energy ...
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ MODULE qs_ks_methods
|
|||
USE cell_types, ONLY: cell_type
|
||||
USE cp_blacs_env, ONLY: cp_blacs_env_type
|
||||
USE cp_control_types, ONLY: becke_restraint_type,&
|
||||
cdft_control_type,&
|
||||
dft_control_type
|
||||
USE cp_dbcsr_cp2k_link, ONLY: cp_dbcsr_alloc_block_from_nbl
|
||||
USE cp_dbcsr_operations, ONLY: copy_dbcsr_to_fm,&
|
||||
|
|
@ -66,7 +67,12 @@ MODULE qs_ks_methods
|
|||
USE hartree_local_methods, ONLY: Vh_1c_gg_integrals
|
||||
USE hfx_admm_utils, ONLY: hfx_admm_init,&
|
||||
hfx_ks_matrix
|
||||
USE input_constants, ONLY: do_ppl_grid
|
||||
USE input_constants, ONLY: cdft_combined_acceptor,&
|
||||
cdft_combined_all,&
|
||||
cdft_combined_constraint,&
|
||||
cdft_combined_donor,&
|
||||
do_ppl_grid,&
|
||||
outer_scf_hirshfeld_constraint
|
||||
USE input_section_types, ONLY: section_vals_get,&
|
||||
section_vals_get_subs_vals,&
|
||||
section_vals_type,&
|
||||
|
|
@ -120,6 +126,7 @@ MODULE qs_ks_methods
|
|||
integrate_v_core_rspace,&
|
||||
integrate_v_rspace_one_center
|
||||
USE qs_ks_apply_restraints, ONLY: qs_ks_becke_restraint,&
|
||||
qs_ks_cdft_constraint,&
|
||||
qs_ks_mulliken_restraint,&
|
||||
qs_ks_s2_restraint
|
||||
USE qs_ks_atom, ONLY: update_ks_atom
|
||||
|
|
@ -216,7 +223,8 @@ CONTAINS
|
|||
routineP = moduleN//':'//routineN
|
||||
|
||||
CHARACTER(len=default_string_length) :: name
|
||||
INTEGER :: handle, img, ispin, nimages, ns, nspins
|
||||
INTEGER :: handle, iatom, img, ispin, nimages, ns, &
|
||||
nspins
|
||||
LOGICAL :: do_adiabatic_rescaling, do_ddapc, do_hfx, do_ppl, gapw, gapw_xc, &
|
||||
hfx_treat_lsd_in_core, just_energy_xc, my_print, use_virial
|
||||
REAL(KIND=dp) :: ecore_ppl, edisp, ee_ener, ekin_mol, &
|
||||
|
|
@ -224,6 +232,7 @@ CONTAINS
|
|||
REAL(KIND=dp), DIMENSION(3, 3) :: h_stress
|
||||
TYPE(admm_type), POINTER :: admm_env
|
||||
TYPE(becke_restraint_type), POINTER :: becke
|
||||
TYPE(cdft_control_type), POINTER :: cdft_control
|
||||
TYPE(cell_type), POINTER :: cell
|
||||
TYPE(cp_logger_type), POINTER :: logger
|
||||
TYPE(cp_para_env_type), POINTER :: para_env
|
||||
|
|
@ -458,6 +467,9 @@ CONTAINS
|
|||
! Check if becke potential is needed to constrain charges
|
||||
CALL qs_ks_becke_restraint(qs_env, auxbas_pw_pool, calculate_forces, matrix_s, becke)
|
||||
|
||||
! Check if CDFT constraint is needed
|
||||
CALL qs_ks_cdft_constraint(qs_env, auxbas_pw_pool, calculate_forces, cdft_control)
|
||||
|
||||
! Adds the External Potential if requested
|
||||
IF (dft_control%apply_external_potential) THEN
|
||||
! Compute the energy due to the external potential
|
||||
|
|
@ -653,7 +665,7 @@ CONTAINS
|
|||
CALL sum_up_and_integrate(qs_env, ks_matrix, rho, my_rho, vppl_rspace, &
|
||||
v_rspace_new, v_rspace_new_aux_fit, v_tau_rspace, v_tau_rspace_aux_fit, &
|
||||
v_efield_rspace, v_sic_rspace, v_spin_ddapc_rest_r, v_sccs_rspace, becke, &
|
||||
calculate_forces)
|
||||
cdft_control, calculate_forces)
|
||||
|
||||
IF (dft_control%qs_control%do_kg) THEN
|
||||
CPASSERT(nimages == 1)
|
||||
|
|
@ -676,6 +688,41 @@ CONTAINS
|
|||
|
||||
IF (calculate_forces .AND. dft_control%qs_control%becke_restraint) THEN
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, becke%becke_pot%pw)
|
||||
IF (dft_control%qs_control%becke_control%atomic_charges) THEN
|
||||
DO iatom = 1, dft_control%qs_control%becke_control%natoms
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, &
|
||||
dft_control%qs_control%becke_control%charge(iatom)%pw)
|
||||
END DO
|
||||
END IF
|
||||
IF (dft_control%qs_control%becke_control%cavity_confine) THEN
|
||||
IF (.NOT. ASSOCIATED(becke%cavity_mat)) THEN
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, becke%cavity%pw)
|
||||
ELSE
|
||||
DEALLOCATE (becke%cavity_mat)
|
||||
END IF
|
||||
END IF
|
||||
IF (ASSOCIATED(dft_control%qs_control%becke_control%charges_fragment)) &
|
||||
DEALLOCATE (dft_control%qs_control%becke_control%charges_fragment)
|
||||
IF (dft_control%qs_control%becke_control%constraint_type == cdft_combined_constraint) THEN
|
||||
SELECT CASE (dft_control%qs_control%becke_control%combined_type)
|
||||
CASE (cdft_combined_all)
|
||||
! Do nothing
|
||||
CASE (cdft_combined_acceptor, cdft_combined_donor)
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, &
|
||||
dft_control%qs_control%becke_control%combined_weight%pw)
|
||||
END SELECT
|
||||
END IF
|
||||
dft_control%qs_control%becke_control%save_pot = .FALSE.
|
||||
dft_control%qs_control%becke_control%need_pot = .TRUE.
|
||||
dft_control%qs_control%becke_control%external_control = .FALSE.
|
||||
END IF
|
||||
|
||||
IF (calculate_forces .AND. dft_control%qs_control%cdft) THEN
|
||||
IF (cdft_control%type == outer_scf_hirshfeld_constraint) THEN
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, cdft_control%weight%pw)
|
||||
cdft_control%save_pot = .FALSE.
|
||||
cdft_control%need_pot = .TRUE.
|
||||
END IF
|
||||
END IF
|
||||
|
||||
IF (dft_control%do_sccs) THEN
|
||||
|
|
@ -780,7 +827,7 @@ CONTAINS
|
|||
energy%becke+energy%dft_plus_u+energy%kTS+ &
|
||||
energy%efield+energy%efield_core+energy%ee+ &
|
||||
energy%ee_core+energy%exc_aux_fit+energy%image_charge+ &
|
||||
energy%sccs_pol+energy%sccs_mpc
|
||||
energy%sccs_pol+energy%sccs_mpc+energy%cdft
|
||||
|
||||
IF (abnormal_value(energy%total)) &
|
||||
CPABORT("KS energy is an abnormal value (NaN/Inf).")
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
MODULE qs_ks_utils
|
||||
USE cell_types, ONLY: cell_type
|
||||
USE cp_control_types, ONLY: becke_restraint_type,&
|
||||
cdft_control_type,&
|
||||
dft_control_type
|
||||
USE cp_dbcsr_operations, ONLY: copy_dbcsr_to_fm,&
|
||||
copy_fm_to_dbcsr,&
|
||||
|
|
@ -47,14 +48,10 @@ MODULE qs_ks_utils
|
|||
dbcsr_add, dbcsr_allocate_matrix_set, dbcsr_copy, dbcsr_deallocate_matrix, &
|
||||
dbcsr_deallocate_matrix_set, dbcsr_get_info, dbcsr_init_p, dbcsr_multiply, dbcsr_p_type, &
|
||||
dbcsr_release_p, dbcsr_scale, dbcsr_scale_by_vector, dbcsr_set, dbcsr_trace, dbcsr_type
|
||||
USE input_constants, ONLY: do_ppl_grid,&
|
||||
sic_ad,&
|
||||
sic_eo,&
|
||||
sic_list_all,&
|
||||
sic_list_unpaired,&
|
||||
sic_mauri_spz,&
|
||||
sic_mauri_us,&
|
||||
sic_none
|
||||
USE input_constants, ONLY: &
|
||||
cdft_combined_acceptor, cdft_combined_all, cdft_combined_donor, &
|
||||
cdft_magnetization_constraint, do_ppl_grid, outer_scf_hirshfeld_constraint, sic_ad, &
|
||||
sic_eo, sic_list_all, sic_list_unpaired, sic_mauri_spz, sic_mauri_us, sic_none
|
||||
USE input_section_types, ONLY: section_vals_get_subs_vals,&
|
||||
section_vals_type,&
|
||||
section_vals_val_get
|
||||
|
|
@ -1165,6 +1162,7 @@ CONTAINS
|
|||
!> \param v_spin_ddapc_rest_r ...
|
||||
!> \param v_sccs_rspace ...
|
||||
!> \param becke ...
|
||||
!> \param cdft_control ...
|
||||
!> \param calculate_forces ...
|
||||
!> \par History
|
||||
!> - refactoring 04.03.2011 [MI]
|
||||
|
|
@ -1176,7 +1174,8 @@ CONTAINS
|
|||
v_rspace_new_aux_fit, v_tau_rspace, &
|
||||
v_tau_rspace_aux_fit, v_efield_rspace, &
|
||||
v_sic_rspace, v_spin_ddapc_rest_r, &
|
||||
v_sccs_rspace, becke, calculate_forces)
|
||||
v_sccs_rspace, becke, cdft_control, &
|
||||
calculate_forces)
|
||||
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: ks_matrix
|
||||
|
|
@ -1188,14 +1187,15 @@ CONTAINS
|
|||
TYPE(pw_p_type) :: v_efield_rspace, v_sic_rspace, &
|
||||
v_spin_ddapc_rest_r, v_sccs_rspace
|
||||
TYPE(becke_restraint_type), POINTER :: becke
|
||||
TYPE(cdft_control_type), POINTER :: cdft_control
|
||||
LOGICAL, INTENT(in) :: calculate_forces
|
||||
|
||||
CHARACTER(LEN=*), PARAMETER :: routineN = 'sum_up_and_integrate', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ispin, nspins
|
||||
INTEGER :: handle, ispin, ivar, nspins, nvar
|
||||
LOGICAL :: do_ppl, gapw, gapw_xc
|
||||
REAL(dp) :: dvol
|
||||
REAL(dp) :: dvol, sign
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: ksmat, matrix_ks_aux_fit, &
|
||||
matrix_ks_aux_fit_dft, rho_ao, &
|
||||
rho_ao_aux
|
||||
|
|
@ -1275,8 +1275,32 @@ CONTAINS
|
|||
END IF
|
||||
END IF
|
||||
IF (dft_control%qs_control%becke_restraint) THEN
|
||||
v_rspace_new(ispin)%pw%cr3d = v_rspace_new(ispin)%pw%cr3d &
|
||||
+becke%becke_pot%pw%cr3d*dft_control%qs_control%becke_control%strength
|
||||
nvar = SIZE(becke%strength)
|
||||
DO ivar = 1, nvar
|
||||
IF (ivar == 2) THEN
|
||||
sign = 1.0_dp
|
||||
IF (ispin == 2) sign = -1.0_dp
|
||||
SELECT CASE (becke%combined_type)
|
||||
CASE (cdft_combined_all)
|
||||
v_rspace_new(ispin)%pw%cr3d = v_rspace_new(ispin)%pw%cr3d &
|
||||
+sign*becke%becke_pot%pw%cr3d*becke%strength(ivar)
|
||||
CASE (cdft_combined_acceptor, cdft_combined_donor)
|
||||
v_rspace_new(ispin)%pw%cr3d = v_rspace_new(ispin)%pw%cr3d &
|
||||
+sign*becke%combined_weight%pw%cr3d*becke%strength(ivar)
|
||||
END SELECT
|
||||
ELSE
|
||||
sign = 1.0_dp
|
||||
IF (ispin == 2 .AND. becke%constraint_type == cdft_magnetization_constraint) &
|
||||
sign = -1.0_dp
|
||||
v_rspace_new(ispin)%pw%cr3d = v_rspace_new(ispin)%pw%cr3d &
|
||||
+sign*becke%becke_pot%pw%cr3d*becke%strength(ivar)
|
||||
END IF
|
||||
END DO
|
||||
END IF
|
||||
IF (dft_control%qs_control%cdft) THEN
|
||||
IF (cdft_control%type == outer_scf_hirshfeld_constraint) &
|
||||
v_rspace_new(ispin)%pw%cr3d = v_rspace_new(ispin)%pw%cr3d &
|
||||
+cdft_control%weight%pw%cr3d*cdft_control%strength(1)
|
||||
END IF
|
||||
! The efield contribution
|
||||
IF (dft_control%apply_efield_field) THEN
|
||||
|
|
|
|||
|
|
@ -494,9 +494,11 @@ CONTAINS
|
|||
!> \param multiplicity ...
|
||||
!> \param dft_section ...
|
||||
!> \param natom_mismatch ...
|
||||
!> \param cdft ...
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE read_mo_set_from_restart(mo_array, atomic_kind_set, qs_kind_set, particle_set, &
|
||||
para_env, id_nr, multiplicity, dft_section, natom_mismatch)
|
||||
para_env, id_nr, multiplicity, dft_section, natom_mismatch, &
|
||||
cdft)
|
||||
|
||||
TYPE(mo_set_p_type), DIMENSION(:), POINTER :: mo_array
|
||||
TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
|
||||
|
|
@ -506,6 +508,7 @@ CONTAINS
|
|||
INTEGER, INTENT(IN) :: id_nr, multiplicity
|
||||
TYPE(section_vals_type), POINTER :: dft_section
|
||||
LOGICAL, INTENT(OUT), OPTIONAL :: natom_mismatch
|
||||
LOGICAL, INTENT(IN), OPTIONAL :: cdft
|
||||
|
||||
CHARACTER(LEN=*), PARAMETER :: routineN = 'read_mo_set_from_restart', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
|
@ -513,11 +516,13 @@ CONTAINS
|
|||
CHARACTER(LEN=default_path_length) :: file_name
|
||||
INTEGER :: group, handle, ispin, natom, nspin, &
|
||||
restart_unit, source
|
||||
LOGICAL :: exist
|
||||
LOGICAL :: exist, my_cdft
|
||||
TYPE(cp_logger_type), POINTER :: logger
|
||||
|
||||
CALL timeset(routineN, handle)
|
||||
logger => cp_get_default_logger()
|
||||
my_cdft = .FALSE.
|
||||
IF (PRESENT(cdft)) my_cdft = cdft
|
||||
|
||||
nspin = SIZE(mo_array)
|
||||
restart_unit = -1
|
||||
|
|
@ -558,10 +563,13 @@ CONTAINS
|
|||
! Close restart file
|
||||
IF (para_env%ionode) CALL close_file(unit_number=restart_unit)
|
||||
|
||||
DO ispin = 1, nspin
|
||||
CALL write_mo_set(mo_array(ispin)%mo_set, atomic_kind_set, qs_kind_set, &
|
||||
particle_set, 4, dft_section)
|
||||
END DO
|
||||
! CDFT has no real dft_section and does not need to print
|
||||
IF (.NOT. my_cdft) THEN
|
||||
DO ispin = 1, nspin
|
||||
CALL write_mo_set(mo_array(ispin)%mo_set, atomic_kind_set, qs_kind_set, &
|
||||
particle_set, 4, dft_section)
|
||||
END DO
|
||||
END IF
|
||||
|
||||
CALL timestop(handle)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,16 +11,20 @@
|
|||
! **************************************************************************************************
|
||||
MODULE qs_outer_scf
|
||||
USE cp_control_types, ONLY: becke_restraint_type,&
|
||||
cdft_control_type,&
|
||||
ddapc_restraint_type,&
|
||||
dft_control_type,&
|
||||
s2_restraint_type
|
||||
USE input_constants, ONLY: &
|
||||
do_ddapc_constraint, do_s2_constraint, outer_scf_basis_center_opt, &
|
||||
outer_scf_becke_constraint, outer_scf_ddapc_constraint, outer_scf_none, &
|
||||
outer_scf_optimizer_bisect, outer_scf_optimizer_diis, outer_scf_optimizer_none, &
|
||||
cdft2ot, cdft_combined_constraint, cdft_density_constraint, cdft_magnetization_constraint, &
|
||||
do_ddapc_constraint, do_s2_constraint, ot2cdft, outer_scf_basis_center_opt, &
|
||||
outer_scf_becke_constraint, outer_scf_cdft_constraint, outer_scf_ddapc_constraint, &
|
||||
outer_scf_none, outer_scf_optimizer_bisect, outer_scf_optimizer_broyden, &
|
||||
outer_scf_optimizer_diis, outer_scf_optimizer_newton, outer_scf_optimizer_none, &
|
||||
outer_scf_optimizer_sd, outer_scf_s2_constraint
|
||||
USE kinds, ONLY: dp
|
||||
USE mathlib, ONLY: diamat_all
|
||||
USE mathlib, ONLY: diamat_all,&
|
||||
invert_matrix
|
||||
USE qs_basis_gradient, ONLY: qs_basis_center_gradient,&
|
||||
qs_update_basis_center_pos,&
|
||||
return_basis_center_gradient_norm
|
||||
|
|
@ -43,19 +47,24 @@ MODULE qs_outer_scf
|
|||
! *** Public subroutines ***
|
||||
|
||||
PUBLIC :: outer_loop_gradient, outer_loop_optimize, outer_loop_update_qs_env, &
|
||||
outer_loop_variables_count, outer_loop_extrapolate
|
||||
outer_loop_variables_count, outer_loop_extrapolate, &
|
||||
outer_loop_switch, outer_loop_purge_history
|
||||
|
||||
CONTAINS
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief returns the number of variables that is employed in the outer loop
|
||||
!> \param scf_control ...
|
||||
!> \retval res ...
|
||||
!> \brief returns the number of variables that is employed in the outer loop. with a CDFT constraint
|
||||
!> this value is returned by the cdft_control type
|
||||
!> \param scf_control the outer loop control type
|
||||
!> \param cdft_control the cdft loop control type
|
||||
!> \retval res the number of variables
|
||||
!> \par History
|
||||
!> 03.2006 created [Joost VandeVondele]
|
||||
! **************************************************************************************************
|
||||
FUNCTION outer_loop_variables_count(scf_control) RESULT(res)
|
||||
FUNCTION outer_loop_variables_count(scf_control, cdft_control) RESULT(res)
|
||||
TYPE(scf_control_type), POINTER :: scf_control
|
||||
TYPE(cdft_control_type), INTENT(IN), OPTIONAL, &
|
||||
POINTER :: cdft_control
|
||||
INTEGER :: res
|
||||
|
||||
SELECT CASE (scf_control%outer_scf%type)
|
||||
|
|
@ -63,8 +72,17 @@ CONTAINS
|
|||
res = 1
|
||||
CASE (outer_scf_s2_constraint)
|
||||
res = 1
|
||||
CASE (outer_scf_becke_constraint)
|
||||
res = 1
|
||||
CASE (outer_scf_becke_constraint, outer_scf_cdft_constraint)
|
||||
IF (PRESENT(cdft_control)) THEN
|
||||
SELECT CASE (cdft_control%constraint_type)
|
||||
CASE (cdft_density_constraint, cdft_magnetization_constraint)
|
||||
res = 1
|
||||
CASE (cdft_combined_constraint)
|
||||
res = 2
|
||||
END SELECT
|
||||
ELSE
|
||||
res = 1
|
||||
END IF
|
||||
CASE (outer_scf_basis_center_opt)
|
||||
res = 1
|
||||
CASE (outer_scf_none) ! just needed to communicate the gradient criterium
|
||||
|
|
@ -89,9 +107,10 @@ CONTAINS
|
|||
CHARACTER(LEN=*), PARAMETER :: routineN = 'outer_loop_gradient', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, ihistory, n
|
||||
INTEGER :: handle, ihistory, ivar, n
|
||||
LOGICAL :: is_constraint
|
||||
TYPE(becke_restraint_type), POINTER :: becke_control
|
||||
TYPE(cdft_control_type), POINTER :: cdft_control
|
||||
TYPE(ddapc_restraint_type), POINTER :: ddapc_restraint_control
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(qs_energy_type), POINTER :: energy
|
||||
|
|
@ -139,9 +158,19 @@ CONTAINS
|
|||
CASE (outer_scf_becke_constraint)
|
||||
CPASSERT(dft_control%qs_control%becke_restraint)
|
||||
becke_control => dft_control%qs_control%becke_control
|
||||
scf_env%outer_scf%variables(:, ihistory) = becke_control%strength
|
||||
scf_env%outer_scf%gradient(:, ihistory) = becke_control%becke_order_p- &
|
||||
becke_control%target
|
||||
DO ivar = 1, SIZE(scf_env%outer_scf%gradient, 1)
|
||||
scf_env%outer_scf%variables(ivar, ihistory) = becke_control%strength(ivar)
|
||||
scf_env%outer_scf%gradient(ivar, ihistory) = becke_control%becke_order_p(ivar)- &
|
||||
becke_control%target(ivar)
|
||||
END DO
|
||||
CASE (outer_scf_cdft_constraint)
|
||||
CPASSERT(dft_control%qs_control%cdft)
|
||||
cdft_control => dft_control%qs_control%cdft_control
|
||||
DO ivar = 1, SIZE(scf_env%outer_scf%gradient, 1)
|
||||
scf_env%outer_scf%variables(ivar, ihistory) = cdft_control%strength(ivar)
|
||||
scf_env%outer_scf%gradient(ivar, ihistory) = cdft_control%value(ivar)- &
|
||||
cdft_control%target(ivar)
|
||||
END DO
|
||||
CASE (outer_scf_basis_center_opt)
|
||||
CALL qs_basis_center_gradient(qs_env)
|
||||
scf_env%outer_scf%gradient(:, ihistory) = return_basis_center_gradient_norm(qs_env)
|
||||
|
|
@ -157,10 +186,11 @@ CONTAINS
|
|||
|
||||
! **************************************************************************************************
|
||||
!> \brief optimizes the parameters of the outer_scf
|
||||
!> \param scf_env ...
|
||||
!> \param scf_control ...
|
||||
!> \param scf_env the scf_env where to optimize the parameters
|
||||
!> \param scf_control control parameters for the optimization
|
||||
!> \par History
|
||||
!> 03.2006 created [Joost VandeVondele]
|
||||
!> 01.2017 added Broyden and Newton optimizers [Nico Holmberg]
|
||||
!> \note
|
||||
!> ought to be general, and independent of the actual kind of variables
|
||||
! **************************************************************************************************
|
||||
|
|
@ -172,16 +202,17 @@ CONTAINS
|
|||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, i, ibuf, ihigh, ihistory, ilow, &
|
||||
j, jbuf, nb, optimizer_type
|
||||
INTEGER, ALLOCATABLE, DIMENSION(:) :: ipivot
|
||||
REAL(KIND=dp) :: interval, tmp
|
||||
j, jbuf, nb, nvar, optimizer_type
|
||||
REAL(KIND=dp) :: interval, inv_error, scale, tmp
|
||||
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: ev
|
||||
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: a, b
|
||||
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: a, b, f, jacobian, x
|
||||
REAL(KIND=dp), DIMENSION(:, :), POINTER :: inv_jacobian
|
||||
|
||||
CALL timeset(routineN, handle)
|
||||
|
||||
ihistory = scf_env%outer_scf%iter_count
|
||||
optimizer_type = scf_control%outer_scf%optimizer
|
||||
NULLIFY (inv_jacobian)
|
||||
|
||||
IF (scf_control%outer_scf%type == outer_scf_basis_center_opt) THEN
|
||||
scf_env%outer_scf%variables(:, ihistory+1) = scf_env%outer_scf%variables(:, ihistory)
|
||||
|
|
@ -237,7 +268,7 @@ CONTAINS
|
|||
optimizer_type = outer_scf_optimizer_sd
|
||||
CYCLE
|
||||
ELSE
|
||||
ALLOCATE (b(nb+1, nb+1), a(nb+1, nb+1), ev(nb+1), ipivot(nb+1))
|
||||
ALLOCATE (b(nb+1, nb+1), a(nb+1, nb+1), ev(nb+1))
|
||||
DO I = 1, nb
|
||||
DO J = I, nb
|
||||
ibuf = ihistory-nb+i
|
||||
|
|
@ -268,8 +299,69 @@ CONTAINS
|
|||
scf_env%outer_scf%variables(:, ihistory+1) = scf_env%outer_scf%variables(:, ihistory+1)+ &
|
||||
ev(i)*scf_env%outer_scf%variables(:, ibuf)
|
||||
ENDDO
|
||||
DEALLOCATE (b, ev)
|
||||
DEALLOCATE (a, b, ev)
|
||||
ENDIF
|
||||
CASE (outer_scf_optimizer_broyden)
|
||||
CPASSERT(SIZE(scf_env%outer_scf%gradient, 2) >= 3)
|
||||
nvar = SIZE(scf_env%outer_scf%gradient, 1)
|
||||
IF (ihistory < 2) THEN
|
||||
! Need two history values to use Broyden, switch to sd
|
||||
optimizer_type = outer_scf_optimizer_sd
|
||||
CYCLE
|
||||
END IF
|
||||
IF (nvar == 1) THEN
|
||||
! 1D case secant method
|
||||
scf_env%outer_scf%variables(1, ihistory+1) = scf_env%outer_scf%variables(1, ihistory)- &
|
||||
(scf_env%outer_scf%variables(1, ihistory)- &
|
||||
scf_env%outer_scf%variables(1, ihistory-1))/ &
|
||||
(scf_env%outer_scf%gradient(1, ihistory)- &
|
||||
scf_env%outer_scf%gradient(1, ihistory-1))* &
|
||||
scf_env%outer_scf%gradient(1, ihistory)
|
||||
ELSE
|
||||
ALLOCATE (f(nvar, 1), x(nvar, 1))
|
||||
DO i = 1, nvar
|
||||
f(i, 1) = scf_env%outer_scf%gradient(i, ihistory)-scf_env%outer_scf%gradient(i, ihistory-1)
|
||||
x(i, 1) = scf_env%outer_scf%variables(i, ihistory)-scf_env%outer_scf%variables(i, ihistory-1)
|
||||
END DO
|
||||
! Use finite difference Jacobian as initial guess
|
||||
! TODO: Add possibility to restart Jacobian
|
||||
IF (ihistory == 2) THEN
|
||||
IF (.NOT. ASSOCIATED(scf_env%outer_scf%inv_jacobian)) &
|
||||
ALLOCATE (scf_env%outer_scf%inv_jacobian(nvar, nvar))
|
||||
inv_jacobian => scf_env%outer_scf%inv_jacobian
|
||||
ALLOCATE (jacobian(nvar, nvar))
|
||||
jacobian = 0.0_dp
|
||||
DO i = 1, nvar
|
||||
jacobian(i, i) = f(i, 1)/x(i, 1)
|
||||
END DO
|
||||
CALL invert_matrix(jacobian, inv_jacobian, inv_error)
|
||||
scale = SUM(MATMUL(TRANSPOSE(x), MATMUL(inv_jacobian, f)))
|
||||
DEALLOCATE (jacobian)
|
||||
ELSE
|
||||
SELECT CASE (scf_control%outer_scf%jacobian_type)
|
||||
CASE DEFAULT
|
||||
! Broyden's 1st method
|
||||
! Update inverse Jacobian: dx_n = \delta x_n; df_n = \delta f_n
|
||||
! J_(n+1)^(-1) = J_n^(-1) + (dx_n - J_n^(-1)*df_n)*(dx_n^T * J_n^(-1))/(dx_n^T * J_n^(-1) * df_n)
|
||||
inv_jacobian => scf_env%outer_scf%inv_jacobian
|
||||
scale = SUM(MATMUL(TRANSPOSE(x), MATMUL(inv_jacobian, f)))
|
||||
scale = 1.0_dp/scale
|
||||
IF (scale < 1.0E-12_dp) scale = 1.0E-12_dp
|
||||
inv_jacobian = inv_jacobian+scale*MATMUL((x-MATMUL(inv_jacobian, f)), &
|
||||
MATMUL(TRANSPOSE(x), inv_jacobian))
|
||||
END SELECT
|
||||
END IF
|
||||
! Broyden update: x_(n+1) = x_n - J^(-1)*f(x_n)
|
||||
scf_env%outer_scf%variables(:, ihistory+1) = scf_env%outer_scf%variables(:, ihistory)- &
|
||||
MATMUL(inv_jacobian, scf_env%outer_scf%gradient(:, ihistory))
|
||||
! Clean up
|
||||
DEALLOCATE (f, x)
|
||||
END IF
|
||||
CASE (outer_scf_optimizer_newton)
|
||||
CPASSERT(ASSOCIATED(scf_env%outer_scf%inv_jacobian))
|
||||
inv_jacobian => scf_env%outer_scf%inv_jacobian
|
||||
scf_env%outer_scf%variables(:, ihistory+1) = scf_env%outer_scf%variables(:, ihistory)- &
|
||||
MATMUL(inv_jacobian, scf_env%outer_scf%gradient(:, ihistory))
|
||||
CASE DEFAULT
|
||||
CPABORT("")
|
||||
END SELECT
|
||||
|
|
@ -299,6 +391,7 @@ CONTAINS
|
|||
INTEGER :: handle, ihistory, n
|
||||
LOGICAL :: is_constraint
|
||||
TYPE(becke_restraint_type), POINTER :: becke_control
|
||||
TYPE(cdft_control_type), POINTER :: cdft_control
|
||||
TYPE(ddapc_restraint_type), POINTER :: ddapc_restraint_control
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(s2_restraint_type), POINTER :: s2_restraint_control
|
||||
|
|
@ -325,7 +418,12 @@ CONTAINS
|
|||
s2_restraint_control%strength = scf_env%outer_scf%variables(1, ihistory+1)
|
||||
CASE (outer_scf_becke_constraint)
|
||||
becke_control => dft_control%qs_control%becke_control
|
||||
becke_control%strength = scf_env%outer_scf%variables(1, ihistory+1)
|
||||
becke_control%strength(:) = scf_env%outer_scf%variables(:, ihistory+1)
|
||||
IF (dft_control%qs_control%cdft) &
|
||||
dft_control%qs_control%cdft_control%strength(:) = becke_control%strength(:)
|
||||
CASE (outer_scf_cdft_constraint)
|
||||
cdft_control => dft_control%qs_control%cdft_control
|
||||
cdft_control%strength(:) = scf_env%outer_scf%variables(:, ihistory+1)
|
||||
CASE (outer_scf_basis_center_opt)
|
||||
CALL qs_update_basis_center_pos(qs_env)
|
||||
CASE DEFAULT
|
||||
|
|
@ -339,7 +437,7 @@ CONTAINS
|
|||
! **************************************************************************************************
|
||||
!> \brief uses the outer_scf_history to extrapolate new values for the variables
|
||||
!> and updates their value in qs_env accordingly
|
||||
!> \param qs_env ...
|
||||
!> \param qs_env the qs_environment_type where to update the variables
|
||||
!> \par History
|
||||
!> 03.2006 created [Joost VandeVondele]
|
||||
!> \note
|
||||
|
|
@ -392,8 +490,11 @@ CONTAINS
|
|||
outer_scf_history(1, ivec) = &
|
||||
dft_control%qs_control%s2_restraint_control%strength
|
||||
CASE (outer_scf_becke_constraint)
|
||||
outer_scf_history(1, ivec) = &
|
||||
dft_control%qs_control%becke_control%strength
|
||||
outer_scf_history(:, ivec) = &
|
||||
dft_control%qs_control%becke_control%strength(:)
|
||||
CASE (outer_scf_cdft_constraint)
|
||||
outer_scf_history(:, ivec) = &
|
||||
dft_control%qs_control%cdft_control%strength(:)
|
||||
CASE (outer_scf_basis_center_opt)
|
||||
outer_scf_history(1, ivec) = 0.0_dp
|
||||
CASE DEFAULT
|
||||
|
|
@ -421,7 +522,11 @@ CONTAINS
|
|||
CASE (outer_scf_s2_constraint)
|
||||
dft_control%qs_control%s2_restraint_control%strength = extrapolation(1)
|
||||
CASE (outer_scf_becke_constraint)
|
||||
dft_control%qs_control%becke_control%strength = extrapolation(1)
|
||||
dft_control%qs_control%becke_control%strength(:) = extrapolation(:)
|
||||
IF (dft_control%qs_control%cdft) &
|
||||
dft_control%qs_control%cdft_control%strength(:) = dft_control%qs_control%becke_control%strength(:)
|
||||
CASE (outer_scf_cdft_constraint)
|
||||
dft_control%qs_control%cdft_control%strength(:) = extrapolation(:)
|
||||
CASE (outer_scf_basis_center_opt)
|
||||
! nothing to do
|
||||
CASE DEFAULT
|
||||
|
|
@ -434,4 +539,124 @@ CONTAINS
|
|||
|
||||
END SUBROUTINE outer_loop_extrapolate
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief switch between two outer_scf envs stored in cdft_control
|
||||
!> \param scf_env the scf_env where values need to be updated using cdft_control
|
||||
!> \param scf_control the scf_control where values need to be updated using cdft_control
|
||||
!> \param cdft_control container for the second outer_scf env
|
||||
!> \param dir determines what switching operation to perform
|
||||
!> \par History
|
||||
!> 12.2015 created [Nico Holmberg]
|
||||
! **************************************************************************************************
|
||||
|
||||
SUBROUTINE outer_loop_switch(scf_env, scf_control, cdft_control, dir)
|
||||
TYPE(qs_scf_env_type), POINTER :: scf_env
|
||||
TYPE(scf_control_type), POINTER :: scf_control
|
||||
TYPE(cdft_control_type), POINTER :: cdft_control
|
||||
INTEGER, INTENT(IN) :: dir
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'outer_loop_switch', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
SELECT CASE (dir)
|
||||
! Constraint -> OT
|
||||
CASE (cdft2ot)
|
||||
! Switch data in scf_control
|
||||
scf_control%outer_scf%have_scf = cdft_control%ot_control%have_scf
|
||||
scf_control%outer_scf%max_scf = cdft_control%ot_control%max_scf
|
||||
scf_control%outer_scf%eps_scf = cdft_control%ot_control%eps_scf
|
||||
scf_control%outer_scf%step_size = cdft_control%ot_control%step_size
|
||||
scf_control%outer_scf%type = cdft_control%ot_control%type
|
||||
scf_control%outer_scf%optimizer = cdft_control%ot_control%optimizer
|
||||
scf_control%outer_scf%diis_buffer_length = cdft_control%ot_control%diis_buffer_length
|
||||
scf_control%outer_scf%bisect_trust_count = cdft_control%ot_control%bisect_trust_count
|
||||
scf_control%outer_scf%jacobian_type = cdft_control%ot_control%jacobian_type
|
||||
! Switch data in scf_env: first save current values for constraint
|
||||
cdft_control%constraint%iter_count = scf_env%outer_scf%iter_count
|
||||
cdft_control%constraint%energy = scf_env%outer_scf%energy
|
||||
cdft_control%constraint%variables = scf_env%outer_scf%variables
|
||||
cdft_control%constraint%gradient = scf_env%outer_scf%gradient
|
||||
cdft_control%constraint%count = scf_env%outer_scf%count
|
||||
! Now switch
|
||||
IF (ASSOCIATED(scf_env%outer_scf%energy)) &
|
||||
DEALLOCATE (scf_env%outer_scf%energy)
|
||||
ALLOCATE (scf_env%outer_scf%energy(scf_control%outer_scf%max_scf+1))
|
||||
scf_env%outer_scf%energy = 0.0_dp
|
||||
IF (ASSOCIATED(scf_env%outer_scf%variables)) &
|
||||
DEALLOCATE (scf_env%outer_scf%variables)
|
||||
ALLOCATE (scf_env%outer_scf%variables(1, scf_control%outer_scf%max_scf+1))
|
||||
scf_env%outer_scf%variables = 0.0_dp
|
||||
IF (ASSOCIATED(scf_env%outer_scf%gradient)) &
|
||||
DEALLOCATE (scf_env%outer_scf%gradient)
|
||||
ALLOCATE (scf_env%outer_scf%gradient(1, scf_control%outer_scf%max_scf+1))
|
||||
scf_env%outer_scf%gradient = 0.0_dp
|
||||
IF (ASSOCIATED(scf_env%outer_scf%count)) &
|
||||
DEALLOCATE (scf_env%outer_scf%count)
|
||||
ALLOCATE (scf_env%outer_scf%count(scf_control%outer_scf%max_scf+1))
|
||||
scf_env%outer_scf%count = 0
|
||||
! OT -> constraint
|
||||
CASE (ot2cdft)
|
||||
scf_control%outer_scf%have_scf = cdft_control%constraint_control%have_scf
|
||||
scf_control%outer_scf%max_scf = cdft_control%constraint_control%max_scf
|
||||
scf_control%outer_scf%eps_scf = cdft_control%constraint_control%eps_scf
|
||||
scf_control%outer_scf%step_size = cdft_control%constraint_control%step_size
|
||||
scf_control%outer_scf%type = cdft_control%constraint_control%type
|
||||
scf_control%outer_scf%optimizer = cdft_control%constraint_control%optimizer
|
||||
scf_control%outer_scf%diis_buffer_length = cdft_control%constraint_control%diis_buffer_length
|
||||
scf_control%outer_scf%bisect_trust_count = cdft_control%constraint_control%bisect_trust_count
|
||||
scf_control%outer_scf%jacobian_type = cdft_control%constraint_control%jacobian_type
|
||||
IF (ASSOCIATED(scf_env%outer_scf%energy)) &
|
||||
DEALLOCATE (scf_env%outer_scf%energy)
|
||||
ALLOCATE (scf_env%outer_scf%energy(scf_control%outer_scf%max_scf+1))
|
||||
scf_env%outer_scf%energy = cdft_control%constraint%energy
|
||||
IF (ASSOCIATED(scf_env%outer_scf%variables)) &
|
||||
DEALLOCATE (scf_env%outer_scf%variables)
|
||||
ALLOCATE (scf_env%outer_scf%variables(SIZE(cdft_control%constraint%variables, 1), &
|
||||
scf_control%outer_scf%max_scf+1))
|
||||
scf_env%outer_scf%variables = cdft_control%constraint%variables
|
||||
IF (ASSOCIATED(scf_env%outer_scf%gradient)) &
|
||||
DEALLOCATE (scf_env%outer_scf%gradient)
|
||||
ALLOCATE (scf_env%outer_scf%gradient(SIZE(cdft_control%constraint%gradient, 1), &
|
||||
scf_control%outer_scf%max_scf+1))
|
||||
scf_env%outer_scf%gradient = cdft_control%constraint%gradient
|
||||
IF (ASSOCIATED(scf_env%outer_scf%count)) &
|
||||
DEALLOCATE (scf_env%outer_scf%count)
|
||||
ALLOCATE (scf_env%outer_scf%count(scf_control%outer_scf%max_scf+1))
|
||||
scf_env%outer_scf%count = cdft_control%constraint%count
|
||||
scf_env%outer_scf%iter_count = cdft_control%constraint%iter_count
|
||||
CASE DEFAULT
|
||||
CPABORT("")
|
||||
END SELECT
|
||||
|
||||
END SUBROUTINE outer_loop_switch
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief purges outer_scf_history zeroing everything except
|
||||
!> the latest value of the outer_scf variable stored in qs_control
|
||||
!> \param qs_env the qs_environment_type where to purge
|
||||
!> \par History
|
||||
!> 05.2016 created [Nico Holmberg]
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE outer_loop_purge_history(qs_env)
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
|
||||
CHARACTER(LEN=*), PARAMETER :: routineN = 'outer_loop_purge_history', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, outer_scf_ihistory
|
||||
REAL(kind=dp), DIMENSION(:, :), POINTER :: outer_scf_history
|
||||
|
||||
CALL timeset(routineN, handle)
|
||||
|
||||
CALL get_qs_env(qs_env, outer_scf_history=outer_scf_history, &
|
||||
outer_scf_ihistory=outer_scf_ihistory)
|
||||
CPASSERT(SIZE(outer_scf_history, 2) > 0)
|
||||
outer_scf_ihistory = 0
|
||||
outer_scf_history = 0.0_dp
|
||||
CALL set_qs_env(qs_env, outer_scf_ihistory=outer_scf_ihistory)
|
||||
|
||||
CALL timestop(handle)
|
||||
|
||||
END SUBROUTINE outer_loop_purge_history
|
||||
|
||||
END MODULE qs_outer_scf
|
||||
|
|
|
|||
590
src/qs_scf.F
590
src/qs_scf.F
|
|
@ -39,13 +39,18 @@
|
|||
!> intermediate energy communication with external communicator added
|
||||
!> - kpoints (08.2014, JGH)
|
||||
!> - unified k-point and gamma-point code (2014.11) [Ole Schuett]
|
||||
!> - added extra SCF loop for CDFT constraints (12.2015) [Nico Holmberg]
|
||||
!> \author Matthias Krack (30.04.2001)
|
||||
! **************************************************************************************************
|
||||
MODULE qs_scf
|
||||
USE atomic_kind_types, ONLY: atomic_kind_type
|
||||
USE cp_control_types, ONLY: dft_control_type
|
||||
USE cp_dbcsr_operations, ONLY: copy_dbcsr_to_fm
|
||||
USE cp_fm_types, ONLY: cp_fm_release,&
|
||||
USE cp_control_types, ONLY: cdft_control_type,&
|
||||
dft_control_type
|
||||
USE cp_dbcsr_operations, ONLY: copy_dbcsr_to_fm,&
|
||||
copy_fm_to_dbcsr
|
||||
USE cp_fm_types, ONLY: cp_fm_create,&
|
||||
cp_fm_release,&
|
||||
cp_fm_to_fm,&
|
||||
cp_fm_type
|
||||
USE cp_log_handling, ONLY: cp_get_default_logger,&
|
||||
cp_logger_type,&
|
||||
|
|
@ -64,14 +69,17 @@ MODULE qs_scf
|
|||
dbcsr_deallocate_matrix,&
|
||||
dbcsr_deallocate_matrix_set,&
|
||||
dbcsr_get_info,&
|
||||
dbcsr_init_p,&
|
||||
dbcsr_p_type,&
|
||||
dbcsr_set,&
|
||||
dbcsr_type
|
||||
USE input_constants, ONLY: history_guess,&
|
||||
ot_precond_full_all,&
|
||||
ot_precond_full_single,&
|
||||
ot_precond_full_single_inverse,&
|
||||
ot_precond_none,&
|
||||
ot_precond_s_inverse
|
||||
USE input_constants, ONLY: &
|
||||
cdft2ot, cdft_combined_acceptor, cdft_combined_all, cdft_combined_constraint, &
|
||||
cdft_combined_donor, history_guess, jacobian_fd1, jacobian_fd1_backward, &
|
||||
jacobian_fd1_central, jacobian_fd2, jacobian_fd2_backward, ot2cdft, ot_precond_full_all, &
|
||||
ot_precond_full_single, ot_precond_full_single_inverse, ot_precond_none, &
|
||||
ot_precond_s_inverse, outer_scf_hirshfeld_constraint, outer_scf_optimizer_broyden, &
|
||||
outer_scf_optimizer_newton
|
||||
USE input_section_types, ONLY: section_vals_get_subs_vals,&
|
||||
section_vals_type
|
||||
USE kinds, ONLY: default_string_length,&
|
||||
|
|
@ -80,6 +88,7 @@ MODULE qs_scf
|
|||
USE kpoint_types, ONLY: kpoint_type
|
||||
USE machine, ONLY: m_flush,&
|
||||
m_walltime
|
||||
USE mathlib, ONLY: invert_matrix
|
||||
USE message_passing, ONLY: mp_send
|
||||
USE particle_types, ONLY: particle_type
|
||||
USE preconditioner, ONLY: prepare_preconditioner,&
|
||||
|
|
@ -97,21 +106,29 @@ MODULE qs_scf
|
|||
USE qs_environment_types, ONLY: get_qs_env,&
|
||||
qs_environment_type,&
|
||||
set_qs_env
|
||||
USE qs_integrate_potential, ONLY: integrate_v_rspace
|
||||
USE qs_kind_types, ONLY: qs_kind_type
|
||||
USE qs_ks_methods, ONLY: qs_ks_update_qs_env
|
||||
USE qs_ks_types, ONLY: qs_ks_did_change,&
|
||||
qs_ks_env_type
|
||||
USE qs_mo_io, ONLY: write_mo_set
|
||||
USE qs_mo_methods, ONLY: make_basis_simple,&
|
||||
USE qs_mo_methods, ONLY: calculate_density_matrix,&
|
||||
make_basis_simple,&
|
||||
make_basis_sm
|
||||
USE qs_mo_occupation, ONLY: set_mo_occupation
|
||||
USE qs_mo_types, ONLY: get_mo_set,&
|
||||
USE qs_mo_types, ONLY: deallocate_mo_set,&
|
||||
duplicate_mo_set,&
|
||||
get_mo_set,&
|
||||
mo_set_p_type
|
||||
USE qs_ot, ONLY: qs_ot_new_preconditioner
|
||||
USE qs_ot_scf, ONLY: ot_scf_init,&
|
||||
ot_scf_read_input
|
||||
USE qs_outer_scf, ONLY: outer_loop_optimize,&
|
||||
USE qs_outer_scf, ONLY: outer_loop_gradient,&
|
||||
outer_loop_optimize,&
|
||||
outer_loop_purge_history,&
|
||||
outer_loop_switch,&
|
||||
outer_loop_update_qs_env
|
||||
USE qs_rho_methods, ONLY: qs_rho_update_rho
|
||||
USE qs_rho_types, ONLY: qs_rho_get,&
|
||||
qs_rho_type
|
||||
USE qs_scf_initialization, ONLY: qs_scf_env_initialize
|
||||
|
|
@ -123,7 +140,9 @@ MODULE qs_scf
|
|||
qs_scf_new_mos_kp,&
|
||||
qs_scf_rho_update,&
|
||||
qs_scf_set_loop_flags
|
||||
USE qs_scf_output, ONLY: qs_scf_loop_info,&
|
||||
USE qs_scf_output, ONLY: qs_scf_cdft_info,&
|
||||
qs_scf_cdft_initial_info,&
|
||||
qs_scf_loop_info,&
|
||||
qs_scf_loop_print,&
|
||||
qs_scf_outer_loop_info,&
|
||||
qs_scf_write_mos
|
||||
|
|
@ -132,7 +151,8 @@ MODULE qs_scf
|
|||
block_davidson_diag_method_nr, block_krylov_diag_method_nr, filter_matrix_diag_method_nr, &
|
||||
general_diag_method_nr, ot_diag_method_nr, ot_method_nr, qs_scf_env_type, scf_env_release, &
|
||||
special_diag_method_nr
|
||||
USE qs_wf_history_methods, ONLY: wfi_update
|
||||
USE qs_wf_history_methods, ONLY: wfi_purge_history,&
|
||||
wfi_update
|
||||
USE scf_control_types, ONLY: scf_control_type
|
||||
#include "./base/base_uses.f90"
|
||||
|
||||
|
|
@ -141,8 +161,9 @@ MODULE qs_scf
|
|||
PRIVATE
|
||||
|
||||
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_scf'
|
||||
LOGICAL, PRIVATE :: reuse_precond = .FALSE.
|
||||
|
||||
PUBLIC :: scf, scf_env_cleanup, scf_env_do_scf
|
||||
PUBLIC :: scf, scf_env_cleanup, scf_env_do_scf, cdft_scf
|
||||
|
||||
CONTAINS
|
||||
|
||||
|
|
@ -195,8 +216,13 @@ CONTAINS
|
|||
scf_control%outer_scf%have_scf = .FALSE.
|
||||
END IF
|
||||
|
||||
CALL scf_env_do_scf(scf_env=scf_env, scf_control=scf_control, qs_env=qs_env, &
|
||||
converged=converged, should_stop=should_stop)
|
||||
IF (.NOT. dft_control%qs_control%cdft) THEN
|
||||
CALL scf_env_do_scf(scf_env=scf_env, scf_control=scf_control, qs_env=qs_env, &
|
||||
converged=converged, should_stop=should_stop)
|
||||
ELSE
|
||||
! Third SCF loop needed for CDFT with OT to properly restart OT inner loop
|
||||
CALL cdft_scf(qs_env=qs_env, should_stop=should_stop)
|
||||
END IF
|
||||
|
||||
! If SCF has not converged, then we should not start MP2
|
||||
IF (ASSOCIATED(qs_env%mp2_env)) qs_env%mp2_env%hf_fail = .NOT. converged
|
||||
|
|
@ -205,7 +231,17 @@ CONTAINS
|
|||
IF ((ASSOCIATED(qs_env%wf_history)) .AND. &
|
||||
((scf_control%density_guess .NE. history_guess) .OR. &
|
||||
(.NOT. first_step_flag))) THEN
|
||||
CALL wfi_update(qs_env%wf_history, qs_env=qs_env, dt=1.0_dp)
|
||||
IF (.NOT. dft_control%qs_control%cdft) THEN
|
||||
CALL wfi_update(qs_env%wf_history, qs_env=qs_env, dt=1.0_dp)
|
||||
ELSE
|
||||
IF (dft_control%qs_control%cdft_control%should_purge) THEN
|
||||
CALL wfi_purge_history(qs_env)
|
||||
CALL outer_loop_purge_history(qs_env)
|
||||
dft_control%qs_control%cdft_control%should_purge = .FALSE.
|
||||
ELSE
|
||||
CALL wfi_update(qs_env%wf_history, qs_env=qs_env, dt=1.0_dp)
|
||||
END IF
|
||||
END IF
|
||||
ELSE IF ((scf_control%density_guess .EQ. history_guess) .AND. &
|
||||
(first_step_flag)) THEN
|
||||
scf_control%max_scf = max_scf_tmp
|
||||
|
|
@ -218,6 +254,8 @@ CONTAINS
|
|||
|
||||
! *** cleanup
|
||||
CALL scf_env_cleanup(scf_env)
|
||||
IF (dft_control%qs_control%cdft) &
|
||||
CALL cdft_control_cleanup(dft_control%qs_control%cdft_control)
|
||||
|
||||
END IF
|
||||
|
||||
|
|
@ -248,8 +286,8 @@ CONTAINS
|
|||
CHARACTER(LEN=*), PARAMETER :: routineN = 'scf_env_do_scf', routineP = moduleN//':'//routineN
|
||||
|
||||
CHARACTER(LEN=default_string_length) :: description, name
|
||||
INTEGER :: ext_master_id, external_comm, handle, handle2, i_tmp, ic, ispin, iter_count, &
|
||||
output_unit, scf_energy_message_tag, total_steps
|
||||
INTEGER :: ext_master_id, external_comm, handle, handle2, i_tmp, iatom, ic, ispin, &
|
||||
iter_count, output_unit, scf_energy_message_tag, total_steps
|
||||
LOGICAL :: diis_step, do_kpoints, energy_only, exit_inner_loop, exit_outer_loop, &
|
||||
inner_loop_converged, just_energy, outer_loop_converged
|
||||
REAL(KIND=dp) :: t1, t2
|
||||
|
|
@ -464,6 +502,10 @@ CONTAINS
|
|||
|
||||
converged = inner_loop_converged .AND. outer_loop_converged
|
||||
|
||||
IF (dft_control%qs_control%cdft) &
|
||||
dft_control%qs_control%cdft_control%total_steps = &
|
||||
dft_control%qs_control%cdft_control%total_steps+total_steps
|
||||
|
||||
IF (.NOT. converged) CPWARN("SCF run NOT converged")
|
||||
|
||||
! if needed copy mo_coeff dbcsr->fm for later use in post_scf!fm->dbcsr
|
||||
|
|
@ -477,11 +519,43 @@ CONTAINS
|
|||
ENDDO !fm -> dbcsr
|
||||
|
||||
IF (dft_control%qs_control%becke_restraint) THEN
|
||||
CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, &
|
||||
dft_control%qs_control%becke_control%becke_pot%pw)
|
||||
dft_control%qs_control%becke_control%need_pot = .TRUE.
|
||||
! Check if Becke potential is not needed for force evaluation or CDFT and deallocate
|
||||
IF (.NOT. dft_control%qs_control%becke_control%save_pot .AND. &
|
||||
.NOT. dft_control%qs_control%cdft) THEN
|
||||
CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, &
|
||||
dft_control%qs_control%becke_control%becke_pot%pw)
|
||||
IF (dft_control%qs_control%becke_control%atomic_charges) THEN
|
||||
DO iatom = 1, dft_control%qs_control%becke_control%natoms
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, &
|
||||
dft_control%qs_control%becke_control%charge(iatom)%pw)
|
||||
END DO
|
||||
DEALLOCATE (dft_control%qs_control%becke_control%charge)
|
||||
END IF
|
||||
IF (dft_control%qs_control%becke_control%cavity_confine) THEN
|
||||
IF (.NOT. ASSOCIATED(dft_control%qs_control%becke_control%cavity_mat)) THEN
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, &
|
||||
dft_control%qs_control%becke_control%cavity%pw)
|
||||
ELSE
|
||||
DEALLOCATE (dft_control%qs_control%becke_control%cavity_mat)
|
||||
END IF
|
||||
END IF
|
||||
IF (ASSOCIATED(dft_control%qs_control%becke_control%charges_fragment)) &
|
||||
DEALLOCATE (dft_control%qs_control%becke_control%charges_fragment)
|
||||
IF (dft_control%qs_control%becke_control%constraint_type == cdft_combined_constraint) THEN
|
||||
SELECT CASE (dft_control%qs_control%becke_control%combined_type)
|
||||
CASE (cdft_combined_all)
|
||||
! Do nothing
|
||||
CASE (cdft_combined_acceptor, cdft_combined_donor)
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, &
|
||||
dft_control%qs_control%becke_control%combined_weight%pw)
|
||||
END SELECT
|
||||
END IF
|
||||
dft_control%qs_control%becke_control%need_pot = .TRUE.
|
||||
dft_control%qs_control%becke_control%external_control = .FALSE.
|
||||
END IF
|
||||
END IF
|
||||
|
||||
CALL cp_rm_iter_level(logger%iter_info, level_name="QS_SCF")
|
||||
CALL timestop(handle)
|
||||
|
||||
|
|
@ -649,9 +723,10 @@ CONTAINS
|
|||
|
||||
! if an old preconditioner is still around (i.e. outer SCF is active),
|
||||
! remove it if this could be worthwhile
|
||||
CALL restart_preconditioner(qs_env, scf_env%ot_preconditioner, &
|
||||
scf_env%qs_ot_env(1)%settings%preconditioner_type, &
|
||||
dft_control%nspins)
|
||||
IF (.NOT. reuse_precond) &
|
||||
CALL restart_preconditioner(qs_env, scf_env%ot_preconditioner, &
|
||||
scf_env%qs_ot_env(1)%settings%preconditioner_type, &
|
||||
dft_control%nspins)
|
||||
|
||||
!
|
||||
! preconditioning still needs to be done correctly with has_unit_metric
|
||||
|
|
@ -663,12 +738,14 @@ CONTAINS
|
|||
orthogonality_metric => matrix_s(1)%matrix
|
||||
ENDIF
|
||||
|
||||
CALL prepare_preconditioner(qs_env, mos, matrix_ks, matrix_s, scf_env%ot_preconditioner, &
|
||||
scf_env%qs_ot_env(1)%settings%preconditioner_type, &
|
||||
scf_env%qs_ot_env(1)%settings%precond_solver_type, &
|
||||
scf_env%qs_ot_env(1)%settings%energy_gap, dft_control%nspins, &
|
||||
has_unit_metric=has_unit_metric, &
|
||||
chol_type=scf_env%qs_ot_env(1)%settings%cholesky_type)
|
||||
IF (.NOT. reuse_precond) &
|
||||
CALL prepare_preconditioner(qs_env, mos, matrix_ks, matrix_s, scf_env%ot_preconditioner, &
|
||||
scf_env%qs_ot_env(1)%settings%preconditioner_type, &
|
||||
scf_env%qs_ot_env(1)%settings%precond_solver_type, &
|
||||
scf_env%qs_ot_env(1)%settings%energy_gap, dft_control%nspins, &
|
||||
has_unit_metric=has_unit_metric, &
|
||||
chol_type=scf_env%qs_ot_env(1)%settings%cholesky_type)
|
||||
IF (reuse_precond) reuse_precond = .FALSE.
|
||||
|
||||
CALL ot_scf_init(mo_array=mos, matrix_s=orthogonality_metric, &
|
||||
broyden_adaptive_sigma=qs_env%broyden_adaptive_sigma, &
|
||||
|
|
@ -802,9 +879,456 @@ CONTAINS
|
|||
IF (ASSOCIATED(scf_env%outer_scf%energy)) THEN
|
||||
DEALLOCATE (scf_env%outer_scf%energy)
|
||||
ENDIF
|
||||
IF (ASSOCIATED(scf_env%outer_scf%inv_jacobian)) THEN
|
||||
DEALLOCATE (scf_env%outer_scf%inv_jacobian)
|
||||
ENDIF
|
||||
|
||||
CALL timestop(handle)
|
||||
|
||||
END SUBROUTINE scf_env_cleanup
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief perform a CDFT scf procedure in the given qs_env
|
||||
!> \param qs_env the qs_environment where to perform the scf procedure
|
||||
!> \param should_stop flag determing if calculation should stop
|
||||
!> \par History
|
||||
!> 12.2015 Created
|
||||
!> \author Nico Holmberg
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE cdft_scf(qs_env, should_stop)
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
LOGICAL, INTENT(OUT) :: should_stop
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'cdft_scf', routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, iatom, ispin, output_unit
|
||||
LOGICAL :: cdft_loop_converged, converged, &
|
||||
exit_cdft_loop, first_iteration
|
||||
TYPE(cdft_control_type), POINTER :: cdft_control
|
||||
TYPE(cp_logger_type), POINTER :: logger
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s, rho_ao
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(pw_env_type), POINTER :: pw_env
|
||||
TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
|
||||
TYPE(qs_energy_type), POINTER :: energy
|
||||
TYPE(qs_ks_env_type), POINTER :: ks_env
|
||||
TYPE(qs_rho_type), POINTER :: rho
|
||||
TYPE(qs_scf_env_type), POINTER :: scf_env
|
||||
TYPE(scf_control_type), POINTER :: scf_control
|
||||
TYPE(section_vals_type), POINTER :: dft_section, input, scf_section
|
||||
|
||||
NULLIFY (scf_env, ks_env, energy, rho, matrix_s, rho_ao, cdft_control, logger, &
|
||||
dft_control, pw_env, auxbas_pw_pool, energy, ks_env, scf_env, dft_section, &
|
||||
input, scf_section, scf_control)
|
||||
logger => cp_get_default_logger()
|
||||
|
||||
CPASSERT(ASSOCIATED(qs_env))
|
||||
CALL get_qs_env(qs_env, scf_env=scf_env, energy=energy, &
|
||||
dft_control=dft_control, scf_control=scf_control, &
|
||||
ks_env=ks_env, input=input)
|
||||
|
||||
CALL timeset(routineN//"_loop", handle)
|
||||
dft_section => section_vals_get_subs_vals(input, "DFT")
|
||||
scf_section => section_vals_get_subs_vals(dft_section, "SCF")
|
||||
output_unit = cp_print_key_unit_nr(logger, scf_section, "PRINT%PROGRAM_RUN_INFO", &
|
||||
extension=".scfLog")
|
||||
first_iteration = .TRUE.
|
||||
|
||||
cdft_control => dft_control%qs_control%cdft_control
|
||||
|
||||
scf_env%outer_scf%iter_count = 0
|
||||
cdft_control%total_steps = 0
|
||||
|
||||
! Write some info about the CDFT calculation
|
||||
IF (output_unit > 0) THEN
|
||||
WRITE (UNIT=output_unit, FMT="(/,/,T2,A)") &
|
||||
"CDFT EXTERNAL SCF WAVEFUNCTION OPTIMIZATION"
|
||||
CALL qs_scf_cdft_initial_info(output_unit, cdft_control, dft_control)
|
||||
END IF
|
||||
IF (cdft_control%reuse_precond) THEN
|
||||
reuse_precond = .FALSE.
|
||||
cdft_control%nreused = 0
|
||||
END IF
|
||||
cdft_outer_loop: DO
|
||||
! Change outer_scf settings to OT settings
|
||||
CALL outer_loop_switch(scf_env, scf_control, cdft_control, cdft2ot)
|
||||
! Solve electronic structure with fixed value of constraint
|
||||
CALL scf_env_do_scf(scf_env=scf_env, scf_control=scf_control, qs_env=qs_env, &
|
||||
converged=converged, should_stop=should_stop)
|
||||
! Decide whether to reuse the preconditioner on the next iteration
|
||||
IF (cdft_control%reuse_precond) THEN
|
||||
! For convergence in exactly one step, the preconditioner is always reused (assuming max_reuse > 0)
|
||||
! usually this means that the electronic structure has already converged to the correct state
|
||||
! but the constraint optimizer keeps jumping over the optimal solution
|
||||
IF (scf_env%outer_scf%iter_count == 1 .AND. scf_env%iter_count == 1 &
|
||||
.AND. cdft_control%total_steps /= 1) &
|
||||
cdft_control%nreused = cdft_control%nreused-1
|
||||
! SCF converged in less than precond_freq steps
|
||||
IF (scf_env%outer_scf%iter_count == 1 .AND. scf_env%iter_count .LE. cdft_control%precond_freq .AND. &
|
||||
cdft_control%total_steps /= 1 .AND. cdft_control%nreused .LT. cdft_control%max_reuse) THEN
|
||||
reuse_precond = .TRUE.
|
||||
cdft_control%nreused = cdft_control%nreused+1
|
||||
ELSE
|
||||
reuse_precond = .FALSE.
|
||||
cdft_control%nreused = 0
|
||||
END IF
|
||||
END IF
|
||||
! Update history purging counters
|
||||
IF (first_iteration .AND. cdft_control%purge_history) THEN
|
||||
cdft_control%istep = cdft_control%istep+1
|
||||
IF (scf_env%outer_scf%iter_count .GT. 1) THEN
|
||||
cdft_control%nbad_conv = cdft_control%nbad_conv+1
|
||||
IF (cdft_control%nbad_conv .GE. cdft_control%purge_freq .AND. &
|
||||
cdft_control%istep .GE. cdft_control%purge_offset) THEN
|
||||
cdft_control%nbad_conv = 0
|
||||
cdft_control%istep = 0
|
||||
cdft_control%should_purge = .TRUE.
|
||||
END IF
|
||||
END IF
|
||||
END IF
|
||||
first_iteration = .FALSE.
|
||||
! Change outer_scf settings to CDFT settings
|
||||
CALL outer_loop_switch(scf_env, scf_control, cdft_control, ot2cdft)
|
||||
CALL qs_scf_check_outer_exit(qs_env, scf_env, scf_control, should_stop, &
|
||||
cdft_loop_converged, exit_cdft_loop)
|
||||
CALL qs_scf_cdft_info(output_unit, scf_control, scf_env, cdft_control, &
|
||||
energy, cdft_control%total_steps, &
|
||||
should_stop, cdft_loop_converged, cdft_loop=.TRUE.)
|
||||
IF (exit_cdft_loop) EXIT cdft_outer_loop
|
||||
! Check if inverse Jacobian needs to be calculated
|
||||
CALL outer_loop_calculate_inverse_jacobian(qs_env)
|
||||
! Optimize constraint
|
||||
CALL outer_loop_optimize(scf_env, scf_control)
|
||||
CALL outer_loop_update_qs_env(qs_env, scf_env)
|
||||
CALL qs_ks_did_change(ks_env, potential_changed=.TRUE.)
|
||||
END DO cdft_outer_loop
|
||||
|
||||
IF (dft_control%qs_control%becke_restraint) THEN
|
||||
! Store needed arrays for ET coupling calculation
|
||||
IF (cdft_control%do_et) THEN
|
||||
CALL get_qs_env(qs_env=qs_env, matrix_s=matrix_s)
|
||||
CALL dbcsr_init_p(cdft_control%wmat%matrix)
|
||||
CALL dbcsr_copy(cdft_control%wmat%matrix, matrix_s(1)%matrix, &
|
||||
name="ET_RESTRAINT_MATRIX")
|
||||
CALL dbcsr_set(cdft_control%wmat%matrix, 0.0_dp)
|
||||
CALL integrate_v_rspace(dft_control%qs_control%becke_control%becke_pot, &
|
||||
hmat=cdft_control%wmat, qs_env=qs_env, &
|
||||
calculate_forces=.FALSE., &
|
||||
gapw=dft_control%qs_control%gapw)
|
||||
CALL dbcsr_init_p(cdft_control%matrix_s%matrix)
|
||||
CALL dbcsr_copy(cdft_control%matrix_s%matrix, matrix_s(1)%matrix, &
|
||||
name="OVERLAP")
|
||||
NULLIFY (cdft_control%mo_coeff)
|
||||
ALLOCATE (cdft_control%mo_coeff(dft_control%nspins))
|
||||
DO ispin = 1, dft_control%nspins
|
||||
NULLIFY (cdft_control%mo_coeff(ispin)%matrix)
|
||||
CALL cp_fm_create(matrix=cdft_control%mo_coeff(ispin)%matrix, &
|
||||
matrix_struct=qs_env%mos(ispin)%mo_set%mo_coeff%matrix_struct, &
|
||||
name="MO_COEFF_A"//TRIM(ADJUSTL(cp_to_string(ispin)))//"MATRIX")
|
||||
CALL cp_fm_to_fm(qs_env%mos(ispin)%mo_set%mo_coeff, &
|
||||
cdft_control%mo_coeff(ispin)%matrix)
|
||||
END DO
|
||||
IF (cdft_control%calculate_metric) THEN
|
||||
CALL get_qs_env(qs_env, rho=rho)
|
||||
CALL qs_rho_get(rho, rho_ao=rho_ao)
|
||||
ALLOCATE (cdft_control%matrix_p(dft_control%nspins))
|
||||
DO ispin = 1, dft_control%nspins
|
||||
NULLIFY (cdft_control%matrix_p(ispin)%matrix)
|
||||
CALL dbcsr_init_p(cdft_control%matrix_p(ispin)%matrix)
|
||||
CALL dbcsr_copy(cdft_control%matrix_p(ispin)%matrix, rho_ao(ispin)%matrix, &
|
||||
name="DENSITY MATRIX")
|
||||
END DO
|
||||
END IF
|
||||
END IF
|
||||
! Forces are not needed => time to deallocate Becke
|
||||
IF (.NOT. dft_control%qs_control%becke_control%save_pot) THEN
|
||||
CALL get_qs_env(qs_env, pw_env=pw_env)
|
||||
CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, &
|
||||
dft_control%qs_control%becke_control%becke_pot%pw)
|
||||
IF (dft_control%qs_control%becke_control%atomic_charges) THEN
|
||||
DO iatom = 1, dft_control%qs_control%becke_control%natoms
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, &
|
||||
dft_control%qs_control%becke_control%charge(iatom)%pw)
|
||||
END DO
|
||||
DEALLOCATE (dft_control%qs_control%becke_control%charge)
|
||||
END IF
|
||||
IF (dft_control%qs_control%becke_control%cavity_confine) THEN
|
||||
IF (.NOT. ASSOCIATED(dft_control%qs_control%becke_control%cavity_mat)) THEN
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, &
|
||||
dft_control%qs_control%becke_control%cavity%pw)
|
||||
ELSE
|
||||
DEALLOCATE (dft_control%qs_control%becke_control%cavity_mat)
|
||||
END IF
|
||||
END IF
|
||||
IF (ASSOCIATED(dft_control%qs_control%becke_control%charges_fragment)) &
|
||||
DEALLOCATE (dft_control%qs_control%becke_control%charges_fragment)
|
||||
IF (dft_control%qs_control%becke_control%constraint_type == cdft_combined_constraint) THEN
|
||||
SELECT CASE (dft_control%qs_control%becke_control%combined_type)
|
||||
CASE (cdft_combined_all)
|
||||
! Do nothing
|
||||
CASE (cdft_combined_acceptor, cdft_combined_donor)
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, &
|
||||
dft_control%qs_control%becke_control%combined_weight%pw)
|
||||
END SELECT
|
||||
END IF
|
||||
dft_control%qs_control%becke_control%need_pot = .TRUE.
|
||||
dft_control%qs_control%becke_control%external_control = .FALSE.
|
||||
END IF
|
||||
END IF
|
||||
|
||||
IF (dft_control%qs_control%cdft) THEN
|
||||
IF (cdft_control%type == outer_scf_hirshfeld_constraint) THEN
|
||||
IF (.NOT. cdft_control%save_pot) THEN
|
||||
CALL get_qs_env(qs_env, pw_env=pw_env)
|
||||
CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
|
||||
CALL pw_pool_give_back_pw(auxbas_pw_pool, cdft_control%weight%pw)
|
||||
cdft_control%need_pot = .TRUE.
|
||||
END IF
|
||||
END IF
|
||||
END IF
|
||||
CALL timestop(handle)
|
||||
|
||||
END SUBROUTINE cdft_scf
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief perform cleanup operations for cdft_control
|
||||
!> \param cdft_control container for the external CDFT SCF loop variables
|
||||
!> \par History
|
||||
!> 12.2015 created [Nico Holmberg]
|
||||
!> \author Nico Holmberg
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE cdft_control_cleanup(cdft_control)
|
||||
TYPE(cdft_control_type), POINTER :: cdft_control
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'cdft_control_cleanup', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
IF (ASSOCIATED(cdft_control%constraint%variables)) &
|
||||
DEALLOCATE (cdft_control%constraint%variables)
|
||||
IF (ASSOCIATED(cdft_control%constraint%count)) &
|
||||
DEALLOCATE (cdft_control%constraint%count)
|
||||
IF (ASSOCIATED(cdft_control%constraint%gradient)) &
|
||||
DEALLOCATE (cdft_control%constraint%gradient)
|
||||
IF (ASSOCIATED(cdft_control%constraint%energy)) &
|
||||
DEALLOCATE (cdft_control%constraint%energy)
|
||||
|
||||
END SUBROUTINE cdft_control_cleanup
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief Calculates the finite difference inverse Jacobian
|
||||
!> \param qs_env the qs_environment_type where to compute the Jacobian
|
||||
!> \par History
|
||||
!> 01.2017 created [Nico Holmberg]
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE outer_loop_calculate_inverse_jacobian(qs_env)
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
|
||||
CHARACTER(LEN=*), PARAMETER :: routineN = 'outer_loop_calculate_inverse_jacobian', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, i, ispin, iter_count, iwork, j, &
|
||||
max_scf, nspins, nvar, nwork, &
|
||||
output_unit, pwork
|
||||
LOGICAL :: converged, should_stop
|
||||
REAL(KIND=dp) :: dh, inv_error
|
||||
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: coeff, step_multiplier
|
||||
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: jacobian
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: energy
|
||||
REAL(KIND=dp), DIMENSION(:, :), POINTER :: gradient, inv_jacobian
|
||||
TYPE(cdft_control_type), POINTER :: cdft_control
|
||||
TYPE(cp_logger_type), POINTER :: logger
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: p_rmpv
|
||||
TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: rho_ao_kp
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(mo_set_p_type), DIMENSION(:), POINTER :: mos, mos_stashed
|
||||
TYPE(qs_ks_env_type), POINTER :: ks_env
|
||||
TYPE(qs_rho_type), POINTER :: rho
|
||||
TYPE(qs_scf_env_type), POINTER :: scf_env
|
||||
TYPE(scf_control_type), POINTER :: scf_control
|
||||
TYPE(section_vals_type), POINTER :: input, scf_section
|
||||
|
||||
CALL timeset(routineN, handle)
|
||||
|
||||
NULLIFY (energy, gradient, p_rmpv, rho_ao_kp, mos, rho, &
|
||||
mos_stashed, ks_env, scf_env, scf_control, dft_control, &
|
||||
cdft_control, input, scf_section, inv_jacobian)
|
||||
logger => cp_get_default_logger()
|
||||
|
||||
CPASSERT(ASSOCIATED(qs_env))
|
||||
CALL get_qs_env(qs_env, scf_env=scf_env, ks_env=ks_env, &
|
||||
scf_control=scf_control, mos=mos, rho=rho, &
|
||||
dft_control=dft_control, input=input)
|
||||
|
||||
SELECT CASE (scf_control%outer_scf%optimizer)
|
||||
CASE DEFAULT
|
||||
scf_control%outer_scf%build_jacobian = .FALSE.
|
||||
CASE (outer_scf_optimizer_newton)
|
||||
scf_control%outer_scf%build_jacobian = .TRUE.
|
||||
CASE (outer_scf_optimizer_broyden)
|
||||
! TODO: Add Broyden variants where the explicit Jacobian is built
|
||||
scf_control%outer_scf%build_jacobian = .FALSE.
|
||||
END SELECT
|
||||
|
||||
IF (scf_control%outer_scf%build_jacobian) THEN
|
||||
! Get output_unit
|
||||
scf_section => section_vals_get_subs_vals(input, "DFT%SCF")
|
||||
output_unit = cp_print_key_unit_nr(logger, scf_section, "PRINT%PROGRAM_RUN_INFO", &
|
||||
extension=".scfLog")
|
||||
! Save last converged state so we can roll back to it (mo_coeff and some outer_loop variables)
|
||||
nspins = dft_control%nspins
|
||||
ALLOCATE (mos_stashed(nspins))
|
||||
DO ispin = 1, nspins
|
||||
CALL duplicate_mo_set(mos_stashed(ispin)%mo_set, mos(ispin)%mo_set)
|
||||
END DO
|
||||
CALL qs_rho_get(rho, rho_ao_kp=rho_ao_kp)
|
||||
p_rmpv => rho_ao_kp(:, 1)
|
||||
cdft_control => dft_control%qs_control%cdft_control
|
||||
IF (.NOT. ASSOCIATED(cdft_control)) &
|
||||
CALL cp_abort(__LOCATION__, "Optimizers that need the explicit Jacobian can"// &
|
||||
" only be used together with a valid CDFT constraint")
|
||||
! Allocate work
|
||||
nvar = SIZE(scf_env%outer_scf%variables, 1)
|
||||
max_scf = scf_control%outer_scf%max_scf+1
|
||||
iter_count = scf_env%outer_scf%iter_count
|
||||
ALLOCATE (gradient(nvar, max_scf))
|
||||
gradient = scf_env%outer_scf%gradient
|
||||
ALLOCATE (energy(max_scf))
|
||||
energy = scf_env%outer_scf%energy
|
||||
ALLOCATE (jacobian(nvar, nvar))
|
||||
jacobian = 0.0_dp
|
||||
! Setup finite difference scheme
|
||||
SELECT CASE (scf_control%outer_scf%jacobian_type)
|
||||
CASE DEFAULT
|
||||
CALL cp_abort(__LOCATION__, "Unknown Jacobian type: "// &
|
||||
cp_to_string(scf_control%outer_scf%jacobian_type))
|
||||
CASE (jacobian_fd1)
|
||||
nwork = 0
|
||||
pwork = 1
|
||||
ALLOCATE (coeff(nwork:pwork), step_multiplier(nwork:pwork))
|
||||
coeff(nwork) = -1.0_dp
|
||||
coeff(pwork) = 1.0_dp
|
||||
step_multiplier = 1.0_dp
|
||||
dh = scf_control%outer_scf%jacobian_step
|
||||
CASE (jacobian_fd1_backward)
|
||||
nwork = -1
|
||||
pwork = 0
|
||||
ALLOCATE (coeff(nwork:pwork), step_multiplier(nwork:pwork))
|
||||
coeff(nwork) = -1.0_dp
|
||||
coeff(pwork) = 1.0_dp
|
||||
step_multiplier = -1.0_dp
|
||||
dh = scf_control%outer_scf%jacobian_step
|
||||
CASE (jacobian_fd2)
|
||||
nwork = 0
|
||||
pwork = 2
|
||||
ALLOCATE (coeff(nwork:pwork), step_multiplier(nwork:pwork))
|
||||
coeff(0) = -3.0_dp/2.0_dp
|
||||
coeff(1) = 2.0_dp
|
||||
coeff(2) = -1.0_dp/2.0_dp
|
||||
step_multiplier = 1.0_dp
|
||||
step_multiplier(2) = 2.0_dp
|
||||
dh = 2.0_dp*scf_control%outer_scf%jacobian_step
|
||||
CASE (jacobian_fd2_backward)
|
||||
nwork = -2
|
||||
pwork = 0
|
||||
ALLOCATE (coeff(nwork:pwork), step_multiplier(nwork:pwork))
|
||||
coeff(0) = 3.0_dp/2.0_dp
|
||||
coeff(-1) = -2.0_dp
|
||||
coeff(-2) = 1.0_dp/2.0_dp
|
||||
step_multiplier = -1.0_dp
|
||||
step_multiplier(-2) = -2.0_dp
|
||||
dh = 2.0_dp*scf_control%outer_scf%jacobian_step
|
||||
CASE (jacobian_fd1_central)
|
||||
nwork = -1
|
||||
pwork = 1
|
||||
ALLOCATE (coeff(nwork:pwork), step_multiplier(nwork:pwork))
|
||||
coeff(nwork) = -1.0_dp/2.0_dp
|
||||
coeff(pwork) = 1.0_dp/2.0_dp
|
||||
step_multiplier = 1.0_dp
|
||||
step_multiplier(nwork) = -1.0_dp
|
||||
dh = 2.0_dp*scf_control%outer_scf%jacobian_step
|
||||
END SELECT
|
||||
DO i = 1, nvar
|
||||
jacobian(i, :) = coeff(0)*scf_env%outer_scf%gradient(i, iter_count)
|
||||
END DO
|
||||
! Print some info
|
||||
IF (output_unit > 0) THEN
|
||||
WRITE (output_unit, FMT="(/,A)") &
|
||||
" ============================== CDFT SCF LOOP =================================="
|
||||
WRITE (output_unit, FMT="(A)") &
|
||||
" Evaluating inverse Jacobian using finite differences"
|
||||
SELECT CASE (scf_control%outer_scf%jacobian_type)
|
||||
CASE (jacobian_fd1)
|
||||
WRITE (output_unit, '(A)') " Type : First order forward difference"
|
||||
CASE (jacobian_fd1_backward)
|
||||
WRITE (output_unit, '(A)') " Type : First order backward difference"
|
||||
CASE (jacobian_fd2)
|
||||
WRITE (output_unit, '(A)') " Type : Second order forward difference"
|
||||
CASE (jacobian_fd2_backward)
|
||||
WRITE (output_unit, '(A)') " Type : Second order backward difference"
|
||||
CASE (jacobian_fd1_central)
|
||||
WRITE (output_unit, '(A)') " Type : First order central difference"
|
||||
CASE DEFAULT
|
||||
CALL cp_abort(__LOCATION__, "Unknown Jacobian type: "// &
|
||||
cp_to_string(scf_control%outer_scf%jacobian_type))
|
||||
END SELECT
|
||||
WRITE (output_unit, '(A,ES12.4)') " Step size : ", scf_control%outer_scf%jacobian_step
|
||||
END IF
|
||||
! Calculate the Jacobian by perturbing each Lagrangian and recalculating the energy self-consistently
|
||||
DO i = 1, nvar
|
||||
DO iwork = nwork, pwork
|
||||
IF (iwork == 0) CYCLE
|
||||
scf_env%outer_scf%variables(i, iter_count+1) = scf_env%outer_scf%variables(i, iter_count)+ &
|
||||
step_multiplier(iwork)* &
|
||||
scf_control%outer_scf%jacobian_step
|
||||
CALL outer_loop_update_qs_env(qs_env, scf_env)
|
||||
CALL qs_ks_did_change(ks_env, potential_changed=.TRUE.)
|
||||
CALL outer_loop_switch(scf_env, scf_control, cdft_control, cdft2ot)
|
||||
CALL scf_env_do_scf(scf_env=scf_env, scf_control=scf_control, qs_env=qs_env, &
|
||||
converged=converged, should_stop=should_stop)
|
||||
CALL outer_loop_switch(scf_env, scf_control, cdft_control, ot2cdft)
|
||||
! Update (iter_count + 1) element of gradient
|
||||
scf_env%outer_scf%iter_count = scf_env%outer_scf%iter_count+1
|
||||
CALL outer_loop_gradient(qs_env, scf_env)
|
||||
scf_env%outer_scf%iter_count = scf_env%outer_scf%iter_count-1
|
||||
! Update Jacobian
|
||||
DO j = 1, nvar
|
||||
jacobian(j, i) = jacobian(j, i)+coeff(iwork)*scf_env%outer_scf%gradient(j, iter_count+1)
|
||||
END DO
|
||||
! Reset everything to last converged state
|
||||
scf_env%outer_scf%variables(i, iter_count+1) = 0.0_dp
|
||||
scf_env%outer_scf%gradient = gradient
|
||||
scf_env%outer_scf%energy = energy
|
||||
DO ispin = 1, nspins
|
||||
CALL duplicate_mo_set(mos(ispin)%mo_set, mos_stashed(ispin)%mo_set)
|
||||
IF (mos(ispin)%mo_set%use_mo_coeff_b) THEN
|
||||
CALL copy_fm_to_dbcsr(mos(ispin)%mo_set%mo_coeff, &
|
||||
mos(ispin)%mo_set%mo_coeff_b)
|
||||
ENDIF
|
||||
CALL calculate_density_matrix(mos(ispin)%mo_set, &
|
||||
p_rmpv(ispin)%matrix)
|
||||
END DO
|
||||
CALL qs_rho_update_rho(rho, qs_env=qs_env)
|
||||
CALL qs_ks_did_change(qs_env%ks_env, rho_changed=.TRUE.)
|
||||
END DO
|
||||
END DO
|
||||
! Finalize and invert Jacobian
|
||||
jacobian = jacobian/dh
|
||||
IF (.NOT. ASSOCIATED(scf_env%outer_scf%inv_jacobian)) &
|
||||
ALLOCATE (scf_env%outer_scf%inv_jacobian(nvar, nvar))
|
||||
inv_jacobian => scf_env%outer_scf%inv_jacobian
|
||||
CALL invert_matrix(jacobian, inv_jacobian, inv_error)
|
||||
! Release temporary storage
|
||||
DO ispin = 1, nspins
|
||||
CALL deallocate_mo_set(mos_stashed(ispin)%mo_set)
|
||||
END DO
|
||||
DEALLOCATE (mos_stashed, jacobian, gradient, energy, coeff, step_multiplier)
|
||||
IF (output_unit > 0) &
|
||||
WRITE (output_unit, FMT="(/,A)") &
|
||||
" ============================= JACOBIAN CALCULATED ============================="
|
||||
END IF
|
||||
CALL timestop(handle)
|
||||
|
||||
END SUBROUTINE outer_loop_calculate_inverse_jacobian
|
||||
|
||||
END MODULE qs_scf
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ MODULE qs_scf_initialization
|
|||
USE input_constants, ONLY: &
|
||||
broy_mix, broy_mix_new, cholesky_dbcsr, cholesky_inverse, cholesky_off, &
|
||||
diag_block_davidson, diag_block_krylov, diag_filter_matrix, diag_ot, diag_standard, &
|
||||
direct_p_mix, kerker_mix, multisec_mix, no_mix, plus_u_lowdin, pulay_mix, &
|
||||
direct_p_mix, kerker_mix, multisec_mix, no_mix, ot2cdft, outer_scf_becke_constraint, &
|
||||
outer_scf_hirshfeld_constraint, outer_scf_none, plus_u_lowdin, pulay_mix, &
|
||||
wfi_frozen_method_nr, wfi_use_guess_method_nr
|
||||
USE input_section_types, ONLY: section_vals_get_subs_vals,&
|
||||
section_vals_type,&
|
||||
|
|
@ -84,6 +85,7 @@ MODULE qs_scf_initialization
|
|||
init_mo_set,&
|
||||
mo_set_p_type
|
||||
USE qs_outer_scf, ONLY: outer_loop_extrapolate,&
|
||||
outer_loop_switch,&
|
||||
outer_loop_variables_count
|
||||
USE qs_rho_atom_types, ONLY: rho_atom_type
|
||||
USE qs_rho_methods, ONLY: duplicate_rho_type,&
|
||||
|
|
@ -169,7 +171,14 @@ CONTAINS
|
|||
|
||||
CALL qs_scf_ensure_mixing_store(qs_env, scf_env)
|
||||
|
||||
CALL qs_scf_ensure_outer_loop_vars(scf_env, my_scf_control)
|
||||
! Initialize outer loop variables: handle CDFT and regular outer loop separately
|
||||
dft_control%qs_control%cdft = (dft_control%qs_control%cdft .AND. my_scf_control%use_ot)
|
||||
IF (dft_control%qs_control%cdft) THEN
|
||||
CALL qs_scf_ensure_cdft_loop_vars(qs_env, scf_env, dft_control, &
|
||||
scf_control=my_scf_control)
|
||||
ELSE
|
||||
CALL qs_scf_ensure_outer_loop_vars(scf_env, my_scf_control)
|
||||
END IF
|
||||
|
||||
CALL init_scf_run(scf_env, qs_env, my_scf_section, my_scf_control)
|
||||
|
||||
|
|
@ -281,6 +290,100 @@ CONTAINS
|
|||
|
||||
END SUBROUTINE qs_scf_ensure_outer_loop_vars
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief performs allocation of CDFT SCF variables
|
||||
!> \param qs_env the qs_env where to perform the allocation
|
||||
!> \param scf_env the currently active scf_env
|
||||
!> \param dft_control the dft_control that holds the cdft_control type
|
||||
!> \param scf_control the currently active scf_control
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE qs_scf_ensure_cdft_loop_vars(qs_env, scf_env, dft_control, scf_control)
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
TYPE(qs_scf_env_type), POINTER :: scf_env
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(scf_control_type), POINTER :: scf_control
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'qs_scf_ensure_cdft_loop_vars', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: nhistory, nvariables
|
||||
LOGICAL :: do_kpoints
|
||||
REAL(KIND=dp), DIMENSION(:, :), POINTER :: outer_scf_history
|
||||
|
||||
CALL get_qs_env(qs_env=qs_env, do_kpoints=do_kpoints)
|
||||
! Check only one constraint section is active
|
||||
IF (dft_control%qs_control%becke_restraint .AND. &
|
||||
dft_control%qs_control%cdft_control%type == outer_scf_hirshfeld_constraint) &
|
||||
CPABORT("Only one constraint can be active simultaneously")
|
||||
! Test kpoints
|
||||
IF (do_kpoints) &
|
||||
CPABORT("CDFT calculation not possible with kpoints")
|
||||
! Initialize CDFT and outer_loop variables (constraint settings active in scf_control)
|
||||
IF (dft_control%qs_control%cdft_control%constraint_control%have_scf) THEN
|
||||
nhistory = dft_control%qs_control%cdft_control%constraint_control%max_scf+1
|
||||
IF (scf_control%outer_scf%type /= outer_scf_none) THEN
|
||||
nvariables = outer_loop_variables_count(scf_control, &
|
||||
dft_control%qs_control%cdft_control)
|
||||
ELSE
|
||||
! First iteration: scf_control has not yet been updated
|
||||
SELECT CASE (dft_control%qs_control%cdft_control%type)
|
||||
CASE (outer_scf_becke_constraint)
|
||||
nvariables = SIZE(dft_control%qs_control%becke_control%target)
|
||||
CASE (outer_scf_hirshfeld_constraint)
|
||||
nvariables = SIZE(dft_control%qs_control%cdft_control%target)
|
||||
END SELECT
|
||||
END IF
|
||||
ALLOCATE (dft_control%qs_control%cdft_control%constraint%variables(nvariables, nhistory))
|
||||
ALLOCATE (dft_control%qs_control%cdft_control%constraint%count(nhistory))
|
||||
dft_control%qs_control%cdft_control%constraint%count = 0
|
||||
ALLOCATE (dft_control%qs_control%cdft_control%constraint%gradient(nvariables, nhistory))
|
||||
ALLOCATE (dft_control%qs_control%cdft_control%constraint%energy(nhistory))
|
||||
CALL qs_scf_ensure_outer_loop_vars(scf_env, scf_control)
|
||||
ENDIF
|
||||
! Executed only on first call (OT settings active in scf_control)
|
||||
! Save OT settings and constraint initial values in CDFT control
|
||||
! Then switch to constraint outer_scf settings for proper initialization of history
|
||||
NULLIFY (outer_scf_history)
|
||||
IF (scf_control%outer_scf%have_scf) THEN
|
||||
IF (scf_control%outer_scf%type == outer_scf_none) THEN
|
||||
dft_control%qs_control%cdft_control%ot_control%have_scf = .TRUE.
|
||||
dft_control%qs_control%cdft_control%ot_control%max_scf = scf_control%outer_scf%max_scf
|
||||
dft_control%qs_control%cdft_control%ot_control%eps_scf = scf_control%outer_scf%eps_scf
|
||||
dft_control%qs_control%cdft_control%ot_control%step_size = scf_control%outer_scf%step_size
|
||||
dft_control%qs_control%cdft_control%ot_control%type = scf_control%outer_scf%type
|
||||
dft_control%qs_control%cdft_control%ot_control%optimizer = scf_control%outer_scf%optimizer
|
||||
dft_control%qs_control%cdft_control%ot_control%diis_buffer_length = scf_control%outer_scf%diis_buffer_length
|
||||
dft_control%qs_control%cdft_control%ot_control%jacobian_type = scf_control%outer_scf%jacobian_type
|
||||
dft_control%qs_control%cdft_control%ot_control%bisect_trust_count = scf_control%outer_scf%bisect_trust_count
|
||||
nvariables = 1
|
||||
! Constraint specific initializations
|
||||
IF (dft_control%qs_control%becke_restraint) THEN
|
||||
nvariables = SIZE(dft_control%qs_control%becke_control%target)
|
||||
IF (.NOT. ASSOCIATED(dft_control%qs_control%cdft_control%target)) &
|
||||
ALLOCATE (dft_control%qs_control%cdft_control%target(nvariables))
|
||||
IF (.NOT. ASSOCIATED(dft_control%qs_control%cdft_control%value)) &
|
||||
ALLOCATE (dft_control%qs_control%cdft_control%value(nvariables))
|
||||
IF (.NOT. ASSOCIATED(dft_control%qs_control%cdft_control%strength)) &
|
||||
ALLOCATE (dft_control%qs_control%cdft_control%strength(nvariables))
|
||||
dft_control%qs_control%cdft_control%target = dft_control%qs_control%becke_control%target
|
||||
dft_control%qs_control%cdft_control%constraint_type = dft_control%qs_control%becke_control%constraint_type
|
||||
dft_control%qs_control%cdft_control%combined_type = dft_control%qs_control%becke_control%combined_type
|
||||
END IF
|
||||
! In case constraint and ot extrapolation orders are different, make sure to use former
|
||||
IF (scf_control%outer_scf%extrapolation_order /= &
|
||||
dft_control%qs_control%cdft_control%constraint_control%extrapolation_order &
|
||||
.OR. nvariables == 2) THEN
|
||||
DEALLOCATE (qs_env%outer_scf_history)
|
||||
nhistory = dft_control%qs_control%cdft_control%constraint_control%extrapolation_order
|
||||
ALLOCATE (outer_scf_history(nvariables, nhistory))
|
||||
CALL set_qs_env(qs_env, outer_scf_history=outer_scf_history)
|
||||
END IF
|
||||
CALL outer_loop_switch(scf_env, scf_control, dft_control%qs_control%cdft_control, ot2cdft)
|
||||
END IF
|
||||
END IF
|
||||
|
||||
END SUBROUTINE qs_scf_ensure_cdft_loop_vars
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief performs allocation of the mixing storage
|
||||
!> \param qs_env ...
|
||||
|
|
|
|||
|
|
@ -480,8 +480,9 @@ CONTAINS
|
|||
outer_loop_converged = .FALSE.
|
||||
|
||||
CALL outer_loop_gradient(qs_env, scf_env)
|
||||
outer_loop_eps = SQRT(SUM(scf_env%outer_scf%gradient(:, scf_env%outer_scf%iter_count)**2))/ &
|
||||
SIZE(scf_env%outer_scf%gradient, 1)
|
||||
! Multiple constraints: get largest deviation
|
||||
outer_loop_eps = SQRT(MAXVAL(scf_env%outer_scf%gradient(:, scf_env%outer_scf%iter_count)**2))
|
||||
|
||||
IF (outer_loop_eps < scf_control%outer_scf%eps_scf) outer_loop_converged = .TRUE.
|
||||
END IF
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
MODULE qs_scf_output
|
||||
USE atomic_kind_types, ONLY: atomic_kind_type
|
||||
USE cp_control_types, ONLY: dft_control_type
|
||||
USE cp_control_types, ONLY: cdft_control_type,&
|
||||
dft_control_type
|
||||
USE cp_dbcsr_output, ONLY: cp_dbcsr_write_sparse_matrix
|
||||
USE cp_log_handling, ONLY: cp_get_default_logger,&
|
||||
cp_logger_type
|
||||
|
|
@ -16,6 +17,13 @@ MODULE qs_scf_output
|
|||
USE cp_para_types, ONLY: cp_para_env_type
|
||||
USE cp_units, ONLY: cp_unit_from_cp2k
|
||||
USE dbcsr_api, ONLY: dbcsr_p_type
|
||||
USE input_constants, ONLY: &
|
||||
becke_cavity_conf, becke_cutoff_element, becke_cutoff_global, becke_dynamic_conf, &
|
||||
becke_mixed_conf, becke_none_conf, becke_static_conf, cdft_combined_acceptor, &
|
||||
cdft_combined_all, cdft_combined_constraint, cdft_combined_donor, cdft_density_constraint, &
|
||||
cdft_magnetization_constraint, outer_scf_becke_constraint, outer_scf_hirshfeld_constraint, &
|
||||
outer_scf_optimizer_bisect, outer_scf_optimizer_broyden, outer_scf_optimizer_diis, &
|
||||
outer_scf_optimizer_sd, radius_covalent, radius_single, radius_user, radius_vdw
|
||||
USE input_section_types, ONLY: section_vals_get_subs_vals,&
|
||||
section_vals_type,&
|
||||
section_vals_val_get
|
||||
|
|
@ -60,7 +68,9 @@ MODULE qs_scf_output
|
|||
qs_scf_loop_print, &
|
||||
qs_scf_outer_loop_info, &
|
||||
qs_scf_initial_info, &
|
||||
qs_scf_write_mos
|
||||
qs_scf_write_mos, &
|
||||
qs_scf_cdft_info, &
|
||||
qs_scf_cdft_initial_info
|
||||
|
||||
CONTAINS
|
||||
|
||||
|
|
@ -191,8 +201,7 @@ CONTAINS
|
|||
|
||||
REAL(KIND=dp) :: outer_loop_eps
|
||||
|
||||
outer_loop_eps = SQRT(SUM(scf_env%outer_scf%gradient(:, scf_env%outer_scf%iter_count)**2))/ &
|
||||
SIZE(scf_env%outer_scf%gradient, 1)
|
||||
outer_loop_eps = SQRT(MAXVAL(scf_env%outer_scf%gradient(:, scf_env%outer_scf%iter_count)**2))
|
||||
IF (output_unit > 0) WRITE (output_unit, '(/,T3,A,I4,A,E10.2,A,F22.10)') &
|
||||
"outer SCF iter = ", scf_env%outer_scf%iter_count, &
|
||||
" RMS gradient = ", outer_loop_eps, " energy =", energy%total
|
||||
|
|
@ -604,4 +613,265 @@ CONTAINS
|
|||
|
||||
END SUBROUTINE qs_scf_loop_print
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief writes CDFT constraint information and optionally CDFT scf loop info
|
||||
!> \param output_unit where to write the information
|
||||
!> \param scf_control settings of the SCF loop
|
||||
!> \param scf_env the env which holds convergence data
|
||||
!> \param cdft_control the env which holds information about the constraint
|
||||
!> \param energy the total energy
|
||||
!> \param total_steps the total number of performed SCF iterations
|
||||
!> \param should_stop if the calculation should stop
|
||||
!> \param outer_loop_converged logical which determines if the CDFT SCF loop converged
|
||||
!> \param cdft_loop logical which determines a CDFT SCF loop is active
|
||||
!> \par History
|
||||
!> 12.2015 created [Nico Holmberg]
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE qs_scf_cdft_info(output_unit, scf_control, scf_env, cdft_control, &
|
||||
energy, total_steps, should_stop, outer_loop_converged, &
|
||||
cdft_loop)
|
||||
INTEGER :: output_unit
|
||||
TYPE(scf_control_type), POINTER :: scf_control
|
||||
TYPE(qs_scf_env_type), POINTER :: scf_env
|
||||
TYPE(cdft_control_type), POINTER :: cdft_control
|
||||
TYPE(qs_energy_type), POINTER :: energy
|
||||
INTEGER :: total_steps
|
||||
LOGICAL, INTENT(IN) :: should_stop, outer_loop_converged, &
|
||||
cdft_loop
|
||||
|
||||
CHARACTER(LEN=*), PARAMETER :: routineN = 'qs_scf_cdft_info', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
REAL(KIND=dp) :: outer_loop_eps
|
||||
|
||||
IF (cdft_loop) THEN
|
||||
outer_loop_eps = SQRT(MAXVAL(scf_env%outer_scf%gradient(:, scf_env%outer_scf%iter_count)**2))
|
||||
IF (output_unit > 0) WRITE (output_unit, '(/,T3,A,I4,A,E10.2,A,F22.10)') &
|
||||
"CDFT SCF iter = ", scf_env%outer_scf%iter_count, &
|
||||
" RMS gradient = ", outer_loop_eps, " energy =", energy%total
|
||||
IF (outer_loop_converged) THEN
|
||||
IF (output_unit > 0) WRITE (output_unit, '(T3,A,I4,A,I4,A,/)') &
|
||||
"CDFT SCF loop converged in", scf_env%outer_scf%iter_count, &
|
||||
" iterations or ", total_steps, " steps"
|
||||
END IF
|
||||
IF ((scf_env%outer_scf%iter_count > scf_control%outer_scf%max_scf .OR. should_stop) &
|
||||
.AND. .NOT. outer_loop_converged) THEN
|
||||
IF (output_unit > 0) WRITE (output_unit, '(T3,A,I4,A,I4,A,/)') &
|
||||
"CDFT SCF loop FAILED to converge after ", &
|
||||
scf_env%outer_scf%iter_count, " iterations or ", total_steps, " steps"
|
||||
END IF
|
||||
END IF
|
||||
IF (output_unit > 0) THEN
|
||||
SELECT CASE (cdft_control%type)
|
||||
CASE (outer_scf_hirshfeld_constraint)
|
||||
WRITE (output_unit, '(/,T3,A,T60)') &
|
||||
'------------------- Hirshfeld constraint information -------------------'
|
||||
CASE (outer_scf_becke_constraint)
|
||||
WRITE (output_unit, '(/,T3,A,T60)') &
|
||||
'--------------------- Becke constraint information ---------------------'
|
||||
END SELECT
|
||||
SELECT CASE (cdft_control%constraint_type)
|
||||
CASE (cdft_density_constraint, cdft_magnetization_constraint)
|
||||
WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
|
||||
'Target value of constraint :', cdft_control%target(1)
|
||||
WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
|
||||
'Current value of constraint :', cdft_control%value(1)
|
||||
WRITE (output_unit, '(T3,A,T59,(3X,ES13.3))') &
|
||||
'Deviation from target :', cdft_control%value(1)-cdft_control%target(1)
|
||||
WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
|
||||
'Strength of constraint :', cdft_control%strength(1)
|
||||
CASE (cdft_combined_constraint)
|
||||
WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
|
||||
'Target value of charge constraint :', cdft_control%target(1)
|
||||
WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
|
||||
'Target value of spin constraint :', cdft_control%target(2)
|
||||
WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
|
||||
'Current value of charge constraint:', cdft_control%value(1)
|
||||
WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
|
||||
'Current value of spin constraint :', cdft_control%value(2)
|
||||
WRITE (output_unit, '(T3,A,T59,(3X,ES13.3))') &
|
||||
'Deviation from target (charge) :', cdft_control%value(1)-cdft_control%target(1)
|
||||
WRITE (output_unit, '(T3,A,T59,(3X,ES13.3))') &
|
||||
'Deviation from target (spin) :', cdft_control%value(2)-cdft_control%target(2)
|
||||
WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
|
||||
'Strength of constraint (charge) :', cdft_control%strength(1)
|
||||
WRITE (output_unit, '(T3,A,T54,(3X,F18.12))') &
|
||||
'Strength of constraint (spin) :', cdft_control%strength(2)
|
||||
END SELECT
|
||||
WRITE (output_unit, '(T3,A)') &
|
||||
'------------------------------------------------------------------------'
|
||||
END IF
|
||||
END SUBROUTINE qs_scf_cdft_info
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief writes information about the CDFT env
|
||||
!> \param output_unit where to write the information
|
||||
!> \param cdft_control the CDFT env that stores information about the constraint calculation
|
||||
!> \param dft_control container for Becke constraint related information
|
||||
!> \par History
|
||||
!> 12.2015 created [Nico Holmberg]
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE qs_scf_cdft_initial_info(output_unit, cdft_control, dft_control)
|
||||
INTEGER :: output_unit
|
||||
TYPE(cdft_control_type), POINTER :: cdft_control
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
|
||||
CHARACTER(LEN=*), PARAMETER :: routineN = 'qs_scf_cdft_initial_info', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
CHARACTER, DIMENSION(3) :: dir = (/"x", "y", "z"/)
|
||||
|
||||
IF (output_unit > 0) THEN
|
||||
WRITE (output_unit, '(/,A)') &
|
||||
" ---------------------------------- CDFT --------------------------------------"
|
||||
SELECT CASE (cdft_control%constraint_type)
|
||||
CASE (cdft_density_constraint)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Optimizing charge density constraint in an external SCF loop "
|
||||
CASE (cdft_magnetization_constraint)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Optimizing magnetization density constraint in an external SCF loop "
|
||||
CASE (cdft_combined_constraint)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Optimizing combined charge-spin constraint in an external SCF loop "
|
||||
SELECT CASE (cdft_control%combined_type)
|
||||
CASE (cdft_combined_all)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" spin constraint defined on all constraint atoms "
|
||||
CASE (cdft_combined_acceptor)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" spin constraint defined on acceptor constraint atoms "
|
||||
CASE (cdft_combined_donor)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" spin constraint defined on donor constraint atoms "
|
||||
END SELECT
|
||||
END SELECT
|
||||
SELECT CASE (cdft_control%constraint_control%optimizer)
|
||||
CASE (outer_scf_optimizer_sd)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Minimizer : SD : steepest descent"
|
||||
CASE (outer_scf_optimizer_broyden)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Minimizer : Broyden : Broyden's method"
|
||||
CASE (outer_scf_optimizer_diis)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Minimizer : DIIS : direct inversion"
|
||||
WRITE (output_unit, '(A)') &
|
||||
" in the iterative subspace"
|
||||
WRITE (output_unit, '(A,I3,A)') &
|
||||
" using ", &
|
||||
cdft_control%constraint_control%diis_buffer_length, " DIIS vectors"
|
||||
CASE (outer_scf_optimizer_bisect)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Minimizer : BISECT : gradient bisection"
|
||||
WRITE (output_unit, '(A,I3)') &
|
||||
" using a trust count of", &
|
||||
cdft_control%constraint_control%bisect_trust_count
|
||||
END SELECT
|
||||
SELECT CASE (cdft_control%type)
|
||||
CASE (outer_scf_hirshfeld_constraint)
|
||||
WRITE (output_unit, '(A)') " Type of constraint : Hirshfeld"
|
||||
CASE (outer_scf_becke_constraint)
|
||||
WRITE (output_unit, '(A)') " Type of constraint : Becke"
|
||||
WRITE (output_unit, '(A)') " "
|
||||
SELECT CASE (dft_control%qs_control%becke_control%cutoff_type)
|
||||
CASE (becke_cutoff_global)
|
||||
WRITE (output_unit, '(A,F8.3,A)') &
|
||||
" Cutoff for partitioning :", cp_unit_from_cp2k(dft_control%qs_control%becke_control%rglobal, &
|
||||
"angstrom"), " angstrom"
|
||||
CASE (becke_cutoff_element)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Using element specific cutoffs for partitioning"
|
||||
END SELECT
|
||||
WRITE (output_unit, '(A,L7)') &
|
||||
" Skipping distant gpoints: ", dft_control%qs_control%becke_control%should_skip
|
||||
WRITE (output_unit, '(A,L7)') &
|
||||
" Precompute gradients : ", dft_control%qs_control%becke_control%in_memory
|
||||
WRITE (output_unit, '(A,L7)') &
|
||||
" Using fragment densities: ", dft_control%qs_control%becke_control%fragment_density
|
||||
WRITE (output_unit, '(A)') " "
|
||||
WRITE (output_unit, '(A,L7)') &
|
||||
" Reusing preconditioner : ", dft_control%qs_control%cdft_control%reuse_precond
|
||||
IF (dft_control%qs_control%cdft_control%reuse_precond) THEN
|
||||
WRITE (output_unit, '(A,I3,A,I3,A)') &
|
||||
" using old preconditioner for upto ", &
|
||||
cdft_control%max_reuse, " subsequent CDFT SCF"
|
||||
WRITE (output_unit, '(A,I3,A,I3,A)') &
|
||||
" iterations if the relevant loop converged in less than ", &
|
||||
cdft_control%precond_freq, " steps"
|
||||
END IF
|
||||
WRITE (output_unit, '(A)') " "
|
||||
IF (dft_control%qs_control%becke_control%atomic_charges) &
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Calculating atomic Becke charges"
|
||||
IF (dft_control%qs_control%becke_control%adjust) &
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Using atomic radii to generate a heteronuclear charge partitioning"
|
||||
WRITE (output_unit, '(A)') " "
|
||||
SELECT CASE (dft_control%qs_control%becke_control%confine_method)
|
||||
CASE (becke_none_conf)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" No confinement is active"
|
||||
CASE (becke_static_conf)
|
||||
WRITE (output_unit, '(A,A3,A)') &
|
||||
" Static confinement is active along ", &
|
||||
dir(dft_control%qs_control%becke_control%confine_dir), " axis"
|
||||
WRITE (output_unit, '(A,F8.4,F8.4)') &
|
||||
" Confinement bounds : ", dft_control%qs_control%becke_control%confine_bounds(1), &
|
||||
dft_control%qs_control%becke_control%confine_bounds(2)
|
||||
CASE (becke_dynamic_conf)
|
||||
WRITE (output_unit, '(A,A3,A,F8.4)') &
|
||||
" Dynamic confinement is active along ", dir(dft_control%qs_control%becke_control%confine_dir), &
|
||||
" axis using a radius of ", dft_control%qs_control%becke_control%dynamic_radius
|
||||
CASE (becke_cavity_conf)
|
||||
WRITE (output_unit, '(A)') " Confinement using a Gaussian shaped cavity is active"
|
||||
SELECT CASE (dft_control%qs_control%becke_control%cavity_shape)
|
||||
CASE (radius_single)
|
||||
WRITE (output_unit, '(A,F8.4, A)') &
|
||||
" Type of Gaussian : Fixed radius: ", &
|
||||
cp_unit_from_cp2k(dft_control%qs_control%becke_control%rcavity, "angstrom"), " angstrom"
|
||||
CASE (radius_covalent)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Type of Gaussian : Covalent radius "
|
||||
CASE (radius_vdw)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Type of Gaussian : vdW radius "
|
||||
CASE (radius_user)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Type of Gaussian : User radius "
|
||||
END SELECT
|
||||
WRITE (output_unit, '(A,ES12.4)') &
|
||||
" Cavity threshold : ", dft_control%qs_control%becke_control%eps_cavity
|
||||
CASE (becke_mixed_conf)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Mixed confinement is active"
|
||||
WRITE (output_unit, '(A,A3,A,F8.4)') &
|
||||
" Dynamic confinement is active along ", dir(dft_control%qs_control%becke_control%confine_dir), &
|
||||
" axis using a radius of ", dft_control%qs_control%becke_control%dynamic_radius
|
||||
WRITE (output_unit, '(A)') " Confinement using a Gaussian shaped cavity is active"
|
||||
SELECT CASE (dft_control%qs_control%becke_control%cavity_shape)
|
||||
CASE (radius_single)
|
||||
WRITE (output_unit, '(A,F8.4,A)') &
|
||||
" Type of Gaussian : Fixed radius: ", &
|
||||
cp_unit_from_cp2k(dft_control%qs_control%becke_control%rcavity, "angstrom"), " angstrom"
|
||||
CASE (radius_covalent)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Type of Gaussian : Covalent radius "
|
||||
CASE (radius_vdw)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Type of Gaussian : vdW radius "
|
||||
CASE (radius_user)
|
||||
WRITE (output_unit, '(A)') &
|
||||
" Type of Gaussian : User radius "
|
||||
END SELECT
|
||||
WRITE (output_unit, '(A,ES12.4)') &
|
||||
" Cavity threshold : ", dft_control%qs_control%becke_control%eps_cavity
|
||||
END SELECT
|
||||
END SELECT
|
||||
WRITE (output_unit, '(/,A)') &
|
||||
" ---------------------------------- CDFT --------------------------------------"
|
||||
END IF
|
||||
|
||||
END SUBROUTINE qs_scf_cdft_initial_info
|
||||
|
||||
END MODULE qs_scf_output
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ MODULE qs_scf_post_gpw
|
|||
do_loc_homo,&
|
||||
do_loc_lumo,&
|
||||
ot_precond_full_all,&
|
||||
radius_covalent,&
|
||||
radius_user,&
|
||||
ref_charge_atomic,&
|
||||
ref_charge_mulliken
|
||||
USE input_section_types, ONLY: section_get_ival,&
|
||||
|
|
@ -2819,10 +2821,10 @@ CONTAINS
|
|||
END SUBROUTINE write_mo_free_results
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief ...
|
||||
!> \param qs_env ...
|
||||
!> \param input_section ...
|
||||
!> \param unit_nr ...
|
||||
!> \brief Calculates Hirshfeld charges
|
||||
!> \param qs_env the qs_env where to calculate the charges
|
||||
!> \param input_section the input section for Hirshfeld charges
|
||||
!> \param unit_nr the output unit number
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE hirshfeld_charges(qs_env, input_section, unit_nr)
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
|
|
@ -2833,10 +2835,11 @@ CONTAINS
|
|||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: i, iat, ikind, natom, nkind, nspin, &
|
||||
refc, shapef
|
||||
radius_type, refc, shapef
|
||||
INTEGER, DIMENSION(:), POINTER :: atom_list
|
||||
LOGICAL :: do_sc, paw_atom
|
||||
LOGICAL :: do_radius, do_sc, paw_atom
|
||||
REAL(KIND=dp) :: zeff
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: radii
|
||||
REAL(KIND=dp), DIMENSION(:, :), POINTER :: charges
|
||||
TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
|
||||
TYPE(atomic_kind_type), POINTER :: atomic_kind
|
||||
|
|
@ -2851,19 +2854,33 @@ CONTAINS
|
|||
TYPE(rho0_mpole_type), POINTER :: rho0_mpole
|
||||
|
||||
NULLIFY (hirshfeld_env)
|
||||
NULLIFY (radii)
|
||||
CALL create_hirshfeld_type(hirshfeld_env)
|
||||
!
|
||||
CALL get_qs_env(qs_env, nkind=nkind, natom=natom)
|
||||
ALLOCATE (hirshfeld_env%charges(natom))
|
||||
! input options
|
||||
CALL section_vals_val_get(input_section, "SELF_CONSISTENT", l_val=do_sc)
|
||||
CALL section_vals_val_get(input_section, "USER_RADIUS", l_val=do_radius)
|
||||
CALL section_vals_val_get(input_section, "SHAPE_FUNCTION", i_val=shapef)
|
||||
CALL section_vals_val_get(input_section, "REFERENCE_CHARGE", i_val=refc)
|
||||
IF (do_radius) THEN
|
||||
radius_type = radius_user
|
||||
CALL section_vals_val_get(input_section, "ATOMIC_RADII", r_vals=radii)
|
||||
IF (.NOT. SIZE(radii) == nkind) &
|
||||
CALL cp_abort(__LOCATION__, &
|
||||
"Length of keyword HIRSHFELD\ATOMIC_RADII does not "// &
|
||||
"match number of atomic kinds in the input coordinate file.")
|
||||
ELSE
|
||||
radius_type = radius_covalent
|
||||
END IF
|
||||
CALL set_hirshfeld_info(hirshfeld_env, shape_function_type=shapef, &
|
||||
iterative=do_sc, ref_charge=refc)
|
||||
iterative=do_sc, ref_charge=refc, &
|
||||
radius_type=radius_type)
|
||||
! shape function
|
||||
CALL get_qs_env(qs_env, qs_kind_set=qs_kind_set, atomic_kind_set=atomic_kind_set)
|
||||
CALL create_shape_function(hirshfeld_env, qs_kind_set, atomic_kind_set)
|
||||
CALL create_shape_function(hirshfeld_env, qs_kind_set, atomic_kind_set, &
|
||||
radii_list=radii)
|
||||
! reference charges
|
||||
CALL get_qs_env(qs_env, rho=rho)
|
||||
CALL qs_rho_get(rho, rho_ao_kp=matrix_p)
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ MODULE qs_scf_types
|
|||
REAL(KIND=dp), DIMENSION(:), POINTER :: energy
|
||||
REAL(KIND=dp), DIMENSION(:, :), POINTER :: variables
|
||||
REAL(KIND=dp), DIMENSION(:, :), POINTER :: gradient
|
||||
REAL(KIND=dp), DIMENSION(:, :), POINTER :: inv_jacobian
|
||||
INTEGER, DIMENSION(:), POINTER :: count
|
||||
END TYPE qs_outer_scf_type
|
||||
|
||||
|
|
@ -171,6 +172,7 @@ CONTAINS
|
|||
NULLIFY (scf_env%outer_scf%gradient)
|
||||
NULLIFY (scf_env%outer_scf%energy)
|
||||
NULLIFY (scf_env%outer_scf%count)
|
||||
NULLIFY (scf_env%outer_scf%inv_jacobian)
|
||||
NULLIFY (scf_env%scf_work1)
|
||||
NULLIFY (scf_env%scf_work2)
|
||||
NULLIFY (scf_env%ortho)
|
||||
|
|
@ -329,6 +331,9 @@ CONTAINS
|
|||
IF (ASSOCIATED(scf_env%outer_scf%gradient)) THEN
|
||||
DEALLOCATE (scf_env%outer_scf%gradient)
|
||||
END IF
|
||||
IF (ASSOCIATED(scf_env%outer_scf%inv_jacobian)) THEN
|
||||
DEALLOCATE (scf_env%outer_scf%inv_jacobian)
|
||||
END IF
|
||||
IF (ASSOCIATED(scf_env%outer_scf%energy)) THEN
|
||||
DEALLOCATE (scf_env%outer_scf%energy)
|
||||
END IF
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ MODULE qs_wf_history_methods
|
|||
RECIPROCALSPACE,&
|
||||
pw_p_type
|
||||
USE qs_environment_types, ONLY: get_qs_env,&
|
||||
qs_environment_type
|
||||
qs_environment_type,&
|
||||
set_qs_env
|
||||
USE qs_ks_types, ONLY: qs_ks_did_change
|
||||
USE qs_matrix_pools, ONLY: mpools_get,&
|
||||
qs_matrix_pools_type
|
||||
|
|
@ -86,7 +87,8 @@ MODULE qs_wf_history_methods
|
|||
qs_scf_env_type
|
||||
USE qs_wf_history_types, ONLY: qs_wf_history_type,&
|
||||
qs_wf_snapshot_type,&
|
||||
wfi_get_snapshot
|
||||
wfi_get_snapshot,&
|
||||
wfi_release
|
||||
USE scf_control_types, ONLY: scf_control_type
|
||||
#include "./base/base_uses.f90"
|
||||
|
||||
|
|
@ -99,7 +101,7 @@ MODULE qs_wf_history_methods
|
|||
|
||||
PUBLIC :: wfi_create, wfi_update, wfi_create_for_kp, &
|
||||
wfi_extrapolate, wfi_get_method_label, &
|
||||
reorthogonalize_vectors
|
||||
reorthogonalize_vectors, wfi_purge_history
|
||||
|
||||
CONTAINS
|
||||
|
||||
|
|
@ -1076,4 +1078,64 @@ CONTAINS
|
|||
CALL timestop(handle)
|
||||
END SUBROUTINE reorthogonalize_vectors
|
||||
|
||||
! **************************************************************************************************
|
||||
!> \brief purges wf_history retaining only the latest snapshot
|
||||
!> \param qs_env the qs env with the latest result, and that will contain
|
||||
!> the purged wf_history
|
||||
!> \par History
|
||||
!> 05.2016 created [Nico Holmberg]
|
||||
!> \author Nico Holmberg
|
||||
! **************************************************************************************************
|
||||
SUBROUTINE wfi_purge_history(qs_env)
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
|
||||
CHARACTER(len=*), PARAMETER :: routineN = 'wfi_purge_history', &
|
||||
routineP = moduleN//':'//routineN
|
||||
|
||||
INTEGER :: handle, output_unit, print_level
|
||||
TYPE(cp_logger_type), POINTER :: logger
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(qs_wf_history_type), POINTER :: wf_history
|
||||
|
||||
NULLIFY (dft_control, wf_history)
|
||||
|
||||
CALL timeset(routineN, handle)
|
||||
logger => cp_get_default_logger()
|
||||
print_level = logger%iter_info%print_level
|
||||
output_unit = cp_print_key_unit_nr(logger, qs_env%input, "DFT%SCF%PRINT%PROGRAM_RUN_INFO", &
|
||||
extension=".scfLog")
|
||||
|
||||
CPASSERT(ASSOCIATED(qs_env))
|
||||
CPASSERT(qs_env%ref_count > 0)
|
||||
CPASSERT(ASSOCIATED(qs_env%wf_history))
|
||||
CPASSERT(qs_env%wf_history%ref_count > 0)
|
||||
CALL get_qs_env(qs_env, dft_control=dft_control)
|
||||
|
||||
SELECT CASE (qs_env%wf_history%interpolation_method_nr)
|
||||
CASE (wfi_use_guess_method_nr, wfi_use_prev_wf_method_nr, &
|
||||
wfi_use_prev_p_method_nr, wfi_use_prev_rho_r_method_nr, &
|
||||
wfi_frozen_method_nr)
|
||||
! do nothing
|
||||
CASE (wfi_linear_wf_method_nr, wfi_linear_p_method_nr, &
|
||||
wfi_linear_ps_method_nr, wfi_ps_method_nr, &
|
||||
wfi_aspc_nr)
|
||||
IF (qs_env%wf_history%snapshot_count .GE. 2) THEN
|
||||
IF (debug_this_module .AND. output_unit > 0) &
|
||||
WRITE (output_unit, FMT="(T2,A)") "QS| Purging WFN history"
|
||||
CALL wfi_create(wf_history, interpolation_method_nr= &
|
||||
dft_control%qs_control%wf_interpolation_method_nr, &
|
||||
extrapolation_order=dft_control%qs_control%wf_extrapolation_order, &
|
||||
has_unit_metric=qs_env%has_unit_metric)
|
||||
CALL set_qs_env(qs_env=qs_env, &
|
||||
wf_history=wf_history)
|
||||
CALL wfi_release(wf_history)
|
||||
CALL wfi_update(qs_env%wf_history, qs_env=qs_env, dt=1.0_dp)
|
||||
END IF
|
||||
CASE DEFAULT
|
||||
CPABORT("Unknown extrapolation method.")
|
||||
END SELECT
|
||||
CALL timestop(handle)
|
||||
|
||||
END SUBROUTINE wfi_purge_history
|
||||
|
||||
END MODULE qs_wf_history_methods
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@ MODULE scf_control_types
|
|||
atomic_guess, core_guess, diag_ot, direct_p_mix, general_roks, high_spin_roks, &
|
||||
ot_algo_taylor_or_diag, outer_scf_basis_center_opt, outer_scf_becke_constraint, &
|
||||
outer_scf_ddapc_constraint, outer_scf_none, outer_scf_optimizer_bisect, &
|
||||
outer_scf_optimizer_diis, outer_scf_optimizer_none, outer_scf_optimizer_sd, &
|
||||
outer_scf_s2_constraint, smear_energy_window, smear_fermi_dirac, smear_list
|
||||
outer_scf_optimizer_broyden, outer_scf_optimizer_diis, outer_scf_optimizer_newton, &
|
||||
outer_scf_optimizer_none, outer_scf_optimizer_sd, outer_scf_s2_constraint, &
|
||||
smear_energy_window, smear_fermi_dirac, smear_list
|
||||
USE input_cp2k_dft, ONLY: create_scf_section
|
||||
USE input_enumeration_types, ONLY: enum_i2c,&
|
||||
enumeration_type
|
||||
|
|
@ -80,6 +81,10 @@ MODULE scf_control_types
|
|||
!> \param id_nr unique number to identify an scf control
|
||||
!> \param ref_count reference count (see cp2k/doc/ReferenceCounting.html)
|
||||
!> \param added_mos additional number of MOs that might be used in the SCF
|
||||
!> \param build_jacobian logical which determines if the inverse Jacobian should be computed
|
||||
!> \param step_size the optimizer step size
|
||||
!> \param jacobian_step the step size for calculating the finite difference Jacobian
|
||||
!> \param jacobian_type the finite difference scheme to compute the Jacobian
|
||||
!> \par History
|
||||
!> 09.2002 created [fawzi]
|
||||
!> \author Fawzi Mohamed
|
||||
|
|
@ -87,13 +92,16 @@ MODULE scf_control_types
|
|||
|
||||
TYPE outer_scf_control_type
|
||||
LOGICAL :: have_scf
|
||||
LOGICAL :: build_jacobian
|
||||
INTEGER :: max_scf
|
||||
REAL(KIND=dp) :: eps_scf, step_size
|
||||
REAL(KIND=dp) :: eps_scf, step_size, &
|
||||
jacobian_step
|
||||
INTEGER :: TYPE
|
||||
INTEGER :: optimizer
|
||||
INTEGER :: diis_buffer_length
|
||||
INTEGER :: extrapolation_order
|
||||
INTEGER :: bisect_trust_count
|
||||
INTEGER :: jacobian_type
|
||||
END TYPE outer_scf_control_type
|
||||
|
||||
TYPE smear_type
|
||||
|
|
@ -259,6 +267,9 @@ CONTAINS
|
|||
scf_control%outer_scf%type = -1
|
||||
scf_control%outer_scf%optimizer = -1
|
||||
scf_control%outer_scf%diis_buffer_length = -1
|
||||
scf_control%outer_scf%jacobian_type = -1
|
||||
scf_control%outer_scf%jacobian_step = 0.0_dp
|
||||
scf_control%outer_scf%build_jacobian = .FALSE.
|
||||
|
||||
! Smearing of the MO occupations
|
||||
|
||||
|
|
@ -494,6 +505,10 @@ CONTAINS
|
|||
i_val=scf_control%outer_scf%max_scf)
|
||||
CALL section_vals_val_get(outer_scf_section, "EXTRAPOLATION_ORDER", &
|
||||
i_val=scf_control%outer_scf%extrapolation_order)
|
||||
CALL section_vals_val_get(outer_scf_section, "JACOBIAN_TYPE", &
|
||||
i_val=scf_control%outer_scf%jacobian_type)
|
||||
CALL section_vals_val_get(outer_scf_section, "JACOBIAN_STEP", &
|
||||
r_val=scf_control%outer_scf%jacobian_step)
|
||||
END IF
|
||||
|
||||
smear_section => section_vals_get_subs_vals(scf_section, "SMEAR")
|
||||
|
|
@ -738,6 +753,10 @@ CONTAINS
|
|||
WRITE (output_unit, '(T25,A)') "DIIS optimization"
|
||||
WRITE (output_unit, '(T25,A,T72,I9)') "DIIS buffer length", &
|
||||
scf_control%outer_scf%diis_buffer_length
|
||||
CASE (outer_scf_optimizer_broyden)
|
||||
WRITE (output_unit, '(T25,A)') "Optimization with Broyden's method"
|
||||
CASE (outer_scf_optimizer_newton)
|
||||
WRITE (output_unit, '(T25,A)') "Optimization with Newton's method"
|
||||
CASE DEFAULT
|
||||
CPABORT("")
|
||||
END SELECT
|
||||
|
|
|
|||
16
tests/QS/regtest-cdft-1/TEST_FILES
Normal file
16
tests/QS/regtest-cdft-1/TEST_FILES
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# runs are executed in the same order as in this file
|
||||
# the second field tells which test should be run in order to compare with the last available output
|
||||
# see regtest/TEST_FILES
|
||||
#
|
||||
water-noconstraint.inp 1 1e-13 -17.09794893929815
|
||||
# These tests give identical value of constraint
|
||||
water-cdft-1.inp 71 1e-12 7.979480462990
|
||||
water-cdft-2.inp 71 1e-12 7.979480462990
|
||||
water-cdft-3.inp 71 1e-12 7.979480462990
|
||||
water-cdft-4.inp 71 1e-12 7.979480462990
|
||||
water-cdft-5.inp 71 1e-12 7.979480462990
|
||||
water-cdft-6.inp 71 1e-12 7.979480462990
|
||||
# The constraint value differs because the confinement is too tight
|
||||
water-cdft-7.inp 71 1e-12 7.894206878787
|
||||
water-cdft-8.inp 71 1e-12 7.979416440315
|
||||
#EOF
|
||||
3
tests/QS/regtest-cdft-1/TEST_FILES_RESET
Normal file
3
tests/QS/regtest-cdft-1/TEST_FILES_RESET
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#
|
||||
# add files to be reset here
|
||||
#
|
||||
73
tests/QS/regtest-cdft-1/becke_qs.inc
Normal file
73
tests/QS/regtest-cdft-1/becke_qs.inc
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
&QS
|
||||
METHOD GPW
|
||||
EPS_DEFAULT 1.0E-12
|
||||
MAP_CONSISTENT
|
||||
EXTRAPOLATION ASPC
|
||||
EXTRAPOLATION_ORDER 3
|
||||
&CDFT
|
||||
TYPE_OF_CONSTRAINT BECKE
|
||||
&OUTER_SCF ON
|
||||
EPS_SCF 1.0e-0
|
||||
TYPE BECKE_CONSTRAINT
|
||||
OPTIMIZER BISECT
|
||||
BISECT_TRUST_COUNT 8
|
||||
EXTRAPOLATION_ORDER 2
|
||||
MAX_SCF 0
|
||||
STEP_SIZE -0.1
|
||||
&END
|
||||
&END CDFT
|
||||
&BECKE_RESTRAINT
|
||||
@IF ( ${BECKE_ADJUST_SIZE} == TRUE )
|
||||
! Defaults to false
|
||||
ADJUST_SIZE TRUE
|
||||
ATOMIC_RADII 0.630 0.320
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_ATOMIC_CHARGES} == TRUE )
|
||||
! Defaults to false
|
||||
ATOMIC_CHARGES TRUE
|
||||
@ENDIF
|
||||
STRENGTH ${BECKE_STR}
|
||||
TARGET ${BECKE_TARGET}
|
||||
@IF ( ${BECKE_CUTOFF_ELEMENT} == TRUE )
|
||||
CUTOFF_TYPE ELEMENT
|
||||
! Note these values are in angstrom
|
||||
ELEMENT_CUTOFF 2.0 2.0
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_GLOBAL_CUTOFF} == TRUE )
|
||||
CUTOFF_TYPE GLOBAL
|
||||
GLOBAL_CUTOFF 2.0
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_IN_MEMORY} == TRUE )
|
||||
! Defaults to false
|
||||
IN_MEMORY TRUE
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_CAVITY_CONFINE} == TRUE )
|
||||
! Defaults to NONE
|
||||
CONFINE CAVITY
|
||||
EPS_CAVITY 1.0E-6
|
||||
CAVITY_SHAPE ${BECKE_CAVITY_SHAPE}
|
||||
! For shape single
|
||||
CAVITY_RADIUS 1.3
|
||||
CAVITY_USE_BOHR FALSE
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_SHOULD_SKIP} == TRUE )
|
||||
! Defaults to false
|
||||
SHOULD_SKIP TRUE
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_CAVITY_PRINT} == TRUE )
|
||||
! Defaults to false
|
||||
CAVITY_PRINT TRUE
|
||||
@ENDIF
|
||||
ATOMS 1..3
|
||||
COEFF 1 1 1
|
||||
CONSTRAINT_TYPE TOTAL
|
||||
&PROGRAM_RUN_INFO ON
|
||||
&EACH
|
||||
QS_SCF 1
|
||||
&END EACH
|
||||
COMMON_ITERATION_LEVELS 2
|
||||
ADD_LAST NUMERIC
|
||||
FILENAME ./${PROJECT_NAME}
|
||||
&END PROGRAM_RUN_INFO
|
||||
&END BECKE_RESTRAINT
|
||||
&END QS
|
||||
76
tests/QS/regtest-cdft-1/dft-common-params.inc
Normal file
76
tests/QS/regtest-cdft-1/dft-common-params.inc
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
&DFT
|
||||
@IF ( ${BECKE_ACTIVE} == TRUE )
|
||||
@include becke_qs.inc
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_ACTIVE} == FALSE )
|
||||
&QS
|
||||
METHOD GPW
|
||||
EPS_DEFAULT 1.0E-12
|
||||
MAP_CONSISTENT
|
||||
EXTRAPOLATION ASPC
|
||||
EXTRAPOLATION_ORDER 3
|
||||
&END QS
|
||||
@ENDIF
|
||||
BASIS_SET_FILE_NAME BASIS_MOLOPT
|
||||
POTENTIAL_FILE_NAME POTENTIAL
|
||||
@IF ( ${RESTART_WFN} == TRUE )
|
||||
WFN_RESTART_FILE_NAME ${WFN_FILE}
|
||||
@ENDIF
|
||||
LSD
|
||||
CHARGE 0
|
||||
&MGRID
|
||||
CUTOFF 100
|
||||
NGRIDS 5
|
||||
&END MGRID
|
||||
&SCF
|
||||
@IF ( ${RESTART_WFN} == TRUE )
|
||||
SCF_GUESS RESTART
|
||||
@ENDIF
|
||||
@IF ( ${RESTART_WFN} == FALSE )
|
||||
SCF_GUESS ATOMIC
|
||||
@ENDIF
|
||||
EPS_SCF 1.0E-5
|
||||
CHOLESKY INVERSE_DBCSR
|
||||
MAX_SCF 20
|
||||
&OT ON
|
||||
MINIMIZER DIIS
|
||||
PRECONDITIONER FULL_ALL
|
||||
ALGORITHM IRAC
|
||||
&END OT
|
||||
&OUTER_SCF ON
|
||||
EPS_SCF 1.0E-5
|
||||
MAX_SCF 2
|
||||
&END
|
||||
&PRINT
|
||||
&RESTART
|
||||
FILENAME ./${PROJECT_NAME}
|
||||
BACKUP_COPIES 0
|
||||
COMMON_ITERATION_LEVELS 1
|
||||
&EACH
|
||||
JUST_ENERGY ${WRITE_WFN}
|
||||
QS_SCF 0
|
||||
&END EACH
|
||||
&END RESTART
|
||||
&RESTART_HISTORY OFF
|
||||
&END RESTART_HISTORY
|
||||
&END PRINT
|
||||
&END SCF
|
||||
&XC
|
||||
&XC_FUNCTIONAL PBE
|
||||
&END XC_FUNCTIONAL
|
||||
&XC_GRID
|
||||
XC_DERIV SPLINE2
|
||||
XC_SMOOTH_RHO NONE
|
||||
&END XC_GRID
|
||||
&END XC
|
||||
&PRINT
|
||||
&MULLIKEN OFF
|
||||
&END MULLIKEN
|
||||
&HIRSHFELD OFF
|
||||
&END HIRSHFELD
|
||||
&END PRINT
|
||||
&END DFT
|
||||
&PRINT
|
||||
&FORCES ON
|
||||
&END
|
||||
&END
|
||||
20
tests/QS/regtest-cdft-1/subsys.inc
Normal file
20
tests/QS/regtest-cdft-1/subsys.inc
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
&SUBSYS
|
||||
&CELL
|
||||
PERIODIC XYZ
|
||||
ABC 15. 15. 15.
|
||||
&END CELL
|
||||
&TOPOLOGY
|
||||
COORD_FILE_FORMAT XYZ
|
||||
COORD_FILE_NAME water.xyz
|
||||
&CENTER_COORDINATES OFF
|
||||
&END CENTER_COORDINATES
|
||||
&END TOPOLOGY
|
||||
&KIND O
|
||||
BASIS_SET SZV-MOLOPT-SR-GTH
|
||||
POTENTIAL GTH-PBE-q6
|
||||
&END KIND
|
||||
&KIND H
|
||||
BASIS_SET SZV-MOLOPT-SR-GTH
|
||||
POTENTIAL GTH-PBE-q1
|
||||
&END KIND
|
||||
&END SUBSYS
|
||||
35
tests/QS/regtest-cdft-1/water-cdft-1.inp
Normal file
35
tests/QS/regtest-cdft-1/water-cdft-1.inp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE water-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME water-cdft-1
|
||||
@SET WRITE_WFN 0
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_TARGET 8.0
|
||||
@SET BECKE_STR 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE FALSE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE FALSE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
35
tests/QS/regtest-cdft-1/water-cdft-2.inp
Normal file
35
tests/QS/regtest-cdft-1/water-cdft-2.inp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE water-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME water-cdft-2
|
||||
@SET WRITE_WFN 0
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_TARGET 8.0
|
||||
@SET BECKE_STR 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE FALSE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT TRUE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
35
tests/QS/regtest-cdft-1/water-cdft-3.inp
Normal file
35
tests/QS/regtest-cdft-1/water-cdft-3.inp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE water-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME water-cdft-3
|
||||
@SET WRITE_WFN 0
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_TARGET 8.0
|
||||
@SET BECKE_STR 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE FALSE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
35
tests/QS/regtest-cdft-1/water-cdft-4.inp
Normal file
35
tests/QS/regtest-cdft-1/water-cdft-4.inp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE water-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME water-cdft-4
|
||||
@SET WRITE_WFN 0
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_TARGET 8.0
|
||||
@SET BECKE_STR 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
35
tests/QS/regtest-cdft-1/water-cdft-5.inp
Normal file
35
tests/QS/regtest-cdft-1/water-cdft-5.inp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE water-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME water-cdft-5
|
||||
@SET WRITE_WFN 0
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_TARGET 8.0
|
||||
@SET BECKE_STR 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
35
tests/QS/regtest-cdft-1/water-cdft-6.inp
Normal file
35
tests/QS/regtest-cdft-1/water-cdft-6.inp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE water-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME water-cdft-6
|
||||
@SET WRITE_WFN 0
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_TARGET 8.0
|
||||
@SET BECKE_STR 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE SINGLE
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
35
tests/QS/regtest-cdft-1/water-cdft-7.inp
Normal file
35
tests/QS/regtest-cdft-1/water-cdft-7.inp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE water-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME water-cdft-7
|
||||
@SET WRITE_WFN 0
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_TARGET 8.0
|
||||
@SET BECKE_STR 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE COVALENT
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
35
tests/QS/regtest-cdft-1/water-cdft-8.inp
Normal file
35
tests/QS/regtest-cdft-1/water-cdft-8.inp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE water-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME water-cdft-8
|
||||
@SET WRITE_WFN 0
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_TARGET 8.0
|
||||
@SET BECKE_STR 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE USER
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
34
tests/QS/regtest-cdft-1/water-noconstraint.inp
Normal file
34
tests/QS/regtest-cdft-1/water-noconstraint.inp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
@SET RESTART_WFN FALSE
|
||||
@SET PROJECT_NAME water-noconstraint
|
||||
@SET WRITE_WFN 1
|
||||
|
||||
@SET BECKE_ACTIVE FALSE
|
||||
@SET BECKE_TARGET 8.0
|
||||
@SET BECKE_STR 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE FALSE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE FALSE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
5
tests/QS/regtest-cdft-1/water.xyz
Normal file
5
tests/QS/regtest-cdft-1/water.xyz
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
3
|
||||
fragment a
|
||||
O 8.973310 7.488240 7.183015
|
||||
H 8.017530 7.477070 7.328865
|
||||
H 9.347810 7.444760 8.067115
|
||||
44
tests/QS/regtest-cdft-2/H-noconstraint.inp
Normal file
44
tests/QS/regtest-cdft-2/H-noconstraint.inp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME H-noconstraint
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 0
|
||||
@SET WRITE_CUBE TRUE
|
||||
@SET XYZFILE H.xyz
|
||||
|
||||
@SET BECKE_ACTIVE FALSE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 0
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE FALSE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES FALSE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE FALSE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
3
tests/QS/regtest-cdft-2/H.xyz
Normal file
3
tests/QS/regtest-cdft-2/H.xyz
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
1
|
||||
|
||||
H 7.500000 7.500000 7.900000
|
||||
44
tests/QS/regtest-cdft-2/He+-noconstraint.inp
Normal file
44
tests/QS/regtest-cdft-2/He+-noconstraint.inp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME He+-noconstraint
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE TRUE
|
||||
@SET XYZFILE He.xyz
|
||||
|
||||
@SET BECKE_ACTIVE FALSE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 0
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE FALSE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES FALSE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE FALSE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
3
tests/QS/regtest-cdft-2/He.xyz
Normal file
3
tests/QS/regtest-cdft-2/He.xyz
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
1
|
||||
|
||||
He 7.500000 7.500000 7.100000
|
||||
46
tests/QS/regtest-cdft-2/HeH-cdft-1.inp
Normal file
46
tests/QS/regtest-cdft-2/HeH-cdft-1.inp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-cdft-1
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 0
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE FALSE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
46
tests/QS/regtest-cdft-2/HeH-cdft-2.inp
Normal file
46
tests/QS/regtest-cdft-2/HeH-cdft-2.inp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-cdft-2
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT TRUE
|
||||
@SET MAX_SCF 0
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE FALSE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
46
tests/QS/regtest-cdft-2/HeH-cdft-3.inp
Normal file
46
tests/QS/regtest-cdft-2/HeH-cdft-3.inp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-cdft-3
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 0
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
46
tests/QS/regtest-cdft-2/HeH-cdft-4.inp
Normal file
46
tests/QS/regtest-cdft-2/HeH-cdft-4.inp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-cdft-4
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT TRUE
|
||||
@SET MAX_SCF 0
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
46
tests/QS/regtest-cdft-2/HeH-cdft-5.inp
Normal file
46
tests/QS/regtest-cdft-2/HeH-cdft-5.inp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-cdft-5
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 1
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE FALSE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY_FORCE
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
46
tests/QS/regtest-cdft-2/HeH-cdft-6.inp
Normal file
46
tests/QS/regtest-cdft-2/HeH-cdft-6.inp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-cdft-6
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 1
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY_FORCE
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
46
tests/QS/regtest-cdft-2/HeH-cdft-7.inp
Normal file
46
tests/QS/regtest-cdft-2/HeH-cdft-7.inp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-cdft-7
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 1
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY_FORCE
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
44
tests/QS/regtest-cdft-2/HeH-noconstraint.inp
Normal file
44
tests/QS/regtest-cdft-2/HeH-noconstraint.inp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
@SET RESTART_WFN FALSE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-noconstraint
|
||||
@SET WRITE_WFN 1
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE FALSE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 0
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE FALSE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES FALSE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE FALSE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
4
tests/QS/regtest-cdft-2/HeH.xyz
Normal file
4
tests/QS/regtest-cdft-2/HeH.xyz
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
2
|
||||
|
||||
He 7.500000 7.500000 7.100000
|
||||
H 7.500000 7.500000 7.900000
|
||||
17
tests/QS/regtest-cdft-2/TEST_FILES
Normal file
17
tests/QS/regtest-cdft-2/TEST_FILES
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# runs are executed in the same order as in this file
|
||||
# the second field tells which test should be run in order to compare with the last available output
|
||||
# see regtest/TEST_FILES
|
||||
#
|
||||
HeH-noconstraint.inp 1 1e-13 -2.92909797857414
|
||||
He+-noconstraint.inp 1 1e-13 -1.97024649506553
|
||||
H-noconstraint.inp 1 1e-13 -0.45619409564056
|
||||
# These tests use different constraint formalisms so their value differs (see outputted charges)
|
||||
HeH-cdft-1.inp 71 1e-12 1.200259777690
|
||||
HeH-cdft-2.inp 71 1e-12 1.599346939652
|
||||
HeH-cdft-3.inp 71 1e-12 1.415422840116
|
||||
HeH-cdft-4.inp 71 1e-12 1.706928470865
|
||||
# These tests give identical value of atomic forces (there is some numerical noise when the number of mpiranks is varied)
|
||||
HeH-cdft-5.inp 72 7e-12 0.0968896882177
|
||||
HeH-cdft-6.inp 72 6e-12 0.0968896882177
|
||||
HeH-cdft-7.inp 72 6e-12 0.0968896882177
|
||||
#EOF
|
||||
3
tests/QS/regtest-cdft-2/TEST_FILES_RESET
Normal file
3
tests/QS/regtest-cdft-2/TEST_FILES_RESET
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#
|
||||
# add files to be reset here
|
||||
#
|
||||
84
tests/QS/regtest-cdft-2/becke_qs.inc
Normal file
84
tests/QS/regtest-cdft-2/becke_qs.inc
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
&QS
|
||||
METHOD GPW
|
||||
EPS_DEFAULT 1.0E-12
|
||||
MAP_CONSISTENT
|
||||
EXTRAPOLATION ASPC
|
||||
EXTRAPOLATION_ORDER 3
|
||||
&CDFT
|
||||
TYPE_OF_CONSTRAINT BECKE
|
||||
&OUTER_SCF ON
|
||||
EPS_SCF 1.0e-0
|
||||
TYPE BECKE_CONSTRAINT
|
||||
OPTIMIZER BISECT
|
||||
BISECT_TRUST_COUNT 8
|
||||
EXTRAPOLATION_ORDER 2
|
||||
MAX_SCF ${MAX_SCF}
|
||||
STEP_SIZE -0.001
|
||||
&END
|
||||
&END CDFT
|
||||
&BECKE_RESTRAINT
|
||||
@IF ( ${BECKE_ADJUST_SIZE} == TRUE )
|
||||
! Defaults to false
|
||||
ADJUST_SIZE TRUE
|
||||
ATOMIC_RADII 0.460 0.320
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_ATOMIC_CHARGES} == TRUE )
|
||||
! Defaults to false
|
||||
ATOMIC_CHARGES TRUE
|
||||
@ENDIF
|
||||
STRENGTH ${BECKE_STR}
|
||||
! The constraint target: sum_i coeff_i * N_i
|
||||
! where N_i is the number of VALENCE electrons on i
|
||||
TARGET ${BECKE_TARGET}
|
||||
@IF ( ${BECKE_CUTOFF_ELEMENT} == TRUE )
|
||||
CUTOFF_TYPE ELEMENT
|
||||
ELEMENT_CUTOFF 2.0 2.0
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_GLOBAL_CUTOFF} == TRUE )
|
||||
CUTOFF_TYPE GLOBAL
|
||||
GLOBAL_CUTOFF 2.0
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_IN_MEMORY} == TRUE )
|
||||
! Defaults to false
|
||||
IN_MEMORY TRUE
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_CAVITY_CONFINE} == TRUE )
|
||||
! Defaults to NONE
|
||||
CONFINE CAVITY
|
||||
EPS_CAVITY 1.0E-6
|
||||
CAVITY_SHAPE ${BECKE_CAVITY_SHAPE}
|
||||
! For shape single
|
||||
CAVITY_RADIUS 1.3
|
||||
CAVITY_USE_BOHR FALSE
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_SHOULD_SKIP} == TRUE )
|
||||
! Defaults to false
|
||||
SHOULD_SKIP TRUE
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_CAVITY_PRINT} == TRUE )
|
||||
! Defaults to false
|
||||
CAVITY_PRINT TRUE
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_FRAGMENT} == TRUE )
|
||||
! Need absolute weight to use fragment densities
|
||||
ATOMS 1
|
||||
COEFF 1
|
||||
FRAGMENT_DENSITIES
|
||||
FRAGMENT_A_FILE_NAME He+-noconstraint-ELECTRON_DENSITY-1_0.cube
|
||||
FRAGMENT_B_FILE_NAME H-noconstraint-ELECTRON_DENSITY-1_0.cube
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_FRAGMENT} == FALSE )
|
||||
ATOMS 1..2
|
||||
COEFF 1 -1
|
||||
@ENDIF
|
||||
CONSTRAINT_TYPE TOTAL
|
||||
&PROGRAM_RUN_INFO ON
|
||||
&EACH
|
||||
QS_SCF 1
|
||||
&END EACH
|
||||
COMMON_ITERATION_LEVELS 2
|
||||
ADD_LAST NUMERIC
|
||||
FILENAME ./${PROJECT_NAME}
|
||||
&END PROGRAM_RUN_INFO
|
||||
&END BECKE_RESTRAINT
|
||||
&END QS
|
||||
83
tests/QS/regtest-cdft-2/dft-common-params.inc
Normal file
83
tests/QS/regtest-cdft-2/dft-common-params.inc
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
&DFT
|
||||
@IF ( ${BECKE_ACTIVE} == TRUE )
|
||||
@include becke_qs.inc
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_ACTIVE} == FALSE )
|
||||
&QS
|
||||
METHOD GPW
|
||||
EPS_DEFAULT 1.0E-12
|
||||
MAP_CONSISTENT
|
||||
EXTRAPOLATION ASPC
|
||||
EXTRAPOLATION_ORDER 3
|
||||
&END QS
|
||||
@ENDIF
|
||||
BASIS_SET_FILE_NAME BASIS_MOLOPT
|
||||
POTENTIAL_FILE_NAME POTENTIAL
|
||||
@IF ( ${RESTART_WFN} == TRUE )
|
||||
WFN_RESTART_FILE_NAME ${WFN_FILE}
|
||||
@ENDIF
|
||||
LSD
|
||||
CHARGE ${CHARGE}
|
||||
&MGRID
|
||||
CUTOFF 100
|
||||
NGRIDS 5
|
||||
&END MGRID
|
||||
&SCF
|
||||
@IF ( ${RESTART_WFN} == TRUE )
|
||||
SCF_GUESS RESTART
|
||||
@ENDIF
|
||||
@IF ( ${RESTART_WFN} == FALSE )
|
||||
SCF_GUESS ATOMIC
|
||||
@ENDIF
|
||||
EPS_SCF 1.0E-5
|
||||
CHOLESKY INVERSE_DBCSR
|
||||
MAX_SCF 20
|
||||
&OT ON
|
||||
! DIIS convergence might not be constant with different mpiranks => use CG
|
||||
MINIMIZER CG
|
||||
PRECONDITIONER FULL_ALL
|
||||
ALGORITHM IRAC
|
||||
&END OT
|
||||
&OUTER_SCF ON
|
||||
EPS_SCF 1.0E-5
|
||||
MAX_SCF 2
|
||||
&END
|
||||
&PRINT
|
||||
&RESTART
|
||||
FILENAME ./${PROJECT_NAME}
|
||||
BACKUP_COPIES 0
|
||||
COMMON_ITERATION_LEVELS 1
|
||||
&EACH
|
||||
JUST_ENERGY ${WRITE_WFN}
|
||||
QS_SCF 0
|
||||
&END EACH
|
||||
&END RESTART
|
||||
&RESTART_HISTORY OFF
|
||||
&END RESTART_HISTORY
|
||||
&END PRINT
|
||||
&END SCF
|
||||
&XC
|
||||
&XC_FUNCTIONAL PBE
|
||||
&END XC_FUNCTIONAL
|
||||
&XC_GRID
|
||||
XC_DERIV SPLINE2
|
||||
XC_SMOOTH_RHO NONE
|
||||
&END XC_GRID
|
||||
&END XC
|
||||
&PRINT
|
||||
&MULLIKEN OFF
|
||||
&END MULLIKEN
|
||||
&HIRSHFELD OFF
|
||||
&END HIRSHFELD
|
||||
@IF ( ${WRITE_CUBE} == TRUE )
|
||||
&E_DENSITY_CUBE ON
|
||||
STRIDE 1 1 1
|
||||
&END E_DENSITY_CUBE
|
||||
@ENDIF
|
||||
&END PRINT
|
||||
&END DFT
|
||||
&PRINT
|
||||
&FORCES ON
|
||||
NDIGITS 13
|
||||
&END
|
||||
&END
|
||||
20
tests/QS/regtest-cdft-2/subsys.inc
Normal file
20
tests/QS/regtest-cdft-2/subsys.inc
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
&SUBSYS
|
||||
&CELL
|
||||
PERIODIC XYZ
|
||||
ABC 15. 15. 15.
|
||||
&END CELL
|
||||
&TOPOLOGY
|
||||
COORD_FILE_FORMAT XYZ
|
||||
COORD_FILE_NAME ${XYZFILE}
|
||||
&CENTER_COORDINATES OFF
|
||||
&END CENTER_COORDINATES
|
||||
&END TOPOLOGY
|
||||
&KIND He
|
||||
BASIS_SET SZV-MOLOPT-SR-GTH
|
||||
POTENTIAL GTH-PBE-q2
|
||||
&END KIND
|
||||
&KIND H
|
||||
BASIS_SET SZV-MOLOPT-SR-GTH
|
||||
POTENTIAL GTH-PBE-q1
|
||||
&END KIND
|
||||
&END SUBSYS
|
||||
46
tests/QS/regtest-cdft-3/HeH-cdft-state-1.inp
Normal file
46
tests/QS/regtest-cdft-3/HeH-cdft-state-1.inp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-cdft-state-1
|
||||
@SET WRITE_WFN 1
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 5
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
46
tests/QS/regtest-cdft-3/HeH-cdft-state-2.inp
Normal file
46
tests/QS/regtest-cdft-3/HeH-cdft-state-2.inp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-cdft-state-2
|
||||
@SET WRITE_WFN 1
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 5
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES TRUE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_2}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_2}
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
100
tests/QS/regtest-cdft-3/HeH-mixed-cdft-1.inp
Normal file
100
tests/QS/regtest-cdft-3/HeH-mixed-cdft-1.inp
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE_1 HeH-cdft-state-1-1_0.wfn
|
||||
@SET WFN_FILE_2 HeH-cdft-state-2-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-mixed-cdft-1
|
||||
@SET NAME ${PROJECT_NAME}
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 5
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.707711420058
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 -1.008285468010
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES FALSE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
@SET USE_DLB FALSE
|
||||
@SET COMPUTE_METRIC FALSE
|
||||
@SET WFN_OVERLAP_METHOD FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&MULTIPLE_FORCE_EVALS
|
||||
FORCE_EVAL_ORDER 2 3
|
||||
MULTIPLE_SUBSYS F
|
||||
&END
|
||||
&FORCE_EVAL
|
||||
METHOD MIXED
|
||||
&MIXED
|
||||
MIXING_TYPE LINEAR_COMBINATION
|
||||
NGROUPS 2
|
||||
&LINEAR
|
||||
LAMBDA 1.0
|
||||
MIXED_CDFT TRUE
|
||||
MIXED_CDFT_COUPLING 1
|
||||
@IF ( ${USE_DLB} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_DLB TRUE
|
||||
LOAD_SCALE 2
|
||||
MORE_WORK 0
|
||||
VERY_OVERLOADED 15
|
||||
@ENDIF
|
||||
@IF ( ${COMPUTE_METRIC} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_METRIC TRUE
|
||||
@ENDIF
|
||||
@IF ( ${WFN_OVERLAP_METHOD} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_WFN_OVERLAP TRUE
|
||||
WFN_RESTART_FILE_NAME HeH-noconstraint-1_0.wfn
|
||||
@ENDIF
|
||||
&END LINEAR
|
||||
&PRINT
|
||||
&PROGRAM_RUN_INFO
|
||||
&END
|
||||
&END PRINT
|
||||
&END MIXED
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@SET PROJECT_NAME ${NAME}-state-1
|
||||
@SET WFN_FILE ${WFN_FILE_1}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_2}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_2}
|
||||
@SET PROJECT_NAME ${NAME}-state-2
|
||||
@SET WFN_FILE ${WFN_FILE_2}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
100
tests/QS/regtest-cdft-3/HeH-mixed-cdft-2.inp
Normal file
100
tests/QS/regtest-cdft-3/HeH-mixed-cdft-2.inp
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE_1 HeH-cdft-state-1-1_0.wfn
|
||||
@SET WFN_FILE_2 HeH-cdft-state-2-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-mixed-cdft-2
|
||||
@SET NAME ${PROJECT_NAME}
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 5
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.707711420058
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 -1.008285468010
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES FALSE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
@SET USE_DLB FALSE
|
||||
@SET COMPUTE_METRIC TRUE
|
||||
@SET WFN_OVERLAP_METHOD FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&MULTIPLE_FORCE_EVALS
|
||||
FORCE_EVAL_ORDER 2 3
|
||||
MULTIPLE_SUBSYS F
|
||||
&END
|
||||
&FORCE_EVAL
|
||||
METHOD MIXED
|
||||
&MIXED
|
||||
MIXING_TYPE LINEAR_COMBINATION
|
||||
NGROUPS 2
|
||||
&LINEAR
|
||||
LAMBDA 1.0
|
||||
MIXED_CDFT TRUE
|
||||
MIXED_CDFT_COUPLING 1
|
||||
@IF ( ${USE_DLB} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_DLB TRUE
|
||||
LOAD_SCALE 2
|
||||
MORE_WORK 0
|
||||
VERY_OVERLOADED 15
|
||||
@ENDIF
|
||||
@IF ( ${COMPUTE_METRIC} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_METRIC TRUE
|
||||
@ENDIF
|
||||
@IF ( ${WFN_OVERLAP_METHOD} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_WFN_OVERLAP TRUE
|
||||
WFN_RESTART_FILE_NAME HeH-noconstraint-1_0.wfn
|
||||
@ENDIF
|
||||
&END LINEAR
|
||||
&PRINT
|
||||
&PROGRAM_RUN_INFO
|
||||
&END
|
||||
&END PRINT
|
||||
&END MIXED
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@SET PROJECT_NAME ${NAME}-state-1
|
||||
@SET WFN_FILE ${WFN_FILE_1}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_2}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_2}
|
||||
@SET PROJECT_NAME ${NAME}-state-2
|
||||
@SET WFN_FILE ${WFN_FILE_2}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
100
tests/QS/regtest-cdft-3/HeH-mixed-cdft-3.inp
Normal file
100
tests/QS/regtest-cdft-3/HeH-mixed-cdft-3.inp
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE_1 HeH-cdft-state-1-1_0.wfn
|
||||
@SET WFN_FILE_2 HeH-cdft-state-2-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-mixed-cdft-3
|
||||
@SET NAME ${PROJECT_NAME}
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 5
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.707711420058
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 -1.008285468010
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES FALSE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
@SET USE_DLB FALSE
|
||||
@SET COMPUTE_METRIC FALSE
|
||||
@SET WFN_OVERLAP_METHOD TRUE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&MULTIPLE_FORCE_EVALS
|
||||
FORCE_EVAL_ORDER 2 3
|
||||
MULTIPLE_SUBSYS F
|
||||
&END
|
||||
&FORCE_EVAL
|
||||
METHOD MIXED
|
||||
&MIXED
|
||||
MIXING_TYPE LINEAR_COMBINATION
|
||||
NGROUPS 2
|
||||
&LINEAR
|
||||
LAMBDA 1.0
|
||||
MIXED_CDFT TRUE
|
||||
MIXED_CDFT_COUPLING 1
|
||||
@IF ( ${USE_DLB} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_DLB TRUE
|
||||
LOAD_SCALE 2
|
||||
MORE_WORK 0
|
||||
VERY_OVERLOADED 15
|
||||
@ENDIF
|
||||
@IF ( ${COMPUTE_METRIC} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_METRIC TRUE
|
||||
@ENDIF
|
||||
@IF ( ${WFN_OVERLAP_METHOD} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_WFN_OVERLAP TRUE
|
||||
WFN_RESTART_FILE_NAME HeH-noconstraint-1_0.wfn
|
||||
@ENDIF
|
||||
&END LINEAR
|
||||
&PRINT
|
||||
&PROGRAM_RUN_INFO
|
||||
&END
|
||||
&END PRINT
|
||||
&END MIXED
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@SET PROJECT_NAME ${NAME}-state-1
|
||||
@SET WFN_FILE ${WFN_FILE_1}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_2}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_2}
|
||||
@SET PROJECT_NAME ${NAME}-state-2
|
||||
@SET WFN_FILE ${WFN_FILE_2}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
103
tests/QS/regtest-cdft-3/HeH-mixed-cdft-4.inp
Normal file
103
tests/QS/regtest-cdft-3/HeH-mixed-cdft-4.inp
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE_1 HeH-cdft-state-1-1_0.wfn
|
||||
@SET WFN_FILE_2 HeH-cdft-state-2-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-mixed-cdft-4
|
||||
@SET NAME ${PROJECT_NAME}
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 5
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.707711420058
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 -1.008285468010
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES FALSE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
@SET USE_DLB FALSE
|
||||
@SET COMPUTE_METRIC FALSE
|
||||
@SET WFN_OVERLAP_METHOD FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY_FORCE
|
||||
PRINT_LEVEL MEDIUM
|
||||
&TIMINGS
|
||||
THRESHOLD 0.001
|
||||
&END
|
||||
&END GLOBAL
|
||||
|
||||
&MULTIPLE_FORCE_EVALS
|
||||
FORCE_EVAL_ORDER 2 3
|
||||
MULTIPLE_SUBSYS F
|
||||
&END
|
||||
&FORCE_EVAL
|
||||
METHOD MIXED
|
||||
&MIXED
|
||||
MIXING_TYPE LINEAR_COMBINATION
|
||||
NGROUPS 2
|
||||
&LINEAR
|
||||
LAMBDA 1.0
|
||||
MIXED_CDFT TRUE
|
||||
MIXED_CDFT_COUPLING 1
|
||||
@IF ( ${USE_DLB} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_DLB TRUE
|
||||
LOAD_SCALE 2
|
||||
MORE_WORK 0
|
||||
VERY_OVERLOADED 15
|
||||
@ENDIF
|
||||
@IF ( ${COMPUTE_METRIC} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_METRIC TRUE
|
||||
@ENDIF
|
||||
@IF ( ${WFN_OVERLAP_METHOD} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_WFN_OVERLAP TRUE
|
||||
WFN_RESTART_FILE_NAME HeH-noconstraint-1_0.wfn
|
||||
@ENDIF
|
||||
&END LINEAR
|
||||
&PRINT
|
||||
&PROGRAM_RUN_INFO
|
||||
&END
|
||||
&END PRINT
|
||||
&END MIXED
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@SET PROJECT_NAME ${NAME}-state-1
|
||||
@SET WFN_FILE ${WFN_FILE_1}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_2}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_2}
|
||||
@SET PROJECT_NAME ${NAME}-state-2
|
||||
@SET WFN_FILE ${WFN_FILE_2}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
103
tests/QS/regtest-cdft-3/HeH-mixed-cdft-5.inp
Normal file
103
tests/QS/regtest-cdft-3/HeH-mixed-cdft-5.inp
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE_1 HeH-cdft-state-1-1_0.wfn
|
||||
@SET WFN_FILE_2 HeH-cdft-state-2-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-mixed-cdft-5
|
||||
@SET NAME ${PROJECT_NAME}
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 5
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.707711420058
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 -1.008285468010
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES FALSE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
@SET USE_DLB TRUE
|
||||
@SET COMPUTE_METRIC FALSE
|
||||
@SET WFN_OVERLAP_METHOD FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY_FORCE
|
||||
PRINT_LEVEL MEDIUM
|
||||
&TIMINGS
|
||||
THRESHOLD 0.001
|
||||
&END
|
||||
&END GLOBAL
|
||||
|
||||
&MULTIPLE_FORCE_EVALS
|
||||
FORCE_EVAL_ORDER 2 3
|
||||
MULTIPLE_SUBSYS F
|
||||
&END
|
||||
&FORCE_EVAL
|
||||
METHOD MIXED
|
||||
&MIXED
|
||||
MIXING_TYPE LINEAR_COMBINATION
|
||||
NGROUPS 2
|
||||
&LINEAR
|
||||
LAMBDA 1.0
|
||||
MIXED_CDFT TRUE
|
||||
MIXED_CDFT_COUPLING 1
|
||||
@IF ( ${USE_DLB} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_DLB TRUE
|
||||
LOAD_SCALE 2
|
||||
MORE_WORK 0
|
||||
VERY_OVERLOADED 15
|
||||
@ENDIF
|
||||
@IF ( ${COMPUTE_METRIC} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_METRIC TRUE
|
||||
@ENDIF
|
||||
@IF ( ${WFN_OVERLAP_METHOD} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_WFN_OVERLAP TRUE
|
||||
WFN_RESTART_FILE_NAME HeH-noconstraint-1_0.wfn
|
||||
@ENDIF
|
||||
&END LINEAR
|
||||
&PRINT
|
||||
&PROGRAM_RUN_INFO
|
||||
&END
|
||||
&END PRINT
|
||||
&END MIXED
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@SET PROJECT_NAME ${NAME}-state-1
|
||||
@SET WFN_FILE ${WFN_FILE_1}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_2}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_2}
|
||||
@SET PROJECT_NAME ${NAME}-state-2
|
||||
@SET WFN_FILE ${WFN_FILE_2}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
114
tests/QS/regtest-cdft-3/HeH-mixed-cdft-6.inp
Normal file
114
tests/QS/regtest-cdft-3/HeH-mixed-cdft-6.inp
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE_1 HeH-cdft-state-1-1_0.wfn
|
||||
@SET WFN_FILE_2 HeH-cdft-state-2-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-mixed-cdft-6
|
||||
@SET NAME ${PROJECT_NAME}
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 5
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.707711420058
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 -1.008285468010
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES FALSE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
@SET USE_DLB FALSE
|
||||
@SET COMPUTE_METRIC FALSE
|
||||
@SET WFN_OVERLAP_METHOD FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE MD
|
||||
PRINT_LEVEL MEDIUM
|
||||
&TIMINGS
|
||||
THRESHOLD 0.001
|
||||
&END
|
||||
&END GLOBAL
|
||||
&MOTION
|
||||
&MD
|
||||
ENSEMBLE NVT
|
||||
STEPS 2
|
||||
TIMESTEP 0.5
|
||||
TEMPERATURE 300
|
||||
&THERMOSTAT
|
||||
TYPE CSVR
|
||||
&END THERMOSTAT
|
||||
&END MD
|
||||
&END MOTION
|
||||
|
||||
&MULTIPLE_FORCE_EVALS
|
||||
FORCE_EVAL_ORDER 2 3
|
||||
MULTIPLE_SUBSYS F
|
||||
&END
|
||||
&FORCE_EVAL
|
||||
METHOD MIXED
|
||||
&MIXED
|
||||
MIXING_TYPE LINEAR_COMBINATION
|
||||
NGROUPS 2
|
||||
&LINEAR
|
||||
LAMBDA 1.0
|
||||
MIXED_CDFT TRUE
|
||||
MIXED_CDFT_COUPLING 1
|
||||
@IF ( ${USE_DLB} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_DLB TRUE
|
||||
LOAD_SCALE 2
|
||||
MORE_WORK 0
|
||||
VERY_OVERLOADED 15
|
||||
@ENDIF
|
||||
@IF ( ${COMPUTE_METRIC} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_METRIC TRUE
|
||||
@ENDIF
|
||||
@IF ( ${WFN_OVERLAP_METHOD} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_WFN_OVERLAP TRUE
|
||||
WFN_RESTART_FILE_NAME HeH-noconstraint-1_0.wfn
|
||||
@ENDIF
|
||||
&END LINEAR
|
||||
&PRINT
|
||||
&PROGRAM_RUN_INFO
|
||||
&END
|
||||
&END PRINT
|
||||
&END MIXED
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@SET PROJECT_NAME ${NAME}-state-1
|
||||
@SET WFN_FILE ${WFN_FILE_1}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_2}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_2}
|
||||
@SET PROJECT_NAME ${NAME}-state-2
|
||||
@SET WFN_FILE ${WFN_FILE_2}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
114
tests/QS/regtest-cdft-3/HeH-mixed-cdft-7.inp
Normal file
114
tests/QS/regtest-cdft-3/HeH-mixed-cdft-7.inp
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
@SET RESTART_WFN TRUE
|
||||
@SET WFN_FILE_1 HeH-cdft-state-1-1_0.wfn
|
||||
@SET WFN_FILE_2 HeH-cdft-state-2-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-mixed-cdft-7
|
||||
@SET NAME ${PROJECT_NAME}
|
||||
@SET WRITE_WFN 0
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE TRUE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 5
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.707711420058
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 -1.008285468010
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF FALSE
|
||||
@SET BECKE_CUTOFF_ELEMENT TRUE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE TRUE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES FALSE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE TRUE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP TRUE
|
||||
|
||||
@SET BECKE_IN_MEMORY TRUE
|
||||
|
||||
@SET USE_DLB TRUE
|
||||
@SET COMPUTE_METRIC FALSE
|
||||
@SET WFN_OVERLAP_METHOD FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE MD
|
||||
PRINT_LEVEL MEDIUM
|
||||
&TIMINGS
|
||||
THRESHOLD 0.001
|
||||
&END
|
||||
&END GLOBAL
|
||||
&MOTION
|
||||
&MD
|
||||
ENSEMBLE NVT
|
||||
STEPS 2
|
||||
TIMESTEP 0.5
|
||||
TEMPERATURE 300
|
||||
&THERMOSTAT
|
||||
TYPE CSVR
|
||||
&END THERMOSTAT
|
||||
&END MD
|
||||
&END MOTION
|
||||
|
||||
&MULTIPLE_FORCE_EVALS
|
||||
FORCE_EVAL_ORDER 2 3
|
||||
MULTIPLE_SUBSYS F
|
||||
&END
|
||||
&FORCE_EVAL
|
||||
METHOD MIXED
|
||||
&MIXED
|
||||
MIXING_TYPE LINEAR_COMBINATION
|
||||
NGROUPS 2
|
||||
&LINEAR
|
||||
LAMBDA 1.0
|
||||
MIXED_CDFT TRUE
|
||||
MIXED_CDFT_COUPLING 1
|
||||
@IF ( ${USE_DLB} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_DLB TRUE
|
||||
LOAD_SCALE 2
|
||||
MORE_WORK 0
|
||||
VERY_OVERLOADED 15
|
||||
@ENDIF
|
||||
@IF ( ${COMPUTE_METRIC} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_METRIC TRUE
|
||||
@ENDIF
|
||||
@IF ( ${WFN_OVERLAP_METHOD} == TRUE )
|
||||
! Defaults to FALSE
|
||||
MIXED_CDFT_WFN_OVERLAP TRUE
|
||||
WFN_RESTART_FILE_NAME HeH-noconstraint-1_0.wfn
|
||||
@ENDIF
|
||||
&END LINEAR
|
||||
&PRINT
|
||||
&PROGRAM_RUN_INFO
|
||||
&END
|
||||
&END PRINT
|
||||
&END MIXED
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_1}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_1}
|
||||
@SET PROJECT_NAME ${NAME}-state-1
|
||||
@SET WFN_FILE ${WFN_FILE_1}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@SET BECKE_STR ${BECKE_STR_2}
|
||||
@SET BECKE_TARGET ${BECKE_TARGET_2}
|
||||
@SET PROJECT_NAME ${NAME}-state-2
|
||||
@SET WFN_FILE ${WFN_FILE_2}
|
||||
@include dft-common-params.inc
|
||||
&END FORCE_EVAL
|
||||
44
tests/QS/regtest-cdft-3/HeH-noconstraint.inp
Normal file
44
tests/QS/regtest-cdft-3/HeH-noconstraint.inp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
@SET RESTART_WFN FALSE
|
||||
@SET WFN_FILE HeH-noconstraint-1_0.wfn
|
||||
@SET PROJECT_NAME HeH-noconstraint
|
||||
@SET WRITE_WFN 1
|
||||
@SET CHARGE 1
|
||||
@SET WRITE_CUBE FALSE
|
||||
@SET XYZFILE HeH.xyz
|
||||
|
||||
@SET BECKE_ACTIVE FALSE
|
||||
@SET BECKE_FRAGMENT FALSE
|
||||
@SET MAX_SCF 0
|
||||
! He+ H
|
||||
@SET BECKE_TARGET_1 0.0
|
||||
@SET BECKE_STR_1 0.0
|
||||
! He H+
|
||||
@SET BECKE_TARGET_2 2.0
|
||||
@SET BECKE_STR_2 0.0
|
||||
|
||||
@SET BECKE_GLOBAL_CUTOFF TRUE
|
||||
@SET BECKE_CUTOFF_ELEMENT FALSE
|
||||
|
||||
@SET BECKE_ADJUST_SIZE FALSE
|
||||
|
||||
@SET BECKE_ATOMIC_CHARGES FALSE
|
||||
|
||||
@SET BECKE_CAVITY_CONFINE FALSE
|
||||
@SET BECKE_CAVITY_SHAPE VDW
|
||||
@SET BECKE_CAVITY_PRINT FALSE
|
||||
|
||||
@SET BECKE_SHOULD_SKIP FALSE
|
||||
|
||||
@SET BECKE_IN_MEMORY FALSE
|
||||
|
||||
&GLOBAL
|
||||
PROJECT ${PROJECT_NAME}
|
||||
RUN_TYPE ENERGY
|
||||
PRINT_LEVEL MEDIUM
|
||||
&END GLOBAL
|
||||
|
||||
&FORCE_EVAL
|
||||
METHOD QS
|
||||
@include dft-common-params.inc
|
||||
@include subsys.inc
|
||||
&END FORCE_EVAL
|
||||
4
tests/QS/regtest-cdft-3/HeH.xyz
Normal file
4
tests/QS/regtest-cdft-3/HeH.xyz
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
2
|
||||
|
||||
He 7.500000 7.500000 7.100000
|
||||
H 7.500000 7.500000 7.900000
|
||||
18
tests/QS/regtest-cdft-3/TEST_FILES
Normal file
18
tests/QS/regtest-cdft-3/TEST_FILES
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# runs are executed in the same order as in this file
|
||||
# the second field tells which test should be run in order to compare with the last available output
|
||||
# see regtest/TEST_FILES
|
||||
#
|
||||
HeH-noconstraint.inp 1 1e-13 -2.92909797857414
|
||||
HeH-cdft-state-1.inp 71 4e-10 0.058799058192
|
||||
HeH-cdft-state-2.inp 71 2e-10 1.819331392252
|
||||
# These tests compute the electronic coupling and related quantities
|
||||
HeH-mixed-cdft-1.inp 73 5e-10 510.592548695828
|
||||
HeH-mixed-cdft-2.inp 73 5e-10 510.592548695828
|
||||
HeH-mixed-cdft-3.inp 74 5e-10 560.222792273994
|
||||
# These tests give identical values of energies/atomic forces
|
||||
HeH-mixed-cdft-4.inp 11 1e-13 -2.348554384953704
|
||||
HeH-mixed-cdft-5.inp 11 1e-13 -2.348554384953704
|
||||
# MD tests
|
||||
HeH-mixed-cdft-6.inp 11 2e-13 -2.350318822849201
|
||||
HeH-mixed-cdft-7.inp 11 2e-13 -2.350318822849201
|
||||
#EOF
|
||||
3
tests/QS/regtest-cdft-3/TEST_FILES_RESET
Normal file
3
tests/QS/regtest-cdft-3/TEST_FILES_RESET
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#
|
||||
# add files to be reset here
|
||||
#
|
||||
84
tests/QS/regtest-cdft-3/becke_qs.inc
Normal file
84
tests/QS/regtest-cdft-3/becke_qs.inc
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
&QS
|
||||
METHOD GPW
|
||||
EPS_DEFAULT 1.0E-12
|
||||
MAP_CONSISTENT
|
||||
EXTRAPOLATION ASPC
|
||||
EXTRAPOLATION_ORDER 3
|
||||
&CDFT
|
||||
TYPE_OF_CONSTRAINT BECKE
|
||||
&OUTER_SCF ON
|
||||
EPS_SCF 2.0e-1
|
||||
TYPE BECKE_CONSTRAINT
|
||||
OPTIMIZER BISECT
|
||||
BISECT_TRUST_COUNT 8
|
||||
EXTRAPOLATION_ORDER 2
|
||||
MAX_SCF ${MAX_SCF}
|
||||
STEP_SIZE -1.0
|
||||
&END
|
||||
&END CDFT
|
||||
&BECKE_RESTRAINT
|
||||
@IF ( ${BECKE_ADJUST_SIZE} == TRUE )
|
||||
! Defaults to false
|
||||
ADJUST_SIZE TRUE
|
||||
ATOMIC_RADII 0.460 0.320
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_ATOMIC_CHARGES} == TRUE )
|
||||
! Defaults to false
|
||||
ATOMIC_CHARGES TRUE
|
||||
@ENDIF
|
||||
STRENGTH ${BECKE_STR}
|
||||
! The constraint target: sum_i coeff_i * N_i
|
||||
! where N_i is the number of VALENCE electrons on i
|
||||
TARGET ${BECKE_TARGET}
|
||||
@IF ( ${BECKE_CUTOFF_ELEMENT} == TRUE )
|
||||
CUTOFF_TYPE ELEMENT
|
||||
ELEMENT_CUTOFF 2.0 2.0
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_GLOBAL_CUTOFF} == TRUE )
|
||||
CUTOFF_TYPE GLOBAL
|
||||
GLOBAL_CUTOFF 2.0
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_IN_MEMORY} == TRUE )
|
||||
! Defaults to false
|
||||
IN_MEMORY TRUE
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_CAVITY_CONFINE} == TRUE )
|
||||
! Defaults to NONE
|
||||
CONFINE CAVITY
|
||||
EPS_CAVITY 1.0E-6
|
||||
CAVITY_SHAPE ${BECKE_CAVITY_SHAPE}
|
||||
! For shape single
|
||||
CAVITY_RADIUS 1.3
|
||||
CAVITY_USE_BOHR FALSE
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_SHOULD_SKIP} == TRUE )
|
||||
! Defaults to false
|
||||
SHOULD_SKIP TRUE
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_CAVITY_PRINT} == TRUE )
|
||||
! Defaults to false
|
||||
CAVITY_PRINT TRUE
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_FRAGMENT} == TRUE )
|
||||
! Need absolute weight to use fragment densities
|
||||
ATOMS 1
|
||||
COEFF 1
|
||||
FRAGMENT_DENSITIES
|
||||
FRAGMENT_A_FILE_NAME He+-noconstraint-ELECTRON_DENSITY-1_0.cube
|
||||
FRAGMENT_B_FILE_NAME H-noconstraint-ELECTRON_DENSITY-1_0.cube
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_FRAGMENT} == FALSE )
|
||||
ATOMS 1..2
|
||||
COEFF 1 -1
|
||||
@ENDIF
|
||||
CONSTRAINT_TYPE TOTAL
|
||||
&PROGRAM_RUN_INFO ON
|
||||
&EACH
|
||||
QS_SCF 1
|
||||
&END EACH
|
||||
COMMON_ITERATION_LEVELS 2
|
||||
ADD_LAST NUMERIC
|
||||
FILENAME ./${PROJECT_NAME}
|
||||
&END PROGRAM_RUN_INFO
|
||||
&END BECKE_RESTRAINT
|
||||
&END QS
|
||||
82
tests/QS/regtest-cdft-3/dft-common-params.inc
Normal file
82
tests/QS/regtest-cdft-3/dft-common-params.inc
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
&DFT
|
||||
@IF ( ${BECKE_ACTIVE} == TRUE )
|
||||
@include becke_qs.inc
|
||||
@ENDIF
|
||||
@IF ( ${BECKE_ACTIVE} == FALSE )
|
||||
&QS
|
||||
METHOD GPW
|
||||
EPS_DEFAULT 1.0E-12
|
||||
MAP_CONSISTENT
|
||||
EXTRAPOLATION ASPC
|
||||
EXTRAPOLATION_ORDER 3
|
||||
&END QS
|
||||
@ENDIF
|
||||
BASIS_SET_FILE_NAME BASIS_MOLOPT
|
||||
POTENTIAL_FILE_NAME POTENTIAL
|
||||
@IF ( ${RESTART_WFN} == TRUE )
|
||||
WFN_RESTART_FILE_NAME ${WFN_FILE}
|
||||
@ENDIF
|
||||
LSD
|
||||
CHARGE ${CHARGE}
|
||||
&MGRID
|
||||
CUTOFF 100
|
||||
NGRIDS 5
|
||||
&END MGRID
|
||||
&SCF
|
||||
@IF ( ${RESTART_WFN} == TRUE )
|
||||
SCF_GUESS RESTART
|
||||
@ENDIF
|
||||
@IF ( ${RESTART_WFN} == FALSE )
|
||||
SCF_GUESS ATOMIC
|
||||
@ENDIF
|
||||
EPS_SCF 1.0E-5
|
||||
CHOLESKY INVERSE_DBCSR
|
||||
MAX_SCF 20
|
||||
&OT ON
|
||||
! DIIS convergence might not be constant with different mpiranks => use CG
|
||||
MINIMIZER CG
|
||||
PRECONDITIONER FULL_ALL
|
||||
ALGORITHM IRAC
|
||||
&END OT
|
||||
&OUTER_SCF ON
|
||||
EPS_SCF 1.0E-5
|
||||
MAX_SCF 2
|
||||
&END
|
||||
&PRINT
|
||||
&RESTART
|
||||
FILENAME ./${PROJECT_NAME}
|
||||
BACKUP_COPIES 0
|
||||
COMMON_ITERATION_LEVELS 1
|
||||
&EACH
|
||||
JUST_ENERGY ${WRITE_WFN}
|
||||
QS_SCF 0
|
||||
&END EACH
|
||||
&END RESTART
|
||||
&RESTART_HISTORY OFF
|
||||
&END RESTART_HISTORY
|
||||
&END PRINT
|
||||
&END SCF
|
||||
&XC
|
||||
&XC_FUNCTIONAL PBE
|
||||
&END XC_FUNCTIONAL
|
||||
&XC_GRID
|
||||
XC_DERIV SPLINE2
|
||||
XC_SMOOTH_RHO NONE
|
||||
&END XC_GRID
|
||||
&END XC
|
||||
&PRINT
|
||||
&MULLIKEN OFF
|
||||
&END MULLIKEN
|
||||
&HIRSHFELD OFF
|
||||
&END HIRSHFELD
|
||||
@IF ( ${WRITE_CUBE} == TRUE )
|
||||
&E_DENSITY_CUBE ON
|
||||
STRIDE 1 1 1
|
||||
&END E_DENSITY_CUBE
|
||||
@ENDIF
|
||||
&END PRINT
|
||||
&END DFT
|
||||
&PRINT
|
||||
&FORCES ON
|
||||
&END
|
||||
&END
|
||||
20
tests/QS/regtest-cdft-3/subsys.inc
Normal file
20
tests/QS/regtest-cdft-3/subsys.inc
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
&SUBSYS
|
||||
&CELL
|
||||
PERIODIC XYZ
|
||||
ABC 15. 15. 15.
|
||||
&END CELL
|
||||
&TOPOLOGY
|
||||
COORD_FILE_FORMAT XYZ
|
||||
COORD_FILE_NAME ${XYZFILE}
|
||||
&CENTER_COORDINATES OFF
|
||||
&END CENTER_COORDINATES
|
||||
&END TOPOLOGY
|
||||
&KIND He
|
||||
BASIS_SET SZV-MOLOPT-SR-GTH
|
||||
POTENTIAL GTH-PBE-q2
|
||||
&END KIND
|
||||
&KIND H
|
||||
BASIS_SET SZV-MOLOPT-SR-GTH
|
||||
POTENTIAL GTH-PBE-q1
|
||||
&END KIND
|
||||
&END SUBSYS
|
||||
|
|
@ -17,7 +17,9 @@
|
|||
TARGET 0.2000
|
||||
ATOMS 1 2
|
||||
COEFF 1 -1
|
||||
FUNCTIONAL_FORM CONSTRAINT
|
||||
CUTOFF_TYPE GLOBAL
|
||||
! 6.0 bohr
|
||||
GLOBAL_CUTOFF 3.1750632515399997
|
||||
&END
|
||||
&END QS
|
||||
&SCF
|
||||
|
|
|
|||
|
|
@ -8,14 +8,18 @@
|
|||
TARGET 0.2000
|
||||
ATOMS 1 2
|
||||
COEFF 1 -1
|
||||
FUNCTIONAL_FORM CONSTRAINT
|
||||
CUTOFF_TYPE GLOBAL
|
||||
! 6.0 bohr
|
||||
GLOBAL_CUTOFF 3.1750632515399997
|
||||
&END
|
||||
&BECKE_RESTRAINT_B
|
||||
STRENGTH -0.000000000000000000
|
||||
TARGET -0.2000
|
||||
ATOMS 1 2
|
||||
COEFF 1 -1
|
||||
FUNCTIONAL_FORM CONSTRAINT
|
||||
CUTOFF_TYPE GLOBAL
|
||||
! 6.0 bohr
|
||||
GLOBAL_CUTOFF 3.1750632515399997
|
||||
&END
|
||||
&END
|
||||
&END
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
# Directories have been reordered according the execution time needed for a gfortran pdbg run using 2 MPI tasks
|
||||
# in case a new directory is added just add it at the top of the list..
|
||||
# the order will be regularly checked and modified...
|
||||
QS/regtest-cdft-3 parallel mpiranks>1
|
||||
QS/regtest-cdft-2
|
||||
QS/regtest-cdft-1
|
||||
Fist/regtest-plumed2 plumed2
|
||||
TMC/regtest_ana_on_the_fly parallel mpiranks>2
|
||||
QS/regtest-sccs-3
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
70
|
||||
74
|
||||
Total energy:!3
|
||||
POTENTIAL ENERGY!4
|
||||
Total energy \[eV\]:!4
|
||||
|
|
@ -69,6 +69,10 @@ Energy Level: !9
|
|||
TDDFPT|[[:space:]]*1 !3
|
||||
Log(1-CN):!10
|
||||
\ TEMPERATURE \[K\] !4
|
||||
Current value of constraint !6
|
||||
SUM OF ATOMIC FORCES !8
|
||||
Diabatic electronic coupling !5
|
||||
Diabatic coupling !7
|
||||
#
|
||||
# these are the tests the can be selected for regtesting.
|
||||
# do regtest will grep for test_grep (first column) and look if the numeric value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue