1!--------------------------------------------------------------------------------------------------!
2!   CP2K: A general program to perform molecular dynamics simulations                              !
3!   Copyright (C) 2000 - 2019  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(keyword, __LOCATION__, name="AUX_BASIS_SET", &
1091                          variants=s2a("AUXILIARY_BASIS_SET", "AUX_BASIS"), &
1092                          description="DEPRECATED (use BASIS_SET): The auxiliary basis set (GTO type)", &
1093                          usage="AUX_BASIS_SET DZVP", default_c_val=" ", &
1094                          n_var=1)
1095      CALL section_add_keyword(section, keyword)
1096      CALL keyword_release(keyword)
1097
1098      CALL keyword_create(keyword, __LOCATION__, name="RI_AUX_BASIS_SET", &
1099                          variants=s2a("RI_MP2_BASIS_SET", "RI_RPA_BASIS_SET", "RI_AUX_BASIS"), &
1100                          description="DEPRECATED (use BASIS_SET): The RI auxiliary basis set used in WF_CORRELATION (GTO type)", &
1101                          usage="RI_AUX_BASIS_SET DZVP", default_c_val=" ", &
1102                          n_var=1)
1103      CALL section_add_keyword(section, keyword)
1104      CALL keyword_release(keyword)
1105
1106      CALL keyword_create(keyword, __LOCATION__, name="LRI_BASIS_SET", &
1107                          variants=s2a("LRI_BASIS"), &
1108                          description="DEPRECATED (use BASIS_SET): The local resolution of identity basis set (GTO type)", &
1109                          usage="", default_c_val=" ", &
1110                          n_var=1)
1111      CALL section_add_keyword(section, keyword)
1112      CALL keyword_release(keyword)
1113
1114      CALL keyword_create( &
1115         keyword, __LOCATION__, name="AUX_FIT_BASIS_SET", &
1116         variants=s2a("AUXILIARY_FIT_BASIS_SET", "AUX_FIT_BASIS"), &
1117         description="DEPRECATED (use BASIS_SET): The auxiliary basis set (GTO type) for auxiliary density matrix method", &
1118         usage="AUX_FIT_BASIS_SET DZVP", default_c_val=" ", &
1119         citations=(/Guidon2010/), &
1120         n_var=1)
1121      CALL section_add_keyword(section, keyword)
1122      CALL keyword_release(keyword)
1123      ! end of old basis set keywords
1124
1125      CALL keyword_create(keyword, __LOCATION__, name="ELEC_CONF", &
1126                          description="Specifies the electronic configuration used in construction the "// &
1127                          "atomic initial guess (see the pseudo potential file for the default values).", &
1128                          usage="ELEC_COND n_elec(s)  n_elec(p)  n_elec(d)  ... ", &
1129                          n_var=-1, type_of_var=integer_t)
1130      CALL section_add_keyword(section, keyword)
1131      CALL keyword_release(keyword)
1132
1133      CALL keyword_create(keyword, __LOCATION__, name="CORE_CORRECTION", &
1134                          description="Corrects the effective nuclear charge", &
1135                          usage="CORE_CORRECTION 1.0", n_var=1, &
1136                          default_r_val=0.0_dp)
1137      CALL section_add_keyword(section, keyword)
1138      CALL keyword_release(keyword)
1139
1140      CALL keyword_create(keyword, __LOCATION__, name="MAGNETIZATION", &
1141                          description="The magnetization used in the atomic initial guess. "// &
1142                          "Adds magnetization/2 spin-alpha electrons and removes magnetization/2 spin-beta electrons.", &
1143                          usage="MAGNETIZATION 0.5", n_var=1, &
1144                          default_r_val=0.0_dp)
1145      CALL section_add_keyword(section, keyword)
1146      CALL keyword_release(keyword)
1147
1148      CALL keyword_create(keyword, __LOCATION__, name="ELEMENT", &
1149                          variants=(/"ELEMENT_SYMBOL"/), &
1150                          description="The element of the actual kind "// &
1151                          "(if not given it is inferred from the kind name)", &
1152                          usage="ELEMENT O", type_of_var=char_t, n_var=1)
1153      CALL section_add_keyword(section, keyword)
1154      CALL keyword_release(keyword)
1155
1156      CALL keyword_create(keyword, __LOCATION__, name="MASS", &
1157                          variants=s2a("ATOMIC_MASS", "ATOMIC_WEIGHT", "WEIGHT"), &
1158                          description="The mass of the atom "// &
1159                          "(if negative or non present it is inferred from the element symbol)", &
1160                          usage="MASS 2.0", type_of_var=real_t, n_var=1)
1161      CALL section_add_keyword(section, keyword)
1162      CALL keyword_release(keyword)
1163
1164      CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_FILE_NAME", &
1165                          description="The name of the file where to find this kinds pseudopotential."// &
1166                          " Default file is specified in DFT section.", &
1167                          usage="POTENTIAL_FILE_NAME <PSEUDO-POTENTIAL-FILE-NAME>", default_c_val="-", n_var=1)
1168      CALL section_add_keyword(section, keyword)
1169      CALL keyword_release(keyword)
1170
1171      CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_TYPE", &
1172                          description="The type of this kinds pseudopotential (ECP, ALL, GTH, UPS).", &
1173                          usage="POTENTIAL_TYPE <TYPE>", default_c_val="", n_var=1)
1174      CALL section_add_keyword(section, keyword)
1175      CALL keyword_release(keyword)
1176
1177      CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL", &
1178                          variants=(/"POT"/), &
1179                          description="The type and name of the pseudopotential for the defined kind.", &
1180                          usage="POTENTIAL [type] <POTENTIAL-NAME>", type_of_var=char_t, default_c_vals=(/" ", " "/), &
1181                          citations=(/Goedecker1996, Hartwigsen1998, Krack2005/), n_var=-1)
1182      CALL section_add_keyword(section, keyword)
1183      CALL keyword_release(keyword)
1184
1185      CALL keyword_create(keyword, __LOCATION__, name="KG_POTENTIAL_FILE_NAME", &
1186                          description="The name of the file where to find this kinds KG potential."// &
1187                          " Default file is specified in DFT section.", &
1188                          usage="KG_POTENTIAL_FILE_NAME <POTENTIAL-FILE-NAME>", default_c_val="-", n_var=1)
1189      CALL section_add_keyword(section, keyword)
1190      CALL keyword_release(keyword)
1191
1192      CALL keyword_create(keyword, __LOCATION__, name="KG_POTENTIAL", &
1193                          variants=(/"KG_POT"/), &
1194                          description="The name of the non-additive atomic kinetic energy potential.", &
1195                          usage="KG_POTENTIAL <TNADD-POTENTIAL-NAME>", default_c_val="NONE", n_var=1)
1196      CALL section_add_keyword(section, keyword)
1197      CALL keyword_release(keyword)
1198
1199      CALL keyword_create(keyword, __LOCATION__, name="HARD_EXP_RADIUS", &
1200                          description="The region where the hard density is supposed to be confined"// &
1201                          " (GAPW) (in Bohr, default is 1.2 for H and 1.512 otherwise)", &
1202                          usage="HARD_EXP_RADIUS 0.9", type_of_var=real_t, n_var=1)
1203      CALL section_add_keyword(section, keyword)
1204      CALL keyword_release(keyword)
1205
1206      CALL keyword_create(keyword, __LOCATION__, name="MAX_RAD_LOCAL", &
1207                          description="Max radius for the basis functions used to"// &
1208                          " generate the local projectors in GAPW [Bohr]", &
1209                          usage="MAX_RAD_LOCAL 15.0", default_r_val=13.0_dp*bohr)
1210      CALL section_add_keyword(section, keyword)
1211      CALL keyword_release(keyword)
1212
1213      CALL keyword_create(keyword, __LOCATION__, name="RHO0_EXP_RADIUS", &
1214                          description="the radius which defines the atomic region where "// &
1215                          "the hard compensation density is confined."// &
1216                          "should be less than HARD_EXP_RADIUS (GAPW) (Bohr, default equals HARD_EXP_RADIUS)", &
1217                          usage="RHO_EXP_RADIUS 0.9", type_of_var=real_t, n_var=1)
1218      CALL section_add_keyword(section, keyword)
1219      CALL keyword_release(keyword)
1220
1221      CALL keyword_create(keyword, __LOCATION__, name="LEBEDEV_GRID", &
1222                          description="The number of points for the angular part of "// &
1223                          "the local grid (GAPW)", &
1224                          usage="LEBEDEV_GRID 40", default_i_val=50)
1225      CALL section_add_keyword(section, keyword)
1226      CALL keyword_release(keyword)
1227
1228      CALL keyword_create(keyword, __LOCATION__, name="RADIAL_GRID", &
1229                          description="The number of points for the radial part of "// &
1230                          "the local grid (GAPW)", &
1231                          usage="RADIAL_GRID 70", default_i_val=50)
1232      CALL section_add_keyword(section, keyword)
1233      CALL keyword_release(keyword)
1234
1235      CALL keyword_create(keyword, __LOCATION__, name="MM_RADIUS", &
1236                          description="Defines the radius of the electrostatic multipole "// &
1237                          "of the atom in Fist. This radius applies to the charge, the "// &
1238                          "dipole and the quadrupole. When zero, the atom is treated as "// &
1239                          "a point multipole, otherwise it is treated as a Gaussian "// &
1240                          "charge distribution with the given radius: "// &
1241                          "p(x,y,z)*N*exp(-(x**2+y**2+z**2)/(2*MM_RADIUS**2)), where N is "// &
1242                          "a normalization constant. In the core-shell model, only the "// &
1243                          "shell is treated as a Gaussian and the core is always a point "// &
1244                          "charge.", &
1245                          usage="MM_RADIUS {real}", default_r_val=0.0_dp, type_of_var=real_t, &
1246                          unit_str="angstrom", n_var=1)
1247      CALL section_add_keyword(section, keyword)
1248      CALL keyword_release(keyword)
1249
1250      CALL keyword_create(keyword, __LOCATION__, name="DFTB3_PARAM", &
1251                          description="The third order parameter (derivative of hardness) used in "// &
1252                          "diagonal DFTB3 correction.", &
1253                          usage="DFTB3_PARAM 0.2", default_r_val=0.0_dp)
1254      CALL section_add_keyword(section, keyword)
1255      CALL keyword_release(keyword)
1256
1257      CALL keyword_create(keyword, __LOCATION__, name="LMAX_DFTB", &
1258                          description="The maximum l-quantum number of the DFTB basis for this kind.", &
1259                          usage="LMAX_DFTB 1", default_i_val=-1)
1260      CALL section_add_keyword(section, keyword)
1261      CALL keyword_release(keyword)
1262
1263      CALL keyword_create(keyword, __LOCATION__, name="MAO", &
1264                          description="The number of MAOs (Modified Atomic Orbitals) for this kind.", &
1265                          usage="MAO 4", default_i_val=-1)
1266      CALL section_add_keyword(section, keyword)
1267      CALL keyword_release(keyword)
1268
1269      ! Logicals
1270      CALL keyword_create(keyword, __LOCATION__, name="SE_P_ORBITALS_ON_H", &
1271                          description="Forces the usage of p-orbitals on H for SEMI-EMPIRICAL calculations. "// &
1272                          " This keyword applies only when the KIND is specifying an Hydrogen element."// &
1273                          " It is ignored in all other cases. ", &
1274                          usage="SE_P_ORBITALS_ON_H", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1275      CALL section_add_keyword(section, keyword)
1276      CALL keyword_release(keyword)
1277
1278      CALL keyword_create(keyword, __LOCATION__, name="GPW_TYPE", &
1279                          description="Force one type to be treated by the GPW scheme,"// &
1280                          " whatever are its primitives, even if the GAPW method is used", &
1281                          usage="GPW_TYPE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1282      CALL section_add_keyword(section, keyword)
1283      CALL keyword_release(keyword)
1284
1285      CALL keyword_create(keyword, __LOCATION__, &
1286                          name="GHOST", &
1287                          description="This keyword makes all atoms of this kind "// &
1288                          "ghost atoms, i.e. without pseudo or nuclear charge. "// &
1289                          "Useful to just have the basis set at that position (e.g. BSSE calculations), "// &
1290                          "or to have a non-interacting particle with BASIS_SET NONE", &
1291                          usage="GHOST", &
1292                          default_l_val=.FALSE., &
1293                          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="FLOATING_BASIS_CENTER", &
1299                          description="This keyword makes all atoms of this kind "// &
1300                          "floating functions, i.e. without pseudo or nuclear charge"// &
1301                          " which are subject to a geometry optimization in the outer SCF.", &
1302                          usage="FLOATING_BASIS_CENTER", &
1303                          default_l_val=.FALSE., &
1304                          lone_keyword_l_val=.TRUE.)
1305      CALL section_add_keyword(section, keyword)
1306      CALL keyword_release(keyword)
1307
1308      CALL keyword_create(keyword, __LOCATION__, &
1309                          name="NO_OPTIMIZE", &
1310                          description="Skip optimization of this type (used in specific basis set or"// &
1311                          " potential optimization schemes)", &
1312                          usage="NO_OPTIMIZE", &
1313                          default_l_val=.FALSE., &
1314                          lone_keyword_l_val=.TRUE.)
1315      CALL section_add_keyword(section, keyword)
1316      CALL keyword_release(keyword)
1317
1318      CALL keyword_create(keyword, __LOCATION__, name="PAO_BASIS_SIZE", &
1319                          description="The block size used for the polarized atomic orbital basis. "// &
1320                          "Setting PAO_BASIS_SIZE to the size of the primary basis or to a value "// &
1321                          "below one will disables the PAO method for the given atomic kind. "// &
1322                          "By default PAO is disbabled.", default_i_val=0)
1323      CALL section_add_keyword(section, keyword)
1324      CALL keyword_release(keyword)
1325
1326      NULLIFY (subsection)
1327      CALL create_pao_potential_section(subsection)
1328      CALL section_add_subsection(section, subsection)
1329      CALL section_release(subsection)
1330
1331      CALL create_pao_descriptor_section(subsection)
1332      CALL section_add_subsection(section, subsection)
1333      CALL section_release(subsection)
1334
1335      CALL create_basis_section(subsection)
1336      CALL section_add_subsection(section, subsection)
1337      CALL section_release(subsection)
1338
1339      CALL create_potential_section(subsection)
1340      CALL section_add_subsection(section, subsection)
1341      CALL section_release(subsection)
1342
1343      CALL create_kgpot_section(subsection)
1344      CALL section_add_subsection(section, subsection)
1345      CALL section_release(subsection)
1346
1347      CALL create_dft_plus_u_section(subsection)
1348      CALL section_add_subsection(section, subsection)
1349      CALL section_release(subsection)
1350
1351      CALL create_bs_section(subsection)
1352      CALL section_add_subsection(section, subsection)
1353      CALL section_release(subsection)
1354
1355   END SUBROUTINE create_kind_section
1356
1357! **************************************************************************************************
1358!> \brief Creates the PAO_POTENTIAL section
1359!> \param section the section to create
1360!> \author Ole Schuett
1361! **************************************************************************************************
1362   SUBROUTINE create_pao_potential_section(section)
1363      TYPE(section_type), POINTER                        :: section
1364
1365      TYPE(keyword_type), POINTER                        :: keyword
1366
1367      CPASSERT(.NOT. ASSOCIATED(section))
1368      NULLIFY (keyword)
1369
1370      CALL section_create(section, __LOCATION__, name="PAO_POTENTIAL", repeats=.TRUE., &
1371                          description="Settings of the PAO potentials, which are atomic kind specific.")
1372
1373      CALL keyword_create(keyword, __LOCATION__, name="MAXL", &
1374                          description="Maximum angular moment of the potential "// &
1375                          "(must be an even number).", default_i_val=0)
1376      CALL section_add_keyword(section, keyword)
1377      CALL keyword_release(keyword)
1378
1379      CALL keyword_create(keyword, __LOCATION__, name="BETA", &
1380                          description="Exponent of the Gaussian potential term.", &
1381                          default_r_val=1.0_dp)
1382      CALL section_add_keyword(section, keyword)
1383      CALL keyword_release(keyword)
1384
1385      CALL keyword_create(keyword, __LOCATION__, name="WEIGHT", &
1386                          description="Weight of Gaussian potential term.", &
1387                          default_r_val=1.0_dp)
1388      CALL section_add_keyword(section, keyword)
1389      CALL keyword_release(keyword)
1390
1391      CALL keyword_create(keyword, __LOCATION__, name="MAX_PROJECTOR", &
1392                          description="Maximum angular moment of the potential's projectors. "// &
1393                          "Used only by the GTH parametrization", default_i_val=2)
1394      CALL section_add_keyword(section, keyword)
1395      CALL keyword_release(keyword)
1396
1397   END SUBROUTINE create_pao_potential_section
1398
1399! **************************************************************************************************
1400!> \brief Creates the PAO_DESCRIPTOR section
1401!> \param section the section to create
1402!> \author Ole Schuett
1403! **************************************************************************************************
1404   SUBROUTINE create_pao_descriptor_section(section)
1405      TYPE(section_type), POINTER                        :: section
1406
1407      TYPE(keyword_type), POINTER                        :: keyword
1408
1409      CPASSERT(.NOT. ASSOCIATED(section))
1410      NULLIFY (keyword)
1411
1412      CALL section_create(section, __LOCATION__, name="PAO_DESCRIPTOR", repeats=.TRUE., &
1413                          description="Settings of the PAO descriptor, which are atomic kind specific.")
1414
1415      CALL keyword_create(keyword, __LOCATION__, name="BETA", &
1416                          description="Exponent of the Gaussian potential term.", &
1417                          default_r_val=1.0_dp)
1418      CALL section_add_keyword(section, keyword)
1419      CALL keyword_release(keyword)
1420
1421      CALL keyword_create(keyword, __LOCATION__, name="SCREENING", &
1422                          description="Exponent of the Gaussian screening.", &
1423                          default_r_val=0.2_dp)
1424      CALL section_add_keyword(section, keyword)
1425      CALL keyword_release(keyword)
1426
1427      CALL keyword_create(keyword, __LOCATION__, name="WEIGHT", &
1428                          description="Weight of Gaussian potential term.", &
1429                          default_r_val=1.0_dp)
1430      CALL section_add_keyword(section, keyword)
1431      CALL keyword_release(keyword)
1432
1433   END SUBROUTINE create_pao_descriptor_section
1434
1435! **************************************************************************************************
1436!> \brief      Create CP2K input section for BS method: imposing atomic orbital occupation
1437!>             different from default in initialization of the density  matrix
1438!>             it works only with GUESS ATOMIC
1439!> \param section ...
1440!> \date       05.08.2009
1441!> \author     MI
1442!> \version    1.0
1443! **************************************************************************************************
1444   SUBROUTINE create_bs_section(section)
1445
1446      TYPE(section_type), POINTER                        :: section
1447
1448      CHARACTER(LEN=*), PARAMETER :: routineN = 'create_bs_section', &
1449         routineP = moduleN//':'//routineN
1450
1451      TYPE(keyword_type), POINTER                        :: keyword
1452      TYPE(section_type), POINTER                        :: subsection
1453
1454      CPASSERT(.NOT. ASSOCIATED(section))
1455
1456      CALL section_create(section, __LOCATION__, &
1457                          name="BS", &
1458                          description="Define the required atomic orbital occupation "// &
1459                          "assigned in initialization of the density matrix, by adding or "// &
1460                          "subtracting electrons from specific angular momentum channels. "// &
1461                          "It works only with GUESS ATOMIC.", &
1462                          n_keywords=0, &
1463                          n_subsections=2, &
1464                          repeats=.FALSE.)
1465
1466      NULLIFY (keyword, subsection)
1467
1468      CALL keyword_create(keyword, __LOCATION__, &
1469                          name="_SECTION_PARAMETERS_", &
1470                          description="controls the activation of the BS section", &
1471                          usage="&BS ON", &
1472                          default_l_val=.FALSE., &
1473                          lone_keyword_l_val=.TRUE.)
1474      CALL section_add_keyword(section, keyword)
1475      CALL keyword_release(keyword)
1476
1477      CALL section_create(subsection, __LOCATION__, name="ALPHA", description="alpha spin", &
1478                          n_keywords=3, &
1479                          n_subsections=0, &
1480                          repeats=.FALSE.)
1481
1482      CALL keyword_create(keyword, __LOCATION__, &
1483                          name="NEL", &
1484                          description="Orbital ccupation change per angular momentum quantum number. "// &
1485                          "In unrestricted calculations applied to spin alpha.", &
1486                          repeats=.FALSE., &
1487                          n_var=-1, &
1488                          default_i_val=-1, &
1489                          usage="NEL 2")
1490      CALL section_add_keyword(subsection, keyword)
1491      CALL keyword_release(keyword)
1492
1493      CALL keyword_create(keyword, __LOCATION__, &
1494                          name="L", &
1495                          variants=(/"L"/), &
1496                          description="Angular momentum quantum number of the "// &
1497                          "orbitals whose occupation is changed", &
1498                          repeats=.FALSE., &
1499                          n_var=-1, &
1500                          default_i_val=-1, &
1501                          usage="L 2")
1502      CALL section_add_keyword(subsection, keyword)
1503      CALL keyword_release(keyword)
1504
1505      CALL keyword_create(keyword, __LOCATION__, &
1506                          name="N", &
1507                          variants=(/"N"/), &
1508                          description="Principal quantum number of the "// &
1509                          "orbitals whose occupation is changed. "// &
1510                          "Default is the first not occupied", &
1511                          repeats=.FALSE., &
1512                          n_var=-1, &
1513                          default_i_val=0, &
1514                          usage="N 2")
1515      CALL section_add_keyword(subsection, keyword)
1516      CALL keyword_release(keyword)
1517      CALL section_add_subsection(section, subsection)
1518      CALL section_release(subsection)
1519
1520      CALL section_create(subsection, __LOCATION__, name="BETA", description="beta spin", &
1521                          n_keywords=3, &
1522                          n_subsections=0, &
1523                          repeats=.FALSE.)
1524
1525      CALL keyword_create(keyword, __LOCATION__, &
1526                          name="NEL", &
1527                          description="Orbital ccupation change per angular momentum quantum number. "// &
1528                          "Applied to spin beta and active only in unrestricted calculations.", &
1529                          repeats=.FALSE., &
1530                          n_var=-1, &
1531                          default_i_val=-1, &
1532                          usage="NEL 2")
1533      CALL section_add_keyword(subsection, keyword)
1534      CALL keyword_release(keyword)
1535
1536      CALL keyword_create(keyword, __LOCATION__, &
1537                          name="L", &
1538                          description="Angular momentum quantum number of the "// &
1539                          "orbitals of beta spin whose occupation is changed. "// &
1540                          "Active only for unrestricted calculations", &
1541                          repeats=.FALSE., &
1542                          n_var=-1, &
1543                          default_i_val=-1, &
1544                          usage="L 2")
1545      CALL section_add_keyword(subsection, keyword)
1546      CALL keyword_release(keyword)
1547
1548      CALL keyword_create(keyword, __LOCATION__, &
1549                          name="N", &
1550                          description="Principal quantum number of the "// &
1551                          "orbitals of beta spin whose occupation is changed. "// &
1552                          "Default is the first not occupied. "// &
1553                          "Active only for unrestricted calculations", &
1554                          repeats=.FALSE., &
1555                          n_var=-1, &
1556                          default_i_val=0, &
1557                          usage="N 2")
1558      CALL section_add_keyword(subsection, keyword)
1559      CALL keyword_release(keyword)
1560
1561      CALL section_add_subsection(section, subsection)
1562      CALL section_release(subsection)
1563
1564   END SUBROUTINE create_bs_section
1565
1566! **************************************************************************************************
1567!> \brief Create the topology section for FIST.. and the base is running running...
1568!>      Contains all information regarding topology to be read in input file..
1569!> \param section the section to create
1570!> \author teo
1571! **************************************************************************************************
1572   SUBROUTINE create_topology_section(section)
1573      TYPE(section_type), POINTER                        :: section
1574
1575      CHARACTER(len=*), PARAMETER :: routineN = 'create_topology_section', &
1576         routineP = moduleN//':'//routineN
1577
1578      TYPE(keyword_type), POINTER                        :: keyword
1579      TYPE(section_type), POINTER                        :: print_key, subsection
1580
1581      CPASSERT(.NOT. ASSOCIATED(section))
1582      CALL section_create(section, __LOCATION__, name="TOPOLOGY", &
1583                          description="Section specifying information regarding how to handle the topology"// &
1584                          " for classical runs.", &
1585                          n_keywords=5, n_subsections=0, repeats=.FALSE.)
1586
1587      NULLIFY (keyword, print_key)
1588      ! Logical
1589      CALL keyword_create(keyword, __LOCATION__, name="USE_ELEMENT_AS_KIND", &
1590                          description="Kinds are generated according to the element name."// &
1591                          " Default=True for SE and TB methods.", &
1592                          usage="USE_ELEMENT_AS_KIND logical", &
1593                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1594      CALL section_add_keyword(section, keyword)
1595      CALL keyword_release(keyword)
1596
1597      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_OCCUP", &
1598                          variants=(/"CHARGE_O"/), &
1599                          description="Read MM charges from the OCCUP field of PDB file.", &
1600                          usage="CHARGE_OCCUP logical", &
1601                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1602      CALL section_add_keyword(section, keyword)
1603      CALL keyword_release(keyword)
1604
1605      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_BETA", &
1606                          variants=(/"CHARGE_B"/), &
1607                          description="Read MM charges from the BETA field of PDB file.", &
1608                          usage="CHARGE_BETA logical", &
1609                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1610      CALL section_add_keyword(section, keyword)
1611      CALL keyword_release(keyword)
1612
1613      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_EXTENDED", &
1614                          description="Read MM charges from the very last field of PDB file (starting from column 81)."// &
1615                          " No limitations of number of digits.", &
1616                          usage="CHARGE_EXTENDED logical", &
1617                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1618      CALL section_add_keyword(section, keyword)
1619      CALL keyword_release(keyword)
1620
1621      CALL keyword_create(keyword, __LOCATION__, name="PARA_RES", &
1622                          description="For a protein, each residue is now considered a molecule", &
1623                          usage="PARA_RES logical", &
1624                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
1625      CALL section_add_keyword(section, keyword)
1626      CALL keyword_release(keyword)
1627
1628      CALL keyword_create(keyword, __LOCATION__, name="MOL_CHECK", &
1629                          description="Check molecules have the same number of atom and names.", &
1630                          usage="MOL_CHECK logical", &
1631                          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
1632      CALL section_add_keyword(section, keyword)
1633      CALL keyword_release(keyword)
1634
1635      CALL keyword_create(keyword, __LOCATION__, name="USE_G96_VELOCITY", &
1636                          description="Use the velocities in the G96 coordinate files as the starting velocity", &
1637                          usage="USE_G96_VELOCITY logical", &
1638                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1639      CALL section_add_keyword(section, keyword)
1640      CALL keyword_release(keyword)
1641
1642      ! Character
1643      CALL keyword_create(keyword, __LOCATION__, name="COORD_FILE_NAME", &
1644                          variants=s2a("COORD_FILE"), &
1645                          description="Specifies the filename that contains coordinates.", &
1646                          usage="COORD_FILE_NAME <FILENAME>", type_of_var=lchar_t)
1647      CALL section_add_keyword(section, keyword)
1648      CALL keyword_release(keyword)
1649
1650      CALL keyword_create(keyword, __LOCATION__, name="COORD_FILE_FORMAT", &
1651                          variants=s2a("COORDINATE"), &
1652                          description="Set up the way in which coordinates will be read.", &
1653                          usage="COORD_FILE_FORMAT (OFF|PDB|XYZ|G96|CRD|CIF|XTL|CP2K)", &
1654                          enum_c_vals=s2a("OFF", "PDB", "XYZ", "G96", "CRD", "CIF", "XTL", "CP2K"), &
1655                          enum_i_vals=(/do_coord_off, do_coord_pdb, do_coord_xyz, do_coord_g96, do_coord_crd, &
1656                                        do_coord_cif, do_coord_xtl, do_coord_cp2k/), &
1657                          enum_desc=s2a( &
1658                          "Coordinates read in the &COORD section of the input file", &
1659                          "Coordinates provided through a PDB file format", &
1660                          "Coordinates provided through an XYZ file format", &
1661                          "Coordinates provided through a GROMOS96 file format", &
1662                          "Coordinates provided through an AMBER file format", &
1663                          "Coordinates provided through a CIF (Crystallographic Information File) file format", &
1664                          "Coordinates provided through a XTL (MSI native) file format", &
1665                          "Read the coordinates in CP2K &COORD section format from an external file. "// &
1666                          "NOTE: This file will be overwritten with the latest coordinates."), &
1667                          default_i_val=do_coord_off)
1668      CALL section_add_keyword(section, keyword)
1669      CALL keyword_release(keyword)
1670
1671      CALL keyword_create(keyword, __LOCATION__, name="NUMBER_OF_ATOMS", &
1672                          variants=s2a("NATOMS", "NATOM"), &
1673                          description="Optionally define the number of atoms read from an external file "// &
1674                          "(see COORD_FILE_NAME) if the COORD_FILE_FORMAT CP2K is used", &
1675                          repeats=.FALSE., &
1676                          n_var=1, &
1677                          type_of_var=integer_t, &
1678                          default_i_val=-1, &
1679                          usage="NATOMS 768000")
1680      CALL section_add_keyword(section, keyword)
1681      CALL keyword_release(keyword)
1682
1683      CALL connectivity_framework(section, do_conn_generate)
1684
1685      CALL keyword_create(keyword, __LOCATION__, name="DISABLE_EXCLUSION_LISTS", &
1686                          description="Do not build any exclusion lists.", &
1687                          usage="DISABLE_EXCLUSION_LISTS", &
1688                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1689      CALL section_add_keyword(section, keyword)
1690      CALL keyword_release(keyword)
1691
1692      CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_VDW", &
1693                          description="Specifies which kind of Van der Waals interaction to skip.", &
1694                          usage="EXCLUDE_VDW (1-1||1-2||1-3||1-4)", &
1695                          enum_c_vals=s2a("1-1", "1-2", "1-3", "1-4"), &
1696                          enum_i_vals=(/do_skip_11, do_skip_12, do_skip_13, do_skip_14/), &
1697                          default_i_val=do_skip_13)
1698      CALL section_add_keyword(section, keyword)
1699      CALL keyword_release(keyword)
1700
1701      CALL keyword_create(keyword, __LOCATION__, name="EXCLUDE_EI", &
1702                          description="Specifies which kind of Electrostatic interaction to skip.", &
1703                          usage="EXCLUDE_EI (1-1||1-2||1-3||1-4)", &
1704                          enum_c_vals=s2a("1-1", "1-2", "1-3", "1-4"), &
1705                          enum_i_vals=(/do_skip_11, do_skip_12, do_skip_13, do_skip_14/), &
1706                          default_i_val=do_skip_13)
1707      CALL section_add_keyword(section, keyword)
1708      CALL keyword_release(keyword)
1709
1710      CALL keyword_create(keyword, __LOCATION__, name="AUTOGEN_EXCLUDE_LISTS", &
1711                          description="When True, the exclude lists are solely based on"// &
1712                          " the bond data in the topology. The (minimal)"// &
1713                          " number of bonds between two atoms is used to"// &
1714                          " determine if the atom pair is added to an"// &
1715                          " exclusion list. When False, 1-2 exclusion is based"// &
1716                          " on bonds in the topology, 1-3 exclusion is based"// &
1717                          " on bonds and bends in the topology, 1-4 exclusion"// &
1718                          " is based on bonds, bends and dihedrals in the"// &
1719                          " topology. This implies that a missing dihedral in"// &
1720                          " the topology will cause the corresponding 1-4 pair"// &
1721                          " not to be in the exclusion list, in case 1-4"// &
1722                          " exclusion is requested for VDW or EI interactions.", &
1723                          usage="AUTOGEN_EXCLUDE_LISTS logical", &
1724                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1725      CALL section_add_keyword(section, keyword)
1726      CALL keyword_release(keyword)
1727
1728      CALL keyword_create( &
1729         keyword, __LOCATION__, name="MULTIPLE_UNIT_CELL", &
1730         description="Specifies the numbers of repetition in space (X, Y, Z) of the defined cell, "// &
1731         "assuming it as a unit cell. This keyword affects only the coordinates specification. The same keyword "// &
1732         "in SUBSYS%CELL%MULTIPLE_UNIT_CELL should be modified in order to affect the cell "// &
1733         "specification.", usage="MULTIPLE_UNIT_CELL 1 1 1", &
1734         n_var=3, default_i_vals=(/1, 1, 1/), repeats=.FALSE.)
1735      CALL section_add_keyword(section, keyword)
1736      CALL keyword_release(keyword)
1737
1738      CALL keyword_create(keyword, __LOCATION__, name="MEMORY_PROGRESSION_FACTOR", &
1739                          description="This keyword is quite technical and should normally not be changed by the user. It "// &
1740                          "affects the memory allocation during the construction of the topology. It does NOT affect the "// &
1741                          "memory used once the topology is built.", &
1742                          n_var=1, default_r_val=1.2_dp, repeats=.FALSE.)
1743      CALL section_add_keyword(section, keyword)
1744      CALL keyword_release(keyword)
1745
1746      CALL cp_print_key_section_create(print_key, __LOCATION__, "DUMP_PDB", &
1747                                       description="controls the dumping of the PDB at the starting geometry", &
1748                                       print_level=debug_print_level, filename="dump")
1749      CALL section_add_subsection(section, print_key)
1750
1751      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_OCCUP", &
1752                          variants=(/"CHARGE_O"/), &
1753                          description="Write the MM charges to the OCCUP field of the PDB file", &
1754                          usage="CHARGE_OCCUP logical", &
1755                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1756      CALL section_add_keyword(print_key, keyword)
1757      CALL keyword_release(keyword)
1758
1759      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_BETA", &
1760                          variants=(/"CHARGE_B"/), &
1761                          description="Write the MM charges to the BETA field of the PDB file", &
1762                          usage="CHARGE_BETA logical", &
1763                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1764      CALL section_add_keyword(print_key, keyword)
1765      CALL keyword_release(keyword)
1766
1767      CALL keyword_create(keyword, __LOCATION__, name="CHARGE_EXTENDED", &
1768                          description="Write the MM charges to the very last field of the PDB file (starting from column 81)", &
1769                          usage="CHARGE_EXTENDED logical", &
1770                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1771      CALL section_add_keyword(print_key, keyword)
1772      CALL keyword_release(keyword)
1773
1774      CALL section_release(print_key)
1775
1776      CALL cp_print_key_section_create(print_key, __LOCATION__, "DUMP_PSF", &
1777                                       description="controls the dumping of the PSF connectivity", &
1778                                       print_level=debug_print_level, filename="dump")
1779      CALL section_add_subsection(section, print_key)
1780      CALL section_release(print_key)
1781
1782      NULLIFY (subsection)
1783      CALL create_exclude_list_section(subsection, "EXCLUDE_VDW_LIST")
1784      CALL section_add_subsection(section, subsection)
1785      CALL section_release(subsection)
1786
1787      CALL create_exclude_list_section(subsection, "EXCLUDE_EI_LIST")
1788      CALL section_add_subsection(section, subsection)
1789      CALL section_release(subsection)
1790
1791      CALL create_center_section(subsection)
1792      CALL section_add_subsection(section, subsection)
1793      CALL section_release(subsection)
1794
1795      CALL create_generate_section(subsection)
1796      CALL section_add_subsection(section, subsection)
1797      CALL section_release(subsection)
1798
1799      CALL create_molset_section(subsection)
1800      CALL section_add_subsection(section, subsection)
1801      CALL section_release(subsection)
1802
1803   END SUBROUTINE create_topology_section
1804
1805! **************************************************************************************************
1806!> \brief Setup a list of fine exclusion elements
1807!> \param section the section to create
1808!> \param header ...
1809!> \author Teodoro Laino [tlaino] - 12.2009
1810! **************************************************************************************************
1811   SUBROUTINE create_exclude_list_section(section, header)
1812      TYPE(section_type), POINTER                        :: section
1813      CHARACTER(LEN=*), INTENT(IN)                       :: header
1814
1815      CHARACTER(len=*), PARAMETER :: routineN = 'create_exclude_list_section', &
1816         routineP = moduleN//':'//routineN
1817
1818      TYPE(keyword_type), POINTER                        :: keyword
1819
1820      CPASSERT(.NOT. ASSOCIATED(section))
1821      NULLIFY (keyword)
1822      CALL section_create(section, __LOCATION__, TRIM(header), &
1823                          description="Speficy bonds (via atom kinds) for fine tuning of 1-2 "// &
1824                          "exclusion lists. If this section is not present the 1-2 exclusion is "// &
1825                          "applied to all bond kinds. When this section is present the 1-2 exclusion "// &
1826                          "is applied ONLY to the bonds defined herein. This section allows ONLY fine tuning of 1-2 "// &
1827                          "interactions. ", &
1828                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
1829
1830      CALL keyword_create(keyword, __LOCATION__, name="BOND", &
1831                          description="Specify the atom kinds involved in the bond for which 1-2 exclusion holds.", &
1832                          usage="BOND {KIND1} {KIND2}", type_of_var=char_t, &
1833                          n_var=2)
1834      CALL section_add_keyword(section, keyword)
1835      CALL keyword_release(keyword)
1836   END SUBROUTINE create_exclude_list_section
1837
1838! **************************************************************************************************
1839!> \brief Specify keywords used to center molecule in the box
1840!> \param section the section to create
1841!> \author Teodoro Laino [tlaino] - University of Zurich - 06.2009
1842! **************************************************************************************************
1843   SUBROUTINE create_center_section(section)
1844      TYPE(section_type), POINTER                        :: section
1845
1846      CHARACTER(len=*), PARAMETER :: routineN = 'create_center_section', &
1847         routineP = moduleN//':'//routineN
1848
1849      TYPE(keyword_type), POINTER                        :: keyword
1850
1851      CPASSERT(.NOT. ASSOCIATED(section))
1852      NULLIFY (keyword)
1853      CALL section_create(section, __LOCATION__, "CENTER_COORDINATES", &
1854                          description="Allows centering the coordinates of the system in the box. "// &
1855                          "The centering point can be defined by the user.", &
1856                          n_keywords=1, n_subsections=0, repeats=.FALSE.)
1857
1858      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
1859                          description="Controls the activation of the centering method", &
1860                          usage="&CENTER_COORDINATES T", &
1861                          default_l_val=.FALSE., &
1862                          lone_keyword_l_val=.TRUE.)
1863      CALL section_add_keyword(section, keyword)
1864      CALL keyword_release(keyword)
1865
1866      CALL keyword_create(keyword, __LOCATION__, name="CENTER_POINT", &
1867                          description="Specify the point used for centering the coordinates. Default is to "// &
1868                          "center the system in cell/2. ", type_of_var=real_t, n_var=3, &
1869                          repeats=.FALSE.)
1870      CALL section_add_keyword(section, keyword)
1871      CALL keyword_release(keyword)
1872   END SUBROUTINE create_center_section
1873
1874! **************************************************************************************************
1875!> \brief Specify keywords used to setup several molecules with few connectivity files
1876!> \param section the section to create
1877!> \author Teodoro Laino [tlaino] - University of Zurich - 08.2008
1878! **************************************************************************************************
1879   SUBROUTINE create_molset_section(section)
1880      TYPE(section_type), POINTER                        :: section
1881
1882      CHARACTER(len=*), PARAMETER :: routineN = 'create_molset_section', &
1883         routineP = moduleN//':'//routineN
1884
1885      TYPE(keyword_type), POINTER                        :: keyword
1886      TYPE(section_type), POINTER                        :: subsection, subsubsection
1887
1888      CPASSERT(.NOT. ASSOCIATED(section))
1889      NULLIFY (keyword, subsection, subsubsection)
1890      CALL section_create(section, __LOCATION__, name="MOL_SET", &
1891                          description="Specify the connectivity of a full system specifying the connectivity"// &
1892                          " of the fragments of the system.", &
1893                          n_keywords=2, n_subsections=0, repeats=.FALSE.)
1894
1895      ! MOLECULES
1896      CALL section_create(subsection, __LOCATION__, name="MOLECULE", &
1897                          description="Specify information about the connectivity of single molecules", &
1898                          n_keywords=2, n_subsections=0, repeats=.TRUE.)
1899
1900      CALL keyword_create(keyword, __LOCATION__, name="NMOL", &
1901                          description="number of molecules ", &
1902                          usage="NMOL {integer}", default_i_val=1)
1903      CALL section_add_keyword(subsection, keyword)
1904      CALL keyword_release(keyword)
1905
1906      CALL connectivity_framework(subsection, do_conn_psf)
1907      CALL section_add_subsection(section, subsection)
1908      CALL section_release(subsection)
1909
1910      ! MERGE MOLECULES
1911      CALL section_create(subsection, __LOCATION__, name="MERGE_MOLECULES", &
1912                          description="Enables the creation of connecting bridges (bonds, angles, torsions, impropers)"// &
1913                          " between the two or more molecules defined with independent connectivity.", &
1914                          n_keywords=2, n_subsections=0, repeats=.FALSE.)
1915
1916      CALL section_create(subsubsection, __LOCATION__, name="bonds", &
1917                          description="Defines new bonds", n_keywords=2, n_subsections=0, repeats=.FALSE.)
1918      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
1919                          description="Two integer indexes per line defining the new bond."// &
1920                          " Indexes must be relative to the full system and not to the single molecules", &
1921                          repeats=.TRUE., &
1922                          usage="{Integer} {Integer}", type_of_var=integer_t, n_var=2)
1923      CALL section_add_keyword(subsubsection, keyword)
1924      CALL keyword_release(keyword)
1925      CALL section_add_subsection(subsection, subsubsection)
1926      CALL section_release(subsubsection)
1927
1928      CALL section_create(subsubsection, __LOCATION__, name="angles", &
1929                          description="Defines new angles", n_keywords=2, n_subsections=0, &
1930                          repeats=.FALSE.)
1931      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
1932                          description="Three integer indexes per line defining the new angle"// &
1933                          " Indexes must be relative to the full system and not to the single molecules", repeats=.TRUE., &
1934                          usage="{Integer} {Integer} {Integer}", type_of_var=integer_t, n_var=3)
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="torsions", &
1941                          description="Defines new torsions", n_keywords=2, n_subsections=0, &
1942                          repeats=.FALSE.)
1943      CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
1944                          description="Four integer indexes per line defining the new torsion"// &
1945                          " Indexes must be relative to the full system and not to the single molecules", repeats=.TRUE., &
1946                          usage="{Integer} {Integer} {Integer} {Integer}", type_of_var=integer_t, n_var=4)
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="impropers", &
1953                          description="Defines new impropers", 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 improper"// &
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_add_subsection(section, subsection)
1965      CALL section_release(subsection)
1966
1967   END SUBROUTINE create_molset_section
1968
1969! **************************************************************************************************
1970!> \brief Specify keywords used to generate connectivity
1971!> \param section the section to create
1972!> \author Teodoro Laino [tlaino] - University of Zurich - 08.2008
1973! **************************************************************************************************
1974   SUBROUTINE create_generate_section(section)
1975      TYPE(section_type), POINTER                        :: section
1976
1977      CHARACTER(len=*), PARAMETER :: routineN = 'create_generate_section', &
1978         routineP = moduleN//':'//routineN
1979
1980      TYPE(keyword_type), POINTER                        :: keyword
1981      TYPE(section_type), POINTER                        :: subsection
1982
1983      CPASSERT(.NOT. ASSOCIATED(section))
1984      NULLIFY (keyword, subsection)
1985      CALL section_create(section, __LOCATION__, name="GENERATE", &
1986                          description="Setup of keywords controlling the generation of the connectivity", &
1987                          n_keywords=2, n_subsections=0, repeats=.TRUE.)
1988
1989      CALL keyword_create(keyword, __LOCATION__, name="REORDER", &
1990                          description="Reorder a list of atomic coordinates into order so it can be packed correctly.", &
1991                          usage="REORDER <LOGICAL>", &
1992                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
1993      CALL section_add_keyword(section, keyword)
1994      CALL keyword_release(keyword)
1995
1996      CALL keyword_create(keyword, __LOCATION__, name="CREATE_MOLECULES", &
1997                          description="Create molecules names and definition. Can be used to override the "// &
1998                          " molecules specifications of a possible input connectivity or to create molecules"// &
1999                          " specifications for file types as XYZ, missing of molecules definitions.", &
2000                          usage="CREATE_MOLECULES <LOGICAL>", &
2001                          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
2002      CALL section_add_keyword(section, keyword)
2003      CALL keyword_release(keyword)
2004
2005      CALL keyword_create(keyword, __LOCATION__, name="BONDPARM", &
2006                          description="Used in conjunction with BONDPARM_FACTOR to "// &
2007                          "help determine wheather there is bonding "// &
2008                          "between two atoms based on a distance criteria. "// &
2009                          "Can use covalent radii information or VDW radii information", &
2010                          usage="BONDPARM (COVALENT||VDW)", &
2011                          enum_c_vals=s2a("COVALENT", "VDW"), &
2012                          enum_i_vals=(/do_bondparm_covalent, do_bondparm_vdw/), &
2013                          default_i_val=do_bondparm_covalent)
2014      CALL section_add_keyword(section, keyword)
2015      CALL keyword_release(keyword)
2016
2017      CALL keyword_create(keyword, __LOCATION__, name="BONDPARM_FACTOR", &
2018                          description="Used in conjunction with BONDPARM to help "// &
2019                          "determine wheather there is bonding between "// &
2020                          "two atoms based on a distance criteria.", &
2021                          usage="bondparm_factor {real}", default_r_val=1.1_dp)
2022      CALL section_add_keyword(section, keyword)
2023      CALL keyword_release(keyword)
2024
2025      CALL keyword_create(keyword, __LOCATION__, name="BONDLENGTH_MAX", &
2026                          description="Maximum distance to generate neighbor lists to build connectivity", &
2027                          usage="BONDLENGTH_MAX <real>", default_r_val=cp_unit_to_cp2k(value=3.0_dp, &
2028                                                                                       unit_str="angstrom"), unit_str="angstrom")
2029      CALL section_add_keyword(section, keyword)
2030      CALL keyword_release(keyword)
2031
2032      CALL keyword_create(keyword, __LOCATION__, name="BONDLENGTH_MIN", &
2033                          description="Minimum distance to generate neighbor lists to build connectivity", &
2034                          usage="BONDLENGTH_MIN <real>", default_r_val=cp_unit_to_cp2k(value=0.01_dp, &
2035                                                                                       unit_str="angstrom"), unit_str="angstrom")
2036      CALL section_add_keyword(section, keyword)
2037      CALL keyword_release(keyword)
2038
2039      ! BONDS
2040      CALL section_create(subsection, __LOCATION__, name="BOND", &
2041                          description="Section used to add/remove  bonds in the connectivity."// &
2042                          " Useful for systems with a complex connectivity, difficult to find out automatically.", &
2043                          n_keywords=1, n_subsections=0, repeats=.TRUE.)
2044
2045      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
2046                          description="controls the activation of the bond", &
2047                          usage="&BOND (ADD|REMOVE)", &
2048                          enum_c_vals=s2a("ADD", "REMOVE"), &
2049                          enum_i_vals=(/do_add, do_remove/), &
2050                          default_i_val=do_add)
2051      CALL section_add_keyword(subsection, keyword)
2052      CALL keyword_release(keyword)
2053
2054      CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
2055                          description="Specifies two atomic index united by a covalent bond", &
2056                          usage="ATOMS {integer} {integer}", type_of_var=integer_t, n_var=2, &
2057                          repeats=.TRUE.)
2058      CALL section_add_keyword(subsection, keyword)
2059      CALL keyword_release(keyword)
2060
2061      CALL section_add_subsection(section, subsection)
2062      CALL section_release(subsection)
2063
2064      ! ANGLES
2065      CALL section_create(subsection, __LOCATION__, name="ANGLE", &
2066                          description="Section used to add/remove angles in the connectivity."// &
2067                          " Useful for systems with a complex connectivity, difficult to find out automatically.", &
2068                          n_keywords=1, n_subsections=0, repeats=.TRUE.)
2069
2070      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
2071                          description="controls the activation of the bond", &
2072                          usage="&ANGLE (ADD|REMOVE)", &
2073                          enum_c_vals=s2a("ADD", "REMOVE"), &
2074                          enum_i_vals=(/do_add, do_remove/), &
2075                          default_i_val=do_add)
2076      CALL section_add_keyword(subsection, keyword)
2077      CALL keyword_release(keyword)
2078
2079      CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
2080                          description="Specifies two atomic index united by a covalent bond", &
2081                          usage="ATOMS {integer} {integer} {integer} ", type_of_var=integer_t, n_var=3, &
2082                          repeats=.TRUE.)
2083      CALL section_add_keyword(subsection, keyword)
2084      CALL keyword_release(keyword)
2085
2086      CALL section_add_subsection(section, subsection)
2087      CALL section_release(subsection)
2088
2089      ! TORSIONS
2090      CALL section_create(subsection, __LOCATION__, name="TORSION", &
2091                          description="Section used to add/remove torsion in the connectivity."// &
2092                          " Useful for systems with a complex connectivity, difficult to find out automatically.", &
2093                          n_keywords=1, n_subsections=0, repeats=.TRUE.)
2094
2095      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
2096                          description="controls the activation of the bond", &
2097                          usage="&TORSION (ADD|REMOVE)", &
2098                          enum_c_vals=s2a("ADD", "REMOVE"), &
2099                          enum_i_vals=(/do_add, do_remove/), &
2100                          default_i_val=do_add)
2101      CALL section_add_keyword(subsection, keyword)
2102      CALL keyword_release(keyword)
2103
2104      CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
2105                          description="Specifies two atomic index united by a covalent bond", &
2106                          usage="ATOMS {integer} {integer} {integer} {integer} ", type_of_var=integer_t, n_var=4, &
2107                          repeats=.TRUE.)
2108      CALL section_add_keyword(subsection, keyword)
2109      CALL keyword_release(keyword)
2110
2111      CALL section_add_subsection(section, subsection)
2112      CALL section_release(subsection)
2113
2114      ! IMPROPERS
2115      CALL section_create(subsection, __LOCATION__, name="IMPROPER", &
2116                          description="Section used to add/remove improper in the connectivity."// &
2117                          " Useful for systems with a complex connectivity, difficult to find out automatically.", &
2118                          n_keywords=1, n_subsections=0, repeats=.TRUE.)
2119
2120      CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
2121                          description="controls the activation of the bond", &
2122                          usage="&IMPROPER (ADD|REMOVE)", &
2123                          enum_c_vals=s2a("ADD", "REMOVE"), &
2124                          enum_i_vals=(/do_add, do_remove/), &
2125                          default_i_val=do_add)
2126      CALL section_add_keyword(subsection, keyword)
2127      CALL keyword_release(keyword)
2128
2129      CALL keyword_create(keyword, __LOCATION__, name="ATOMS", &
2130                          description="Specifies two atomic index united by a covalent bond", &
2131                          usage="ATOMS {integer} {integer} {integer} {integer} ", type_of_var=integer_t, n_var=4, &
2132                          repeats=.TRUE.)
2133      CALL section_add_keyword(subsection, keyword)
2134      CALL keyword_release(keyword)
2135
2136      CALL section_add_subsection(section, subsection)
2137      CALL section_release(subsection)
2138
2139      ! ISOLATED ATOMS
2140      CALL section_create(subsection, __LOCATION__, name="ISOLATED_ATOMS", &
2141                          description=" This section specifies the  atoms that one considers isolated. Useful when present "// &
2142                          " ions in solution.", n_keywords=1, n_subsections=0, repeats=.FALSE.)
2143      CALL keyword_create(keyword, __LOCATION__, name="LIST", &
2144                          description="Specifies a list of atomic indexes of the isolated ion", &
2145                          usage="LIST {integer}", type_of_var=integer_t, n_var=-1, &
2146                          repeats=.TRUE.)
2147      CALL section_add_keyword(subsection, keyword)
2148      CALL keyword_release(keyword)
2149
2150      CALL section_add_subsection(section, subsection)
2151      CALL section_release(subsection)
2152
2153      ! Neighbor lists keys and printing handling the construction of NL for the connectivity
2154      CALL create_neighbor_lists_section(subsection)
2155      CALL section_add_subsection(section, subsection)
2156      CALL section_release(subsection)
2157
2158      CALL create_gen_print_section(subsection)
2159      CALL section_add_subsection(section, subsection)
2160      CALL section_release(subsection)
2161
2162   END SUBROUTINE create_generate_section
2163
2164! **************************************************************************************************
2165!> \brief Create the print gen section
2166!> \param section the section to create
2167!> \author teo
2168! **************************************************************************************************
2169   SUBROUTINE create_gen_print_section(section)
2170      TYPE(section_type), POINTER                        :: section
2171
2172      CHARACTER(len=*), PARAMETER :: routineN = 'create_gen_print_section', &
2173         routineP = moduleN//':'//routineN
2174
2175      TYPE(section_type), POINTER                        :: print_key
2176
2177      CPASSERT(.NOT. ASSOCIATED(section))
2178      CALL section_create(section, __LOCATION__, name="print", &
2179                          description="Section of possible print options in GENERATE code.", &
2180                          n_keywords=0, n_subsections=1, repeats=.FALSE.)
2181
2182      NULLIFY (print_key)
2183      CALL cp_print_key_section_create(print_key, __LOCATION__, "NEIGHBOR_LISTS", &
2184                                       description="Activates the printing of the neighbor lists used"// &
2185                                       " for generating the connectivity.", print_level=high_print_level, &
2186                                       filename="", unit_str="angstrom")
2187      CALL section_add_subsection(section, print_key)
2188      CALL section_release(print_key)
2189
2190      CALL cp_print_key_section_create(print_key, __LOCATION__, "SUBCELL", &
2191                                       description="Activates the printing of the subcells used for the"// &
2192                                       "generation of neighbor lists for connectivity.", &
2193                                       print_level=high_print_level, filename="__STD_OUT__")
2194      CALL section_add_subsection(section, print_key)
2195      CALL section_release(print_key)
2196
2197   END SUBROUTINE create_gen_print_section
2198
2199! **************************************************************************************************
2200!> \brief Specify keywords used to define connectivity
2201!> \param section the section to create
2202!> \param default ...
2203!> \author teo
2204! **************************************************************************************************
2205   SUBROUTINE connectivity_framework(section, default)
2206      TYPE(section_type), POINTER                        :: section
2207      INTEGER, INTENT(IN)                                :: default
2208
2209      CHARACTER(len=*), PARAMETER :: routineN = 'connectivity_framework', &
2210         routineP = moduleN//':'//routineN
2211
2212      TYPE(keyword_type), POINTER                        :: keyword
2213
2214      CPASSERT(ASSOCIATED(section))
2215      NULLIFY (keyword)
2216      CALL keyword_create(keyword, __LOCATION__, name="CONN_FILE_NAME", &
2217                          variants=(/"CONN_FILE"/), &
2218                          description="Specifies the filename that contains the molecular connectivity.", &
2219                          usage="CONN_FILE_NAME <FILENAME>", type_of_var=lchar_t)
2220      CALL section_add_keyword(section, keyword)
2221      CALL keyword_release(keyword)
2222
2223      CALL keyword_create(keyword, __LOCATION__, name="CONN_FILE_FORMAT", &
2224                          variants=(/"CONNECTIVITY"/), &
2225                          description="Ways to determine and generate a molecules. "// &
2226                          "Default is to use GENERATE", &
2227                          usage="CONN_FILE_FORMAT (PSF|UPSF|MOL_SET|GENERATE|OFF|G87|G96|AMBER|USER)", &
2228                          enum_c_vals=s2a("PSF", "UPSF", "MOL_SET", "GENERATE", "OFF", "G87", "G96", "AMBER", "USER"), &
2229                          enum_i_vals=(/do_conn_psf, &
2230                                        do_conn_psf_u, &
2231                                        do_conn_mol_set, &
2232                                        do_conn_generate, &
2233                                        do_conn_off, &
2234                                        do_conn_g87, &
2235                                        do_conn_g96, &
2236                                        do_conn_amb7, &
2237                                        do_conn_user/), &
2238                          enum_desc=s2a("Use  a PSF file to determine the connectivity."// &
2239                                        " (support standard CHARMM/XPLOR and EXT CHARMM)", &
2240                                        "Read a PSF file in an unformatted way (useful for not so standard PSF).", &
2241                                        "Use multiple PSF (for now...) files to generate the whole sytem.", &
2242                                        "Use a simple distance criteria. (Look at keyword BONDPARM)", &
2243                                        "Do not generate molecules. (e.g. for QS or ill defined systems)", &
2244                                        "Use GROMOS G87 topology file.", &
2245                                        "Use GROMOS G96 topology file.", &
2246                                        "Use AMBER topology file for reading connectivity (compatible starting from AMBER V.7)", &
2247                                        "Allows the definition of molecules and residues based on the 5th and 6th column of "// &
2248                                        "the COORD section. This option can be handy for the definition of molecules with QS "// &
2249                                        "or to save memory in the case of very large systems (use PARA_RES off)."), &
2250                          default_i_val=default)
2251      CALL section_add_keyword(section, keyword)
2252      CALL keyword_release(keyword)
2253   END SUBROUTINE connectivity_framework
2254
2255! **************************************************************************************************
2256!> \brief      Create CP2K input section for the DFT+U method parameters
2257!> \param section ...
2258!> \date       01.11.2007
2259!> \author     Matthias Krack (MK)
2260!> \version    1.0
2261! **************************************************************************************************
2262   SUBROUTINE create_dft_plus_u_section(section)
2263
2264      TYPE(section_type), POINTER                        :: section
2265
2266      CHARACTER(LEN=*), PARAMETER :: routineN = 'create_dft_plus_u_section', &
2267         routineP = moduleN//':'//routineN
2268
2269      TYPE(keyword_type), POINTER                        :: keyword
2270      TYPE(section_type), POINTER                        :: subsection
2271
2272      CPASSERT(.NOT. ASSOCIATED(section))
2273
2274      CALL section_create(section, __LOCATION__, &
2275                          name="DFT_PLUS_U", &
2276                          description="Define the parameters for a DFT+U run", &
2277                          n_keywords=3, &
2278                          n_subsections=1, &
2279                          repeats=.FALSE.)
2280
2281      NULLIFY (keyword)
2282
2283      CALL keyword_create(keyword, __LOCATION__, &
2284                          name="_SECTION_PARAMETERS_", &
2285                          description="Controls the activation of the DFT+U section", &
2286                          usage="&DFT_PLUS_U ON", &
2287                          default_l_val=.FALSE., &
2288                          lone_keyword_l_val=.TRUE.)
2289      CALL section_add_keyword(section, keyword)
2290      CALL keyword_release(keyword)
2291
2292      CALL keyword_create(keyword, __LOCATION__, &
2293                          name="L", &
2294                          description="Angular momentum quantum number of the"// &
2295                          "orbitals to which the correction is applied", &
2296                          repeats=.FALSE., &
2297                          n_var=1, &
2298                          type_of_var=integer_t, &
2299                          default_i_val=-1, &
2300                          usage="L 2")
2301      CALL section_add_keyword(section, keyword)
2302      CALL keyword_release(keyword)
2303
2304      CALL keyword_create(keyword, __LOCATION__, &
2305                          name="U_MINUS_J", &
2306                          description="Effective parameter U(eff) = U - J", &
2307                          repeats=.FALSE., &
2308                          n_var=1, &
2309                          type_of_var=real_t, &
2310                          default_r_val=0.0_dp, &
2311                          unit_str="au_e", &
2312                          usage="U_MINUS_J [eV] 1.4")
2313      CALL section_add_keyword(section, keyword)
2314      CALL keyword_release(keyword)
2315
2316      CALL keyword_create(keyword, __LOCATION__, &
2317                          name="U_RAMPING", &
2318                          description="Increase the effective U parameter stepwise using the specified "// &
2319                          "increment until the target value given by U_MINUS_J is reached.", &
2320                          repeats=.FALSE., &
2321                          n_var=1, &
2322                          type_of_var=real_t, &
2323                          default_r_val=0.0_dp, &
2324                          unit_str="au_e", &
2325                          usage="U_RAMPING [eV] 0.1")
2326      CALL section_add_keyword(section, keyword)
2327      CALL keyword_release(keyword)
2328
2329      CALL keyword_create(keyword, __LOCATION__, &
2330                          name="EPS_U_RAMPING", &
2331                          description="Threshold value (SCF convergence) for incrementing the effective "// &
2332                          "U value when U ramping is active.", &
2333                          repeats=.FALSE., &
2334                          n_var=1, &
2335                          type_of_var=real_t, &
2336                          default_r_val=1.0E-5_dp, &
2337                          usage="EPS_U_RAMPING 1.0E-6")
2338      CALL section_add_keyword(section, keyword)
2339      CALL keyword_release(keyword)
2340
2341      CALL keyword_create(keyword, __LOCATION__, &
2342                          name="INIT_U_RAMPING_EACH_SCF", &
2343                          description="Set the initial U ramping value to zero before each wavefunction optimisation. "// &
2344                          "The default is to apply U ramping only for the initial wavefunction optimisation.", &
2345                          repeats=.FALSE., &
2346                          default_l_val=.FALSE., &
2347                          lone_keyword_l_val=.TRUE., &
2348                          usage="INIT_U_RAMPING_EACH_SCF on")
2349      CALL section_add_keyword(section, keyword)
2350      CALL keyword_release(keyword)
2351
2352      NULLIFY (subsection)
2353
2354      CALL section_create(subsection, __LOCATION__, &
2355                          name="ENFORCE_OCCUPATION", &
2356                          description="Enforce and control a special (initial) orbital occupation. "// &
2357                          "Note, this feature works only for the methods MULLIKEN and LOWDIN. "// &
2358                          "It should only be used to prepare an initial configuration. An "// &
2359                          "inadequate parameter choice can easily inhibit SCF convergence.", &
2360                          n_keywords=5, &
2361                          n_subsections=0, &
2362                          repeats=.FALSE.)
2363
2364      CALL keyword_create(keyword, __LOCATION__, &
2365                          name="_SECTION_PARAMETERS_", &
2366                          description="Controls the activation of the ENFORCE_OCCUPATION section", &
2367                          usage="&ENFORCE_OCCUPATION ON", &
2368                          default_l_val=.FALSE., &
2369                          lone_keyword_l_val=.TRUE.)
2370      CALL section_add_keyword(subsection, keyword)
2371      CALL keyword_release(keyword)
2372
2373      CALL keyword_create(keyword, __LOCATION__, name="NELEC", &
2374                          variants=(/"N_ELECTRONS"/), &
2375                          description="Number of alpha and beta electrons. An occupation (per spin) smaller than 0.5 is ignored.", &
2376                          repeats=.FALSE., &
2377                          n_var=-1, &
2378                          type_of_var=real_t, &
2379                          default_r_val=0.0_dp, &
2380                          usage="NELEC 5.0 4.0")
2381      CALL section_add_keyword(subsection, keyword)
2382      CALL keyword_release(keyword)
2383
2384      CALL keyword_create(keyword, __LOCATION__, &
2385                          name="ORBITALS", &
2386                          variants=(/"M"/), &
2387                          description="Select orbitals and occupation order. An input of 1 to 2*L+1 integer values in "// &
2388                          "the range -L to L defining the M values of the spherical orbitals is expected.", &
2389                          repeats=.FALSE., &
2390                          n_var=-1, &
2391                          type_of_var=integer_t, &
2392                          default_i_val=0, &
2393                          usage="ORBITALS 0 +1 -1")
2394      CALL section_add_keyword(subsection, keyword)
2395      CALL keyword_release(keyword)
2396
2397      CALL keyword_create(keyword, __LOCATION__, &
2398                          name="EPS_SCF", &
2399                          description="The occupation constraint is enforced until this threshold value "// &
2400                          "for the SCF convergence criterion is reached", &
2401                          repeats=.FALSE., &
2402                          n_var=1, &
2403                          type_of_var=real_t, &
2404                          default_r_val=1.0E30_dp, &
2405                          usage="EPS_SCF 0.001")
2406      CALL section_add_keyword(subsection, keyword)
2407      CALL keyword_release(keyword)
2408
2409      CALL keyword_create(keyword, __LOCATION__, &
2410                          name="MAX_SCF", &
2411                          description="The occupation constraint is applied for this number of initial SCF iterations", &
2412                          repeats=.FALSE., &
2413                          n_var=1, &
2414                          type_of_var=integer_t, &
2415                          default_i_val=-1, &
2416                          usage="MAX_SCF 5")
2417      CALL section_add_keyword(subsection, keyword)
2418      CALL keyword_release(keyword)
2419
2420      CALL keyword_create(keyword, __LOCATION__, &
2421                          name="SMEAR", &
2422                          description="The occupation constraint is applied with smearing", &
2423                          repeats=.FALSE., &
2424                          default_l_val=.FALSE., &
2425                          lone_keyword_l_val=.TRUE., &
2426                          usage="SMEAR ON")
2427      CALL section_add_keyword(subsection, keyword)
2428      CALL keyword_release(keyword)
2429
2430      CALL section_add_subsection(section, subsection)
2431      CALL section_release(subsection)
2432
2433   END SUBROUTINE create_dft_plus_u_section
2434
2435END MODULE input_cp2k_subsys
2436