1!--------------------------------------------------------------------------------------------------!
2!   CP2K: A general program to perform molecular dynamics simulations                              !
3!   Copyright (C) 2000 - 2020  CP2K developers group                                               !
4!--------------------------------------------------------------------------------------------------!
5
6! **************************************************************************************************
7!> \brief builds the subsystem section of the input
8!> \par History
9!>      10.2005 split input_cp2k [fawzi]
10!> \author teo & fawzi
11! **************************************************************************************************
12MODULE input_cp2k_subsys
13   USE bibliography,                    ONLY: Goedecker1996,&
14                                              Guidon2010,&
15                                              Hartwigsen1998,&
16                                              Krack2005,&
17                                              VandeVondele2005a,&
18                                              VandeVondele2007
19   USE cell_types,                      ONLY: &
20        cell_sym_cubic, cell_sym_hexagonal, cell_sym_monoclinic, cell_sym_monoclinic_gamma_ab, &
21        cell_sym_none, cell_sym_orthorhombic, cell_sym_rhombohedral, cell_sym_tetragonal_ab, &
22        cell_sym_tetragonal_ac, cell_sym_tetragonal_bc, cell_sym_triclinic, use_perd_none, &
23        use_perd_x, use_perd_xy, use_perd_xyz, use_perd_xz, use_perd_y, use_perd_yz, use_perd_z
24   USE cp_output_handling,              ONLY: cp_print_key_section_create,&
25                                              debug_print_level,&
26                                              high_print_level,&
27                                              medium_print_level
28   USE cp_units,                        ONLY: cp_unit_to_cp2k
29   USE input_constants,                 ONLY: &
30        do_add, do_bondparm_covalent, do_bondparm_vdw, do_cell_cif, do_cell_cp2k, do_cell_xsc, &
31        do_conn_amb7, do_conn_g87, do_conn_g96, do_conn_generate, do_conn_mol_set, do_conn_off, &
32        do_conn_psf, do_conn_psf_u, do_conn_user, do_coord_cif, do_coord_cp2k, do_coord_crd, &
33        do_coord_g96, do_coord_off, do_coord_pdb, do_coord_xtl, do_coord_xyz, do_remove, &
34        do_skip_11, do_skip_12, do_skip_13, do_skip_14, dump_pdb, gaussian
35   USE input_cp2k_colvar,               ONLY: create_colvar_section
36   USE input_cp2k_mm,                   ONLY: create_neighbor_lists_section
37   USE input_keyword_types,             ONLY: keyword_create,&
38                                              keyword_release,&
39                                              keyword_type
40   USE input_section_types,             ONLY: section_add_keyword,&
41                                              section_add_subsection,&
42                                              section_create,&
43                                              section_release,&
44                                              section_type
45   USE input_val_types,                 ONLY: char_t,&
46                                              integer_t,&
47                                              lchar_t,&
48                                              real_t
49   USE kinds,                           ONLY: dp
50   USE physcon,                         ONLY: bohr
51   USE string_utilities,                ONLY: newline,&
52                                              s2a
53#include "./base/base_uses.f90"
54
55   IMPLICIT NONE
56   PRIVATE
57
58   LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
59   CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_subsys'
60
61   PUBLIC :: create_subsys_section, &
62             create_cell_section, &
63             create_structure_data_section, &
64             create_rng_section, &
65             create_basis_section
66!***
67CONTAINS
68
69! **************************************************************************************************
70!> \brief creates the cell section
71!> \param section ...
72!> \param periodic ...
73!> \author Ole Schuett
74! **************************************************************************************************
75   SUBROUTINE create_cell_section(section, periodic)
76      TYPE(section_type), POINTER                        :: section
77      INTEGER, INTENT(IN), OPTIONAL                      :: periodic
78
79      TYPE(section_type), POINTER                        :: subsection
80
81      CPASSERT(.NOT. ASSOCIATED(section))
82      CALL section_create(section, __LOCATION__, "CELL", &
83                          description="Input parameters needed to set up the simulation cell.")
84      CALL create_cell_section_low(section, periodic)
85
86      NULLIFY (subsection)
87      CALL section_create(subsection, __LOCATION__, "CELL_REF", &
88                          description="Input parameters needed to set up the reference cell. "// &
89                          "This option can be used to keep the FFT grid fixed while "// &
90                          "running a cell optimization or NpT molecular dynamics.")
91      CALL create_cell_section_low(subsection, periodic)
92      CALL section_add_subsection(section, subsection)
93      CALL section_release(subsection)
94
95   END SUBROUTINE create_cell_section
96
97! **************************************************************************************************
98!> \brief populates cell section with keywords
99!> \param section ...
100!> \param periodic ...
101!> \author teo
102! **************************************************************************************************
103   SUBROUTINE create_cell_section_low(section, periodic)
104      TYPE(section_type), POINTER                        :: section
105      INTEGER, INTENT(IN), OPTIONAL                      :: periodic
106
107      INTEGER                                            :: my_periodic
108      TYPE(keyword_type), POINTER                        :: keyword
109
110      my_periodic = use_perd_xyz
111      IF (PRESENT(periodic)) my_periodic = periodic
112
113      NULLIFY (keyword)
114      CALL keyword_create(keyword, __LOCATION__, name="A", &
115                          description="Specify the Cartesian components for the cell vector A. "// &
116                          "This defines the first column of the h matrix.", &
117                          usage="A  10.000  0.000  0.000", unit_str="angstrom", &
118                          n_var=3, type_of_var=real_t, repeats=.FALSE.)
119      CALL section_add_keyword(section, keyword)
120      CALL keyword_release(keyword)
121
122      CALL keyword_create(keyword, __LOCATION__, name="B", &
123                          description="Specify the Cartesian components for the cell vector B. "// &
124                          "This defines the second column of the h matrix.", &
125                          usage="B   0.000 10.000  0.000", unit_str="angstrom", &
126                          n_var=3, type_of_var=real_t, repeats=.FALSE.)
127      CALL section_add_keyword(section, keyword)
128      CALL keyword_release(keyword)
129
130      CALL keyword_create(keyword, __LOCATION__, name="C", &
131                          description="Specify the Cartesian components for the cell vector C. "// &
132                          "This defines the third column of the h matrix.", &
133                          usage="C   0.000  0.000 10.000", unit_str="angstrom", &
134                          n_var=3, type_of_var=real_t, repeats=.FALSE.)
135      CALL section_add_keyword(section, keyword)
136      CALL keyword_release(keyword)
137
138      CALL keyword_create(keyword, __LOCATION__, name="ABC", &
139                          description="Specify the lengths of the cell vectors A, B, and C, which"// &
140                          " defines the diagonal elements of h matrix for an orthorhombic cell."// &
141                          " For non-orthorhombic cells it is possible either to specify the angles "// &
142                          "ALPHA, BETA, GAMMA via ALPHA_BETA_GAMMA keyword or alternatively use the keywords "// &
143                          "A, B, and C. The convention is that A lies along the X-axis, B is in the XY plane.", &
144                          usage="ABC 10.000 10.000 10.000", unit_str="angstrom", &
145                          n_var=3, type_of_var=real_t, repeats=.FALSE.)
146      CALL section_add_keyword(section, keyword)
147      CALL keyword_release(keyword)
148
149      CALL keyword_create(keyword, __LOCATION__, name="ALPHA_BETA_GAMMA", &
150                          variants=(/"ANGLES"/), &
151                          description="Specify the angles between the vectors A, B and C when using the ABC keyword. "// &
152                          "The convention is that A lies along the X-axis, B is in the XY plane. "// &
153                          "ALPHA is the angle between B and C, BETA is the angle between A and C and "// &
154                          "GAMMA the angle between A and B.", &
155                          usage="ALPHA_BETA_GAMMA [deg] 90.0 90.0 120.0", unit_str="deg", &
156                          n_var=3, default_r_vals=(/cp_unit_to_cp2k(value=90.0_dp, unit_str="deg"), &
157                                                    cp_unit_to_cp2k(value=90.0_dp, unit_str="deg"), &
158                                                    cp_unit_to_cp2k(value=90.0_dp, unit_str="deg")/), &
159                          repeats=.FALSE.)
160      CALL section_add_keyword(section, keyword)
161      CALL keyword_release(keyword)
162
163      CALL keyword_create(keyword, __LOCATION__, name="CELL_FILE_NAME", &
164                          description="Possibility to read the cell from an external file ", &
165                          repeats=.FALSE., usage="CELL_FILE_NAME <CHARACTER>", &
166                          type_of_var=lchar_t)
167      CALL section_add_keyword(section, keyword)
168      CALL keyword_release(keyword)
169
170      CALL keyword_create(keyword, __LOCATION__, name="CELL_FILE_FORMAT", &
171                          description="Specify the format of the cell file (if used)", &
172                          usage="CELL_FILE_FORMAT (CP2K|CIF|XSC)", &
173                          enum_c_vals=s2a("CP2K", "CIF", "XSC"), &
174                          enum_i_vals=(/do_cell_cp2k, do_cell_cif, do_cell_xsc/), &
175                          enum_desc=s2a("Cell info in the CP2K native format.", &
176                                        "Cell info from CIF file.", &
177                                        "Cell info in the XSC format (NAMD)"), &
178                          default_i_val=do_cell_cp2k)
179      CALL section_add_keyword(section, keyword)
180      CALL keyword_release(keyword)
181
182      CALL keyword_create(keyword, __LOCATION__, name="PERIODIC", &
183                          description="Specify the directions for which periodic boundary conditions (PBC) will be applied. "// &
184                          "Important notice: This applies to the generation of the pair lists as well as to the "// &
185                          "application of the PBCs to positions. "// &
186                          "See the POISSON section to specify the periodicity used for the electrostatics. "// &
187                          "Typically the settings should be the same.", &
188                          usage="PERIODIC (x|y|z|xy|xz|yz|xyz|none)", &
189                          enum_c_vals=s2a("x", "y", "z", "xy", "xz", "yz", "xyz", "none"), &
190                          enum_i_vals=(/use_perd_x, use_perd_y, use_perd_z, &
191                                        use_perd_xy, use_perd_xz, use_perd_yz, &
192                                        use_perd_xyz, use_perd_none/), &
193                          default_i_val=my_periodic)
194      CALL section_add_keyword(section, keyword)
195      CALL keyword_release(keyword)
196
197      CALL keyword_create(keyword, __LOCATION__, name="MULTIPLE_UNIT_CELL", &
198                          description="Specifies the numbers of repetition in space (X, Y, Z) of the defined cell, "// &
199                          "assuming it as a unit cell. This keyword affects only the CELL specification. The same keyword "// &
200                          "in SUBSYS%TOPOLOGY%MULTIPLE_UNIT_CELL should be modified in order to affect the coordinates "// &
201                          "specification.", usage="MULTIPLE_UNIT_CELL 1 1 1", &
202                          n_var=3, default_i_vals=(/1, 1, 1/), repeats=.FALSE.)
203      CALL section_add_keyword(section, keyword)
204      CALL keyword_release(keyword)
205
206      CALL keyword_create( &
207         keyword, __LOCATION__, name="SYMMETRY", &
208         description="Imposes an initial cell symmetry.", &
209         usage="SYMMETRY monoclinic", &
210         enum_desc=s2a("No cell symmetry", &
211                       "Triclinic (a &ne; b &ne; c &ne; a, &alpha; &ne; &beta; &ne; &gamma; &ne; &alpha; &ne; 90&deg;)", &
212                       "Monoclinic (a &ne; b &ne; c &ne; a, &alpha; = &gamma; = 90&deg;, &beta; &ne; 90&deg;)", &
213                       "Monoclinic (a = b &ne; c, &alpha; = &beta; = 90&deg;, &gamma; &ne; 90&deg;)", &
214                       "Orthorhombic (a &ne; b &ne; c, &alpha; = &beta; = &gamma; = 90&deg;)", &
215                       "Tetragonal (a = b &ne; c, &alpha; = &beta; = &gamma; = 90&deg;)", &
216                       "Tetragonal (a = c &ne; b, &alpha; = &beta; = &gamma; = 90&deg;)", &
217                       "Tetragonal (a &ne; b = c, &alpha; = &beta; = &gamma; = 90&deg;)", &
218                       "Tetragonal (alias for TETRAGONAL_AB)", &
219                       "Rhombohedral (a = b = c, &alpha; = &beta; = &gamma; &ne; 90&deg;)", &
220                       "Hexagonal (a = b &ne; c, &alpha; = &beta; = 90&deg;, &gamma; = 60&deg;)", &
221                       "Cubic (a = b = c, &alpha; = &beta; = &gamma; = 90&deg;)"), &
222         enum_c_vals=s2a("NONE", "TRICLINIC", "MONOCLINIC", "MONOCLINIC_GAMMA_AB", "ORTHORHOMBIC", &
223                         "TETRAGONAL_AB", "TETRAGONAL_AC", "TETRAGONAL_BC", "TETRAGONAL", "RHOMBOHEDRAL", &
224                         "HEXAGONAL", "CUBIC"), &
225         enum_i_vals=(/cell_sym_none, cell_sym_triclinic, cell_sym_monoclinic, cell_sym_monoclinic_gamma_ab, &
226                       cell_sym_orthorhombic, cell_sym_tetragonal_ab, cell_sym_tetragonal_ac, cell_sym_tetragonal_bc, &
227                       cell_sym_tetragonal_ab, cell_sym_rhombohedral, cell_sym_hexagonal, cell_sym_cubic/), &
228         default_i_val=cell_sym_none)
229      CALL section_add_keyword(section, keyword)
230      CALL keyword_release(keyword)
231
232   END SUBROUTINE create_cell_section_low
233
234! **************************************************************************************************
235!> \brief Creates the random number restart section
236!> \param section the section to create
237!> \author teo
238! **************************************************************************************************
239   SUBROUTINE create_rng_section(section)
240      TYPE(section_type), POINTER                        :: section
241
242      CHARACTER(len=*), PARAMETER :: routineN = 'create_rng_section', &
243         routineP = moduleN//':'//routineN
244
245      TYPE(keyword_type), POINTER                        :: keyword
246
247      CPASSERT(.NOT. ASSOCIATED(section))
248      CALL section_create(section, __LOCATION__, name="RNG_INIT", &
249                          description="Information to initialize the parallel random number generator streams", &
250                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
251      NULLIFY (keyword)
252
253      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
254                          description="Specify an initial RNG stream record", repeats=.TRUE., &
255                          usage="{RNG record string}", type_of_var=lchar_t)
256      CALL section_add_keyword(section, keyword)
257      CALL keyword_release(keyword)
258
259   END SUBROUTINE create_rng_section
260
261! **************************************************************************************************
262!> \brief creates the structure of a subsys, i.e. a full set of
263!>      atoms+mol+bounds+cell
264!> \param section the section to create
265!> \author fawzi
266! **************************************************************************************************
267   SUBROUTINE create_subsys_section(section)
268      TYPE(section_type), POINTER                        :: section
269
270      CHARACTER(len=*), PARAMETER :: routineN = 'create_subsys_section', &
271         routineP = moduleN//':'//routineN
272
273      TYPE(keyword_type), POINTER                        :: keyword
274      TYPE(section_type), POINTER                        :: subsection
275
276      CPASSERT(.NOT. ASSOCIATED(section))
277      CALL section_create(section, __LOCATION__, name="subsys", &
278                          description="a subsystem: coordinates, topology, molecules and cell", &
279                          n_keywords=1, n_subsections=9, repeats=.FALSE.)
280
281      NULLIFY (keyword)
282      CALL keyword_create(keyword, __LOCATION__, name="SEED", &
283                          description="Initial seed for the (pseudo)random number generator for the "// &
284                          "Wiener process employed by the Langevin dynamics. Exactly 1 or 6 positive "// &
285                          "integer values are expected. A single value is replicated to fill up the "// &
286                          "full seed array with 6 numbers.", &
287                          n_var=-1, &
288                          type_of_var=integer_t, &
289                          usage="SEED {INTEGER} .. {INTEGER}", &
290                          default_i_vals=(/12345/))
291      CALL section_add_keyword(section, keyword)
292      CALL keyword_release(keyword)
293
294      NULLIFY (subsection)
295
296      CALL create_rng_section(subsection)
297      CALL section_add_subsection(section, subsection)
298      CALL section_release(subsection)
299
300      CALL create_cell_section(subsection)
301      CALL section_add_subsection(section, subsection)
302      CALL section_release(subsection)
303
304      CALL create_coord_section(subsection)
305      CALL section_add_subsection(section, subsection)
306      CALL section_release(subsection)
307
308      CALL create_velocity_section(subsection)
309      CALL section_add_subsection(section, subsection)
310      CALL section_release(subsection)
311
312      CALL create_kind_section(subsection)
313      CALL section_add_subsection(section, subsection)
314      CALL section_release(subsection)
315
316      CALL create_topology_section(subsection)
317      CALL section_add_subsection(section, subsection)
318      CALL section_release(subsection)
319
320      CALL create_colvar_section(section=subsection)
321      CALL section_add_subsection(section, subsection)
322      CALL section_release(subsection)
323
324      CALL create_multipole_section(subsection)
325      CALL section_add_subsection(section, subsection)
326      CALL section_release(subsection)
327
328      CALL create_shell_coord_section(subsection)
329      CALL section_add_subsection(section, subsection)
330      CALL section_release(subsection)
331
332      CALL create_shell_vel_section(subsection)
333      CALL section_add_subsection(section, subsection)
334      CALL section_release(subsection)
335
336      CALL create_core_coord_section(subsection)
337      CALL section_add_subsection(section, subsection)
338      CALL section_release(subsection)
339
340      CALL create_core_vel_section(subsection)
341      CALL section_add_subsection(section, subsection)
342      CALL section_release(subsection)
343
344      CALL create_subsys_print_section(subsection)
345      CALL section_add_subsection(section, subsection)
346      CALL section_release(subsection)
347
348   END SUBROUTINE create_subsys_section
349
350! **************************************************************************************************
351!> \brief Creates the subsys print section
352!> \param section the section to create
353!> \author teo
354! **************************************************************************************************
355   SUBROUTINE create_subsys_print_section(section)
356      TYPE(section_type), POINTER                        :: section
357
358      CHARACTER(len=*), PARAMETER :: routineN = 'create_subsys_print_section', &
359         routineP = moduleN//':'//routineN
360
361      TYPE(keyword_type), POINTER                        :: keyword
362      TYPE(section_type), POINTER                        :: print_key
363
364      NULLIFY (print_key, keyword)
365      CPASSERT(.NOT. ASSOCIATED(section))
366      CALL section_create(section, __LOCATION__, name="print", &
367                          description="Controls printings related to the subsys", &
368                          n_keywords=0, n_subsections=9, repeats=.FALSE.)
369
370      CALL cp_print_key_section_create(print_key, __LOCATION__, "atomic_coordinates", &
371                                       description="controls the output of the atomic coordinates when setting up the"// &
372                                       "force environment. For printing coordinates during MD or GEO refer to the keyword"// &
373                                       " trajectory.", unit_str="angstrom", &
374                                       print_level=medium_print_level, filename="__STD_OUT__")
375      CALL section_add_subsection(section, print_key)
376      CALL section_release(print_key)
377
378      CALL create_structure_data_section(print_key)
379      CALL section_add_subsection(section, print_key)
380      CALL section_release(print_key)
381
382      CALL cp_print_key_section_create(print_key, __LOCATION__, "interatomic_distances", &
383                                       description="controls the output of the interatomic distances when setting up the"// &
384                                       "force environment", unit_str="angstrom", &
385                                       print_level=debug_print_level, filename="__STD_OUT__")
386      CALL section_add_subsection(section, print_key)
387      CALL section_release(print_key)
388
389      CALL cp_print_key_section_create(print_key, __LOCATION__, "topology_info", description= &
390                                       "controls the printing of information in the topology settings", &
391                                       print_level=high_print_level, filename="__STD_OUT__")
392      CALL keyword_create(keyword, __LOCATION__, name="xtl_info", &
393                          description="Prints information when parsing XTL files.", &
394                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
395      CALL section_add_keyword(print_key, keyword)
396      CALL keyword_release(keyword)
397      CALL keyword_create(keyword, __LOCATION__, name="cif_info", &
398                          description="Prints information when parsing CIF files.", &
399                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
400      CALL section_add_keyword(print_key, keyword)
401      CALL keyword_release(keyword)
402      CALL keyword_create(keyword, __LOCATION__, name="pdb_info", &
403                          description="Prints information when parsing PDB files.", &
404                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
405      CALL section_add_keyword(print_key, keyword)
406      CALL keyword_release(keyword)
407      CALL keyword_create(keyword, __LOCATION__, name="xyz_info", &
408                          description="Prints information when parsing XYZ files.", &
409                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
410      CALL section_add_keyword(print_key, keyword)
411      CALL keyword_release(keyword)
412      CALL keyword_create(keyword, __LOCATION__, name="psf_info", &
413                          description="Prints information when parsing PSF files.", &
414                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
415      CALL section_add_keyword(print_key, keyword)
416      CALL keyword_release(keyword)
417      CALL keyword_create(keyword, __LOCATION__, name="amber_info", &
418                          description="Prints information when parsing ABER topology files.", &
419                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
420      CALL section_add_keyword(print_key, keyword)
421      CALL keyword_release(keyword)
422      CALL keyword_create(keyword, __LOCATION__, name="g96_info", &
423                          description="Prints information when parsing G96 files.", &
424                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
425      CALL section_add_keyword(print_key, keyword)
426      CALL keyword_release(keyword)
427      CALL keyword_create(keyword, __LOCATION__, name="crd_info", &
428                          description="Prints information when parsing CRD files.", &
429                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
430      CALL section_add_keyword(print_key, keyword)
431      CALL keyword_release(keyword)
432      CALL keyword_create(keyword, __LOCATION__, name="gtop_info", &
433                          description="Prints information when parsing GROMOS topology files.", &
434                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
435      CALL section_add_keyword(print_key, keyword)
436      CALL keyword_release(keyword)
437      CALL keyword_create(keyword, __LOCATION__, name="util_info", &
438                          description="Prints information regarding topology utilities", &
439                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
440      CALL section_add_keyword(print_key, keyword)
441      CALL keyword_release(keyword)
442      CALL keyword_create(keyword, __LOCATION__, name="generate_info", &
443                          description="Prints information regarding topology generation", &
444                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
445      CALL section_add_keyword(print_key, keyword)
446      CALL keyword_release(keyword)
447      CALL section_add_subsection(section, print_key)
448      CALL section_release(print_key)
449
450      CALL cp_print_key_section_create(print_key, __LOCATION__, "cell", &
451                                       description="controls the output of the cell parameters", &
452                                       print_level=medium_print_level, filename="__STD_OUT__", &
453                                       unit_str="angstrom")
454      CALL section_add_subsection(section, print_key)
455      CALL section_release(print_key)
456
457      CALL cp_print_key_section_create(print_key, __LOCATION__, "kinds", &
458                                       description="controls the output of information on the kinds", &
459                                       print_level=medium_print_level, filename="__STD_OUT__")
460      CALL keyword_create(keyword, __LOCATION__, name="potential", &
461                          description="If the printkey is activated controls the printing of the"// &
462                          " fist_potential, gth_potential, sgp_potential or all electron"// &
463                          " potential information", &
464                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
465      CALL section_add_keyword(print_key, keyword)
466      CALL keyword_release(keyword)
467      CALL keyword_create(keyword, __LOCATION__, name="basis_set", &
468                          description="If the printkey is activated controls the printing of basis set information", &
469                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
470      CALL section_add_keyword(print_key, keyword)
471      CALL keyword_release(keyword)
472      CALL keyword_create(keyword, __LOCATION__, name="se_parameters", &
473                          description="If the printkey is activated controls the printing of the semi-empirical parameters.", &
474                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
475      CALL section_add_keyword(print_key, keyword)
476      CALL keyword_release(keyword)
477      CALL section_add_subsection(section, print_key)
478      CALL section_release(print_key)
479
480      CALL cp_print_key_section_create(print_key, __LOCATION__, "SYMMETRY", &
481                                       description="controls the output of symmetry information", &
482                                       print_level=debug_print_level + 1, filename="__STD_OUT__")
483      CALL keyword_create(keyword, __LOCATION__, name="MOLECULE", &
484                          description="Assume the system is an isolated molecule", &
485                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
486      CALL section_add_keyword(print_key, keyword)
487      CALL keyword_release(keyword)
488      CALL keyword_create(keyword, __LOCATION__, name="EPS_GEO", &
489                          description="Accuracy required for symmetry detection", &
490                          default_r_val=1.e-4_dp)
491      CALL section_add_keyword(print_key, keyword)
492      CALL keyword_release(keyword)
493      CALL keyword_create(keyword, __LOCATION__, name="STANDARD_ORIENTATION", &
494                          description="Print molecular coordinates in standard orientation", &
495                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
496      CALL section_add_keyword(print_key, keyword)
497      CALL keyword_release(keyword)
498      CALL keyword_create(keyword, __LOCATION__, name="INERTIA", &
499                          description="Print molecular inertia tensor", &
500                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
501      CALL section_add_keyword(print_key, keyword)
502      CALL keyword_release(keyword)
503      CALL keyword_create(keyword, __LOCATION__, name="SYMMETRY_ELEMENTS", &
504                          description="Print symmetry elements", &
505                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
506      CALL section_add_keyword(print_key, keyword)
507      CALL keyword_release(keyword)
508      CALL keyword_create(keyword, __LOCATION__, name="ALL", &
509                          description="Print all symmetry information", &
510                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
511      CALL section_add_keyword(print_key, keyword)
512      CALL keyword_release(keyword)
513      CALL keyword_create(keyword, __LOCATION__, name="ROTATION_MATRICES", &
514                          description="All the rotation matrices of the point group", &
515                          default_l_val=.FALSE.)
516      CALL section_add_keyword(print_key, keyword)
517      CALL keyword_release(keyword)
518      CALL keyword_create(keyword, __LOCATION__, name="CHECK_SYMMETRY", &
519                          description="Check if calculated symmetry has expected value."// &
520                          " Use either Schoenfliess or Hermann-Maugin symbols", &
521                          default_c_val="NONE")
522      CALL section_add_keyword(print_key, keyword)
523      CALL keyword_release(keyword)
524      CALL section_add_subsection(section, print_key)
525      CALL section_release(print_key)
526
527      CALL cp_print_key_section_create(print_key, __LOCATION__, "molecules", &
528                                       description="controls the output of information on the molecules", &
529                                       print_level=medium_print_level, filename="__STD_OUT__")
530      CALL section_add_subsection(section, print_key)
531      CALL section_release(print_key)
532
533      CALL cp_print_key_section_create(print_key, __LOCATION__, "radii", &
534                                       description="controls the output of radii information", unit_str="angstrom", &
535                                       print_level=high_print_level, filename="__STD_OUT__")
536
537      CALL keyword_create(keyword, __LOCATION__, name="core_charges_radii", &
538                          description="If the printkey is activated controls the printing of the radii of the core charges", &
539                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
540      CALL section_add_keyword(print_key, keyword)
541      CALL keyword_release(keyword)
542
543      CALL keyword_create(keyword, __LOCATION__, name="pgf_radii", &
544                          description="If the printkey is activated controls the printing of the core gaussian radii", &
545                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
546      CALL section_add_keyword(print_key, keyword)
547      CALL keyword_release(keyword)
548
549      CALL keyword_create(keyword, __LOCATION__, name="set_radii", &
550                          description="If the printkey is activated controls the printing of the set_radii", &
551                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
552      CALL section_add_keyword(print_key, keyword)
553      CALL keyword_release(keyword)
554
555      CALL keyword_create(keyword, __LOCATION__, name="kind_radii", &
556                          description="If the printkey is activated controls the printing of the kind_radii", &
557                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
558      CALL section_add_keyword(print_key, keyword)
559      CALL keyword_release(keyword)
560
561      CALL keyword_create(keyword, __LOCATION__, name="core_charge_radii", &
562                          description="If the printkey is activated controls the printing of the core_charge_radii", &
563                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
564      CALL section_add_keyword(print_key, keyword)
565      CALL keyword_release(keyword)
566
567      CALL keyword_create(keyword, __LOCATION__, name="ppl_radii", &
568                          description="If the printkey is activated controls the printing of the "// &
569                          "pseudo potential local radii", &
570                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
571      CALL section_add_keyword(print_key, keyword)
572      CALL keyword_release(keyword)
573
574      CALL keyword_create(keyword, __LOCATION__, name="ppnl_radii", &
575                          description="If the printkey is activated controls the printing of the "// &
576                          "pseudo potential non local radii", &
577                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
578      CALL section_add_keyword(print_key, keyword)
579      CALL keyword_release(keyword)
580
581      CALL keyword_create(keyword, __LOCATION__, name="gapw_prj_radii", &
582                          description="If the printkey is activated controls the printing of the gapw projector radii", &
583                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
584      CALL section_add_keyword(print_key, keyword)
585      CALL keyword_release(keyword)
586
587      CALL section_add_subsection(section, print_key)
588      CALL section_release(print_key)
589
590   END SUBROUTINE create_subsys_print_section
591
592! **************************************************************************************************
593!> \brief Creates the multipole section
594!> \param section the section to create
595!> \author teo
596! **************************************************************************************************
597   SUBROUTINE create_multipole_section(section)
598      TYPE(section_type), POINTER                        :: section
599
600      CHARACTER(len=*), PARAMETER :: routineN = 'create_multipole_section', &
601         routineP = moduleN//':'//routineN
602
603      TYPE(keyword_type), POINTER                        :: keyword
604      TYPE(section_type), POINTER                        :: subsection
605
606      CPASSERT(.NOT. ASSOCIATED(section))
607      CALL section_create(section, __LOCATION__, name="multipoles", &
608                          description="Specifies the dipoles and quadrupoles for particles.", &
609                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
610
611      NULLIFY (keyword, subsection)
612      CALL section_create(subsection, __LOCATION__, name="dipoles", &
613                          description="Specifies the dipoles of the particles.", &
614                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
615      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
616                          description="The dipole components for each atom in the format:"// &
617                          "<p><tt><big>D<sub>x</sub> D<sub>y</sub> D<sub>z</sub></big></tt></p>", &
618                          repeats=.TRUE., usage="{Real} {Real} {Real}", &
619                          type_of_var=real_t, n_var=3)
620      CALL section_add_keyword(subsection, keyword)
621      CALL keyword_release(keyword)
622      CALL section_add_subsection(section, subsection)
623      CALL section_release(subsection)
624
625      CALL section_create(subsection, __LOCATION__, name="quadrupoles", &
626                          description="Specifies the quadrupoles of the particles.", &
627                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
628      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
629                          description="The quadrupole components for each atom in the format:"// &
630                          "<p><big><tt>Q<sub>xx</sub> Q<sub>xy</sub> Q<sub>xz</sub> Q<sub>yy</sub> "// &
631                          "Q<sub>yz</sub> Q<sub>zz</sub></big></tt></p>", &
632                          repeats=.TRUE., usage="{Real} {Real} {Real} {Real} {Real} {Real}", &
633                          type_of_var=real_t, n_var=6)
634      CALL section_add_keyword(subsection, keyword)
635      CALL keyword_release(keyword)
636      CALL section_add_subsection(section, subsection)
637      CALL section_release(subsection)
638
639   END SUBROUTINE create_multipole_section
640
641! **************************************************************************************************
642!> \brief creates structure data section for output.. both subsys  (for initialization)
643!>      and motion section..
644!> \param print_key ...
645! **************************************************************************************************
646   SUBROUTINE create_structure_data_section(print_key)
647      TYPE(section_type), POINTER                        :: print_key
648
649      CHARACTER(len=*), PARAMETER :: routineN = 'create_structure_data_section', &
650         routineP = moduleN//':'//routineN
651
652      TYPE(keyword_type), POINTER                        :: keyword
653
654      CPASSERT(.NOT. ASSOCIATED(print_key))
655
656      NULLIFY (keyword)
657
658      CALL cp_print_key_section_create(print_key, __LOCATION__, name="STRUCTURE_DATA", &
659                                       description="Request the printing of special structure data during a structure "// &
660                                       "optimization (in MOTION%PRINT) or when setting up a subsys (in SUBSYS%PRINT).", &
661                                       print_level=high_print_level, filename="__STD_OUT__", unit_str="angstrom")
662
663      CALL keyword_create(keyword, __LOCATION__, name="POSITION", variants=(/"POS"/), &
664                          description="Print the position vectors in Cartesian coordinates of the atoms specified "// &
665                          "by a list of their indices", &
666                          usage="POSITION {integer} {integer} {integer}..{integer}", n_var=-1, repeats=.TRUE., &
667                          type_of_var=integer_t)
668      CALL section_add_keyword(print_key, keyword)
669      CALL keyword_release(keyword)
670
671      CALL keyword_create(keyword, __LOCATION__, name="POSITION_SCALED", variants=(/"POS_SCALED"/), &
672                          description="Print the position vectors in scaled coordinates of the atoms specified "// &
673                          "by a list of their indices", &
674                          usage="POSITION_SCALED {integer} {integer} {integer}..{integer}", n_var=-1, repeats=.TRUE., &
675                          type_of_var=integer_t)
676      CALL section_add_keyword(print_key, keyword)
677      CALL keyword_release(keyword)
678
679      CALL keyword_create(keyword, __LOCATION__, name="DISTANCE", variants=(/"DIS"/), &
680                          description="Print the distance between the atoms a and b specified by their indices", &
681                          usage="DISTANCE {integer} {integer}", n_var=2, repeats=.TRUE., &
682                          type_of_var=integer_t)
683      CALL section_add_keyword(print_key, keyword)
684      CALL keyword_release(keyword)
685
686      CALL keyword_create(keyword, __LOCATION__, name="ANGLE", variants=(/"ANG"/), &
687                          description="Print the angle formed by the atoms specified by their indices", &
688                          usage="ANGLE {integer} {integer} {integer}", n_var=3, repeats=.TRUE., &
689                          type_of_var=integer_t)
690      CALL section_add_keyword(print_key, keyword)
691      CALL keyword_release(keyword)
692
693      CALL keyword_create(keyword, __LOCATION__, name="DIHEDRAL_ANGLE", variants=s2a("DIHEDRAL", "DIH"), &
694                          description="Print the dihedral angle between the planes defined by the atoms (a,b,c) and "// &
695                          "the atoms (b,c,d) specified by their indices", &
696                          usage="DIHEDRAL_ANGLE {integer}  {integer} {integer} {integer}", n_var=4, &
697                          repeats=.TRUE., type_of_var=integer_t)
698      CALL section_add_keyword(print_key, keyword)
699      CALL keyword_release(keyword)
700
701   END SUBROUTINE create_structure_data_section
702
703! **************************************************************************************************
704!> \brief Creates the velocity section
705!> \param section the section to create
706!> \author teo
707! **************************************************************************************************
708   SUBROUTINE create_velocity_section(section)
709      TYPE(section_type), POINTER                        :: section
710
711      CHARACTER(len=*), PARAMETER :: routineN = 'create_velocity_section', &
712         routineP = moduleN//':'//routineN
713
714      TYPE(keyword_type), POINTER                        :: keyword
715
716      CPASSERT(.NOT. ASSOCIATED(section))
717      CALL section_create(section, __LOCATION__, name="velocity", &
718                          description="The velocities for simple systems or "// &
719                          "the centroid mode in PI runs, xyz format by default", &
720                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
721      NULLIFY (keyword)
722      CALL keyword_create(keyword, __LOCATION__, name="PINT_UNIT", &
723                          description="Specify the units of measurement for the velocities "// &
724                          "(currently works only for the path integral code). "// &
725                          "All available CP2K units can be used.", &
726                          usage="UNIT angstrom*au_t^-1", &
727                          default_c_val="bohr*au_t^-1")
728      CALL section_add_keyword(section, keyword)
729      CALL keyword_release(keyword)
730
731      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
732                          description="The atomic velocities in the format:"// &
733                          "<p><tt><big>v<sub>x</sub> v<sub>y</sub> v<sub>z</sub></big></tt></p>"// &
734                          "The same order as for the atomic coordinates is assumed.", &
735                          repeats=.TRUE., usage="{Real} {Real} {Real}", &
736                          type_of_var=real_t, n_var=3)
737      CALL section_add_keyword(section, keyword)
738      CALL keyword_release(keyword)
739
740   END SUBROUTINE create_velocity_section
741
742! **************************************************************************************************
743!> \brief Creates the shell velocity section
744!> \param section the section to create
745!> \author teo
746! **************************************************************************************************
747   SUBROUTINE create_shell_vel_section(section)
748      TYPE(section_type), POINTER                        :: section
749
750      CHARACTER(len=*), PARAMETER :: routineN = 'create_shell_vel_section', &
751         routineP = moduleN//':'//routineN
752
753      TYPE(keyword_type), POINTER                        :: keyword
754
755      CPASSERT(.NOT. ASSOCIATED(section))
756      CALL section_create(section, __LOCATION__, name="shell_velocity", &
757                          description="The velocities of shells for shell-model potentials, "// &
758                          "in xyz format  ", &
759                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
760      NULLIFY (keyword)
761
762      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
763                          description="The shell particle velocities in the format:"// &
764                          "<p><tt><big>v<sub>x</sub> v<sub>y</sub> v<sub>z</sub></big></tt></p>"// &
765                          "The same order as for the shell particle coordinates is assumed.", &
766                          repeats=.TRUE., usage="{Real} {Real} {Real}", &
767                          type_of_var=real_t, n_var=3)
768      CALL section_add_keyword(section, keyword)
769      CALL keyword_release(keyword)
770
771   END SUBROUTINE create_shell_vel_section
772
773! **************************************************************************************************
774!> \brief Creates the shell velocity section
775!> \param section the section to create
776!> \author teo
777! **************************************************************************************************
778   SUBROUTINE create_core_vel_section(section)
779      TYPE(section_type), POINTER                        :: section
780
781      CHARACTER(len=*), PARAMETER :: routineN = 'create_core_vel_section', &
782         routineP = moduleN//':'//routineN
783
784      TYPE(keyword_type), POINTER                        :: keyword
785
786      CPASSERT(.NOT. ASSOCIATED(section))
787      CALL section_create(section, __LOCATION__, name="core_velocity", &
788                          description="The velocities of cores for shell-model potentials, "// &
789                          "in xyz format  ", &
790                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
791      NULLIFY (keyword)
792
793      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
794                          description="The core particle velocities in the format:"// &
795                          "<p><tt><big>v<sub>x</sub> v<sub>y</sub> v<sub>z</sub></big></tt></p>"// &
796                          "The same order as for the core particle coordinates is assumed.", &
797                          repeats=.TRUE., usage="{Real} {Real} {Real}", &
798                          type_of_var=real_t, n_var=3)
799      CALL section_add_keyword(section, keyword)
800      CALL keyword_release(keyword)
801
802   END SUBROUTINE create_core_vel_section
803
804! **************************************************************************************************
805!> \brief Creates the &POTENTIAL section
806!> \param section the section to create
807!> \author teo
808! **************************************************************************************************
809   SUBROUTINE create_potential_section(section)
810      TYPE(section_type), POINTER                        :: section
811
812      CHARACTER(len=*), PARAMETER :: routineN = 'create_potential_section', &
813         routineP = moduleN//':'//routineN
814
815      TYPE(keyword_type), POINTER                        :: keyword
816
817      CALL section_create(section, __LOCATION__, name="potential", &
818                          description="Section used to specify Potentials.", &
819                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
820      NULLIFY (keyword)
821      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
822                          description="CP2K Pseudo Potential Standard Format (GTH, ALL)", &
823                          repeats=.TRUE., type_of_var=lchar_t)
824      CALL section_add_keyword(section, keyword)
825      CALL keyword_release(keyword)
826
827   END SUBROUTINE create_potential_section
828
829! **************************************************************************************************
830!> \brief Creates the &KG_POTENTIAL section
831!> \param section the section to create
832!> \author JGH
833! **************************************************************************************************
834   SUBROUTINE create_kgpot_section(section)
835      TYPE(section_type), POINTER                        :: section
836
837      CHARACTER(len=*), PARAMETER :: routineN = 'create_kgpot_section', &
838         routineP = moduleN//':'//routineN
839
840      TYPE(keyword_type), POINTER                        :: keyword
841
842      CALL section_create(section, __LOCATION__, name="kg_potential", &
843                          description="Section used to specify KG Potentials.", &
844                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
845      NULLIFY (keyword)
846      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
847                          description="CP2K KG TNADD Potential Standard Format (TNADD)", &
848                          repeats=.TRUE., type_of_var=lchar_t)
849      CALL section_add_keyword(section, keyword)
850      CALL keyword_release(keyword)
851
852   END SUBROUTINE create_kgpot_section
853
854! **************************************************************************************************
855!> \brief Creates the &BASIS section
856!> \param section the section to create
857!> \author teo
858! **************************************************************************************************
859   SUBROUTINE create_basis_section(section)
860      TYPE(section_type), POINTER                        :: section
861
862      CHARACTER(len=*), PARAMETER :: routineN = 'create_basis_section', &
863         routineP = moduleN//':'//routineN
864
865      TYPE(keyword_type), POINTER                        :: keyword
866
867      CALL section_create(section, __LOCATION__, name="BASIS", &
868                          description="Section used to specify a general basis set for QM calculations.", &
869                          n_keywords=1, n_subsections=0, repeats=.TRUE.)
870
871      NULLIFY (keyword)
872
873      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
874                          description="The type of basis set defined in this section.", &
875                          lone_keyword_c_val="Orbital", &
876                          usage="Orbital", default_c_val="Orbital")
877      CALL section_add_keyword(section, keyword)
878      CALL keyword_release(keyword)
879
880      CALL keyword_create( &
881         keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
882         repeats=.TRUE., type_of_var=lchar_t, &
883         description="<u>CP2K Basis Set Standard Format</u>"//newline// &
884         "<pre>"//newline// &
885         "Element symbol  Name of the basis set  Alias names"//newline// &
886         "nset (repeat the following block of lines nset times)"//newline// &
887         "n lmin lmax nexp nshell(lmin) nshell(lmin+1) ... nshell(lmax-1) nshell(lmax)"//newline// &
888         "a(1)      c(1,l,1)      c(1,l,2) ...      c(1,l,nshell(l)-1)      c(1,l,nshell(l)), l=lmin,lmax"//newline// &
889         "a(2)      c(2,l,1)      c(2,l,2) ...      c(2,l,nshell(l)-1)      c(2,l,nshell(l)), l=lmin,lmax"//newline// &
890         " .         .             .                 .                       ."//newline// &
891         " .         .             .                 .                       ."//newline// &
892         " .         .             .                 .                       ."//newline// &
893         "a(nexp-1) c(nexp-1,l,1) c(nexp-1,l,2) ... c(nexp-1,l,nshell(l)-1) c(nexp-1,l,nshell(l)), l=lmin,lmax"//newline// &
894         "a(nexp)   c(nexp,l,1)   c(nexp,l,2)   ... c(nexp,l,nshell(l)-1)   c(nexp,l,nshell(l)), l=lmin,lmax"//newline// &
895         newline// &
896         newline// &
897         "nset     : Number of exponent sets"//newline// &
898         "n        : Principle quantum number (only for orbital label printing)"//newline// &
899         "lmax     : Maximum angular momentum quantum number l"//newline// &
900         "lmin     : Minimum angular momentum quantum number l"//newline// &
901         "nshell(l): Number of shells for angular momentum quantum number l"//newline// &
902         "a        : Exponent"//newline// &
903         "c        : Contraction coefficient"//newline// &
904         "</pre>"//newline// &
905         "Source: ftp://ftp.aip.org/epaps/journ_chem_phys/E-JCPSA6-127-308733/BASIS_MOLOPT_JCP.txt")
906      CALL section_add_keyword(section, keyword)
907      CALL keyword_release(keyword)
908
909   END SUBROUTINE create_basis_section
910
911! **************************************************************************************************
912!> \brief Creates the &COORD section
913!> \param section the section to create
914!> \author teo
915! **************************************************************************************************
916   SUBROUTINE create_coord_section(section)
917      TYPE(section_type), POINTER                        :: section
918
919      CHARACTER(len=*), PARAMETER :: routineN = 'create_coord_section', &
920         routineP = moduleN//':'//routineN
921
922      TYPE(keyword_type), POINTER                        :: keyword
923
924      CPASSERT(.NOT. ASSOCIATED(section))
925      CALL section_create(section, __LOCATION__, name="coord", &
926                          description="The coordinates for simple systems (like small QM cells)"// &
927                          " are specified here by default using explicit XYZ coordinates.  "// &
928                          " More complex systems should be given via an external coordinate "// &
929                          " file in the SUBSYS%TOPOLOGY section.", &
930                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
931      NULLIFY (keyword)
932      CALL keyword_create(keyword, __LOCATION__, name="UNIT", &
933                          description='Specify the unit of measurement for the coordinates in input'// &
934                          "All available CP2K units can be used.", &
935                          usage="UNIT angstrom", default_c_val="angstrom")
936      CALL section_add_keyword(section, keyword)
937      CALL keyword_release(keyword)
938
939      CALL keyword_create(keyword, __LOCATION__, name="SCALED", &
940                          description='Specify if the coordinates in input are scaled. '// &
941                          'When true, the coordinates are given in multiples of the lattice vectors.', &
942                          usage="SCALED F", default_l_val=.FALSE., &
943                          lone_keyword_l_val=.TRUE.)
944      CALL section_add_keyword(section, keyword)
945      CALL keyword_release(keyword)
946
947      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
948                          description="The atomic coordinates in the format:"// &
949                          "<p><tt>ATOMIC_KIND  X Y Z  MOLNAME</tt></p>"// &
950                          "The <tt>MOLNAME</tt> is optional. If not provided the molecule name "// &
951                          "is internally created. All other fields after <tt>MOLNAME</tt> are simply ignored.", &
952                          repeats=.TRUE., usage="{{String} {Real} {Real} {Real} {String}}", &
953                          type_of_var=lchar_t)
954      CALL section_add_keyword(section, keyword)
955      CALL keyword_release(keyword)
956   END SUBROUTINE create_coord_section
957
958! **************************************************************************************************
959!> \brief Creates the &SHELL_COORD section
960!> \param section the section to create
961!> \author teo
962! **************************************************************************************************
963   SUBROUTINE create_shell_coord_section(section)
964      TYPE(section_type), POINTER                        :: section
965
966      CHARACTER(len=*), PARAMETER :: routineN = 'create_shell_coord_section', &
967         routineP = moduleN//':'//routineN
968
969      TYPE(keyword_type), POINTER                        :: keyword
970
971      CPASSERT(.NOT. ASSOCIATED(section))
972      CALL section_create(section, __LOCATION__, name="shell_coord", &
973                          description="The shell coordinates for the shell-model potentials"// &
974                          " xyz format with an additional column for the index of the corresponding particle", &
975                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
976      NULLIFY (keyword)
977      CALL keyword_create(keyword, __LOCATION__, name="UNIT", &
978                          description='Specify the unit of measurement for the coordinates in input'// &
979                          "All available CP2K units can be used.", &
980                          usage="UNIT angstrom", default_c_val="angstrom")
981      CALL section_add_keyword(section, keyword)
982      CALL keyword_release(keyword)
983
984      CALL keyword_create(keyword, __LOCATION__, name="SCALED", &
985                          description='Specify if the coordinates in input are scaled. '// &
986                          'When true, the coordinates are given in multiples of the lattice vectors.', &
987                          usage="SCALED F", default_l_val=.FALSE., &
988                          lone_keyword_l_val=.TRUE.)
989      CALL section_add_keyword(section, keyword)
990      CALL keyword_release(keyword)
991
992      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
993                          description="The shell particle coordinates in the format:"// &
994                          "<p><tt>ATOMIC_KIND  X Y Z  ATOMIC_INDEX</tt></p>"// &
995                          "The <tt>ATOMIC_INDEX</tt> refers to the atom the shell particle belongs to.", &
996                          repeats=.TRUE., usage="{{String} {Real} {Real} {Real} {Integer}}", &
997                          type_of_var=lchar_t)
998      CALL section_add_keyword(section, keyword)
999      CALL keyword_release(keyword)
1000
1001   END SUBROUTINE create_shell_coord_section
1002
1003! **************************************************************************************************
1004!> \brief Creates the &core_COORD section
1005!> \param section the section to create
1006!> \author teo
1007! **************************************************************************************************
1008   SUBROUTINE create_core_coord_section(section)
1009      TYPE(section_type), POINTER                        :: section
1010
1011      CHARACTER(len=*), PARAMETER :: routineN = 'create_core_coord_section', &
1012         routineP = moduleN//':'//routineN
1013
1014      TYPE(keyword_type), POINTER                        :: keyword
1015
1016      CPASSERT(.NOT. ASSOCIATED(section))
1017      CALL section_create(section, __LOCATION__, name="core_coord", &
1018                          description="The core coordinates for the shell-model potentials"// &
1019                          " xyz format with an additional column for the index of the corresponding particle", &
1020                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
1021      NULLIFY (keyword)
1022      CALL keyword_create(keyword, __LOCATION__, name="UNIT", &
1023                          description='Specify the unit of measurement for the coordinates in input'// &
1024                          "All available CP2K units can be used.", &
1025                          usage="UNIT angstrom", default_c_val="angstrom")
1026      CALL section_add_keyword(section, keyword)
1027      CALL keyword_release(keyword)
1028
1029      CALL keyword_create(keyword, __LOCATION__, name="SCALED", &
1030                          description='Specify if the coordinates in input are scaled. '// &
1031                          'When true, the coordinates are given in multiples of the lattice vectors.', &
1032                          usage="SCALED F", default_l_val=.FALSE., &
1033                          lone_keyword_l_val=.TRUE.)
1034      CALL section_add_keyword(section, keyword)
1035      CALL keyword_release(keyword)
1036
1037      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
1038                          description="The core particle coordinates in the format:"// &
1039                          "<p><tt>ATOMIC_KIND  X Y Z  ATOMIC_INDEX</tt></p>"// &
1040                          "The <tt>ATOMIC_INDEX</tt> refers to the atom the core particle belongs to.", &
1041                          repeats=.TRUE., usage="{{String} {Real} {Real} {Real} {Integer}}", &
1042                          type_of_var=lchar_t)
1043      CALL section_add_keyword(section, keyword)
1044      CALL keyword_release(keyword)
1045
1046   END SUBROUTINE create_core_coord_section
1047
1048! **************************************************************************************************
1049!> \brief Creates the QM/MM section
1050!> \param section the section to create
1051!> \author teo
1052! **************************************************************************************************
1053   SUBROUTINE create_kind_section(section)
1054      TYPE(section_type), POINTER                        :: section
1055
1056      CHARACTER(len=*), PARAMETER :: routineN = 'create_kind_section', &
1057         routineP = moduleN//':'//routineN
1058
1059      TYPE(keyword_type), POINTER                        :: keyword
1060      TYPE(section_type), POINTER                        :: subsection
1061
1062      CPASSERT(.NOT. ASSOCIATED(section))
1063
1064      CALL section_create(section, __LOCATION__, name="KIND", &
1065                          description="The description of the kind of the atoms (mostly for QM)", &
1066                          n_keywords=19, n_subsections=1, repeats=.TRUE.)
1067
1068      NULLIFY (keyword)
1069
1070      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
1071                          description="The name of the kind described in this section.", &
1072                          usage="H", default_c_val="DEFAULT")
1073      CALL section_add_keyword(section, keyword)
1074      CALL keyword_release(keyword)
1075
1076      CALL keyword_create(keyword, __LOCATION__, name="BASIS_SET", &
1077                          description="The primary Gaussian basis set (NONE implies no basis used, meaningful with GHOST). "// &
1078                          "Defaults are set for TYPE {ORB} and FORM {GTO}. Possible values for TYPE are "// &
1079                          "{ORB, AUX, RI_AUX, LRI, ...}. Possible values for "// &
1080                          "FORM are {GTO, STO}. Where STO results in a GTO expansion of a Slater type basis."// &
1081                          "If a value for FORM is given, also TYPE has to be set explicitly.", &
1082                          usage="BASIS_SET [type] [form] DZVP", type_of_var=char_t, default_c_vals=(/" ", " ", " "/), &
1083                          citations=(/VandeVondele2005a, VandeVondele2007/), &
1084                          repeats=.TRUE., n_var=-1)
1085      CALL section_add_keyword(section, keyword)
1086      CALL keyword_release(keyword)
1087
1088      ! old type basis set input keywords
1089      ! kept for backward compatibility
1090      CALL keyword_create( &
1091         keyword, __LOCATION__, name="AUX_BASIS_SET", &
1092         variants=s2a("AUXILIARY_BASIS_SET", "AUX_BASIS"), &
1093         description="The auxiliary basis set (GTO type)", &
1094         usage="AUX_BASIS_SET DZVP", default_c_val=" ", &
1095         n_var=1, &
1096         deprecation_notice="use 'BASIS_SET AUX ...' instead", &
1097         removed=.TRUE.)
1098      CALL section_add_keyword(section, keyword)
1099      CALL keyword_release(keyword)
1100
1101      CALL keyword_create( &
1102         keyword, __LOCATION__, name="RI_AUX_BASIS_SET", &
1103         variants=s2a("RI_MP2_BASIS_SET", "RI_RPA_BASIS_SET", "RI_AUX_BASIS"), &
1104         description="The RI auxiliary basis set used in WF_CORRELATION (GTO type)", &
1105         usage="RI_AUX_BASIS_SET DZVP", default_c_val=" ", &
1106         n_var=1, &
1107         deprecation_notice="use 'BASIS_SET RI_AUX ...' instead", &
1108         removed=.TRUE.)
1109      CALL section_add_keyword(section, keyword)
1110      CALL keyword_release(keyword)
1111
1112      CALL keyword_create( &
1113         keyword, __LOCATION__, name="LRI_BASIS_SET", &
1114         variants=s2a("LRI_BASIS"), &
1115         description="The local resolution of identity basis set (GTO type)", &
1116         usage="", default_c_val=" ", &
1117         n_var=1, &
1118         deprecation_notice="use 'BASIS_SET AUX_FIT ...' instead", &
1119         removed=.TRUE.)
1120      CALL section_add_keyword(section, keyword)
1121      CALL keyword_release(keyword)
1122
1123      CALL keyword_create( &
1124         keyword, __LOCATION__, name="AUX_FIT_BASIS_SET", &
1125         variants=s2a("AUXILIARY_FIT_BASIS_SET", "AUX_FIT_BASIS"), &
1126         description="The auxiliary basis set (GTO type) for auxiliary density matrix method", &
1127         usage="AUX_FIT_BASIS_SET DZVP", default_c_val=" ", &
1128         citations=(/Guidon2010/), &
1129         n_var=1, &
1130         deprecation_notice="use 'BASIS_SET AUX_FIT ...' instead", &
1131         removed=.TRUE.)
1132      CALL section_add_keyword(section, keyword)
1133      CALL keyword_release(keyword)
1134      ! end of old basis set keywords
1135
1136      CALL keyword_create(keyword, __LOCATION__, name="ELEC_CONF", &
1137                          description="Specifies the electronic configuration used in construction the "// &
1138                          "atomic initial guess (see the pseudo potential file for the default values).", &
1139                          usage="ELEC_COND n_elec(s)  n_elec(p)  n_elec(d)  ... ", &
1140                          n_var=-1, type_of_var=integer_t)
1141      CALL section_add_keyword(section, keyword)
1142      CALL keyword_release(keyword)
1143
1144      CALL keyword_create(keyword, __LOCATION__, name="CORE_CORRECTION", &
1145                          description="Corrects the effective nuclear charge", &
1146                          usage="CORE_CORRECTION 1.0", n_var=1, &
1147                          default_r_val=0.0_dp)
1148      CALL section_add_keyword(section, keyword)
1149      CALL keyword_release(keyword)
1150
1151      CALL keyword_create(keyword, __LOCATION__, name="MAGNETIZATION", &
1152                          description="The magnetization used in the atomic initial guess. "// &
1153                          "Adds magnetization/2 spin-alpha electrons and removes magnetization/2 spin-beta electrons.", &
1154                          usage="MAGNETIZATION 0.5", n_var=1, &
1155                          default_r_val=0.0_dp)
1156      CALL section_add_keyword(section, keyword)
1157      CALL keyword_release(keyword)
1158
1159      CALL keyword_create(keyword, __LOCATION__, name="ELEMENT", &
1160                          variants=(/"ELEMENT_SYMBOL"/), &
1161                          description="The element of the actual kind "// &
1162                          "(if not given it is inferred from the kind name)", &
1163                          usage="ELEMENT O", type_of_var=char_t, n_var=1)
1164      CALL section_add_keyword(section, keyword)
1165      CALL keyword_release(keyword)
1166
1167      CALL keyword_create(keyword, __LOCATION__, name="MASS", &
1168                          variants=s2a("ATOMIC_MASS", "ATOMIC_WEIGHT", "WEIGHT"), &
1169                          description="The mass of the atom "// &
1170                          "(if negative or non present it is inferred from the element symbol)", &
1171                          usage="MASS 2.0", type_of_var=real_t, n_var=1)
1172      CALL section_add_keyword(section, keyword)
1173      CALL keyword_release(keyword)
1174
1175      CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_FILE_NAME", &
1176                          description="The name of the file where to find this kinds pseudopotential."// &
1177                          " Default file is specified in DFT section.", &
1178                          usage="POTENTIAL_FILE_NAME <PSEUDO-POTENTIAL-FILE-NAME>", default_c_val="-", n_var=1)
1179      CALL section_add_keyword(section, keyword)
1180      CALL keyword_release(keyword)
1181
1182      CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_TYPE", &
1183                          description="The type of this kinds pseudopotential (ECP, ALL, GTH, UPS).", &
1184                          deprecation_notice="use 'POTENTIAL <TYPE> ...' instead", &
1185                          usage="POTENTIAL_TYPE <TYPE>", default_c_val="", n_var=1)
1186      CALL section_add_keyword(section, keyword)
1187      CALL keyword_release(keyword)
1188
1189      CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL", &
1190                          variants=(/"POT"/), &
1191                          description="The type (ECP, ALL, GTH, UPS) and name of the pseudopotential for the defined kind.", &
1192                          usage="POTENTIAL [type] <POTENTIAL-NAME>", type_of_var=char_t, default_c_vals=(/" ", " "/), &
1193                          citations=(/Goedecker1996, Hartwigsen1998, Krack2005/), n_var=-1)
1194      CALL section_add_keyword(section, keyword)
1195      CALL keyword_release(keyword)
1196
1197      CALL keyword_create(keyword, __LOCATION__, name="KG_POTENTIAL_FILE_NAME", &
1198                          description="The name of the file where to find this kinds KG potential."// &
1199                          " Default file is specified in DFT section.", &
1200                          usage="KG_POTENTIAL_FILE_NAME <POTENTIAL-FILE-NAME>", default_c_val="-", n_var=1)
1201      CALL section_add_keyword(section, keyword)
1202      CALL keyword_release(keyword)
1203
1204      CALL keyword_create(keyword, __LOCATION__, name="KG_POTENTIAL", &
1205                          variants=(/"KG_POT"/), &
1206                          description="The name of the non-additive atomic kinetic energy potential.", &
1207                          usage="KG_POTENTIAL <TNADD-POTENTIAL-NAME>", default_c_val="NONE", n_var=1)
1208      CALL section_add_keyword(section, keyword)
1209      CALL keyword_release(keyword)
1210
1211      CALL keyword_create(keyword, __LOCATION__, name="HARD_EXP_RADIUS", &
1212                          description="The region where the hard density is supposed to be confined"// &
1213                          " (GAPW) (in Bohr, default is 1.2 for H and 1.512 otherwise)", &
1214                          usage="HARD_EXP_RADIUS 0.9", type_of_var=real_t, n_var=1)
1215      CALL section_add_keyword(section, keyword)
1216      CALL keyword_release(keyword)
1217
1218      CALL keyword_create(keyword, __LOCATION__, name="MAX_RAD_LOCAL", &
1219                          description="Max radius for the basis functions used to"// &
1220                          " generate the local projectors in GAPW [Bohr]", &
1221                          usage="MAX_RAD_LOCAL 15.0", default_r_val=13.0_dp*bohr)
1222      CALL section_add_keyword(section, keyword)
1223      CALL keyword_release(keyword)
1224
1225      CALL keyword_create(keyword, __LOCATION__, name="RHO0_EXP_RADIUS", &
1226                          description="the radius which defines the atomic region where "// &
1227                          "the hard compensation density is confined."// &
1228                          "should be less than HARD_EXP_RADIUS (GAPW) (Bohr, default equals HARD_EXP_RADIUS)", &
1229                          usage="RHO_EXP_RADIUS 0.9", type_of_var=real_t, n_var=1)
1230      CALL section_add_keyword(section, keyword)
1231      CALL keyword_release(keyword)
1232
1233      CALL keyword_create(keyword, __LOCATION__, name="LEBEDEV_GRID", &
1234                          description="The number of points for the angular part of "// &
1235                          "the local grid (GAPW)", &
1236                          usage="LEBEDEV_GRID 40", default_i_val=50)
1237      CALL section_add_keyword(section, keyword)
1238      CALL keyword_release(keyword)
1239
1240      CALL keyword_create(keyword, __LOCATION__, name="RADIAL_GRID", &
1241                          description="The number of points for the radial part of "// &
1242                          "the local grid (GAPW)", &
1243                          usage="RADIAL_GRID 70", default_i_val=50)
1244      CALL section_add_keyword(section, keyword)
1245      CALL keyword_release(keyword)
1246
1247      CALL keyword_create(keyword, __LOCATION__, name="MM_RADIUS", &
1248                          description="Defines the radius of the electrostatic multipole "// &
1249                          "of the atom in Fist. This radius applies to the charge, the "// &
1250                          "dipole and the quadrupole. When zero, the atom is treated as "// &
1251                          "a point multipole, otherwise it is treated as a Gaussian "// &
1252                          "charge distribution with the given radius: "// &
1253                          "p(x,y,z)*N*exp(-(x**2+y**2+z**2)/(2*MM_RADIUS**2)), where N is "// &
1254                          "a normalization constant. In the core-shell model, only the "// &
1255                          "shell is treated as a Gaussian and the core is always a point "// &
1256                          "charge.", &
1257                          usage="MM_RADIUS {real}", default_r_val=0.0_dp, type_of_var=real_t, &
1258                          unit_str="angstrom", n_var=1)
1259      CALL section_add_keyword(section, keyword)
1260      CALL keyword_release(keyword)
1261
1262      CALL keyword_create(keyword, __LOCATION__, name="DFTB3_PARAM", &
1263                          description="The third order parameter (derivative of hardness) used in "// &
1264                          "diagonal DFTB3 correction.", &
1265                          usage="DFTB3_PARAM 0.2", default_r_val=0.0_dp)
1266      CALL section_add_keyword(section, keyword)
1267      CALL keyword_release(keyword)
1268
1269      CALL keyword_create(keyword, __LOCATION__, name="LMAX_DFTB", &
1270                          description="The maximum l-quantum number of the DFTB basis for this kind.", &
1271                          usage="LMAX_DFTB 1", default_i_val=-1)
1272      CALL section_add_keyword(section, keyword)
1273      CALL keyword_release(keyword)
1274
1275      CALL keyword_create(keyword, __LOCATION__, name="MAO", &
1276                          description="The number of MAOs (Modified Atomic Orbitals) for this kind.", &
1277                          usage="MAO 4", default_i_val=-1)
1278      CALL section_add_keyword(section, keyword)
1279      CALL keyword_release(keyword)
1280
1281      ! Logicals
1282      CALL keyword_create(keyword, __LOCATION__, name="SE_P_ORBITALS_ON_H", &
1283                          description="Forces the usage of p-orbitals on H for SEMI-EMPIRICAL calculations. "// &
1284                          " This keyword applies only when the KIND is specifying an Hydrogen element."// &
1285                          " It is ignored in all other cases. ", &
1286                          usage="SE_P_ORBITALS_ON_H", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1287      CALL section_add_keyword(section, keyword)
1288      CALL keyword_release(keyword)
1289
1290      CALL keyword_create(keyword, __LOCATION__, name="GPW_TYPE", &
1291                          description="Force one type to be treated by the GPW scheme,"// &
1292                          " whatever are its primitives, even if the GAPW method is used", &
1293                          usage="GPW_TYPE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1294      CALL section_add_keyword(section, keyword)
1295      CALL keyword_release(keyword)
1296
1297      CALL keyword_create(keyword, __LOCATION__, &
1298                          name="GHOST", &
1299                          description="This keyword makes all atoms of this kind "// &
1300                          "ghost atoms, i.e. without pseudo or nuclear charge. "// &
1301                          "Useful to just have the basis set at that position (e.g. BSSE calculations), "// &
1302                          "or to have a non-interacting particle with BASIS_SET NONE", &
1303                          usage="GHOST", &
1304                          default_l_val=.FALSE., &
1305                          lone_keyword_l_val=.TRUE.)
1306      CALL section_add_keyword(section, keyword)
1307      CALL keyword_release(keyword)
1308
1309      CALL keyword_create(keyword, __LOCATION__, &
1310                          name="FLOATING_BASIS_CENTER", &
1311                          description="This keyword makes all atoms of this kind "// &
1312                          "floating functions, i.e. without pseudo or nuclear charge"// &
1313                          " which are subject to a geometry optimization in the outer SCF.", &
1314                          usage="FLOATING_BASIS_CENTER", &
1315                          default_l_val=.FALSE., &
1316                          lone_keyword_l_val=.TRUE.)
1317      CALL section_add_keyword(section, keyword)
1318      CALL keyword_release(keyword)
1319
1320      CALL keyword_create(keyword, __LOCATION__, &
1321                          name="NO_OPTIMIZE", &
1322                          description="Skip optimization of this type (used in specific basis set or"// &
1323                          " potential optimization schemes)", &
1324                          usage="NO_OPTIMIZE", &
1325                          default_l_val=.FALSE., &
1326                          lone_keyword_l_val=.TRUE.)
1327      CALL section_add_keyword(section, keyword)
1328      CALL keyword_release(keyword)
1329
1330      CALL keyword_create(keyword, __LOCATION__, name="PAO_BASIS_SIZE", &
1331                          description="The block size used for the polarized atomic orbital basis. "// &
1332                          "Setting PAO_BASIS_SIZE to the size of the primary basis or to a value "// &
1333                          "below one will disables the PAO method for the given atomic kind. "// &
1334                          "By default PAO is disbabled.", default_i_val=0)
1335      CALL section_add_keyword(section, keyword)
1336      CALL keyword_release(keyword)
1337
1338      NULLIFY (subsection)
1339      CALL create_pao_potential_section(subsection)
1340      CALL section_add_subsection(section, subsection)
1341      CALL section_release(subsection)
1342
1343      CALL create_pao_descriptor_section(subsection)
1344      CALL section_add_subsection(section, subsection)
1345      CALL section_release(subsection)
1346
1347      CALL create_basis_section(subsection)
1348      CALL section_add_subsection(section, subsection)
1349      CALL section_release(subsection)
1350
1351      CALL create_potential_section(subsection)
1352      CALL section_add_subsection(section, subsection)
1353      CALL section_release(subsection)
1354
1355      CALL create_kgpot_section(subsection)
1356      CALL section_add_subsection(section, subsection)
1357      CALL section_release(subsection)
1358
1359      CALL create_dft_plus_u_section(subsection)
1360      CALL section_add_subsection(section, subsection)
1361      CALL section_release(subsection)
1362
1363      CALL create_bs_section(subsection)
1364      CALL section_add_subsection(section, subsection)
1365      CALL section_release(subsection)
1366
1367   END SUBROUTINE create_kind_section
1368
1369! **************************************************************************************************
1370!> \brief Creates the PAO_POTENTIAL section
1371!> \param section the section to create
1372!> \author Ole Schuett
1373! **************************************************************************************************
1374   SUBROUTINE create_pao_potential_section(section)
1375      TYPE(section_type), POINTER                        :: section
1376
1377      TYPE(keyword_type), POINTER                        :: keyword
1378
1379      CPASSERT(.NOT. ASSOCIATED(section))
1380      NULLIFY (keyword)
1381
1382      CALL section_create(section, __LOCATION__, name="PAO_POTENTIAL", repeats=.TRUE., &
1383                          description="Settings of the PAO potentials, which are atomic kind specific.")
1384
1385      CALL keyword_create(keyword, __LOCATION__, name="MAXL", &
1386                          description="Maximum angular moment of the potential "// &
1387                          "(must be an even number).", default_i_val=0)
1388      CALL section_add_keyword(section, keyword)
1389      CALL keyword_release(keyword)
1390
1391      CALL keyword_create(keyword, __LOCATION__, name="BETA", &
1392                          description="Exponent of the Gaussian potential term.", &
1393                          default_r_val=1.0_dp)
1394      CALL section_add_keyword(section, keyword)
1395      CALL keyword_release(keyword)
1396
1397      CALL keyword_create(keyword, __LOCATION__, name="WEIGHT", &
1398                          description="Weight of Gaussian potential term.", &
1399                          default_r_val=1.0_dp)
1400      CALL section_add_keyword(section, keyword)
1401      CALL keyword_release(keyword)
1402
1403      CALL keyword_create(keyword, __LOCATION__, name="MAX_PROJECTOR", &
1404                          description="Maximum angular moment of the potential's projectors. "// &
1405                          "Used only by the GTH parametrization", default_i_val=2)
1406      CALL section_add_keyword(section, keyword)
1407      CALL keyword_release(keyword)
1408
1409   END SUBROUTINE create_pao_potential_section
1410
1411! **************************************************************************************************
1412!> \brief Creates the PAO_DESCRIPTOR section
1413!> \param section the section to create
1414!> \author Ole Schuett
1415! **************************************************************************************************
1416   SUBROUTINE create_pao_descriptor_section(section)
1417      TYPE(section_type), POINTER                        :: section
1418
1419      TYPE(keyword_type), POINTER                        :: keyword
1420
1421      CPASSERT(.NOT. ASSOCIATED(section))
1422      NULLIFY (keyword)
1423
1424      CALL section_create(section, __LOCATION__, name="PAO_DESCRIPTOR", repeats=.TRUE., &
1425                          description="Settings of the PAO descriptor, which are atomic kind specific.")
1426
1427      CALL keyword_create(keyword, __LOCATION__, name="BETA", &
1428                          description="Exponent of the Gaussian potential term.", &
1429                          default_r_val=1.0_dp)
1430      CALL section_add_keyword(section, keyword)
1431      CALL keyword_release(keyword)
1432
1433      CALL keyword_create(keyword, __LOCATION__, name="SCREENING", &
1434                          description="Exponent of the Gaussian screening.", &
1435                          default_r_val=0.2_dp)
1436      CALL section_add_keyword(section, keyword)
1437      CALL keyword_release(keyword)
1438
1439      CALL keyword_create(keyword, __LOCATION__, name="WEIGHT", &
1440                          description="Weight of Gaussian potential term.", &
1441                          default_r_val=1.0_dp)
1442      CALL section_add_keyword(section, keyword)
1443      CALL keyword_release(keyword)
1444
1445   END SUBROUTINE create_pao_descriptor_section
1446
1447! **************************************************************************************************
1448!> \brief      Create CP2K input section for BS method: imposing atomic orbital occupation
1449!>             different from default in initialization of the density  matrix
1450!>             it works only with GUESS ATOMIC
1451!> \param section ...
1452!> \date       05.08.2009
1453!> \author     MI
1454!> \version    1.0
1455! **************************************************************************************************
1456   SUBROUTINE create_bs_section(section)
1457
1458      TYPE(section_type), POINTER                        :: section
1459
1460      CHARACTER(LEN=*), PARAMETER :: routineN = 'create_bs_section', &
1461         routineP = moduleN//':'//routineN
1462
1463      TYPE(keyword_type), POINTER                        :: keyword
1464      TYPE(section_type), POINTER                        :: subsection
1465
1466      CPASSERT(.NOT. ASSOCIATED(section))
1467
1468      CALL section_create(section, __LOCATION__, &
1469                          name="BS", &
1470                          description="Define the required atomic orbital occupation "// &
1471                          "assigned in initialization of the density matrix, by adding or "// &
1472                          "subtracting electrons from specific angular momentum channels. "// &
1473                          "It works only with GUESS ATOMIC.", &
1474                          n_keywords=0, &
1475                          n_subsections=2, &
1476                          repeats=.FALSE.)
1477
1478      NULLIFY (keyword, subsection)
1479
1480      CALL keyword_create(keyword, __LOCATION__, &
1481                          name="_SECTION_PARAMETERS_", &
1482                          description="controls the activation of the BS section", &
1483                          usage="&BS ON", &
1484                          default_l_val=.FALSE., &
1485                          lone_keyword_l_val=.TRUE.)
1486      CALL section_add_keyword(section, keyword)
1487      CALL keyword_release(keyword)
1488
1489      CALL section_create(subsection, __LOCATION__, name="ALPHA", description="alpha spin", &
1490                          n_keywords=3, &
1491                          n_subsections=0, &
1492                          repeats=.FALSE.)
1493
1494      CALL keyword_create(keyword, __LOCATION__, &
1495                          name="NEL", &
1496                          description="Orbital ccupation change per angular momentum quantum number. "// &
1497                          "In unrestricted calculations applied to spin alpha.", &
1498                          repeats=.FALSE., &
1499                          n_var=-1, &
1500                          default_i_val=-1, &
1501                          usage="NEL 2")
1502      CALL section_add_keyword(subsection, keyword)
1503      CALL keyword_release(keyword)
1504
1505      CALL keyword_create(keyword, __LOCATION__, &
1506                          name="L", &
1507                          variants=(/"L"/), &
1508                          description="Angular momentum quantum number of the "// &
1509                          "orbitals whose occupation is changed", &
1510                          repeats=.FALSE., &
1511                          n_var=-1, &
1512                          default_i_val=-1, &
1513                          usage="L 2")
1514      CALL section_add_keyword(subsection, keyword)
1515      CALL keyword_release(keyword)
1516
1517      CALL keyword_create(keyword, __LOCATION__, &
1518                          name="N", &
1519                          variants=(/"N"/), &
1520                          description="Principal quantum number of the "// &
1521                          "orbitals whose occupation is changed. "// &
1522                          "Default is the first not occupied", &
1523                          repeats=.FALSE., &
1524                          n_var=-1, &
1525                          default_i_val=0, &
1526                          usage="N 2")
1527      CALL section_add_keyword(subsection, keyword)
1528      CALL keyword_release(keyword)
1529      CALL section_add_subsection(section, subsection)
1530      CALL section_release(subsection)
1531
1532      CALL section_create(subsection, __LOCATION__, name="BETA", description="beta spin", &
1533                          n_keywords=3, &
1534                          n_subsections=0, &
1535                          repeats=.FALSE.)
1536
1537      CALL keyword_create(keyword, __LOCATION__, &
1538                          name="NEL", &
1539                          description="Orbital ccupation change per angular momentum quantum number. "// &
1540                          "Applied to spin beta and active only in unrestricted calculations.", &
1541                          repeats=.FALSE., &
1542                          n_var=-1, &
1543                          default_i_val=-1, &
1544                          usage="NEL 2")
1545      CALL section_add_keyword(subsection, keyword)
1546      CALL keyword_release(keyword)
1547
1548      CALL keyword_create(keyword, __LOCATION__, &
1549                          name="L", &
1550                          description="Angular momentum quantum number of the "// &
1551                          "orbitals of beta spin whose occupation is changed. "// &
1552                          "Active only for unrestricted calculations", &
1553                          repeats=.FALSE., &
1554                          n_var=-1, &
1555                          default_i_val=-1, &
1556                          usage="L 2")
1557      CALL section_add_keyword(subsection, keyword)
1558      CALL keyword_release(keyword)
1559
1560      CALL keyword_create(keyword, __LOCATION__, &
1561                          name="N", &
1562                          description="Principal quantum number of the "// &
1563                          "orbitals of beta spin whose occupation is changed. "// &
1564                          "Default is the first not occupied. "// &
1565                          "Active only for unrestricted calculations", &
1566                          repeats=.FALSE., &
1567                          n_var=-1, &
1568                          default_i_val=0, &
1569                          usage="N 2")
1570      CALL section_add_keyword(subsection, keyword)
1571      CALL keyword_release(keyword)
1572
1573      CALL section_add_subsection(section, subsection)
1574      CALL section_release(subsection)
1575
1576   END SUBROUTINE create_bs_section
1577
1578! **************************************************************************************************
1579!> \brief Create the topology section for FIST.. and the base is running running...
1580!>      Contains all information regarding topology to be read in input file..
1581!> \param section the section to create
1582!> \author teo
1583! **************************************************************************************************
1584   SUBROUTINE create_topology_section(section)
1585      TYPE(section_type), POINTER                        :: section
1586
1587      CHARACTER(len=*), PARAMETER :: routineN = 'create_topology_section', &
1588         routineP = moduleN//':'//routineN
1589
1590      TYPE(keyword_type), POINTER                        :: keyword
1591      TYPE(section_type), POINTER                        :: print_key, subsection
1592
1593      CPASSERT(.NOT. ASSOCIATED(section))
1594      CALL section_create(section, __LOCATION__, name="TOPOLOGY", &
1595                          description="Section specifying information regarding how to handle the topology"// &
1596                          " for classical runs.", &
1597                          n_keywords=5, n_subsections=0, repeats=.FALSE.)
1598
1599      NULLIFY (keyword, print_key)
1600      ! Logical
1601      CALL keyword_create(keyword, __LOCATION__, name="USE_ELEMENT_AS_KIND", &
1602                          description="Kinds are generated according to the element name."// &
1603                          " Default=True for SE and TB methods.", &
1604                          usage="USE_ELEMENT_AS_KIND logical", &
1605                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1606      CALL section_add_keyword(section, keyword)
1607      CALL keyword_release(keyword)
1608
1609      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_OCCUP", &
1610                          variants=(/"CHARGE_O"/), &
1611                          description="Read MM charges from the OCCUP field of PDB file.", &
1612                          usage="CHARGE_OCCUP logical", &
1613                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1614      CALL section_add_keyword(section, keyword)
1615      CALL keyword_release(keyword)
1616
1617      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_BETA", &
1618                          variants=(/"CHARGE_B"/), &
1619                          description="Read MM charges from the BETA field of PDB file.", &
1620                          usage="CHARGE_BETA logical", &
1621                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1622      CALL section_add_keyword(section, keyword)
1623      CALL keyword_release(keyword)
1624
1625      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_EXTENDED", &
1626                          description="Read MM charges from the very last field of PDB file (starting from column 81)."// &
1627                          " No limitations of number of digits.", &
1628                          usage="CHARGE_EXTENDED logical", &
1629                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1630      CALL section_add_keyword(section, keyword)
1631      CALL keyword_release(keyword)
1632
1633      CALL keyword_create(keyword, __LOCATION__, name="PARA_RES", &
1634                          description="For a protein, each residue is now considered a molecule", &
1635                          usage="PARA_RES logical", &
1636                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
1637      CALL section_add_keyword(section, keyword)
1638      CALL keyword_release(keyword)
1639
1640      CALL keyword_create(keyword, __LOCATION__, name="MOL_CHECK", &
1641                          description="Check molecules have the same number of atom and names.", &
1642                          usage="MOL_CHECK logical", &
1643                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
1644      CALL section_add_keyword(section, keyword)
1645      CALL keyword_release(keyword)
1646
1647      CALL keyword_create(keyword, __LOCATION__, name="USE_G96_VELOCITY", &
1648                          description="Use the velocities in the G96 coordinate files as the starting velocity", &
1649                          usage="USE_G96_VELOCITY logical", &
1650                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1651      CALL section_add_keyword(section, keyword)
1652      CALL keyword_release(keyword)
1653
1654      ! Character
1655      CALL keyword_create(keyword, __LOCATION__, name="COORD_FILE_NAME", &
1656                          variants=s2a("COORD_FILE"), &
1657                          description="Specifies the filename that contains coordinates.", &
1658                          usage="COORD_FILE_NAME <FILENAME>", type_of_var=lchar_t)
1659      CALL section_add_keyword(section, keyword)
1660      CALL keyword_release(keyword)
1661
1662      CALL keyword_create(keyword, __LOCATION__, name="COORD_FILE_FORMAT", &
1663                          variants=s2a("COORDINATE"), &
1664                          description="Set up the way in which coordinates will be read.", &
1665                          usage="COORD_FILE_FORMAT (OFF|PDB|XYZ|G96|CRD|CIF|XTL|CP2K)", &
1666                          enum_c_vals=s2a("OFF", "PDB", "XYZ", "G96", "CRD", "CIF", "XTL", "CP2K"), &
1667                          enum_i_vals=(/do_coord_off, do_coord_pdb, do_coord_xyz, do_coord_g96, do_coord_crd, &
1668                                        do_coord_cif, do_coord_xtl, do_coord_cp2k/), &
1669                          enum_desc=s2a( &
1670                          "Coordinates read in the &COORD section of the input file", &
1671                          "Coordinates provided through a PDB file format", &
1672                          "Coordinates provided through an XYZ file format", &
1673                          "Coordinates provided through a GROMOS96 file format", &
1674                          "Coordinates provided through an AMBER file format", &
1675                          "Coordinates provided through a CIF (Crystallographic Information File) file format", &
1676                          "Coordinates provided through a XTL (MSI native) file format", &
1677                          "Read the coordinates in CP2K &COORD section format from an external file. "// &
1678                          "NOTE: This file will be overwritten with the latest coordinates."), &
1679                          default_i_val=do_coord_off)
1680      CALL section_add_keyword(section, keyword)
1681      CALL keyword_release(keyword)
1682
1683      CALL keyword_create(keyword, __LOCATION__, name="NUMBER_OF_ATOMS", &
1684                          variants=s2a("NATOMS", "NATOM"), &
1685                          description="Optionally define the number of atoms read from an external file "// &
1686                          "(see COORD_FILE_NAME) if the COORD_FILE_FORMAT CP2K is used", &
1687                          repeats=.FALSE., &
1688                          n_var=1, &
1689                          type_of_var=integer_t, &
1690                          default_i_val=-1, &
1691                          usage="NATOMS 768000")
1692      CALL section_add_keyword(section, keyword)
1693      CALL keyword_release(keyword)
1694
1695      CALL connectivity_framework(section, do_conn_generate)
1696
1697      CALL keyword_create(keyword, __LOCATION__, name="DISABLE_EXCLUSION_LISTS", &
1698                          description="Do not build any exclusion lists.", &
1699                          usage="DISABLE_EXCLUSION_LISTS", &
1700                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1701      CALL section_add_keyword(section, keyword)
1702      CALL keyword_release(keyword)
1703
1704      CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_VDW", &
1705                          description="Specifies which kind of Van der Waals interaction to skip.", &
1706                          usage="EXCLUDE_VDW (1-1||1-2||1-3||1-4)", &
1707                          enum_c_vals=s2a("1-1", "1-2", "1-3", "1-4"), &
1708                          enum_i_vals=(/do_skip_11, do_skip_12, do_skip_13, do_skip_14/), &
1709                          default_i_val=do_skip_13)
1710      CALL section_add_keyword(section, keyword)
1711      CALL keyword_release(keyword)
1712
1713      CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_EI", &
1714                          description="Specifies which kind of Electrostatic interaction to skip.", &
1715                          usage="EXCLUDE_EI (1-1||1-2||1-3||1-4)", &
1716                          enum_c_vals=s2a("1-1", "1-2", "1-3", "1-4"), &
1717                          enum_i_vals=(/do_skip_11, do_skip_12, do_skip_13, do_skip_14/), &
1718                          default_i_val=do_skip_13)
1719      CALL section_add_keyword(section, keyword)
1720      CALL keyword_release(keyword)
1721
1722      CALL keyword_create(keyword, __LOCATION__, name="AUTOGEN_EXCLUDE_LISTS", &
1723                          description="When True, the exclude lists are solely based on"// &
1724                          " the bond data in the topology. The (minimal)"// &
1725                          " number of bonds between two atoms is used to"// &
1726                          " determine if the atom pair is added to an"// &
1727                          " exclusion list. When False, 1-2 exclusion is based"// &
1728                          " on bonds in the topology, 1-3 exclusion is based"// &
1729                          " on bonds and bends in the topology, 1-4 exclusion"// &
1730                          " is based on bonds, bends and dihedrals in the"// &
1731                          " topology. This implies that a missing dihedral in"// &
1732                          " the topology will cause the corresponding 1-4 pair"// &
1733                          " not to be in the exclusion list, in case 1-4"// &
1734                          " exclusion is requested for VDW or EI interactions.", &
1735                          usage="AUTOGEN_EXCLUDE_LISTS logical", &
1736                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1737      CALL section_add_keyword(section, keyword)
1738      CALL keyword_release(keyword)
1739
1740      CALL keyword_create( &
1741         keyword, __LOCATION__, name="MULTIPLE_UNIT_CELL", &
1742         description="Specifies the numbers of repetition in space (X, Y, Z) of the defined cell, "// &
1743         "assuming it as a unit cell. This keyword affects only the coordinates specification. The same keyword "// &
1744         "in SUBSYS%CELL%MULTIPLE_UNIT_CELL should be modified in order to affect the cell "// &
1745         "specification.", usage="MULTIPLE_UNIT_CELL 1 1 1", &
1746         n_var=3, default_i_vals=(/1, 1, 1/), repeats=.FALSE.)
1747      CALL section_add_keyword(section, keyword)
1748      CALL keyword_release(keyword)
1749
1750      CALL keyword_create(keyword, __LOCATION__, name="MEMORY_PROGRESSION_FACTOR", &
1751                          description="This keyword is quite technical and should normally not be changed by the user. It "// &
1752                          "affects the memory allocation during the construction of the topology. It does NOT affect the "// &
1753                          "memory used once the topology is built.", &
1754                          n_var=1, default_r_val=1.2_dp, repeats=.FALSE.)
1755      CALL section_add_keyword(section, keyword)
1756      CALL keyword_release(keyword)
1757
1758      CALL cp_print_key_section_create(print_key, __LOCATION__, "DUMP_PDB", &
1759                                       description="controls the dumping of the PDB at the starting geometry", &
1760                                       print_level=debug_print_level, filename="dump")
1761      CALL section_add_subsection(section, print_key)
1762
1763      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_OCCUP", &
1764                          variants=(/"CHARGE_O"/), &
1765                          description="Write the MM charges to the OCCUP field of the PDB file", &
1766                          usage="CHARGE_OCCUP logical", &
1767                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1768      CALL section_add_keyword(print_key, keyword)
1769      CALL keyword_release(keyword)
1770
1771      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_BETA", &
1772                          variants=(/"CHARGE_B"/), &
1773                          description="Write the MM charges to the BETA field of the PDB file", &
1774                          usage="CHARGE_BETA logical", &
1775                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1776      CALL section_add_keyword(print_key, keyword)
1777      CALL keyword_release(keyword)
1778
1779      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_EXTENDED", &
1780                          description="Write the MM charges to the very last field of the PDB file (starting from column 81)", &
1781                          usage="CHARGE_EXTENDED logical", &
1782                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1783      CALL section_add_keyword(print_key, keyword)
1784      CALL keyword_release(keyword)
1785
1786      CALL section_release(print_key)
1787
1788      CALL cp_print_key_section_create(print_key, __LOCATION__, "DUMP_PSF", &
1789                                       description="controls the dumping of the PSF connectivity", &
1790                                       print_level=debug_print_level, filename="dump")
1791      CALL section_add_subsection(section, print_key)
1792      CALL section_release(print_key)
1793
1794      NULLIFY (subsection)
1795      CALL create_exclude_list_section(subsection, "EXCLUDE_VDW_LIST")
1796      CALL section_add_subsection(section, subsection)
1797      CALL section_release(subsection)
1798
1799      CALL create_exclude_list_section(subsection, "EXCLUDE_EI_LIST")
1800      CALL section_add_subsection(section, subsection)
1801      CALL section_release(subsection)
1802
1803      CALL create_center_section(subsection)
1804      CALL section_add_subsection(section, subsection)
1805      CALL section_release(subsection)
1806
1807      CALL create_generate_section(subsection)
1808      CALL section_add_subsection(section, subsection)
1809      CALL section_release(subsection)
1810
1811      CALL create_molset_section(subsection)
1812      CALL section_add_subsection(section, subsection)
1813      CALL section_release(subsection)
1814
1815   END SUBROUTINE create_topology_section
1816
1817! **************************************************************************************************
1818!> \brief Setup a list of fine exclusion elements
1819!> \param section the section to create
1820!> \param header ...
1821!> \author Teodoro Laino [tlaino] - 12.2009
1822! **************************************************************************************************
1823   SUBROUTINE create_exclude_list_section(section, header)
1824      TYPE(section_type), POINTER                        :: section
1825      CHARACTER(LEN=*), INTENT(IN)                       :: header
1826
1827      CHARACTER(len=*), PARAMETER :: routineN = 'create_exclude_list_section', &
1828         routineP = moduleN//':'//routineN
1829
1830      TYPE(keyword_type), POINTER                        :: keyword
1831
1832      CPASSERT(.NOT. ASSOCIATED(section))
1833      NULLIFY (keyword)
1834      CALL section_create(section, __LOCATION__, TRIM(header), &
1835                          description="Speficy bonds (via atom kinds) for fine tuning of 1-2 "// &
1836                          "exclusion lists. If this section is not present the 1-2 exclusion is "// &
1837                          "applied to all bond kinds. When this section is present the 1-2 exclusion "// &
1838                          "is applied ONLY to the bonds defined herein. This section allows ONLY fine tuning of 1-2 "// &
1839                          "interactions. ", &
1840                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
1841
1842      CALL keyword_create(keyword, __LOCATION__, name="BOND", &
1843                          description="Specify the atom kinds involved in the bond for which 1-2 exclusion holds.", &
1844                          usage="BOND {KIND1} {KIND2}", type_of_var=char_t, &
1845                          n_var=2)
1846      CALL section_add_keyword(section, keyword)
1847      CALL keyword_release(keyword)
1848   END SUBROUTINE create_exclude_list_section
1849
1850! **************************************************************************************************
1851!> \brief Specify keywords used to center molecule in the box
1852!> \param section the section to create
1853!> \author Teodoro Laino [tlaino] - University of Zurich - 06.2009
1854! **************************************************************************************************
1855   SUBROUTINE create_center_section(section)
1856      TYPE(section_type), POINTER                        :: section
1857
1858      CHARACTER(len=*), PARAMETER :: routineN = 'create_center_section', &
1859         routineP = moduleN//':'//routineN
1860
1861      TYPE(keyword_type), POINTER                        :: keyword
1862
1863      CPASSERT(.NOT. ASSOCIATED(section))
1864      NULLIFY (keyword)
1865      CALL section_create(section, __LOCATION__, "CENTER_COORDINATES", &
1866                          description="Allows centering the coordinates of the system in the box. "// &
1867                          "The centering point can be defined by the user.", &
1868                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
1869
1870      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
1871                          description="Controls the activation of the centering method", &
1872                          usage="&CENTER_COORDINATES T", &
1873                          default_l_val=.FALSE., &
1874                          lone_keyword_l_val=.TRUE.)
1875      CALL section_add_keyword(section, keyword)
1876      CALL keyword_release(keyword)
1877
1878      CALL keyword_create(keyword, __LOCATION__, name="CENTER_POINT", &
1879                          description="Specify the point used for centering the coordinates. Default is to "// &
1880                          "center the system in cell/2. ", type_of_var=real_t, n_var=3, &
1881                          repeats=.FALSE.)
1882      CALL section_add_keyword(section, keyword)
1883      CALL keyword_release(keyword)
1884   END SUBROUTINE create_center_section
1885
1886! **************************************************************************************************
1887!> \brief Specify keywords used to setup several molecules with few connectivity files
1888!> \param section the section to create
1889!> \author Teodoro Laino [tlaino] - University of Zurich - 08.2008
1890! **************************************************************************************************
1891   SUBROUTINE create_molset_section(section)
1892      TYPE(section_type), POINTER                        :: section
1893
1894      CHARACTER(len=*), PARAMETER :: routineN = 'create_molset_section', &
1895         routineP = moduleN//':'//routineN
1896
1897      TYPE(keyword_type), POINTER                        :: keyword
1898      TYPE(section_type), POINTER                        :: subsection, subsubsection
1899
1900      CPASSERT(.NOT. ASSOCIATED(section))
1901      NULLIFY (keyword, subsection, subsubsection)
1902      CALL section_create(section, __LOCATION__, name="MOL_SET", &
1903                          description="Specify the connectivity of a full system specifying the connectivity"// &
1904                          " of the fragments of the system.", &
1905                          n_keywords=2, n_subsections=0, repeats=.FALSE.)
1906
1907      ! MOLECULES
1908      CALL section_create(subsection, __LOCATION__, name="MOLECULE", &
1909                          description="Specify information about the connectivity of single molecules", &
1910                          n_keywords=2, n_subsections=0, repeats=.TRUE.)
1911
1912      CALL keyword_create(keyword, __LOCATION__, name="NMOL", &
1913                          description="number of molecules ", &
1914                          usage="NMOL {integer}", default_i_val=1)
1915      CALL section_add_keyword(subsection, keyword)
1916      CALL keyword_release(keyword)
1917
1918      CALL connectivity_framework(subsection, do_conn_psf)
1919      CALL section_add_subsection(section, subsection)
1920      CALL section_release(subsection)
1921
1922      ! MERGE MOLECULES
1923      CALL section_create(subsection, __LOCATION__, name="MERGE_MOLECULES", &
1924                          description="Enables the creation of connecting bridges (bonds, angles, torsions, impropers)"// &
1925                          " between the two or more molecules defined with independent connectivity.", &
1926                          n_keywords=2, n_subsections=0, repeats=.FALSE.)
1927
1928      CALL section_create(subsubsection, __LOCATION__, name="bonds", &
1929                          description="Defines new bonds", n_keywords=2, n_subsections=0, repeats=.FALSE.)
1930      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
1931                          description="Two integer indexes per line defining the new bond."// &
1932                          " Indexes must be relative to the full system and not to the single molecules", &
1933                          repeats=.TRUE., &
1934                          usage="{Integer} {Integer}", type_of_var=integer_t, n_var=2)
1935      CALL section_add_keyword(subsubsection, keyword)
1936      CALL keyword_release(keyword)
1937      CALL section_add_subsection(subsection, subsubsection)
1938      CALL section_release(subsubsection)
1939
1940      CALL section_create(subsubsection, __LOCATION__, name="angles", &
1941                          description="Defines new angles", n_keywords=2, n_subsections=0, &
1942                          repeats=.FALSE.)
1943      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
1944                          description="Three integer indexes per line defining the new angle"// &
1945                          " Indexes must be relative to the full system and not to the single molecules", repeats=.TRUE., &
1946                          usage="{Integer} {Integer} {Integer}", type_of_var=integer_t, n_var=3)
1947      CALL section_add_keyword(subsubsection, keyword)
1948      CALL keyword_release(keyword)
1949      CALL section_add_subsection(subsection, subsubsection)
1950      CALL section_release(subsubsection)
1951
1952      CALL section_create(subsubsection, __LOCATION__, name="torsions", &
1953                          description="Defines new torsions", n_keywords=2, n_subsections=0, &
1954                          repeats=.FALSE.)
1955      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
1956                          description="Four integer indexes per line defining the new torsion"// &
1957                          " Indexes must be relative to the full system and not to the single molecules", repeats=.TRUE., &
1958                          usage="{Integer} {Integer} {Integer} {Integer}", type_of_var=integer_t, n_var=4)
1959      CALL section_add_keyword(subsubsection, keyword)
1960      CALL keyword_release(keyword)
1961      CALL section_add_subsection(subsection, subsubsection)
1962      CALL section_release(subsubsection)
1963
1964      CALL section_create(subsubsection, __LOCATION__, name="impropers", &
1965                          description="Defines new impropers", n_keywords=2, n_subsections=0, &
1966                          repeats=.FALSE.)
1967      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
1968                          description="Four integer indexes per line defining the new improper"// &
1969                          " Indexes must be relative to the full system and not to the single molecules", repeats=.TRUE., &
1970                          usage="{Integer} {Integer} {Integer} {Integer}", type_of_var=integer_t, n_var=4)
1971      CALL section_add_keyword(subsubsection, keyword)
1972      CALL keyword_release(keyword)
1973      CALL section_add_subsection(subsection, subsubsection)
1974      CALL section_release(subsubsection)
1975
1976      CALL section_add_subsection(section, subsection)
1977      CALL section_release(subsection)
1978
1979   END SUBROUTINE create_molset_section
1980
1981! **************************************************************************************************
1982!> \brief Specify keywords used to generate connectivity
1983!> \param section the section to create
1984!> \author Teodoro Laino [tlaino] - University of Zurich - 08.2008
1985! **************************************************************************************************
1986   SUBROUTINE create_generate_section(section)
1987      TYPE(section_type), POINTER                        :: section
1988
1989      CHARACTER(len=*), PARAMETER :: routineN = 'create_generate_section', &
1990         routineP = moduleN//':'//routineN
1991
1992      TYPE(keyword_type), POINTER                        :: keyword
1993      TYPE(section_type), POINTER                        :: subsection
1994
1995      CPASSERT(.NOT. ASSOCIATED(section))
1996      NULLIFY (keyword, subsection)
1997      CALL section_create(section, __LOCATION__, name="GENERATE", &
1998                          description="Setup of keywords controlling the generation of the connectivity", &
1999                          n_keywords=2, n_subsections=0, repeats=.TRUE.)
2000
2001      CALL keyword_create(keyword, __LOCATION__, name="REORDER", &
2002                          description="Reorder a list of atomic coordinates into order so it can be packed correctly.", &
2003                          usage="REORDER <LOGICAL>", &
2004                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
2005      CALL section_add_keyword(section, keyword)
2006      CALL keyword_release(keyword)
2007
2008      CALL keyword_create(keyword, __LOCATION__, name="CREATE_MOLECULES", &
2009                          description="Create molecules names and definition. Can be used to override the "// &
2010                          " molecules specifications of a possible input connectivity or to create molecules"// &
2011                          " specifications for file types as XYZ, missing of molecules definitions.", &
2012                          usage="CREATE_MOLECULES <LOGICAL>", &
2013                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
2014      CALL section_add_keyword(section, keyword)
2015      CALL keyword_release(keyword)
2016
2017      CALL keyword_create(keyword, __LOCATION__, name="BONDPARM", &
2018                          description="Used in conjunction with BONDPARM_FACTOR to "// &
2019                          "help determine wheather there is bonding "// &
2020                          "between two atoms based on a distance criteria. "// &
2021                          "Can use covalent radii information or VDW radii information", &
2022                          usage="BONDPARM (COVALENT||VDW)", &
2023                          enum_c_vals=s2a("COVALENT", "VDW"), &
2024                          enum_i_vals=(/do_bondparm_covalent, do_bondparm_vdw/), &
2025                          default_i_val=do_bondparm_covalent)
2026      CALL section_add_keyword(section, keyword)
2027      CALL keyword_release(keyword)
2028
2029      CALL keyword_create(keyword, __LOCATION__, name="BONDPARM_FACTOR", &
2030                          description="Used in conjunction with BONDPARM to help "// &
2031                          "determine wheather there is bonding between "// &
2032                          "two atoms based on a distance criteria.", &
2033                          usage="bondparm_factor {real}", default_r_val=1.1_dp)
2034      CALL section_add_keyword(section, keyword)
2035      CALL keyword_release(keyword)
2036
2037      CALL keyword_create(keyword, __LOCATION__, name="BONDLENGTH_MAX", &
2038                          description="Maximum distance to generate neighbor lists to build connectivity", &
2039                          usage="BONDLENGTH_MAX <real>", default_r_val=cp_unit_to_cp2k(value=3.0_dp, &
2040                                                                                       unit_str="angstrom"), unit_str="angstrom")
2041      CALL section_add_keyword(section, keyword)
2042      CALL keyword_release(keyword)
2043
2044      CALL keyword_create(keyword, __LOCATION__, name="BONDLENGTH_MIN", &
2045                          description="Minimum distance to generate neighbor lists to build connectivity", &
2046                          usage="BONDLENGTH_MIN <real>", default_r_val=cp_unit_to_cp2k(value=0.01_dp, &
2047                                                                                       unit_str="angstrom"), unit_str="angstrom")
2048      CALL section_add_keyword(section, keyword)
2049      CALL keyword_release(keyword)
2050
2051      ! BONDS
2052      CALL section_create(subsection, __LOCATION__, name="BOND", &
2053                          description="Section used to add/remove  bonds in the connectivity."// &
2054                          " Useful for systems with a complex connectivity, difficult to find out automatically.", &
2055                          n_keywords=1, n_subsections=0, repeats=.TRUE.)
2056
2057      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
2058                          description="controls the activation of the bond", &
2059                          usage="&BOND (ADD|REMOVE)", &
2060                          enum_c_vals=s2a("ADD", "REMOVE"), &
2061                          enum_i_vals=(/do_add, do_remove/), &
2062                          default_i_val=do_add)
2063      CALL section_add_keyword(subsection, keyword)
2064      CALL keyword_release(keyword)
2065
2066      CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
2067                          description="Specifies two atomic index united by a covalent bond", &
2068                          usage="ATOMS {integer} {integer}", type_of_var=integer_t, n_var=2, &
2069                          repeats=.TRUE.)
2070      CALL section_add_keyword(subsection, keyword)
2071      CALL keyword_release(keyword)
2072
2073      CALL section_add_subsection(section, subsection)
2074      CALL section_release(subsection)
2075
2076      ! ANGLES
2077      CALL section_create(subsection, __LOCATION__, name="ANGLE", &
2078                          description="Section used to add/remove angles in the connectivity."// &
2079                          " Useful for systems with a complex connectivity, difficult to find out automatically.", &
2080                          n_keywords=1, n_subsections=0, repeats=.TRUE.)
2081
2082      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
2083                          description="controls the activation of the bond", &
2084                          usage="&ANGLE (ADD|REMOVE)", &
2085                          enum_c_vals=s2a("ADD", "REMOVE"), &
2086                          enum_i_vals=(/do_add, do_remove/), &
2087                          default_i_val=do_add)
2088      CALL section_add_keyword(subsection, keyword)
2089      CALL keyword_release(keyword)
2090
2091      CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
2092                          description="Specifies two atomic index united by a covalent bond", &
2093                          usage="ATOMS {integer} {integer} {integer} ", type_of_var=integer_t, n_var=3, &
2094                          repeats=.TRUE.)
2095      CALL section_add_keyword(subsection, keyword)
2096      CALL keyword_release(keyword)
2097
2098      CALL section_add_subsection(section, subsection)
2099      CALL section_release(subsection)
2100
2101      ! TORSIONS
2102      CALL section_create(subsection, __LOCATION__, name="TORSION", &
2103                          description="Section used to add/remove torsion in the connectivity."// &
2104                          " Useful for systems with a complex connectivity, difficult to find out automatically.", &
2105                          n_keywords=1, n_subsections=0, repeats=.TRUE.)
2106
2107      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
2108                          description="controls the activation of the bond", &
2109                          usage="&TORSION (ADD|REMOVE)", &
2110                          enum_c_vals=s2a("ADD", "REMOVE"), &
2111                          enum_i_vals=(/do_add, do_remove/), &
2112                          default_i_val=do_add)
2113      CALL section_add_keyword(subsection, keyword)
2114      CALL keyword_release(keyword)
2115
2116      CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
2117                          description="Specifies two atomic index united by a covalent bond", &
2118                          usage="ATOMS {integer} {integer} {integer} {integer} ", type_of_var=integer_t, n_var=4, &
2119                          repeats=.TRUE.)
2120      CALL section_add_keyword(subsection, keyword)
2121      CALL keyword_release(keyword)
2122
2123      CALL section_add_subsection(section, subsection)
2124      CALL section_release(subsection)
2125
2126      ! IMPROPERS
2127      CALL section_create(subsection, __LOCATION__, name="IMPROPER", &
2128                          description="Section used to add/remove improper in the connectivity."// &
2129                          " Useful for systems with a complex connectivity, difficult to find out automatically.", &
2130                          n_keywords=1, n_subsections=0, repeats=.TRUE.)
2131
2132      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
2133                          description="controls the activation of the bond", &
2134                          usage="&IMPROPER (ADD|REMOVE)", &
2135                          enum_c_vals=s2a("ADD", "REMOVE"), &
2136                          enum_i_vals=(/do_add, do_remove/), &
2137                          default_i_val=do_add)
2138      CALL section_add_keyword(subsection, keyword)
2139      CALL keyword_release(keyword)
2140
2141      CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
2142                          description="Specifies two atomic index united by a covalent bond", &
2143                          usage="ATOMS {integer} {integer} {integer} {integer} ", type_of_var=integer_t, n_var=4, &
2144                          repeats=.TRUE.)
2145      CALL section_add_keyword(subsection, keyword)
2146      CALL keyword_release(keyword)
2147
2148      CALL section_add_subsection(section, subsection)
2149      CALL section_release(subsection)
2150
2151      ! ISOLATED ATOMS
2152      CALL section_create(subsection, __LOCATION__, name="ISOLATED_ATOMS", &
2153                          description=" This section specifies the  atoms that one considers isolated. Useful when present "// &
2154                          " ions in solution.", n_keywords=1, n_subsections=0, repeats=.FALSE.)
2155      CALL keyword_create(keyword, __LOCATION__, name="LIST", &
2156                          description="Specifies a list of atomic indexes of the isolated ion", &
2157                          usage="LIST {integer}", type_of_var=integer_t, n_var=-1, &
2158                          repeats=.TRUE.)
2159      CALL section_add_keyword(subsection, keyword)
2160      CALL keyword_release(keyword)
2161
2162      CALL section_add_subsection(section, subsection)
2163      CALL section_release(subsection)
2164
2165      ! Neighbor lists keys and printing handling the construction of NL for the connectivity
2166      CALL create_neighbor_lists_section(subsection)
2167      CALL section_add_subsection(section, subsection)
2168      CALL section_release(subsection)
2169
2170      CALL create_gen_print_section(subsection)
2171      CALL section_add_subsection(section, subsection)
2172      CALL section_release(subsection)
2173
2174   END SUBROUTINE create_generate_section
2175
2176! **************************************************************************************************
2177!> \brief Create the print gen section
2178!> \param section the section to create
2179!> \author teo
2180! **************************************************************************************************
2181   SUBROUTINE create_gen_print_section(section)
2182      TYPE(section_type), POINTER                        :: section
2183
2184      CHARACTER(len=*), PARAMETER :: routineN = 'create_gen_print_section', &
2185         routineP = moduleN//':'//routineN
2186
2187      TYPE(section_type), POINTER                        :: print_key
2188
2189      CPASSERT(.NOT. ASSOCIATED(section))
2190      CALL section_create(section, __LOCATION__, name="print", &
2191                          description="Section of possible print options in GENERATE code.", &
2192                          n_keywords=0, n_subsections=1, repeats=.FALSE.)
2193
2194      NULLIFY (print_key)
2195      CALL cp_print_key_section_create(print_key, __LOCATION__, "NEIGHBOR_LISTS", &
2196                                       description="Activates the printing of the neighbor lists used"// &
2197                                       " for generating the connectivity.", print_level=high_print_level, &
2198                                       filename="", unit_str="angstrom")
2199      CALL section_add_subsection(section, print_key)
2200      CALL section_release(print_key)
2201
2202      CALL cp_print_key_section_create(print_key, __LOCATION__, "SUBCELL", &
2203                                       description="Activates the printing of the subcells used for the"// &
2204                                       "generation of neighbor lists for connectivity.", &
2205                                       print_level=high_print_level, filename="__STD_OUT__")
2206      CALL section_add_subsection(section, print_key)
2207      CALL section_release(print_key)
2208
2209   END SUBROUTINE create_gen_print_section
2210
2211! **************************************************************************************************
2212!> \brief Specify keywords used to define connectivity
2213!> \param section the section to create
2214!> \param default ...
2215!> \author teo
2216! **************************************************************************************************
2217   SUBROUTINE connectivity_framework(section, default)
2218      TYPE(section_type), POINTER                        :: section
2219      INTEGER, INTENT(IN)                                :: default
2220
2221      CHARACTER(len=*), PARAMETER :: routineN = 'connectivity_framework', &
2222         routineP = moduleN//':'//routineN
2223
2224      TYPE(keyword_type), POINTER                        :: keyword
2225
2226      CPASSERT(ASSOCIATED(section))
2227      NULLIFY (keyword)
2228      CALL keyword_create(keyword, __LOCATION__, name="CONN_FILE_NAME", &
2229                          variants=(/"CONN_FILE"/), &
2230                          description="Specifies the filename that contains the molecular connectivity.", &
2231                          usage="CONN_FILE_NAME <FILENAME>", type_of_var=lchar_t)
2232      CALL section_add_keyword(section, keyword)
2233      CALL keyword_release(keyword)
2234
2235      CALL keyword_create(keyword, __LOCATION__, name="CONN_FILE_FORMAT", &
2236                          variants=(/"CONNECTIVITY"/), &
2237                          description="Ways to determine and generate a molecules. "// &
2238                          "Default is to use GENERATE", &
2239                          usage="CONN_FILE_FORMAT (PSF|UPSF|MOL_SET|GENERATE|OFF|G87|G96|AMBER|USER)", &
2240                          enum_c_vals=s2a("PSF", "UPSF", "MOL_SET", "GENERATE", "OFF", "G87", "G96", "AMBER", "USER"), &
2241                          enum_i_vals=(/do_conn_psf, &
2242                                        do_conn_psf_u, &
2243                                        do_conn_mol_set, &
2244                                        do_conn_generate, &
2245                                        do_conn_off, &
2246                                        do_conn_g87, &
2247                                        do_conn_g96, &
2248                                        do_conn_amb7, &
2249                                        do_conn_user/), &
2250                          enum_desc=s2a("Use  a PSF file to determine the connectivity."// &
2251                                        " (support standard CHARMM/XPLOR and EXT CHARMM)", &
2252                                        "Read a PSF file in an unformatted way (useful for not so standard PSF).", &
2253                                        "Use multiple PSF (for now...) files to generate the whole system.", &
2254                                        "Use a simple distance criteria. (Look at keyword BONDPARM)", &
2255                                        "Do not generate molecules. (e.g. for QS or ill defined systems)", &
2256                                        "Use GROMOS G87 topology file.", &
2257                                        "Use GROMOS G96 topology file.", &
2258                                        "Use AMBER topology file for reading connectivity (compatible starting from AMBER V.7)", &
2259                                        "Allows the definition of molecules and residues based on the 5th and 6th column of "// &
2260                                        "the COORD section. This option can be handy for the definition of molecules with QS "// &
2261                                        "or to save memory in the case of very large systems (use PARA_RES off)."), &
2262                          default_i_val=default)
2263      CALL section_add_keyword(section, keyword)
2264      CALL keyword_release(keyword)
2265   END SUBROUTINE connectivity_framework
2266
2267! **************************************************************************************************
2268!> \brief      Create CP2K input section for the DFT+U method parameters
2269!> \param section ...
2270!> \date       01.11.2007
2271!> \author     Matthias Krack (MK)
2272!> \version    1.0
2273! **************************************************************************************************
2274   SUBROUTINE create_dft_plus_u_section(section)
2275
2276      TYPE(section_type), POINTER                        :: section
2277
2278      CHARACTER(LEN=*), PARAMETER :: routineN = 'create_dft_plus_u_section', &
2279         routineP = moduleN//':'//routineN
2280
2281      TYPE(keyword_type), POINTER                        :: keyword
2282      TYPE(section_type), POINTER                        :: subsection
2283
2284      CPASSERT(.NOT. ASSOCIATED(section))
2285
2286      CALL section_create(section, __LOCATION__, &
2287                          name="DFT_PLUS_U", &
2288                          description="Define the parameters for a DFT+U run", &
2289                          n_keywords=3, &
2290                          n_subsections=1, &
2291                          repeats=.FALSE.)
2292
2293      NULLIFY (keyword)
2294
2295      CALL keyword_create(keyword, __LOCATION__, &
2296                          name="_SECTION_PARAMETERS_", &
2297                          description="Controls the activation of the DFT+U section", &
2298                          usage="&DFT_PLUS_U ON", &
2299                          default_l_val=.FALSE., &
2300                          lone_keyword_l_val=.TRUE.)
2301      CALL section_add_keyword(section, keyword)
2302      CALL keyword_release(keyword)
2303
2304      CALL keyword_create(keyword, __LOCATION__, &
2305                          name="L", &
2306                          description="Angular momentum quantum number of the"// &
2307                          "orbitals to which the correction is applied", &
2308                          repeats=.FALSE., &
2309                          n_var=1, &
2310                          type_of_var=integer_t, &
2311                          default_i_val=-1, &
2312                          usage="L 2")
2313      CALL section_add_keyword(section, keyword)
2314      CALL keyword_release(keyword)
2315
2316      CALL keyword_create(keyword, __LOCATION__, &
2317                          name="U_MINUS_J", &
2318                          description="Effective parameter U(eff) = U - J", &
2319                          repeats=.FALSE., &
2320                          n_var=1, &
2321                          type_of_var=real_t, &
2322                          default_r_val=0.0_dp, &
2323                          unit_str="au_e", &
2324                          usage="U_MINUS_J [eV] 1.4")
2325      CALL section_add_keyword(section, keyword)
2326      CALL keyword_release(keyword)
2327
2328      CALL keyword_create(keyword, __LOCATION__, &
2329                          name="U_RAMPING", &
2330                          description="Increase the effective U parameter stepwise using the specified "// &
2331                          "increment until the target value given by U_MINUS_J is reached.", &
2332                          repeats=.FALSE., &
2333                          n_var=1, &
2334                          type_of_var=real_t, &
2335                          default_r_val=0.0_dp, &
2336                          unit_str="au_e", &
2337                          usage="U_RAMPING [eV] 0.1")
2338      CALL section_add_keyword(section, keyword)
2339      CALL keyword_release(keyword)
2340
2341      CALL keyword_create(keyword, __LOCATION__, &
2342                          name="EPS_U_RAMPING", &
2343                          description="Threshold value (SCF convergence) for incrementing the effective "// &
2344                          "U value when U ramping is active.", &
2345                          repeats=.FALSE., &
2346                          n_var=1, &
2347                          type_of_var=real_t, &
2348                          default_r_val=1.0E-5_dp, &
2349                          usage="EPS_U_RAMPING 1.0E-6")
2350      CALL section_add_keyword(section, keyword)
2351      CALL keyword_release(keyword)
2352
2353      CALL keyword_create(keyword, __LOCATION__, &
2354                          name="INIT_U_RAMPING_EACH_SCF", &
2355                          description="Set the initial U ramping value to zero before each wavefunction optimisation. "// &
2356                          "The default is to apply U ramping only for the initial wavefunction optimisation.", &
2357                          repeats=.FALSE., &
2358                          default_l_val=.FALSE., &
2359                          lone_keyword_l_val=.TRUE., &
2360                          usage="INIT_U_RAMPING_EACH_SCF on")
2361      CALL section_add_keyword(section, keyword)
2362      CALL keyword_release(keyword)
2363
2364      NULLIFY (subsection)
2365
2366      CALL section_create(subsection, __LOCATION__, &
2367                          name="ENFORCE_OCCUPATION", &
2368                          description="Enforce and control a special (initial) orbital occupation. "// &
2369                          "Note, this feature works only for the methods MULLIKEN and LOWDIN. "// &
2370                          "It should only be used to prepare an initial configuration. An "// &
2371                          "inadequate parameter choice can easily inhibit SCF convergence.", &
2372                          n_keywords=5, &
2373                          n_subsections=0, &
2374                          repeats=.FALSE.)
2375
2376      CALL keyword_create(keyword, __LOCATION__, &
2377                          name="_SECTION_PARAMETERS_", &
2378                          description="Controls the activation of the ENFORCE_OCCUPATION section", &
2379                          usage="&ENFORCE_OCCUPATION ON", &
2380                          default_l_val=.FALSE., &
2381                          lone_keyword_l_val=.TRUE.)
2382      CALL section_add_keyword(subsection, keyword)
2383      CALL keyword_release(keyword)
2384
2385      CALL keyword_create(keyword, __LOCATION__, name="NELEC", &
2386                          variants=(/"N_ELECTRONS"/), &
2387                          description="Number of alpha and beta electrons. An occupation (per spin) smaller than 0.5 is ignored.", &
2388                          repeats=.FALSE., &
2389                          n_var=-1, &
2390                          type_of_var=real_t, &
2391                          default_r_val=0.0_dp, &
2392                          usage="NELEC 5.0 4.0")
2393      CALL section_add_keyword(subsection, keyword)
2394      CALL keyword_release(keyword)
2395
2396      CALL keyword_create(keyword, __LOCATION__, &
2397                          name="ORBITALS", &
2398                          variants=(/"M"/), &
2399                          description="Select orbitals and occupation order. An input of 1 to 2*L+1 integer values in "// &
2400                          "the range -L to L defining the M values of the spherical orbitals is expected.", &
2401                          repeats=.FALSE., &
2402                          n_var=-1, &
2403                          type_of_var=integer_t, &
2404                          default_i_val=0, &
2405                          usage="ORBITALS 0 +1 -1")
2406      CALL section_add_keyword(subsection, keyword)
2407      CALL keyword_release(keyword)
2408
2409      CALL keyword_create(keyword, __LOCATION__, &
2410                          name="EPS_SCF", &
2411                          description="The occupation constraint is enforced until this threshold value "// &
2412                          "for the SCF convergence criterion is reached", &
2413                          repeats=.FALSE., &
2414                          n_var=1, &
2415                          type_of_var=real_t, &
2416                          default_r_val=1.0E30_dp, &
2417                          usage="EPS_SCF 0.001")
2418      CALL section_add_keyword(subsection, keyword)
2419      CALL keyword_release(keyword)
2420
2421      CALL keyword_create(keyword, __LOCATION__, &
2422                          name="MAX_SCF", &
2423                          description="The occupation constraint is applied for this number of initial SCF iterations", &
2424                          repeats=.FALSE., &
2425                          n_var=1, &
2426                          type_of_var=integer_t, &
2427                          default_i_val=-1, &
2428                          usage="MAX_SCF 5")
2429      CALL section_add_keyword(subsection, keyword)
2430      CALL keyword_release(keyword)
2431
2432      CALL keyword_create(keyword, __LOCATION__, &
2433                          name="SMEAR", &
2434                          description="The occupation constraint is applied with smearing", &
2435                          repeats=.FALSE., &
2436                          default_l_val=.FALSE., &
2437                          lone_keyword_l_val=.TRUE., &
2438                          usage="SMEAR ON")
2439      CALL section_add_keyword(subsection, keyword)
2440      CALL keyword_release(keyword)
2441
2442      CALL section_add_subsection(section, subsection)
2443      CALL section_release(subsection)
2444
2445   END SUBROUTINE create_dft_plus_u_section
2446
2447END MODULE input_cp2k_subsys
2448