(git:591cf04)
Loading...
Searching...
No Matches
input_cp2k_harris.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Harris input section
10! **************************************************************************************************
12 USE input_constants, ONLY: hden_atomic,&
13 hden_cube,&
25 USE input_val_types, ONLY: char_t
26 USE kinds, ONLY: dp
27 USE physcon, ONLY: kelvin
28 USE string_utilities, ONLY: s2a
29#include "./base/base_uses.f90"
30
31 IMPLICIT NONE
32 PRIVATE
33
34 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_harris'
35
36 PUBLIC :: create_harris_section
37
38CONTAINS
39
40! **************************************************************************************************
41!> \brief creates the HARRIS_METHOD section
42!> \param section ...
43!> \author JGH
44! **************************************************************************************************
45 SUBROUTINE create_harris_section(section)
46 TYPE(section_type), POINTER :: section
47
48 TYPE(keyword_type), POINTER :: keyword
49
50 cpassert(.NOT. ASSOCIATED(section))
51
52 NULLIFY (keyword)
53 CALL section_create(section, __location__, name="HARRIS_METHOD", &
54 description="Sets the various options for the Harris method", &
55 n_keywords=15, n_subsections=0, repeats=.false.)
56
57 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
58 description="Controls the activation of the Harris method", &
59 usage="&HARRIS_METHOD T", &
60 default_l_val=.false., &
61 lone_keyword_l_val=.true.)
62 CALL section_add_keyword(section, keyword)
63 CALL keyword_release(keyword)
64
65 CALL keyword_create(keyword, __location__, name="ENERGY_FUNCTIONAL", &
66 description="Functional used in energy correction", &
67 usage="ENERGY_FUNCTIONAL HARRIS", &
68 default_i_val=hfun_harris, &
69 enum_c_vals=s2a("HARRIS"), &
70 enum_desc=s2a("Harris functional"), &
71 enum_i_vals=[hfun_harris])
72 CALL section_add_keyword(section, keyword)
73 CALL keyword_release(keyword)
74
75 CALL keyword_create(keyword, __location__, name="DENSITY_SOURCE", &
76 description="Method to create the input density", &
77 usage="DENSITY_SOURCE ATOMIC", &
78 default_i_val=hden_atomic, &
79 enum_c_vals=s2a("ATOMIC", "CUBE", "CUBE_FIT"), &
80 enum_desc=s2a("Atomic densities", &
81 "Electron density read directly from a Gaussian cube file", &
82 "Cube density fitted by a constrained AO density matrix. "// &
83 "This dense reference method currently requires GPW, a "// &
84 "spin-restricted calculation, and the Gamma point"), &
85 enum_i_vals=[hden_atomic, hden_cube, hden_cube_fit])
86 CALL section_add_keyword(section, keyword)
87 CALL keyword_release(keyword)
88
89 CALL keyword_create(keyword, __location__, name="FILE_DENSITY", &
90 description="Filename of the electron density in Gaussian cube format. "// &
91 "Used when DENSITY_SOURCE is CUBE or CUBE_FIT. The cube grid has to coincide with "// &
92 "the finest CP2K real-space grid.", &
93 usage="FILE_DENSITY <FILENAME>", &
94 type_of_var=char_t, default_c_val="", n_var=1)
95 CALL section_add_keyword(section, keyword)
96 CALL keyword_release(keyword)
97
98 CALL keyword_create(keyword, __location__, name="FIT_METHOD", &
99 description="Objective used to reconstruct an AO density matrix for CUBE_FIT. "// &
100 "RELATIVE_ENTROPY uses the frozen H[n_cube] Fermi matrix as a physical prior. "// &
101 "The current implementation is a dense cubic reference method.", &
102 usage="FIT_METHOD LEAST_SQUARES", &
103 default_i_val=hfit_least_squares, &
104 enum_c_vals=s2a("LEAST_SQUARES", "RELATIVE_ENTROPY"), &
105 enum_desc=s2a("Constrained least-squares density fit", &
106 "Fermionic relative-entropy/Mermin reconstruction with H[n_cube] prior"), &
108 CALL section_add_keyword(section, keyword)
109 CALL keyword_release(keyword)
110
111 CALL keyword_create(keyword, __location__, name="FIT_MAX_ITER", &
112 description="Maximum number of projected-gradient iterations for CUBE_FIT.", &
113 usage="FIT_MAX_ITER 50", default_i_val=50)
114 CALL section_add_keyword(section, keyword)
115 CALL keyword_release(keyword)
116
117 CALL keyword_create(keyword, __location__, name="FIT_EPS", &
118 description="Target RMS error of the fitted density for CUBE_FIT.", &
119 usage="FIT_EPS 1.0E-3", default_r_val=1.0e-3_dp)
120 CALL section_add_keyword(section, keyword)
121 CALL keyword_release(keyword)
122
123 CALL keyword_create(keyword, __location__, name="FIT_STEP_SIZE", &
124 description="Initial spectral projected-gradient step size for CUBE_FIT.", &
125 usage="FIT_STEP_SIZE 1.0", default_r_val=1.0_dp)
126 CALL section_add_keyword(section, keyword)
127 CALL keyword_release(keyword)
128
129 CALL keyword_create(keyword, __location__, name="FIT_MAX_BACKTRACK", &
130 description="Maximum number of line-search reductions in each CUBE_FIT iteration.", &
131 usage="FIT_MAX_BACKTRACK 20", default_i_val=20)
132 CALL section_add_keyword(section, keyword)
133 CALL keyword_release(keyword)
134
135 CALL keyword_create(keyword, __location__, name="FIT_TEMPERATURE", &
136 description="Electronic temperature of the Fermi-matrix prior used by "// &
137 "FIT_METHOD RELATIVE_ENTROPY.", &
138 usage="FIT_TEMPERATURE [K] 300", &
139 default_r_val=300.0_dp/kelvin, unit_str="K")
140 CALL section_add_keyword(section, keyword)
141 CALL keyword_release(keyword)
142
143 CALL keyword_create(keyword, __location__, name="FIT_RELATIVE_ENTROPY_WEIGHT", &
144 description="Weight multiplying the dimensionless fermionic relative entropy "// &
145 "in the regularized CUBE_FIT objective.", &
146 usage="FIT_RELATIVE_ENTROPY_WEIGHT 1.0E-3", default_r_val=1.0e-3_dp)
147 CALL section_add_keyword(section, keyword)
148 CALL keyword_release(keyword)
149
150 CALL keyword_create(keyword, __location__, name="DIRECT_DENSITY_MATRIX_ENERGY", &
151 description="Evaluate the fitted AO density matrix directly, without a NONSCF "// &
152 "eigensolver. Requires DENSITY_SOURCE CUBE_FIT. CP2K reports both the "// &
153 "consistent trial-density-matrix energy and a Harris-like energy based on "// &
154 "the original cube density.", &
155 usage="DIRECT_DENSITY_MATRIX_ENERGY T", default_l_val=.false., &
156 lone_keyword_l_val=.true.)
157 CALL section_add_keyword(section, keyword)
158 CALL keyword_release(keyword)
159
160 CALL keyword_create(keyword, __location__, name="ORBITAL_BASIS", &
161 description="Specifies the type of basis to be used for the energy functional. ", &
162 default_i_val=horb_default, &
163 enum_c_vals=s2a("ATOMIC_KIND_BASIS"), &
164 enum_desc=s2a("Atomic kind orbital basis"), &
165 enum_i_vals=[horb_default])
166 CALL section_add_keyword(section, keyword)
167 CALL keyword_release(keyword)
168
169 CALL keyword_create(keyword, __location__, name="DEBUG_FORCES", &
170 description="Additional output to debug Harris method forces.", &
171 usage="DEBUG_FORCES T", default_l_val=.false., lone_keyword_l_val=.true.)
172 CALL section_add_keyword(section, keyword)
173 CALL keyword_release(keyword)
174 CALL keyword_create(keyword, __location__, name="DEBUG_STRESS", &
175 description="Additional output to debug Harris method stress.", &
176 usage="DEBUG_STRESS T", default_l_val=.false., lone_keyword_l_val=.true.)
177 CALL section_add_keyword(section, keyword)
178 CALL keyword_release(keyword)
179
180 END SUBROUTINE create_harris_section
181
182END MODULE input_cp2k_harris
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public hden_cube
integer, parameter, public hfit_least_squares
integer, parameter, public hfit_relative_entropy
integer, parameter, public hfun_harris
integer, parameter, public horb_default
integer, parameter, public hden_cube_fit
integer, parameter, public hden_atomic
Harris input section.
subroutine, public create_harris_section(section)
creates the HARRIS_METHOD section
represents keywords in an input
subroutine, public keyword_release(keyword)
releases the given keyword (see doc/ReferenceCounting.html)
subroutine, public keyword_create(keyword, location, name, description, usage, type_of_var, n_var, repeats, variants, default_val, default_l_val, default_r_val, default_lc_val, default_c_val, default_i_val, default_l_vals, default_r_vals, default_c_vals, default_i_vals, lone_keyword_val, lone_keyword_l_val, lone_keyword_r_val, lone_keyword_c_val, lone_keyword_i_val, lone_keyword_l_vals, lone_keyword_r_vals, lone_keyword_c_vals, lone_keyword_i_vals, enum_c_vals, enum_i_vals, enum, enum_strict, enum_desc, unit_str, citations, deprecation_notice, removed)
creates a keyword object
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_create(section, location, name, description, n_keywords, n_subsections, repeats, citations, deprecation_notice)
creates a list of keywords
subroutine, public section_add_keyword(section, keyword)
adds a keyword to the given section
a wrapper for basic fortran types.
integer, parameter, public char_t
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public kelvin
Definition physcon.F:165
Utilities for string manipulations.
represent a keyword in the input
represent a section of the input file