Skip to content

Commit

Permalink
ADMM: input(short cuts) and output(write info to output) (#3118)
Browse files Browse the repository at this point in the history
  • Loading branch information
juerghutter committed Nov 17, 2023
1 parent 79e6028 commit e1b64ec
Show file tree
Hide file tree
Showing 12 changed files with 572 additions and 40 deletions.
1 change: 1 addition & 0 deletions src/cp_control_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ MODULE cp_control_types

TYPE admm_control_type
REAL(KIND=dp) :: eps_filter = 0.0_dp
INTEGER :: admm_type = 0
INTEGER :: purification_method = 0
INTEGER :: method = 0
LOGICAL :: charge_constrain = .FALSE.
Expand Down
234 changes: 204 additions & 30 deletions src/cp_control_utils.F

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/input_constants.F
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,13 @@ MODULE input_constants
! Define scaling of the exchange correction
INTEGER, PARAMETER, PUBLIC :: do_admm_exch_scaling_none = 0, &
do_admm_exch_scaling_merlot = 1
! ADMM TYPES
INTEGER, PARAMETER, PUBLIC :: no_admm_type = 0, &
admm1_type = 1, &
admm2_type = 2, &
admms_type = 3, &
admmp_type = 4, &
admmq_type = 5

! Define DFT+U method identifier codes
INTEGER, PARAMETER, PUBLIC :: plus_u_lowdin = 1, &
Expand Down
23 changes: 21 additions & 2 deletions src/input_cp2k_dft.F
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MODULE input_cp2k_dft
Ehrhardt1985, Eriksen2020, Fattebert2002, Golze2017a, Golze2017b, Guidon2010, &
Heinzmann1976, Holmberg2017, Holmberg2018, Iannuzzi2005, Iannuzzi2006, Iannuzzi2007, &
Knizia2013, Kolafa2004, Krack2000, Krack2002, Kuhne2007, Kunert2003, Lippert1997, &
Lippert1999, Lu2004, Perdew1981, Repasky2002, Rocha2006, Schenter2008, Schiffmann2015, &
Lippert1999, Lu2004, Merlot2014, Perdew1981, Repasky2002, Rocha2006, Schenter2008, Schiffmann2015, &
Shigeta2001, Stewart1982, Stewart1989, Stewart2007, Thiel1992, VanVoorhis2015, &
VandeVondele2003, VandeVondele2005a, VandeVondele2005b, VandeVondele2006, Weber2008, &
Yin2017
Expand Down Expand Up @@ -105,7 +105,8 @@ MODULE input_cp2k_dft
xas_1s_type, xas_2p_type, xas_2s_type, xas_3d_type, xas_3p_type, xas_3s_type, xas_4d_type, &
xas_4f_type, xas_4p_type, xas_4s_type, xas_dip_len, xas_dip_vel, xas_dscf, xas_none, &
xas_not_excited, xas_tdp_by_index, xas_tdp_by_kind, xas_tp_fh, xas_tp_flex, xas_tp_hh, &
xas_tp_xfh, xas_tp_xhh, xes_tp_val
xas_tp_xfh, xas_tp_xhh, xes_tp_val, &
no_admm_type, admm1_type, admm2_type, admms_type, admmp_type, admmq_type
USE input_cp2k_almo, ONLY: create_almo_scf_section
USE input_cp2k_distribution, ONLY: create_distribution_section
USE input_cp2k_ec, ONLY: create_ec_section
Expand Down Expand Up @@ -3480,6 +3481,24 @@ SUBROUTINE create_admm_section(section)
n_keywords=1, n_subsections=1, repeats=.FALSE., &
citations=(/Guidon2010/))

CALL keyword_create( &
keyword, __LOCATION__, &
name="ADMM_TYPE", &
description="Type of ADMM (sort name) as refered in literature. "// &
"This sets values for METHOD, ADMM_PURIFICATION_METHOD, and EXCH_SCALING_MODEL", &
enum_c_vals=s2a("NONE", "ADMM1", "ADMM2", "ADMMS", "ADMMP", "ADMMQ"), &
enum_desc=s2a("No short name is used, use specific definitions (default)", &
"ADMM1 method from Guidon2010", &
"ADMM2 method from Guidon2010", &
"ADMMS method from Merlot2014", &
"ADMMP method from Merlot2014", &
"ADMMQ method from Merlot2014"), &
enum_i_vals=(/no_admm_type, admm1_type, admm2_type, admms_type, admmp_type, admmq_type/), &
default_i_val=no_admm_type, &
citations=(/Guidon2010, Merlot2014/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create( &
keyword, __LOCATION__, &
name="ADMM_PURIFICATION_METHOD", &
Expand Down
17 changes: 9 additions & 8 deletions src/qs_environment.F
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@ MODULE qs_environment
qs_control_type,&
semi_empirical_control_type,&
xtb_control_type
USE cp_control_utils, ONLY: read_ddapc_section,&
read_dft_control,&
read_mgrid_section,&
read_qs_section,&
read_tddfpt2_control,&
read_tddfpt_control,&
write_dft_control,&
write_qs_control
USE cp_control_utils, ONLY: &
read_ddapc_section, read_dft_control, read_mgrid_section, read_qs_section, &
read_tddfpt2_control, read_tddfpt_control, write_admm_control, write_dft_control, &
write_qs_control
USE cp_ddapc_types, ONLY: cp_ddapc_ewald_create
USE cp_log_handling, ONLY: cp_get_default_logger,&
cp_logger_get_default_io_unit,&
Expand Down Expand Up @@ -1662,6 +1658,11 @@ SUBROUTINE qs_init_subsys(qs_env, para_env, subsys, cell, cell_ref, use_ref_cell
! Print the Quickstep control parameters
CALL write_qs_control(dft_control%qs_control, dft_section)
! Print the ADMM control parameters
IF (dft_control%do_admm) THEN
CALL write_admm_control(dft_control%admm_control, dft_section)
END IF
! Print XES/XAS control parameters
IF (dft_control%do_xas_calculation) THEN
CALL cite_reference(Iannuzzi2007)
Expand Down
63 changes: 63 additions & 0 deletions tests/QS/regtest-admm-type/H2O-ADMM1.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
&FORCE_EVAL
METHOD Quickstep
&DFT
BASIS_SET_FILE_NAME BASIS_ccGRB_UZH
BASIS_SET_FILE_NAME BASIS_ADMM_UZH
POTENTIAL_FILE_NAME POTENTIAL_UZH
&MGRID
CUTOFF 200
REL_CUTOFF 40
&END MGRID
&AUXILIARY_DENSITY_MATRIX_METHOD
ADMM_TYPE ADMM1
EXCH_CORRECTION_FUNC PBEX
&END
&QS
EPS_DEFAULT 1.0E-12
METHOD GPW
&END
&SCF
SCF_GUESS ATOMIC
MAX_SCF 5
&END SCF
&XC
&XC_FUNCTIONAL NONE
&END XC_FUNCTIONAL
&HF
FRACTION 1.0
&INTERACTION_POTENTIAL
POTENTIAL_TYPE TRUNCATED
CUTOFF_RADIUS 2.0
&END
&END
&END XC
&END DFT
&SUBSYS
&CELL
ABC 4.5 4.5 4.5
PERIODIC NONE
&END CELL
&TOPOLOGY
&END
&COORD
O 0.000000 0.000000 -0.065587
H 0.000000 -0.757136 0.520545
H 0.000000 0.757136 0.520545
&END COORD
&KIND H
BASIS_SET ccGRB-D-q1
BASIS_SET AUX_FIT admm-dz-q1
POTENTIAL GTH-HYB-q1
&END KIND
&KIND O
BASIS_SET ccGRB-D-q6
BASIS_SET AUX_FIT admm-dz-q6
POTENTIAL GTH-HYB-q6
&END KIND
&END SUBSYS
&END FORCE_EVAL
&GLOBAL
PROJECT H2O-ADMM1
PRINT_LEVEL MEDIUM
RUN_TYPE ENERGY
&END GLOBAL
67 changes: 67 additions & 0 deletions tests/QS/regtest-admm-type/H2O-ADMM2.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
&FORCE_EVAL
METHOD Quickstep
&DFT
BASIS_SET_FILE_NAME BASIS_ccGRB_UZH
BASIS_SET_FILE_NAME BASIS_ADMM_UZH
POTENTIAL_FILE_NAME POTENTIAL_UZH
&MGRID
CUTOFF 200
REL_CUTOFF 40
&END MGRID
&AUXILIARY_DENSITY_MATRIX_METHOD
ADMM_TYPE ADMM2
EXCH_CORRECTION_FUNC NONE
&END
&QS
EPS_DEFAULT 1.0E-12
METHOD GPW
&END
&SCF
SCF_GUESS ATOMIC
MAX_SCF 5
&OT
PRECONDITIONER FULL_ALL
MINIMIZER DIIS
&END OT
&END SCF
&XC
&XC_FUNCTIONAL NONE
&END XC_FUNCTIONAL
&HF
FRACTION 1.0
&INTERACTION_POTENTIAL
POTENTIAL_TYPE TRUNCATED
CUTOFF_RADIUS 2.0
&END
&END
&END XC
&END DFT
&SUBSYS
&CELL
ABC 4.5 4.5 4.5
PERIODIC NONE
&END CELL
&TOPOLOGY
&END
&COORD
O 0.000000 0.000000 -0.065587
H 0.000000 -0.757136 0.520545
H 0.000000 0.757136 0.520545
&END COORD
&KIND H
BASIS_SET ccGRB-D-q1
BASIS_SET AUX_FIT admm-dz-q1
POTENTIAL GTH-HYB-q1
&END KIND
&KIND O
BASIS_SET ccGRB-D-q6
BASIS_SET AUX_FIT admm-dz-q6
POTENTIAL GTH-HYB-q6
&END KIND
&END SUBSYS
&END FORCE_EVAL
&GLOBAL
PROJECT H2O-ADMM2
PRINT_LEVEL MEDIUM
RUN_TYPE ENERGY
&END GLOBAL
62 changes: 62 additions & 0 deletions tests/QS/regtest-admm-type/H2O-ADMMP-GAPW.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
&FORCE_EVAL
METHOD Quickstep
&DFT
BASIS_SET_FILE_NAME BASIS_ccGRB_UZH
BASIS_SET_FILE_NAME BASIS_ADMM_UZH
POTENTIAL_FILE_NAME POTENTIAL_UZH
&MGRID
CUTOFF 200
REL_CUTOFF 40
&END MGRID
&AUXILIARY_DENSITY_MATRIX_METHOD
ADMM_TYPE ADMMP
&END
&QS
EPS_DEFAULT 1.0E-12
METHOD GAPW
&END
&SCF
SCF_GUESS ATOMIC
MAX_SCF 5
&END SCF
&XC
&XC_FUNCTIONAL NONE
&END XC_FUNCTIONAL
&HF
FRACTION 1.0
&INTERACTION_POTENTIAL
POTENTIAL_TYPE TRUNCATED
CUTOFF_RADIUS 2.0
&END
&END
&END XC
&END DFT
&SUBSYS
&CELL
ABC 4.5 4.5 4.5
PERIODIC NONE
&END CELL
&TOPOLOGY
&END
&COORD
O 0.000000 0.000000 -0.065587
H 0.000000 -0.757136 0.520545
H 0.000000 0.757136 0.520545
&END COORD
&KIND H
BASIS_SET ccGRB-D-q1
BASIS_SET AUX_FIT admm-dz-q1
POTENTIAL GTH-HYB-q1
&END KIND
&KIND O
BASIS_SET ccGRB-D-q6
BASIS_SET AUX_FIT admm-dz-q6
POTENTIAL GTH-HYB-q6
&END KIND
&END SUBSYS
&END FORCE_EVAL
&GLOBAL
PROJECT H2O-ADMMP
PRINT_LEVEL MEDIUM
RUN_TYPE ENERGY
&END GLOBAL
63 changes: 63 additions & 0 deletions tests/QS/regtest-admm-type/H2O-ADMMQ-OPTX.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
&FORCE_EVAL
METHOD Quickstep
&DFT
BASIS_SET_FILE_NAME BASIS_ccGRB_UZH
BASIS_SET_FILE_NAME BASIS_ADMM_UZH
POTENTIAL_FILE_NAME POTENTIAL_UZH
&MGRID
CUTOFF 200
REL_CUTOFF 40
&END MGRID
&AUXILIARY_DENSITY_MATRIX_METHOD
ADMM_TYPE ADMMQ
EXCH_CORRECTION_FUNC OPTX
&END
&QS
EPS_DEFAULT 1.0E-12
METHOD GPW
&END
&SCF
SCF_GUESS ATOMIC
MAX_SCF 5
&END SCF
&XC
&XC_FUNCTIONAL NONE
&END XC_FUNCTIONAL
&HF
FRACTION 1.0
&INTERACTION_POTENTIAL
POTENTIAL_TYPE TRUNCATED
CUTOFF_RADIUS 2.0
&END
&END
&END XC
&END DFT
&SUBSYS
&CELL
ABC 4.5 4.5 4.5
PERIODIC NONE
&END CELL
&TOPOLOGY
&END
&COORD
O 0.000000 0.000000 -0.065587
H 0.000000 -0.757136 0.520545
H 0.000000 0.757136 0.520545
&END COORD
&KIND H
BASIS_SET ccGRB-D-q1
BASIS_SET AUX_FIT admm-dz-q1
POTENTIAL GTH-HYB-q1
&END KIND
&KIND O
BASIS_SET ccGRB-D-q6
BASIS_SET AUX_FIT admm-dz-q6
POTENTIAL GTH-HYB-q6
&END KIND
&END SUBSYS
&END FORCE_EVAL
&GLOBAL
PROJECT H2O-ADMMQ
PRINT_LEVEL MEDIUM
RUN_TYPE ENERGY
&END GLOBAL

0 comments on commit e1b64ec

Please sign in to comment.