41#include "./base/base_uses.f90"
46 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .false.
47 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'input_cp2k_nnp'
65 cpassert(.NOT.
ASSOCIATED(section))
67 description=
"This section contains all information to run a "// &
68 "Neural Network Potential (NNP) calculation.", &
69 n_keywords=5, n_subsections=3, repeats=.false., &
72 NULLIFY (subsection, subsubsection, keyword)
74 CALL keyword_create(keyword, __location__, name=
"NNP_INPUT_FILE_NAME", &
75 description=
"File containing the input information for "// &
76 "the setup of the NNP (n2p2/RuNNer format).", &
77 repeats=.false., default_lc_val=
"input.nn")
80 CALL keyword_create(keyword, __location__, name=
"SCALE_FILE_NAME", &
81 description=
"File containing the scaling information for "// &
82 "the symmetry functions of the NNP.", &
83 repeats=.false., default_lc_val=
"scaling.data")
88 description=
"Number of knots per radial group in "// &
89 "the cubic-Hermite spline tables that tabulate "// &
90 "the radial symmetry-function product "// &
91 "y(r) = exp(-eta*(r-rs)^2) * fcut(r). "// &
92 "The value error scales as O(1/n^4) and the "// &
93 "force (derivative) error as O(1/n^3); the "// &
94 "default keeps both inside the NNP regression "// &
95 "tolerance for a radial cutoff of ~12 bohr "// &
96 "(value ~1e-14, force ~1e-10). Larger cutoffs or "// &
97 "stricter tolerances may need a larger n, with "// &
98 "the force term the binding constraint. Memory "// &
99 "cost scales linearly in n per group.", &
103 default_i_val=8192, &
104 usage=
"RAD_SPLINE_N 8192")
109 description=
"Verlet skin distance for the NNP descriptor "// &
110 "neighbour cell-list. The neighbour-list cutoff is "// &
111 "(symmetry-function cutoff + skin); the cell-list "// &
112 "chain is rebuilt only when an atom drifts more "// &
113 "than skin/2 from its rebuild-time position, "// &
114 "analogous to the LAMMPS 'neighbor <skin> bin' "// &
115 "command. Larger skin reduces the rebuild rate "// &
116 "but enlarges the per-atom neighbour list. "// &
117 "A negative value (default) selects the "// &
118 "automatic heuristic MIN(0.5 bohr, 0.1*cutoff). "// &
119 "Useful upper bound is half the smallest "// &
120 "perpendicular cell width.", &
124 default_r_val=-1.0_dp, &
126 usage=
"VERLET_SKIN [bohr] 0.5")
131 description=
"Choose between the CPU and GPU code paths for "// &
132 "the NNP energy and force evaluation. The GPU path "// &
133 "requires a build with CUDA or HIP support; it "// &
134 "reproduces the CPU results within the "// &
135 "regression-test tolerances. Analytic stress (e.g. "// &
136 "NPT) is accumulated on the device by the "// &
137 "force-scatter kernels; only energy-only "// &
138 "evaluations always use the CPU path.", &
139 usage=
"USE_GPU AUTO", &
141 enum_c_vals=
s2a(
"AUTO",
"ON",
"OFF"), &
143 enum_desc=
s2a(
"Probe for a GPU at initialization and use it when "// &
144 "the build supports one, every rank sees a device, "// &
145 "the model fits the compiled-in device-table "// &
146 "capacities, and the system is large enough for the "// &
147 "transfer and launch overhead to pay off (currently "// &
148 "a thousand atoms per rank); otherwise fall back to "// &
150 "Force the GPU code path; abort if the build has "// &
151 "no GPU support or no device is available.", &
152 "Force the CPU code path."), &
157 CALL keyword_create(keyword, __location__, name=
"GPU_PRECISION", &
158 description=
"Floating-point precision of the GPU code path. "// &
159 "Only meaningful when the GPU path is active.", &
160 usage=
"GPU_PRECISION DOUBLE", &
162 enum_c_vals=
s2a(
"DOUBLE",
"MIXED"), &
164 enum_desc=
s2a(
"All-FP64 path; reproduces the CPU trajectory "// &
165 "within the regression-test tolerances.", &
166 "FP32 angular symmetry-function math with FP64 "// &
167 "radial functions, network evaluation and every "// &
168 "accumulator that sums over neighbours. Faster on "// &
169 "GPUs whose single-precision throughput exceeds "// &
170 "their double-precision throughput, at the cost of "// &
171 "a perturbation of energies and forces that is "// &
172 "model dependent (a relative 4.5e-11 on the "// &
173 "step-zero energy of the shipped regression-test "// &
174 "model, whose tests bound it at 1e-6; measure it "// &
181 description=
"When enabled and the GPU code path is active, the CPU "// &
182 "reference implementation is run in shadow mode on every force "// &
183 "evaluation and its energies, forces and stress are compared with "// &
184 "those from the GPU path. If the two results differ by too much "// &
185 "then the calculation is aborted. Under USE_GPU AUTO the "// &
186 "system-size heuristic is skipped, so the GPU path engages "// &
187 "whenever the build and the machine support it. Has no effect "// &
188 "when the evaluation runs on the CPU, so the same input can be "// &
189 "used on every architecture.", &
191 default_l_val=.false., &
192 lone_keyword_l_val=.true.)
198 description=
"Section to bias the committee disagreement (sigma) by "// &
199 "E = 0.5 * K_B * (sigma - SIGMA_0)**2, if sigma > SIGMA_0.", &
200 n_keywords=2, n_subsections=0, repeats=.false., &
203 description=
"Harmonic spring constant of the bias potential [1/hartree].", &
208 unit_str=
"hartree^-1", &
209 usage=
"K_B [hartree^-1] 0.1")
213 description=
"Shift of the harmonic bias potential.", &
218 unit_str=
"hartree", &
219 usage=
"SIGMA_0 [hartree] 0.1")
222 CALL keyword_create(keyword, __location__, name=
"ALIGN_NNP_ENERGIES", &
223 description=
"Remove PES shifts within the committee by "// &
224 "subtracting energy for each committee member. Provide "// &
225 "one number per C-NNP member.", &
229 usage=
"ALIGN_NNP_ENERGIES <REAL> <REAL> ... <REAL>")
233 CALL create_nnp_bias_print_section(subsubsection)
242 description=
"Section for a single NNP model. "// &
243 "If this section is repeated, a committee model (C-NNP) "// &
244 "is used where the NNP members share the same symmetry functions.", &
245 n_keywords=1, n_subsections=0, repeats=.true.)
247 description=
"File containing the weights for the "// &
248 "artificial neural networks of the NNP. "// &
249 "The specified name is extended by .XXX.data", &
250 repeats=.false., default_lc_val=
"weights")
256 CALL create_nnp_print_section(subsection)
268 SUBROUTINE create_nnp_print_section(section)
274 cpassert(.NOT.
ASSOCIATED(section))
276 description=
"Section of possible print options in NNP code.", &
277 n_keywords=0, n_subsections=5, repeats=.false.)
279 NULLIFY (print_key, keyword)
282 description=
"Controls the printing of the NNP energies.", &
288 description=
"Controls the printing of the NNP forces.", &
294 description=
"Controls the printing of the STD per atom of the NNP forces.", &
300 description=
"If activated, output structures with extrapolation "// &
301 "warning in xyz-format", &
307 description=
"If activated, output summed force over specified atoms. "// &
308 "Used in Green-Kubo relation for friction at liquid-solid interfaces.", &
312 description=
"List of atoms over which to calculate summed force", &
313 usage=
"ATOM_LISTS {O} {H} .. {X}", repeats=.false., &
314 n_var=-1, type_of_var=
char_t)
321 END SUBROUTINE create_nnp_print_section
329 SUBROUTINE create_nnp_bias_print_section(section)
334 cpassert(.NOT.
ASSOCIATED(section))
336 description=
"Section of possible print options in NNP code.", &
337 n_keywords=0, n_subsections=3, repeats=.false.)
342 description=
"Controls the printing of the BIAS energy.", &
348 description=
"Controls the printing of the BIAS forces.", &
353 END SUBROUTINE create_nnp_bias_print_section
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public schran2020b
integer, save, public schran2020a
integer, save, public behler2011
integer, save, public behler2007
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
subroutine, public cp_print_key_section_create(print_key_section, location, name, description, print_level, each_iter_names, each_iter_values, add_last, filename, common_iter_levels, citations, unit_str, do_backup)
creates a print_key section
integer, parameter, public medium_print_level
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Defines the basic variable types.
integer, parameter, public dp
Utilities for string manipulations.