(git:e704af8)
Loading...
Searching...
No Matches
input_cp2k_poisson.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 function that build the poisson section of the input
10!> \par History
11!> 03.2006 fusing of poisson_dft and poisson_mm
12!> \author fawzi
13! **************************************************************************************************
15 USE bibliography, ONLY: &
18 USE cell_types, ONLY: use_perd_none,&
30 USE cp_units, ONLY: cp_unit_to_cp2k
31 USE dct, ONLY: neumannx,&
32 neumannxy,&
34 neumannxz,&
35 neumanny,&
36 neumannyz,&
38 USE dielectric_types, ONLY: &
42 inscribed,&
43 x_axis,&
44 xy_plane,&
45 xz_plane,&
46 y_axis,&
47 yz_plane,&
48 z_axis
61 USE input_val_types, ONLY: enum_t,&
62 integer_t,&
63 real_t
64 USE kinds, ONLY: dp
69 USE ps_implicit_types, ONLY: mixed_bc,&
73 USE pw_poisson_types, ONLY: &
77 USE pw_spline_utils, ONLY: no_precond,&
83 USE string_utilities, ONLY: s2a
84#include "./base/base_uses.f90"
85
86 IMPLICIT NONE
87 PRIVATE
88
89 LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .true.
90 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_poisson'
91
92 PUBLIC :: create_poisson_section, &
95!***
96CONTAINS
97
98! **************************************************************************************************
99!> \brief Creates the Poisson section
100!> \param section the section to create
101!> \author teo
102! **************************************************************************************************
103 SUBROUTINE create_poisson_section(section)
104 TYPE(section_type), POINTER :: section
105
106 TYPE(keyword_type), POINTER :: keyword
107 TYPE(section_type), POINTER :: subsection
108
109 cpassert(.NOT. ASSOCIATED(section))
110 CALL section_create(section, __location__, name="poisson", &
111 description="Controls the Poisson solver and electrostatic boundary conditions used by DFT.", &
112 n_keywords=1, n_subsections=0, repeats=.false.)
113
114 NULLIFY (keyword, subsection)
115 CALL keyword_create(keyword, __location__, name="POISSON_SOLVER", &
116 variants=["POISSON", "PSOLVER"], &
117 description="Specify which kind of solver to use to solve the Poisson equation.", &
118 usage="POISSON_SOLVER char", &
119 enum_c_vals=s2a("PERIODIC", "ANALYTIC", "MT", "MULTIPOLE", "WAVELET", "IMPLICIT"), &
122 enum_desc=s2a("PERIODIC is only available for fully (3D) periodic systems.", &
123 "ANALYTIC is available for 0D, 1D and 2D periodic solutions using analytical green "// &
124 "functions in the g space (slow convergence).", &
125 "MT (Martyna Tuckermann) decoupling that interacts only with the nearest "// &
126 "neighbor. Beware results are completely wrong if the cell is smaller than twice the "// &
127 "cluster size (with electronic density). Available for 0D and 2D systems.", &
128 "MULTIPOLE uses a scheme that fits the total charge with one gaussian per atom. "// &
129 "Available only for cluster (0D) systems.", &
130 "WAVELET allows for 0D, 2D (but only PERIODIC XZ) and 3D systems. It does not "// &
131 "require very large unit cells, only that the density goes to zero on the faces of "// &
132 "the cell. The use of PREFERRED_FFT_LIBRARY FFTSG is required.", &
133 "IMPLICIT allows for 0D, 1D, 2D and 3D systems."), &
135 default_i_val=pw_poisson_periodic)
136 CALL section_add_keyword(section, keyword)
137 CALL keyword_release(keyword)
138
139 CALL keyword_create(keyword, __location__, name="PERIODIC", &
140 description="Specifies the directions in which periodic boundary conditions apply to electrostatics. "// &
141 "See the CELL section for the periodicity used by geometry and pair lists; "// &
142 "the settings are usually the same.", &
143 usage="PERIODIC (x|y|z|xy|xz|yz|xyz|none)", &
144 enum_c_vals=s2a("x", "y", "z", "xy", "xz", "yz", "xyz", "none"), &
145 enum_i_vals=[use_perd_x, use_perd_y, use_perd_z, &
148 default_i_val=use_perd_xyz)
149 CALL section_add_keyword(section, keyword)
150 CALL keyword_release(keyword)
151
152 CALL create_mt_section(subsection)
153 CALL section_add_subsection(section, subsection)
154 CALL section_release(subsection)
155
156 CALL create_wavelet_section(subsection)
157 CALL section_add_subsection(section, subsection)
158 CALL section_release(subsection)
159
160 CALL create_multipole_section(subsection)
161 CALL section_add_subsection(section, subsection)
162 CALL section_release(subsection)
163
164 CALL create_ewald_section(subsection)
165 CALL section_add_subsection(section, subsection)
166 CALL section_release(subsection)
167
168 CALL create_implicit_ps_section(subsection)
169 CALL section_add_subsection(section, subsection)
170 CALL section_release(subsection)
171 END SUBROUTINE create_poisson_section
172
173! **************************************************************************************************
174!> \brief Section to set-up parameters for decoupling using the Bloechl scheme
175!> \param section the section to create
176!> \author teo
177! **************************************************************************************************
178 SUBROUTINE create_multipole_section(section)
179 TYPE(section_type), POINTER :: section
180
181 TYPE(keyword_type), POINTER :: keyword
182 TYPE(section_type), POINTER :: subsection
183
184 cpassert(.NOT. ASSOCIATED(section))
185
186 CALL section_create(section, __location__, name="MULTIPOLE", &
187 description="This section is used to set up the decoupling of QM periodic images with "// &
188 "the use of density derived atomic point charges.", &
189 n_keywords=1, n_subsections=0, repeats=.false.)
190
191 NULLIFY (keyword, subsection)
192 CALL keyword_create(keyword, __location__, name="RCUT", &
193 description="Real space cutoff for the Ewald sum.", &
194 usage="RCUT {real}", n_var=1, type_of_var=real_t, &
195 unit_str="angstrom")
196 CALL section_add_keyword(section, keyword)
197 CALL keyword_release(keyword)
198
199 CALL keyword_create(keyword, __location__, name="EWALD_PRECISION", &
200 description="Precision achieved in the Ewald sum.", &
201 usage="EWALD_PRECISION {real}", n_var=1, type_of_var=real_t, &
202 unit_str="hartree", default_r_val=1.0e-6_dp)
203 CALL section_add_keyword(section, keyword)
204 CALL keyword_release(keyword)
205
206 CALL keyword_create(keyword, __location__, name="ANALYTICAL_GTERM", &
207 description="Evaluates the Gterm in the Ewald Scheme analytically instead of using Splines.", &
208 usage="ANALYTICAL_GTERM <LOGICAL>", &
209 default_l_val=.false., lone_keyword_l_val=.true.)
210 CALL section_add_keyword(section, keyword)
211 CALL keyword_release(keyword)
212
213 CALL keyword_create(keyword, __location__, name="NGRIDS", &
214 description="Specifies the number of grid points used for the Interpolation of the G-space term", &
215 usage="NGRIDS <integer> <integer> <integer> ", n_var=3, default_i_vals=[50, 50, 50])
216 CALL section_add_keyword(section, keyword)
217 CALL keyword_release(keyword)
218
219 CALL create_gspace_interp_section(subsection)
220 CALL section_add_subsection(section, subsection)
221 CALL section_release(subsection)
222
223 CALL cp_print_key_section_create(subsection, __location__, "check_spline", &
224 description="Controls the checking of the G-space term Spline Interpolation.", &
225 print_level=medium_print_level, filename="GSpace-SplInterp")
226 CALL section_add_subsection(section, subsection)
227 CALL section_release(subsection)
228
229 CALL cp_print_key_section_create(subsection, __location__, "program_run_info", &
230 description="Controls the printing of basic information during the run", &
231 print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
232 CALL section_add_subsection(section, subsection)
233 CALL section_release(subsection)
234
235 END SUBROUTINE create_multipole_section
236
237! **************************************************************************************************
238!> \brief Creates the Martyna-Tuckerman section
239!> \param section the section to create
240!> \author teo
241! **************************************************************************************************
242 SUBROUTINE create_mt_section(section)
243 TYPE(section_type), POINTER :: section
244
245 TYPE(keyword_type), POINTER :: keyword
246
247 cpassert(.NOT. ASSOCIATED(section))
248 CALL section_create(section, __location__, name="mt", &
249 description="Sets up parameters of Martyna-Tuckerman poisson solver. "// &
250 "Note that exact results are only guaranteed if the unit cell is "// &
251 "twice as large as charge density (and serious artefacts can result "// &
252 "if the cell is much smaller).", &
253 n_keywords=1, n_subsections=0, repeats=.false., &
254 citations=[martyna1999])
255
256 NULLIFY (keyword)
257
258 CALL keyword_create(keyword, __location__, name="ALPHA", &
259 description="Convergence parameter ALPHA*RMIN. Default value 7.0", &
260 usage="ALPHA real", &
261 n_var=1, default_r_val=7.0_dp)
262 CALL section_add_keyword(section, keyword)
263 CALL keyword_release(keyword)
264
265 CALL keyword_create(keyword, __location__, name="REL_CUTOFF", &
266 description="Specify the multiplicative factor for the CUTOFF keyword in MULTI_GRID"// &
267 " section. The result gives the cutoff at which the 1/r non-periodic FFT3D is evaluated."// &
268 " Default is 2.0", &
269 usage="REL_CUTOFF real", &
270 n_var=1, default_r_val=2.0_dp)
271 CALL section_add_keyword(section, keyword)
272 CALL keyword_release(keyword)
273
274 END SUBROUTINE create_mt_section
275
276! **************************************************************************************************
277!> \brief ...
278!> \param section will contain the ewald section
279!> \author fawzi
280! **************************************************************************************************
281 SUBROUTINE create_ewald_section(section)
282 TYPE(section_type), POINTER :: section
283
284 TYPE(keyword_type), POINTER :: keyword
285 TYPE(section_type), POINTER :: print_key, subsection
286
287 cpassert(.NOT. ASSOCIATED(section))
288 CALL section_create(section, __location__, name="ewald", &
289 description="Ewald parameters controlling electrostatic only for CLASSICAL MM.", &
290 n_keywords=7, n_subsections=0, repeats=.false., &
292
293 NULLIFY (keyword, print_key, subsection)
294 CALL keyword_create( &
295 keyword, __location__, name="EWALD_TYPE", &
296 description="The type of ewald you want to perform.", &
297 citations=[ewald1921, essmann1995, darden1993], &
298 usage="EWALD_TYPE (NONE|EWALD|PME|SPME)", &
299 default_i_val=do_ewald_ewald, &
300 enum_c_vals=["none ", &
301 "ewald ", &
302 "pme ", &
303 "spme "], &
304 enum_i_vals=[do_ewald_none, &
306 do_ewald_pme, &
307 do_ewald_spme], &
308 enum_desc=s2a("NONE standard real-space coulomb potential is computed together with the non-bonded contributions", &
309 "EWALD is the standard non-fft based ewald", &
310 "PME is the particle mesh using fft interpolation", &
311 "SPME is the smooth particle mesh using beta-Euler splines (recommended)"))
312 CALL section_add_keyword(section, keyword)
313 CALL keyword_release(keyword)
314
315 CALL keyword_create(keyword, __location__, name="EWALD_ACCURACY", &
316 description="Expected accuracy in the Ewald sum. This number affects only the calculation of "// &
317 "the cutoff for the real-space term of the ewald summation (EWALD|PME|SPME) as well as the "// &
318 "construction of the neighbor lists (if the cutoff for non-bonded terms is smaller than the "// &
319 "value employed to compute the EWALD real-space term). This keyword has no "// &
320 "effect on the reciprocal space term (which can be tuned independently).", &
321 usage="EWALD_ACCURACY {real}", n_var=1, type_of_var=real_t, &
322 unit_str="hartree", default_r_val=1.0e-6_dp)
323 CALL section_add_keyword(section, keyword)
324 CALL keyword_release(keyword)
325
326 CALL keyword_create(keyword, __location__, name="RCUT", &
327 description="Explicitly provide the real-space cutoff of the ewald summation (EWALD|PME|SPME). "// &
328 "This value is ignored in Tight-binding applications (rcut from basis overlap is used). "// &
329 "If present, overwrites the estimate of EWALD_ACCURACY and may affect the "// &
330 "construction of the neighbor lists for non-bonded terms (in FIST), if the value "// &
331 "specified is larger than the cutoff for non-bonded interactions.", &
332 usage="RCUT 5.0", n_var=1, type_of_var=real_t, unit_str="angstrom")
333 CALL section_add_keyword(section, keyword)
334 CALL keyword_release(keyword)
335
336 CALL keyword_create(keyword, __location__, name="alpha", &
337 description="alpha parameter associated with Ewald (EWALD|PME|SPME). "// &
338 "Recommended for small systems is alpha = 3.5 / r_cut. "// &
339 "For Tight-binding application a recommended value is alpha = 1.0. "// &
340 "Tuning alpha, r_cut and gmax is needed to obtain O(N**1.5) scaling for ewald.", &
341 usage="alpha .30", &
342 default_r_val=cp_unit_to_cp2k(value=0.35_dp, unit_str="angstrom^-1"), &
343 unit_str='angstrom^-1')
344 CALL section_add_keyword(section, keyword)
345 CALL keyword_release(keyword)
346
347 CALL keyword_create(keyword, __location__, name="gmax", &
348 description="number of grid points (SPME and EWALD). If a single number is specified, "// &
349 "the same number of points is used for all three directions on the grid. "// &
350 "If three numbers are given, each direction can have a different number of points. "// &
351 "The number of points needs to be FFTable (which depends on the library used) and odd for EWALD. "// &
352 "The optimal number depends e.g. on alpha and the size of the cell. 1 point per Angstrom is common.", &
353 usage="gmax 25 25 25", n_var=-1, type_of_var=integer_t)
354 CALL section_add_keyword(section, keyword)
355 CALL keyword_release(keyword)
356
357 CALL keyword_create(keyword, __location__, name="ns_max", &
358 description="number of grid points on small mesh (PME only), should be odd.", &
359 usage="ns_max 11", default_i_val=11)
360 CALL section_add_keyword(section, keyword)
361 CALL keyword_release(keyword)
362
363 CALL keyword_create(keyword, __location__, name="o_spline", &
364 description="order of the beta-Euler spline (SPME only)", &
365 usage="o_spline 6", default_i_val=6)
366 CALL section_add_keyword(section, keyword)
367 CALL keyword_release(keyword)
368
369 CALL keyword_create(keyword, __location__, name="epsilon", &
370 description="tolerance of gaussians for fft interpolation (PME only)", &
371 usage="epsilon 1e-6", default_r_val=1.e-6_dp)
372 CALL section_add_keyword(section, keyword)
373 CALL keyword_release(keyword)
374
375 NULLIFY (subsection)
376 CALL create_rsgrid_section(subsection)
377 CALL section_add_subsection(section, subsection)
378 CALL section_release(subsection)
379
380 NULLIFY (subsection)
381 CALL section_create(subsection, __location__, name="MULTIPOLES", &
382 description="Enables the use of multipoles in the treatment of the electrostatics.", &
383 n_keywords=0, n_subsections=1, repeats=.false., &
384 citations=[aguado2003, laino2008])
385
386 CALL keyword_create(keyword, __location__, name="_SECTION_PARAMETERS_", &
387 description="Controls the activation of the Multipoles", &
388 usage="&MULTIPOLES T", default_l_val=.false., lone_keyword_l_val=.true.)
389 CALL section_add_keyword(subsection, keyword)
390 CALL keyword_release(keyword)
391
392 CALL keyword_create(keyword, __location__, name="MAX_MULTIPOLE_EXPANSION", &
393 description="Specify the maximum level of multipoles expansion used "// &
394 "for the electrostatics.", &
395 usage="MAX_MULTIPOLE_EXPANSION DIPOLE", &
396 enum_c_vals=s2a("NONE", "CHARGE", "DIPOLE", "QUADRUPOLE"), &
397 enum_desc=s2a("No multipolar terms! Check the codes providing a zero contribution.", &
398 "Use up to the Charge term", &
399 "Use up to the Dipole term", &
400 "Use up to the Quadrupole term"), &
402 do_multipole_quadrupole], type_of_var=enum_t)
403 CALL section_add_keyword(subsection, keyword)
404 CALL keyword_release(keyword)
405
406 CALL keyword_create(keyword, __location__, name="POL_SCF", &
407 description="Specify the method to obtain self consistent induced "// &
408 "multipole moments.", &
409 usage="POL_SCF CONJUGATE_GRADIENT", &
410 enum_c_vals=s2a("NONE", "SELF_CONSISTENT", "CONJUGATE_GRADIENT"), &
411 enum_desc=s2a("No inducible multipoles.", &
412 "Conventional self-consistent iteration.", &
413 "Linear conjugate-gradient optimization of the sum "// &
414 "of the electrostatic and induction energy. This "// &
415 "method does not support non-linear polarization "// &
416 "but is sometimes faster."), &
418 type_of_var=enum_t, default_i_val=do_fist_pol_none)
419 CALL section_add_keyword(subsection, keyword)
420 CALL keyword_release(keyword)
421
422 CALL keyword_create(keyword, __location__, name="MAX_IPOL_ITER", &
423 description="Specify the maximum number of iterations for induced "// &
424 "dipoles", &
425 usage="MAX_IPOL_ITER {int}", type_of_var=integer_t, &
426 n_var=1, default_i_val=0)
427 CALL section_add_keyword(subsection, keyword)
428 CALL keyword_release(keyword)
429
430 CALL keyword_create(keyword, __location__, name="EPS_POL", &
431 description="Specify the rmsd threshold for the derivatives "// &
432 "of the energy towards the Cartesian dipoles components", &
433 usage="EPS_POL {real}", type_of_var=real_t, &
434 n_var=1, default_r_val=0.5e-07_dp)
435 CALL section_add_keyword(subsection, keyword)
436 CALL keyword_release(keyword)
437
438 CALL section_add_subsection(section, subsection)
439 CALL section_release(subsection)
440
441 NULLIFY (subsection)
442 CALL section_create(subsection, __location__, name="PRINT", &
443 description="Controls printing of Ewald properties", &
444 n_keywords=0, n_subsections=1, repeats=.false.)
445 NULLIFY (print_key)
446 CALL cp_print_key_section_create(print_key, __location__, "PROGRAM_RUN_INFO", &
447 description="controls the printing of ewald setup", &
448 print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
449 CALL section_add_subsection(subsection, print_key)
450 CALL section_release(print_key)
451 CALL section_add_subsection(section, subsection)
452 CALL section_release(subsection)
453
454 END SUBROUTINE create_ewald_section
455
456! **************************************************************************************************
457!> \brief creates the interpolation section for the periodic QM/MM
458!> \param section ...
459!> \author tlaino
460! **************************************************************************************************
462 TYPE(section_type), POINTER :: section
463
464 TYPE(keyword_type), POINTER :: keyword
465 TYPE(section_type), POINTER :: print_key
466
467 cpassert(.NOT. ASSOCIATED(section))
468 CALL section_create(section, __location__, name="interpolator", &
469 description="controls the interpolation for the G-space term", &
470 n_keywords=5, n_subsections=0, repeats=.false.)
471
472 NULLIFY (keyword, print_key)
473
474 CALL keyword_create(keyword, __location__, name="aint_precond", &
475 description="the approximate inverse to use to get the starting point"// &
476 " for the linear solver of the spline3 methods", &
477 usage="aint_precond copy", &
478 default_i_val=precond_spl3_aint, &
479 enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_precond1", &
480 "spl3_nopbc_aint2", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
483 CALL section_add_keyword(section, keyword)
484 CALL keyword_release(keyword)
485
486 CALL keyword_create(keyword, __location__, name="precond", &
487 description="The preconditioner used"// &
488 " for the linear solver of the spline3 methods", &
489 usage="precond copy", &
490 default_i_val=precond_spl3_3, &
491 enum_c_vals=s2a("copy", "spl3_nopbc_aint1", "spl3_nopbc_precond1", &
492 "spl3_nopbc_aint2", "spl3_nopbc_precond2", "spl3_nopbc_precond3"), &
495 CALL section_add_keyword(section, keyword)
496 CALL keyword_release(keyword)
497
498 CALL keyword_create(keyword, __location__, name="eps_x", &
499 description="accuracy on the solution for spline3 the interpolators", &
500 usage="eps_x 1.e-15", default_r_val=1.e-10_dp)
501 CALL section_add_keyword(section, keyword)
502 CALL keyword_release(keyword)
503
504 CALL keyword_create(keyword, __location__, name="eps_r", &
505 description="accuracy on the residual for spline3 the interpolators", &
506 usage="eps_r 1.e-15", default_r_val=1.e-10_dp)
507 CALL section_add_keyword(section, keyword)
508 CALL keyword_release(keyword)
509
510 CALL keyword_create(keyword, __location__, name="max_iter", &
511 variants=['maxiter'], &
512 description="the maximum number of iterations", &
513 usage="max_iter 200", default_i_val=100)
514 CALL section_add_keyword(section, keyword)
515 CALL keyword_release(keyword)
516
517 NULLIFY (print_key)
518 CALL cp_print_key_section_create(print_key, __location__, "conv_info", &
519 description="if convergence information about the linear solver"// &
520 " of the spline methods should be printed", &
521 print_level=medium_print_level, each_iter_names=s2a("SPLINE_FIND_COEFFS"), &
522 each_iter_values=[10], filename="__STD_OUT__", &
523 add_last=add_last_numeric)
524 CALL section_add_subsection(section, print_key)
525 CALL section_release(print_key)
526
527 END SUBROUTINE create_gspace_interp_section
528
529! **************************************************************************************************
530!> \brief Creates the wavelet section
531!> \param section the section to create
532!> \author fschiff
533!> \note
534!> this approach is based on the development of T. Deutsch and S. Goedecker
535! **************************************************************************************************
536 SUBROUTINE create_wavelet_section(section)
537 TYPE(section_type), POINTER :: section
538
539 TYPE(keyword_type), POINTER :: keyword
540
541 cpassert(.NOT. ASSOCIATED(section))
542 CALL section_create( &
543 section, __location__, name="wavelet", &
544 description="Sets up parameters of wavelet based poisson solver.", &
545 n_keywords=1, n_subsections=0, repeats=.false., &
546 citations=[genovese2006, genovese2007])
547
548 NULLIFY (keyword)
549
550 CALL keyword_create( &
551 keyword, __location__, name="SCF_TYPE", &
552 description="Type of scaling function used in the wavelet approach, the total energy depends on this choice, "// &
553 "and the convergence with respect to cutoff depends on the selected scaling functions. "// &
554 "Possible values are 8,14,16,20,24,30,40,50,60,100", &
555 usage="SCF_TYPE integer", &
556 n_var=1, default_i_val=40)
557 CALL section_add_keyword(section, keyword)
558 CALL keyword_release(keyword)
559
560 END SUBROUTINE create_wavelet_section
561
562! **************************************************************************************************
563!> \brief Creates the section for the implicit (generalized) poisson solver
564!> \param section the section to be created
565!> \author Mohammad Hossein Bani-Hashemian
566! **************************************************************************************************
567 SUBROUTINE create_implicit_ps_section(section)
568 TYPE(section_type), POINTER :: section
569
570 TYPE(keyword_type), POINTER :: keyword
571 TYPE(section_type), POINTER :: subsection
572
573 cpassert(.NOT. ASSOCIATED(section))
574 CALL section_create(section, __location__, name="IMPLICIT", &
575 description="Parameters for the implicit (generalized) Poisson solver.", &
576 citations=[banihashemian2016], &
577 n_keywords=6, n_subsections=2, repeats=.false.)
578
579 NULLIFY (subsection, keyword)
580
581 CALL create_dielectric_section(subsection)
582 CALL section_add_subsection(section, subsection)
583 CALL section_release(subsection)
584
585 CALL create_dbc_section(subsection)
586 CALL section_add_subsection(section, subsection)
587 CALL section_release(subsection)
588
589 CALL keyword_create( &
590 keyword, __location__, name="BOUNDARY_CONDITIONS", &
591 enum_c_vals=s2a('PERIODIC', 'MIXED', 'MIXED_PERIODIC', 'NEUMANN'), &
592 enum_desc=s2a('periodic boundary conditions', 'Dirichlet + homogeneous Neumann boundary conditions', &
593 'Dirichlet + periodic boundary conditions', 'homogeneous Neumann BC (zero-average solution)'), &
595 description="Specifies the type of boundary conditions. Dirichlet=fixed value, Neumann=zero normal deriv. "// &
596 "Mixed and Neumann boundaries essentially requires FFTW3 so that all grid sizes are FFT-able.", &
597 usage="BOUNDARY_CONDITIONS <bc_type>", default_i_val=periodic_bc)
598 CALL section_add_keyword(section, keyword)
599 CALL keyword_release(keyword)
600
601 CALL keyword_create(keyword, __location__, name="ZERO_INITIAL_GUESS", &
602 description="Whether or not to use zero potential as initial guess.", &
603 usage="ZERO_INITIAL_GUESS <logical>", default_l_val=.false., lone_keyword_l_val=.true.)
604 CALL section_add_keyword(section, keyword)
605 CALL keyword_release(keyword)
606
607 CALL keyword_create(keyword, __location__, name="max_iter", &
608 description="Maximum number of iterations.", &
609 usage="max_iter <integer>", default_i_val=30)
610 CALL section_add_keyword(section, keyword)
611 CALL keyword_release(keyword)
612
613 CALL keyword_create(keyword, __location__, name="tol", &
614 description="Stopping tolerance.", &
615 usage="tol <real>", default_r_val=1.0e-8_dp)
616 CALL section_add_keyword(section, keyword)
617 CALL keyword_release(keyword)
618
619 CALL keyword_create(keyword, __location__, name="OR_PARAMETER", variants=s2a('omega'), &
620 description="Over-relaxation parameter (large epsilon requires smaller omega ~0.1).", &
621 usage="OR_PARAMETER <real>", default_r_val=1.0_dp)
622 CALL section_add_keyword(section, keyword)
623 CALL keyword_release(keyword)
624
625 CALL keyword_create( &
626 keyword, __location__, name="NEUMANN_DIRECTIONS", &
627 enum_c_vals=s2a('XYZ', 'XY', 'XZ', 'YZ', 'X', 'Y', 'Z'), &
629 description="Directions in which homogeneous Neumann conditions are imposed. In the remaining directions "// &
630 "periodic conditions will be enforced. Having specified MIXED or NEUMANN as BOUNDARY_CONDITIONS, "// &
631 "the keyword is meant to be used to combine periodic and homogeneous Neumann conditions at the "// &
632 "boundaries of the simulation cell.", &
633 usage="NEUMANN_DIRECTIONS <direction>", default_i_val=neumannxyz)
634 CALL section_add_keyword(section, keyword)
635 CALL keyword_release(keyword)
636
637 END SUBROUTINE create_implicit_ps_section
638
639! **************************************************************************************************
640!> \brief Creates the dielectric constant section.
641!> The dielectric constant is defined as a function of electronic density.
642!> [see O. Andreussi, I. Dabo, and N. Marzari, J. Chem. Phys., 136, 064102(2012)]
643!> \param section the section to be created
644!> \author Mohammad Hossein Bani-Hashemian
645! **************************************************************************************************
646 SUBROUTINE create_dielectric_section(section)
647 TYPE(section_type), POINTER :: section
648
649 TYPE(keyword_type), POINTER :: keyword
650 TYPE(section_type), POINTER :: subsection
651
652 cpassert(.NOT. ASSOCIATED(section))
653 CALL section_create(section, __location__, name="DIELECTRIC", &
654 description="Parameters for the dielectric constant function.", &
655 n_keywords=6, n_subsections=2, repeats=.false.)
656
657 NULLIFY (keyword, subsection)
658
659 CALL keyword_create(keyword, __location__, name="DIELECTRIC_CORE_CORRECTION", &
660 description="Avoid spurious values of the dielectric constant at the ionic core for pseudopotentials "// &
661 "where the electron density goes to zero at the core (e.g. GTH). "// &
662 "The correction is based on rho_core.", &
663 usage="DIELECTRIC_CORE_CORRECTION <logical>", default_l_val=.true., lone_keyword_l_val=.true.)
664 CALL section_add_keyword(section, keyword)
665 CALL keyword_release(keyword)
666
667 CALL keyword_create( &
668 keyword, __location__, name="DIELECTRIC_FUNCTION_TYPE", &
669 enum_c_vals=s2a('density_dependent', 'spatially_dependent', 'spatially_rho_dependent'), &
671 enum_desc=s2a("Dielectric constant as a function of the electron density "// &
672 "as e.g. proposed within the SCCS model.", &
673 "Various regions with different dielectric constants.", &
674 "Various regions with different dielectric constants. The dielectric constant decays to 1.0, "// &
675 "wherever the electron density is present."), &
676 description="Preferred type for the dielectric constant function.", &
677 usage="DIELECTRIC_FUNCTION_TYPE <method>", default_i_val=rho_dependent)
678 CALL section_add_keyword(section, keyword)
679 CALL keyword_release(keyword)
680
681 CALL keyword_create(keyword, __location__, name="dielectric_constant", variants=s2a('epsilon'), &
682 description="Dielectric constant in the bulk of the solvent.", &
683 usage="dielectric_constant <real>", default_r_val=80.0_dp)
684 CALL section_add_keyword(section, keyword)
685 CALL keyword_release(keyword)
686
687 CALL keyword_create(keyword, __location__, name="rho_min", &
688 description="Lower density threshold.", &
689 usage="rho_min <real>", default_r_val=1.0e-4_dp)
690 CALL section_add_keyword(section, keyword)
691 CALL keyword_release(keyword)
692
693 CALL keyword_create(keyword, __location__, name="rho_max", &
694 description="Upper density threshold.", &
695 usage="rho_max <real>", default_r_val=1.0e-3_dp)
696 CALL section_add_keyword(section, keyword)
697 CALL keyword_release(keyword)
698
699 CALL keyword_create( &
700 keyword, __location__, name="DERIVATIVE_METHOD", &
701 enum_c_vals=s2a('fft', 'fft_use_deps', 'fft_use_drho', 'cd3', 'cd5', 'cd7'), &
704 enum_desc=s2a("FFT based deriv of epsilon, without correction (high cutoff needed).", &
705 "FFT based deriv of epsilon, with correction using gradient of epsilon (high cutoff needed).", &
706 "FFT based deriv of epsilon, with correction using gradient of rho (high cutoff needed).", &
707 "3-point central difference derivative.", &
708 "5-point central difference derivative.", &
709 "7-point central difference derivative (recommended)."), &
710 description="Preferred method for evaluating the gradient of ln(eps).", &
711 usage="DERIVATIVE_METHOD <method>", default_i_val=derivative_cd7)
712 CALL section_add_keyword(section, keyword)
713 CALL keyword_release(keyword)
714
715 CALL create_dielec_aa_cuboidal_section(subsection)
716 CALL section_add_subsection(section, subsection)
717 CALL section_release(subsection)
718
719 CALL create_dielec_xaa_annular_section(subsection)
720 CALL section_add_subsection(section, subsection)
721 CALL section_release(subsection)
722
723 END SUBROUTINE create_dielectric_section
724
725! **************************************************************************************************
726!> \brief Creates the section for creating axis-aligned cuboidal dielectric region.
727!> \param section the section to be created
728!> \author Mohammad Hossein Bani-Hashemian
729! **************************************************************************************************
730 SUBROUTINE create_dielec_aa_cuboidal_section(section)
731 TYPE(section_type), POINTER :: section
732
733 TYPE(keyword_type), POINTER :: keyword
734
735 cpassert(.NOT. ASSOCIATED(section))
736 CALL section_create(section, __location__, name="DIELEC_AA_CUBOIDAL", &
737 description="Parameters for creating axis-aligned cuboidal dielectric region. "// &
738 "Note that once such a region is defined, the 'background' dielectric constant "// &
739 "would be the default (80.0), unless a different value is specified using the "// &
740 "keyword IMPLICIT%DIELECTRIC%DIELECTRIC_CONSTANT.", &
741 n_keywords=5, n_subsections=0, repeats=.true.)
742
743 NULLIFY (keyword)
744
745 CALL keyword_create(keyword, __location__, name="dielectric_constant", variants=s2a('epsilon'), &
746 description="value of the dielectric constant inside the region.", &
747 usage="dielectric_constant <real>", default_r_val=80.0_dp)
748 CALL section_add_keyword(section, keyword)
749 CALL keyword_release(keyword)
750
751 CALL keyword_create(keyword, __location__, name="X_xtnt", &
752 description="The X extents of the cuboid.", &
753 usage="X_xtnt <xmin(real)> <xmax(real)>", unit_str="angstrom", &
754 n_var=2, type_of_var=real_t)
755 CALL section_add_keyword(section, keyword)
756 CALL keyword_release(keyword)
757
758 CALL keyword_create(keyword, __location__, name="Y_xtnt", &
759 description="The Y extents of the cuboid.", &
760 usage="Y_xtnt <ymin(real)> <ymax(real)>", unit_str="angstrom", &
761 n_var=2, type_of_var=real_t)
762 CALL section_add_keyword(section, keyword)
763 CALL keyword_release(keyword)
764
765 CALL keyword_create(keyword, __location__, name="Z_xtnt", &
766 description="The Z extents of the cuboid.", &
767 usage="Z_xtnt <zmin(real)> <zmax(real)>", unit_str="angstrom", &
768 n_var=2, type_of_var=real_t)
769 CALL section_add_keyword(section, keyword)
770 CALL keyword_release(keyword)
771
772 CALL keyword_create(keyword, __location__, name="SMOOTHING_WIDTH", variants=s2a('zeta'), &
773 description="The width of the standard mollifier.", &
774 usage="SMOOTHING_WIDTH <real>", unit_str="angstrom", &
775 default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
776 CALL section_add_keyword(section, keyword)
777 CALL keyword_release(keyword)
778
779 END SUBROUTINE create_dielec_aa_cuboidal_section
780
781! **************************************************************************************************
782!> \brief Creates the section for creating x-axis-aligned annular dielectric region.
783!> \param section the section to be created
784!> \author Mohammad Hossein Bani-Hashemian
785! **************************************************************************************************
786 SUBROUTINE create_dielec_xaa_annular_section(section)
787 TYPE(section_type), POINTER :: section
788
789 TYPE(keyword_type), POINTER :: keyword
790
791 cpassert(.NOT. ASSOCIATED(section))
792 CALL section_create(section, __location__, name="DIELEC_XAA_ANNULAR", &
793 description="Parameters for creating x-axis-aligned annular dielectric region. "// &
794 "Note that once such a region is defined, the 'background' dielectric constant "// &
795 "would be the default (80.0), unless a different value is specified using the "// &
796 "keyword IMPLICIT%DIELECTRIC%DIELECTRIC_CONSTANT.", &
797 n_keywords=5, n_subsections=0, repeats=.true.)
798
799 NULLIFY (keyword)
800
801 CALL keyword_create(keyword, __location__, name="dielectric_constant", variants=s2a('epsilon'), &
802 description="value of the dielectric constant inside the region.", &
803 usage="dielectric_constant <real>", default_r_val=80.0_dp)
804 CALL section_add_keyword(section, keyword)
805 CALL keyword_release(keyword)
806
807 CALL keyword_create(keyword, __location__, name="X_xtnt", &
808 description="The X extents of the annulus.", &
809 usage="X_xtnt <xmin(real)> <xmax(real)>", unit_str="angstrom", &
810 n_var=2, type_of_var=real_t)
811 CALL section_add_keyword(section, keyword)
812 CALL keyword_release(keyword)
813
814 CALL keyword_create(keyword, __location__, name="base_center", &
815 description="The y and z coordinates of the annulus' base center.", &
816 usage="base_center <y(real)> <z(real)>", unit_str="angstrom", &
817 n_var=2, type_of_var=real_t)
818 CALL section_add_keyword(section, keyword)
819 CALL keyword_release(keyword)
820
821 CALL keyword_create(keyword, __location__, name="base_radii", &
822 description="The base radius of the annulus.", &
823 usage="base_radii <r1(real)> <r2(real)>", unit_str="angstrom", &
824 n_var=2, type_of_var=real_t)
825 CALL section_add_keyword(section, keyword)
826 CALL keyword_release(keyword)
827
828 CALL keyword_create(keyword, __location__, name="smoothing_width", variants=s2a('zeta'), &
829 description="The width of the standard mollifier.", &
830 usage="smoothing_width <real>", unit_str="angstrom", &
831 default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
832 CALL section_add_keyword(section, keyword)
833 CALL keyword_release(keyword)
834
835 END SUBROUTINE create_dielec_xaa_annular_section
836
837! **************************************************************************************************
838!> \brief Creates the section for Dirichlet boundary conditions
839!> \param section the section to be created
840!> \author Mohammad Hossein Bani-Hashemian
841! **************************************************************************************************
842 SUBROUTINE create_dbc_section(section)
843 TYPE(section_type), POINTER :: section
844
845 TYPE(keyword_type), POINTER :: keyword
846 TYPE(section_type), POINTER :: subsection
847
848 cpassert(.NOT. ASSOCIATED(section))
849 CALL section_create(section, __location__, name="DIRICHLET_BC", &
850 description="Parameters for creating Dirichlet type boundary conditions.", &
851 n_keywords=1, n_subsections=4, repeats=.false.)
852
853 NULLIFY (keyword)
854
855 CALL keyword_create(keyword, __location__, name="VERBOSE_OUTPUT", &
856 description="Print out the coordinates of the vertices defining Dirichlet regions and their "// &
857 "tessellations (in Angstrom), the values of the electrostatic potential at the regions (in a.u.), "// &
858 "and their corresponding evaluated Lagrange multipliers.", &
859 usage="VERBOSE_OUTPUT <logical>", default_l_val=.false., lone_keyword_l_val=.true.)
860 CALL section_add_keyword(section, keyword)
861 CALL keyword_release(keyword)
862
863 NULLIFY (subsection)
864
865 CALL create_aa_planar_section(subsection)
866 CALL section_add_subsection(section, subsection)
867 CALL section_release(subsection)
868
869 CALL create_planar_section(subsection)
870 CALL section_add_subsection(section, subsection)
871 CALL section_release(subsection)
872
873 CALL create_aa_cylindrical_section(subsection)
874 CALL section_add_subsection(section, subsection)
875 CALL section_release(subsection)
876
877 CALL create_aa_cuboidal_section(subsection)
878 CALL section_add_subsection(section, subsection)
879 CALL section_release(subsection)
880
881 END SUBROUTINE create_dbc_section
882
883! **************************************************************************************************
884!> \brief Creates the section for creating axis-aligned planar Dirichlet BC.
885!> \param section the section to be created
886!> \author Mohammad Hossein Bani-Hashemian
887! **************************************************************************************************
888 SUBROUTINE create_aa_planar_section(section)
889 TYPE(section_type), POINTER :: section
890
891 TYPE(keyword_type), POINTER :: keyword
892
893 cpassert(.NOT. ASSOCIATED(section))
894 CALL section_create(section, __location__, name="AA_PLANAR", &
895 description="Parameters for creating axis-aligned planar (rectangular) Dirichlet boundary regions.", &
896 n_keywords=10, n_subsections=0, repeats=.true.)
897
898 NULLIFY (keyword)
899
900 CALL keyword_create(keyword, __location__, name="v_D", &
901 description="The value of the fixed potential to be imposed at the axis-aligned Dirichlet boundary.", &
902 usage="v_D <real>", unit_str="volt", type_of_var=real_t)
903 CALL section_add_keyword(section, keyword)
904 CALL keyword_release(keyword)
905
906 CALL keyword_create(keyword, __location__, name="OSCILLATING_FRACTION", &
907 description="A fraction of the field can be set to oscilate over time.", &
908 usage="OSCILLATING_FRACTION <real>", default_r_val=0.0_dp, type_of_var=real_t)
909 CALL section_add_keyword(section, keyword)
910 CALL keyword_release(keyword)
911
912 CALL keyword_create(keyword, __location__, name="FREQUENCY", &
913 description="The frequency with which the oscillating fraction oscillates.", &
914 usage="FREQUENCY <real>", default_r_val=0.0_dp, unit_str="s^-1", type_of_var=real_t)
915 CALL section_add_keyword(section, keyword)
916 CALL keyword_release(keyword)
917
918 CALL keyword_create(keyword, __location__, name="PHASE", &
919 description="The phase of the oscillattion. A phase of zero corresponds to a cosine function. ", &
920 usage="PHASE <real>", default_r_val=0.0_dp, type_of_var=real_t)
921 CALL section_add_keyword(section, keyword)
922 CALL keyword_release(keyword)
923
924 CALL keyword_create(keyword, __location__, name="PARALLEL_PLANE", &
925 enum_c_vals=s2a('XY', 'YZ', 'XZ'), &
926 enum_i_vals=[xy_plane, yz_plane, xz_plane], &
927 description="The coordinate plane that the region is parallel to.", &
928 usage="PARALLEL_PLANE <plane>", &
929 type_of_var=enum_t)
930 CALL section_add_keyword(section, keyword)
931 CALL keyword_release(keyword)
932
933 CALL keyword_create(keyword, __location__, name="INTERCEPT", &
934 description="The intercept of the rectangle's plane.", &
935 usage="INTERCEPT <real>", unit_str="angstrom", &
936 type_of_var=real_t)
937 CALL section_add_keyword(section, keyword)
938 CALL keyword_release(keyword)
939
940 CALL keyword_create(keyword, __location__, name="X_xtnt", &
941 description="The X extents of the rectangle.", &
942 usage="X_xtnt <xmin(real)> <xmax(real)>", unit_str="angstrom", &
943 n_var=2, type_of_var=real_t)
944 CALL section_add_keyword(section, keyword)
945 CALL keyword_release(keyword)
946
947 CALL keyword_create(keyword, __location__, name="Y_xtnt", &
948 description="The Y extents of the rectangle.", &
949 usage="Y_xtnt <ymin(real)> <ymax(real)>", unit_str="angstrom", &
950 n_var=2, type_of_var=real_t)
951 CALL section_add_keyword(section, keyword)
952 CALL keyword_release(keyword)
953
954 CALL keyword_create(keyword, __location__, name="Z_xtnt", &
955 description="The Z extents of the rectangle.", &
956 usage="Z_xtnt <zmin(real)> <zmax(real)>", unit_str="angstrom", &
957 n_var=2, type_of_var=real_t)
958 CALL section_add_keyword(section, keyword)
959 CALL keyword_release(keyword)
960
961 CALL keyword_create(keyword, __location__, name="N_PRTN", &
962 description="The number of partitions in the directions of the unit vectors generating the "// &
963 "corresponding PARALLEL_PLANE (e1, e2 or e3) for tiling the rectangluar region.", &
964 usage="N_PRTN <integer> <integer>", &
965 n_var=2, default_i_vals=[1, 1])
966 CALL section_add_keyword(section, keyword)
967 CALL keyword_release(keyword)
968
969 CALL keyword_create(keyword, __location__, name="THICKNESS", &
970 description="The thickness of the planar Dirichlet region.", &
971 usage="THICKNESS <real>", unit_str="angstrom", &
972 default_r_val=cp_unit_to_cp2k(value=0.75_dp, unit_str="angstrom"))
973 CALL section_add_keyword(section, keyword)
974 CALL keyword_release(keyword)
975
976 CALL keyword_create(keyword, __location__, name="SMOOTHING_WIDTH", variants=s2a('SIGMA'), &
977 description="The width of the transition region between the Dirichlet subdomain and its surrounding.", &
978 usage="SMOOTHING_WIDTH <real>", unit_str="angstrom", &
979 default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
980 CALL section_add_keyword(section, keyword)
981 CALL keyword_release(keyword)
982
983 CALL keyword_create(keyword, __location__, name="PERIODIC_REGION", &
984 description="Whether or not to take into consideration the effects of the periodicity of the "// &
985 "simulation cell (MIXED_PERIODIC bc) for regions defined sufficiently close to the boundaries.", &
986 usage="PERIODIC_REGION <logical>", default_l_val=.false., lone_keyword_l_val=.true.)
987 CALL section_add_keyword(section, keyword)
988 CALL keyword_release(keyword)
989
990 END SUBROUTINE create_aa_planar_section
991
992! **************************************************************************************************
993!> \brief Creates the section for creating axis-aligned planar Dirichlet BC.
994!> \param section the section to be created
995!> \author Mohammad Hossein Bani-Hashemian
996! **************************************************************************************************
997 SUBROUTINE create_planar_section(section)
998 TYPE(section_type), POINTER :: section
999
1000 TYPE(keyword_type), POINTER :: keyword
1001
1002 cpassert(.NOT. ASSOCIATED(section))
1003 CALL section_create( &
1004 section, __location__, name="PLANAR", &
1005 description="Parameters for creating planar (rectangular) Dirichlet boundary regions with given vertices.", &
1006 n_keywords=7, n_subsections=0, repeats=.true.)
1007
1008 NULLIFY (keyword)
1009
1010 CALL keyword_create(keyword, __location__, name="v_D", &
1011 description="The value of the fixed potential to be imposed at the planar Dirichlet boundary.", &
1012 usage="v_D <real>", unit_str="volt", type_of_var=real_t)
1013 CALL section_add_keyword(section, keyword)
1014 CALL keyword_release(keyword)
1015
1016 CALL keyword_create(keyword, __location__, name="OSCILLATING_FRACTION", &
1017 description="A fraction of the field can be set to oscilate over time.", &
1018 usage="OSCILLATING_FRACTION <real>", default_r_val=0.0_dp, type_of_var=real_t)
1019 CALL section_add_keyword(section, keyword)
1020 CALL keyword_release(keyword)
1021
1022 CALL keyword_create(keyword, __location__, name="FREQUENCY", &
1023 description="The frequency with which the oscillating fraction oscillates.", &
1024 usage="FREQUENCY <real>", default_r_val=0.0_dp, unit_str="s^-1", type_of_var=real_t)
1025 CALL section_add_keyword(section, keyword)
1026 CALL keyword_release(keyword)
1027
1028 CALL keyword_create(keyword, __location__, name="PHASE", &
1029 description="The phase of the oscillattion. A phase of zero corresponds to a cosine function. ", &
1030 usage="PHASE <real>", default_r_val=0.0_dp, type_of_var=real_t)
1031 CALL section_add_keyword(section, keyword)
1032 CALL keyword_release(keyword)
1033
1034 CALL keyword_create(keyword, __location__, name="A", &
1035 description="Coordinates of the vertex A.", &
1036 usage="A <x(real)> <y(real)> <z(real)>", unit_str="angstrom", &
1037 n_var=3, type_of_var=real_t)
1038 CALL section_add_keyword(section, keyword)
1039 CALL keyword_release(keyword)
1040
1041 CALL keyword_create(keyword, __location__, name="B", &
1042 description="Coordinates of the vertex B.", &
1043 usage="B <x(real)> <y(real)> <z(real)>", unit_str="angstrom", &
1044 n_var=3, type_of_var=real_t)
1045 CALL section_add_keyword(section, keyword)
1046 CALL keyword_release(keyword)
1047
1048 CALL keyword_create(keyword, __location__, name="C", &
1049 description="Coordinates of the vertex C.", &
1050 usage="C <x(real)> <y(real)> <z(real)>", unit_str="angstrom", &
1051 n_var=3, type_of_var=real_t)
1052 CALL section_add_keyword(section, keyword)
1053 CALL keyword_release(keyword)
1054
1055 CALL keyword_create( &
1056 keyword, __location__, name="N_PRTN", &
1057 description="The number of partitions along the edges for tiling the rectangular region. If the edges "// &
1058 "have different lengths, from the two given values, the larger one will be assigned to the longer edge.", &
1059 usage="N_PRTN <integer> <integer>", &
1060 n_var=2, default_i_vals=[1, 1])
1061 CALL section_add_keyword(section, keyword)
1062 CALL keyword_release(keyword)
1063
1064 CALL keyword_create(keyword, __location__, name="THICKNESS", &
1065 description="The thickness of the planar Dirichlet region.", &
1066 usage="THICKNESS <real>", unit_str="angstrom", &
1067 default_r_val=cp_unit_to_cp2k(value=0.75_dp, unit_str="angstrom"))
1068 CALL section_add_keyword(section, keyword)
1069 CALL keyword_release(keyword)
1070
1071 CALL keyword_create(keyword, __location__, name="SMOOTHING_WIDTH", variants=s2a('SIGMA'), &
1072 description="The width of the transition region between the Dirichlet subdomain and its surrounding.", &
1073 usage="SMOOTHING_WIDTH <real>", unit_str="angstrom", &
1074 default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
1075 CALL section_add_keyword(section, keyword)
1076 CALL keyword_release(keyword)
1077
1078 END SUBROUTINE create_planar_section
1079
1080! **************************************************************************************************
1081!> \brief Creates the section for creating x-axis-aligned cylindrical Dirichlet BC.
1082!> \param section the section to be created
1083!> \author Mohammad Hossein Bani-Hashemian
1084! **************************************************************************************************
1085 SUBROUTINE create_aa_cylindrical_section(section)
1086 TYPE(section_type), POINTER :: section
1087
1088 TYPE(keyword_type), POINTER :: keyword
1089
1090 cpassert(.NOT. ASSOCIATED(section))
1091 CALL section_create(section, __location__, name="AA_CYLINDRICAL", &
1092 description="Parameters for creating axis-aligned cylindrical Dirichlet boundary regions.", &
1093 n_keywords=11, n_subsections=0, repeats=.true.)
1094
1095 NULLIFY (keyword)
1096
1097 CALL keyword_create(keyword, __location__, name="v_D", &
1098 description="The value of the fixed potential to be imposed at the cylindrical Dirichlet boundary.", &
1099 usage="v_D <real>", unit_str="volt", type_of_var=real_t)
1100 CALL section_add_keyword(section, keyword)
1101 CALL keyword_release(keyword)
1102
1103 CALL keyword_create(keyword, __location__, name="OSCILLATING_FRACTION", &
1104 description="A fraction of the field can be set to oscilate over time.", &
1105 usage="OSCILLATING_FRACTION <real>", default_r_val=0.0_dp, type_of_var=real_t)
1106 CALL section_add_keyword(section, keyword)
1107 CALL keyword_release(keyword)
1108
1109 CALL keyword_create(keyword, __location__, name="FREQUENCY", &
1110 description="The frequency with which the oscillating fraction oscillates.", &
1111 usage="FREQUENCY <real>", default_r_val=0.0_dp, unit_str="s^-1", type_of_var=real_t)
1112 CALL section_add_keyword(section, keyword)
1113 CALL keyword_release(keyword)
1114
1115 CALL keyword_create(keyword, __location__, name="PHASE", &
1116 description="The phase of the oscillattion. A phase of zero corresponds to a cosine function. ", &
1117 usage="PHASE <real>", default_r_val=0.0_dp, type_of_var=real_t)
1118 CALL section_add_keyword(section, keyword)
1119 CALL keyword_release(keyword)
1120
1121 CALL keyword_create(keyword, __location__, name="PARALLEL_AXIS", &
1122 enum_c_vals=s2a('X', 'Y', 'Z'), &
1123 enum_i_vals=[x_axis, y_axis, z_axis], &
1124 description="The coordinate axis that the cylindrical region extends along.", &
1125 usage="PARALLEL_AXIS <axis>", &
1126 type_of_var=enum_t)
1127 CALL section_add_keyword(section, keyword)
1128 CALL keyword_release(keyword)
1129
1130 CALL keyword_create(keyword, __location__, name="xtnt", &
1131 description="The extents of the cylinder along its central axis.", &
1132 usage="xtnt <xmin(real)> <xmax(real)>", unit_str="angstrom", &
1133 n_var=2, type_of_var=real_t)
1134 CALL section_add_keyword(section, keyword)
1135 CALL keyword_release(keyword)
1136
1137 CALL keyword_create(keyword, __location__, name="BASE_CENTER", &
1138 description="The y and z coordinates (x and z or x and y coordinates, "// &
1139 "depending on the choice of the parallel axis) of the cylinder's base center.", &
1140 usage="BASE_CENTER <y(real)> <z(real)>", unit_str="angstrom", &
1141 n_var=2, type_of_var=real_t)
1142 CALL section_add_keyword(section, keyword)
1143 CALL keyword_release(keyword)
1144
1145 CALL keyword_create(keyword, __location__, name="BASE_RADIUS", &
1146 description="The base radius of the cylinder.", &
1147 usage="BASE_RADIUS <real>", unit_str="angstrom", &
1148 default_r_val=cp_unit_to_cp2k(value=1.0_dp, unit_str="angstrom"))
1149 CALL section_add_keyword(section, keyword)
1150 CALL keyword_release(keyword)
1151
1152 CALL keyword_create(keyword, __location__, name="N_SIDES", &
1153 description="The number of sides (faces) of the n-gonal prism approximating the cylinder.", &
1154 usage="N_SIDES <integer>", default_i_val=5)
1155 CALL section_add_keyword(section, keyword)
1156 CALL keyword_release(keyword)
1157
1158 CALL keyword_create(keyword, __location__, name="APX_TYPE", &
1159 enum_c_vals=s2a('CIRCUMSCRIBED', 'INSCRIBED'), &
1160 enum_i_vals=[circumscribed, inscribed], &
1161 description="Specifies the type of the n-gonal prism approximating the cylinder.", &
1162 usage="APX_TYPE <apx_type>", default_i_val=circumscribed)
1163 CALL section_add_keyword(section, keyword)
1164 CALL keyword_release(keyword)
1165
1166 CALL keyword_create( &
1167 keyword, __location__, name="N_PRTN", &
1168 description="The number of partitions along the face edges of the prism for tiling. If the edges "// &
1169 "have different lengths, from the two given values, the larger one will be assigned to the longer edge.", &
1170 usage="N_PRTN <integer> <integer>", &
1171 n_var=2, default_i_vals=[1, 1])
1172 CALL section_add_keyword(section, keyword)
1173 CALL keyword_release(keyword)
1174
1175 CALL keyword_create(keyword, __location__, name="THICKNESS", &
1176 description="The thickness of the cylinder.", &
1177 usage="THICKNESS <real>", unit_str="angstrom", &
1178 default_r_val=cp_unit_to_cp2k(value=0.75_dp, unit_str="angstrom"))
1179 CALL section_add_keyword(section, keyword)
1180 CALL keyword_release(keyword)
1181
1182 CALL keyword_create(keyword, __location__, name="SMOOTHING_WIDTH", variants=s2a('SIGMA'), &
1183 description="The width of the transition region between the Dirichlet subdomain and its surrounding.", &
1184 usage="SMOOTHING_WIDTH <real>", unit_str="angstrom", &
1185 default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
1186 CALL section_add_keyword(section, keyword)
1187 CALL keyword_release(keyword)
1188
1189 CALL keyword_create( &
1190 keyword, __location__, name="delta_alpha", &
1191 description="A central angle specifying the gap between the faces of the n-gonal prism. To avoide overlap "// &
1192 "between the cuboids (of the given thickness) built on top of the faces, a larger value is required if the"// &
1193 " number of faces (N_SIDES) is quite few and/or the base radius is fairly small.", &
1194 usage="delta_alpha <real>", default_r_val=0.05_dp, unit_str="rad")
1195 CALL section_add_keyword(section, keyword)
1196 CALL keyword_release(keyword)
1197
1198 END SUBROUTINE create_aa_cylindrical_section
1199
1200! **************************************************************************************************
1201!> \brief Creates the section for creating axis-aligned cuboidal Dirichlet region.
1202!> \param section the section to be created
1203!> \author Mohammad Hossein Bani-Hashemian
1204! **************************************************************************************************
1205 SUBROUTINE create_aa_cuboidal_section(section)
1206 TYPE(section_type), POINTER :: section
1207
1208 TYPE(keyword_type), POINTER :: keyword
1209
1210 cpassert(.NOT. ASSOCIATED(section))
1211 CALL section_create(section, __location__, name="AA_CUBOIDAL", &
1212 description="Parameters for creating axis-aligned cuboidal Dirichlet regions.", &
1213 n_keywords=7, n_subsections=0, repeats=.true.)
1214
1215 NULLIFY (keyword)
1216
1217 CALL keyword_create(keyword, __location__, name="v_D", &
1218 description="The value of the fixed potential to be imposed at the region.", &
1219 usage="v_D <real>", unit_str="volt", type_of_var=real_t)
1220 CALL section_add_keyword(section, keyword)
1221 CALL keyword_release(keyword)
1222
1223 CALL keyword_create(keyword, __location__, name="OSCILLATING_FRACTION", &
1224 description="A fraction of the field can be set to oscilate over time.", &
1225 usage="OSCILLATING_FRACTION <real>", default_r_val=0.0_dp, type_of_var=real_t)
1226 CALL section_add_keyword(section, keyword)
1227 CALL keyword_release(keyword)
1228
1229 CALL keyword_create(keyword, __location__, name="FREQUENCY", &
1230 description="The frequency with which the oscillating fraction oscillates.", &
1231 usage="FREQUENCY <real>", default_r_val=0.0_dp, unit_str="s^-1", type_of_var=real_t)
1232 CALL section_add_keyword(section, keyword)
1233 CALL keyword_release(keyword)
1234
1235 CALL keyword_create(keyword, __location__, name="PHASE", &
1236 description="The phase of the oscillattion. A phase of zero corresponds to a cosine function. ", &
1237 usage="PHASE <real>", default_r_val=0.0_dp, type_of_var=real_t)
1238 CALL section_add_keyword(section, keyword)
1239 CALL keyword_release(keyword)
1240
1241 CALL keyword_create(keyword, __location__, name="X_xtnt", &
1242 description="The X extents of the cuboid.", &
1243 usage="X_xtnt <xmin(real)> <xmax(real)>", unit_str="angstrom", &
1244 n_var=2, type_of_var=real_t)
1245 CALL section_add_keyword(section, keyword)
1246 CALL keyword_release(keyword)
1247
1248 CALL keyword_create(keyword, __location__, name="Y_xtnt", &
1249 description="The Y extents of the cuboid.", &
1250 usage="Y_xtnt <ymin(real)> <ymax(real)>", unit_str="angstrom", &
1251 n_var=2, type_of_var=real_t)
1252 CALL section_add_keyword(section, keyword)
1253 CALL keyword_release(keyword)
1254
1255 CALL keyword_create(keyword, __location__, name="Z_xtnt", &
1256 description="The Z extents of the cuboid.", &
1257 usage="Z_xtnt <zmin(real)> <zmax(real)>", unit_str="angstrom", &
1258 n_var=2, type_of_var=real_t)
1259 CALL section_add_keyword(section, keyword)
1260 CALL keyword_release(keyword)
1261
1262 CALL keyword_create(keyword, __location__, name="N_PRTN", &
1263 description="The number of partitions in the x, y and z directions for partitioning the cuboid.", &
1264 usage="N_PRTN <integer> <integer> <integer>", &
1265 n_var=3, default_i_vals=[1, 1, 1])
1266 CALL section_add_keyword(section, keyword)
1267 CALL keyword_release(keyword)
1268
1269 CALL keyword_create(keyword, __location__, name="SMOOTHING_WIDTH", variants=s2a('SIGMA'), &
1270 description="The width of the transition region between the Dirichlet subdomain and its surrounding.", &
1271 usage="SMOOTHING_WIDTH <real>", unit_str="angstrom", &
1272 default_r_val=cp_unit_to_cp2k(value=0.2_dp, unit_str="angstrom"))
1273 CALL section_add_keyword(section, keyword)
1274 CALL keyword_release(keyword)
1275
1276 CALL keyword_create(keyword, __location__, name="PERIODIC_REGION", &
1277 description="Whether or not to take into consideration the effects of the periodicity of the "// &
1278 "simulation cell (MIXED_PERIODIC bc) for regions defined sufficiently close to the boundaries.", &
1279 usage="PERIODIC_REGION <logical>", default_l_val=.false., lone_keyword_l_val=.true.)
1280 CALL section_add_keyword(section, keyword)
1281 CALL keyword_release(keyword)
1282
1283 END SUBROUTINE create_aa_cuboidal_section
1284
1285END MODULE input_cp2k_poisson
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public blochl1995
integer, save, public toukmaji1996
integer, save, public aguado2003
integer, save, public genovese2006
integer, save, public laino2008
integer, save, public genovese2007
integer, save, public essmann1995
integer, save, public darden1993
integer, save, public ewald1921
integer, save, public martyna1999
integer, save, public banihashemian2016
Handles all functions related to the CELL.
Definition cell_types.F:15
integer, parameter, public use_perd_xyz
Definition cell_types.F:42
integer, parameter, public use_perd_y
Definition cell_types.F:42
integer, parameter, public use_perd_xz
Definition cell_types.F:42
integer, parameter, public use_perd_x
Definition cell_types.F:42
integer, parameter, public use_perd_z
Definition cell_types.F:42
integer, parameter, public use_perd_yz
Definition cell_types.F:42
integer, parameter, public use_perd_none
Definition cell_types.F:42
integer, parameter, public use_perd_xy
Definition cell_types.F:42
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public low_print_level
integer, parameter, public medium_print_level
integer, parameter, public add_last_numeric
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)
creates a print_key section
unit conversion facility
Definition cp_units.F:30
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Definition cp_units.F:1149
the type I Discrete Cosine Transform (DCT-I)
Definition dct.F:16
integer, parameter, public neumannx
Definition dct.F:63
integer, parameter, public neumannxy
Definition dct.F:63
integer, parameter, public neumannxz
Definition dct.F:63
integer, parameter, public neumannxyz
Definition dct.F:63
integer, parameter, public neumannz
Definition dct.F:63
integer, parameter, public neumannyz
Definition dct.F:63
integer, parameter, public neumanny
Definition dct.F:63
dielectric constant data type
integer, parameter, public derivative_fft_use_drho
integer, parameter, public derivative_fft_use_deps
integer, parameter, public derivative_fft
integer, parameter, public derivative_cd5
integer, parameter, public spatially_rho_dependent
integer, parameter, public derivative_cd3
integer, parameter, public spatially_dependent
integer, parameter, public rho_dependent
integer, parameter, public derivative_cd7
Dirichlet boundary condition data types.
integer, parameter, public z_axis
integer, parameter, public inscribed
integer, parameter, public y_axis
integer, parameter, public circumscribed
integer, parameter, public x_axis
integer, parameter, public xz_plane
integer, parameter, public yz_plane
integer, parameter, public xy_plane
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_fist_pol_cg
integer, parameter, public do_fist_pol_none
integer, parameter, public do_fist_pol_sc
function that build the poisson section of the input
subroutine, public create_poisson_section(section)
Creates the Poisson section.
subroutine, public create_gspace_interp_section(section)
creates the interpolation section for the periodic QM/MM
subroutine, public create_ewald_section(section)
...
subroutine, public create_rsgrid_section(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
subroutine, public section_add_subsection(section, subsection)
adds a subsection to the given section
recursive subroutine, public section_release(section)
releases the given keyword list (see doc/ReferenceCounting.html)
a wrapper for basic fortran types.
integer, parameter, public real_t
integer, parameter, public integer_t
integer, parameter, public enum_t
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Multipole structure: for multipole (fixed and induced) in FF based MD.
integer, parameter, public do_multipole_quadrupole
integer, parameter, public do_multipole_dipole
integer, parameter, public do_multipole_charge
integer, parameter, public do_multipole_none
Types containing essential information for running implicit (iterative) Poisson solver.
integer, parameter, public neumann_bc
integer, parameter, public mixed_bc
integer, parameter, public mixed_periodic_bc
integer, parameter, public periodic_bc
functions related to the poisson solver on regular grids
integer, parameter, public pw_poisson_wavelet
integer, parameter, public pw_poisson_periodic
integer, parameter, public pw_poisson_mt
integer, parameter, public do_ewald_pme
integer, parameter, public do_ewald_ewald
integer, parameter, public pw_poisson_implicit
integer, parameter, public do_ewald_none
integer, parameter, public pw_poisson_analytic
integer, parameter, public do_ewald_spme
integer, parameter, public pw_poisson_multipole
different utils that are useful to manipulate splines on the regular grid of a pw
integer, parameter, public precond_spl3_3
integer, parameter, public precond_spl3_aint
integer, parameter, public no_precond
integer, parameter, public precond_spl3_2
integer, parameter, public precond_spl3_aint2
integer, parameter, public precond_spl3_1
Utilities for string manipulations.
represent a keyword in the input
represent a section of the input file