CP2K 2.5 (Revision 12981)

input_cp2k_dft.f90

Go to the documentation of this file.
00001 !-----------------------------------------------------------------------------!
00002 !   CP2K: A general program to perform molecular dynamics simulations         !
00003 !   Copyright (C) 2000 - 2013  CP2K developers group                          !
00004 !-----------------------------------------------------------------------------!
00005 
00006 ! *****************************************************************************
00012 MODULE input_cp2k_dft
00013   USE bibliography,                    ONLY: &
00014        Avezac2005, Blochl1995, Brelaz1979, Dewar1977, Dewar1985, Dudarev1997, &
00015        Dudarev1998, Elstner1998, Guidon2010, Hu2007, Hunt2003, Iannuzzi2005, &
00016        Iannuzzi2006, Iannuzzi2007, Kolafa2004, Krack2000, Krack2002, &
00017        Kunert2003, Lippert1997, Lippert1999, Perdew1981, Porezag1995, &
00018        Repasky2002, Rocha2006, Schenter2008, Seifert1996, Stewart1982, &
00019        Stewart1989, Stewart2007, Thiel1992, VandeVondele2003, &
00020        VandeVondele2005a, VandeVondele2005b, VandeVondele2006, Weber2008, &
00021        Zhechkov2005
00022   USE cp_output_handling,              ONLY: cp_print_key_section_create
00023   USE cp_units,                        ONLY: cp_unit_to_cp2k
00024   USE f77_blas
00025   USE input_constants
00026   USE input_cp2k_atom,                 ONLY: create_powell_section
00027   USE input_cp2k_distribution,         ONLY: create_distribution_section
00028   USE input_cp2k_ls,                   ONLY: create_ls_scf_section
00029   USE input_cp2k_mm,                   ONLY: create_dipoles_section,&
00030                                              create_neighbor_lists_section
00031   USE input_cp2k_motion,               ONLY: add_format_keyword
00032   USE input_cp2k_poisson,              ONLY: create_poisson_section
00033   USE input_cp2k_rsgrid,               ONLY: create_rsgrid_section
00034   USE input_cp2k_xc,                   ONLY: create_xc_section
00035   USE input_keyword_types,             ONLY: keyword_create,&
00036                                              keyword_release,&
00037                                              keyword_type
00038   USE input_section_types,             ONLY: section_add_keyword,&
00039                                              section_add_subsection,&
00040                                              section_create,&
00041                                              section_release,&
00042                                              section_type
00043   USE input_val_types,                 ONLY: char_t,&
00044                                              integer_t,&
00045                                              lchar_t,&
00046                                              logical_t,&
00047                                              real_t
00048   USE kinds,                           ONLY: dp
00049   USE string_utilities,                ONLY: s2a
00050 #include "cp_common_uses.h"
00051 
00052   IMPLICIT NONE
00053   PRIVATE
00054 
00055   CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_dft'
00056 
00057   PUBLIC :: create_dft_section,create_relativistic_section
00058   PUBLIC :: create_bsse_section, create_qs_section
00059   PUBLIC :: create_scf_section, create_ep_section
00060   PUBLIC :: create_interp_section, create_localize_section, print_wanniers
00061 
00062 CONTAINS
00063 
00064 ! *****************************************************************************
00071   SUBROUTINE create_ep_section(section,error)
00072     TYPE(section_type), POINTER              :: section
00073     TYPE(cp_error_type), INTENT(inout)       :: error
00074 
00075     CHARACTER(len=*), PARAMETER :: routineN = 'create_ep_section', 
00076       routineP = moduleN//':'//routineN
00077 
00078     LOGICAL                                  :: failure
00079     TYPE(keyword_type), POINTER              :: keyword
00080     TYPE(section_type), POINTER              :: print_key, print_section
00081 
00082     failure=.FALSE.
00083 
00084     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
00085     CALL section_create(section,name="ep",&
00086          description="parameter needed by an ep calculation",&
00087          repeats=.FALSE., required=.TRUE.,&
00088          error=error)
00089 
00090     NULLIFY(keyword)
00091     CALL keyword_create(keyword, name="EPS_LIN_SOLV",&
00092          description="Requested convergence of the linear solver (for psi1)",&
00093          usage="EPS_LIN_SOLV",&
00094          default_r_val=1.e-5_dp,error=error)
00095     CALL section_add_keyword(section,keyword,error=error)
00096     CALL keyword_release(keyword,error=error)
00097     CALL keyword_create(keyword, name="ROTATE",&
00098          description="If rotations from a unique set of coefficients should"//&
00099          " be used or if single molecule optimizations generate it",&
00100          usage="ROTATE",&
00101          default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
00102     CALL section_add_keyword(section,keyword,error=error)
00103     CALL keyword_release(keyword,error=error)
00104     CALL keyword_create(keyword, name="START_COEFFS",&
00105          description="Starting coefficients for roatation based ep",&
00106          usage="START_COEFFS 1.0 0.0 ...",&
00107           type_of_var=real_t, n_var=-1,error=error)
00108     CALL section_add_keyword(section,keyword,error=error)
00109     CALL keyword_release(keyword,error=error)
00110     CALL keyword_create(keyword, name="E0_ONLY",&
00111          description="If only e0 should be calculated",&
00112          usage="E0_ONLY",&
00113          default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
00114     CALL section_add_keyword(section,keyword,error=error)
00115     CALL keyword_release(keyword,error=error)
00116     CALL keyword_create(keyword, name="COMP_INPUT",&
00117          description="Path to the input to be used for the component of the main system",&
00118          usage="COMP_INPUT comp.inp",&
00119          default_lc_val="comp.inp",error=error)
00120     CALL section_add_keyword(section,keyword,error=error)
00121     CALL keyword_release(keyword,error=error)
00122     CALL keyword_create(keyword, name="AT_PER_MOL",&
00123          description="Number of atoms in each molecule (at the moment only uniform system cam be handled)",&
00124          usage="at_per_mol 3",&
00125          default_i_val=3,error=error)
00126     CALL section_add_keyword(section,keyword,error=error)
00127     CALL keyword_release(keyword,error=error)
00128 
00129     NULLIFY(print_section)
00130     CALL section_create(print_section,name="print",&
00131          description="Section of possible print options for an EP calculation.",&
00132          repeats=.FALSE., required=.TRUE.,error=error)
00133 
00134     NULLIFY(print_key)
00135     CALL cp_print_key_section_create(print_key,"ENERGY",&
00136          description="Controls the printing of the various energies",&
00137          print_level=medium_print_level,filename="",&
00138          error=error)
00139     CALL section_add_subsection(print_section,print_key,error=error)
00140     CALL section_release(print_key,error=error)
00141 
00142     CALL cp_print_key_section_create(print_key,"RUN_INFO",&
00143          description="Prints various informations on the progress of the ep calculation",&
00144          print_level=medium_print_level,filename="__STD_OUT__",&
00145          error=error)
00146     CALL keyword_create(keyword, name="LIN_SOLV",&
00147          description="print the linear solver progress",&
00148          usage="lin_solv",&
00149          default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
00150     CALL section_add_keyword(print_key,keyword,error=error)
00151     CALL keyword_release(keyword,error=error)
00152 
00153     CALL section_add_subsection(print_section,print_key,error=error)
00154     CALL section_release(print_key,error=error)
00155 
00156     CALL cp_print_key_section_create(print_key,"EP_MATRIXES",&
00157          description="Prints various matrixes of an ep calculation",&
00158          print_level=debug_print_level,filename="__STD_OUT__",&
00159          error=error)
00160 
00161     CALL keyword_create(keyword, name="psi0",&
00162          description="print the value of the psi0 matrix",&
00163          usage="psi0",&
00164          default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
00165     CALL section_add_keyword(print_key,keyword,error=error)
00166     CALL keyword_release(keyword,error=error)
00167 
00168     CALL keyword_create(keyword, name="psi0_blocks",&
00169          description="print the value of the blocs of the psi0 matrix",&
00170          usage="psi0_blocks",&
00171          default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
00172     CALL section_add_keyword(print_key,keyword,error=error)
00173     CALL keyword_release(keyword,error=error)
00174 
00175     CALL keyword_create(keyword, name="psi1",&
00176          description="print the value of the psi1 matrix",&
00177          usage="psi1",&
00178          default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
00179     CALL section_add_keyword(print_key,keyword,error=error)
00180     CALL keyword_release(keyword,error=error)
00181 
00182     CALL keyword_create(keyword, name="mo_s_inv",&
00183          description="print the value of the inverse of the mo overlap matrix",&
00184          usage="mo_s_inv",&
00185          default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
00186     CALL section_add_keyword(print_key,keyword,error=error)
00187     CALL keyword_release(keyword,error=error)
00188 
00189     CALL section_add_subsection(print_section,print_key,error=error)
00190     CALL section_release(print_key,error=error)
00191 
00192     CALL cp_print_key_section_create(print_key,"EP_RHO_CUBE",&
00193          description="Prints out a cube file with the calculated rho",&
00194          print_level=debug_print_level,filename="EP_RHO",&
00195          error=error)
00196 
00197     CALL keyword_create(keyword, name="rho0",&
00198          description="print the cube of rho0,the psi0 derived density matrix",&
00199          usage="rho0 OFF",&
00200          default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
00201     CALL section_add_keyword(print_key,keyword,error=error)
00202     CALL keyword_release(keyword,error=error)
00203 
00204     CALL keyword_create(keyword, name="rho1",&
00205          description="print the value of the blocs of rho1, the psi1 (and psi0) derived density matrix",&
00206          usage="rho1 F",&
00207          default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
00208     CALL section_add_keyword(print_key,keyword,error=error)
00209     CALL keyword_release(keyword,error=error)
00210 
00211     CALL keyword_create(keyword, name="stride",&
00212          description="The stride (X,Y,Z) used to write the cube file "//&
00213          "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
00214          " 1 number valid for all components.",&
00215          usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
00216     CALL section_add_keyword(print_key,keyword,error=error)
00217     CALL keyword_release(keyword,error=error)
00218 
00219     CALL keyword_create(keyword, name="mo_s_inv",&
00220          description="print the value of the inverse of the mo overlap matrix",&
00221          usage="mo_s_inv",&
00222          default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
00223     CALL section_add_keyword(print_key,keyword,error=error)
00224     CALL keyword_release(keyword,error=error)
00225 
00226     CALL section_add_subsection(print_section,print_key,error=error)
00227     CALL section_release(print_key,error=error)
00228 
00229     CALL section_add_subsection(section,print_section,error=error)
00230     CALL section_release(print_section,error=error)
00231 
00232   END SUBROUTINE create_ep_section
00233 
00234 ! *****************************************************************************
00241   SUBROUTINE create_dft_section(section,error)
00242     TYPE(section_type), POINTER              :: section
00243     TYPE(cp_error_type), INTENT(inout)       :: error
00244 
00245     CHARACTER(len=*), PARAMETER :: routineN = 'create_dft_section', 
00246       routineP = moduleN//':'//routineN
00247 
00248     LOGICAL                                  :: failure
00249     TYPE(keyword_type), POINTER              :: keyword
00250     TYPE(section_type), POINTER              :: subsection
00251 
00252     failure=.FALSE.
00253 
00254     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
00255     CALL section_create(section,name="dft",&
00256          description="parameter needed by dft programs",&
00257          n_keywords=3, n_subsections=4, repeats=.FALSE., required=.TRUE.,&
00258          error=error)
00259 
00260     NULLIFY(keyword)
00261     CALL keyword_create(keyword, name="BASIS_SET_FILE_NAME",&
00262          description="Name of the basis set file, may include a path",&
00263          usage="BASIS_SET_FILE_NAME <FILENAME>",&
00264          type_of_var=lchar_t,repeats=.TRUE.,&
00265          default_lc_val="BASIS_SET",n_var=1,error=error)
00266     CALL section_add_keyword(section,keyword,error=error)
00267     CALL keyword_release(keyword,error=error)
00268 
00269     CALL keyword_create(keyword, name="POTENTIAL_FILE_NAME",&
00270          description="Name of the pseudo potential file, may include a path",&
00271          usage="POTENTIAL_FILE_NAME <FILENAME>",&
00272          default_lc_val="POTENTIAL",error=error)
00273     CALL section_add_keyword(section,keyword,error=error)
00274     CALL keyword_release(keyword,error=error)
00275 
00276     CALL keyword_create(keyword, name="GEMINAL_FILE_NAME",&
00277          description="Name of the geminal basis set file, may include a path",&
00278          usage="GEMINAL_FILE_NAME <FILENAME>",&
00279          default_lc_val="BASIS_GEMINAL",error=error)
00280     CALL section_add_keyword(section,keyword,error=error)
00281     CALL keyword_release(keyword,error=error)
00282 
00283     CALL keyword_create(keyword, name="WFN_RESTART_FILE_NAME",&
00284          variants=(/"RESTART_FILE_NAME"/),&
00285          description="Name of the wavefunction restart file, may include a path."//&
00286          " If no file is specified, the default is to open the file as generated by the wfn restart print key.",&
00287          usage="WFN_RESTART_FILE_NAME <FILENAME>",&
00288          type_of_var=lchar_t,&
00289          error=error)
00290     CALL section_add_keyword(section,keyword,error=error)
00291     CALL keyword_release(keyword,error=error)
00292 
00293     CALL keyword_create(keyword=keyword,&
00294          name="UKS",&
00295          variants=s2a("UNRESTRICTED_KOHN_SHAM",&
00296          "LSD",&
00297          "SPIN_POLARIZED"),&
00298          description="Requests a spin-polarized calculation using alpha "//&
00299          "and beta orbitals, i.e. no spin restriction is applied",&
00300          usage="LSD",&
00301          default_l_val=.FALSE.,&
00302          lone_keyword_l_val=.TRUE.,&
00303          error=error)
00304     CALL section_add_keyword(section,keyword,error=error)
00305     CALL keyword_release(keyword,error=error)
00306     CALL keyword_create(keyword=keyword,&
00307          name="ROKS",&
00308          variants=(/"RESTRICTED_OPEN_KOHN_SHAM"/),&
00309          description="Requests a restricted open Kohn-Sham calculation",&
00310          usage="ROKS",&
00311          default_l_val=.FALSE.,&
00312          lone_keyword_l_val=.TRUE.,&
00313          error=error)
00314     CALL section_add_keyword(section,keyword,error=error)
00315     CALL keyword_release(keyword,error=error)
00316     CALL keyword_create(keyword=keyword,&
00317          name="MULTIPLICITY",&
00318          variants=(/"MULTIP"/),&
00319          description="Two times the total spin plus one. "//&
00320          "Specify 3 for a triplet, 4 for a quartet, "//&
00321          "and so on. Default is 1 (singlet) for an "//&
00322          "even number and 2 (doublet) for an odd number "//&
00323          "of electrons.",&
00324          usage="MULTIPLICITY 3",&
00325          default_i_val=0,& ! this default value is just a flag to get the above
00326          error=error)
00327     CALL section_add_keyword(section,keyword,error=error)
00328     CALL keyword_release(keyword,error=error)
00329     CALL keyword_create(keyword, name="CHARGE",&
00330          description="The total charge of the system",&
00331          usage="CHARGE -1",&
00332          default_i_val=0,error=error)
00333     CALL section_add_keyword(section,keyword,error=error)
00334     CALL keyword_release(keyword,error=error)
00335     CALL keyword_create(keyword, name="EXCITATIONS",&
00336          description="If excitations should be calculated",&
00337          usage="EXCITATIONS",&
00338          enum_c_vals=s2a("NONE","TDLR","TDDFPT"),&
00339          enum_i_vals=(/ no_excitations, tddfpt_excitations, &
00340          tddfpt_excitations/),&
00341          default_i_val=no_excitations, error=error)
00342     CALL section_add_keyword(section,keyword,error=error)
00343     CALL keyword_release(keyword,error=error)
00344 
00345     CALL keyword_create(keyword,&
00346                         name="PLUS_U_METHOD",&
00347                         description="Method employed for the calculation of the DFT+U contribution",&
00348                         required=.FALSE.,&
00349                         repeats=.FALSE.,&
00350                         enum_c_vals=s2a("LOWDIN","MULLIKEN","MULLIKEN_CHARGES"),&
00351                         enum_i_vals=(/plus_u_lowdin,plus_u_mulliken,plus_u_mulliken_charges/),&
00352                         enum_desc=s2a("Method based on Lowdin population analysis "//&
00353                                       "(computationally expensive, since the diagonalization of the "//&
00354                                       "overlap matrix is required, but possibly more robust than Mulliken)",&
00355                                       "Method based on Mulliken population analysis using the net AO and "//&
00356                                       "overlap populations (computationally cheap method)",&
00357                                       "Method based on Mulliken gross orbital populations (GOP)"),&
00358                         n_var=1,&
00359                         default_i_val=plus_u_mulliken,&
00360                         usage="METHOD Lowdin",&
00361                         error=error)
00362     CALL section_add_keyword(section,keyword,error=error)
00363     CALL keyword_release(keyword,error=error)
00364 
00365     CALL keyword_create(keyword,&
00366                         name="RELAX_MULTIPLICITY",&
00367                         variants=(/"RELAX_MULTIP"/),&
00368                         description="Do not enforce the occupation of alpha and beta MOs due to the initially "//&
00369                                     "defined multiplicity, but rather follow an Aufbau principle. "//&
00370                                     "A threshold value greater than zero activates this option. "//&
00371                                     "Larger threshold values increase the probability for a spin flip. "//&
00372                                     "This option is only valid for unrestricted (i.e. spin polarised) "//&
00373                                     "Kohn-Sham (UKS) calculations.",&
00374                         usage="RELAX_MULTIPLICITY 0.00001",&
00375                         required=.FALSE.,&
00376                         repeats=.FALSE.,&
00377                         default_r_val=0.0_dp,&
00378                         error=error)
00379     CALL section_add_keyword(section,keyword,error=error)
00380     CALL keyword_release(keyword,error=error)
00381 
00382     CALL keyword_create(keyword, name="SUBCELLS",&
00383          description="Read the grid size for subcell generation in the construction of "//&
00384          "neighbor lists.", usage="SUBCELLS 1.5",&
00385          n_var=1,default_r_val=2.0_dp, error=error)
00386     CALL section_add_keyword(section,keyword,error=error)
00387     CALL keyword_release(keyword,error=error)
00388 
00389     NULLIFY(subsection)
00390     CALL create_scf_section(subsection,error)
00391     CALL section_add_subsection(section, subsection, error=error)
00392     CALL section_release(subsection,error=error)
00393 
00394     CALL create_ls_scf_section(subsection,error)
00395     CALL section_add_subsection(section, subsection, error=error)
00396     CALL section_release(subsection,error=error)
00397 
00398     CALL create_kg_section(subsection,error)
00399     CALL section_add_subsection(section, subsection, error=error)
00400     CALL section_release(subsection,error=error)
00401 
00402     CALL create_scp_section(subsection,error)
00403     CALL section_add_subsection(section, subsection, error=error)
00404     CALL section_release(subsection,error=error)
00405 
00406     CALL create_admm_section(subsection,error)
00407     CALL section_add_subsection(section, subsection, error=error)
00408     CALL section_release(subsection,error=error)
00409 
00410     CALL create_qs_section(subsection,error)
00411     CALL section_add_subsection(section, subsection, error=error)
00412     CALL section_release(subsection,error=error)
00413 
00414     CALL create_tddfpt_section(subsection,error)
00415     CALL section_add_subsection(section, subsection, error=error)
00416     CALL section_release(subsection,error=error)
00417 
00418     CALL create_mgrid_section(subsection,error=error)
00419     CALL section_add_subsection(section, subsection,error=error)
00420     CALL section_release(subsection,error=error)
00421 
00422     CALL create_xc_section(subsection,error)
00423     CALL section_add_subsection(section, subsection, error=error)
00424     CALL section_release(subsection,error=error)
00425 
00426     CALL create_relativistic_section(subsection,error)
00427     CALL section_add_subsection(section, subsection, error=error)
00428     CALL section_release(subsection,error=error)
00429 
00430     CALL create_sic_section(subsection,error)
00431     CALL section_add_subsection(section, subsection, error=error)
00432     CALL section_release(subsection,error=error)
00433 
00434     CALL create_low_spin_roks_section(subsection,error)
00435     CALL section_add_subsection(section, subsection, error=error)
00436     CALL section_release(subsection,error=error)
00437 
00438     CALL create_efield_section(subsection,error)
00439     CALL section_add_subsection(section, subsection, error=error)
00440     CALL section_release(subsection,error=error)
00441 
00442     CALL create_per_efield_section(subsection,error)
00443     CALL section_add_subsection(section, subsection, error=error)
00444     CALL section_release(subsection,error=error)
00445 
00446     CALL create_ext_pot_section(subsection,error)
00447     CALL section_add_subsection(section, subsection, error=error)
00448     CALL section_release(subsection,error=error)
00449 
00450     CALL create_poisson_section(subsection,error)
00451     CALL section_add_subsection(section, subsection, error=error)
00452     CALL section_release(subsection,error=error)
00453 
00454     CALL create_implicit_solv_section(subsection, error)
00455     CALL section_add_subsection(section,subsection,error=error)
00456     CALL section_release(subsection,error=error)
00457 
00458     CALL create_density_fitting_section(subsection,error)
00459     CALL section_add_subsection(section, subsection, error=error)
00460     CALL section_release(subsection,error=error)
00461 
00462     CALL create_xas_section(subsection,error)
00463     CALL section_add_subsection(section, subsection, error=error)
00464     CALL section_release(subsection,error=error)
00465 
00466     CALL create_localize_section(subsection,error)
00467     CALL section_add_subsection(section, subsection, error=error)
00468     CALL section_release(subsection,error=error)
00469 
00470     CALL create_rtp_section(subsection,error)
00471     CALL section_add_subsection(section, subsection, error=error)
00472     CALL section_release(subsection,error=error)
00473 
00474     CALL create_print_dft_section(subsection,error)
00475     CALL section_add_subsection(section, subsection, error=error)
00476     CALL section_release(subsection,error=error)
00477   END SUBROUTINE create_dft_section
00478 
00479 ! *****************************************************************************
00485   SUBROUTINE create_implicit_solv_section(section,error)
00486     TYPE(section_type), POINTER              :: section
00487     TYPE(cp_error_type), INTENT(inout)       :: error
00488 
00489     CHARACTER(len=*), PARAMETER :: routineN = 'create_implicit_solv_section', 
00490       routineP = moduleN//':'//routineN
00491 
00492     LOGICAL                                  :: failure
00493     TYPE(keyword_type), POINTER              :: keyword
00494     TYPE(section_type), POINTER              :: print_key, subsection
00495 
00496     failure=.FALSE.
00497 
00498     NULLIFY(keyword, subsection, print_key)
00499     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
00500     IF (.NOT. failure) THEN
00501        CALL section_create(section,name="SCRF",&
00502             description="Adds an implicit solvation model to the DFT calculation."//&
00503             " Know also as Self Consistent Reaction Field.",&
00504             n_keywords=0, n_subsections=0, repeats=.FALSE., required=.TRUE.,&
00505             error=error)
00506 
00507        CALL keyword_create(keyword,name="EPS_OUT",&
00508             description="Value of the dielectric constant outside the sphere",&
00509             usage="EPS_OUT <REAL>",&
00510             default_r_val=1.0_dp,error=error)
00511        CALL section_add_keyword(section,keyword,error=error)
00512        CALL keyword_release(keyword,error=error)
00513 
00514        CALL keyword_create(keyword,name="LMAX",&
00515             description="Maximum value of L used in the multipole expansion",&
00516             usage="LMAX <INTEGER>",&
00517             default_i_val=3,error=error)
00518        CALL section_add_keyword(section,keyword,error=error)
00519        CALL keyword_release(keyword,error=error)
00520 
00521        CALL create_sphere_section(subsection,error)
00522        CALL section_add_subsection(section, subsection, error=error)
00523        CALL section_release(subsection,error=error)
00524 
00525        CALL cp_print_key_section_create(print_key,"program_run_info",&
00526             description="Controls the printing basic info about the method", &
00527             print_level=low_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
00528             error=error)
00529        CALL section_add_subsection(section,print_key,error=error)
00530        CALL section_release(print_key,error=error)
00531 
00532     END IF
00533   END SUBROUTINE create_implicit_solv_section
00534 
00535 ! *****************************************************************************
00541   SUBROUTINE create_sphere_section(section,error)
00542     TYPE(section_type), POINTER              :: section
00543     TYPE(cp_error_type), INTENT(inout)       :: error
00544 
00545     CHARACTER(len=*), PARAMETER :: routineN = 'create_sphere_section', 
00546       routineP = moduleN//':'//routineN
00547 
00548     LOGICAL                                  :: failure
00549     TYPE(keyword_type), POINTER              :: keyword
00550     TYPE(section_type), POINTER              :: subsection
00551 
00552     failure=.FALSE.
00553 
00554     NULLIFY(keyword, subsection)
00555     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
00556     IF (.NOT. failure) THEN
00557        CALL section_create(section,name="SPHERE",&
00558             description="Treats the implicit solvent environment like a sphere",&
00559             n_keywords=0, n_subsections=0, repeats=.FALSE., required=.TRUE.,&
00560             error=error)
00561 
00562        CALL keyword_create(keyword,name="RADIUS",&
00563             description="Value of the spherical cavity in the dielectric medium",&
00564             usage="RADIUS <REAL>",&
00565             unit_str="angstrom",&
00566             type_of_var=real_t,error=error)
00567        CALL section_add_keyword(section,keyword,error=error)
00568        CALL keyword_release(keyword,error=error)
00569 
00570        CALL create_center_section(subsection,error)
00571        CALL section_add_subsection(section, subsection, error=error)
00572        CALL section_release(subsection,error=error)
00573 
00574     END IF
00575   END SUBROUTINE create_sphere_section
00576 
00577 ! *****************************************************************************
00582   SUBROUTINE create_center_section(section,error)
00583     TYPE(section_type), POINTER              :: section
00584     TYPE(cp_error_type), INTENT(inout)       :: error
00585 
00586     CHARACTER(len=*), PARAMETER :: routineN = 'create_center_section', 
00587       routineP = moduleN//':'//routineN
00588 
00589     LOGICAL                                  :: failure
00590     TYPE(keyword_type), POINTER              :: keyword
00591 
00592     failure=.FALSE.
00593 
00594     NULLIFY(keyword)
00595     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
00596     IF (.NOT. failure) THEN
00597        CALL section_create(section,name="CENTER",&
00598             description="Defines the center of the sphere.",&
00599             n_keywords=0, n_subsections=0, repeats=.FALSE., required=.TRUE.,&
00600             error=error)
00601 
00602        CALL keyword_create(keyword,name="XYZ",&
00603             description="Coordinates of the center of the sphere",&
00604             usage="XYZ <REAL> <REAL> <REAL>",&
00605             unit_str="angstrom",&
00606             type_of_var=real_t, n_var=3, error=error)
00607        CALL section_add_keyword(section,keyword,error=error)
00608        CALL keyword_release(keyword,error=error)
00609 
00610        CALL keyword_create(keyword,name="ATOM_LIST",&
00611             description="Defines a list of atoms to define the center of the sphere",&
00612             usage="ATOM_LIST <INTEGER> .. <INTEGER>",&
00613             type_of_var=integer_t, n_var=-1, error=error)
00614        CALL section_add_keyword(section,keyword,error=error)
00615        CALL keyword_release(keyword,error=error)
00616 
00617        CALL keyword_create(keyword,name="WEIGHT",&
00618             description="Defines the weight used to define the center of the sphere"//&
00619             " (if ATOM_LIST is provided)",&
00620             usage="WEIGHT (UNIT|MASS)",&
00621             enum_c_vals=(/"UNIT","MASS"/),&
00622             enum_i_vals=(/weight_type_unit,weight_type_mass/),&
00623             default_i_val=weight_type_unit,error=error)
00624        CALL section_add_keyword(section,keyword,error=error)
00625        CALL keyword_release(keyword,error=error)
00626 
00627        CALL keyword_create(keyword,name="FIXED",&
00628             description="Specify if the center of the sphere should be fixed or"//&
00629             " allowed to move",&
00630             usage="FIXED <LOGICAL>",&
00631             default_l_val=.TRUE., error=error)
00632        CALL section_add_keyword(section,keyword,error=error)
00633        CALL keyword_release(keyword,error=error)
00634     END IF
00635   END SUBROUTINE create_center_section
00636 
00637 ! *****************************************************************************
00642   SUBROUTINE create_localize_section(section, error)
00643 
00644     TYPE(section_type), POINTER              :: section
00645     TYPE(cp_error_type), INTENT(inout)       :: error
00646 
00647     CHARACTER(len=*), PARAMETER :: routineN = 'create_localize_section', 
00648       routineP = moduleN//':'//routineN
00649 
00650     LOGICAL                                  :: failure
00651     TYPE(keyword_type), POINTER              :: keyword
00652     TYPE(section_type), POINTER              :: print_key, print_section, 
00653                                                 subsection
00654 
00655     failure=.FALSE.
00656 
00657     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
00658     IF (.NOT. failure) THEN
00659 
00660        NULLIFY(keyword, print_key)
00661        CALL section_create(section,name="LOCALIZE",&
00662             description="Use one of the available methods to define the localization "//&
00663             " and possibly to optimize it to a minimum or a maximum.",&
00664             n_keywords=8, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
00665             error=error)
00666 
00667        CALL keyword_create(keyword, name="_SECTION_PARAMETERS_",&
00668             description="controls the activation of the MOS localization procedure",&
00669             usage="&LOCALIZE T",default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,&
00670             error=error)
00671        CALL section_add_keyword(section,keyword,error=error)
00672        CALL keyword_release(keyword,error=error)
00673 
00674        CALL keyword_create(keyword, name="MAX_ITER",&
00675             description="Maximum number of iterations used for localization methods",&
00676             usage="MAX_ITER 2000", default_i_val=10000, error=error)
00677        CALL section_add_keyword(section,keyword,error=error)
00678        CALL keyword_release(keyword,error=error)
00679 
00680        CALL keyword_create(keyword, name="MAX_CRAZY_ANGLE",&
00681             description="Largest allowed angle for the crazy rotations algorithm (smaller is slower but more stable).",&
00682             usage="MAX_CRAZY_ANGLE 0.1", unit_str="rad", default_r_val=0.2_dp, error=error)
00683        CALL section_add_keyword(section,keyword,error=error)
00684        CALL keyword_release(keyword,error=error)
00685 
00686        CALL keyword_create(keyword, name="CRAZY_SCALE",&
00687             description="scale angles",&
00688             usage="CRAZY_SCALE 0.9", default_r_val=1.0_dp, error=error)
00689        CALL section_add_keyword(section,keyword,error=error)
00690        CALL keyword_release(keyword,error=error)
00691 
00692        CALL keyword_create(keyword, name="CRAZY_USE_DIAG",&
00693             description="Use diagonalization (slow) or pade based calculation of matrix exponentials.",&
00694             usage="CRAZY_USE_DIAG ", default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
00695        CALL section_add_keyword(section,keyword,error=error)
00696        CALL keyword_release(keyword,error=error)
00697 
00698        CALL keyword_create(keyword, name="USE_HISTORY",&
00699             description="Generate an improved initial guess based on a history of results, which is useful during MD."//&
00700                         "Will only work if the number of states to be localized remains constant.",&
00701             usage="USE_HISTORY ", default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
00702        CALL section_add_keyword(section,keyword,error=error)
00703        CALL keyword_release(keyword,error=error)
00704 
00705        CALL keyword_create(keyword, name="EPS_OCCUPATION",&
00706             description="Tolerance in the occupation number to select only fully occupied orbitals for the rotation",&
00707             usage="EPS_OCCUPATION 1.E-5", default_r_val=1.0E-8_dp, error=error)
00708        CALL section_add_keyword(section,keyword,error=error)
00709        CALL keyword_release(keyword,error=error)
00710 
00711        CALL keyword_create(keyword, name="OUT_ITER_EACH",&
00712             description="Every how many iterations of the localization algorithm"//&
00713             "(Jacobi) the tolerance value is printed out",&
00714             usage="OUT_ITER_EACH 100", default_i_val=100, error=error)
00715        CALL section_add_keyword(section,keyword,error=error)
00716        CALL keyword_release(keyword,error=error)
00717 
00718        CALL keyword_create(keyword, name="EPS_LOCALIZATION",&
00719             description="Tolerance used in the convergence criterium of the localization methods.",&
00720             usage="EPS_LOCALIZATION 1.0E-2", default_r_val=1.0E-4_dp, error=error)
00721        CALL section_add_keyword(section,keyword,error=error)
00722        CALL keyword_release(keyword,error=error)
00723 
00724        CALL keyword_create(keyword,name="MIN_OR_MAX",&
00725             description="Requires the maximization of the spread of the wfn",&
00726             usage="MIN_OR_MAX (SPREADMIN|SPREADMAX)",&
00727             enum_c_vals=(/"SPREADMIN","SPREADMAX"/),&
00728             enum_i_vals=(/do_loc_min, do_loc_max/),&
00729             default_i_val=do_loc_min,error=error)
00730        CALL section_add_keyword(section,keyword,error=error)
00731        CALL keyword_release(keyword,error=error)
00732 
00733        CALL keyword_create(keyword,name="METHOD",&
00734             description="Method of optimization if any",&
00735             usage="METHOD (JACOBI|CRAZY|DIRECT|L1SD|NONE)",&
00736             enum_c_vals=s2a("NONE","JACOBI","CRAZY","L1SD","DIRECT"),&
00737             enum_i_vals=(/do_loc_none, &
00738                           do_loc_jacobi, &
00739                           do_loc_crazy, &
00740                           do_loc_l1_norm_sd, &
00741                           do_loc_direct/),&
00742             enum_desc=s2a("No localization is applied",&
00743             "Using 2 x 2 rotations of the orbitals, slow but robust",&
00744             "A new fast method is applied, might be slightly less robust than jacobi, but usually much faster",&
00745             "Steepest descent minimization of an approximate l1 norm",&
00746             "Using a direct minimisation approach"),&
00747             default_i_val=do_loc_jacobi,error=error)
00748        CALL section_add_keyword(section,keyword,error=error)
00749        CALL keyword_release(keyword,error=error)
00750 
00751        CALL keyword_create(keyword, name="JACOBI_FALLBACK",&
00752             description="Use Jacobi method in case no convergence was achieved"//&
00753             " by using the crazy rotations method.",&
00754             usage="JACOBI_FALLBACK", default_l_val=.TRUE., &
00755             lone_keyword_l_val=.TRUE., error=error)
00756        CALL section_add_keyword(section,keyword,error=error)
00757        CALL keyword_release(keyword,error=error)
00758 
00759        CALL keyword_create(keyword, name="RESTART",&
00760             description="Restart the localization from a set of orbitals"//&
00761             " read from a localization restart file.",&
00762             usage="RESTART", default_l_val=.FALSE., &
00763             lone_keyword_l_val=.TRUE., error=error)
00764        CALL section_add_keyword(section,keyword,error=error)
00765        CALL keyword_release(keyword,error=error)
00766 
00767        CALL keyword_create(keyword, name="LOCHOMO_RESTART_FILE_NAME",&
00768             description="File name where to read the MOS from"//&
00769             "which to restart the localization procedure for occupied states",&
00770             usage="LOCHOMO_RESTART_FILE_NAME <FILENAME>",&
00771             type_of_var=lchar_t,&
00772             error=error)
00773        CALL section_add_keyword(section,keyword,error=error)
00774        CALL keyword_release(keyword,error=error)
00775 
00776        CALL keyword_create(keyword, name="LOCLUMO_RESTART_FILE_NAME",&
00777             description="File name where to read the MOS from"//&
00778             "which to restart the localization procedure for unoccupied states",&
00779             usage="LOCLUMO_RESTART_FILE_NAME <FILENAME>",&
00780             type_of_var=lchar_t,&
00781             error=error)
00782        CALL section_add_keyword(section,keyword,error=error)
00783        CALL keyword_release(keyword,error=error)
00784 
00785        CALL keyword_create(keyword,name="OPERATOR",&
00786             description="Type of opertator which defines the spread functional",&
00787             usage="OPERATOR (BERRY|BOYS|PIPEK)",&
00788             enum_c_vals=s2a("BERRY","BOYS","PIPEK"),&
00789             enum_i_vals=(/op_loc_berry, op_loc_boys, op_loc_pipek/),&
00790             default_i_val=op_loc_berry,error=error)
00791        CALL section_add_keyword(section,keyword,error=error)
00792        CALL keyword_release(keyword,error=error)
00793 
00794        CALL keyword_create(keyword,name="LIST",&
00795             description="Indexes of the occupied wfn to be localized"//&
00796             "This keyword can be repeated several times"//&
00797             "(useful if you have to specify many indexes).",&
00798             usage="LIST 1 2",&
00799             n_var=-1,type_of_var=integer_t,repeats=.TRUE.,error=error)
00800        CALL section_add_keyword(section,keyword,error=error)
00801        CALL keyword_release(keyword,error=error)
00802 
00803        CALL keyword_create(keyword,name="LIST_UNOCCUPIED",&
00804             description="Indexes of the unoccupied states to be localized, "//&
00805             "up to now only valid in combination with GPW. "//&
00806             "This keyword has to be present if unoccupied states should be localized. "//&
00807             "This keyword can be repeated several times"//&
00808             "(useful if you have to specify many indexes).",&
00809             usage="LIST 1 2",&
00810             n_var=-1,type_of_var=integer_t,repeats=.TRUE.,error=error)
00811        CALL section_add_keyword(section,keyword,error=error)
00812        CALL keyword_release(keyword,error=error)
00813 
00814        CALL keyword_create(keyword,name="STATES",&
00815             description="Which states to localize, LUMO up to now only available in GPW",&
00816             usage="STATES (HOMO|LUMO|ALL)",&
00817             enum_c_vals=s2a("OCCUPIED","UNOCCUPIED","ALL"),&
00818             enum_i_vals=(/do_loc_homo, do_loc_lumo,do_loc_both/),&
00819             default_i_val=do_loc_homo,error=error)
00820        CALL section_add_keyword(section,keyword,error=error)
00821        CALL keyword_release(keyword,error=error)
00822 
00823        CALL keyword_create(keyword=keyword,&
00824             name="ENERGY_RANGE",&
00825             description="Select the orbitals to be localized within the given energy range."//&
00826             "This type of selection cannot be added on top of the selection through a LIST. It reads to reals that are"//&
00827             " lower and higher boundaries of the energy range.",&
00828             usage=" ENERGY_RANGE lower_bound {real}, higher_bound {real}", &
00829             repeats=.FALSE.,&
00830             required=.FALSE.,&
00831             n_var=2,default_r_vals=(/0._dp,0._dp/),unit_str='eV',&
00832             type_of_var=real_t, error=error)
00833        CALL section_add_keyword(section,keyword,error=error)
00834        CALL keyword_release(keyword,error=error)
00835 
00836        NULLIFY(print_section)
00837        CALL section_create(print_section,name="PRINT",&
00838             description="Collects all printing options related to the Wannier centers and "//&
00839             "properties computed with Wannier centers.",&
00840             n_keywords=0, n_subsections=1, repeats=.FALSE., required=.FALSE.,&
00841             error=error)
00842        NULLIFY(print_key)
00843        CALL cp_print_key_section_create(print_key,"program_run_info",&
00844             description="Controls the printing basic info about the method", &
00845             print_level=low_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
00846             error=error)
00847        CALL section_add_subsection(print_section,print_key,error=error)
00848        CALL section_release(print_key,error=error)
00849        ! Add printing of wannier infos
00850        CALL print_wanniers(print_section, error)
00851        NULLIFY(subsection)
00852        ! Total Dipoles with wannier
00853        CALL create_dipoles_section(subsection,"TOTAL_DIPOLE",debug_print_level+1,error)
00854        CALL section_add_subsection(print_section, subsection, error=error)
00855        CALL section_release(subsection,error=error)
00856        ! Molecular Dipoles with wannier
00857        CALL create_dipoles_section(subsection,"MOLECULAR_DIPOLES",debug_print_level+1,error)
00858        CALL section_add_subsection(print_section, subsection, error=error)
00859        CALL section_release(subsection,error=error)
00860        ! Molecular States with wannier
00861        CALL create_molecular_states_section(subsection,error)
00862        CALL section_add_subsection(print_section, subsection, error=error)
00863        CALL section_release(subsection,error=error)
00864        ! Wannier States with wannier
00865        CALL create_wannier_states_section(subsection,error)
00866        CALL section_add_subsection(print_section, subsection, error=error)
00867        CALL section_release(subsection,error=error)
00868        CALL section_add_subsection(section,print_section,error=error)
00869        CALL section_release(print_section,error=error)
00870 
00871 
00872     END IF
00873   END SUBROUTINE create_localize_section
00874 
00875 ! *****************************************************************************
00882   SUBROUTINE print_wanniers(section, error)
00883     TYPE(section_type), POINTER              :: section
00884     TYPE(cp_error_type), INTENT(inout)       :: error
00885 
00886     CHARACTER(len=*), PARAMETER :: routineN = 'print_wanniers', 
00887       routineP = moduleN//':'//routineN
00888 
00889     LOGICAL                                  :: failure
00890     TYPE(keyword_type), POINTER              :: keyword
00891     TYPE(section_type), POINTER              :: print_key
00892 
00893     failure=.FALSE.
00894     CPPrecondition(ASSOCIATED(section),cp_failure_level,routineP,error,failure)
00895     NULLIFY(print_key, keyword)
00896     CALL cp_print_key_section_create(print_key,"WANNIER_CUBES",&
00897          description="Controls the printing of the wannier functions ", &
00898          print_level=high_print_level,add_last=add_last_numeric,filename="",&
00899          error=error)
00900     CALL keyword_create(keyword, name="stride",&
00901          description="The stride (X,Y,Z) used to write the cube file "//&
00902          "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
00903          " 1 number valid for all components.",&
00904          usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
00905     CALL section_add_keyword(print_key,keyword,error=error)
00906     CALL keyword_release(keyword,error=error)
00907 
00908     CALL keyword_create(keyword,name="CUBES_LU_BOUNDS",&
00909          variants=(/"CUBES_LU"/),&
00910          description="The lower and upper index of the states to be printed as cube",&
00911          usage="CUBES_LU_BOUNDS integer integer",&
00912          n_var=2,default_i_vals=(/0,-2/), type_of_var=integer_t,error=error)
00913     CALL section_add_keyword(print_key,keyword,error=error)
00914     CALL keyword_release(keyword,error=error)
00915 
00916     CALL keyword_create(keyword,name="CUBES_LIST",&
00917          description="Indexes of the states to be printed as cube files"//&
00918          "This keyword can be repeated several times"//&
00919          "(useful if you have to specify many indexes).",&
00920          usage="CUBES_LIST 1 2",&
00921          n_var=-1,type_of_var=integer_t,repeats=.TRUE.,error=error)
00922     CALL section_add_keyword(print_key,keyword,error=error)
00923     CALL keyword_release(keyword,error=error)
00924     CALL keyword_create(keyword, name="APPEND",&
00925             description="append the cube files when they already exist",&
00926             default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
00927     CALL section_add_keyword(print_key,keyword,error=error)
00928     CALL keyword_release(keyword,error=error)
00929 
00930     CALL section_add_subsection(section,print_key,error=error)
00931     CALL section_release(print_key,error=error)
00932 
00933     NULLIFY(print_key)
00934     CALL cp_print_key_section_create(print_key,"WANNIER_CENTERS",&
00935          description="Controls the printing of the wannier functions", &
00936          print_level=high_print_level,add_last=add_last_numeric,filename="",&
00937          unit_str="angstrom",error=error)
00938 
00939     CALL keyword_create(keyword, name="IONS+CENTERS",&
00940          description="prints out the wannier centers together with the particles",&
00941          usage="IONS+CENTERS", default_l_val=.FALSE., &
00942          lone_keyword_l_val=.TRUE., error=error)
00943     CALL section_add_keyword(print_key,keyword,error=error)
00944     CALL keyword_release(keyword,error=error)
00945 
00946     CALL add_format_keyword(keyword, print_key, pos=.TRUE.,& 
00947          description="Specifies the format of the output file when IONS+CENTERS is enabled.",&
00948          error=error)
00949     CALL section_add_subsection(section,print_key,error=error)
00950     CALL section_release(print_key,error=error)
00951 
00952     NULLIFY(print_key)
00953     CALL cp_print_key_section_create(print_key,"WANNIER_SPREADS",&
00954          description="Controls the printing of the wannier functions", &
00955          print_level=high_print_level,add_last=add_last_numeric,filename="",&
00956          error=error)
00957     CALL section_add_subsection(section,print_key,error=error)
00958     CALL section_release(print_key,error=error)
00959 
00960     NULLIFY(print_key)
00961     CALL cp_print_key_section_create(print_key,"LOC_RESTART",&
00962          description="Controls the printing of restart file for localized MOS", &
00963          print_level=high_print_level,add_last=add_last_numeric,filename="",&
00964          error=error)
00965     CALL section_add_subsection(section,print_key,error=error)
00966     CALL section_release(print_key,error=error)
00967 
00968   END SUBROUTINE print_wanniers
00969 
00970 ! *****************************************************************************
00977   SUBROUTINE create_print_dft_section(section,error)
00978     TYPE(section_type), POINTER              :: section
00979     TYPE(cp_error_type), INTENT(inout)       :: error
00980 
00981     CHARACTER(len=*), PARAMETER :: routineN = 'create_print_dft_section', 
00982       routineP = moduleN//':'//routineN
00983 
00984     LOGICAL                                  :: failure
00985     TYPE(keyword_type), POINTER              :: keyword
00986     TYPE(section_type), POINTER              :: print_key, subsection
00987 
00988     failure=.FALSE.
00989 
00990     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
00991     IF (.NOT. failure) THEN
00992        CALL section_create(section,name="print",&
00993             description="Section of possible print options in DFT code.",&
00994             n_keywords=0, n_subsections=1, repeats=.FALSE., required=.TRUE.,&
00995             error=error)
00996 
00997        NULLIFY(print_key, keyword, subsection)
00998 
00999        CALL cp_print_key_section_create(print_key,"PROGRAM_BANNER",&
01000             description="Controls the printing of the banner of the MM program",&
01001             print_level=silent_print_level,filename="__STD_OUT__",&
01002             error=error)
01003        CALL section_add_subsection(section,print_key,error=error)
01004        CALL section_release(print_key,error=error)
01005 
01006        CALL cp_print_key_section_create(print_key,"KINETIC_ENERGY",&
01007             description="Controls the printing of the kinetic energy",&
01008             print_level=high_print_level,filename="__STD_OUT__",&
01009             error=error)
01010        CALL section_add_subsection(section,print_key,error=error)
01011        CALL section_release(print_key,error=error)
01012 
01013        CALL cp_print_key_section_create(print_key,"DERIVATIVES",&
01014             description="Print all derivatives after the DFT calculation", &
01015             print_level=high_print_level,filename="__STD_OUT__",&
01016             error=error)
01017        CALL keyword_create(keyword=keyword,&
01018             name="ndigits",&
01019             description="Specify the number of digits used to print derivatives",&
01020             default_i_val=6,&
01021             error=error)
01022        CALL section_add_keyword(print_key,keyword,error=error)
01023        CALL keyword_release(keyword,error=error)
01024 
01025        CALL section_add_subsection(section,print_key,error=error)
01026        CALL section_release(print_key,error=error)
01027 
01028        CALL cp_print_key_section_create(print_key_section=print_key,&
01029             name="neighbor_lists",&
01030             description="Controls the printing of the neighbor lists",&
01031             print_level=debug_print_level, filename="", unit_str="angstrom",&
01032             error=error)
01033        CALL keyword_create(keyword=keyword,&
01034             name="sab_orb",&
01035             description="Activates the printing of the orbital "//&
01036             "orbital neighbor lists, "//&
01037             "i.e. the overlap neighbor lists",&
01038             default_l_val=.FALSE.,&
01039             lone_keyword_l_val=.TRUE.,&
01040             error=error)
01041        CALL section_add_keyword(print_key,keyword,error=error)
01042        CALL keyword_release(keyword,error=error)
01043 
01044        CALL keyword_create(keyword=keyword,&
01045             name="sab_aux_fit",&
01046             description="Activates the printing of the orbital "//&
01047             "orbital neighbor lists wavefunction fitting basis, "//&
01048             "i.e. the overlap neighbor lists",&
01049             default_l_val=.FALSE.,&
01050             lone_keyword_l_val=.TRUE.,&
01051             error=error)
01052        CALL section_add_keyword(print_key,keyword,error=error)
01053        CALL keyword_release(keyword,error=error)
01054 
01055        CALL keyword_create(keyword=keyword,&
01056             name="sab_aux_fit_vs_orb",&
01057             description="Activates the printing of the orbital "//&
01058             "orbital mixed neighbor lists of wavefunction fitting basis, "//&
01059             "and the orbital basis, i.e. the overlap neighbor lists",&
01060             default_l_val=.FALSE.,&
01061             lone_keyword_l_val=.TRUE.,&
01062             error=error)
01063        CALL section_add_keyword(print_key,keyword,error=error)
01064        CALL keyword_release(keyword,error=error)
01065 
01066        CALL keyword_create(keyword=keyword,&
01067             name="sab_scp",&
01068             description="Activates the printing of the vdW SCP "//&
01069             "neighbor lists ",&
01070             default_l_val=.FALSE.,&
01071             lone_keyword_l_val=.TRUE.,&
01072             error=error)
01073        CALL section_add_keyword(print_key,keyword,error=error)
01074        CALL keyword_release(keyword,error=error)
01075 
01076        CALL keyword_create(keyword=keyword,&
01077             name="sab_vdw",&
01078             description="Activates the printing of the vdW "//&
01079             "neighbor lists (from DFT, DFTB, SE), "//&
01080             "i.e. the dispersion neighbor lists",&
01081             default_l_val=.FALSE.,&
01082             lone_keyword_l_val=.TRUE.,&
01083             error=error)
01084        CALL section_add_keyword(print_key,keyword,error=error)
01085        CALL keyword_release(keyword,error=error)
01086 
01087        CALL keyword_create(keyword=keyword,&
01088             name="sab_cn",&
01089             description="Activates the printing of the "//&
01090             "neighbor lists used for coordination numbers in vdW DFT-D3",&
01091             default_l_val=.FALSE.,&
01092             lone_keyword_l_val=.TRUE.,&
01093             error=error)
01094        CALL section_add_keyword(print_key,keyword,error=error)
01095        CALL keyword_release(keyword,error=error)
01096 
01097        CALL keyword_create(keyword=keyword,&
01098             name="sac_ae",&
01099             description="Activates the printing of the orbital "//&
01100             "nuclear attraction neighbor lists (erfc potential)",&
01101             default_l_val=.FALSE.,&
01102             lone_keyword_l_val=.TRUE.,&
01103             error=error)
01104        CALL section_add_keyword(print_key,keyword,error=error)
01105        CALL keyword_release(keyword,error=error)
01106 
01107        CALL keyword_create(keyword=keyword,&
01108             name="sac_ppl",&
01109             description="Activates the printing of the orbital "//&
01110             "GTH-PPL neighbor lists (local part of the "//&
01111             "Goedecker-Teter-Hutter pseudo potentials)",&
01112             default_l_val=.FALSE.,&
01113             lone_keyword_l_val=.TRUE.,&
01114             error=error)
01115        CALL section_add_keyword(print_key,keyword,error=error)
01116        CALL keyword_release(keyword,error=error)
01117 
01118        CALL keyword_create(keyword=keyword,&
01119             name="sap_ppnl",&
01120             description="Activates the printing of the orbital "//&
01121             "GTH-PPNL neighbor lists (non-local part of the"//&
01122             "Goedecker-Teter-Hutter pseudo potentials)",&
01123             default_l_val=.FALSE.,&
01124             lone_keyword_l_val=.TRUE.,&
01125             error=error)
01126        CALL section_add_keyword(print_key,keyword,error=error)
01127        CALL keyword_release(keyword,error=error)
01128 
01129        CALL keyword_create(keyword=keyword,&
01130             name="sap_oce",&
01131             description="Activates the printing of the orbital "//&
01132             "PAW-projector neighbor lists (only GAPW)",&
01133             default_l_val=.FALSE.,&
01134             lone_keyword_l_val=.TRUE.,&
01135             error=error)
01136        CALL section_add_keyword(print_key,keyword,error=error)
01137        CALL keyword_release(keyword,error=error)
01138 
01139        CALL keyword_create(keyword=keyword,&
01140             name="sab_se",&
01141             description="Activates the printing of the two-center "//&
01142             "neighbor lists for Coulomb type interactions in NDDO ",&
01143             default_l_val=.FALSE.,&
01144             lone_keyword_l_val=.TRUE.,&
01145             error=error)
01146        CALL section_add_keyword(print_key,keyword,error=error)
01147        CALL keyword_release(keyword,error=error)
01148 
01149        CALL keyword_create(keyword=keyword,&
01150             name="sab_lrc",&
01151             description="Activates the printing of the long-range SE correction "//&
01152             "neighbor lists (only when doing long-range SE with integral scheme KDSO and KDSO-d)",&
01153             default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
01154        CALL section_add_keyword(print_key,keyword,error=error)
01155        CALL keyword_release(keyword,error=error)
01156 
01157        CALL keyword_create(keyword=keyword,&
01158             name="sab_tbe",&
01159             description="Activates the printing of the DFTB Ewald "//&
01160             "neighbor lists ",&
01161             default_l_val=.FALSE.,&
01162             lone_keyword_l_val=.TRUE.,&
01163             error=error)
01164        CALL section_add_keyword(print_key,keyword,error=error)
01165        CALL keyword_release(keyword,error=error)
01166 
01167        CALL keyword_create(keyword=keyword,&
01168             name="sab_core",&
01169             description="Activates the printing of core interaction "//&
01170             "neighbor lists ",&
01171             default_l_val=.FALSE.,&
01172             lone_keyword_l_val=.TRUE.,&
01173             error=error)
01174        CALL section_add_keyword(print_key,keyword,error=error)
01175        CALL keyword_release(keyword,error=error)
01176 
01177        CALL keyword_create(keyword=keyword,&
01178             name="soo_list",&
01179             description="Activates the printing of RI orbital-orbital "//&
01180             "neighbor lists ",&
01181             default_l_val=.FALSE.,&
01182             lone_keyword_l_val=.TRUE.,&
01183             error=error)
01184        CALL section_add_keyword(print_key,keyword,error=error)
01185        CALL keyword_release(keyword,error=error)
01186 
01187        CALL keyword_create(keyword=keyword,&
01188             name="sip_list",&
01189             description="Activates the printing of RI basis-projector interaction "//&
01190             "neighbor lists ",&
01191             default_l_val=.FALSE.,&
01192             lone_keyword_l_val=.TRUE.,&
01193             error=error)
01194        CALL section_add_keyword(print_key,keyword,error=error)
01195        CALL keyword_release(keyword,error=error)
01196 
01197        CALL section_add_subsection(section,print_key,error=error)
01198        CALL section_release(print_key,error=error)
01199 
01200        CALL cp_print_key_section_create(print_key,"SUBCELL",&
01201             description="Activates the printing of the subcells used for the"//&
01202             "generation of neighbor lists.", unit_str="angstrom",&
01203             print_level=high_print_level,filename="__STD_OUT__",&
01204             error=error)
01205        CALL section_add_subsection(section,print_key,error=error)
01206        CALL section_release(print_key,error=error)
01207 
01208        CALL cp_print_key_section_create(print_key,"AO_MATRICES",&
01209             description="Controls the printing of the ao (i.e. contracted gaussian) matrices (debug).", &
01210             print_level=debug_print_level,filename="__STD_OUT__",&
01211             error=error)
01212        CALL keyword_create(keyword, name="CORE_HAMILTONIAN",&
01213             description="If the printkey is activated controls the printing of the hamiltonian matrix",&
01214             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01215        CALL section_add_keyword(print_key,keyword,error=error)
01216        CALL keyword_release(keyword,error=error)
01217        CALL keyword_create(keyword, name="DENSITY",&
01218             description="If the printkey is activated controls the printing of the density (P) matrix",&
01219             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01220        CALL section_add_keyword(print_key,keyword,error=error)
01221        CALL keyword_release(keyword,error=error)
01222 
01223        CALL keyword_create(keyword, name="KINETIC_ENERGY",&
01224             description="If the printkey is activated controls the printing of the kinetic energy matrix",&
01225             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01226        CALL section_add_keyword(print_key,keyword,error=error)
01227        CALL keyword_release(keyword,error=error)
01228        CALL keyword_create(keyword, name="KOHN_SHAM_MATRIX",&
01229             description="If the printkey is activated controls the printing of the kohn-sham matrix",&
01230             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01231        CALL section_add_keyword(print_key,keyword,error=error)
01232        CALL keyword_release(keyword,error=error)
01233        CALL keyword_create(keyword, name="MATRIX_VXC",&
01234             description="If the printkey is activated compute and print the matrix of the exchange and correlation potential."//&
01235                         "Only the GGA part for GPW is printed",&
01236             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01237        CALL section_add_keyword(print_key,keyword,error=error)
01238        CALL keyword_release(keyword,error=error)
01239        CALL keyword_create(keyword, name="ORTHO",&
01240             description="If the printkey is activated controls the printing of the orthogonalization matrix",&
01241             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01242        CALL section_add_keyword(print_key,keyword,error=error)
01243        CALL keyword_release(keyword,error=error)
01244        CALL keyword_create(keyword, name="OVERLAP",&
01245             description="If the printkey is activated controls the printing of the overlap matrix",&
01246             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01247        CALL section_add_keyword(print_key,keyword,error=error)
01248        CALL keyword_release(keyword,error=error)
01249 
01250        CALL keyword_create(keyword, name="FERMI_CONTACT",&
01251             description="If the printkey is activated controls the printing of the Fermi contact matrix",&
01252             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01253        CALL section_add_keyword(print_key,keyword,error=error)
01254        CALL keyword_release(keyword,error=error)
01255        CALL keyword_create(keyword, name="PSO",&
01256             description="If the printkey is activated controls the printing of the paramagnetic spin-orbit matrices",&
01257             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01258        CALL section_add_keyword(print_key,keyword,error=error)
01259        CALL keyword_release(keyword,error=error)
01260        CALL keyword_create(keyword, name="EFG",&
01261             description="If the printkey is activated controls the printing of the electric field gradient matrices",&
01262             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01263        CALL section_add_keyword(print_key,keyword,error=error)
01264        CALL keyword_release(keyword,error=error)
01265        CALL keyword_create(keyword, name="POTENTIAL_ENERGY",&
01266             description="If the printkey is activated controls the printing of the potential energy matrix",&
01267             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01268        CALL section_add_keyword(print_key,keyword,error=error)
01269        CALL keyword_release(keyword,error=error)
01270        CALL keyword_create(keyword, name="OCE_HARD",&
01271             description="If the printkey is activated controls the printing of the OCE HARD matrix",&
01272             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01273        CALL section_add_keyword(print_key,keyword,error=error)
01274        CALL keyword_release(keyword,error=error)
01275        CALL keyword_create(keyword, name="OCE_SOFT",&
01276             description="If the printkey is activated controls the printing of the OCE SOFT matrix",&
01277             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01278        CALL section_add_keyword(print_key,keyword,error=error)
01279        CALL keyword_release(keyword,error=error)
01280        CALL keyword_create(keyword, name="W_MATRIX",&
01281             description="If the printkey is activated controls the printing of the w matrix",&
01282             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01283        CALL section_add_keyword(print_key,keyword,error=error)
01284        CALL keyword_release(keyword,error=error)
01285        CALL keyword_create(keyword, name="W_MATRIX_AUX_FIT",&
01286             description="If the printkey is activated controls the printing of the w matrix",&
01287             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01288        CALL section_add_keyword(print_key,keyword,error=error)
01289        CALL keyword_release(keyword,error=error)
01290        CALL keyword_create(keyword, name="DERIVATIVES",&
01291             description="If the printkey is activated controls the printing "//&
01292             "of derivatives (for the matrixes that support this)",&
01293             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01294        CALL section_add_keyword(print_key,keyword,error=error)
01295        CALL keyword_release(keyword,error=error)
01296        CALL section_add_subsection(section,print_key,error=error)
01297        CALL section_release(print_key,error=error)
01298 
01299        CALL cp_print_key_section_create(print_key,"MO",&
01300             description="Controls the printing of the molecular orbitals."//&
01301             "Note that this is only functional with diagonalization based methods, in particular not with OT (see MO_CUBES)", &
01302             print_level=high_print_level,filename="__STD_OUT__",&
01303             error=error)
01304        CALL keyword_create(keyword, name="Cartesian",&
01305             description="If the printkey is activated controls the printing of the mo in the cartesian basis",&
01306             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01307        CALL section_add_keyword(print_key,keyword,error=error)
01308        CALL keyword_release(keyword,error=error)
01309        CALL keyword_create(keyword, name="EIGENVALUES",variants=s2a("EIGVALS"),&
01310             description="If the printkey is activated controls the printing of the eigenvalues of the mos",&
01311             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01312        CALL section_add_keyword(print_key,keyword,error=error)
01313        CALL keyword_release(keyword,error=error)
01314        CALL keyword_create(keyword, name="EIGENVECTORS",variants=s2a("EIGVECS"),&
01315             description="If the printkey is activated controls the printing of the eigenvectors of the mos",&
01316             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01317        CALL section_add_keyword(print_key,keyword,error=error)
01318        CALL keyword_release(keyword,error=error)
01319        CALL keyword_create(keyword, name="OCCUPATION_NUMBERS",variants=s2a("OCCNUMS"),&
01320             description="If the printkey is activated controls the printing of the occupation numbers of the mos",&
01321             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01322        CALL section_add_keyword(print_key,keyword,error=error)
01323        CALL keyword_release(keyword,error=error)
01324        CALL keyword_create(keyword=keyword, name="NDIGITS",&
01325             description="Specify the number of digits used to print the MO eigenvalues and occupation numbers",&
01326             default_i_val=6, error=error)
01327        CALL section_add_keyword(print_key,keyword,error=error)
01328        CALL keyword_release(keyword,error=error)
01329        CALL keyword_create(keyword,&
01330                            name="MO_INDEX_RANGE",&
01331                            variants=s2a("MO_RANGE","RANGE"),&
01332                            description="Allows to print only a subset of the MO eigenvectors or eigenvalues. "//&
01333                                        "The indices of the first and the last MO have to be specified",&
01334                            required=.FALSE.,&
01335                            repeats=.FALSE.,&
01336                            n_var=2,&
01337                            type_of_var=integer_t,&
01338                            default_i_vals=(/0,0/),&
01339                            usage="MO_INDEX_RANGE 10 15",&
01340                            error=error)
01341        CALL section_add_keyword(print_key,keyword,error=error)
01342        CALL keyword_release(keyword,error=error)
01343        CALL section_add_subsection(section,print_key,error=error)
01344        CALL section_release(print_key,error=error)
01345 
01346        CALL create_mo_cubes_section(print_key,error)
01347        CALL section_add_subsection(section,print_key,error=error)
01348        CALL section_release(print_key,error=error)
01349 
01350        CALL create_stm_section(print_key,error)
01351        CALL section_add_subsection(section,print_key,error=error)
01352        CALL section_release(print_key,error=error)
01353 
01354 
01355        CALL create_wfn_mix_section(subsection,error)
01356        CALL section_add_subsection(section,subsection,error=error)
01357        CALL section_release(subsection,error=error)
01358 
01359        CALL section_create(subsection,name="GAPW",&
01360             description="Controls the printing of some gapw related information (debug).",&
01361             n_keywords=0, n_subsections=1, repeats=.FALSE., required=.TRUE.,&
01362             error=error)
01363        CALL cp_print_key_section_create(print_key,"projectors",&
01364             description="If the printkey is activated controls if information on"//&
01365             " the projectors is printed.",&
01366             print_level=debug_print_level,filename="__STD_OUT__",&
01367             error=error)
01368        CALL section_add_subsection(subsection,print_key,error=error)
01369        CALL section_release(print_key,error=error)
01370        CALL cp_print_key_section_create(print_key,"rho0_information",&
01371             description="If the printkey is activated controls if information on rho0 is printed.",&
01372             print_level=debug_print_level,filename="__STD_OUT__",unit_str="angstrom",&
01373             error=error)
01374        CALL section_add_subsection(subsection,print_key,error=error)
01375        CALL section_release(print_key,error=error)
01376        CALL section_add_subsection(section,subsection,error=error)
01377        CALL section_release(subsection,error=error)
01378 
01379        CALL cp_print_key_section_create(print_key,"dft_control_parameters",&
01380             description="Controls the printing of dft control parameters.", &
01381             print_level=medium_print_level,filename="__STD_OUT__",&
01382             error=error)
01383        CALL section_add_subsection(section,print_key,error=error)
01384        CALL section_release(print_key,error=error)
01385 
01386        CALL cp_print_key_section_create(print_key,"OPTICAL_CONDUCTIVITY",&
01387             description="Controls the printing of the optical conductivity.", &
01388             print_level=high_print_level,filename="optical_conductivity",&
01389             error=error)
01390        CALL section_add_subsection(section,print_key,error=error)
01391        CALL section_release(print_key,error=error)
01392 
01393        CALL cp_print_key_section_create(print_key,&
01394             name="E_DENSITY_CUBE",&
01395             description="Controls the printing of cube files with "//&
01396                         "the electronic density and, for LSD "//&
01397                         "calculations, the spin density",&
01398             print_level=high_print_level,filename="",error=error)
01399        CALL keyword_create(keyword, name="stride",&
01400             description="The stride (X,Y,Z) used to write the cube file "//&
01401             "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
01402             " 1 number valid for all components.",&
01403             usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
01404        CALL section_add_keyword(print_key,keyword,error=error)
01405        CALL keyword_release(keyword,error=error)
01406        CALL keyword_create(keyword,&
01407             name="TOTAL_DENSITY",&
01408             description="Print the total electronic density in the case "//&
01409                         "of a GAPW run. This keyword has only an effect, "//&
01410                         "if PAW atoms are present. The default is to print "//&
01411                         "only the soft part of the electronic density and "//&
01412                         "to ignore the hard part. NOTE: The total density in "//&
01413                         "real space might exhibit unphysical features like "//&
01414                         "spikes due to the finite and thus truncated g vector "//&
01415                         "expansion",&
01416             usage="TOTAL_DENSITY {logical}",&
01417             repeats=.FALSE.,&
01418             required=.FALSE.,&
01419             n_var=1,&
01420             default_l_val=.FALSE.,&
01421             lone_keyword_l_val=.TRUE.,&
01422             error=error)
01423        CALL section_add_keyword(print_key,keyword,error=error)
01424        CALL keyword_release(keyword,error=error)
01425 
01426        CALL keyword_create(keyword, name="APPEND",&
01427             description="append the cube files when they already exist",&
01428             default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
01429        CALL section_add_keyword(print_key,keyword,error=error)
01430        CALL keyword_release(keyword,error=error)
01431 
01432        CALL keyword_create(keyword, name="XRD_INTERFACE",&
01433             description="It activates the print out of exponents and coefficients for the "//&
01434            " Gaussian expansion of the core densities, based on atom calculations for each kind."//&
01435            " The resulting core dansities are needed to compute the form factors."//&
01436            " If GAPW the local densities are also given in terms of a Gaussian expansion,"//& 
01437            " by fitting the difference between local-fhard and local-soft density for each atom."//&
01438            " In this case the keyword TOTAL_DENSITY is set to FALSE",&
01439             default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
01440        CALL section_add_keyword(print_key,keyword,error=error)
01441        CALL keyword_release(keyword,error=error)
01442 
01443        CALL keyword_create(keyword, name="NGAUSS",&
01444             description="Number of Gaussian functions used in the expansion of atomic (core) density",&
01445             usage="NGAUSS 10",n_var=1,default_i_val=12, type_of_var=integer_t,error=error)
01446        CALL section_add_keyword(print_key,keyword,error=error)
01447        CALL keyword_release(keyword,error=error)
01448 
01449        CALL section_add_subsection(section,print_key,error=error)
01450        CALL section_release(print_key,error=error)
01451 
01452        CALL cp_print_key_section_create(print_key,"tot_density_cube",&
01453             description="Controls printing of cube files with "//&
01454             "the total density (electrons+atomic core). Note that "//&
01455             "the value of the total density is positive where the "//&
01456             "electron density dominates and negative where the core is.",&
01457             print_level=high_print_level,filename="",&
01458             error=error)
01459        CALL keyword_create(keyword, name="stride",&
01460             description="The stride (X,Y,Z) used to write the cube file "//&
01461             "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
01462             " 1 number valid for all components.",&
01463             usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
01464        CALL section_add_keyword(print_key,keyword,error=error)
01465        CALL keyword_release(keyword,error=error)
01466        CALL keyword_create(keyword, name="APPEND",&
01467             description="append the cube files when they already exist",&
01468             default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
01469        CALL section_add_keyword(print_key,keyword,error=error)
01470        CALL keyword_release(keyword,error=error)
01471 
01472        CALL section_add_subsection(section,print_key,error=error)
01473        CALL section_release(print_key,error=error)
01474 
01475        CALL cp_print_key_section_create(print_key,"v_hartree_cube",&
01476             description="Controls the printing of a cube file with eletrostatic "//&
01477             " potential generated by the total density (electrons+ions). It is "//&
01478             " valid only for QS with GPW formalism .", &
01479             print_level=high_print_level,filename="",&
01480             error=error)
01481        CALL keyword_create(keyword, name="stride",&
01482             description="The stride (X,Y,Z) used to write the cube file "//&
01483             "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
01484             " 1 number valid for all components.",&
01485             usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
01486        CALL section_add_keyword(print_key,keyword,error=error)
01487        CALL keyword_release(keyword,error=error)
01488        CALL keyword_create(keyword, name="APPEND",&
01489             description="append the cube files when they already exist",&
01490             default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
01491        CALL section_add_keyword(print_key,keyword,error=error)
01492        CALL keyword_release(keyword,error=error)
01493 
01494        CALL section_add_subsection(section,print_key,error=error)
01495        CALL section_release(print_key,error=error)
01496 
01497        CALL cp_print_key_section_create(print_key,"efield_cube",&
01498             description="Controls the printing of cube files with electric "//&
01499             " field generated by the total density (electrons+ions). It is "//&
01500             " valid only for QS with GPW formalism .", &
01501             print_level=high_print_level,filename="",&
01502             error=error)
01503        CALL keyword_create(keyword, name="stride",&
01504             description="The stride (X,Y,Z) used to write the cube file "//&
01505             "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
01506             " 1 number valid for all components.",&
01507             usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
01508        CALL section_add_keyword(print_key,keyword,error=error)
01509        CALL keyword_release(keyword,error=error)
01510        CALL keyword_create(keyword, name="APPEND",&
01511             description="append the cube files when they already exist",&
01512             default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
01513        CALL section_add_keyword(print_key,keyword,error=error)
01514        CALL keyword_release(keyword,error=error)
01515 
01516        CALL section_add_subsection(section,print_key,error=error)
01517        CALL section_release(print_key,error=error)
01518 
01519        CALL cp_print_key_section_create(print_key,"ELF_CUBE",&
01520             description="Controls printing of cube files with "//&
01521             "the electron localization function (ELF). Note that "//&
01522             "the value of ELF is defined between 0 and 1:  Pauli kinetic energy density normalized "//&
01523             " by the kinetic energy density of a uniform el. gas of same density.",&
01524             print_level=high_print_level,filename="",&
01525             error=error)
01526        CALL keyword_create(keyword, name="stride",&
01527             description="The stride (X,Y,Z) used to write the cube file "//&
01528             "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
01529             " 1 number valid for all components.",&
01530             usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
01531        CALL section_add_keyword(print_key,keyword,error=error)
01532        CALL keyword_release(keyword,error=error)
01533        CALL keyword_create(keyword, name="APPEND",&
01534             description="append the cube files when they already exist",&
01535             default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
01536        CALL section_add_keyword(print_key,keyword,error=error)
01537        CALL keyword_release(keyword,error=error)
01538 
01539        CALL keyword_create(keyword, name="density_cutoff",&
01540             description=" ",&
01541             usage="density_cutoff 0.0001",&
01542             repeats=.FALSE.,&
01543             required=.FALSE.,&
01544             n_var=1,&
01545             type_of_var=real_t,&
01546             default_r_val=1.0e-10_dp, error=error)
01547        CALL section_add_keyword(print_key,keyword,error=error)
01548        CALL keyword_release(keyword,error=error)
01549 
01550        CALL section_add_subsection(section,print_key,error=error)
01551        CALL section_release(print_key,error=error)
01552 
01553 
01554        CALL cp_print_key_section_create(print_key,"PDOS",&
01555             description="Print out the DOS projected per kind and per angular momentum  ",&
01556             print_level=high_print_level,common_iter_levels=1,filename="",&
01557             error=error)
01558        CALL keyword_create(keyword, name="COMPONENTS",&
01559             description="Print out pdos distinguishing all angular momentum components.",&
01560             usage="COMPONENTS", default_l_val=.FALSE., &
01561             lone_keyword_l_val=.TRUE., error=error)
01562        CALL section_add_keyword(print_key,keyword,error=error)
01563        CALL keyword_release(keyword,error=error)
01564        CALL keyword_create(keyword, name="APPEND",&
01565             description="Append the pdos obtained at different iterations to the pdos  output file."//&
01566             "By defaut the file is overwritten",&
01567             usage="APPEND", default_l_val=.FALSE., &
01568             lone_keyword_l_val=.TRUE., error=error)
01569        CALL section_add_keyword(print_key,keyword,error=error)
01570        CALL keyword_release(keyword,error=error)
01571        CALL keyword_create(keyword, name="NLUMO",&
01572             description="Number of virtual orbitals to be added to the MO set (-1=all)",&
01573             usage="NLUMO integer",default_i_val=0, error=error)
01574        CALL section_add_keyword(print_key,keyword,error=error)
01575        CALL keyword_release(keyword,error=error)
01576        CALL keyword_create(keyword, name="OUT_EACH_MO",&
01577             description="Output on the status of the calculation every OUT_EACH_MO states. If -1 no output",&
01578             usage="OUT_EACH_MO integer",default_i_val=-1, error=error)
01579        CALL section_add_keyword(print_key,keyword,error=error)
01580        CALL keyword_release(keyword,error=error)
01581 !
01582        CALL section_create(subsection,name="LDOS",&
01583              description="Controls the printing of local PDOS, projected on subsets"//&
01584              " of atoms given through lists",&
01585              n_keywords=4, n_subsections=0, repeats=.TRUE., required=.TRUE.,&
01586              error=error)
01587        CALL keyword_create(keyword, name="COMPONENTS",&
01588             description="Print out pdos distinguishing all angular momentum components.",&
01589             usage="COMPONENTS", default_l_val=.FALSE., &
01590             lone_keyword_l_val=.TRUE., error=error)
01591        CALL section_add_keyword(subsection,keyword,error=error)
01592        CALL keyword_release(keyword,error=error)
01593 
01594        CALL keyword_create(keyword, name="LIST",&
01595             description="Specifies a list of indexes of atoms where to project the DOS  ",&
01596             usage="LIST {integer}  {integer} ..  {integer} ",type_of_var=integer_t,&
01597             n_var=-1, required=.TRUE., repeats=.TRUE., error=error)
01598        CALL section_add_keyword(subsection,keyword,error=error)
01599        CALL keyword_release(keyword,error=error)
01600 
01601        CALL section_add_subsection(print_key,subsection,error=error)
01602        CALL section_release(subsection,error=error)
01603 
01604        CALL section_create(subsection,name="R_LDOS",&
01605              description="Controls the printing of local PDOS, projected on 3D volume in real space,"//&
01606              " the volume is defined in terms of position with respect to atoms in the lists",&
01607              n_keywords=4, n_subsections=0, repeats=.TRUE., required=.TRUE.,&
01608              error=error)
01609 
01610        CALL keyword_create(keyword, name="LIST",&
01611             description="Specifies a list of indexes of atoms used to define the real space volume  ",&
01612             usage="LIST {integer}  {integer} ..  {integer} ",type_of_var=integer_t,&
01613             n_var=-1, required=.TRUE., repeats=.TRUE., error=error)
01614        CALL section_add_keyword(subsection,keyword,error=error)
01615        CALL keyword_release(keyword,error=error)
01616 
01617        CALL keyword_create(keyword, name="XRANGE",&
01618             description="range of positions in Cartesian direction x: all grid points within "//&
01619             " this range from at least one atom of the list are considered",&
01620             usage="XRANGE -10.0 10.0",unit_str="angstrom",n_var=2,type_of_var=real_t,  error=error)
01621        CALL section_add_keyword(subsection,keyword,error=error)
01622        CALL keyword_release(keyword,error=error)
01623        CALL keyword_create(keyword, name="YRANGE",&
01624             description="range of positions in Cartesian direction y: all grid points within "//&
01625             " this range from at least one atom of the list are considered",&
01626             usage="YRANGE -10.0 10.0",unit_str="angstrom",n_var=2,type_of_var=real_t,  error=error)
01627        CALL section_add_keyword(subsection,keyword,error=error)
01628        CALL keyword_release(keyword,error=error)
01629        CALL keyword_create(keyword, name="ZRANGE",&
01630             description="range of positions in Cartesian direction z: all grid points within "//&
01631             " this range from at least one atom of the list are considered",&
01632             usage="ZRANGE -10.0 10.0",unit_str="angstrom",n_var=2,type_of_var=real_t,  error=error)
01633        CALL section_add_keyword(subsection,keyword,error=error)
01634        CALL keyword_release(keyword,error=error)
01635 
01636        CALL keyword_create(keyword, name="ERANGE",&
01637             description="only project states with the eigenvalues in the given interval. "//&
01638                         "Default is all states.",&
01639                         usage="ERANGE -1.0 1.0",unit_str="hartree",n_var=2,type_of_var=real_t,error=error)
01640        CALL section_add_keyword(subsection,keyword,error=error)
01641        CALL keyword_release(keyword,error=error)
01642 
01643 
01644        CALL section_add_subsection(print_key,subsection,error=error)
01645        CALL section_release(subsection,error=error)
01646 
01647        CALL section_add_subsection(section,print_key,error=error)
01648        CALL section_release(print_key,error=error)
01649 
01650 !
01651        CALL section_create(print_key,name="LOCALIZATION",&
01652             description="Collects all printing options related to the Wannier centers and "//&
01653             "properties computed with Wannier centers.",&
01654             n_keywords=0, n_subsections=1, repeats=.FALSE., required=.FALSE.,&
01655             error=error)
01656        ! Add printing of wannier infos
01657        CALL print_wanniers(print_key, error)
01658        ! Total Dipoles with wannier
01659        CALL create_dipoles_section(subsection,"TOTAL_DIPOLE",debug_print_level+1,error)
01660        CALL section_add_subsection(print_key, subsection, error=error)
01661        CALL section_release(subsection,error=error)
01662        ! Molecular Dipoles with wannier
01663        CALL create_dipoles_section(subsection,"MOLECULAR_DIPOLES",debug_print_level+1,error)
01664        CALL section_add_subsection(print_key, subsection, error=error)
01665        CALL section_release(subsection,error=error)
01666        ! Molecular States with wannier
01667        CALL create_molecular_states_section(subsection,error)
01668        CALL section_add_subsection(print_key, subsection, error=error)
01669        CALL section_release(subsection,error=error)
01670        ! Wannier States with wannier
01671        CALL create_wannier_states_section(subsection,error)
01672        CALL section_add_subsection(print_key, subsection, error=error)
01673        CALL section_release(subsection,error=error)
01674        CALL section_add_subsection(section,print_key,error=error)
01675        CALL section_release(print_key,error=error)
01676 
01677        !Printing of Moments
01678        CALL create_dipoles_section(print_key,"MOMENTS",high_print_level,error)
01679        CALL keyword_create(keyword=keyword,&
01680             name="MAX_MOMENT",&
01681             description="Maximum moment to be calculated",&
01682             usage="MAX_MOMENT {integer}",&
01683             repeats=.FALSE.,&
01684             required=.FALSE.,&
01685             n_var=1,&
01686             type_of_var=integer_t,&
01687             default_i_val=1,&
01688             error=error)
01689        CALL section_add_keyword(print_key,keyword,error=error)
01690        CALL keyword_release(keyword,error=error)
01691        CALL keyword_create(keyword=keyword,&
01692             name="MAGNETIC",&
01693             description="Calculate also magnetic moments",&
01694             usage="MAGNETIC yes",&
01695             repeats=.FALSE.,&
01696             required=.FALSE.,&
01697             n_var=1,&
01698             default_l_val=.FALSE.,&
01699             lone_keyword_l_val=.TRUE.,&
01700             error=error)
01701        CALL section_add_keyword(print_key,keyword,error=error)
01702        CALL keyword_release(keyword,error=error)
01703        CALL section_add_subsection(section, print_key, error=error)
01704        CALL section_release(print_key,error=error)
01705 
01706        ! Mulliken population analysis
01707        CALL cp_print_key_section_create(print_key,"MULLIKEN",&
01708             description="Controls the printing of the Mulliken (spin) population analysis", &
01709             print_level=medium_print_level,filename="__STD_OUT__",&
01710             common_iter_levels=1, error=error)
01711        CALL keyword_create(&
01712             keyword=keyword,&
01713             name="PRINT_GOP",&
01714             description="Print the gross orbital populations (GOP) in addition to the gross atomic populations (GAP) "//&
01715                         "and net charges",&
01716             usage="PRINT_GOP yes",&
01717             repeats=.FALSE.,&
01718             required=.FALSE.,&
01719             n_var=1,&
01720             default_l_val=.FALSE.,&
01721             lone_keyword_l_val=.TRUE.,&
01722             error=error)
01723        CALL section_add_keyword(print_key,keyword,error=error)
01724        CALL keyword_release(keyword,error=error)
01725        CALL keyword_create(&
01726             keyword=keyword,&
01727             name="PRINT_ALL",&
01728             description="Print all information including the full net AO and overlap population matrix",&
01729             usage="PRINT_ALL yes",&
01730             repeats=.FALSE.,&
01731             required=.FALSE.,&
01732             n_var=1,&
01733             default_l_val=.FALSE.,&
01734             lone_keyword_l_val=.TRUE.,&
01735             error=error)
01736        CALL section_add_keyword(print_key,keyword,error=error)
01737        CALL keyword_release(keyword,error=error)
01738        CALL section_add_subsection(section,print_key,error=error)
01739        CALL section_release(print_key,error=error)
01740 
01741        ! Lowdin population analysis (fairly expensive to compute, so only at high)
01742        CALL cp_print_key_section_create(print_key,"LOWDIN",&
01743             description="Controls the printing of the Lowdin (spin) population analysis", &
01744             print_level=high_print_level,filename="__STD_OUT__",&
01745             common_iter_levels=1, error=error)
01746        CALL keyword_create(&
01747             keyword=keyword,&
01748             name="PRINT_GOP",&
01749             description="Print the orbital populations in addition to the atomic populations and net charges",&
01750             usage="PRINT_GOP yes",&
01751             repeats=.FALSE.,&
01752             required=.FALSE.,&
01753             n_var=1,&
01754             default_l_val=.FALSE.,&
01755             lone_keyword_l_val=.TRUE.,&
01756             error=error)
01757        CALL section_add_keyword(print_key,keyword,error=error)
01758        CALL keyword_release(keyword,error=error)
01759        CALL keyword_create(&
01760             keyword=keyword,&
01761             name="PRINT_ALL",&
01762             description="Print all information including the full symmetrically orthogonalised density matrix",&
01763             usage="PRINT_ALL yes",&
01764             repeats=.FALSE.,&
01765             required=.FALSE.,&
01766             n_var=1,&
01767             default_l_val=.FALSE.,&
01768             lone_keyword_l_val=.TRUE.,&
01769             error=error)
01770        CALL section_add_keyword(print_key,keyword,error=error)
01771        CALL keyword_release(keyword,error=error)
01772        CALL section_add_subsection(section,print_key,error=error)
01773        CALL section_release(print_key,error=error)
01774 
01775        CALL cp_print_key_section_create(&
01776             print_key_section=print_key,&
01777             name="XRAY_DIFFRACTION_SPECTRUM",&
01778             description="Calculate and print the coherent X-ray "//&
01779             "diffraction spectrum",&
01780             print_level=debug_print_level,&
01781             filename="",&
01782             citations=(/Krack2000,Krack2002/),&
01783             error=error)
01784        CALL keyword_create(&
01785             keyword=keyword,&
01786             name="Q_MAX",&
01787             variants=(/"Q_MAXIMUM"/),&
01788             description="Maximum Q value calculated for the spectrum",&
01789             usage="Q_MAX {real}",&
01790             repeats=.FALSE.,&
01791             required=.FALSE.,&
01792             n_var=1,&
01793             type_of_var=real_t,&
01794             default_r_val=cp_unit_to_cp2k(value=20.0_dp,&
01795             unit_str="angstrom^-1",&
01796             error=error),&
01797             unit_str="angstrom^-1",&
01798             error=error)
01799        CALL section_add_keyword(print_key,keyword,error=error)
01800        CALL keyword_release(keyword,error=error)
01801        CALL section_add_subsection(section,print_key,error=error)
01802        CALL section_release(print_key,error=error)
01803 
01804        CALL cp_print_key_section_create(print_key_section=print_key,&
01805             name="ELECTRIC_FIELD_GRADIENT",&
01806             description="Calculate and print the electric field gradients"//&
01807             "at atomic positions",&
01808             print_level=debug_print_level,&
01809             filename="__STD_OUT__",error=error)
01810 
01811        CALL keyword_create(keyword=keyword,&
01812             name="INTERPOLATION",&
01813             description="Use interpolation method from real space grid",&
01814             usage="INTERPOLATION {logical}",&
01815             repeats=.FALSE.,&
01816             required=.FALSE.,&
01817             n_var=1,&
01818             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01819        CALL section_add_keyword(print_key,keyword,error=error)
01820        CALL keyword_release(keyword,error=error)
01821 
01822        CALL keyword_create(keyword=keyword,&
01823             name="GSPACE_SMOOTHING",&
01824             description="Use a G-space smoothing function",&
01825             usage="GSPACE_SMOOTHING cutoff {real}, width {real}", &
01826             repeats=.FALSE.,&
01827             required=.FALSE.,&
01828             n_var=2,default_r_vals=(/-1._dp,-1._dp/),&
01829             type_of_var=real_t, error=error)
01830        CALL section_add_keyword(print_key,keyword,error=error)
01831        CALL keyword_release(keyword,error=error)
01832 
01833        CALL keyword_create(keyword=keyword,&
01834             name="DEBUG",&
01835             description="Print additional debug output",&
01836             usage="DEBUG {logical}",&
01837             repeats=.FALSE.,&
01838             required=.FALSE.,&
01839             n_var=1,&
01840             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
01841        CALL section_add_keyword(print_key,keyword,error=error)
01842        CALL keyword_release(keyword,error=error)
01843 
01844        CALL create_gspace_interp_section(subsection,error=error)
01845        CALL section_add_subsection(print_key, subsection, error=error)
01846        CALL section_release(subsection,error=error)
01847 
01848        CALL section_add_subsection(section,print_key,error=error)
01849        CALL section_release(print_key,error=error)
01850 
01851        CALL cp_print_key_section_create(print_key_section=print_key,&
01852             name="BASIS_MOLOPT_QUANTITIES",&
01853             description="Print the two quantities needed in the basis molopt generation:"//&
01854             " total energy and condition number of the overlap matrix (S matrix)",&
01855             print_level=high_print_level,&
01856             filename="__STD_OUT__",error=error)
01857        CALL section_add_subsection(section,print_key,error=error)
01858        CALL section_release(print_key,error=error)
01859 
01860        CALL cp_print_key_section_create(print_key_section=print_key,&
01861             name="HYPERFINE_COUPLING_TENSOR",&
01862             description="Calculate and print the EPR hyperfine coupling tensor"//&
01863             " at atomic positions",&
01864             print_level=debug_print_level,&
01865             filename="__STD_OUT__",error=error)
01866 
01867        CALL keyword_create(keyword=keyword,&
01868             name="INTERACTION_RADIUS",&
01869             description="Radius of interaction for EPR hyperfine tensor calculation",&
01870             usage="INTERACTION_RADIUS radius {real}",&
01871             repeats=.FALSE.,&
01872             required=.FALSE.,&
01873             n_var=1,default_r_val=10._dp,&
01874             type_of_var=real_t, error=error)
01875        CALL section_add_keyword(print_key,keyword,error=error)
01876        CALL keyword_release(keyword,error=error)
01877 
01878        CALL section_add_subsection(section,print_key,error=error)
01879        CALL section_release(print_key,error=error)
01880 
01881        CALL cp_print_key_section_create(print_key_section=print_key,&
01882             name="OPTIMIZE_GEMINALS",&
01883             description="Optimize the parameters of the geminal basis set",&
01884             print_level=debug_print_level,&
01885             filename="__STD_OUT__",error=error)
01886 
01887        CALL create_powell_section(subsection,error)
01888        CALL section_add_subsection(print_key, subsection, error=error)
01889        CALL section_release(subsection,error=error)
01890 
01891        CALL section_add_subsection(section,print_key,error=error)
01892        CALL section_release(print_key,error=error)
01893 
01894        CALL cp_print_key_section_create(&
01895             print_key_section=print_key,&
01896             name="PLUS_U",&
01897             description="Controls the printing for the DFT+U methods",&
01898             print_level=high_print_level,&
01899             filename="__STD_OUT__",&
01900             each_iter_names=s2a("QS_SCF"),&
01901             each_iter_values=(/0/),&
01902             citations=(/Dudarev1997,Dudarev1998/),&
01903             error=error)
01904 
01905        CALL section_add_subsection(section,print_key,error=error)
01906        CALL section_release(print_key,error=error)
01907 
01908     END IF
01909   END SUBROUTINE create_print_dft_section
01910 
01911 ! *****************************************************************************
01914   SUBROUTINE create_mo_cubes_section(print_key,error)
01915     TYPE(section_type), POINTER              :: print_key
01916     TYPE(cp_error_type), INTENT(inout)       :: error
01917 
01918     CHARACTER(len=*), PARAMETER :: routineN = 'create_mo_cubes_section', 
01919       routineP = moduleN//':'//routineN
01920 
01921     TYPE(keyword_type), POINTER              :: keyword
01922 
01923     NULLIFY(keyword)
01924 
01925     CALL cp_print_key_section_create(print_key,"MO_CUBES",&
01926          description="Controls the printing of cubes of the molecular orbitals.", &
01927          print_level=high_print_level,filename="",&
01928          error=error)
01929     CALL keyword_create(keyword, name="stride",&
01930          description="The stride (X,Y,Z) used to write the cube file "//&
01931          "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
01932          " 1 number valid for all components.",&
01933          usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
01934     CALL section_add_keyword(print_key,keyword,error=error)
01935     CALL keyword_release(keyword,error=error)
01936 
01937     CALL keyword_create(keyword, name="write_cube",&
01938          description="If the MO cube file should be written. If false, the eigenvalues are still computed."//&
01939                      " Can also be useful in combination with STM calculations",&
01940          default_l_val=.TRUE., lone_keyword_l_val=.TRUE.,error=error)
01941     CALL section_add_keyword(print_key,keyword,error=error)
01942     CALL keyword_release(keyword,error=error)
01943 
01944     CALL keyword_create(keyword, name="nlumo",&
01945          description="If the printkey is activated controls the number of lumos"//&
01946                      "that are printed and dumped as a cube (-1=all)",&
01947          default_i_val=0, error=error)
01948     CALL section_add_keyword(print_key,keyword,error=error)
01949     CALL keyword_release(keyword,error=error)
01950     CALL keyword_create(keyword, name="nhomo",&
01951          description="If the printkey is activated controls the number of homos that dumped as a cube (-1=all),"//&
01952                      " eigenvalues are always all dumped",&
01953          default_i_val=1, error=error)
01954     CALL section_add_keyword(print_key,keyword,error=error)
01955     CALL keyword_release(keyword,error=error)
01956 
01957 !    CALL keyword_create(keyword, name="STM",&
01958 !         description="do stm",&
01959 !         default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
01960 !    CALL section_add_keyword(print_key,keyword,error=error)
01961 !    CALL keyword_release(keyword,error=error)
01962 
01963     CALL keyword_create(keyword, name="APPEND",&
01964          description="append the cube files when they already exist",&
01965          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
01966     CALL section_add_keyword(print_key,keyword,error=error)
01967     CALL keyword_release(keyword,error=error)
01968 
01969 !    CALL keyword_create(keyword, name="STM_BIAS",&
01970 !         description="Bias energy for scanning tunneling microscopy (STM) image generation."//&
01971 !                     "Orbital densities are summed according to the bias energy."//&
01972 !                     "For negative values, states in the range ]EF+bias,EF] are summed,"//&
01973 !                     "While positive values sum states in the range [EF,EF+bias[."//&
01974 !                     "If postive biases are used, sufficiently many unoccupied stated"//&
01975 !                     " (see ADDED_MOS and NLUMO ) should be computed.",&
01976 !         n_var=-1,type_of_var=real_t, default_r_vals=(/0.0_dp/), unit_str='eV', error=error)
01977 !    CALL section_add_keyword(print_key,keyword,error=error)
01978 !    CALL keyword_release(keyword,error=error)
01979 
01980 !    CALL keyword_create(keyword, name="TH_TORB",&
01981 !         description="Tip orbital symmetry in Tersoff-Hamann approximation to compute STM images",&
01982 !         required=.FALSE.,&
01983 !         repeats=.TRUE.,&
01984 !         default_i_val=orb_s,&
01985 !         usage="TH_TORB s dz2",&
01986 !         enum_c_vals=s2a("S","PX","PY","PZ","DXY","DYZ","DZX","DX2","DY2","DZ2"),&
01987 !         enum_i_vals=(/orb_s,orb_px,orb_py,orb_pz,orb_dxy,orb_dyz,orb_dzx,orb_dx2,orb_dy2,orb_dz2/),&
01988 !         enum_desc=s2a("s orbital","px orbital","py orbital","pz orbital",&
01989 !         "dxy orbital","dyz orbital","dzx orbital","x^2 orbital","y^2 orbital","z^2 orbital"),&
01990 !         error=error)
01991 !    CALL section_add_keyword(print_key,keyword,error=error)
01992 !    CALL keyword_release(keyword,error=error)
01993 
01994   END SUBROUTINE create_mo_cubes_section
01995 
01996   SUBROUTINE create_stm_section(print_key,error)
01997     TYPE(section_type), POINTER              :: print_key
01998     TYPE(cp_error_type), INTENT(inout)       :: error
01999 
02000     CHARACTER(len=*), PARAMETER :: routineN = 'create_stm_section', 
02001       routineP = moduleN//':'//routineN
02002 
02003     TYPE(keyword_type), POINTER              :: keyword
02004 
02005     NULLIFY(keyword)
02006 
02007     CALL cp_print_key_section_create(print_key,"STM",&
02008          description="Controls the printing of cubes for the generation of STM images.", &
02009          print_level=high_print_level,filename="",&
02010          error=error)
02011     CALL keyword_create(keyword, name="stride",&
02012          description="The stride (X,Y,Z) used to write the cube file "//&
02013          "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
02014          " 1 number valid for all components.",&
02015          usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
02016     CALL section_add_keyword(print_key,keyword,error=error)
02017     CALL keyword_release(keyword,error=error)
02018 
02019     CALL keyword_create(keyword, name="nlumo",&
02020          description="If the printkey is activated controls the number of additional lumos"//&
02021                      " that are computed to be able to reproduce STM images obtained"//&
02022                      "  from positive bias (imaging unoccupied states)",&
02023          default_i_val=0, error=error)
02024     CALL section_add_keyword(print_key,keyword,error=error)
02025     CALL keyword_release(keyword,error=error)
02026 
02027 
02028     CALL keyword_create(keyword, name="BIAS",&
02029          description="Bias energy for scanning tunneling microscopy (STM) image generation."//&
02030                      "Orbital densities are summed according to the bias energy."//&
02031                      "For negative values, states in the range ]EF+bias,EF] are summed,"//&
02032                      "While positive values sum states in the range [EF,EF+bias[."//&
02033                      "If postive biases are used, sufficiently many unoccupied stated"//&
02034                      " (see ADDED_MOS and NLUMO ) should be computed.",&
02035          n_var=-1,type_of_var=real_t, default_r_vals=(/0.0_dp/), unit_str='eV', error=error)
02036     CALL section_add_keyword(print_key,keyword,error=error)
02037     CALL keyword_release(keyword,error=error)
02038 
02039     CALL keyword_create(keyword, name="TH_TORB",&
02040          description="Tip orbital symmetry in Tersoff-Hamann approximation to compute STM images",&
02041          required=.FALSE.,&
02042          repeats=.TRUE.,&
02043          default_i_val=orb_s,&
02044          usage="TH_TORB s dz2",&
02045          enum_c_vals=s2a("S","PX","PY","PZ","DXY","DYZ","DZX","DX2","DY2","DZ2"),&
02046          enum_i_vals=(/orb_s,orb_px,orb_py,orb_pz,orb_dxy,orb_dyz,orb_dzx,orb_dx2,orb_dy2,orb_dz2/),&
02047          enum_desc=s2a("s orbital","px orbital","py orbital","pz orbital",&
02048          "dxy orbital","dyz orbital","dzx orbital","x^2 orbital","y^2 orbital","z^2 orbital"),&
02049          error=error)
02050     CALL section_add_keyword(print_key,keyword,error=error)
02051     CALL keyword_release(keyword,error=error)
02052 
02053     CALL keyword_create(keyword, name="REF_ENERGY",&
02054          description="By default the reference energy is the Fermi energy. In order to compare"//&
02055                      " with STS experiments, where specific energy ranges are addressed, here"//&
02056                      "  one can set a different reference energy."//&
02057                      " The energy range is anyway controlled by the BIAS",&
02058          type_of_var=real_t,default_r_val=0.0_dp, unit_str='eV',error=error)
02059     CALL section_add_keyword(print_key,keyword,error=error)
02060     CALL keyword_release(keyword,error=error)
02061 
02062     CALL keyword_create(keyword, name="APPEND",&
02063          description="append the cube files when they already exist",&
02064          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
02065     CALL section_add_keyword(print_key,keyword,error=error)
02066     CALL keyword_release(keyword,error=error)
02067 
02068 
02069 
02070   END SUBROUTINE create_stm_section
02071 
02072   SUBROUTINE create_wfn_mix_section(section, error)
02073 
02074     TYPE(section_type), POINTER              :: section
02075     TYPE(cp_error_type), INTENT(inout)       :: error
02076 
02077     CHARACTER(len=*), PARAMETER :: routineN = 'create_wfn_mix_section', 
02078       routineP = moduleN//':'//routineN
02079 
02080     LOGICAL                                  :: failure
02081     TYPE(keyword_type), POINTER              :: keyword
02082     TYPE(section_type), POINTER              :: subsection
02083 
02084     failure=.FALSE.
02085     NULLIFY(subsection)
02086     NULLIFY(keyword)
02087 
02088     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
02089     IF (.NOT. failure) THEN
02090 
02091        CALL section_create(section,name="WFN_MIX",&
02092             description="A section that allows manipulation of the MO coeffs,"//&
02093                         " e.g. for changing a ground state into an excited state."//&
02094                         "Starting from a copy of the original MOs, changes can be made"//&
02095                         "by adding linear combinations of HOMO/LUMO of the original MOs to the result MOs",&
02096             n_keywords=1, n_subsections=0, repeats=.FALSE., required=.FALSE., error=error)
02097 
02098        CALL keyword_create(keyword, name="OVERWRITE_MOS",&
02099             description="If the keyword is active molecular orbitals in memory will be replaced by the mixed wfn."//&
02100                         " In combination with RTP or EMD no restart will be required to use the mixed wfn.",&
02101             default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
02102        CALL section_add_keyword(section,keyword,error=error)
02103        CALL keyword_release(keyword,error=error)
02104 
02105        CALL section_create(subsection,name="UPDATE",&
02106             description="update a result MO with with a linear combination of of original MOs."//&
02107                         " This section can be repeated to build arbitrary linear combinations using repeatedly y=a*y+b*x.",&
02108             n_keywords=1, n_subsections=0, repeats=.TRUE., required=.FALSE., error=error)
02109 
02110        CALL keyword_create(keyword, name="RESULT_MO_INDEX",&
02111             description="Index of the MO (y) to be modified. Counting down in energy with HOMO=1",&
02112             usage="RESULT_MO_INDEX 1", type_of_var=integer_t,default_i_val=0, error=error)
02113        CALL section_add_keyword(subsection,keyword,error=error)
02114        CALL keyword_release(keyword,error=error)
02115 
02116        CALL keyword_create(keyword, name="RESULT_MARKED_STATE",&
02117             description="Specifies the MO according to "//&
02118                         "the marks set in MOLECULAR_STATES. The value corresponds to the repetition "//&
02119                         " of MARK_STATES in MOLECULAR_STATES",&
02120             usage="ORIG_MARKED_STATE 1", type_of_var=integer_t,default_i_val=0, error=error)
02121        CALL section_add_keyword(subsection,keyword,error=error)
02122        CALL keyword_release(keyword,error=error)
02123 
02124        CALL keyword_create(keyword, name="RESULT_SPIN_INDEX",&
02125             description="Spin of the MO (y) to be modified.",&
02126             enum_c_vals=s2a("Alpha","Beta"),&
02127             enum_i_vals=(/ 1, 2/),&  ! direct index in array
02128             default_i_val=1,&
02129             enum_desc=s2a("Majority spin","Minority spin"), error=error)
02130        CALL section_add_keyword(subsection,keyword,error=error)
02131        CALL keyword_release(keyword,error=error)
02132 
02133        CALL keyword_create(keyword, name="RESULT_SCALE",&
02134             description="Scaling factor of the result variable (a).",&
02135             usage="RESULT_SCALE 0.0", type_of_var=real_t, error=error)
02136        CALL section_add_keyword(subsection,keyword,error=error)
02137        CALL keyword_release(keyword,error=error)
02138 
02139        CALL keyword_create(keyword, name="ORIG_MO_INDEX",&
02140             description="Index of the original MO (x). "//&
02141                         "Counting down in energy with HOMO=1 or up from LUMO=1, depending on ORIG_IS_VIRTUAL.",&
02142             usage="ORIG_MO_INDEX 1", type_of_var=integer_t,default_i_val=0, error=error)
02143        CALL section_add_keyword(subsection,keyword,error=error)
02144        CALL keyword_release(keyword,error=error)
02145 
02146        CALL keyword_create(keyword, name="ORIG_MARKED_STATE",&
02147             description="Specifies the MO according to "//&
02148                         "the marks set in MOLECULAR_STATES. The value corresponds to the repetition "//&
02149                         " of MARK_STATES in MOLECULAR_STATES",&
02150             usage="ORIG_MARKED_STATE 1", type_of_var=integer_t,default_i_val=0, error=error)
02151        CALL section_add_keyword(subsection,keyword,error=error)
02152        CALL keyword_release(keyword,error=error)
02153 
02154        CALL keyword_create(keyword, name="ORIG_SPIN_INDEX",&
02155             description="Spin of the MO (x) to be modified.",&
02156             enum_c_vals=s2a("Alpha","Beta"),&
02157             enum_i_vals=(/ 1, 2/),&  ! direct index in array
02158             default_i_val=1,&
02159             enum_desc=s2a("Majority spin","Minority spin"), error=error)
02160        CALL section_add_keyword(subsection,keyword,error=error)
02161        CALL keyword_release(keyword,error=error)
02162 
02163        CALL keyword_create(keyword, name="ORIG_SCALE",&
02164             description="Scaling factor of the result variable (b).",&
02165             usage="ORIG_SCALE 0.0", type_of_var=real_t, error=error)
02166        CALL section_add_keyword(subsection,keyword,error=error)
02167        CALL keyword_release(keyword,error=error)
02168 
02169        CALL keyword_create(keyword, name="ORIG_IS_VIRTUAL",&
02170             description="The original MO (x) is a LUMO.",&
02171             usage="ORIG_IS_VIRTUAL", type_of_var=logical_t, error=error)
02172        CALL section_add_keyword(subsection,keyword,error=error)
02173        CALL keyword_release(keyword,error=error)
02174 
02175        CALL section_add_subsection(section,subsection,error=error)
02176        CALL section_release(subsection,error=error)
02177 
02178     END IF
02179   END SUBROUTINE create_wfn_mix_section
02180 
02181 ! *****************************************************************************
02188   SUBROUTINE create_molecular_states_section(print_key,error)
02189     TYPE(section_type), POINTER              :: print_key
02190     TYPE(cp_error_type), INTENT(inout)       :: error
02191 
02192     CHARACTER(len=*), PARAMETER :: 
02193       routineN = 'create_molecular_states_section', 
02194       routineP = moduleN//':'//routineN
02195 
02196     LOGICAL                                  :: failure
02197     TYPE(keyword_type), POINTER              :: keyword
02198     TYPE(section_type), POINTER              :: print_key2
02199 
02200     failure=.FALSE.
02201     CPPrecondition(.NOT.ASSOCIATED(print_key),cp_failure_level,routineP,error,failure)
02202     IF (.NOT. failure) THEN
02203        NULLIFY(print_key2, keyword)
02204        CALL cp_print_key_section_create(print_key,"MOLECULAR_STATES",&
02205             description="Controls printing of molecular states ",&
02206             print_level=high_print_level,filename=" ",citations=(/Hunt2003/), error=error)
02207 
02208        CALL keyword_create(keyword, name="CUBE_EVAL_RANGE",&
02209             description="only write cubes if the eigenvalues of the corresponding molecular states lie in the given interval. "//&
02210                         "Default is all states.",&
02211                         usage="CUBE_EVAL_RANGE -1.0 1.0",unit_str="hartree",n_var=2,type_of_var=real_t,error=error)
02212        CALL section_add_keyword(print_key,keyword,error=error)
02213        CALL keyword_release(keyword,error=error)
02214 
02215        CALL keyword_create(keyword,name="MARK_STATES",&
02216             description="Can be used to mark given molecular states."//&
02217             " Sets a mark to both, occupied and unoccupied states. "//&
02218             "Occupied states are counted beginning with HOMO=1, "//&
02219             "unoccupied states are counted beginning with LUMO=1, "//&
02220             "This is only meaningful in combination with WFN_MIX. "//&
02221             "First integer specifies the molecule, second integer specifies the state.",&
02222             usage="MARK_STATES integer integer",&
02223             n_var=2,default_i_vals=(/-1,-1/), type_of_var=integer_t,repeats=.TRUE.,error=error)
02224        CALL section_add_keyword(print_key,keyword,error=error)
02225        CALL keyword_release(keyword,error=error)
02226 
02227        CALL cp_print_key_section_create(print_key2,"cubes",&
02228             description="Controls the printing of cube files", &
02229             print_level=high_print_level,filename="",error=error)
02230        CALL keyword_create(keyword, name="stride",&
02231             description="The stride (X,Y,Z) used to write the cube file "//&
02232             "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
02233             " 1 number valid for all components.",&
02234             usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
02235        CALL section_add_keyword(print_key2,keyword,error=error)
02236        CALL keyword_release(keyword,error=error)
02237        CALL section_add_subsection(print_key,print_key2,error=error)
02238        CALL section_release(print_key2,error=error)
02239     END IF
02240   END SUBROUTINE create_molecular_states_section
02241 
02242 
02243   SUBROUTINE create_wannier_states_section(print_key,error)
02244     TYPE(section_type), POINTER              :: print_key
02245     TYPE(cp_error_type), INTENT(inout)       :: error
02246 
02247     CHARACTER(len=*), PARAMETER :: 
02248       routineN = 'create_wannier_states_section', 
02249       routineP = moduleN//':'//routineN
02250 
02251     LOGICAL                                  :: failure
02252     TYPE(keyword_type), POINTER              :: keyword
02253     TYPE(section_type), POINTER              :: print_key2
02254 
02255     failure=.FALSE.
02256     CPPrecondition(.NOT.ASSOCIATED(print_key),cp_failure_level,routineP,error,failure)
02257     IF (.NOT. failure) THEN
02258        NULLIFY(print_key2, keyword)
02259        CALL cp_print_key_section_create(print_key,"WANNIER_STATES",&
02260             description="Controls printing of molecular states ",&
02261             print_level=high_print_level,filename=" ", error=error)
02262 
02263        CALL keyword_create(keyword, name="CUBE_EVAL_RANGE",&
02264             description="only write cubes if the eigenvalues of the corresponding molecular states lie in the given interval. "//&
02265                         "Default is all states.",&
02266                         usage="CUBE_EVAL_RANGE -1.0 1.0",unit_str="hartree",n_var=2,type_of_var=real_t,error=error)
02267        CALL section_add_keyword(print_key,keyword,error=error)
02268        CALL keyword_release(keyword,error=error)
02269 
02270        CALL keyword_create(keyword,name="MARK_STATES",&
02271             description="Can be used to mark given molecular states."//&
02272             " Sets a mark to both, occupied and unoccupied states. "//&
02273             "Occupied states are counted beginning with HOMO=1, "//&
02274             "unoccupied states are counted beginning with LUMO=1, "//&
02275             "This is only meaningful in combination with WFN_MIX. "//&
02276             "First integer specifies the molecule, second integer specifies the state.",&
02277             usage="MARK_STATES integer integer",&
02278             n_var=2,default_i_vals=(/-1,-1/), type_of_var=integer_t,repeats=.TRUE.,error=error)
02279        CALL section_add_keyword(print_key,keyword,error=error)
02280        CALL keyword_release(keyword,error=error)
02281 
02282        CALL cp_print_key_section_create(print_key2,"cubes",&
02283             description="Controls the printing of cube files", &
02284             print_level=high_print_level,filename="",error=error)
02285        CALL keyword_create(keyword, name="stride",&
02286             description="The stride (X,Y,Z) used to write the cube file "//&
02287             "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
02288             " 1 number valid for all components.",&
02289             usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
02290        CALL section_add_keyword(print_key2,keyword,error=error)
02291        CALL keyword_release(keyword,error=error)
02292        CALL section_add_subsection(print_key,print_key2,error=error)
02293        CALL section_release(print_key2,error=error)
02294     END IF
02295   END SUBROUTINE create_wannier_states_section
02296 
02297 ! *****************************************************************************
02304   SUBROUTINE create_qs_section(section,error)
02305     TYPE(section_type), POINTER              :: section
02306     TYPE(cp_error_type), INTENT(inout)       :: error
02307 
02308     CHARACTER(len=*), PARAMETER :: routineN = 'create_qs_section', 
02309       routineP = moduleN//':'//routineN
02310 
02311     LOGICAL                                  :: failure
02312     TYPE(keyword_type), POINTER              :: keyword
02313     TYPE(section_type), POINTER              :: subsection
02314 
02315     failure=.FALSE.
02316     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
02317     IF (.NOT. failure) THEN
02318        CALL section_create(section,"qs",&
02319             description="parameters needed to set up the Quickstep framework",&
02320             n_keywords=1, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
02321             error=error)
02322 
02323        NULLIFY(keyword, subsection)
02324 
02325        ! Reals
02326        CALL keyword_create(keyword, name="EPS_DEFAULT",&
02327             description="Try setting all EPS_xxx to values leading to an energy correct up to EPS_DEFAULT",&
02328             usage="EPS_DEFAULT real", default_r_val=1.0E-10_dp,&
02329             error=error)
02330        CALL section_add_keyword(section,keyword,error=error)
02331        CALL keyword_release(keyword,error=error)
02332 
02333        CALL keyword_create(keyword, name="EPS_CORE_CHARGE",&
02334             description="Precision for mapping the core charges.Overrides EPS_DEFAULT/100.0 value",&
02335             usage="EPS_CORE_CHARGE real", type_of_var=real_t,&
02336             error=error)
02337        CALL section_add_keyword(section,keyword,error=error)
02338        CALL keyword_release(keyword,error=error)
02339 
02340        CALL keyword_create(keyword, name="EPS_GVG_RSPACE",&
02341             variants=(/"EPS_GVG"/),&
02342             description="Sets precision of the realspace KS matrix element integration. Overrides SQRT(EPS_DEFAULT) value",&
02343             usage="EPS_GVG_RSPACE real",type_of_var=real_t ,&
02344             error=error)
02345        CALL section_add_keyword(section,keyword,error=error)
02346        CALL keyword_release(keyword,error=error)
02347 
02348        CALL keyword_create(keyword, name="EPS_PGF_ORB",&
02349             description="Sets precision of the overlap matrix elements. Overrides SQRT(EPS_DEFAULT) value",&
02350             usage="EPS_PGF_ORB real",type_of_var=real_t,&
02351             error=error)
02352        CALL section_add_keyword(section,keyword,error=error)
02353        CALL keyword_release(keyword,error=error)
02354 
02355        CALL keyword_create(keyword, name="EPS_KG_ORB",&
02356             description="Sets precision used in coloring the subsets. Overrides SQRT(EPS_DEFAULT) value",&
02357             usage="EPS_KG_ORB 1.0E-8",&
02358             type_of_var=real_t, error=error)
02359        CALL section_add_keyword(section,keyword,error=error)
02360        CALL keyword_release(keyword,error=error)
02361 
02362        CALL keyword_create(keyword, name="EPS_3C_REDUCE",&
02363             description="GAPW: Factor to reduce the precision in the construction"//&
02364             " of the 3 center lists for the calculation of the OCE coefficients.",&
02365             usage="EPS_3C_REDUCE real", default_r_val=1.0_dp,&
02366             type_of_var=real_t, error=error)
02367        CALL section_add_keyword(section,keyword,error=error)
02368        CALL keyword_release(keyword,error=error)
02369 
02370        CALL keyword_create(keyword, name="EPS_PPL",&
02371             description="Adjusts the precision for the local part of the pseudo potential. ",&
02372             usage="EPS_PPL real", type_of_var=real_t, default_r_val=1.0E-2_dp,&
02373             error=error)
02374        CALL section_add_keyword(section,keyword,error=error)
02375        CALL keyword_release(keyword,error=error)
02376 
02377        CALL keyword_create(keyword, name="EPS_PPNL",&
02378             description="Sets precision of the non-local part of the pseudo potential. Overrides sqrt(EPS_DEFAULT) value",&
02379             usage="EPS_PPNL real", type_of_var=real_t,&
02380             error=error)
02381        CALL section_add_keyword(section,keyword,error=error)
02382        CALL keyword_release(keyword,error=error)
02383 
02384        CALL keyword_create(keyword, name="EPS_CPC",&
02385             description="Sets precision of the GAPW projection. Overrides EPS_DEFAULT value",&
02386             usage="EPS_CPC real", type_of_var=real_t,&
02387             error=error)
02388        CALL section_add_keyword(section,keyword,error=error)
02389        CALL keyword_release(keyword,error=error)
02390 
02391        CALL keyword_create(keyword, name="EPS_RHO",&
02392             description="Sets precision of the density mapping on the grids.Overrides EPS_DEFAULT value",&
02393             usage="EPS_RHO real",type_of_var=real_t,&
02394             error=error)
02395        CALL section_add_keyword(section,keyword,error=error)
02396        CALL keyword_release(keyword,error=error)
02397 
02398        CALL keyword_create(keyword, name="EPS_RHO_RSPACE",&
02399             description="Sets precision of the density mapping in rspace.Overrides EPS_DEFAULT value."//&
02400             ".Overrides EPS_RHO value",&
02401             usage="EPS_RHO_RSPACE real",type_of_var=real_t,&
02402             error=error)
02403        CALL section_add_keyword(section,keyword,error=error)
02404        CALL keyword_release(keyword,error=error)
02405 
02406        CALL keyword_create(keyword, name="EPS_RHO_GSPACE",&
02407             description="Sets precision of the density mapping in gspace.Overrides EPS_DEFAULT value."//&
02408             ".Overrides EPS_RHO value",&
02409             usage="EPS_RHO_GSPACE real",type_of_var=real_t,&
02410             error=error)
02411        CALL section_add_keyword(section,keyword,error=error)
02412        CALL keyword_release(keyword,error=error)
02413 
02414        CALL keyword_create(keyword, name="EPS_FILTER_MATRIX",&
02415             description="Sets the threshold for filtering matrix elements.",&
02416             usage="EPS_FILTER_MATRIX 1.0E-6", type_of_var=real_t,default_r_val=0.0E0_dp,&
02417             error=error)
02418        CALL section_add_keyword(section,keyword,error=error)
02419        CALL keyword_release(keyword,error=error)
02420 
02421        CALL keyword_create(keyword, name="EPSFIT",&
02422             variants=(/"EPS_FIT"/),&
02423             description="GAPW and LRIPAW: precision to give the extention of a hard gaussian ",&
02424             usage="EPSFIT real", default_r_val=1.0E-4_dp,&
02425             error=error)
02426        CALL section_add_keyword(section,keyword,error=error)
02427        CALL keyword_release(keyword,error=error)
02428 
02429        CALL keyword_create(keyword, name="EPSISO",&
02430             variants=(/"EPS_ISO"/),&
02431             description="GAPW : precision to determine an isolated projector",&
02432             usage="EPSISO real", default_r_val=1.0E-12_dp,&
02433             error=error)
02434        CALL section_add_keyword(section,keyword,error=error)
02435        CALL keyword_release(keyword,error=error)
02436 
02437        CALL keyword_create(keyword, name="EPSSVD",&
02438             variants=(/"EPS_SVD"/),&
02439             description="GAPW : tolerance used in the singular value decomposition of the projector matrix",&
02440             usage="EPS_SVD real", default_r_val=1.0E-8_dp,&
02441             error=error)
02442        CALL section_add_keyword(section,keyword,error=error)
02443        CALL keyword_release(keyword,error=error)
02444 
02445        CALL keyword_create(keyword, name="EPSRHO0",&
02446             variants=s2a("EPSVRHO0","EPS_VRHO0"),&
02447             description="GAPW : precision to determine the range of V(rho0-rho0soft)",&
02448             usage="EPSRHO0 real", default_r_val=1.0E-6_dp,&
02449             error=error)
02450        CALL section_add_keyword(section,keyword,error=error)
02451        CALL keyword_release(keyword,error=error)
02452 
02453        CALL keyword_create(keyword, name="ALPHA0_HARD",&
02454             variants=s2a("ALPHA0_H","ALPHA0"),&
02455             description="GAPW and LRIPAW : Exponent for hard compensation charge",&
02456             usage="ALPHA0_HARD real", default_r_val=0.0_dp,&
02457             error=error)
02458        CALL section_add_keyword(section,keyword,error=error)
02459        CALL keyword_release(keyword,error=error)
02460 
02461        CALL keyword_create(keyword, name="FORCE_PAW",&
02462             description="Use the GAPW scheme also for atoms with soft basis sets, i.e. "//&
02463             " the local densities are computed even if hard and soft should be equal. "//&
02464             "If this keyword is not set to true, those atoms with soft basis sets are treated by a GPW scheme, i.e. "//&
02465             "the corresponding density contribution goes on the global grid and is expanded in PW. "//&
02466             " This option nullifies the effect of the GPW_TYPE in the atomic KIND",&
02467             usage="FORCE_PAW",&
02468             default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
02469        CALL section_add_keyword(section,keyword,error=error)
02470        CALL keyword_release(keyword,error=error)
02471 
02472        CALL keyword_create(keyword, name="MAX_RAD_LOCAL",&
02473             description="GAPW : maximum radius of gaussian functions"//&
02474             " included in the generation of projectors",&
02475             usage="MAX_RAD_LOCAL real", default_r_val=25.0_dp,&
02476             error=error)
02477        CALL section_add_keyword(section,keyword,error=error)
02478        CALL keyword_release(keyword,error=error)
02479 
02480        ! Logicals
02481        CALL keyword_create(keyword, name="SCP",&
02482             description="Introduce additional self-consistent polarization through"//&
02483             " additional response basis functions (read in through AUX_BASIS.",&
02484             usage="SCP",lone_keyword_l_val=.TRUE.,&
02485             default_l_val=.FALSE.,error=error)
02486        CALL section_add_keyword(section,keyword,error=error)
02487        CALL keyword_release(keyword,error=error)
02488 
02489        CALL keyword_create(keyword, name="LS_SCF",&
02490             description="Perform a linear scaling SCF",&
02491             usage="LS_SCF",lone_keyword_l_val=.TRUE.,&
02492             default_l_val=.FALSE.,error=error)
02493        CALL section_add_keyword(section,keyword,error=error)
02494        CALL keyword_release(keyword,error=error)
02495 
02496        CALL keyword_create(keyword, name="KG_METHOD",&
02497             description="Use a Kim-Gordon-like scheme.",&
02498             usage="KG_METHOD",lone_keyword_l_val=.TRUE.,&
02499             default_l_val=.FALSE.,citations=(/Iannuzzi2006, Brelaz1979/),error=error)
02500        CALL section_add_keyword(section,keyword,error=error)
02501        CALL keyword_release(keyword,error=error)
02502 
02503        CALL keyword_create(keyword, name="MAP_CONSISTENT",&
02504             description="Compute the exact derivative (Hks) of the energy with respect to the density matrix. "//&
02505                         "This is slightly more expensive than using an approximate computation, "//&
02506                         "but consistent mapping can improve the stability of the SCF procedure, "//&
02507                         "especially for a tight EPS_SCF and a less tight EPS_DEFAULT.",&
02508             usage="MAP_CONSISTENT FALSE",&
02509             default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
02510        CALL section_add_keyword(section,keyword,error=error)
02511        CALL keyword_release(keyword,error=error)
02512 
02513        CALL keyword_create(keyword, name="CHECK_BCSR_CODE",&
02514             description="Check the BCSR code on actual data, once per QS run.",&
02515             usage="CHECK_BCSR_CODE TRUE",&
02516             default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
02517        CALL section_add_keyword(section,keyword,error=error)
02518        CALL keyword_release(keyword,error=error)
02519 
02520        CALL keyword_create(keyword, name="BCSR_CODE",&
02521             description="Selects BCSR pathway.",&
02522             usage="BCSR_CODE 0",&
02523             default_i_val=0,error=error)
02524        CALL section_add_keyword(section,keyword,error=error)
02525        CALL keyword_release(keyword,error=error)
02526 
02527        ! Integers
02528        CALL keyword_create(keyword, name="LMAXN1",&
02529             variants=(/"LMAXRHO1"/),&
02530             description="GAPW : max L number for espansion of the atomic densities in spherical gaussians",&
02531             usage="LMAXN1 integer",&
02532             default_i_val=-1,error=error)
02533        CALL section_add_keyword(section,keyword,error=error)
02534        CALL keyword_release(keyword,error=error)
02535 
02536        CALL keyword_create(keyword, name="LMAXN0",&
02537             variants=(/"LMAXRHO0"/),&
02538             description="GAPW : max L number for the expansion compensation densities in spherical gaussians",&
02539             usage="LMAXN0 integer",&
02540             default_i_val=2,error=error)
02541        CALL section_add_keyword(section,keyword,error=error)
02542        CALL keyword_release(keyword,error=error)
02543 
02544        CALL keyword_create(keyword, name="LADDN0",&
02545             description="GAPW : integer added to the max L of the basis set, used to determine the "//&
02546             "maximum value of L for the compensation charge density.",&
02547             usage="LADDN0 integer",&
02548             default_i_val=99,error=error)
02549        CALL section_add_keyword(section,keyword,error=error)
02550        CALL keyword_release(keyword,error=error)
02551 
02552        ! Characters
02553        CALL keyword_create(keyword, name="QUADRATURE",&
02554             description="GAPW and LRIPAW: algorithm to construct the atomic radial grids",&
02555             usage="QUADRATURE GC_SIMPLE",&
02556             enum_c_vals=s2a("GC_SIMPLE","GC_TRANSFORMED","GC_LOG"),&
02557             enum_i_vals=(/ do_gapw_gcs,do_gapw_gct,do_gapw_log/),&
02558             enum_desc=s2a("Gauss-Chebyshev",&
02559                           "Trans_Gauss-Chebyshev",&
02560                           "LogTrans-Gauss-Chebyshev"),&
02561             default_i_val=do_gapw_log, error=error)
02562        CALL section_add_keyword(section,keyword,error=error)
02563        CALL keyword_release(keyword,error=error)
02564 
02565        CALL keyword_create(keyword, name="PW_GRID",&
02566             description="What kind of PW_GRID should be employed",&
02567             usage="PW_GRID NS-FULLSPACE",&
02568             enum_c_vals=s2a("SPHERICAL","NS-FULLSPACE","NS-HALFSPACE"),&
02569             enum_desc=s2a("- not tested"," tested"," - not tested"),&
02570             enum_i_vals=(/ do_pwgrid_spherical, do_pwgrid_ns_fullspace,do_pwgrid_ns_halfspace/),&
02571             default_i_val=do_pwgrid_ns_fullspace, error=error)
02572        CALL section_add_keyword(section,keyword,error=error)
02573        CALL keyword_release(keyword,error=error)
02574 
02575        CALL keyword_create(keyword, name="PW_GRID_LAYOUT",&
02576             description="Force a particular real-space layout for the plane waves grids. "//&
02577                         "Numbers <=0 mean that this dimension is free, incorrect layouts will be ignored. "//&
02578                         "The default (/-1,-1/) causes CP2K to select a good value, "//&
02579                         "i.e. plane distributed for large grids, more general distribution for small grids.",&
02580             usage="PW_GRID_LAYOUT 4 16",&
02581             repeats=.FALSE.,required=.FALSE.,n_var=2,&
02582             default_i_vals=(/-1,-1/),&
02583             error=error)
02584        CALL section_add_keyword(section,keyword,error=error)
02585        CALL keyword_release(keyword,error=error)
02586 
02587        CALL keyword_create(keyword, name="PW_GRID_BLOCKED",&
02588             description="Can be used to set the distribution in g-space for the pw grids and their FFT.",&
02589             usage="PW_GRID_BLOCKED FREE",&
02590             enum_c_vals=s2a("FREE","TRUE","FALSE"),&
02591             enum_desc=s2a("CP2K will select an appropriate value","blocked","not blocked"),&
02592             enum_i_vals=(/do_pw_grid_blocked_free,do_pw_grid_blocked_true,do_pw_grid_blocked_false/),&
02593             default_i_val=do_pw_grid_blocked_free, error=error)
02594        CALL section_add_keyword(section,keyword,error=error)
02595        CALL keyword_release(keyword,error=error)
02596 
02597        CALL keyword_create(keyword, name="EXTRAPOLATION",&
02598             variants=s2a("INTERPOLATION","WF_INTERPOLATION"),&
02599             description="Extrapolation strategy for the wavefunction during e.g. MD."//&
02600                         "PS and ASPC are recommended, see also EXTRAPOLATION_ORDER.",&
02601             citations=(/Kolafa2004,VandeVondele2005a/),&
02602             usage="EXTRAPOLATION PS",&
02603             enum_c_vals=s2a("USE_GUESS","USE_PREV_P","USE_PREV_RHO_R","LINEAR_WF",&
02604             "LINEAR_P","LINEAR_PS","USE_PREV_WF","PS","FROZEN","ASPC"),&
02605             enum_desc=s2a("Use the method specified with SCF_GUESS, i.e. no extrapolation",&
02606             "Use the previous density matrix",&
02607             "Use the previous density in real space",&
02608             "Linear extrapolation of the wavefunction",&
02609             "Linear extrapolation of the density matrix",&
02610             "Linear extrapolation of the density matrix times the overlap matrix",&
02611             "Use the previous wavefunction",&
02612             "Higher order extrapolation of the density matrix times the overlap matrix",&
02613             "Frozen ...",&
02614             "Always stable predictor corrector, similar to PS, but going for MD stability instead of intial guess accuracy."),&
02615             enum_i_vals=(/&
02616             wfi_use_guess_method_nr,&
02617             wfi_use_prev_p_method_nr,&
02618             wfi_use_prev_rho_r_method_nr,&
02619             wfi_linear_wf_method_nr,&
02620             wfi_linear_p_method_nr,&
02621             wfi_linear_ps_method_nr,&
02622             wfi_use_prev_wf_method_nr,&
02623             wfi_ps_method_nr,&
02624             wfi_frozen_method_nr,&
02625             wfi_aspc_nr/),&
02626             default_i_val=wfi_aspc_nr, error=error)
02627        CALL section_add_keyword(section,keyword,error=error)
02628        CALL keyword_release(keyword,error=error)
02629 
02630        CALL keyword_create(keyword, name="EXTRAPOLATION_ORDER",&
02631             description="Order for the PS or ASPC extrapolation (typically 2-4). "//&
02632                         "Higher order might bring more accuracy, but comes, "//&
02633                         "for large systems, also at some cost. "//&
02634                         "In some cases, a high order extrapolation is not stable,"//&
02635                         " and the order needs to be reduced.",&
02636             usage="EXTRAPOLATION_ORDER {integer}",default_i_val=3, error=error)
02637        CALL section_add_keyword(section,keyword,error=error)
02638        CALL keyword_release(keyword,error=error)
02639 
02640        CALL keyword_create(keyword, name="METHOD",&
02641             description="Specifies the electronic structure method that should be employed",&
02642             usage="METHOD GAPW",&
02643             enum_c_vals=s2a("GAPW","GAPW_XC","GPW","LRIPAW",&
02644             "MNDO","MNDOD","AM1","PM3","PM6","PDG","RM1","PNNL","DFTB","OFGPW","SCPTB"),&
02645             enum_desc=s2a("Gaussian and augmented plane waves method",&
02646                           "Gaussian and augmented plane waves method only for XC",&
02647                           "Gaussian and plane waves method",&
02648                           "Local resolution of identity projector augmented wave method",&
02649                           "MNDO semiempirical","MNDO-d semiempirical","AM1 semiempirical",&
02650                           "PM3 semiempirical","PM6 semiempirical","PDG semiempirical",&
02651                           "RM1 semiempirical",&
02652                           "PNNL semiempirical",&
02653                           "DFTB Density Functional based Tight-Binding",&
02654                           "OFGPW Orbital-free GPW method",&
02655                           "SCPTB Self-Consistent-Polarization Tight-Binding"),&
02656             enum_i_vals=(/ do_method_gapw, do_method_gapw_xc, do_method_gpw, do_method_lripaw,&
02657             do_method_mndo, do_method_mndod, do_method_am1, do_method_pm3, &
02658             do_method_pm6, do_method_pdg, do_method_rm1, do_method_pnnl, do_method_dftb, &
02659             do_method_ofgpw, do_method_scptb/),&
02660             citations=(/Lippert1997,Lippert1999,Krack2000,VandeVondele2005a,&
02661             VandeVondele2006,Dewar1977,Dewar1985,Rocha2006,Stewart1989,Thiel1992,&
02662             Repasky2002,Stewart2007,Schenter2008/),&
02663             default_i_val=do_method_gpw, error=error)
02664        CALL section_add_keyword(section,keyword,error=error)
02665        CALL keyword_release(keyword,error=error)
02666 
02667        CALL keyword_create(keyword, name="CORE_PPL",&
02668             description="Specifies the method used to calculate the local pseudopotential contribution.",&
02669             usage="CORE_PPL ANALYTIC",&
02670             enum_c_vals=s2a("ANALYTIC","GRID"),&
02671             enum_desc=s2a("Analytic integration of integrals",&
02672                           "Numerical integration on real space grid. Lumped together with core charge"),&
02673             enum_i_vals=(/ do_ppl_analytic, do_ppl_grid/), &
02674             default_i_val=do_ppl_analytic, error=error)
02675        CALL section_add_keyword(section,keyword,error=error)
02676        CALL keyword_release(keyword,error=error)
02677 
02678        CALL create_distribution_section(subsection,error)
02679        CALL section_add_subsection(section, subsection, error=error)
02680        CALL section_release(subsection,error=error)
02681 
02682        CALL create_dftb_control_section(subsection,error)
02683        CALL section_add_subsection(section, subsection, error=error)
02684        CALL section_release(subsection,error=error)
02685 
02686        CALL create_scptb_control_section(subsection,error)
02687        CALL section_add_subsection(section, subsection, error=error)
02688        CALL section_release(subsection,error=error)
02689 
02690        CALL create_se_control_section(subsection,error)
02691        CALL section_add_subsection(section, subsection, error=error)
02692        CALL section_release(subsection,error=error)
02693 
02694        CALL create_mulliken_section(subsection,error)
02695        CALL section_add_subsection(section, subsection, error=error)
02696        CALL section_release(subsection,error=error)
02697 
02698        CALL create_ddapc_restraint_section(subsection,error)
02699        CALL section_add_subsection(section, subsection, error=error)
02700        CALL section_release(subsection,error=error)
02701 
02702        CALL create_becke_restraint_section(subsection,error)
02703        CALL section_add_subsection(section, subsection, error=error)
02704        CALL section_release(subsection,error=error)
02705 
02706        CALL create_s2_restraint_section(subsection,error)
02707        CALL section_add_subsection(section, subsection, error=error)
02708        CALL section_release(subsection,error=error)
02709 
02710        CALL create_harris_section(subsection,error)
02711        CALL section_add_subsection(section, subsection, error=error)
02712        CALL section_release(subsection,error=error)
02713     END IF
02714 
02715   END SUBROUTINE create_qs_section
02716 
02717 ! *****************************************************************************
02718   SUBROUTINE create_scp_section(section,error)
02719     TYPE(section_type), POINTER              :: section
02720     TYPE(cp_error_type), INTENT(inout)       :: error
02721 
02722     CHARACTER(len=*), PARAMETER :: routineN = 'create_scp_section', 
02723       routineP = moduleN//':'//routineN
02724 
02725     LOGICAL                                  :: failure
02726     TYPE(keyword_type), POINTER              :: keyword
02727     TYPE(section_type), POINTER              :: print_key
02728 
02729     failure=.FALSE.
02730     NULLIFY(keyword)
02731     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
02732     IF (.NOT. failure) THEN
02733        CALL section_create(section,"SCP",&
02734             description="Parameters needed to set up the SCP-DFT method",&
02735             n_keywords=4, n_subsections=4, repeats=.FALSE., required=.FALSE.,&
02736             error=error)
02737 
02738        CALL keyword_create(keyword, name="_SECTION_PARAMETERS_",&
02739             description="controls the activation of the SCP method",&
02740             usage="&SCP T",&
02741             default_l_val=.FALSE.,&
02742             lone_keyword_l_val=.TRUE.,&
02743             error=error)
02744        CALL section_add_keyword(section,keyword,error=error)
02745        CALL keyword_release(keyword,error=error)
02746 
02747        CALL keyword_create(keyword, name="DISPERSION",&
02748             description="Use dispersion correction through SCP method",&
02749             usage="DISPERSION",default_l_val=.FALSE., error=error)
02750        CALL section_add_keyword(section,keyword,error=error)
02751        CALL keyword_release(keyword,error=error)
02752 
02753        NULLIFY(print_key)
02754        CALL cp_print_key_section_create(print_key,"program_run_info",&
02755             description="Controls the printing of basic information during the run", &
02756             print_level=high_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
02757             error=error)
02758        CALL section_add_subsection(section,print_key,error=error)
02759        CALL section_release(print_key,error=error)
02760 
02761     END IF
02762   END SUBROUTINE create_scp_section
02763 
02764 ! *****************************************************************************
02765   SUBROUTINE create_dftb_control_section(section,error)
02766     TYPE(section_type), POINTER              :: section
02767     TYPE(cp_error_type), INTENT(inout)       :: error
02768 
02769     CHARACTER(len=*), PARAMETER :: routineN = 'create_dftb_control_section', 
02770       routineP = moduleN//':'//routineN
02771 
02772     LOGICAL                                  :: failure
02773     TYPE(keyword_type), POINTER              :: keyword
02774     TYPE(section_type), POINTER              :: subsection
02775 
02776     failure=.FALSE.
02777 
02778     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
02779     IF (.NOT. failure) THEN
02780        CALL section_create(section,"DFTB",&
02781             description="Parameters needed to set up the DFTB methods",&
02782             n_keywords=1, n_subsections=1, repeats=.FALSE., required=.TRUE.,&
02783             citations=(/Porezag1995, Seifert1996, Elstner1998, Zhechkov2005/),&
02784             error=error)
02785 
02786        NULLIFY(subsection)
02787        CALL create_dftb_parameter_section(subsection,error)
02788        CALL section_add_subsection(section, subsection, error=error)
02789        CALL section_release(subsection,error=error)
02790 
02791        NULLIFY(keyword)
02792        CALL keyword_create(keyword, name="self_consistent",&
02793             description="Use self-consistent method",&
02794             citations=(/Elstner1998/),&
02795             usage="SELF_CONSISTENT",default_l_val=.TRUE., error=error)
02796        CALL section_add_keyword(section,keyword,error=error)
02797        CALL keyword_release(keyword,error=error)
02798 
02799        CALL keyword_create(keyword, name="orthogonal_basis",&
02800             description="Assume orthogonal basis set",&
02801             usage="ORTHOGONAL_BASIS",default_l_val=.FALSE., error=error)
02802        CALL section_add_keyword(section,keyword,error=error)
02803        CALL keyword_release(keyword,error=error)
02804 
02805        CALL keyword_create(keyword, name="do_ewald",&
02806             description="Use Ewald type method instead of direct sum for Coulomb interaction",&
02807             usage="DO_EWALD",default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
02808        CALL section_add_keyword(section,keyword,error=error)
02809        CALL keyword_release(keyword,error=error)
02810 
02811        CALL keyword_create(keyword, name="dispersion",&
02812             description="Use dispersion correction",&
02813             citations=(/Zhechkov2005/),lone_keyword_l_val=.TRUE.,&
02814             usage="DISPERSION",default_l_val=.FALSE., error=error)
02815        CALL section_add_keyword(section,keyword,error=error)
02816        CALL keyword_release(keyword,error=error)
02817 
02818        CALL keyword_create(keyword, name="HB_SR_GAMMA",&
02819             description="Uses a modified version for the GAMMA within the SCC-DFTB scheme, "//&
02820             "specifically tuned for hydrogen bonds.",&
02821             citations=(/Hu2007/),lone_keyword_l_val=.TRUE.,&
02822             usage="HB_SR_GAMMA",default_l_val=.FALSE., error=error)
02823        CALL section_add_keyword(section,keyword,error=error)
02824        CALL keyword_release(keyword,error=error)
02825 
02826        CALL keyword_create(keyword, name="eps_disp",&
02827             description="Define accuracy of dispersion interaction",&
02828             usage="EPS_DISP",default_r_val=0.0001_dp, error=error)
02829        CALL section_add_keyword(section,keyword,error=error)
02830        CALL keyword_release(keyword,error=error)
02831 
02832     END IF
02833 
02834   END SUBROUTINE create_dftb_control_section
02835 
02836 ! *****************************************************************************
02837   SUBROUTINE create_scptb_control_section(section,error)
02838     TYPE(section_type), POINTER              :: section
02839     TYPE(cp_error_type), INTENT(inout)       :: error
02840 
02841     CHARACTER(len=*), PARAMETER :: routineN = 'create_scptb_control_section', 
02842       routineP = moduleN//':'//routineN
02843 
02844     LOGICAL                                  :: failure
02845     TYPE(keyword_type), POINTER              :: keyword
02846 
02847     failure=.FALSE.
02848 
02849     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
02850     IF (.NOT. failure) THEN
02851        CALL section_create(section,"SCPTB",&
02852             description="Parameters needed to set up the SCPTB methods",&
02853             n_keywords=1, n_subsections=1, repeats=.FALSE., required=.FALSE.,&
02854             error=error)
02855 
02856        NULLIFY(keyword)
02857        CALL keyword_create(keyword,name="PARAMETER_FILE_NAME",&
02858             description="Specify file that contains the atomic parameters",&
02859             usage="PARAMETER_FILE_NAME filename",&
02860             n_var=1,type_of_var=char_t,default_c_val="",error=error)
02861        CALL section_add_keyword(section,keyword,error=error)
02862        CALL keyword_release(keyword,error=error)
02863 
02864        CALL keyword_create(keyword,name="DISPERSION_PARAMETER_FILE",&
02865             description="Specify file that contains the atomic dispersion parameters",&
02866             usage="DISPERSION_PARAMETER_FILE filename",&
02867             n_var=1,type_of_var=char_t,default_c_val="",error=error)
02868        CALL section_add_keyword(section,keyword,error=error)
02869        CALL keyword_release(keyword,error=error)
02870 
02871        CALL keyword_create(keyword, name="DISPERSION",&
02872             description="Use dispersion correction",&
02873             lone_keyword_l_val=.TRUE.,&
02874             usage="DISPERSION",default_l_val=.TRUE., error=error)
02875        CALL section_add_keyword(section,keyword,error=error)
02876        CALL keyword_release(keyword,error=error)
02877 
02878        CALL keyword_create(keyword, name="DISPERSION_RADIUS",&
02879             description="Define radius of dispersion interaction",&
02880             usage="DISPERSION_RADIUS",default_r_val=15._dp, error=error)
02881        CALL section_add_keyword(section,keyword,error=error)
02882        CALL keyword_release(keyword,error=error)
02883 
02884        CALL keyword_create(keyword, name="COORDINATION_CUTOFF",&
02885             description="Define cutoff for coordination number calculation",&
02886             usage="COORDINATION_CUTOFF",default_r_val=1.e-6_dp, error=error)
02887        CALL section_add_keyword(section,keyword,error=error)
02888        CALL keyword_release(keyword,error=error)
02889 
02890        CALL keyword_create(keyword,name="D3_SCALING",&
02891             description="Scaling parameters (s6,sr6,s8) for the D3 dispersion method,",&
02892             usage="D3_SCALING 1.0 1.0 1.0", n_var=3, default_r_vals=(/1.0_dp,1.0_dp,1.0_dp/),required=.FALSE.,error=error)
02893        CALL section_add_keyword(section,keyword,error=error)
02894        CALL keyword_release(keyword,error=error)
02895 
02896        CALL keyword_create(keyword, name="STO_NG",&
02897             description="Provides the order of the Slater orbital expansion of Gaussian-Type Orbitals.",&
02898             usage="STO_NG",default_i_val=6, error=error)
02899        CALL section_add_keyword(section,keyword,error=error)
02900        CALL keyword_release(keyword,error=error)
02901 
02902        CALL keyword_create(keyword, name="PAIR_CUTOFF",&
02903             description="Define cutoff for pair potential calculation",&
02904             usage="PAIR_CUTOFF",default_r_val=1.e-8_dp, error=error)
02905        CALL section_add_keyword(section,keyword,error=error)
02906        CALL keyword_release(keyword,error=error)
02907 
02908        CALL keyword_create(keyword, name="do_ewald",&
02909             description="Use Ewald type method instead of direct sum for Coulomb interaction",&
02910             usage="DO_EWALD",default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
02911        CALL section_add_keyword(section,keyword,error=error)
02912        CALL keyword_release(keyword,error=error)
02913 
02914        CALL keyword_create(keyword, name="do_scc",&
02915             description="Use self consistent charge method. Can be used together with DO_SCP to get TB method",&
02916             usage="DO_SCC",default_l_val=.TRUE., lone_keyword_l_val=.TRUE., error=error)
02917        CALL section_add_keyword(section,keyword,error=error)
02918        CALL keyword_release(keyword,error=error)
02919 
02920        CALL keyword_create(keyword, name="do_scp",&
02921             description="Use SCP method. Can be used to switch off SCP to get a SCC-DFTB method",&
02922             usage="DO_SCP",default_l_val=.TRUE., lone_keyword_l_val=.TRUE., error=error)
02923        CALL section_add_keyword(section,keyword,error=error)
02924        CALL keyword_release(keyword,error=error)
02925 
02926     END IF
02927 
02928   END SUBROUTINE create_scptb_control_section
02929 
02930 ! *****************************************************************************
02931   SUBROUTINE create_admm_section(section,error)
02932     TYPE(section_type), POINTER              :: section
02933     TYPE(cp_error_type), INTENT(inout)       :: error
02934 
02935     CHARACTER(len=*), PARAMETER :: routineN = 'create_admm_section', 
02936       routineP = moduleN//':'//routineN
02937 
02938     LOGICAL                                  :: failure
02939     TYPE(keyword_type), POINTER              :: keyword
02940     TYPE(section_type), POINTER              :: subsection
02941 
02942     failure=.FALSE.
02943     NULLIFY(keyword)
02944     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
02945     IF (.NOT. failure) THEN
02946        CALL section_create(section,"AUXILIARY_DENSITY_MATRIX_METHOD",&
02947             description="Parameters needed to set wavefunction fitting",&
02948             n_keywords=1, n_subsections=1, repeats=.FALSE., required=.TRUE.,&
02949             citations=(/Guidon2010/),&
02950             error=error)
02951 
02952        CALL keyword_create(&
02953             keyword=keyword,&
02954             name="METHOD",&
02955             description="Method that shall be used for wavefunction fitting. Use BASIS_PROJECTION for MD.",&
02956             usage="METHOD BASIS_PROJECTION",&
02957             enum_c_vals=s2a("BASIS_PROJECTION","BLOCK_DENSITY_MATRIX"),&
02958             enum_i_vals=(/do_admm_basis_set_projection, do_admm_block_density_matrix/),&
02959             enum_desc=s2a("Construct auxiliary density matrix from auxiliary basis", &
02960                           "Construct auxiliary density from a blocked Fock matrix"), &
02961             citations=(/Guidon2010/),&
02962             default_i_val=do_admm_basis_set_projection, error=error)
02963        CALL section_add_keyword(section,keyword,error=error)
02964        CALL keyword_release(keyword,error=error)
02965 
02966        CALL keyword_create(&
02967             keyword=keyword,&
02968             name="ADMM_PURIFICATION_METHOD",&
02969             description="Method that shall be used for wavefunction fitting. Use MO_DIAG for MD.",&
02970             usage="ADMM_PURIFICATION_METHOD NONE",&
02971             enum_c_vals=s2a("NONE","CAUCHY","CAUCHY_SUBSPACE","MO_DIAG", "MO_NO_DIAG"),&
02972             enum_i_vals=(/do_admm_purify_none, do_admm_purify_cauchy, do_admm_purify_cauchy_subspace,&
02973                           do_admm_purify_mo_diag, do_admm_purify_mo_no_diag/),&
02974             enum_desc=s2a("Do not apply any purification", &
02975                           "Apply McWeeny purification via general Cauchy representation", &
02976                           "Apply McWeeny purification via Cauchy representation in occupied subspace", &
02977                           "Calculate MO derivatives via Cauchy representation by diagonalization", &
02978                           "Calculate MO derivatives via Cauchy representation by inversion"), &
02979             citations=(/Guidon2010/),&
02980             default_i_val=do_admm_purify_mo_diag, error=error)
02981        CALL section_add_keyword(section,keyword,error=error)
02982        CALL keyword_release(keyword,error=error)
02983 
02984        NULLIFY(subsection)
02985        CALL create_admm_block_section(subsection,error)
02986        CALL section_add_subsection(section, subsection, error=error)
02987        CALL section_release(subsection,error=error)
02988 
02989     END IF
02990   END SUBROUTINE create_admm_section
02991 
02992 ! *****************************************************************************
02993   SUBROUTINE create_admm_block_section(section,error)
02994     TYPE(section_type), POINTER              :: section
02995     TYPE(cp_error_type), INTENT(inout)       :: error
02996 
02997     CHARACTER(len=*), PARAMETER :: routineN = 'create_admm_block_section', 
02998       routineP = moduleN//':'//routineN
02999 
03000     LOGICAL                                  :: failure
03001     TYPE(keyword_type), POINTER              :: keyword
03002     TYPE(section_type), POINTER              :: subsection
03003 
03004     failure=.FALSE.
03005     NULLIFY(keyword)
03006     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03007     IF (.NOT. failure) THEN
03008        CALL section_create(section,"BLOCK_DENSITY_MATRIX_METHOD",&
03009             description="Parameters needed to set wavefunction fitting",&
03010             n_keywords=1, n_subsections=0, repeats=.FALSE., required=.TRUE.,&
03011             error=error)
03012 
03013        CALL keyword_create(&
03014             keyword=keyword,&
03015             name="BASIS_PROJECTION",&
03016             description="Defines usage of auxiliary basis set",&
03017             usage="BASIS_PROJECTION ON",&
03018             enum_c_vals=s2a("ON","OFF"),&
03019             enum_i_vals=(/do_admm_block_aux_basis_on, do_admm_block_aux_basis_off/),&
03020             enum_desc=s2a("Use auxiliary basis", &
03021                           "Use primary basis"), &
03022             default_i_val=do_admm_block_aux_basis_on, error=error)
03023        CALL section_add_keyword(section,keyword,error=error)
03024        CALL keyword_release(keyword,error=error)
03025 
03026        CALL keyword_create(&
03027             keyword=keyword,&
03028             name="PURIFICATION",&
03029             description="Method that shall be used for Purification",&
03030             usage="PURIFICATION ON",&
03031             enum_c_vals=s2a("OFF","FULL","BLOCKED"),&
03032             enum_i_vals=(/do_admm_block_purify_off, do_admm_block_purify_full, do_admm_block_purify_blocked/),&
03033             enum_desc=s2a("Do not apply any purification", &
03034                           "Apply full McWeeny purification via general Cauchy representation",&
03035                           "Apply blocked McWeeny purification via general Cauchy representation"), &
03036             default_i_val=do_admm_block_purify_full, error=error)
03037        CALL section_add_keyword(section,keyword,error=error)
03038        CALL keyword_release(keyword,error=error)
03039 
03040        NULLIFY(keyword, subsection)
03041        ! FRAGMENT SECTION
03042        CALL section_create(subsection,name="BLOCK",&
03043             description="Specify the atom number belonging to this fragment.",&
03044             n_keywords=2, n_subsections=0, repeats=.TRUE., required=.TRUE.,&
03045             error=error)
03046 
03047        CALL keyword_create(keyword, name="LIST",&
03048             description="Specifies a list of atoms.",&
03049             usage="LIST {integer} {integer} .. {integer}", required=.FALSE.,&
03050             n_var=-1, type_of_var=integer_t, error=error)
03051        CALL section_add_keyword(subsection,keyword,error=error)
03052        CALL keyword_release(keyword,error=error)
03053 
03054        CALL section_add_subsection(section, subsection, error=error)
03055        CALL section_release(subsection,error=error)
03056 
03057     END IF
03058   END SUBROUTINE create_admm_block_section
03059 
03060 ! *****************************************************************************
03061   SUBROUTINE create_dftb_parameter_section(section, error)
03062 
03063     TYPE(section_type), POINTER              :: section
03064     TYPE(cp_error_type), INTENT(inout)       :: error
03065 
03066     CHARACTER(len=*), PARAMETER :: 
03067       routineN = 'create_dftb_parameter_section', 
03068       routineP = moduleN//':'//routineN
03069 
03070     LOGICAL                                  :: failure
03071     TYPE(keyword_type), POINTER              :: keyword
03072 
03073     failure=.FALSE.
03074 
03075     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03076     IF (.NOT. failure) THEN
03077 
03078        CALL section_create(section,name="PARAMETER",&
03079             description="Information on where to find DFTB parameters",&
03080             n_keywords=1, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
03081             error=error)
03082 
03083        NULLIFY(keyword)
03084        CALL keyword_create(keyword,name="SK_FILE",&
03085             description="Define parameter file for atom pair",&
03086             usage="SK_FILE a1 a2 filename",&
03087             n_var=3,type_of_var=char_t,repeats=.TRUE.,error=error)
03088        CALL section_add_keyword(section,keyword,error=error)
03089        CALL keyword_release(keyword,error=error)
03090 
03091        CALL keyword_create(keyword,name="PARAM_FILE_PATH",&
03092             description="Specify the directory with the DFTB parameter files. "//&
03093             "Used in combination with the filenames specified in the file "//&
03094             "given in PARAM_FILE_NAME.", usage="PARAM_FILE_PATH pathname",&
03095             n_var=1,type_of_var=char_t,default_c_val="./",error=error)
03096        CALL section_add_keyword(section,keyword,error=error)
03097        CALL keyword_release(keyword,error=error)
03098 
03099        CALL keyword_create(keyword,name="PARAM_FILE_NAME",&
03100             description="Specify file that contains the names of "//&
03101             "Slater-Koster tables: A plain text file, each line has the "//&
03102             'format "ATOM1 ATOM2 filename.spl".',&
03103             usage="PARAM_FILE_NAME filename",&
03104             n_var=1,type_of_var=char_t,default_c_val="",error=error)
03105        CALL section_add_keyword(section,keyword,error=error)
03106        CALL keyword_release(keyword,error=error)
03107 
03108        CALL keyword_create(keyword, name="UFF_FORCE_FIELD",&
03109             description="Name of file with UFF parameters that will be used "//&
03110             "for the dispersion correction. Needs to be specified when "//&
03111             "DISPERSION==.TRUE., otherwise cp2k crashes with a Segmentation "//&
03112             "Fault.", usage="UFF_FORCE_FIELD filename",required=.FALSE.,&
03113             n_var=1,type_of_var=char_t,default_c_val="",error=error)
03114        CALL section_add_keyword(section,keyword,error=error)
03115        CALL keyword_release(keyword,error=error)
03116 
03117     END IF
03118   END SUBROUTINE create_dftb_parameter_section
03119 
03120 ! *****************************************************************************
03121   SUBROUTINE create_se_control_section(section,error)
03122     TYPE(section_type), POINTER              :: section
03123     TYPE(cp_error_type), INTENT(inout)       :: error
03124 
03125     CHARACTER(len=*), PARAMETER :: routineN = 'create_se_control_section', 
03126       routineP = moduleN//':'//routineN
03127 
03128     LOGICAL                                  :: failure
03129     TYPE(keyword_type), POINTER              :: keyword
03130     TYPE(section_type), POINTER              :: subsection
03131 
03132     failure=.FALSE.
03133 
03134     NULLIFY(keyword)
03135     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03136     IF (.NOT. failure) THEN
03137        CALL section_create(section,"SE",&
03138             description="Parameters needed to set up the Semi-empirical methods",&
03139             n_keywords=8, n_subsections=0, repeats=.FALSE., required=.TRUE.,&
03140             error=error)
03141 
03142        CALL keyword_create(keyword, name="ORTHOGONAL_BASIS",&
03143             description="Assume orthogonal basis set. This flag is overwritten by "//&
03144                         "methods with fixed orthogonal/non-orthogonal basis set.",&
03145             usage="ORTHOGONAL_BASIS",default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,&
03146             error=error)
03147        CALL section_add_keyword(section,keyword,error=error)
03148        CALL keyword_release(keyword,error=error)
03149 
03150        CALL keyword_create(keyword, name="STO_NG",&
03151             description="Provides the order of the Slater orbital expansion of Gaussian-Type Orbitals.",&
03152             usage="STO_NG",default_i_val=6, error=error)
03153        CALL section_add_keyword(section,keyword,error=error)
03154        CALL keyword_release(keyword,error=error)
03155 
03156        CALL keyword_create(keyword, name="ANALYTICAL_GRADIENTS",&
03157             description="Nuclear Gradients are computed analytically or numerically",&
03158             usage="ANALYTICAL_GRADIENTS",default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,&
03159             error=error)
03160        CALL section_add_keyword(section,keyword,error=error)
03161        CALL keyword_release(keyword,error=error)
03162 
03163        CALL keyword_create(keyword, name="DELTA",&
03164             description="Step size in finite difference force calculation",&
03165             usage="DELTA {real} ",default_r_val=1.e-6_dp, error=error)
03166        CALL section_add_keyword(section,keyword,error=error)
03167        CALL keyword_release(keyword,error=error)
03168 
03169        CALL keyword_create(keyword, name="INTEGRAL_SCREENING",&
03170             description="Specifies the functional form for the ",&
03171             usage="INTEGRAL_SCREENING (KDSO|KDSO-D|SLATER)",&
03172             enum_c_vals=s2a("KDSO","KDSO-D","SLATER"),&
03173             enum_i_vals=(/ do_se_IS_kdso, do_se_IS_kdso_d, do_se_IS_slater/),&
03174             enum_desc=s2a("Uses the standard NDDO Klopman-Dewar-Sabelli-Ohno equation "//&
03175             "for the screening of the Coulomb interactions.",&
03176             "Uses a modified Klopman-Dewar-Sabelli-Ohno equation, dumping the screening "//&
03177             "parameter for the Coulomb interactions.",&
03178             "Uses an exponential Slater-type function for modelling the Coulomb interactions."),&
03179             default_i_val=do_se_IS_kdso, error=error)
03180        CALL section_add_keyword(section,keyword,error=error)
03181        CALL keyword_release(keyword,error=error)
03182 
03183        CALL keyword_create(keyword, name="PERIODIC",&
03184             description="Specifies the type of treatment for the electrostatic long-range part "//&
03185             "in semi-empirical calculations.",&
03186             usage="PERIODIC (NONE|EWALD|EWALD_R3|EWALD_GKS)",&
03187             enum_c_vals=s2a("NONE","EWALD","EWALD_R3","EWALD_GKS"),&
03188             enum_i_vals=(/ do_se_lr_none, do_se_lr_ewald, do_se_lr_ewald_r3, do_se_lr_ewald_gks/),&
03189             enum_desc=s2a("The long-range part is not explicitly treaten. The interaction "//&
03190             "depends uniquely on the Cutoffs used for the calculation.",&
03191             "Enables the usage of Multipoles Ewald summation schemes. The short-range part "//&
03192             "is tapered according the value of RC_COULOMB.",&
03193             "Enables the usage of Multipoles Ewald summation schemes together with a long-range "//&
03194             "treatment for the 1/R^3 term, deriving from the short-range component. This option "//&
03195             "is active only for K-DSO integral screening type.",&
03196             "Use Ewald directly in Coulomb integral evaluation, works only with Slater screening"),&
03197             default_i_val=do_se_lr_none, error=error)
03198        CALL section_add_keyword(section,keyword,error=error)
03199        CALL keyword_release(keyword,error=error)
03200 
03201        CALL keyword_create(keyword, name="SCP",&
03202             description="Perform a SCP-NDDO calculation",&
03203             usage="SCP",default_l_val=.FALSE., error=error)
03204        CALL section_add_keyword(section,keyword,error=error)
03205        CALL keyword_release(keyword,error=error)
03206 
03207        CALL keyword_create(keyword, name="FORCE_KDSO-D_EXCHANGE",&
03208             description="This keywords forces the usage of the KDSO-D integral screening "//&
03209             "for the Exchange integrals (default is to apply the screening only to the "//&
03210             "Coulomb integrals.",default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,&
03211             error=error)
03212        CALL section_add_keyword(section,keyword,error=error)
03213        CALL keyword_release(keyword,error=error)
03214 
03215        NULLIFY(subsection)
03216        CALL create_coulomb_section(subsection,error)
03217        CALL section_add_subsection(section, subsection, error=error)
03218        CALL section_release(subsection,error=error)
03219 
03220        CALL create_exchange_section(subsection,error)
03221        CALL section_add_subsection(section, subsection, error=error)
03222        CALL section_release(subsection,error=error)
03223 
03224        CALL create_screening_section(subsection,error)
03225        CALL section_add_subsection(section, subsection, error=error)
03226        CALL section_release(subsection,error=error)
03227 
03228        CALL create_lr_corr_section(subsection,error)
03229        CALL section_add_subsection(section, subsection, error=error)
03230        CALL section_release(subsection,error=error)
03231 
03232        CALL create_neighbor_lists_section(subsection,error)
03233        CALL section_add_subsection(section, subsection, error=error)
03234        CALL section_release(subsection,error=error)
03235 
03236        CALL create_se_memory_section(subsection,error)
03237        CALL section_add_subsection(section,subsection,error=error)
03238        CALL section_release(subsection,error=error)
03239 
03240        CALL create_se_print_section(subsection,error)
03241        CALL section_add_subsection(section,subsection,error=error)
03242        CALL section_release(subsection,error=error)
03243 
03244        CALL create_se_ga_section(subsection,error)
03245        CALL section_add_subsection(section,subsection,error=error)
03246        CALL section_release(subsection,error=error)
03247     END IF
03248 
03249   END SUBROUTINE create_se_control_section
03250 
03251 ! *****************************************************************************
03259   SUBROUTINE create_lr_corr_section(section,error)
03260     TYPE(section_type), POINTER              :: section
03261     TYPE(cp_error_type), INTENT(inout)       :: error
03262 
03263     CHARACTER(len=*), PARAMETER :: routineN = 'create_lr_corr_section', 
03264       routineP = moduleN//':'//routineN
03265 
03266     LOGICAL                                  :: failure
03267     TYPE(keyword_type), POINTER              :: keyword
03268 
03269     failure=.FALSE.
03270     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03271     IF (.NOT. failure) THEN
03272        CALL section_create(section,name="LR_CORRECTION",&
03273             description="Setup parameters for the evaluation of the long-range correction term in SE "//&
03274             "calculations.", n_keywords=0, n_subsections=1, repeats=.FALSE., required=.FALSE.,&
03275             error=error)
03276        NULLIFY(keyword)
03277 
03278        CALL keyword_create(keyword, name="CUTOFF",&
03279             description="Atomic Cutoff Radius Cutoff for the evaluation of the long-ranbe correction integrals. ",&
03280             usage="CUTOFF {real} ",unit_str="angstrom",&
03281             default_r_val=cp_unit_to_cp2k(value=6.0_dp,unit_str="angstrom",error=error),&
03282             error=error)
03283        CALL section_add_keyword(section,keyword,error=error)
03284        CALL keyword_release(keyword,error=error)
03285 
03286        CALL keyword_create(keyword, name="RC_TAPER",&
03287             description="Atomic Cutoff Radius Cutoff for Tapering the long-range correction integrals. "//&
03288             "If not specified it assumes the same value specified for the CUTOFF.",&
03289             usage="RC_TAPER {real} ",unit_str="angstrom",type_of_var=real_t, error=error)
03290        CALL section_add_keyword(section,keyword,error=error)
03291        CALL keyword_release(keyword,error=error)
03292 
03293        CALL keyword_create(keyword, name="RC_RANGE",&
03294             description="Range of cutoff switch function (tapering): 0.5*(1-TANH((r-r0)/RC_RANGE)), "//&
03295             "where r0=2.0*RC_TAPER-20.0*RC_RANGE.",&
03296             usage="RC_RANGE {real} ",unit_str="angstrom",default_r_val=0.0_dp, error=error)
03297        CALL section_add_keyword(section,keyword,error=error)
03298        CALL keyword_release(keyword,error=error)
03299 
03300     END IF
03301   END SUBROUTINE create_lr_corr_section
03302 
03303 ! *****************************************************************************
03311   SUBROUTINE create_coulomb_section(section,error)
03312     TYPE(section_type), POINTER              :: section
03313     TYPE(cp_error_type), INTENT(inout)       :: error
03314 
03315     CHARACTER(len=*), PARAMETER :: routineN = 'create_coulomb_section', 
03316       routineP = moduleN//':'//routineN
03317 
03318     LOGICAL                                  :: failure
03319     TYPE(keyword_type), POINTER              :: keyword
03320 
03321     failure=.FALSE.
03322     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03323     IF (.NOT. failure) THEN
03324        CALL section_create(section,name="COULOMB",&
03325             description="Setup parameters for the evaluation of the COULOMB term in SE "//&
03326             "calculations.", n_keywords=0, n_subsections=1, repeats=.FALSE., required=.FALSE.,&
03327             error=error)
03328        NULLIFY(keyword)
03329 
03330        CALL keyword_create(keyword, name="CUTOFF",&
03331             description="Atomic Cutoff Radius Cutoff for the evaluation of the  Coulomb integrals. "//&
03332             "For non-periodic calculation the default value is exactly the full cell dimension, in order "//&
03333             "to evaluate all pair interactions. Instead, for periodic calculations the default numerical value is used." ,&
03334             usage="CUTOFF {real} ",unit_str="angstrom",&
03335             default_r_val=cp_unit_to_cp2k(value=12.0_dp,unit_str="angstrom",error=error),&
03336             error=error)
03337        CALL section_add_keyword(section,keyword,error=error)
03338        CALL keyword_release(keyword,error=error)
03339 
03340        CALL keyword_create(keyword, name="RC_TAPER",&
03341             description="Atomic Cutoff Radius Cutoff for Tapering Coulomb integrals. "//&
03342             "If not specified it assumes the same value specified for the CUTOFF.",&
03343             usage="RC_TAPER {real} ",unit_str="angstrom",type_of_var=real_t, error=error)
03344        CALL section_add_keyword(section,keyword,error=error)
03345        CALL keyword_release(keyword,error=error)
03346 
03347        CALL keyword_create(keyword, name="RC_RANGE",&
03348             description="Range of cutoff switch function (tapering): 0.5*(1-TANH((r-r0)/RC_RANGE)), "//&
03349             "where r0=2.0*RC_TAPER-20.0*RC_RANGE.",&
03350             usage="RC_RANGE {real} ",unit_str="angstrom",default_r_val=0.0_dp, error=error)
03351        CALL section_add_keyword(section,keyword,error=error)
03352        CALL keyword_release(keyword,error=error)
03353 
03354     END IF
03355   END SUBROUTINE create_coulomb_section
03356 
03357 ! *****************************************************************************
03365   SUBROUTINE create_exchange_section(section,error)
03366     TYPE(section_type), POINTER              :: section
03367     TYPE(cp_error_type), INTENT(inout)       :: error
03368 
03369     CHARACTER(len=*), PARAMETER :: routineN = 'create_exchange_section', 
03370       routineP = moduleN//':'//routineN
03371 
03372     LOGICAL                                  :: failure
03373     TYPE(keyword_type), POINTER              :: keyword
03374 
03375     failure=.FALSE.
03376     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03377     IF (.NOT. failure) THEN
03378        CALL section_create(section,name="EXCHANGE",&
03379             description="Setup parameters for the evaluation of the EXCHANGE and "//&
03380             " core Hamiltonian terms in SE calculations.", n_keywords=0, n_subsections=1,&
03381             repeats=.FALSE., required=.FALSE.,error=error)
03382        NULLIFY(keyword)
03383 
03384        CALL keyword_create(keyword, name="CUTOFF",&
03385             description="Atomic Cutoff Radius Cutoff for the evaluation of the Exchange integrals. "//&
03386             "For non-periodic calculation the default value is exactly the full cell dimension, in order "//&
03387             "to evaluate all pair interactions. Instead, for periodic calculations the default is the "//&
03388             "minimum value between 1/4 of the cell dimension and the value specified in input (either"//&
03389             " explicitly defined or the default numerical value).",&
03390             usage="CUTOFF {real} ",unit_str="angstrom",&
03391             default_r_val=cp_unit_to_cp2k(value=12.0_dp,unit_str="angstrom",error=error),&
03392             error=error)
03393        CALL section_add_keyword(section,keyword,error=error)
03394        CALL keyword_release(keyword,error=error)
03395 
03396        CALL keyword_create(keyword, name="RC_TAPER",&
03397             description="Atomic Cutoff Radius Cutoff for Tapering Exchange integrals. "//&
03398             "If not specified it assumes the same value specified for the CUTOFF.",&
03399             usage="RC_TAPER {real} ",unit_str="angstrom",type_of_var=real_t, error=error)
03400        CALL section_add_keyword(section,keyword,error=error)
03401        CALL keyword_release(keyword,error=error)
03402 
03403        CALL keyword_create(keyword, name="RC_RANGE",&
03404             description="Range of cutoff switch function (tapering): 0.5*(1-TANH((r-r0)/RC_RANGE)), "//&
03405             "where r0=2.0*RC_TAPER-20.0*RC_RANGE.",&
03406             usage="RC_RANGE {real} ",unit_str="angstrom",default_r_val=0.0_dp, error=error)
03407        CALL section_add_keyword(section,keyword,error=error)
03408        CALL keyword_release(keyword,error=error)
03409 
03410     END IF
03411   END SUBROUTINE create_exchange_section
03412 
03413 ! *****************************************************************************
03421   SUBROUTINE create_screening_section(section,error)
03422     TYPE(section_type), POINTER              :: section
03423     TYPE(cp_error_type), INTENT(inout)       :: error
03424 
03425     CHARACTER(len=*), PARAMETER :: routineN = 'create_screening_section', 
03426       routineP = moduleN//':'//routineN
03427 
03428     LOGICAL                                  :: failure
03429     TYPE(keyword_type), POINTER              :: keyword
03430 
03431     failure=.FALSE.
03432     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03433     IF (.NOT. failure) THEN
03434        CALL section_create(section,name="SCREENING",&
03435             description="Setup parameters for the tapering of the Coulomb/Exchange Screening in "//&
03436             "KDSO-D integral scheme,", n_keywords=0, n_subsections=1, repeats=.FALSE., required=.FALSE.,&
03437             error=error)
03438        NULLIFY(keyword)
03439 
03440        CALL keyword_create(keyword, name="RC_TAPER",&
03441             description="Atomic Cutoff Radius Cutoff for Tapering the screening term. ",&
03442             usage="RC_TAPER {real} ",unit_str="angstrom",&
03443             default_r_val=cp_unit_to_cp2k(value=12.0_dp,unit_str="angstrom",error=error),&
03444             error=error)
03445        CALL section_add_keyword(section,keyword,error=error)
03446        CALL keyword_release(keyword,error=error)
03447 
03448        CALL keyword_create(keyword, name="RC_RANGE",&
03449             description="Range of cutoff switch function (tapering): 0.5*(1-TANH((r-r0)/RC_RANGE)), "//&
03450             "where r0=2*RC_TAPER-20*RC_RANGE.",&
03451             usage="RC_RANGE {real} ",unit_str="angstrom",default_r_val=0.0_dp, error=error)
03452        CALL section_add_keyword(section,keyword,error=error)
03453        CALL keyword_release(keyword,error=error)
03454 
03455     END IF
03456   END SUBROUTINE create_screening_section
03457 
03458 ! *****************************************************************************
03465   SUBROUTINE create_se_print_section(section,error)
03466     TYPE(section_type), POINTER              :: section
03467     TYPE(cp_error_type), INTENT(inout)       :: error
03468 
03469     CHARACTER(len=*), PARAMETER :: routineN = 'create_se_print_section', 
03470       routineP = moduleN//':'//routineN
03471 
03472     LOGICAL                                  :: failure
03473     TYPE(section_type), POINTER              :: print_key
03474 
03475     failure=.FALSE.
03476     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03477     IF (.NOT. failure) THEN
03478        CALL section_create(section,name="print",&
03479             description="Section of possible print options in SE code.",&
03480             n_keywords=0, n_subsections=1, repeats=.FALSE., required=.TRUE.,&
03481             error=error)
03482 
03483        NULLIFY(print_key)
03484        CALL cp_print_key_section_create(print_key,"NEIGHBOR_LISTS",&
03485             description="Activates the printing of the neighbor lists used"//&
03486             " for the periodic SE calculations.", &
03487             print_level=high_print_level,filename="",unit_str="angstrom",&
03488             error=error)
03489        CALL section_add_subsection(section,print_key,error=error)
03490        CALL section_release(print_key,error=error)
03491 
03492        CALL cp_print_key_section_create(print_key,"SUBCELL",&
03493             description="Activates the printing of the subcells used for the"//&
03494             "generation of neighbor lists for periodic SE.", &
03495             print_level=high_print_level,filename="__STD_OUT__",&
03496             error=error)
03497        CALL section_add_subsection(section,print_key,error=error)
03498        CALL section_release(print_key,error=error)
03499 
03500        CALL cp_print_key_section_create(print_key,"EWALD_INFO",&
03501             description="Activates the printing of the information for "//&
03502             "Ewald multipole summation in periodic SE.", &
03503             print_level=high_print_level,filename="__STD_OUT__",&
03504             error=error)
03505        CALL section_add_subsection(section,print_key,error=error)
03506        CALL section_release(print_key,error=error)
03507 
03508     END IF
03509   END SUBROUTINE create_se_print_section
03510 
03511 ! *****************************************************************************
03516   SUBROUTINE create_se_ga_section(section,error)
03517     TYPE(section_type), POINTER              :: section
03518     TYPE(cp_error_type), INTENT(inout)       :: error
03519 
03520     CHARACTER(len=*), PARAMETER :: routineN = 'create_se_ga_section', 
03521       routineP = moduleN//':'//routineN
03522 
03523     LOGICAL                                  :: failure
03524     TYPE(keyword_type), POINTER              :: keyword
03525 
03526     failure=.FALSE.
03527 
03528     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03529     IF (.NOT. failure) THEN
03530        CALL section_create(section,"GA",&
03531             description="Sets up memory parameters for the storage of the integrals",&
03532             n_keywords=1, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
03533             error=error)
03534        NULLIFY(keyword)
03535 
03536        CALL keyword_create(&
03537             keyword=keyword,&
03538             name="NCELLS",&
03539             description="Defines the number of linked cells for the neighbor list. "//&
03540                         "Default value is number of processors",&
03541             usage="NCELLS 10",&
03542             default_i_val=0,&
03543             error=error)
03544        CALL section_add_keyword(section,keyword,error=error)
03545        CALL keyword_release(keyword,error=error)
03546     END IF
03547   END SUBROUTINE create_se_ga_section
03548 
03549 ! *****************************************************************************
03556   SUBROUTINE create_se_memory_section(section,error)
03557     TYPE(section_type), POINTER              :: section
03558     TYPE(cp_error_type), INTENT(inout)       :: error
03559 
03560     CHARACTER(len=*), PARAMETER :: routineN = 'create_se_memory_section', 
03561       routineP = moduleN//':'//routineN
03562 
03563     LOGICAL                                  :: failure
03564     TYPE(keyword_type), POINTER              :: keyword
03565 
03566     failure=.FALSE.
03567 
03568     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03569     IF (.NOT. failure) THEN
03570        CALL section_create(section,"MEMORY",&
03571             description="Sets up memory parameters for the storage of the integrals",&
03572             n_keywords=1, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
03573             error=error)
03574        NULLIFY(keyword)
03575        CALL keyword_create(&
03576             keyword=keyword,&
03577             name="EPS_STORAGE",&
03578             description="Storage threshold for compression is EPS_STORAGE",&
03579             usage="EPS_STORAGE 1.0E-10",&
03580             default_r_val=1.0E-10_dp,&
03581             error=error)
03582        CALL section_add_keyword(section,keyword,error=error)
03583        CALL keyword_release(keyword,error=error)
03584 
03585        CALL keyword_create(&
03586             keyword=keyword,&
03587             name="MAX_MEMORY",&
03588             description="Defines the maximum amount of memory [MB] used to store precomputed "//&
03589                          "(possibly compressed) two-electron two-center integrals",&
03590             usage="MAX_MEMORY 256",&
03591             default_i_val=50,&
03592             error=error)
03593        CALL section_add_keyword(section,keyword,error=error)
03594        CALL keyword_release(keyword,error=error)
03595 
03596        CALL keyword_create(keyword, name="COMPRESS",&
03597             description="Enables the compression of the integrals in memory.",&
03598             usage="COMPRESS <LOGICAL>",&
03599             default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
03600        CALL section_add_keyword(section,keyword,error=error)
03601        CALL keyword_release(keyword,error=error)
03602     END IF
03603 
03604   END SUBROUTINE create_se_memory_section
03605 
03606 
03607 ! *****************************************************************************
03608   SUBROUTINE create_mulliken_section(section,error)
03609     TYPE(section_type), POINTER              :: section
03610     TYPE(cp_error_type), INTENT(inout)       :: error
03611 
03612     CHARACTER(len=*), PARAMETER :: routineN = 'create_mulliken_section', 
03613       routineP = moduleN//':'//routineN
03614 
03615     LOGICAL                                  :: failure
03616     TYPE(keyword_type), POINTER              :: keyword
03617 
03618     failure=.FALSE.
03619     NULLIFY(keyword)
03620     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03621     IF (.NOT. failure) THEN
03622        CALL section_create(section,"MULLIKEN_RESTRAINT",&
03623             description="Use mulliken charges in a restraint (check code for details)",&
03624             n_keywords=7, n_subsections=0, repeats=.FALSE., required=.TRUE.,&
03625             error=error)
03626 
03627        CALL keyword_create(keyword, name="STRENGTH",&
03628             description="force constant of the restraint",&
03629             usage="STRENGTH {real} ",default_r_val=0.1_dp, error=error)
03630        CALL section_add_keyword(section,keyword,error=error)
03631        CALL keyword_release(keyword,error=error)
03632 
03633        CALL keyword_create(keyword, name="TARGET",&
03634             description="target value of the restraint",&
03635             usage="TARGET {real} ",default_r_val=1._dp, error=error)
03636        CALL section_add_keyword(section,keyword,error=error)
03637        CALL keyword_release(keyword,error=error)
03638 
03639        CALL keyword_create(keyword, name="ATOMS",&
03640             description="Specifies the list of atoms that is summed in the restraint",&
03641             usage="ATOMS {integer} {integer} .. {integer}", required=.TRUE.,&
03642             n_var=-1, type_of_var=integer_t, error=error)
03643        CALL section_add_keyword(section,keyword,error=error)
03644        CALL keyword_release(keyword,error=error)
03645     END IF
03646 
03647   END SUBROUTINE create_mulliken_section
03648 
03649 ! *****************************************************************************
03650   SUBROUTINE create_density_fitting_section(section,error)
03651     TYPE(section_type), POINTER              :: section
03652     TYPE(cp_error_type), INTENT(inout)       :: error
03653 
03654     CHARACTER(len=*), PARAMETER :: 
03655       routineN = 'create_density_fitting_section', 
03656       routineP = moduleN//':'//routineN
03657 
03658     LOGICAL                                  :: failure
03659     TYPE(keyword_type), POINTER              :: keyword
03660     TYPE(section_type), POINTER              :: print_key
03661 
03662     failure=.FALSE.
03663     NULLIFY(keyword, print_key)
03664     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03665     IF (.NOT. failure) THEN
03666        CALL section_create(section,"DENSITY_FITTING",&
03667             description="Setup parameters for density fitting (Bloechl charges or density derived "//&
03668             " atomic point charges (DDAPC) charges)",&
03669             n_keywords=7, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
03670             citations=(/Blochl1995/),&
03671             error=error)
03672 
03673        CALL keyword_create(keyword, name="NUM_GAUSS",&
03674             description="Specifies the numbers of gaussian used to fit the QM density for each atomic site.",&
03675             usage="NUM_GAUSS {integer}", required=.FALSE.,&
03676             n_var=1, type_of_var=integer_t, default_i_val=3, error=error)
03677        CALL section_add_keyword(section,keyword,error=error)
03678        CALL keyword_release(keyword,error=error)
03679 
03680        CALL keyword_create(keyword, name="PFACTOR",&
03681             description="Specifies the progression factor for the gaussian exponent for each atomic site.",&
03682             usage="PFACTOR {real}", required=.FALSE.,&
03683             n_var=1, type_of_var=real_t, default_r_val=1.5_dp,error=error)
03684        CALL section_add_keyword(section,keyword,error=error)
03685        CALL keyword_release(keyword,error=error)
03686 
03687        CALL keyword_create(keyword, name="MIN_RADIUS",&
03688             description="Specifies the smallest radius of the gaussian used in the fit. All other radius are"//&
03689             " obtained with the progression factor.",&
03690             usage="MIN_RADIUS {real}", required=.FALSE.,&
03691             unit_str="angstrom",n_var=1, type_of_var=real_t, default_r_val=0.5_dp, error=error)
03692        CALL section_add_keyword(section,keyword,error=error)
03693        CALL keyword_release(keyword,error=error)
03694 
03695        CALL keyword_create(keyword, name="RADII",&
03696             description="Specifies all the radius of the gaussian used in the fit for each atomic site. The use"//&
03697             " of this keyword disables all other keywords of this section.",&
03698             usage="RADII {real} {real} .. {real}", required=.FALSE.,&
03699             unit_str="angstrom",n_var=-1, type_of_var=real_t, error=error)
03700        CALL section_add_keyword(section,keyword,error=error)
03701        CALL keyword_release(keyword,error=error)
03702 
03703         CALL keyword_create(keyword, name="GCUT",&
03704             description="Cutoff for charge fit in G-space.",&
03705             usage="GCUT {real}", required=.FALSE.,&
03706             n_var=1, type_of_var=real_t, default_r_val=SQRT(6.0_dp),error=error)
03707        CALL section_add_keyword(section,keyword,error=error)
03708        CALL keyword_release(keyword,error=error)
03709 
03710        CALL cp_print_key_section_create(print_key,"program_run_info",&
03711             description="Controls the printing of basic information during the run", &
03712             print_level=high_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
03713             error=error)
03714 
03715        CALL keyword_create(keyword, name="CONDITION_NUMBER",&
03716             description="Prints information regarding the condition numbers of the A matrix (to be inverted)",&
03717             usage="ANALYTICAL_GTERM <LOGICAL>",&
03718             default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
03719        CALL section_add_keyword(print_key,keyword,error=error)
03720        CALL keyword_release(keyword,error=error)
03721 
03722        CALL section_add_subsection(section,print_key,error=error)
03723        CALL section_release(print_key,error=error)
03724 
03725     END IF
03726 
03727   END SUBROUTINE create_density_fitting_section
03728 
03729 ! *****************************************************************************
03730   SUBROUTINE create_ddapc_restraint_section(section,error)
03731     TYPE(section_type), POINTER              :: section
03732     TYPE(cp_error_type), INTENT(inout)       :: error
03733 
03734     CHARACTER(len=*), PARAMETER :: 
03735       routineN = 'create_ddapc_restraint_section', 
03736       routineP = moduleN//':'//routineN
03737 
03738     LOGICAL                                  :: failure
03739     TYPE(keyword_type), POINTER              :: keyword
03740     TYPE(section_type), POINTER              :: print_key
03741 
03742     failure=.FALSE.
03743     NULLIFY(keyword, print_key)
03744     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03745     IF (.NOT. failure) THEN
03746        CALL section_create(section,"DDAPC_RESTRAINT",&
03747             description="Use DDAPC charges in a restraint (check code for details)",&
03748             n_keywords=7, n_subsections=0, repeats=.TRUE., required=.TRUE.,&
03749             error=error)
03750 
03751        CALL keyword_create(keyword, name="TYPE_OF_DENSITY",&
03752             description="Specifies the type of density used for the fitting",&
03753             usage="TYPE_OF_DENSITY (FULL|SPIN)",&
03754             enum_c_vals=s2a("FULL","SPIN"),&
03755             enum_i_vals=(/ do_full_density, do_spin_density/),&
03756             enum_desc=s2a("Full density","Spin density"),&
03757             default_i_val=do_full_density, error=error)
03758        CALL section_add_keyword(section,keyword,error=error)
03759        CALL keyword_release(keyword,error=error)
03760 
03761        CALL keyword_create(keyword, name="STRENGTH",&
03762             description="force constant of the restraint",&
03763             usage="STRENGTH {real} ",default_r_val=0.1_dp, error=error)
03764        CALL section_add_keyword(section,keyword,error=error)
03765        CALL keyword_release(keyword,error=error)
03766 
03767        CALL keyword_create(keyword, name="TARGET",&
03768             description="target value of the restraint",&
03769             usage="TARGET {real} ",default_r_val=1._dp, error=error)
03770        CALL section_add_keyword(section,keyword,error=error)
03771        CALL keyword_release(keyword,error=error)
03772 
03773        CALL keyword_create(keyword, name="ATOMS",&
03774             description="Specifies the list of atoms that is summed in the restraint",&
03775             usage="ATOMS {integer} {integer} .. {integer}", required=.TRUE.,&
03776             n_var=-1, type_of_var=integer_t, error=error)
03777        CALL section_add_keyword(section,keyword,error=error)
03778        CALL keyword_release(keyword,error=error)
03779 
03780        CALL keyword_create(keyword,name="COEFF",&
03781             description="Defines the the coefficient of the atom in the atom list (default is one) ",&
03782             usage="COEFF 1.0 -1.0",&
03783             type_of_var=real_t, n_var=-1, error=error)
03784        CALL section_add_keyword(section,keyword,error=error)
03785        CALL keyword_release(keyword,error=error)
03786 
03787        CALL keyword_create(keyword, name="FUNCTIONAL_FORM",&
03788             description="Specifies the functional form of the term added",&
03789             usage="FUNCTIONAL_FORM RESTRAINT",&
03790             enum_c_vals=s2a("RESTRAINT","CONSTRAINT"),&
03791             enum_i_vals=(/ do_ddapc_restraint, do_ddapc_constraint/),&
03792             enum_desc=s2a("Harmonic potential: s*(q-t)**2","Constraint form: s*(q-t)"),&
03793             default_i_val=do_ddapc_restraint, error=error)
03794        CALL section_add_keyword(section,keyword,error=error)
03795        CALL keyword_release(keyword,error=error)
03796 
03797        CALL cp_print_key_section_create(print_key,"program_run_info",&
03798             description="Controls the printing basic info about the method", &
03799             print_level=low_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
03800             error=error)
03801        CALL section_add_subsection(section,print_key,error=error)
03802        CALL section_release(print_key,error=error)
03803 
03804     END IF
03805 
03806   END SUBROUTINE create_ddapc_restraint_section
03807 
03808 ! *****************************************************************************
03809   SUBROUTINE create_becke_restraint_section(section,error)
03810     TYPE(section_type), POINTER              :: section
03811     TYPE(cp_error_type), INTENT(inout)       :: error
03812 
03813     CHARACTER(len=*), PARAMETER :: 
03814       routineN = 'create_becke_restraint_section', 
03815       routineP = moduleN//':'//routineN
03816 
03817     LOGICAL                                  :: failure
03818     TYPE(keyword_type), POINTER              :: keyword
03819     TYPE(section_type), POINTER              :: print_key
03820 
03821     failure=.FALSE.
03822     NULLIFY(keyword, print_key)
03823     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03824     IF (.NOT. failure) THEN
03825        CALL section_create(section,"BECKE_RESTRAINT",&
03826             description="Use Becke weight population in a restraint/constraint ",&
03827             n_keywords=7, n_subsections=0, repeats=.FALSE., required=.TRUE.,&
03828             error=error)
03829 
03830        CALL keyword_create(keyword, name="STRENGTH",&
03831             description="force constant of the restraint",&
03832             usage="STRENGTH {real} ",default_r_val=0.1_dp, error=error)
03833        CALL section_add_keyword(section,keyword,error=error)
03834        CALL keyword_release(keyword,error=error)
03835 
03836        CALL keyword_create(keyword, name="TARGET",&
03837             description="target value of the restraint",&
03838             usage="TARGET {real} ",default_r_val=1._dp, error=error)
03839        CALL section_add_keyword(section,keyword,error=error)
03840        CALL keyword_release(keyword,error=error)
03841 
03842        CALL keyword_create(keyword, name="ATOMS",&
03843             description="Specifies the list of atoms that is summed in the restraint",&
03844             usage="ATOMS {integer} {integer} .. {integer}", required=.TRUE.,&
03845             n_var=-1, type_of_var=integer_t, error=error)
03846        CALL section_add_keyword(section,keyword,error=error)
03847        CALL keyword_release(keyword,error=error)
03848 
03849        CALL keyword_create(keyword,name="COEFF",&
03850             description="Defines the the coefficient of the atom in the atom list (default is one)",&
03851             usage="COEFF 1.0 -1.0",&
03852             type_of_var=real_t, n_var=-1, error=error)
03853        CALL section_add_keyword(section,keyword,error=error)
03854        CALL keyword_release(keyword,error=error)
03855 
03856        CALL keyword_create(keyword, name="FUNCTIONAL_FORM",&
03857             description="Specifies the functional form of the term added",&
03858             usage="FUNCTIONAL_FORM RESTRAINT",&
03859             enum_c_vals=s2a("RESTRAINT","CONSTRAINT"),&
03860             enum_i_vals=(/ do_ddapc_restraint, do_ddapc_constraint/),&
03861             enum_desc=s2a("Harmonic potential: s*(q-t)**2","Constraint form: s*(q-t)"),&
03862             default_i_val=do_ddapc_restraint, error=error)
03863        CALL section_add_keyword(section,keyword,error=error)
03864        CALL keyword_release(keyword,error=error)
03865 
03866        CALL keyword_create(keyword, name="TYPE_OF_DENSITY",&
03867             description="Specifies the type of density used for the fitting",&
03868             usage="TYPE_OF_DENSITY (FULL|SPIN)",&
03869             enum_c_vals=s2a("FULL","SPIN"),&
03870             enum_i_vals=(/ do_full_density, do_spin_density/),&
03871             enum_desc=s2a("Full density","Spin density"),&
03872             default_i_val=do_full_density, error=error)
03873        CALL section_add_keyword(section,keyword,error=error)
03874        CALL keyword_release(keyword,error=error)
03875 
03876        CALL cp_print_key_section_create(print_key,"program_run_info",&
03877             description="Controls the printing basic info about the method", &
03878             print_level=low_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
03879             error=error)
03880        CALL section_add_subsection(section,print_key,error=error)
03881        CALL section_release(print_key,error=error)
03882 
03883     END IF
03884 
03885   END SUBROUTINE create_becke_restraint_section
03886 
03887 ! *****************************************************************************
03888   SUBROUTINE create_s2_restraint_section(section,error)
03889     TYPE(section_type), POINTER              :: section
03890     TYPE(cp_error_type), INTENT(inout)       :: error
03891 
03892     CHARACTER(len=*), PARAMETER :: routineN = 'create_s2_restraint_section', 
03893       routineP = moduleN//':'//routineN
03894 
03895     LOGICAL                                  :: failure
03896     TYPE(keyword_type), POINTER              :: keyword
03897 
03898     failure=.FALSE.
03899     NULLIFY(keyword)
03900     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03901     IF (.NOT. failure) THEN
03902 
03903        CALL section_create(section,"S2_RESTRAINT",&
03904             description="Use S2 in a re/constraint (OT only)",&
03905             n_keywords=7, n_subsections=0, repeats=.FALSE., required=.TRUE.,&
03906             error=error)
03907 
03908        CALL keyword_create(keyword, name="STRENGTH",&
03909             description="force constant of the restraint",&
03910             usage="STRENGTH {real} ",default_r_val=0.1_dp, error=error)
03911        CALL section_add_keyword(section,keyword,error=error)
03912        CALL keyword_release(keyword,error=error)
03913 
03914        CALL keyword_create(keyword, name="TARGET",&
03915             description="target value of the restraint",&
03916             usage="TARGET {real} ",default_r_val=1._dp, error=error)
03917        CALL section_add_keyword(section,keyword,error=error)
03918        CALL keyword_release(keyword,error=error)
03919 
03920        CALL keyword_create(keyword, name="FUNCTIONAL_FORM",&
03921             description="Specifies the functional form of the term added",&
03922             usage="FUNCTIONAL_FORM RESTRAINT",&
03923             enum_c_vals=s2a("RESTRAINT","CONSTRAINT"),&
03924             enum_i_vals=(/ do_s2_restraint, do_s2_constraint/),&
03925             enum_desc=s2a("Harmonic potential: s*(q-t)**2","Constraint form: s*(q-t)"),&
03926             default_i_val=do_s2_restraint, error=error)
03927        CALL section_add_keyword(section,keyword,error=error)
03928        CALL keyword_release(keyword,error=error)
03929 
03930     END IF
03931 
03932   END SUBROUTINE create_s2_restraint_section
03933 
03934 ! *****************************************************************************
03941   SUBROUTINE create_tddfpt_section(section,error)
03942     TYPE(section_type), POINTER              :: section
03943     TYPE(cp_error_type), INTENT(inout)       :: error
03944 
03945     CHARACTER(len=*), PARAMETER :: routineN = 'create_tddfpt_section', 
03946       routineP = moduleN//':'//routineN
03947 
03948     LOGICAL                                  :: failure
03949     TYPE(keyword_type), POINTER              :: keyword
03950     TYPE(section_type), POINTER              :: subsection
03951 
03952     failure=.FALSE.
03953 
03954     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
03955     IF (.NOT. failure) THEN
03956        CALL section_create(section,"tddfpt",&
03957             description="parameters needed to set up the Time Dependent Density Functional PT",&
03958             n_keywords=5, n_subsections=1, repeats=.FALSE., required=.TRUE.,&
03959             citations=(/Iannuzzi2005/),error=error)
03960 
03961        NULLIFY(subsection,keyword)
03962 
03963        ! Integer
03964        CALL keyword_create(keyword, name="MAX_KV",&
03965             variants=s2a("MAX_VECTORS"),&
03966             description=" maximal number of Krylov space vectors",&
03967             usage="MAX_KV someInteger>0",&
03968             n_var=1,type_of_var=integer_t,&
03969             default_i_val=60, error=error)
03970        CALL section_add_keyword(section,keyword,error=error)
03971        CALL keyword_release(keyword,error=error)
03972 
03973        CALL keyword_create(keyword, name="RESTARTS",&
03974             variants=s2a("N_RESTARTS"),&
03975             description=" maximal number subspace search restarts",&
03976             usage="RESTARTS someInteger>0",&
03977             n_var=1,type_of_var=integer_t,&
03978             default_i_val=5, error=error)
03979        CALL section_add_keyword(section,keyword,error=error)
03980        CALL keyword_release(keyword,error=error)
03981 
03982        CALL keyword_create(keyword, name="NEV",&
03983             variants=s2a("N_EV", "EV"),&
03984             description=" number of excitations to calculate",&
03985             usage="NEV someInteger>0",&
03986             n_var=1,type_of_var=integer_t,&
03987             default_i_val=1, error=error)
03988        CALL section_add_keyword(section,keyword,error=error)
03989        CALL keyword_release(keyword,error=error)
03990 
03991        CALL keyword_create(keyword, name="NLUMO",&
03992             description=" number of additional unoccupied orbitals ",&
03993             usage="NLUMO 10",&
03994             n_var=1,type_of_var=integer_t,&
03995             default_i_val=5, error=error)
03996        CALL section_add_keyword(section,keyword,error=error)
03997        CALL keyword_release(keyword,error=error)
03998 
03999        CALL keyword_create(keyword, name="NREORTHO",&
04000             variants=s2a("N_REORTHO","REORTHO","REORTHOGONALITAZIONS"),&
04001             description=" number of reorthogonalization steps",&
04002             usage="NREORTHO someInteger>0",&
04003             n_var=1,type_of_var=integer_t,&
04004             default_i_val=2, error=error)
04005        CALL section_add_keyword(section,keyword,error=error)
04006        CALL keyword_release(keyword,error=error)
04007 
04008        ! Logical
04009        CALL keyword_create(keyword, name="KERNEL",&
04010             variants=s2a("DO_KERNEL"),&
04011             description="compute the kernel (debug purpose only)",&
04012             usage="KERNEL logical_value",&
04013             default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
04014        CALL section_add_keyword(section,keyword,error=error)
04015        CALL keyword_release(keyword,error=error)
04016 
04017        CALL keyword_create(keyword, name="LSD_SINGLETS",&
04018             description="compute singlets using lsd vxc kernel",&
04019             usage="LSD_SINGLETS logical_value",&
04020             default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
04021        CALL section_add_keyword(section,keyword,error=error)
04022        CALL keyword_release(keyword,error=error)
04023 
04024        CALL keyword_create(keyword, name="INVERT_S",&
04025             variants=s2a("INVERT_OVERLAP"),&
04026             description="use the inverse of the overlap matrix",&
04027             usage="INVERT_S logical_value",&
04028             default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
04029        CALL section_add_keyword(section,keyword,error=error)
04030        CALL keyword_release(keyword,error=error)
04031 
04032        CALL keyword_create(keyword, name="PRECONDITIONER",&
04033             variants=s2a("PRECOND"),&
04034             description="use the preconditioner (only for Davidson)",&
04035             usage="PRECONDITIONER logical_value",&
04036             default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
04037        CALL section_add_keyword(section,keyword,error=error)
04038        CALL keyword_release(keyword,error=error)
04039 
04040        ! Character
04041        CALL keyword_create(keyword, name="RES_ETYPE",&
04042             variants=s2a("RESTRICTED_EXCITATIONS_TYPE", "RES_E_TYPE"),&
04043             description="(singlets/triplets) for restricted calculation",&
04044             usage="RES_ETYPE T",&
04045             enum_c_vals=s2a("S","SINGLET","SINGLETS","T","TRIPLET","TRIPLETS"),&
04046             enum_i_vals=(/ tddfpt_singlet, tddfpt_singlet, tddfpt_singlet,&
04047             tddfpt_triplet, tddfpt_triplet, tddfpt_triplet/),&
04048             default_i_val=tddfpt_singlet, error=error)
04049        CALL section_add_keyword(section,keyword,error=error)
04050        CALL keyword_release(keyword,error=error)
04051 
04052        CALL keyword_create(keyword, name="DIAG_METHOD",&
04053             variants=s2a("DIAGONALIZATION_METHOD", "METHOD"),&
04054             description="Diagonalization method used in tddfpt",&
04055             usage="DIAG_METHOD DAVIDSON",&
04056             enum_c_vals=s2a("DAVIDSON","LANCZOS"),&
04057             enum_i_vals=(/ tddfpt_davidson, tddfpt_lanczos/),&
04058             default_i_val=tddfpt_davidson, error=error)
04059        CALL section_add_keyword(section,keyword,error=error)
04060        CALL keyword_release(keyword,error=error)
04061 
04062        CALL keyword_create(keyword, name="OE_CORR",&
04063             variants=s2a("ORBITAL_EIGENVALUES_CORRECTION"),&
04064             description="Which type of orbital eigenvalue correction to use\n"//&
04065             "(to yield better HOMO-LUMO energies)",&
04066             usage="OE_CORR SAOP",&
04067             enum_c_vals=s2a("NONE", "LB", "LB_ALPHA", "LB94", "GLLB", "GLB", "SAOP","SIC"),&
04068             enum_i_vals=(/ oe_none, oe_lb, oe_lb, oe_lb, oe_gllb, oe_gllb, oe_saop, oe_sic /),&
04069             default_i_val=oe_none, error=error)
04070        CALL section_add_keyword(section,keyword,error=error)
04071        CALL keyword_release(keyword,error=error)
04072 
04073        ! Real
04074        CALL keyword_create(keyword, name="CONVERGENCE",&
04075             variants=s2a("CONV"),&
04076             description="The convergence of the eigenvalues",&
04077             usage="CONVERGENCE 1.0E-6 ",&
04078             n_var=1,type_of_var=real_t,&
04079             default_r_val=1.0e-5_dp, error=error)
04080        CALL section_add_keyword(section,keyword,error=error)
04081        CALL keyword_release(keyword,error=error)
04082 
04083        CALL create_xc_section(subsection,error)
04084        CALL section_add_subsection(section, subsection, error=error)
04085        CALL section_release(subsection,error=error)
04086 
04087        CALL create_sic_section(subsection,error)
04088        CALL section_add_subsection(section, subsection, error=error)
04089        CALL section_release(subsection,error=error)
04090     END IF
04091 
04092   END SUBROUTINE create_tddfpt_section
04093 
04094 ! *****************************************************************************
04101   SUBROUTINE create_relativistic_section(section,error)
04102     TYPE(section_type), POINTER              :: section
04103     TYPE(cp_error_type), INTENT(inout)       :: error
04104 
04105     CHARACTER(len=*), PARAMETER :: routineN = 'create_relativistic_section', 
04106       routineP = moduleN//':'//routineN
04107 
04108     LOGICAL                                  :: failure
04109     TYPE(keyword_type), POINTER              :: keyword
04110 
04111     failure=.FALSE.
04112 
04113     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
04114     IF (.NOT. failure) THEN
04115        CALL section_create(section,"relativistic",&
04116             description="parameters needed and setup for relativistic calculations",&
04117             n_keywords=5, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
04118             error=error)
04119 
04120        NULLIFY(keyword)
04121 
04122        CALL keyword_create(keyword, name="method",&
04123             description="type of relativistic correction used",&
04124             usage="method DKH", default_i_val=rel_none,&
04125             enum_c_vals=s2a("NONE","DKH"),&
04126             enum_i_vals=(/ rel_none, rel_dkh /),error=error)
04127        CALL section_add_keyword(section,keyword,error=error)
04128        CALL keyword_release(keyword,error=error)
04129 
04130        CALL keyword_create(keyword, name="DKH_order",&
04131             description="The order of the DKH transformation ",&
04132             usage="DKH_order 2", default_i_val=2,error=error)
04133        CALL section_add_keyword(section,keyword,error=error)
04134        CALL keyword_release(keyword,error=error)
04135 
04136        CALL keyword_create(keyword, name="transformation",&
04137             description="type of DKH transformation, full: use full matrix transformation,"//&
04138              " molecule: use transformation blocked by molecule, atom: use atomic blocks ",&
04139             usage="transformation full", default_i_val=rel_trans_full,&
04140             enum_c_vals=s2a("FULL","MOLECULE","ATOM"), &
04141             enum_i_vals=(/ rel_trans_full, rel_trans_molecule, rel_trans_atom/),error=error)
04142        CALL section_add_keyword(section,keyword,error=error)
04143        CALL keyword_release(keyword,error=error)
04144 
04145        CALL keyword_create(keyword, name="z_cutoff",&
04146             description="The minimal atomic number considered for atom transformation",&
04147             usage="z_cutoff 50", default_i_val=1,error=error)
04148        CALL section_add_keyword(section,keyword,error=error)
04149        CALL keyword_release(keyword,error=error)
04150 
04151        CALL keyword_create(keyword, name="potential",&
04152             description="External potential used in DKH transformation, full 1/r or erfc(r)/r",&
04153             usage="POTENTIAL {FULL,ERFC}", default_i_val=rel_pot_erfc,&
04154             enum_c_vals=s2a("FULL","ERFC"),&
04155             enum_i_vals=(/ rel_pot_full, rel_pot_erfc /),error=error)
04156        CALL section_add_keyword(section,keyword,error=error)
04157        CALL keyword_release(keyword,error=error)
04158 
04159     END IF
04160   END SUBROUTINE create_relativistic_section
04161 
04162 ! *****************************************************************************
04169   SUBROUTINE create_scf_section(section,error)
04170     TYPE(section_type), POINTER              :: section
04171     TYPE(cp_error_type), INTENT(inout)       :: error
04172 
04173     CHARACTER(len=*), PARAMETER :: routineN = 'create_scf_section', 
04174       routineP = moduleN//':'//routineN
04175 
04176     LOGICAL                                  :: failure
04177     TYPE(keyword_type), POINTER              :: keyword
04178     TYPE(section_type), POINTER              :: print_key, subsection
04179 
04180     failure=.FALSE.
04181     NULLIFY(print_key)
04182 
04183     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
04184     IF (.NOT. failure) THEN
04185        CALL section_create(section,"scf",&
04186             description="parameters needed perform an scf run",&
04187             n_keywords=24, n_subsections=3, repeats=.FALSE., required=.FALSE.,&
04188             error=error)
04189 
04190        NULLIFY (subsection)
04191 
04192        CALL create_ot_section(subsection,error)
04193        CALL section_add_subsection(section,subsection,error=error)
04194        CALL section_release(subsection,error=error)
04195 
04196        CALL create_diagonalization_section(subsection,error)
04197        CALL section_add_subsection(section,subsection,error=error)
04198        CALL section_release(subsection,error=error)
04199 
04200        CALL create_outer_scf_section(subsection,error)
04201        CALL section_add_subsection(section,subsection,error=error)
04202        CALL section_release(subsection,error=error)
04203 
04204        CALL create_smear_section(subsection,error)
04205        CALL section_add_subsection(section,subsection,error=error)
04206        CALL section_release(subsection,error=error)
04207 
04208        CALL create_mixing_section(subsection,error)
04209        CALL section_add_subsection(section,subsection,error=error)
04210        CALL section_release(subsection,error=error)
04211 
04212        NULLIFY (keyword)
04213 
04214        CALL keyword_create(keyword, name="MAX_ITER_LUMO",&
04215             variants=(/"MAX_ITER_LUMOS"/),&
04216             description="The maximum number of iteration for the lumo computation",&
04217             usage="MAX_ITER_LUMO 100", default_i_val=299,error=error)
04218        CALL section_add_keyword(section,keyword,error=error)
04219        CALL keyword_release(keyword,error=error)
04220 
04221        CALL keyword_create(keyword, name="EPS_LUMO",&
04222             variants=(/"EPS_LUMOS"/),&
04223             description="target accuracy of the computation of the lumo energy",&
04224             usage="EPS_LUMO 1.e-6", default_r_val=1.0e-5_dp,error=error)
04225        CALL section_add_keyword(section,keyword,error=error)
04226        CALL keyword_release(keyword,error=error)
04227 
04228        CALL keyword_create(keyword, name="MAX_SCF",&
04229             description="Maximum number of SCF iteration to be performed for one optimization",&
04230             usage="MAX_SCF 200", default_i_val=50,error=error)
04231        CALL section_add_keyword(section,keyword,error=error)
04232        CALL keyword_release(keyword,error=error)
04233 
04234        CALL keyword_create(keyword, name="MAX_SCF_HISTORY", variants=(/"MAX_SCF_HIST"/), &
04235             description="Maximum number of SCF iterations after the history pipeline is filled", &
04236             usage="MAX_SCF_HISTORY 1", required=.FALSE., default_i_val=0,lone_keyword_i_val=1, &
04237             error=error)
04238        CALL section_add_keyword(section, keyword, error=error)
04239        CALL keyword_release(keyword, error=error)
04240 
04241        CALL keyword_create(keyword, name="MAX_DIIS",&
04242             variants=(/"MAX_DIIS_BUFFER_SIZE"/),&
04243             description="Maximum number of DIIS vectors to be used",&
04244             usage="MAX_DIIS 3", default_i_val=4,error=error)
04245        CALL section_add_keyword(section,keyword,error=error)
04246        CALL keyword_release(keyword,error=error)
04247 
04248        CALL keyword_create(keyword, name="LEVEL_SHIFT",&
04249             variants=(/"LSHIFT"/),&
04250             description="Use level shifting to improve convergence",&
04251             usage="LEVEL_SHIFT 0.1", default_r_val=0._dp,error=error)
04252        CALL section_add_keyword(section,keyword,error=error)
04253        CALL keyword_release(keyword,error=error)
04254 
04255        CALL keyword_create(keyword, name="EPS_SCF",&
04256             description="target accuracy for the scf convergence",&
04257             usage="EPS_SCF 1.e-6", default_r_val=1.e-5_dp,error=error)
04258        CALL section_add_keyword(section,keyword,error=error)
04259        CALL keyword_release(keyword,error=error)
04260 
04261        CALL keyword_create(keyword, name="EPS_SCF_HISTORY", variants=(/"EPS_SCF_HIST"/), &
04262             description="target accuracy for the scf convergence after the history pipeline is filled",&
04263             usage="EPS_SCF_HISTORY 1.e-5", default_r_val=0.0_dp,lone_keyword_r_val=1.0e-5_dp,&
04264             error=error)
04265        CALL section_add_keyword(section,keyword,error=error)
04266        CALL keyword_release(keyword,error=error)
04267 
04268        CALL keyword_create(keyword, name="CHOLESKY",&
04269             description="If the cholesky method should be used for computing "//&
04270             "the inverse of S, and in this case calling which Lapack routines",&
04271             usage="CHOLESKY REDUCE", default_i_val=cholesky_reduce,&
04272             enum_c_vals=s2a("OFF","REDUCE","RESTORE","INVERSE"),&
04273             enum_desc=s2a("The cholesky algorithm is not used","Reduce is called",&
04274             "Reduce is replaced by two restore",&
04275             "Restore uses operator multiply by inverse of the triangular matrix"),&
04276             enum_i_vals=(/cholesky_off,cholesky_reduce,cholesky_restore,cholesky_inverse/),&
04277             error=error)
04278        CALL section_add_keyword(section,keyword,error=error)
04279        CALL keyword_release(keyword,error=error)
04280 
04281        CALL keyword_create(keyword, name="EPS_EIGVAL",&
04282             description="Throw away linear combinations of basis functions with a small eigenvalue in S",&
04283             usage="EPS_EIGVAL 1.0", default_r_val=1.0e-5_dp,error=error)
04284        CALL section_add_keyword(section,keyword,error=error)
04285        CALL keyword_release(keyword,error=error)
04286 
04287        CALL keyword_create(keyword, name="EPS_DIIS",&
04288             description="Threshold on the convergence to start using DIAG/DIIS",&
04289             usage="EPS_DIIS 5.0e-2", default_r_val=0.1_dp,error=error)
04290        CALL section_add_keyword(section,keyword,error=error)
04291        CALL keyword_release(keyword,error=error)
04292 
04293        CALL keyword_create(keyword, name="SCF_GUESS",&
04294             description="Change the initial guess for the wavefunction.",&
04295             usage="SCF_GUESS RESTART", default_i_val=atomic_guess,&
04296             enum_c_vals=s2a("ATOMIC","RESTART","RANDOM","CORE","DENSITIES",&
04297             "HISTORY_RESTART","MOPAC","SPARSE","NONE"),&
04298             enum_desc=s2a("Generate an atomic density using the atomic code", &
04299             "Use the RESTART file as an initial guess (and ATOMIC if not present).", &
04300             "Use random wavefunction coefficients.", &
04301             "Diagonalize the core hamiltonian for an initial guess.", &
04302             "Use the aux_basis_set for collocation.", &
04303             "Extrapolated from previous RESTART files.", &
04304             "Use same guess as MOPAC for semi-empirical methods or a simple diagonal density matrix for other methods", &
04305             "Generate a sparse wavefunction using the atomic code (for OT based methods)", &
04306             "Skip initial guess (only for NON-SCC DFTB)."), &
04307             enum_i_vals=(/atomic_guess,restart_guess,random_guess,core_guess,&
04308             densities_guess,history_guess,mopac_guess,sparse_guess,no_guess/),&
04309             error=error)
04310        CALL section_add_keyword(section,keyword,error=error)
04311        CALL keyword_release(keyword,error=error)
04312 
04313        CALL keyword_create(keyword, name="NROW_BLOCK",&
04314             description="sets the number of rows in a scalapack block",&
04315             usage="NROW_BLOCK 31", default_i_val=32,error=error)
04316        CALL section_add_keyword(section,keyword,error=error)
04317        CALL keyword_release(keyword,error=error)
04318 
04319        CALL keyword_create(keyword, name="NCOL_BLOCK",&
04320             description="Sets the number of columns in a scalapack block",&
04321             usage="NCOL_BLOCK 31", default_i_val=32,error=error)
04322        CALL section_add_keyword(section,keyword,error=error)
04323        CALL keyword_release(keyword,error=error)
04324 
04325        CALL keyword_create(keyword, name="ADDED_MOS",&
04326             description="Number of additional MOS added for each spin",&
04327             usage="ADDED_MOS", default_i_val=0,n_var=-1,error=error)
04328        CALL section_add_keyword(section,keyword,error=error)
04329        CALL keyword_release(keyword,error=error)
04330 
04331        CALL keyword_create(keyword=keyword,&
04332             name="ROKS_SCHEME",&
04333             description="Selects the ROKS scheme when ROKS is applied.",&
04334             usage="ROKS_SCHEME HIGH-SPIN",&
04335             repeats=.FALSE.,&
04336             required=.FALSE.,&
04337             n_var=1,&
04338             enum_c_vals=s2a("GENERAL","HIGH-SPIN"),&
04339             enum_i_vals=(/general_roks,high_spin_roks/),&
04340             default_i_val=high_spin_roks,&
04341             error=error)
04342        CALL section_add_keyword(section,keyword,error=error)
04343        CALL keyword_release(keyword,error=error)
04344 
04345        CALL keyword_create(keyword=keyword,&
04346             name="ROKS_F",&
04347             variants=(/"F_ROKS"/),&
04348             description="Allows to define the parameter f for the "//&
04349             "general ROKS scheme.",&
04350             usage="ROKS_PARAMETER 1/2",&
04351             repeats=.FALSE.,&
04352             required=.FALSE.,&
04353             n_var=1,&
04354             type_of_var=real_t,&
04355             default_r_val=0.5_dp,&
04356             error=error)
04357        CALL section_add_keyword(section,keyword,error=error)
04358        CALL keyword_release(keyword,error=error)
04359 
04360        CALL keyword_create(keyword=keyword,&
04361             name="ROKS_PARAMETERS",&
04362             variants=(/"ROKS_PARAMETER"/),&
04363             description="Allows to define all parameters for the high-spin "//&
04364             "ROKS scheme explicitly. "//&
04365             "The full set of 6 parameters has to be specified "//&
04366             "in the order acc, bcc, aoo, boo, avv, bvv",&
04367             usage="ROKS_PARAMETERS 1/2 1/2 1/2 1/2 1/2 1/2",&
04368             repeats=.FALSE.,&
04369             required=.FALSE.,&
04370             n_var=6,&
04371             type_of_var=real_t,&
04372             default_r_vals=(/-0.5_dp,1.5_dp,0.5_dp,0.5_dp,1.5_dp,-0.5_dp/),&
04373             error=error)
04374        CALL section_add_keyword(section,keyword,error=error)
04375        CALL keyword_release(keyword,error=error)
04376 
04377        CALL section_create(subsection,"PRINT","printing of information during the scf",&
04378             error=error, repeats=.FALSE., required=.FALSE.)
04379 
04380         CALL cp_print_key_section_create(print_key,"RESTART",&
04381             description="Controls the dumping of the MO restart file during scf."//&
04382                         "By default keeps a short history of three restarts."//&
04383                         "See also RESTART_HISTORY", &
04384             print_level=low_print_level, common_iter_levels=3,&
04385             each_iter_names=s2a("QS_SCF"),each_iter_values=(/20/), &
04386             add_last=add_last_numeric,filename="RESTART",error=error)
04387        CALL keyword_create(keyword, name="BACKUP_COPIES",&
04388              description="Specifies the maximum index of backup copies.",&
04389              usage="BACKUP_COPIES {int}",&
04390              default_i_val=3, error=error)
04391        CALL section_add_keyword(print_key,keyword,error=error)
04392        CALL keyword_release(keyword,error=error)
04393        CALL section_add_subsection(subsection,print_key,error=error)
04394        CALL section_release(print_key,error=error)
04395 
04396        CALL cp_print_key_section_create(print_key,"RESTART_HISTORY",&
04397             description="Dumps unique MO restart files during the run keeping all of them.",&
04398             print_level=low_print_level, common_iter_levels=0,&
04399             each_iter_names=s2a("__ROOT__","MD","GEO_OPT","ROT_OPT","NEB","METADYNAMICS","QS_SCF"),&
04400             each_iter_values=(/500,500,500,500,500,500,500/), &
04401             filename="RESTART",error=error)
04402        CALL keyword_create(keyword, name="BACKUP_COPIES",&
04403              description="Specifies the maximum index of backup copies.",&
04404              usage="BACKUP_COPIES {int}",&
04405              default_i_val=3, error=error)
04406        CALL section_add_keyword(print_key,keyword,error=error)
04407        CALL keyword_release(keyword,error=error)
04408        CALL section_add_subsection(subsection,print_key,error=error)
04409        CALL section_release(print_key,error=error)
04410 
04411        CALL cp_print_key_section_create(print_key,"iteration_info",&
04412             description="Controls the printing of basic iteration information during the scf.", &
04413             print_level=low_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
04414             error=error)
04415        CALL keyword_create(keyword, name="time_cumul",&
04416             description="If the printkey is activated switches the printing of timings"//&
04417             " to cumulative (over the scf).",&
04418             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
04419        CALL section_add_keyword(print_key,keyword,error=error)
04420        CALL keyword_release(keyword,error=error)
04421        CALL section_add_subsection(subsection,print_key,error=error)
04422        CALL section_release(print_key,error=error)
04423 
04424        CALL cp_print_key_section_create(print_key,"program_run_info",&
04425             description="Controls the printing of basic information during the SCF", &
04426             print_level=low_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
04427             error=error)
04428        CALL section_add_subsection(subsection,print_key,error=error)
04429        CALL section_release(print_key,error=error)
04430 
04431        CALL cp_print_key_section_create(print_key,"MO_ORTHONORMALITY",&
04432             description="Controls the printing relative to the orthonormality of MOs (CT S C).", &
04433             print_level=high_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
04434             error=error)
04435        CALL section_add_subsection(subsection,print_key,error=error)
04436        CALL section_release(print_key,error=error)
04437 
04438        CALL cp_print_key_section_create(print_key,"MO_MAGNITUDE",&
04439             description="Prints the min/max eigenvalues of the overlap of the MOs without S (CT C).", &
04440             print_level=high_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
04441             error=error)
04442        CALL section_add_subsection(subsection,print_key,error=error)
04443        CALL section_release(print_key,error=error)
04444 
04445        CALL cp_print_key_section_create(print_key,"detailed_energy",&
04446             description="Controls the printing of detailed energy information.", &
04447             print_level=high_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
04448             error=error)
04449        CALL section_add_subsection(subsection,print_key,error=error)
04450        CALL section_release(print_key,error=error)
04451 
04452        CALL cp_print_key_section_create(print_key,"diis_info",&
04453             description="Controls the printing of diis information.", &
04454             print_level=high_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
04455             error=error)
04456        CALL section_add_subsection(subsection,print_key,error=error)
04457        CALL section_release(print_key,error=error)
04458 
04459        CALL cp_print_key_section_create(print_key,"total_densities",&
04460             description="Controls the printing of total densities.", &
04461             print_level=medium_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
04462             error=error)
04463        CALL section_add_subsection(subsection,print_key,error=error)
04464        CALL section_release(print_key,error=error)
04465 
04466        CALL cp_print_key_section_create(print_key,"Lanczos",&
04467             description="Controls the printing of information on Lanczos refinement iterations.", &
04468             print_level=medium_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
04469             error=error)
04470        CALL section_add_subsection(subsection,print_key,error=error)
04471        CALL section_release(print_key,error=error)
04472 
04473        CALL cp_print_key_section_create(print_key,"DIAG_SUB_SCF",&
04474             description="Controls the printing of information on subspace diagonalization internal loop. ", &
04475             print_level=medium_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
04476             error=error)
04477        CALL section_add_subsection(subsection,print_key,error=error)
04478        CALL section_release(print_key,error=error)
04479 
04480        CALL cp_print_key_section_create(print_key,"Davidson",&
04481             description="Controls the printing of information on Davidson iterations.", &
04482             print_level=medium_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
04483             error=error)
04484        CALL section_add_subsection(subsection,print_key,error=error)
04485        CALL section_release(print_key,error=error)
04486 
04487        CALL section_add_subsection(section,subsection,error=error)
04488        CALL section_release(subsection,error=error)
04489 
04490     END IF
04491   END SUBROUTINE create_scf_section
04492 
04493 ! *****************************************************************************
04497   SUBROUTINE create_kg_section(section,error)
04498     TYPE(section_type), POINTER              :: section
04499     TYPE(cp_error_type), INTENT(inout)       :: error
04500 
04501     CHARACTER(len=*), PARAMETER :: routineN = 'create_kg_section', 
04502       routineP = moduleN//':'//routineN
04503 
04504     LOGICAL                                  :: failure
04505     TYPE(keyword_type), POINTER              :: keyword
04506     TYPE(section_type), POINTER              :: print_key, subsection
04507 
04508     failure=.FALSE.
04509 
04510     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
04511     IF (.NOT. failure) THEN
04512        CALL section_create(section,"KG_METHOD",&
04513             description="Specifies the parameters for a Kim-Gordon-like partitioning"//&
04514                         " into molecular subunits",&
04515             n_keywords=0, n_subsections=1, repeats=.FALSE., required=.FALSE.,&
04516             citations=(/Iannuzzi2006, Brelaz1979/),error=error)
04517       
04518        NULLIFY (keyword, subsection, print_key)
04519 
04520        CALL keyword_create(keyword, name="COLORING_METHOD",&
04521             description="Which algorithm to use for coloring.",&
04522             usage="COLORING_METHOD GREEDY",&
04523             default_i_val=kg_color_dsatur,&
04524             enum_c_vals=s2a( "DSATUR", "GREEDY"),&
04525             enum_desc=s2a("Maximum degree of saturation, relatively accurate",&
04526                           "Greedy, fast coloring, less accurate"),&
04527             enum_i_vals=(/kg_color_dsatur, kg_color_greedy /),&
04528             error=error)
04529        CALL section_add_keyword(section,keyword,error=error)
04530        CALL keyword_release(keyword,error=error)
04531 
04532        CALL section_create(subsection, name="PRINT",&
04533             description="Print section",&
04534             n_keywords=0, n_subsections=1, repeats=.FALSE., required=.FALSE.,&
04535             error=error)
04536 
04537        CALL cp_print_key_section_create(print_key,"NEIGHBOR_LISTS",&
04538             description="Controls the printing of the neighbor lists.", &
04539             print_level=low_print_level, filename="__STD_OUT__", unit_str="angstrom",&
04540             error=error)
04541 
04542        CALL keyword_create(keyword=keyword,&
04543             name="SAB_ORB_FULL",&
04544             description="Activates the printing of the full orbital "//&
04545             "orbital neighbor lists.", &
04546             default_l_val=.FALSE.,&
04547             lone_keyword_l_val=.TRUE.,&
04548             error=error)
04549        CALL section_add_keyword(print_key,keyword,error=error)
04550        CALL keyword_release(keyword,error=error)
04551 
04552        CALL keyword_create(keyword=keyword,&
04553             name="SAB_ORB_MOLECULAR",&
04554             description="Activates the printing of the orbital "//&
04555             "orbital neighbor lists for molecular subsets.",&
04556             default_l_val=.FALSE.,&
04557             lone_keyword_l_val=.TRUE.,&
04558             error=error)
04559        CALL section_add_keyword(print_key,keyword,error=error)
04560        CALL keyword_release(keyword,error=error)
04561 
04562        CALL section_add_subsection(subsection, print_key, error=error)
04563        CALL section_release(print_key, error=error)
04564 
04565        CALL section_add_subsection(section, subsection, error=error)
04566        CALL section_release(subsection, error=error)
04567 
04568     END IF
04569 
04570   END SUBROUTINE create_kg_section
04571 
04572 ! *****************************************************************************
04580   SUBROUTINE create_outer_scf_section(section,error)
04581     TYPE(section_type), POINTER              :: section
04582     TYPE(cp_error_type), INTENT(inout)       :: error
04583 
04584     CHARACTER(len=*), PARAMETER :: routineN = 'create_outer_scf_section', 
04585       routineP = moduleN//':'//routineN
04586 
04587     LOGICAL                                  :: failure
04588     TYPE(keyword_type), POINTER              :: keyword
04589 
04590     failure=.FALSE.
04591     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
04592     IF (.NOT. failure) THEN
04593        CALL section_create(section,"OUTER_SCF",&
04594             description="parameters controlling the outer SCF loop",&
04595             n_keywords=9, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
04596             error=error)
04597 
04598        NULLIFY(keyword)
04599 
04600        CALL keyword_create(keyword, name="_SECTION_PARAMETERS_",&
04601             description="controls the activation of the outer SCF loop",&
04602             usage="&OUTER_SCF ON",default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,&
04603             error=error)
04604        CALL section_add_keyword(section,keyword,error=error)
04605        CALL keyword_release(keyword,error=error)
04606 
04607        CALL keyword_create(keyword, name="TYPE",&
04608             description="Specifies which kind of outer SCF should be employed",&
04609             usage="TYPE DDAPC_CONSTRAINT ",&
04610             default_i_val=outer_scf_none,&
04611             enum_c_vals=s2a( "DDAPC_CONSTRAINT", "S2_CONSTRAINT", "BECKE_CONSTRAINT",&
04612              "SCP", "NONE" ),&
04613             enum_desc=s2a("Enforce a constraint on the DDAPC, requires the corresponding section", &
04614             "Enforce a constraint on the S2, requires the corresponding section", &
04615             "Enforce a constraint on the Becke weight population,requires the corresponding section", &
04616             "Enforce outer loop optimization for SCP, requires the corresponding metod (-DFT or -NDDO)", &
04617             "Do nothing in the outer loop, useful for resetting the inner loop,"),&
04618             enum_i_vals=(/outer_scf_ddapc_constraint,outer_scf_s2_constraint,&
04619             outer_scf_becke_constraint,outer_scf_scp,outer_scf_none/),&
04620             error=error)
04621        CALL section_add_keyword(section,keyword,error=error)
04622        CALL keyword_release(keyword,error=error)
04623 
04624        CALL keyword_create(keyword, name="OPTIMIZER",&
04625             description="Method used to bring the outer loop to a stationary point",&
04626             usage="OPTIMIZER SD",&
04627             default_i_val=outer_scf_optimizer_none,&
04628             enum_c_vals=s2a("SD","DIIS","NONE","BISECT"),&
04629             enum_desc=s2a("Takes steps in the direction of the gradient, multiplied by step_size", &
04630             "Uses a Direct Inversion in the Iterative Subspace method", &
04631             "Do nothing, useful only with the none type",&
04632             "Bisection on the gradient, useful for difficult one dimensional cases"),&
04633             enum_i_vals=(/outer_scf_optimizer_sd,outer_scf_optimizer_diis,outer_scf_optimizer_none,outer_scf_optimizer_bisect/),&
04634             error=error)
04635        CALL section_add_keyword(section,keyword,error=error)
04636        CALL keyword_release(keyword,error=error)
04637 
04638        CALL keyword_create(keyword, name="BISECT_TRUST_COUNT",&
04639             description="Maximum number of times the same point will be used in bisection,"//&
04640                         " a small number guards against the effect of wrongly converged states.", &
04641             usage="BISECT_TRUST_COUNT 5", default_i_val=10,error=error)
04642        CALL section_add_keyword(section,keyword,error=error)
04643        CALL keyword_release(keyword,error=error)
04644 
04645        CALL keyword_create(keyword, name="EPS_SCF",&
04646             description="The target gradient of the outer scf variables. "//&
04647             "Notice that the EPS_SCF of the inner loop also determines "//&
04648             "the value that can be reached in the outer loop, "//&
04649             "typically EPS_SCF of the outer loop must be smaller "//&
04650             "than EPS_SCF of the inner loop.", &
04651             usage="EPS_SCF 1.0E-6 ", default_r_val=1.0E-5_dp,error=error)
04652        CALL section_add_keyword(section,keyword,error=error)
04653        CALL keyword_release(keyword,error=error)
04654 
04655        CALL keyword_create(keyword, name="DIIS_BUFFER_LENGTH",&
04656             description="Maximum number of DIIS vectors used ", &
04657             usage="DIIS_BUFFER_LENGTH 5", default_i_val=3,error=error)
04658        CALL section_add_keyword(section,keyword,error=error)
04659        CALL keyword_release(keyword,error=error)
04660 
04661        CALL keyword_create(keyword, name="EXTRAPOLATION_ORDER",&
04662             description="Number of past states used in the extrapolation of the variables during e.g. MD", &
04663             usage="EXTRAPOLATION_ORDER 5", default_i_val=3,error=error)
04664        CALL section_add_keyword(section,keyword,error=error)
04665        CALL keyword_release(keyword,error=error)
04666 
04667        CALL keyword_create(keyword, name="MAX_SCF",&
04668             description="The maximum number of outer loops ", &
04669             usage="MAX_SCF 20", default_i_val=50,error=error)
04670        CALL section_add_keyword(section,keyword,error=error)
04671        CALL keyword_release(keyword,error=error)
04672 
04673        CALL keyword_create(keyword, name="STEP_SIZE",&
04674             description="The initial step_size used in the optimizer (currently steepest descent)."//&
04675             "Note that in cases where a sadle point is sought for (DDAPC_CONSTRAINT),"//&
04676             " this can be negative", &
04677             usage="STEP_SIZE -1.0", default_r_val=0.5_dp,error=error)
04678        CALL section_add_keyword(section,keyword,error=error)
04679        CALL keyword_release(keyword,error=error)
04680 
04681     END IF
04682 
04683   END SUBROUTINE create_outer_scf_section
04684 
04685 
04686 ! *****************************************************************************
04693   SUBROUTINE create_bsse_section(section,error)
04694     TYPE(section_type), POINTER              :: section
04695     TYPE(cp_error_type), INTENT(inout)       :: error
04696 
04697     CHARACTER(len=*), PARAMETER :: routineN = 'create_bsse_section', 
04698       routineP = moduleN//':'//routineN
04699 
04700     LOGICAL                                  :: failure
04701     TYPE(keyword_type), POINTER              :: keyword
04702     TYPE(section_type), POINTER              :: subsection
04703 
04704     failure=.FALSE.
04705 
04706     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
04707     IF (.NOT. failure) THEN
04708        CALL section_create(section,name="BSSE",&
04709             description="This section is used to set up the BSSE calculation. "//&
04710             "It also requires that for each atomic kind X a kind X_ghost is present, "//&
04711             "with the GHOST keyword specified, in addition to the other required fields.",&
04712             n_keywords=3, n_subsections=1, repeats=.FALSE., required=.TRUE.,&
04713             error=error)
04714 
04715        NULLIFY(keyword, subsection)
04716        ! FRAGMENT SECTION
04717        CALL section_create(subsection,name="FRAGMENT",&
04718             description="Specify the atom number belonging to this fragment.",&
04719             n_keywords=2, n_subsections=0, repeats=.TRUE., required=.TRUE.,&
04720             error=error)
04721 
04722        CALL keyword_create(keyword, name="LIST",&
04723             description="Specifies a list of atoms.",&
04724             usage="LIST {integer} {integer} .. {integer}", required=.FALSE.,&
04725             n_var=-1, type_of_var=integer_t, error=error)
04726        CALL section_add_keyword(subsection,keyword,error=error)
04727        CALL keyword_release(keyword,error=error)
04728 
04729        CALL section_add_subsection(section, subsection, error=error)
04730        CALL section_release(subsection,error=error)
04731 
04732        ! CONFIGURATION SECTION
04733        CALL section_create(subsection,name="CONFIGURATION",&
04734             description="Specify additional parameters for the combinatorial configurations.",&
04735             n_keywords=2, n_subsections=0, repeats=.TRUE., required=.TRUE.,&
04736             error=error)
04737 
04738        CALL keyword_create(keyword, name="GLB_CONF",&
04739             description="Specifies the global configuration using 1 or 0.",&
04740             usage="GLB_CONF {integer} {integer} .. {integer}", required=.TRUE.,&
04741             n_var=-1, type_of_var=integer_t, error=error)
04742        CALL section_add_keyword(subsection,keyword,error=error)
04743        CALL keyword_release(keyword,error=error)
04744 
04745        CALL keyword_create(keyword, name="SUB_CONF",&
04746             description="Specifies the subconfiguration using 1 or 0 belonging to the global configuration.",&
04747             usage="SUB_CONF {integer} {integer} .. {integer}", required=.TRUE.,&
04748             n_var=-1, type_of_var=integer_t, error=error)
04749        CALL section_add_keyword(subsection,keyword,error=error)
04750        CALL keyword_release(keyword,error=error)
04751 
04752        CALL keyword_create(keyword=keyword,&
04753             name="MULTIPLICITY",&
04754             variants=(/"MULTIP"/),&
04755             description="Specify for each fragment the multiplicity. Two times the total spin plus one. "//&
04756             "Specify 3 for a triplet, 4 for a quartet,and so on. Default is 1 (singlet) for an "//&
04757             "even number and 2 (doublet) for an odd number of electrons.",&
04758             usage="MULTIPLICITY 3",&
04759             default_i_val=0,& ! this default value is just a flag to get the above
04760             error=error)
04761        CALL section_add_keyword(subsection,keyword,error=error)
04762        CALL keyword_release(keyword,error=error)
04763 
04764        CALL keyword_create(keyword, name="CHARGE",&
04765             description="The total charge for each fragment.",&
04766             usage="CHARGE -1",&
04767             default_i_val=0,error=error)
04768        CALL section_add_keyword(subsection,keyword,error=error)
04769        CALL keyword_release(keyword,error=error)
04770        CALL section_add_subsection(section, subsection, error=error)
04771        CALL section_release(subsection,error=error)
04772 
04773        CALL section_create(subsection,name="FRAGMENT_ENERGIES",&
04774             description="This section contains the energies of the fragments already"//&
04775             " computed. It is useful as a summary and specifically for restarting BSSE runs.",&
04776             n_keywords=2, n_subsections=0, repeats=.TRUE., required=.TRUE.,&
04777             error=error)
04778        CALL keyword_create(keyword, name="_DEFAULT_KEYWORD_",&
04779             description="The energy computed for each fragment",repeats=.TRUE.,&
04780             usage="<REAL>", type_of_var=real_t, error=error)
04781        CALL section_add_keyword(subsection,keyword,error=error)
04782        CALL keyword_release(keyword,error=error)
04783        CALL section_add_subsection(section, subsection, error=error)
04784        CALL section_release(subsection,error=error)
04785 
04786        CALL create_print_bsse_section(subsection,error)
04787        CALL section_add_subsection(section, subsection, error=error)
04788        CALL section_release(subsection,error=error)
04789 
04790     END IF
04791 
04792   END SUBROUTINE create_bsse_section
04793 
04794 ! *****************************************************************************
04801   SUBROUTINE create_print_bsse_section(section,error)
04802     TYPE(section_type), POINTER              :: section
04803     TYPE(cp_error_type), INTENT(inout)       :: error
04804 
04805     CHARACTER(len=*), PARAMETER :: routineN = 'create_print_bsse_section', 
04806       routineP = moduleN//':'//routineN
04807 
04808     LOGICAL                                  :: failure
04809     TYPE(section_type), POINTER              :: print_key
04810 
04811     failure=.FALSE.
04812 
04813     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
04814     IF (.NOT. failure) THEN
04815        CALL section_create(section,name="print",&
04816             description="Section of possible print options in BSSE code.",&
04817             n_keywords=0, n_subsections=1, repeats=.FALSE., required=.TRUE.,&
04818             error=error)
04819 
04820        NULLIFY(print_key)
04821        CALL cp_print_key_section_create(print_key,"PROGRAM_RUN_INFO",&
04822             description="Controls the printing of information regarding the run.",&
04823             print_level=low_print_level,filename="__STD_OUT__",&
04824             error=error)
04825        CALL section_add_subsection(section,print_key,error=error)
04826        CALL section_release(print_key,error=error)
04827 
04828        CALL cp_print_key_section_create(print_key,"RESTART",&
04829             description="Controls the dumping of the restart file during BSSE runs."//&
04830             "By default the restart is updated after each configuration calculation is "//&
04831             " completed.", &
04832             print_level=silent_print_level, common_iter_levels=0,  &
04833             add_last=add_last_numeric,filename="",error=error)
04834        CALL section_add_subsection(section,print_key,error=error)
04835        CALL section_release(print_key,error=error)
04836 
04837     END IF
04838   END SUBROUTINE create_print_bsse_section
04839 
04840 ! *****************************************************************************
04846   SUBROUTINE create_gspace_interp_section(section,error)
04847     TYPE(section_type), POINTER              :: section
04848     TYPE(cp_error_type), INTENT(inout)       :: error
04849 
04850     CHARACTER(len=*), PARAMETER :: routineN = 'create_gspace_interp_section', 
04851       routineP = moduleN//':'//routineN
04852 
04853     LOGICAL                                  :: failure
04854     TYPE(keyword_type), POINTER              :: keyword
04855     TYPE(section_type), POINTER              :: print_key
04856 
04857     failure=.FALSE.
04858 
04859     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
04860     IF (.NOT. failure) THEN
04861        CALL section_create(section,name="interpolator",&
04862             description="controls the interpolation for the G-space term",&
04863             n_keywords=5, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
04864             error=error)
04865 
04866        NULLIFY(keyword, print_key)
04867 
04868        CALL keyword_create(keyword, name="aint_precond",&
04869             description="the approximate inverse to use to get the starting point"//&
04870             " for the linear solver of the spline3 methods",&
04871             usage="kind spline3",&
04872             default_i_val=precond_spl3_aint,&
04873             enum_c_vals=s2a( "copy","spl3_nopbc_aint1","spl3_nopbc_precond1",&
04874             "spl3_nopbc_aint2","spl3_nopbc_precond2","spl3_nopbc_precond3"),&
04875             enum_i_vals=(/no_precond,precond_spl3_aint, precond_spl3_1,&
04876             precond_spl3_aint2, precond_spl3_2, precond_spl3_3/),&
04877             error=error)
04878        CALL section_add_keyword(section,keyword,error=error)
04879        CALL keyword_release(keyword,error=error)
04880 
04881        CALL keyword_create(keyword, name="precond",&
04882             description="The preconditioner used"//&
04883             " for the linear solver of the spline3 methods",&
04884             usage="kind spline3",&
04885             default_i_val=precond_spl3_3,&
04886             enum_c_vals=s2a("copy","spl3_nopbc_aint1","spl3_nopbc_precond1",&
04887             "spl3_nopbc_aint2","spl3_nopbc_precond2","spl3_nopbc_precond3"),&
04888             enum_i_vals=(/no_precond,precond_spl3_aint, precond_spl3_1,&
04889             precond_spl3_aint2, precond_spl3_2, precond_spl3_3/),&
04890             error=error)
04891        CALL section_add_keyword(section,keyword,error=error)
04892        CALL keyword_release(keyword,error=error)
04893 
04894        CALL keyword_create(keyword, name="eps_x",&
04895             description="accuracy on the solution for spline3 the interpolators",&
04896             usage="eps_x 1.e-15", default_r_val=1.e-10_dp, error=error)
04897        CALL section_add_keyword(section,keyword,error=error)
04898        CALL keyword_release(keyword,error=error)
04899 
04900        CALL keyword_create(keyword, name="eps_r",&
04901             description="accuracy on the residual for spline3 the interpolators",&
04902             usage="eps_r 1.e-15", default_r_val=1.e-10_dp, error=error)
04903        CALL section_add_keyword(section,keyword,error=error)
04904        CALL keyword_release(keyword,error=error)
04905 
04906        CALL keyword_create(keyword, name="max_iter",&
04907             variants=(/'maxiter'/),&
04908             description="the maximum number of iterations",&
04909             usage="max_iter 200", default_i_val=100, error=error)
04910        CALL section_add_keyword(section,keyword,error=error)
04911        CALL keyword_release(keyword,error=error)
04912 
04913        NULLIFY(print_key)
04914        CALL cp_print_key_section_create(print_key,"conv_info",&
04915             description="if convergence information about the linear solver"//&
04916             " of the spline methods should be printed", &
04917             print_level=medium_print_level,each_iter_names=s2a("SPLINE_FIND_COEFFS"),&
04918             each_iter_values=(/10/),filename="__STD_OUT__",&
04919             add_last=add_last_numeric,error=error)
04920        CALL section_add_subsection(section,print_key,error=error)
04921        CALL section_release(print_key,error=error)
04922 
04923     END IF
04924   END SUBROUTINE create_gspace_interp_section
04925 
04926 ! *****************************************************************************
04933   SUBROUTINE create_harris_section(section,error)
04934     TYPE(section_type), POINTER              :: section
04935     TYPE(cp_error_type), INTENT(inout)       :: error
04936 
04937     CHARACTER(len=*), PARAMETER :: routineN = 'create_harris_section', 
04938       routineP = moduleN//':'//routineN
04939 
04940     LOGICAL                                  :: failure
04941     TYPE(keyword_type), POINTER              :: keyword
04942 
04943     failure=.FALSE.
04944 
04945     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
04946     IF (.NOT. failure) THEN
04947        CALL section_create(section,name="HARRIS",&
04948             description="This section specifies the flags for the calculation of the harris functional",&
04949             n_keywords=2, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
04950             error=error)
04951 
04952        NULLIFY(keyword)
04953 
04954        CALL keyword_create(keyword, name="ACTIVATE", &
04955             description="Activates the harris functional.", &
04956             usage="ACTIVATE TRUE", required=.FALSE., &
04957             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., &
04958             error=error)
04959        CALL section_add_keyword(section, keyword, error=error)
04960        CALL keyword_release(keyword, error=error)
04961 
04962        CALL keyword_create(keyword, name="HARRIS_ENERGY",&
04963             description="Overrides the QS Energy.", &
04964             usage="HARRIS_ENERGY TRUE", required=.FALSE., &
04965             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., &
04966             error=error)
04967        CALL section_add_keyword(section, keyword, error=error)
04968        CALL keyword_release(keyword, error=error)
04969 
04970     END IF
04971   END SUBROUTINE create_harris_section
04972 
04973 ! *****************************************************************************
04979   SUBROUTINE create_mgrid_section(section,error)
04980     TYPE(section_type), POINTER              :: section
04981     TYPE(cp_error_type), INTENT(inout)       :: error
04982 
04983     CHARACTER(len=*), PARAMETER :: routineN = 'create_mgrid_section', 
04984       routineP = moduleN//':'//routineN
04985 
04986     LOGICAL                                  :: failure
04987     TYPE(keyword_type), POINTER              :: keyword
04988     TYPE(section_type), POINTER              :: subsection
04989 
04990     failure=.FALSE.
04991 
04992     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
04993     IF (.NOT. failure) THEN
04994        CALL section_create(section,name="mgrid",&
04995             description="multigrid information",&
04996             n_keywords=5, n_subsections=1, repeats=.FALSE., required=.FALSE.,&
04997             error=error)
04998        NULLIFY(keyword)
04999        CALL keyword_create(keyword, name="NGRIDS",&
05000             description="The number of multigrids to use",&
05001             usage="ngrids 1", default_i_val=4, error=error)
05002        CALL section_add_keyword(section,keyword,error=error)
05003        CALL keyword_release(keyword,error=error)
05004 
05005        CALL keyword_create(keyword=keyword, name="cutoff",&
05006             description="The cutoff of the finest grid level. Default value for "//&
05007             "SE or DFTB calculation is 1.0 [Ry].",&
05008             usage="cutoff 300",default_r_val=cp_unit_to_cp2k(value=280.0_dp,&
05009             unit_str="Ry",error=error), n_var=1, unit_str="Ry", error=error)
05010        CALL section_add_keyword(section,keyword,error=error)
05011        CALL keyword_release(keyword,error=error)
05012 
05013        CALL keyword_create(keyword, name="progression_factor",&
05014             description="Factor used to find the cutoff of the multigrids that"//&
05015             " where not given explicitly",&
05016             usage="progression_factor <integer>", default_r_val=3._dp, error=error)
05017        CALL section_add_keyword(section,keyword,error=error)
05018        CALL keyword_release(keyword,error=error)
05019 
05020        CALL keyword_create(keyword, name="commensurate",&
05021             description="If the grids should be commensurate. If true overrides "//&
05022             "the progression factor and the cutoffs of the sub grids",&
05023             usage="commensurate", default_l_val=.FALSE.,&
05024             lone_keyword_l_val=.TRUE.,error=error)
05025        CALL section_add_keyword(section,keyword,error=error)
05026        CALL keyword_release(keyword,error=error)
05027 
05028        CALL keyword_create(keyword, name="realspace",&
05029             description="If both rho and rho_gspace are needed ",&
05030             usage="realspace", default_l_val=.FALSE.,&
05031             lone_keyword_l_val=.TRUE.,error=error)
05032        CALL section_add_keyword(section,keyword,error=error)
05033        CALL keyword_release(keyword,error=error)
05034 
05035        CALL keyword_create(keyword, name="REL_CUTOFF",&
05036             variants=(/"RELATIVE_CUTOFF"/),&
05037             description="Determines the grid at which a Gaussian is mapped,"//&
05038             " giving the cutoff used for a gaussian with alpha=1."//&
05039             " A value 50+-10Ry might be required for highly accurate results, "//&
05040             " Or for simulations with a variable cell."//&
05041             " Versions prior to 2.3 used a default of 30Ry.",&
05042             usage="RELATIVE_CUTOFF real", default_r_val=20.0_dp,&
05043             unit_str="Ry",error=error)
05044        CALL section_add_keyword(section,keyword,error=error)
05045        CALL keyword_release(keyword,error=error)
05046 
05047        CALL keyword_create(keyword, name="MULTIGRID_SET",&
05048             description="Activate a manual setting of the multigrids",&
05049             usage="MULTIGRID_SET", default_l_val=.FALSE.,&
05050             error=error)
05051        CALL section_add_keyword(section,keyword,error=error)
05052        CALL keyword_release(keyword,error=error)
05053 
05054        CALL keyword_create(keyword, name="SKIP_LOAD_BALANCE_DISTRIBUTED",&
05055             description="Skip load balancing on distributed multigrids, which might be memory intensive."//&
05056                         "If not explicitly specified, runs using more than 1024 MPI tasks will default to .TRUE.",&
05057             usage="SKIP_LOAD_BALANCE_DISTRIBUTED", default_l_val=.FALSE., lone_keyword_l_val=.TRUE., &
05058             error=error)
05059        CALL section_add_keyword(section,keyword,error=error)
05060        CALL keyword_release(keyword,error=error)
05061 
05062        CALL keyword_create(keyword,name="MULTIGRID_CUTOFF",&
05063             variants=(/"CUTOFF_LIST"/),&
05064             description="List of cutoff values to set up multigrids manually",&
05065             usage="MULTIGRID_CUTOFF 200.0 100.0 ", n_var=-1, type_of_var=real_t,&
05066             error=error)
05067        CALL section_add_keyword(section,keyword,error=error)
05068        CALL keyword_release(keyword,error=error)
05069 
05070        NULLIFY(subsection)
05071        CALL create_rsgrid_section(subsection,error)
05072        CALL section_add_subsection(section,subsection,error=error)
05073        CALL section_release(subsection,error=error)
05074 
05075        NULLIFY(subsection)
05076        CALL create_interp_section(subsection,error)
05077        CALL section_add_subsection(section,subsection,error=error)
05078        CALL section_release(subsection,error=error)
05079     END IF
05080   END SUBROUTINE create_mgrid_section
05081 
05082 ! *****************************************************************************
05088   SUBROUTINE create_interp_section(section,error)
05089     TYPE(section_type), POINTER              :: section
05090     TYPE(cp_error_type), INTENT(inout)       :: error
05091 
05092     CHARACTER(len=*), PARAMETER :: routineN = 'create_interp_section', 
05093       routineP = moduleN//':'//routineN
05094 
05095     LOGICAL                                  :: failure
05096     TYPE(keyword_type), POINTER              :: keyword
05097     TYPE(section_type), POINTER              :: print_key
05098 
05099     failure=.FALSE.
05100 
05101     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
05102     IF (.NOT. failure) THEN
05103        CALL section_create(section,name="interpolator",&
05104             description="kind of interpolation used between the multigrids",&
05105             n_keywords=5, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
05106             error=error)
05107 
05108        NULLIFY(keyword, print_key)
05109 
05110        CALL keyword_create(keyword, name="kind",&
05111             description="the interpolator to use",&
05112             usage="kind spline3",&
05113             default_i_val=pw_interp,&
05114             enum_c_vals=s2a("pw","spline3_nopbc","spline3"),&
05115             enum_i_vals=(/pw_interp,&
05116             spline3_nopbc_interp,spline3_pbc_interp/),error=error)
05117        CALL section_add_keyword(section,keyword,error=error)
05118        CALL keyword_release(keyword,error=error)
05119 
05120        CALL keyword_create(keyword, name="safe_computation",&
05121             description="if a non unrolled calculation is to be performed in parallel",&
05122             usage="safe_computation OFF",&
05123             default_l_val=.FALSE.,&
05124             lone_keyword_l_val=.TRUE.,&
05125             error=error)
05126        CALL section_add_keyword(section,keyword,error=error)
05127        CALL keyword_release(keyword,error=error)
05128 
05129        CALL keyword_create(keyword, name="aint_precond",&
05130             description="the approximate inverse to use to get the starting point"//&
05131             " for the linear solver of the spline3 methods",&
05132             usage="aint_precond copy",&
05133             default_i_val=precond_spl3_aint,&
05134             enum_c_vals=s2a( "copy","spl3_nopbc_aint1","spl3_nopbc_aint2",&
05135             "spl3_nopbc_precond1","spl3_nopbc_precond2","spl3_nopbc_precond3"),&
05136             enum_i_vals=(/no_precond,precond_spl3_aint, precond_spl3_aint2,&
05137             precond_spl3_1,precond_spl3_2,precond_spl3_3/),&
05138             error=error)
05139        CALL section_add_keyword(section,keyword,error=error)
05140        CALL keyword_release(keyword,error=error)
05141 
05142        CALL keyword_create(keyword, name="precond",&
05143             description="The preconditioner used"//&
05144             " for the linear solver of the spline3 methods",&
05145             usage="PRECOND copy",&
05146             default_i_val=precond_spl3_3,&
05147             enum_c_vals=s2a( "copy","spl3_nopbc_aint1","spl3_nopbc_aint2",&
05148             "spl3_nopbc_precond1","spl3_nopbc_precond2","spl3_nopbc_precond3"),&
05149             enum_i_vals=(/no_precond,precond_spl3_aint, precond_spl3_aint2,&
05150             precond_spl3_1,precond_spl3_2,precond_spl3_3/),&
05151             error=error)
05152        CALL section_add_keyword(section,keyword,error=error)
05153        CALL keyword_release(keyword,error=error)
05154 
05155        CALL keyword_create(keyword, name="eps_x",&
05156             description="accuracy on the solution for spline3 the interpolators",&
05157             usage="eps_x 1.e-15", default_r_val=1.e-10_dp, error=error)
05158        CALL section_add_keyword(section,keyword,error=error)
05159        CALL keyword_release(keyword,error=error)
05160 
05161        CALL keyword_create(keyword, name="eps_r",&
05162             description="accuracy on the residual for spline3 the interpolators",&
05163             usage="eps_r 1.e-15", default_r_val=1.e-10_dp, error=error)
05164        CALL section_add_keyword(section,keyword,error=error)
05165        CALL keyword_release(keyword,error=error)
05166 
05167        CALL keyword_create(keyword, name="max_iter",&
05168             variants=(/'maxiter'/),&
05169             description="the maximum number of iterations",&
05170             usage="max_iter 200", default_i_val=100, error=error)
05171        CALL section_add_keyword(section,keyword,error=error)
05172        CALL keyword_release(keyword,error=error)
05173 
05174        NULLIFY(print_key)
05175        CALL cp_print_key_section_create(print_key,"conv_info",&
05176             description="if convergence information about the linear solver"//&
05177             " of the spline methods should be printed", &
05178             print_level=medium_print_level,each_iter_names=s2a("SPLINE_FIND_COEFFS"),&
05179             each_iter_values=(/10/),filename="__STD_OUT__",&
05180             add_last=add_last_numeric,error=error)
05181        CALL section_add_subsection(section,print_key,error=error)
05182        CALL section_release(print_key,error=error)
05183 
05184     END IF
05185   END SUBROUTINE create_interp_section
05186 
05187 ! *****************************************************************************
05193   SUBROUTINE create_sic_section(section,error)
05194     TYPE(section_type), POINTER              :: section
05195     TYPE(cp_error_type), INTENT(inout)       :: error
05196 
05197     CHARACTER(len=*), PARAMETER :: routineN = 'create_sic_section', 
05198       routineP = moduleN//':'//routineN
05199 
05200     LOGICAL                                  :: failure
05201     TYPE(keyword_type), POINTER              :: keyword
05202 
05203     failure=.FALSE.
05204 
05205     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
05206     IF (.NOT. failure) THEN
05207        CALL section_create(section,"sic",&
05208             description="parameters for the self interaction correction",&
05209             n_keywords=6, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
05210             citations=(/VandeVondele2005b,Perdew1981,Avezac2005/),&
05211             error=error)
05212 
05213        NULLIFY(keyword)
05214 
05215        CALL keyword_create(keyword, name="SIC_SCALING_A",&
05216             description="Scaling of the coulomb term in sic [experimental]",&
05217             usage="SIC_SCALING_A 0.5",&
05218             citations=(/VandeVondele2005b/),&
05219             default_r_val=1.0_dp,error=error)
05220        CALL section_add_keyword(section,keyword,error=error)
05221        CALL keyword_release(keyword,error=error)
05222 
05223        CALL keyword_create(keyword, name="SIC_SCALING_B",&
05224             description="Scaling of the xc term in sic [experimental]",&
05225             usage="SIC_SCALING_B 0.5",&
05226             citations=(/VandeVondele2005b/),&
05227             default_r_val=1.0_dp,error=error)
05228        CALL section_add_keyword(section,keyword,error=error)
05229        CALL keyword_release(keyword,error=error)
05230 
05231        CALL keyword_create(keyword, name="SIC_METHOD",&
05232             description="Method used to remove the self interaction",&
05233             usage="SIC_METHOD MAURI_US",&
05234             default_i_val=sic_none,&
05235             enum_c_vals=s2a( "NONE", "MAURI_US", "MAURI_SPZ", "AD", "EXPLICIT_ORBITALS"),&
05236             enum_i_vals=(/sic_none,sic_mauri_us,sic_mauri_spz,sic_ad,sic_eo/),&
05237             enum_desc=s2a("Do not apply a sic correction",&
05238                           "Employ a (scaled) correction proposed by Mauri and co-workers"//&
05239                                  " on the spin density / doublet unpaired orbital",&
05240                           "Employ a (scaled) Perdew-Zunger expression"//&
05241                                  " on the spin density / doublet unpaired orbital",&
05242                           "The average density correction",&
05243                           "(scaled) Perdew-Zunger correction explicitly on a set of orbitals."),&
05244             citations=(/VandeVondele2005b,Perdew1981,Avezac2005/),&
05245             error=error)
05246        CALL section_add_keyword(section,keyword,error=error)
05247        CALL keyword_release(keyword,error=error)
05248 
05249        CALL keyword_create(keyword, name="ORBITAL_SET",&
05250             description="Type of orbitals treated with the SIC",&
05251             usage="ORBITAL_SET ALL",&
05252             default_i_val=sic_list_unpaired,&
05253             enum_c_vals=s2a("UNPAIRED","ALL"),&
05254             enum_desc=s2a("correction for the unpaired orbitals only, requires a restricted open shell calculation",&
05255                           "correction for all orbitals, requires a LSD or ROKS calculation"),&
05256             enum_i_vals=(/sic_list_unpaired,sic_list_all/),&
05257             error=error)
05258        CALL section_add_keyword(section,keyword,error=error)
05259        CALL keyword_release(keyword,error=error)
05260 
05261     END IF
05262   END SUBROUTINE create_sic_section
05263 
05264 ! *****************************************************************************
05268   SUBROUTINE create_low_spin_roks_section(section,error)
05269     TYPE(section_type), POINTER              :: section
05270     TYPE(cp_error_type), INTENT(inout)       :: error
05271 
05272     CHARACTER(len=*), PARAMETER :: routineN = 'create_low_spin_roks_section', 
05273       routineP = moduleN//':'//routineN
05274 
05275     LOGICAL                                  :: failure
05276     TYPE(keyword_type), POINTER              :: keyword
05277 
05278     failure=.FALSE.
05279 
05280     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
05281     IF (.NOT. failure) THEN
05282        CALL section_create(section,"LOW_SPIN_ROKS",&
05283             description="Specify the details of the low spin ROKS method."//&
05284                         "In particular, one can specify various terms added to the energy of the high spin roks configuration"//&
05285                         " with a energy scaling factor, and a prescription of the spin state.",&
05286             n_keywords=6, n_subsections=0, repeats=.FALSE., required=.TRUE.,&
05287             error=error)
05288 
05289        NULLIFY(keyword)
05290        CALL keyword_create(keyword,name="ENERGY_SCALING",&
05291             description="The scaling factors for each term added to the total energy."//&
05292                         "This list should contain one number for each term added to the total energy.",&
05293             usage="ENERGY_SCALING 1.0 -1.0 ",&
05294             n_var=-1,type_of_var=real_t,repeats=.FALSE.,error=error)
05295        CALL section_add_keyword(section,keyword,error=error)
05296        CALL keyword_release(keyword,error=error)
05297        CALL keyword_create(keyword,name="SPIN_CONFIGURATION",&
05298             description="for each singly occupied orbital, specify if this should be an alpha (=1) or a beta (=2) orbital"//&
05299                         "This keyword should be repeated, each repetition corresponding to an additional term." ,&
05300             usage="SPIN_CONFIGURATION 1 2",&
05301             n_var=-1,type_of_var=integer_t,repeats=.TRUE.,error=error)
05302        CALL section_add_keyword(section,keyword,error=error)
05303        CALL keyword_release(keyword,error=error)
05304 
05305     END IF
05306   END SUBROUTINE create_low_spin_roks_section
05307 
05308 ! *****************************************************************************
05313   SUBROUTINE create_ext_pot_section(section,error)
05314     TYPE(section_type), POINTER              :: section
05315     TYPE(cp_error_type), INTENT(inout)       :: error
05316 
05317     CHARACTER(len=*), PARAMETER :: routineN = 'create_ext_pot_section', 
05318       routineP = moduleN//':'//routineN
05319 
05320     LOGICAL                                  :: failure
05321     TYPE(keyword_type), POINTER              :: keyword
05322 
05323     failure=.FALSE.
05324 
05325     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
05326     IF (.NOT. failure) THEN
05327        CALL section_create(section,name="EXTERNAL_POTENTIAL",&
05328             description="Section controlling the presence of an electrostatic "//&
05329             "external potential dependent on the atomic positions (X,Y,Z)",&
05330             n_keywords=7, n_subsections=0, repeats=.FALSE., required=.TRUE.,&
05331             error=error)
05332        NULLIFY(keyword)
05333 
05334        CALL keyword_create(keyword, name="FUNCTION",&
05335             description="Specifies the functional form in mathematical notation. Variables must be the atomic "//&
05336             "coordinates (X,Y,Z) of the grid.",usage="FUNCTION  X^2+Y^2+Z^2+LOG(ABS(X+Y))", required=.TRUE.,&
05337             type_of_var=lchar_t, n_var=1, error=error)
05338        CALL section_add_keyword(section,keyword,error=error)
05339        CALL keyword_release(keyword,error=error)
05340 
05341        CALL keyword_create(keyword, name="PARAMETERS",&
05342             description="Defines the parameters of the functional form",&
05343             usage="PARAMETERS a b D", required=.TRUE., type_of_var=char_t,&
05344             n_var=-1, repeats=.TRUE., error=error)
05345        CALL section_add_keyword(section,keyword,error=error)
05346        CALL keyword_release(keyword,error=error)
05347 
05348        CALL keyword_create(keyword, name="VALUES",&
05349             description="Defines the values of parameter of the functional form",&
05350             usage="VALUES ", required=.TRUE., type_of_var=real_t,&
05351             n_var=-1, repeats=.TRUE., unit_str="internal_cp2k", error=error)
05352        CALL section_add_keyword(section,keyword,error=error)
05353        CALL keyword_release(keyword,error=error)
05354 
05355        CALL keyword_create(keyword, name="UNITS",&
05356             description="Optionally, allows to define valid CP2K unit strings for each parameter value. "//&
05357                         "It is assumed that the corresponding parameter value is specified in this unit.",&
05358             usage="UNITS angstrom eV*angstrom^-1 angstrom^1 K", required=.FALSE., type_of_var=char_t,&
05359             n_var=-1, repeats=.TRUE., error=error)
05360        CALL section_add_keyword(section,keyword,error=error)
05361        CALL keyword_release(keyword,error=error)
05362 
05363        CALL keyword_create(keyword, name="STATIC",&
05364             description="Specifies the external potential as STATIC or time dependent. At the moment "//&
05365                         "only static potentials are implemented.",&
05366             usage="STATIC T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE., error=error)
05367        CALL section_add_keyword(section,keyword,error=error)
05368        CALL keyword_release(keyword,error=error)
05369 
05370        CALL keyword_create(keyword, name="DX",&
05371             description="Parameter used for computing the derivative with the Ridders method.",&
05372             usage="DX <REAL>", default_r_val=0.1_dp, unit_str="bohr", error=error)
05373        CALL section_add_keyword(section,keyword,error=error)
05374        CALL keyword_release(keyword,error=error)
05375 
05376        CALL keyword_create(keyword, name="ERROR_LIMIT",&
05377             description="Checks that the error in computing the derivative is not larger than "//&
05378             "the value set. In case prints a warning message.",&
05379             usage="ERROR_LIMIT <REAL>", default_r_val=1.0E-12_dp, error=error)
05380        CALL section_add_keyword(section,keyword,error=error)
05381        CALL keyword_release(keyword,error=error)
05382     END IF
05383   END SUBROUTINE create_ext_pot_section
05384 
05385 ! *****************************************************************************
05391   SUBROUTINE create_per_efield_section(section,error)
05392     TYPE(section_type), POINTER              :: section
05393     TYPE(cp_error_type), INTENT(inout)       :: error
05394 
05395     CHARACTER(len=*), PARAMETER :: routineN = 'create_per_efield_section', 
05396       routineP = moduleN//':'//routineN
05397 
05398     LOGICAL                                  :: failure
05399     TYPE(keyword_type), POINTER              :: keyword
05400 
05401     failure=.FALSE.
05402 
05403     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
05404     IF (.NOT. failure) THEN
05405        CALL section_create(section,"PERIODIC_EFIELD",&
05406             description="parameters for finite periodic electric field computed using "//&
05407             "the Berry phase approach. IMPORTANT: Can only be used in combination "//&
05408             " with OT. Can not be used in combination with RTP or EMD.",&
05409             n_keywords=6, n_subsections=1, repeats=.TRUE., required=.TRUE.,&
05410             error=error)
05411 
05412        NULLIFY(keyword)
05413 
05414        CALL keyword_create(keyword, name="INTENSITY",&
05415             description="Intensity of the electric field in a.u",&
05416             usage="INTENSITY  0.001",&
05417             default_r_val=0._dp,error=error)
05418        CALL section_add_keyword(section,keyword,error=error)
05419        CALL keyword_release(keyword,error=error)
05420 
05421        CALL keyword_create(keyword, name="POLARISATION",&
05422             description="Polarisation vector of electric field",&
05423             usage="POLARISIATION  0.0 0.0 1.0",&
05424             repeats=.FALSE.,required=.FALSE.,n_var=3,&
05425             type_of_var=real_t,default_r_vals=(/0.0_dp,0.0_dp,1.0_dp/),&
05426             error=error)
05427        CALL section_add_keyword(section,keyword,error=error)
05428        CALL keyword_release(keyword,error=error)
05429 
05430     END IF
05431 
05432   END SUBROUTINE create_per_efield_section
05433 ! *****************************************************************************
05439   SUBROUTINE create_efield_section(section,error)
05440     TYPE(section_type), POINTER              :: section
05441     TYPE(cp_error_type), INTENT(inout)       :: error
05442 
05443     CHARACTER(len=*), PARAMETER :: routineN = 'create_efield_section', 
05444       routineP = moduleN//':'//routineN
05445 
05446     LOGICAL                                  :: failure
05447     TYPE(keyword_type), POINTER              :: keyword
05448     TYPE(section_type), POINTER              :: subsection
05449 
05450     failure=.FALSE.
05451 
05452     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
05453     IF (.NOT. failure) THEN
05454        CALL section_create(section,"EFIELD",&
05455             description="parameters for finite, time dependent, nonperiodic electric fields",&
05456             n_keywords=6, n_subsections=1, repeats=.TRUE., required=.TRUE.,&
05457             error=error)
05458 
05459        NULLIFY(keyword,subsection)
05460 
05461        CALL keyword_create(keyword, name="INTENSITY",&
05462             description="Intensity of the electric field in W*cm-2 which corresponds "//&
05463             "to a maximal amplitude in a.u. of sqrt(I/(3.50944*10^16))",&
05464             usage="INTENSITY  0.001",&
05465             default_r_val=0._dp,error=error)
05466        CALL section_add_keyword(section,keyword,error=error)
05467        CALL keyword_release(keyword,error=error)
05468 
05469        CALL keyword_create(keyword, name="POLARISATION",&
05470             description="Polarisation vector of electric field",&
05471             usage="POLARISIATION  0.0 0.0 1.0",&
05472             repeats=.FALSE.,required=.FALSE.,n_var=3,&
05473             type_of_var=real_t,default_r_vals=(/0.0_dp,0.0_dp,1.0_dp/),&
05474             error=error)
05475        CALL section_add_keyword(section,keyword,error=error)
05476        CALL keyword_release(keyword,error=error)
05477 
05478        CALL keyword_create(keyword, name="wavelength",&
05479             description="Wavelength of efield field",&
05480             usage="Wavelength  1.E0",&
05481             default_r_val=0._dp,unit_str="nm",error=error)
05482        CALL section_add_keyword(section,keyword,error=error)
05483        CALL keyword_release(keyword,error=error)
05484 
05485        CALL keyword_create(keyword, name="PHASE",&
05486             description="phase offset of the cosine given in multiples of pi",&
05487             usage="Phase  1.E0",&
05488             default_r_val=0._dp,error=error)
05489        CALL section_add_keyword(section,keyword,error=error)
05490        CALL keyword_release(keyword,error=error)
05491 
05492        CALL keyword_create(keyword, name="ENVELOP",&
05493             description="Shape of the efield pulse",&
05494             usage="ENVELOP CONSTANT",&
05495             default_i_val=constant_env,&
05496             enum_c_vals=s2a( "CONSTANT", "GAUSSIAN","RAMP" ),&
05497             enum_desc=s2a("No envelop function is applied to the strength",&
05498                           "A Gaussian function is used as envelop ",&
05499                           "Linear tune in/out of the field"),&
05500             enum_i_vals=(/constant_env,gaussian_env,ramp_env/),&
05501             error=error)
05502        CALL section_add_keyword(section,keyword,error=error)
05503        CALL keyword_release(keyword,error=error)
05504 
05505        CALL create_constant_env_section(subsection,error)
05506        CALL section_add_subsection(section,subsection,error=error)
05507        CALL section_release(subsection,error=error)
05508 
05509        CALL create_ramp_env_section(subsection,error)
05510        CALL section_add_subsection(section,subsection,error=error)
05511        CALL section_release(subsection,error=error)
05512 
05513        CALL create_gaussian_env_section(subsection,error)
05514        CALL section_add_subsection(section,subsection,error=error)
05515        CALL section_release(subsection,error=error)
05516 
05517     END IF
05518   END SUBROUTINE create_efield_section
05519 
05520 ! *****************************************************************************
05525   SUBROUTINE create_ot_section(section,error)
05526     TYPE(section_type), POINTER              :: section
05527     TYPE(cp_error_type), INTENT(inout)       :: error
05528 
05529     CHARACTER(len=*), PARAMETER :: routineN = 'create_ot_section', 
05530       routineP = moduleN//':'//routineN
05531 
05532     LOGICAL                                  :: failure
05533     TYPE(keyword_type), POINTER              :: keyword
05534 
05535     failure=.FALSE.
05536 
05537     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
05538     IF (.NOT. failure) THEN
05539        CALL section_create(section,"OT",&
05540             description="Sets the various options for the orbital transformation (OT) method. "//&
05541             "Default settings already provide an efficient, yet robust method. "//&
05542             "Most systems benefit from using the FULL_ALL preconditioner "//&
05543             "combined with a small value (0.001) of ENERGY_GAP."//&
05544             "Well-behaved systems might benefit from using a DIIS minimizer.",&
05545             n_keywords=27, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
05546             citations=(/VandeVondele2003,Weber2008/), error=error)
05547 
05548        NULLIFY(keyword)
05549 
05550        CALL keyword_create(keyword, name="_SECTION_PARAMETERS_",&
05551             description="controls the activation of the ot method",&
05552             usage="&OT T",&
05553             default_l_val=.FALSE.,&
05554             lone_keyword_l_val=.TRUE.,&
05555             error=error)
05556        CALL section_add_keyword(section,keyword,error=error)
05557        CALL keyword_release(keyword,error=error)
05558 
05559        CALL keyword_create(keyword, name="ALGORITHM",&
05560             description="Algorithm to be used for OT",&
05561             usage="ALGORITHM STRICT",&
05562             default_i_val=ot_algo_taylor_or_diag,&
05563             enum_c_vals=s2a( "STRICT", "IRAC" ),&
05564             enum_desc=s2a("Strict orthogonality: Taylor or diagonalization based algorithm.",&
05565                           "Orbital Transformation based Iterative Refinement "//&
05566                           "of the Approximative Congruence transformation (OT/IR)."),&
05567             enum_i_vals=(/ot_algo_taylor_or_diag,ot_algo_irac/),&
05568             citations=(/VandeVondele2003,VandeVondele2005a,Weber2008/),&
05569             error=error)
05570        CALL section_add_keyword(section,keyword,error=error)
05571        CALL keyword_release(keyword,error=error)
05572 
05573        CALL keyword_create(keyword, name="IRAC_DEGREE",&
05574             description="The refinement polynomial degree (2, 3 or 4).",&
05575             usage="IRAC_DEGREE 4",&
05576             default_i_val=4,error=error)
05577        CALL section_add_keyword(section,keyword,error=error)
05578        CALL keyword_release(keyword,error=error)
05579 
05580        CALL keyword_create(keyword, name="MAX_IRAC",&
05581             description="Maximum allowed refinement iteration.",&
05582             usage="MAX_IRAC 5",&
05583             default_i_val=50,error=error)
05584        CALL section_add_keyword(section,keyword,error=error)
05585        CALL keyword_release(keyword,error=error)
05586 
05587        CALL keyword_create(keyword, name="MIXED_PRECISION",&
05588             description="Uses a mixed precision algorithm." //&
05589             "With a well behaved basis set (i.e. condition number less than 1/eps_sp)"//&
05590             "it provides double precision accuracy results and up to a 2 fold speedup for building and "//&
05591             "applying the preconditioner.",&
05592             usage="MIXED_PRECISION T",&
05593             default_l_val=.FALSE.,error=error)
05594        CALL section_add_keyword(section,keyword,error=error)
05595        CALL keyword_release(keyword,error=error)
05596 
05597        CALL keyword_create(keyword, name="ORTHO_IRAC",&
05598             description="The orthogonality method.",&
05599             usage="ORTHO_IRAC POLY",&
05600             default_i_val=ot_chol_irac,&
05601             enum_c_vals=s2a( "CHOL", "POLY", "LWDN"),&
05602             enum_desc=s2a("Cholesky.","Polynomial.","Loewdin."),&
05603             enum_i_vals=(/ot_chol_irac,ot_poly_irac,ot_lwdn_irac/),&
05604             error=error)
05605        CALL section_add_keyword(section,keyword,error=error)
05606        CALL keyword_release(keyword,error=error)
05607 
05608        CALL keyword_create(keyword, name="EPS_IRAC_FILTER_MATRIX",&
05609             description="Sets the threshold for filtering the matrices.",&
05610             usage="EPS_IRAC_FILTER_MATRIX 1.0E-5",&
05611             default_r_val=0.0_dp,error=error)
05612        CALL section_add_keyword(section,keyword,error=error)
05613        CALL keyword_release(keyword,error=error)
05614 
05615        CALL keyword_create(keyword, name="EPS_IRAC",&
05616             description="Targeted accuracy during the refinement iteration.",&
05617             usage="EPS_IRAC 1.0E-5",&
05618             default_r_val=1.0E-10_dp,error=error)
05619        CALL section_add_keyword(section,keyword,error=error)
05620        CALL keyword_release(keyword,error=error)
05621 
05622        CALL keyword_create(keyword, name="EPS_IRAC_QUICK_EXIT",&
05623             description="Only one extra refinement iteration is "//&
05624             "done when the norm is below this value.",&
05625             usage="EPS_IRAC_QUICK_EXIT 1.0E-2",&
05626             default_r_val=1.0E-5_dp,error=error)
05627        CALL section_add_keyword(section,keyword,error=error)
05628        CALL keyword_release(keyword,error=error)
05629 
05630        CALL keyword_create(keyword, name="EPS_IRAC_SWITCH",&
05631             description="The algorithm switches to the polynomial "//&
05632             "refinement when the norm is below this value.",&
05633             usage="EPS_IRAC_SWITCH 1.0E-3",&
05634             default_r_val=1.0E-2_dp,error=error)
05635        CALL section_add_keyword(section,keyword,error=error)
05636        CALL keyword_release(keyword,error=error)
05637 
05638        CALL keyword_create(keyword, name="ON_THE_FLY_LOC",&
05639             description="On the fly localization of the molecular orbitals. "//&
05640             "Can only be used with OT/IRAC.",&
05641             usage="ON_THE_FLY_LOC T",&
05642             default_l_val=.FALSE.,error=error)
05643        CALL section_add_keyword(section,keyword,error=error)
05644        CALL keyword_release(keyword,error=error)
05645 
05646        CALL keyword_create(keyword, name="MINIMIZER",&
05647             description="Minimizer to be used with the OT method",&
05648             usage="MINIMIZER DIIS",&
05649             default_i_val=ot_mini_cg,&
05650             enum_c_vals=s2a( "SD", "CG", "DIIS","BROYDEN"),&
05651             enum_desc=s2a("Steepest descent: not recommended","Conjugate Gradients: most reliable, use for difficult systems."//&
05652             " The total energy should decrease at every OT CG step if the line search is appropriate.", &
05653             "Direct inversion in the iterative subspace: less reliable than CG, but sometimes about 50% faster",&
05654             "Broyden mixing approximating the inverse Hessian"),&
05655             enum_i_vals=(/ot_mini_sd,ot_mini_cg,ot_mini_diis,ot_mini_broyden/),&
05656             error=error)
05657        CALL section_add_keyword(section,keyword,error=error)
05658        CALL keyword_release(keyword,error=error)
05659 
05660        CALL keyword_create(keyword, name="SAFE_DIIS",&
05661             variants=(/"SAFER_DIIS"/),&
05662             description="Reject DIIS steps if they point away from the"//&
05663             " minimum, do SD in that case.",&
05664             usage="SAFE_DIIS ON", default_l_val=.TRUE.,error=error)
05665        CALL section_add_keyword(section,keyword,error=error)
05666        CALL keyword_release(keyword,error=error)
05667 
05668        CALL keyword_create(keyword, name="N_HISTORY_VEC",&
05669             variants=s2a("NDIIS","N_DIIS","N_BROYDEN"),&
05670             description="Number of history vectors to be used with DIIS or BROYDEN",&
05671             usage="N_DIIS 4",&
05672             default_i_val=7,error=error)
05673        CALL section_add_keyword(section,keyword,error=error)
05674        CALL keyword_release(keyword,error=error)
05675 
05676        CALL keyword_create(keyword, name="BROYDEN_BETA",&
05677             description="Underrelaxation for the broyden mixer",&
05678             usage="BROYDEN_BETA 0.9",&
05679             default_r_val=0.9_dp,error=error)
05680        CALL section_add_keyword(section,keyword,error=error)
05681        CALL keyword_release(keyword,error=error)
05682 
05683        CALL keyword_create(keyword, name="BROYDEN_GAMMA",&
05684             description="Backtracking parameter",&
05685             usage="BROYDEN_GAMMA 0.5",&
05686             default_r_val=0.5_dp,error=error)
05687        CALL section_add_keyword(section,keyword,error=error)
05688        CALL keyword_release(keyword,error=error)
05689 
05690        CALL keyword_create(keyword, name="BROYDEN_SIGMA",&
05691             description="Curvature of energy functional.",&
05692             usage="BROYDEN_SIGMA 0.25",&
05693             default_r_val=0.25_dp,error=error)
05694        CALL section_add_keyword(section,keyword,error=error)
05695        CALL keyword_release(keyword,error=error)
05696 
05697        CALL keyword_create(keyword, name="BROYDEN_ETA",&
05698             description="Dampening of estimated energy curvature.",&
05699             usage="BROYDEN_ETA 0.7",&
05700             default_r_val=0.7_dp,error=error)
05701        CALL section_add_keyword(section,keyword,error=error)
05702        CALL keyword_release(keyword,error=error)
05703 
05704        CALL keyword_create(keyword, name="BROYDEN_OMEGA",&
05705             description="Growth limit of curvature.",&
05706             usage="BROYDEN_OMEGA 1.1",&
05707             default_r_val=1.1_dp,error=error)
05708        CALL section_add_keyword(section,keyword,error=error)
05709        CALL keyword_release(keyword,error=error)
05710 
05711        CALL keyword_create(keyword, name="BROYDEN_SIGMA_DECREASE",&
05712             description="Reduction of curvature on bad approximation.",&
05713             usage="BROYDEN_SIGMA_DECREASE 0.7",&
05714             default_r_val=0.7_dp,error=error)
05715        CALL section_add_keyword(section,keyword,error=error)
05716        CALL keyword_release(keyword,error=error)
05717 
05718        CALL keyword_create(keyword, name="BROYDEN_SIGMA_MIN",&
05719             description="Minimum adaptive curvature.",&
05720             usage="BROYDEN_SIGMA_MIN 0.05",&
05721             default_r_val=0.05_dp,error=error)
05722        CALL section_add_keyword(section,keyword,error=error)
05723        CALL keyword_release(keyword,error=error)
05724 
05725        CALL keyword_create(keyword, name="BROYDEN_FORGET_HISTORY",&
05726             description="Forget history on bad approximation", &
05727             usage="BROYDEN_FORGET_HISTORY OFF", default_l_val=.FALSE., &
05728             lone_keyword_l_val=.TRUE.,error=error)
05729        CALL section_add_keyword(section,keyword,error=error)
05730        CALL keyword_release(keyword,error=error)
05731 
05732        CALL keyword_create(keyword, name="BROYDEN_ADAPTIVE_SIGMA",&
05733             description="Enable adaptive curvature estimation", &
05734             usage="BROYDEN_ADAPTIVE_SIGMA ON", default_l_val=.TRUE., &
05735             lone_keyword_l_val=.TRUE.,error=error)
05736        CALL section_add_keyword(section,keyword,error=error)
05737        CALL keyword_release(keyword,error=error)
05738 
05739        CALL keyword_create(keyword, name="BROYDEN_ENABLE_FLIP",&
05740             description="Ensure positive definite update", &
05741             usage="BROYDEN_ENABLE_FLIP ON", default_l_val=.TRUE., &
05742             lone_keyword_l_val=.TRUE.,error=error)
05743        CALL section_add_keyword(section,keyword,error=error)
05744        CALL keyword_release(keyword,error=error)
05745 
05746        CALL keyword_create(keyword, name="LINESEARCH",&
05747             variants=(/"LINE_SEARCH"/),&
05748             description="1D line search algorithm to be used with the OT minimizer,"//&
05749             " in increasing order of robustness and cost. MINIMIZER CG combined with"//&
05750             " LINESEARCH GOLD should always find an electronic minimum. "//&
05751             " Whereas the 2PNT minimizer is almost always OK, 3PNT might be needed for systems"//&
05752             " in which successive OT CG steps do not decrease the total energy.",&
05753             usage="LINESEARCH GOLD",&
05754             default_i_val=ls_2pnt,&
05755             enum_c_vals=s2a( "NONE", "2PNT", "3PNT","GOLD"),&
05756             enum_desc=s2a("take fixed lenght steps","extrapolate based on 2 points", &
05757             "... or on 3 points","perform 1D golden section search of the minimum (very expensive)"),&
05758             enum_i_vals=(/ls_none,ls_2pnt,ls_3pnt,ls_gold/),&
05759             error=error)
05760        CALL section_add_keyword(section,keyword,error=error)
05761        CALL keyword_release(keyword,error=error)
05762 
05763        CALL keyword_create(keyword, name="STEPSIZE",&
05764             description="Initial stepsize used for the line search, sometimes this parameter can be reduced to stablize DIIS"//&
05765             " or to improve the CG behavior in the first few steps",&
05766             usage="STEPSIZE 0.4",&
05767             default_r_val=0.15_dp,error=error)
05768        CALL section_add_keyword(section,keyword,error=error)
05769        CALL keyword_release(keyword,error=error)
05770 
05771        CALL keyword_create(keyword, name="GOLD_TARGET",&
05772             description="Target relative uncertainty in the location of the minimum for LINESEARCH GOLD",&
05773             usage="GOLD_TARGET 0.1",&
05774             default_r_val=0.01_dp,error=error)
05775        CALL section_add_keyword(section,keyword,error=error)
05776        CALL keyword_release(keyword,error=error)
05777 
05778        CALL keyword_create(keyword, name="PRECONDITIONER",&
05779             description="Type of preconditioner to be used with all minimization schemes. "//&
05780             "They differ in effectiveness, cost of construction, cost of application. "//&
05781             "Properly preconditioned minimization can be orders of magnitude faster than doing nothing.",&
05782             usage="PRECONDITIONER FULL_ALL",&
05783             default_i_val=ot_precond_full_kinetic,&
05784             enum_c_vals=s2a("FULL_ALL","FULL_SINGLE_INVERSE","FULL_SINGLE","FULL_KINETIC","FULL_S_INVERSE",&
05785             "SPARSE_DIAG","SPARSE_KINETIC",&
05786             "SPARSE_STABLE_APPROXIMATE_INVERSE",&
05787             "NONE"),&
05788             enum_desc=s2a("Most effective state selective preconditioner based on diagonalization, "//&
05789             "requires the ENERGY_GAP parameter to be an underestimate of the HOMO-LUMO gap. "//&
05790             "This preconditioner is recommended for almost all systems, except very large systems where "//&
05791             "make_preconditioner would dominate the total computational cost.",&
05792             "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "//&
05793             "but cheaper to construct, "//&
05794             "might be somewhat less robust. Recommended for large systems.",&
05795             "Based on H-eS diagonalisation, not as good as FULL_ALL, but somewhat cheaper to apply. ",&
05796             "Cholesky inversion of S and T, fast construction, robust, and relatively good, "//&
05797             "use for very large systems.",&
05798             "Cholesky inversion of S, not as good as FULL_KINETIC, yet equally expensive.",&
05799             "Only based on atomic blocks, very cheap in construction but quite poor.",&
05800             "Toward -sparse- linear solver for T-eS.",&
05801             "Stabilized Approximate INVerse preconditioning using DBCSR sparse matrices (not working yet).",&
05802             "skip preconditioning"),&
05803             enum_i_vals=(/ot_precond_full_all,ot_precond_full_single_inverse,ot_precond_full_single, &
05804             ot_precond_full_kinetic,ot_precond_s_inverse,&
05805             ot_precond_sparse_diag,ot_precond_sparse_kinetic,&
05806             ot_precond_sparse_kinetic_sainv,&
05807             ot_precond_none/),&
05808             citations=(/VandeVondele2003/),&
05809             error=error)
05810        CALL section_add_keyword(section,keyword,error=error)
05811        CALL keyword_release(keyword,error=error)
05812 
05813        CALL keyword_create(keyword, name="PRECOND_SOLVER",&
05814             description="How the preconditioner is applied to the residual.",&
05815             usage="PRECOND_SOLVER DIRECT",&
05816             default_i_val=ot_precond_solver_default,&
05817             enum_c_vals=s2a( "DEFAULT", "DIRECT", "INVERSE_CHOLESKY","SAINV"),&
05818             enum_desc=s2a("the default","Cholesky decomposition followed by triangular solve "//&
05819             "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)",&
05820             "Cholesky decomposition followed by explicit inversion "//&
05821             "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)",&
05822             "SAINV inversion (works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)"),&
05823             enum_i_vals=(/ot_precond_solver_default,&
05824             ot_precond_solver_direct,&
05825             ot_precond_solver_inv_chol,&
05826             ot_precond_solver_sainv/),&
05827             error=error)
05828        CALL section_add_keyword(section,keyword,error=error)
05829        CALL keyword_release(keyword,error=error)
05830 
05831        CALL keyword_create(keyword, name="ENERGY_GAP",&
05832             description="Should be an estimate for the energy gap [a.u.] (HOMO-LUMO) and is used in preconditioning, "//&
05833             "especially effective with the FULL_ALL preconditioner, in which case it should be an underestimate "//&
05834             "of the gap (0.001 doing normally fine). For the other preconditioners, making this value larger (0.2)"//&
05835             " will tame the preconditioner in case of poor initial guesses.",&
05836             usage="ENERGY_GAP 0.001",&
05837             default_r_val=0.2_dp,error=error)
05838        CALL section_add_keyword(section,keyword,error=error)
05839        CALL keyword_release(keyword,error=error)
05840 
05841        CALL keyword_create(keyword, name="EPS_TAYLOR",&
05842             variants=(/"EPSTAYLOR"/),&
05843             description="Target accuracy of the taylor expansion for the matrix functions, should normally be kept as is.",&
05844             usage="EPS_TAYLOR 1.0E-15",&
05845             default_r_val=1.0E-16_dp,error=error)
05846        CALL section_add_keyword(section,keyword,error=error)
05847        CALL keyword_release(keyword,error=error)
05848 
05849        CALL keyword_create(keyword, name="MAX_TAYLOR",&
05850             description="Maximum order of the Taylor expansion before diagonalisation is prefered, for large parallel runs"//&
05851             " a slightly higher order could sometimes result in a small speedup.",&
05852             usage="MAX_TAYLOR 5",&
05853             default_i_val=4,error=error)
05854        CALL section_add_keyword(section,keyword,error=error)
05855        CALL keyword_release(keyword,error=error)
05856 
05857        CALL keyword_create(keyword, name="ROTATION",&
05858             description="Introduce additional variables so that rotations of the occupied"//&
05859             " subspace are allowed as well, only needed for cases where the energy is not invariant under "//&
05860             " a rotation of the occupied subspace such as non-singlet restricted calculations "//&
05861             " or fractional occupations.",&
05862             usage="ROTATION",lone_keyword_l_val=.TRUE.,&
05863             default_l_val=.FALSE.,error=error)
05864        CALL section_add_keyword(section,keyword,error=error)
05865        CALL keyword_release(keyword,error=error)
05866 
05867        CALL keyword_create(keyword, name="SCP_DFT",&
05868             description="Introduce additional self-consistent polarization through"//&
05869             " additional response basis functions (read in through AUX_BASIS.)",&
05870             usage="SCP_DFT",lone_keyword_l_val=.TRUE.,&
05871             default_l_val=.FALSE.,error=error)
05872        CALL section_add_keyword(section,keyword,error=error)
05873        CALL keyword_release(keyword,error=error)
05874 
05875        CALL keyword_create(keyword, name="SCP_NDDO",&
05876             description="Introduce additional self-consistent polarization through"//&
05877             " response basis set = orbital basis set for NDDO.)",&
05878             usage="SCP_NDDO",lone_keyword_l_val=.TRUE.,&
05879             default_l_val=.FALSE.,error=error)
05880        CALL section_add_keyword(section,keyword,error=error)
05881        CALL keyword_release(keyword,error=error)
05882 
05883        CALL keyword_create(keyword, name="ENERGIES",&
05884             description="Optimize orbital energies for use in Fermi-Dirac smearing "//&
05885                         "(requires ROTATION and FD smearing to be active).",&
05886             usage="ENERGIES",lone_keyword_l_val=.TRUE.,&
05887             default_l_val=.FALSE.,error=error)
05888        CALL section_add_keyword(section,keyword,error=error)
05889        CALL keyword_release(keyword,error=error)
05890 
05891        CALL keyword_create(keyword, name="OCCUPATION_PRECONDITIONER",&
05892             description="Preconditioner with the occupation numbers (FD smearing)",&
05893             usage="OCCUPATION_PRECONDITIONER",lone_keyword_l_val=.TRUE.,&
05894             default_l_val=.FALSE.,error=error)
05895        CALL section_add_keyword(section,keyword,error=error)
05896        CALL keyword_release(keyword,error=error)
05897 
05898        CALL keyword_create(keyword, name="NONDIAG_ENERGY",&
05899             description="Add a non-diagonal energy penalty (FD smearing)",&
05900             usage="NONDIAG_ENERGY",lone_keyword_l_val=.TRUE.,&
05901             default_l_val=.FALSE.,error=error)
05902        CALL section_add_keyword(section,keyword,error=error)
05903        CALL keyword_release(keyword,error=error)
05904 
05905        CALL keyword_create(keyword, name="NONDIAG_ENERGY_STRENGTH",&
05906             description="The prefactor for the non-diagonal energy penalty (FD smearing)",&
05907             usage="NONDIAG_ENERGY_STRENGTH", default_r_val=1.0_dp,error=error)
05908        CALL section_add_keyword(section,keyword,error=error)
05909        CALL keyword_release(keyword,error=error)
05910 
05911 
05912     END IF
05913   END SUBROUTINE create_ot_section
05914 
05915 ! *****************************************************************************
05920   SUBROUTINE create_diagonalization_section(section,error)
05921     TYPE(section_type), POINTER              :: section
05922     TYPE(cp_error_type), INTENT(inout)       :: error
05923 
05924     CHARACTER(len=*), PARAMETER :: 
05925       routineN = 'create_diagonalization_section', 
05926       routineP = moduleN//':'//routineN
05927 
05928     LOGICAL                                  :: failure
05929     TYPE(keyword_type), POINTER              :: keyword
05930     TYPE(section_type), POINTER              :: subsection
05931 
05932     failure=.FALSE.
05933 
05934     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
05935     IF (.NOT. failure) THEN
05936        CALL section_create(section,"DIAGONALIZATION",&
05937             description="Set up type and parameters for Kohn-Sham matrix diagonalization.",&
05938             n_keywords=0, n_subsections=1, repeats=.FALSE., required=.FALSE.,&
05939             error=error)
05940 
05941        NULLIFY(keyword)
05942 
05943        CALL keyword_create(keyword, name="_SECTION_PARAMETERS_",&
05944             description="controls the activation of the diagonalization method",&
05945             usage="&DIAGONALIZATION T",&
05946             default_l_val=.FALSE.,&
05947             lone_keyword_l_val=.TRUE.,&
05948             error=error)
05949        CALL section_add_keyword(section,keyword,error=error)
05950        CALL keyword_release(keyword,error=error)
05951 
05952        CALL keyword_create(keyword, name="ALGORITHM",&
05953             description="Algorithm to be used for diagonalization",&
05954             usage="ALGORITHM STANDARD",&
05955             default_i_val=diag_standard,&
05956             enum_c_vals=s2a( "STANDARD","OT", "LANCZOS","DAVIDSON" ),&
05957             enum_desc=s2a("Standard diagonalization: LAPACK methods or Jacobi.",&
05958                           "Iterative diagonalization using OT method",&
05959                           "Block Krylov-space approach to self-consistent diagonalisation",&
05960                           "Preconditioned blocked Davidson"),&
05961             enum_i_vals=(/diag_standard, diag_ot, diag_block_krylov, diag_block_davidson/),&
05962             error=error)
05963        CALL section_add_keyword(section,keyword,error=error)
05964        CALL keyword_release(keyword,error=error)
05965 
05966        CALL keyword_create(keyword, name="JACOBI_THRESHOLD",&
05967             description="Controls the accuracy of the pseudo-diagonalization method using Jacobi rotations",&
05968             usage="JACOBI_THRESHOLD 1.0E-6",&
05969             default_r_val=1.0E-7_dp,&
05970             citations=(/Stewart1982/),&
05971             error=error)
05972        CALL section_add_keyword(section,keyword,error=error)
05973        CALL keyword_release(keyword,error=error)
05974 
05975        CALL keyword_create(keyword, name="EPS_JACOBI",&
05976             description="Below this threshold value for the SCF convergence the pseudo-diagonalization "//&
05977                         "method using Jacobi rotations is activated. This method is much faster than a "//&
05978                         "real diagonalization and it is even speeding up while achieving full convergence."//&
05979                         "However, it needs a pre-converged wavefunction obtained by at least one real "//&
05980                         "diagonalization which is further optimized while keeping the original eigenvalue "//&
05981                         "spectrum. The MO eigenvalues are NOT updated. The method might be useful to speed "//&
05982                         "up calculations for large systems e.g. using a semi-empirical method.",&
05983             usage="EPS_JACOBI 1.0E-5",&
05984             default_r_val=0.0_dp,&
05985             citations=(/Stewart1982/),&
05986             error=error)
05987        CALL section_add_keyword(section,keyword,error=error)
05988        CALL keyword_release(keyword,error=error)
05989 
05990        CALL keyword_create(keyword, name="EPS_ADAPT",&
05991             description="Required accuracy in iterative diagonalization as compared to current SCF convergence",&
05992             usage="EPS_ADAPT 0.01",&
05993             default_r_val=0._dp,&
05994             error=error)
05995        CALL section_add_keyword(section,keyword,error=error)
05996        CALL keyword_release(keyword,error=error)
05997 
05998        CALL keyword_create(keyword, name="MAX_ITER",&
05999             description="Maximum number of iterations in iterative diagonalization",&
06000             usage="MAX_ITER 20",&
06001             default_i_val=2,&
06002             error=error)
06003        CALL section_add_keyword(section,keyword,error=error)
06004        CALL keyword_release(keyword,error=error)
06005 
06006        CALL keyword_create(keyword, name="EPS_ITER",&
06007             description="Required accuracy in iterative diagonalization",&
06008             usage="EPS_ITER 1.e-8",&
06009             default_r_val=1.e-8_dp,&
06010             error=error)
06011        CALL section_add_keyword(section,keyword,error=error)
06012        CALL keyword_release(keyword,error=error)
06013 
06014 
06015        NULLIFY(subsection)
06016        CALL create_ot_section(subsection,error)
06017        CALL section_add_subsection(section,subsection,error=error)
06018        CALL section_release(subsection,error=error)
06019 
06020 
06021        NULLIFY(subsection)
06022        CALL create_krylov_section(subsection,error)
06023        CALL section_add_subsection(section,subsection,error=error)
06024        CALL section_release(subsection,error=error)
06025 
06026        NULLIFY(subsection)
06027        CALL create_diag_subspace_section(subsection,error)
06028        CALL section_add_subsection(section,subsection,error=error)
06029        CALL section_release(subsection,error=error)
06030 
06031        NULLIFY(subsection)
06032        CALL create_davidson_section(subsection,error)
06033        CALL section_add_subsection(section,subsection,error=error)
06034        CALL section_release(subsection,error=error)
06035 
06036     END IF
06037 
06038   END SUBROUTINE create_diagonalization_section
06039 
06040 
06041   SUBROUTINE create_davidson_section(section,error)
06042     TYPE(section_type), POINTER              :: section
06043     TYPE(cp_error_type), INTENT(inout)       :: error
06044 
06045     CHARACTER(len=*), PARAMETER :: routineN = 'create_davidson_section', 
06046       routineP = moduleN//':'//routineN
06047 
06048     LOGICAL                                  :: failure
06049     TYPE(keyword_type), POINTER              :: keyword
06050 
06051     failure = .FALSE.
06052     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
06053     IF (.NOT. failure) THEN
06054        CALL section_create(section,"DAVIDSON",&
06055             description=" ",&
06056             n_keywords=2, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
06057             error=error)
06058 
06059        NULLIFY(keyword)
06060 
06061        CALL keyword_create(keyword, name="PRECONDITIONER",&
06062             description="Type of preconditioner to be used with all minimization schemes. ",&
06063             usage="PRECONDITIONER FULL_ALL",&
06064             default_i_val=ot_precond_full_all,&
06065             enum_c_vals=s2a("FULL_ALL","FULL_SINGLE_INVERSE","NONE"),&
06066             enum_desc=s2a("Most effective state selective preconditioner based on diagonalization ",&
06067             "Based on H-eS cholesky inversion, similar to FULL_SINGLE in preconditioning efficiency "//&
06068             "but cheaper to construct, might be somewhat less robust. Recommended for large systems.",&
06069             "skip preconditioning"),&
06070             enum_i_vals=(/ot_precond_full_all,ot_precond_full_single_inverse,ot_precond_none/),&
06071             citations=(/VandeVondele2003/),&
06072             error=error)
06073        CALL section_add_keyword(section,keyword,error=error)
06074        CALL keyword_release(keyword,error=error)
06075 
06076        CALL keyword_create(keyword, name="PRECOND_SOLVER",&
06077             description="How the preconditioner is applied to the residual.",&
06078             usage="PRECOND_SOLVER DIRECT",&
06079             default_i_val=ot_precond_solver_default,&
06080             enum_c_vals=s2a( "DEFAULT", "DIRECT", "INVERSE_CHOLESKY","SAINV"),&
06081             enum_desc=s2a("the default","Cholesky decomposition followed by triangular solve "//&
06082             "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)",&
06083             "Cholesky decomposition followed by explicit inversion "//&
06084             "(works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)",&
06085             "SAINV inversion (works for FULL_KINETIC/SINGLE_INVERSE/S_INVERSE)"),&
06086             enum_i_vals=(/ot_precond_solver_default,&
06087             ot_precond_solver_direct,&
06088             ot_precond_solver_inv_chol,&
06089             ot_precond_solver_sainv/),&
06090             error=error)
06091        CALL section_add_keyword(section,keyword,error=error)
06092        CALL keyword_release(keyword,error=error)
06093 
06094        CALL keyword_create(keyword, name="ENERGY_GAP",&
06095             description="Should be an estimate for the energy gap [a.u.] (HOMO-LUMO) and is used in preconditioning, "//&
06096             "especially effective with the FULL_ALL preconditioner, in which case it should be an underestimate "//&
06097             "of the gap (0.001 doing normally fine). For the other preconditioners, making this value larger (0.2)"//&
06098             " will tame the preconditioner in case of poor initial guesses.",&
06099             usage="ENERGY_GAP 0.001",&
06100             default_r_val=0.2_dp,error=error)
06101        CALL section_add_keyword(section,keyword,error=error)
06102        CALL keyword_release(keyword,error=error)
06103 
06104        CALL keyword_create(keyword, name="NEW_PREC_EACH",&
06105             description="Number of SCF iterations after which a new Preconditioner is computed",&
06106             usage="NEW_PREC_EACH 10", default_i_val=20,error=error)
06107        CALL section_add_keyword(section,keyword,error=error)
06108        CALL keyword_release(keyword,error=error)
06109 
06110        CALL keyword_create(keyword, name="FIRST_PREC",&
06111             description="First SCF iteration at which a Preconditioner is employed",&
06112             usage="FIRST_PREC 1", default_i_val=1,error=error)
06113        CALL section_add_keyword(section,keyword,error=error)
06114        CALL keyword_release(keyword,error=error)
06115 
06116        CALL keyword_create(keyword, name="CONV_MOS_PERCENT",&
06117             description="Minimal percent of MOS that have to converge within the Davidson loop"//&
06118             " before the SCF iteration is completed and a new Hamiltonian is computed",&
06119             usage="CONV_MOS_PERCENT 0.8", default_r_val=0.5_dp,error=error)
06120        CALL section_add_keyword(section,keyword,error=error)
06121        CALL keyword_release(keyword,error=error)
06122 
06123        CALL keyword_create(keyword, name="SPARSE_MOS",&
06124             description="Use MOS as sparse matrix and avoid as much as possible multiplications with full matrices",&
06125             usage="SPARSE_MOS",default_l_val=.TRUE.,&
06126             lone_keyword_l_val=.TRUE.,error=error)
06127        CALL section_add_keyword(section,keyword,error=error)
06128        CALL keyword_release(keyword,error=error)
06129 
06130     END IF
06131 
06132   END SUBROUTINE create_davidson_section
06133 
06134   SUBROUTINE create_krylov_section(section,error)
06135     TYPE(section_type), POINTER              :: section
06136     TYPE(cp_error_type), INTENT(inout)       :: error
06137 
06138     CHARACTER(len=*), PARAMETER :: routineN = 'create_krylov_section', 
06139       routineP = moduleN//':'//routineN
06140 
06141     LOGICAL                                  :: failure
06142     TYPE(keyword_type), POINTER              :: keyword
06143 
06144     failure = .FALSE.
06145     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
06146     IF (.NOT. failure) THEN
06147        CALL section_create(section,"KRYLOV",&
06148             description=" ",&
06149             n_keywords=2, n_subsections=0, repeats=.FALSE., required=.FALSE.,&
06150             error=error)
06151 
06152        NULLIFY(keyword)
06153 
06154        CALL keyword_create(keyword, name="NKRYLOV",&
06155             description="Dimension of the Krylov space used for the Lanczos refinement",&
06156             usage="NKRYLOV 20",&
06157             default_i_val=4,&
06158             error=error)
06159        CALL section_add_keyword(section,keyword,error=error)
06160        CALL keyword_release(keyword,error=error)
06161 
06162        CALL keyword_create(keyword, name="NBLOCK",&
06163             description="Size of the block of vectors refined simultaneously by the Lanczos procedure",&
06164             usage="NBLOCK 1",&
06165             default_i_val=32,&
06166             error=error)
06167        CALL section_add_keyword(section,keyword,error=error)
06168        CALL keyword_release(keyword,error=error)
06169 
06170        CALL keyword_create(keyword, name="EPS_KRYLOV",&
06171             description="Convergence criterion for the MOs",&
06172             usage="EPS_KRYLOV 0.00001",&
06173             default_r_val=0.0000001_dp,&
06174             error=error)
06175        CALL section_add_keyword(section,keyword,error=error)
06176        CALL keyword_release(keyword,error=error)
06177 
06178        CALL keyword_create(keyword, name="EPS_STD_DIAG",&
06179             description="Level of convergence to be reached before starting the Lanczos procedure."//&
06180             " Above this threshold a standard diagonalization method is used. "//&
06181             " If negative Lanczos is started at the first iteration",&
06182             usage="EPS_STD_DIAG 0.001",&
06183             default_r_val=-1.0_dp,&
06184             error=error)
06185        CALL section_add_keyword(section,keyword,error=error)
06186        CALL keyword_release(keyword,error=error)
06187 
06188        CALL keyword_create(keyword, name="CHECK_MOS_CONV",&
06189             description="This requires to check the convergence of MOS also when standard "//&
06190             "diagonalization steps are performed, if the block krylov approach is active.",&
06191             usage="CHECK_MOS_CONV T",&
06192             default_l_val=.FALSE.,&
06193             lone_keyword_l_val=.TRUE.,&
06194             error=error)
06195        CALL section_add_keyword(section,keyword,error=error)
06196        CALL keyword_release(keyword,error=error)
06197 
06198 
06199     END IF
06200   END SUBROUTINE create_krylov_section
06201 
06202 
06203   SUBROUTINE create_diag_subspace_section(section,error)
06204     TYPE(section_type), POINTER              :: section
06205     TYPE(cp_error_type), INTENT(inout)       :: error
06206 
06207     CHARACTER(len=*), PARAMETER :: routineN = 'create_diag_subspace_section', 
06208       routineP = moduleN//':'//routineN
06209 
06210     LOGICAL                                  :: failure
06211     TYPE(keyword_type), POINTER              :: keyword
06212     TYPE(section_type), POINTER              :: subsection
06213 
06214     failure = .FALSE.
06215     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
06216     IF (.NOT. failure) THEN
06217        CALL section_create(section,"DIAG_SUB_SCF",&
06218             description="Activation of self-consistenf subspace refinement by diagonalization "//&
06219             "of H by adjusting the occupation but keeping the MOS unchanged.",&
06220             n_keywords=2, n_subsections=1, repeats=.FALSE., required=.FALSE.,&
06221             error=error)
06222 
06223        NULLIFY(keyword, subsection)
06224 
06225        CALL keyword_create(keyword, name="_SECTION_PARAMETERS_",&
06226             description="controls the activation of inner SCF loop to refine occupations in MOS subspace",&
06227             usage="&DIAG_SUB_SCF T",&
06228             default_l_val=.FALSE.,&
06229             lone_keyword_l_val=.TRUE.,&
06230             error=error)
06231        CALL section_add_keyword(section,keyword,error=error)
06232        CALL keyword_release(keyword,error=error)
06233 
06234        CALL keyword_create(keyword, name="MAX_ITER",&
06235             description="Maximum number of iterations for the SCF inner loop",&
06236             usage="MAX_ITER 20",&
06237             default_i_val=2,&
06238             error=error)
06239        CALL section_add_keyword(section,keyword,error=error)
06240        CALL keyword_release(keyword,error=error)
06241 
06242        CALL keyword_create(keyword, name="EPS_ENE",&
06243             description="Required energy accuracy for convergence of subspace diagonalization",&
06244             usage="EPS_ENE 1.e-8",&
06245             default_r_val=1.e-4_dp,&
06246             error=error)
06247        CALL section_add_keyword(section,keyword,error=error)
06248        CALL keyword_release(keyword,error=error)
06249 
06250        CALL keyword_create(keyword, name="EPS_ADAPT_SCF",&
06251             description="Required density matrix accuracy as compared to current SCF convergence",&
06252             usage="EPS_ADAPT_SCF 1.e-1",&
06253             default_r_val=1._dp,&
06254             error=error)
06255        CALL section_add_keyword(section,keyword,error=error)
06256        CALL keyword_release(keyword,error=error)
06257 
06258        CALL keyword_create(keyword, name="EPS_SKIP_SUB_DIAG",&
06259             description="Level of convergence to be reached before starting the internal loop of subspace rotations."//&
06260             " Above this threshold only the outer diagonalization method is used. "//&
06261             " If negative the subspace rotation is started at the first iteration",&
06262             usage="EPS_SKIP_SUB_DIAG 0.001",&
06263             default_r_val=-1.0_dp,&
06264             error=error)
06265        CALL section_add_keyword(section,keyword,error=error)
06266        CALL keyword_release(keyword,error=error)
06267 
06268        CALL create_mixing_section(subsection,error)
06269        CALL section_add_subsection(section,subsection,error=error)
06270        CALL section_release(subsection,error=error)
06271     END IF
06272   END SUBROUTINE create_diag_subspace_section
06273 
06274 ! *****************************************************************************
06279   SUBROUTINE create_xas_section(section,error)
06280     TYPE(section_type), POINTER              :: section
06281     TYPE(cp_error_type), INTENT(inout)       :: error
06282 
06283     CHARACTER(len=*), PARAMETER :: routineN = 'create_xas_section', 
06284       routineP = moduleN//':'//routineN
06285 
06286     LOGICAL                                  :: failure
06287     TYPE(keyword_type), POINTER              :: keyword
06288     TYPE(section_type), POINTER              :: print_key, subsection
06289 
06290     failure=.FALSE.
06291 
06292     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
06293     IF (.NOT. failure) THEN
06294        CALL section_create(section,"xas",&
06295             description="Sets the method of choice to calculate core-level excitation spectra. "//&
06296             "The occupied states from  which we calculate the "//&
06297             "excitation should be specified. "//&
06298             "Localization of the orbitals may be useful.",&
06299             n_keywords=10, n_subsections=1, repeats=.FALSE., required=.TRUE.,&
06300             citations=(/Iannuzzi2007/),&
06301             error=error)
06302 
06303        NULLIFY(keyword,subsection,print_key)
06304 
06305        CALL keyword_create(keyword, name="_SECTION_PARAMETERS_",&
06306             description="controls the activation of core-level spectroscopy simulations",&
06307             usage="&XAS T",&
06308             default_l_val=.FALSE.,&
06309             lone_keyword_l_val=.TRUE.,&
06310             error=error)
06311        CALL section_add_keyword(section,keyword,error=error)
06312        CALL keyword_release(keyword,error=error)
06313 
06314        CALL keyword_create(keyword, name="METHOD",&
06315             variants=(/"XAS_METHOD"/),&
06316             description="Method to be used to calculate core-level excitation spectra",&
06317             usage="METHOD TP_HH",&
06318             default_i_val=xas_none,&
06319             enum_c_vals=s2a( "NONE", "TP_HH", "TP_FH", "TP_VAL", "TP_XHH","TP_XFH", "DSCF"),&
06320             enum_desc=s2a(&
06321             "No core electron spectroscopy", "Transition potential half-hole",&
06322             "Transition potential full-hole", "Hole in homo for X-ray emission only " , &
06323             "Transition potential excited half-hole", &
06324             "Transition potential excited full-hole " , &
06325             "DSCF calculations to compute the first (core)excited state"),&
06326             enum_i_vals=(/xas_none,xas_tp_hh,xas_tp_fh,xes_tp_val,xas_tp_xhh,&
06327             xas_tp_xfh,xas_dscf/), error=error)
06328        CALL section_add_keyword(section,keyword,error=error)
06329        CALL keyword_release(keyword,error=error)
06330 
06331        CALL keyword_create(keyword, name="XES_CORE",&
06332             description="occupation of the core state in XES calculation by TP_VAL."//&
06333             "The homo is emptied by the same amount",&
06334             usage="XES_CORE 0.5",&
06335             default_r_val=1._dp,error=error)
06336        CALL section_add_keyword(section,keyword,error=error)
06337        CALL keyword_release(keyword,error=error)
06338 
06339        CALL keyword_create(keyword, name="DIPOLE_FORM",&
06340             variants=(/"DIP_FORM"/),&
06341             description="Type of integral to get the oscillator strengths "//&
06342             "in the diipole approximation",&
06343             usage="DIPOLE_FORM string",&
06344             default_i_val=xas_dip_vel,&
06345             enum_c_vals=s2a( "LENGTH","VELOCITY" ),&
06346             enum_desc=s2a("Length form <i|e r |j>","Velocity form <i|d/dr|j>"),&
06347             enum_i_vals=(/xas_dip_len2,xas_dip_vel/),error=error)
06348        CALL section_add_keyword(section,keyword,error=error)
06349 
06350        CALL keyword_release(keyword,error=error)
06351        CALL keyword_create(keyword, name="SCF_OPTIMIZER",&
06352             description="Optimization algorithm: diagonalization or OT",&
06353             usage="SCF_OPTIMIZER GENERAL",&
06354             default_i_val=xas_scf_general,&
06355             enum_c_vals=s2a( "DEFAULT", "GENERAL"),&
06356             enum_desc=s2a("same as in std SCF", "diagonalization"),&
06357             enum_i_vals=(/xas_scf_default,xas_scf_general/),&
06358             error=error)
06359        CALL section_add_keyword(section,keyword,error=error)
06360        CALL keyword_release(keyword,error=error)
06361 
06362        CALL keyword_create(keyword, name="MAXSTEP",&
06363             description="Max # of steps in the cls-scf for one excitation",&
06364             usage="MAXSTEP 150",&
06365             default_i_val=150,error=error)
06366        CALL section_add_keyword(section,keyword,error=error)
06367        CALL keyword_release(keyword,error=error)
06368 
06369        CALL keyword_create(keyword, name="CONVERGENCE",&
06370             variants=(/"CONV"/),&
06371             description="Convergence criterion for the xas-scf",&
06372             usage="CONVERGENCE 0.00005",&
06373             default_r_val=0.5E-6_dp,error=error)
06374        CALL section_add_keyword(section,keyword,error=error)
06375        CALL keyword_release(keyword,error=error)
06376 
06377        CALL keyword_create(keyword, name="EPS_DIIS",&
06378             description="treshold on the convergence to start"//&
06379             " using DIAG/DIIS for the cls-scf"//&
06380             "if default, the scf_control value is used",&
06381             usage="EPS_DIIS 0.5",&
06382             default_r_val=-1._dp,error=error)
06383        CALL section_add_keyword(section,keyword,error=error)
06384        CALL keyword_release(keyword,error=error)
06385 
06386        CALL keyword_create(keyword, name="STATE_TYPE",&
06387             variants=(/"TYPE"/),&
06388             description="Type of the orbitas that are excited for the xas spectra calculation",&
06389             usage="STATE_TYPE 1S",&
06390             default_i_val=xas_1s_type,&
06391             enum_c_vals=s2a("1S","2S","2P"),&
06392             enum_desc=s2a("1s orbitals","2s orbitals","2p orbitals"),&
06393             enum_i_vals=(/xas_1s_type,xas_2s_type,xas_2p_type/),&
06394             error=error)
06395        CALL section_add_keyword(section,keyword,error=error)
06396        CALL keyword_release(keyword,error=error)
06397 
06398        CALL keyword_create(keyword, name="STATE_SEARCH",&
06399             description="# of states where to look for the one to be excited",&
06400             usage="STATE_SEARCH 1",&
06401             default_i_val=-1,error=error)
06402        CALL section_add_keyword(section,keyword,error=error)
06403        CALL keyword_release(keyword,error=error)
06404 
06405        CALL keyword_create(keyword,name="ATOMS_LIST",&
06406             variants=(/"AT_LIST"/),&
06407             description="Indexes of the atoms to be excited"//&
06408             "This keyword can be repeated several times"//&
06409             "(useful if you have to specify many indexes).",&
06410             usage="ATOMS_LIST {integer}  {integer} ..  {integer} ",&
06411             n_var=-1,type_of_var=integer_t,required=.TRUE.,repeats=.TRUE.,error=error)
06412        CALL section_add_keyword(section,keyword,error=error)
06413        CALL keyword_release(keyword,error=error)
06414 
06415        CALL keyword_create(keyword, name="ADDED_MOS",&
06416             description="Number of additional MOS added spin up only",&
06417             usage="ADDED_MOS {integer}", default_i_val=-1,error=error)
06418        CALL section_add_keyword(section,keyword,error=error)
06419        CALL keyword_release(keyword,error=error)
06420 
06421        CALL keyword_create(keyword, name="MAX_ITER_ADDED",&
06422             description="maximum number of iteration in calculation of added orbitals",&
06423             usage="MAX_ITER_ADDED 100", default_i_val=2999,error=error)
06424        CALL section_add_keyword(section,keyword,error=error)
06425        CALL keyword_release(keyword,error=error)
06426 
06427        CALL keyword_create(keyword, name="EPS_ADDED",&
06428             description="target accuracy incalculation of the added orbitals",&
06429             usage="EPS_ADDED 1.e-6", default_r_val=1.0e-5_dp,error=error)
06430        CALL section_add_keyword(section,keyword,error=error)
06431        CALL keyword_release(keyword,error=error)
06432 
06433        CALL keyword_create(keyword, name="NGAUSS",&
06434             description="Number of gto's for the expansion of the sto"//&
06435             "of the type given by STATE_TYPE",&
06436             usage="NGAUSS {integer}", default_i_val=3,error=error)
06437        CALL section_add_keyword(section,keyword,error=error)
06438        CALL keyword_release(keyword,error=error)
06439 
06440        CALL keyword_create(keyword, name="RESTART",&
06441             description="Restart the excited state if the restart file exists",&
06442             usage="RESTART",&
06443             default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
06444        CALL section_add_keyword(section,keyword,error=error)
06445        CALL keyword_release(keyword,error=error)
06446 
06447        CALL keyword_create(keyword, name="WFN_RESTART_FILE_NAME",&
06448             variants=(/"RESTART_FILE_NAME"/),&
06449             description="Root of the file names where to read the MOS from"//&
06450             "which to restart the calculation of the core level excited states",&
06451             usage="WFN_RESTART_FILE_NAME <FILENAME>",&
06452             type_of_var=lchar_t,&
06453             error=error)
06454        CALL section_add_keyword(section,keyword,error=error)
06455        CALL keyword_release(keyword,error=error)
06456 
06457        CALL create_localize_section(subsection,error)
06458        CALL section_add_subsection(section, subsection, error=error)
06459        CALL section_release(subsection,error=error)
06460 
06461        CALL section_create(subsection,"PRINT",&
06462             "printing of information during the core-level spectroscopy simulation",&
06463             error=error,repeats=.FALSE.,required=.FALSE.)
06464 
06465        ! Add printing of wannier infos
06466        CALL print_wanniers(subsection, error)
06467 
06468        CALL cp_print_key_section_create(print_key,"iteration_info",&
06469             description="Controls the printing of basic iteration information during the xas scf.", &
06470             print_level=low_print_level,filename="__STD_OUT__",&
06471             error=error)
06472        CALL keyword_create(keyword, name="time_cumul",&
06473             description="If the printkey is activated switches the printing of timings"//&
06474             " to cumulative (over the scf).",&
06475             default_l_val=.FALSE., lone_keyword_l_val=.TRUE., error=error)
06476        CALL section_add_keyword(print_key,keyword,error=error)
06477        CALL keyword_release(keyword,error=error)
06478        CALL section_add_subsection(subsection,print_key,error=error)
06479        CALL section_release(print_key,error=error)
06480 
06481        CALL cp_print_key_section_create(print_key,"program_run_info",&
06482             description="Controls the printing of basic iteration information in CLS", &
06483             print_level=low_print_level,add_last=add_last_numeric,filename="__STD_OUT__",&
06484             error=error)
06485        CALL section_add_subsection(subsection,print_key,error=error)
06486        CALL section_release(print_key,error=error)
06487 
06488        CALL cp_print_key_section_create(print_key,"XES_SPECTRUM",&
06489             description="Controls the dumping of the CLS output files containing the emission spectra",&
06490             print_level=low_print_level,common_iter_levels=3,filename="",&
06491             error=error)
06492        CALL section_add_subsection(subsection,print_key,error=error)
06493        CALL section_release(print_key,error=error)
06494 
06495        CALL cp_print_key_section_create(print_key,"XAS_SPECTRUM",&
06496             description="Controls the dumping of the CLS output files containing the absorption spectra",&
06497             print_level=low_print_level,common_iter_levels=3,filename="",&
06498             error=error)
06499        CALL section_add_subsection(subsection,print_key,error=error)
06500        CALL section_release(print_key,error=error)
06501 
06502        CALL cp_print_key_section_create(print_key,"RESTART",&
06503             description="Controls the dumping of MO restart file during the scf"//&
06504             "of a Core-Level-Spectroscopy calculation. For each new excited atom,"//&
06505             "one different restart file is dumped. These restart files should be"//&
06506             "employed only to restart the same type of CLS calculation, "//&
06507             "i.e. with the same core potential.", &
06508             print_level=low_print_level,common_iter_levels=3,each_iter_names=s2a("XAS_SCF"),&
06509             add_last=add_last_numeric,each_iter_values=(/3/),filename="",error=error)
06510        CALL section_add_subsection(subsection,print_key,error=error)
06511        CALL section_release(print_key,error=error)
06512 
06513        CALL cp_print_key_section_create(print_key,"CLS_FUNCTION_CUBES",&
06514             description="Controls the printing of the relaxed orbitals ", &
06515             print_level=high_print_level,common_iter_levels=3,add_last=add_last_numeric,filename="",&
06516             error=error)
06517        CALL keyword_create(keyword, name="stride",&
06518             description="The stride (X,Y,Z) used to write the cube file "//&
06519             "(larger values result in smaller cube files). You can provide 3 numbers (for X,Y,Z) or"//&
06520             " 1 number valid for all components.",&
06521             usage="STRIDE 2 2 2",n_var=-1,default_i_vals=(/2,2,2/), type_of_var=integer_t,error=error)
06522        CALL section_add_keyword(print_key,keyword,error=error)
06523        CALL keyword_release(keyword,error=error)
06524 
06525        CALL keyword_create(keyword,name="CUBES_LU_BOUNDS",&
06526             variants=(/"CUBES_LU"/),&
06527             description="The lower and upper index of the states to be printed as cube",&
06528             usage="CUBES_LU_BOUNDS integer integer",&
06529             n_var=2,default_i_vals=(/0,-2/), type_of_var=integer_t,error=error)
06530        CALL section_add_keyword(print_key,keyword,error=error)
06531        CALL keyword_release(keyword,error=error)
06532 
06533        CALL keyword_create(keyword,name="CUBES_LIST",&
06534             description="Indexes of the states to be printed as cube files"//&
06535             "This keyword can be repeated several times"//&
06536             "(useful if you have to specify many indexes).",&
06537             usage="CUBES_LIST 1 2",&
06538             n_var=-1,type_of_var=integer_t,repeats=.TRUE.,error=error)
06539        CALL section_add_keyword(print_key,keyword,error=error)
06540        CALL keyword_release(keyword,error=error)
06541        CALL keyword_create(keyword, name="APPEND",&
06542             description="append the cube files when they already exist",&
06543             default_l_val=.FALSE., lone_keyword_l_val=.TRUE.,error=error)
06544        CALL section_add_keyword(print_key,keyword,error=error)
06545        CALL keyword_release(keyword,error=error)
06546 
06547        CALL section_add_subsection(subsection,print_key,error=error)
06548        CALL section_release(print_key,error=error)
06549 
06550        CALL section_add_subsection(section, subsection, error=error)
06551        CALL section_release(subsection,error=error)
06552 
06553        CALL create_mixing_section(subsection,error)
06554        CALL section_add_subsection(section,subsection,error=error)
06555        CALL section_release(subsection,error=error)
06556 
06557        CALL create_smear_section(subsection,error)
06558        CALL section_add_subsection(section,subsection,error=error)
06559        CALL section_release(subsection,error=error)
06560 
06561     END IF
06562   END SUBROUTINE create_xas_section
06563 
06564 ! *****************************************************************************
06570   SUBROUTINE create_smear_section(section,error)
06571 
06572     TYPE(section_type), POINTER              :: section
06573     TYPE(cp_error_type), INTENT(INOUT)       :: error
06574 
06575     CHARACTER(LEN=*), PARAMETER :: routineN = 'create_smear_section', 
06576       routineP = moduleN//':'//routineN
06577 
06578     LOGICAL                                  :: failure
06579     TYPE(keyword_type), POINTER              :: keyword
06580 
06581     failure = .FALSE.
06582 
06583     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
06584 
06585     IF (.NOT.failure) THEN
06586 
06587       CALL section_create(section,&
06588                           name="SMEAR",&
06589                           description="Define the smearing of the MO occupation numbers",&
06590                           n_keywords=6,&
06591                           n_subsections=0,&
06592                           repeats=.FALSE.,&
06593                           required=.FALSE.,&
06594                           error=error)
06595 
06596       NULLIFY (keyword)
06597 
06598       CALL keyword_create(keyword,&
06599                           name="_SECTION_PARAMETERS_",&
06600                           description="Controls the activation of smearing",&
06601                           usage="&SMEAR ON",&
06602                           default_l_val=.FALSE.,&
06603                           lone_keyword_l_val=.TRUE.,&
06604                           error=error)
06605       CALL section_add_keyword(section,keyword,error=error)
06606       CALL keyword_release(keyword,error=error)
06607 
06608       CALL keyword_create(keyword,&
06609                           name="METHOD",&
06610                           description="Smearing method to be applied",&
06611                           usage="METHOD Fermi_Dirac",&
06612                           default_i_val=smear_energy_window,&
06613                           enum_c_vals=s2a("FERMI_DIRAC","ENERGY_WINDOW","LIST"),&
06614                           enum_i_vals=(/smear_fermi_dirac,smear_energy_window,smear_list/),&
06615                           enum_desc=s2a("Fermi-Dirac distribution defined by the keyword ELECTRONIC_TEMPERATURE",&
06616                                         "Energy window defined by the keyword WINDOW_SIZE",&
06617                                         "Use a fixed list of occupations"),&
06618                           error=error)
06619       CALL section_add_keyword(section,keyword,error=error)
06620       CALL keyword_release(keyword,error=error)
06621 
06622       CALL keyword_create(keyword,&
06623                           name="LIST",&
06624                           description="A list of fractional occupations to use. Must match the number of states "//&
06625                                       "and sum up to the correct number of electrons",&
06626                           required=.FALSE.,&
06627                           repeats=.FALSE.,&
06628                           n_var=-1,&
06629                           type_of_var=real_t,&
06630                           usage="LIST 2.0 0.6666 0.6666 0.66666 0.0 0.0",&
06631                           error=error)
06632       CALL section_add_keyword(section,keyword,error=error)
06633       CALL keyword_release(keyword,error=error)
06634 
06635       CALL keyword_create(keyword,&
06636                           name="ELECTRONIC_TEMPERATURE",&
06637                           variants=s2a("ELEC_TEMP","TELEC"),&
06638                           description="Electronic temperature in the case of Fermi-Dirac smearing",&
06639                           required=.FALSE.,&
06640                           repeats=.FALSE.,&
06641                           n_var=1,&
06642                           type_of_var=real_t,&
06643                           default_r_val=cp_unit_to_cp2k(value=300.0_dp, unit_str="K", error=error),&
06644                           unit_str="K",&
06645                           usage="ELECTRONIC_TEMPERATURE [K] 300",&
06646                           error=error)
06647       CALL section_add_keyword(section,keyword,error=error)
06648       CALL keyword_release(keyword,error=error)
06649 
06650       CALL keyword_create(keyword,&
06651                           name="EPS_FERMI_DIRAC",&
06652                           description="Accuracy checks on occupation numbers use this as a tolerance",&
06653                           required=.FALSE.,&
06654                           repeats=.FALSE.,&
06655                           n_var=1,&
06656                           type_of_var=real_t,&
06657                           default_r_val=1.0E-10_dp,&
06658                           usage="EPS_FERMI_DIRAC 1.0E-6",&
06659                           error=error)
06660       CALL section_add_keyword(section,keyword,error=error)
06661       CALL keyword_release(keyword,error=error)
06662 
06663       CALL keyword_create(keyword,&
06664                           name="WINDOW_SIZE",&
06665                           description="Size of the energy window centred at the Fermi level",&
06666                           required=.FALSE.,&
06667                           repeats=.FALSE.,&
06668                           n_var=1,&
06669                           type_of_var=real_t,&
06670                           default_r_val=0.0_dp,&
06671                           unit_str="au_e",&
06672                           usage="WINDOW_SIZE [eV] 0.3",&
06673                           error=error)
06674       CALL section_add_keyword(section,keyword,error=error)
06675       CALL keyword_release(keyword,error=error)
06676 
06677       CALL keyword_create(keyword, name="FIXED_MAGNETIC_MOMENT",&
06678                           description="Imposed difference between the numbers of electrons of spin up "//&
06679                                       "and spin down: m = n(up) - n(down). A negative value (default) allows "//&
06680                                       "for a change of the magnetic moment. -1 specifically keeps an integer "//&
06681                                       "number of spin up and spin down electrons.",&
06682                           required=.FALSE.,&
06683                           repeats=.FALSE.,&
06684                           n_var=1,&
06685                           type_of_var=real_t,&
06686                           default_r_val=-100.0_dp,&
06687                           usage="FIXED_MAGNETIC_MOMENT 1.5",&
06688                           error=error)
06689       CALL section_add_keyword(section,keyword,error=error)
06690       CALL keyword_release(keyword,error=error)
06691 
06692     END IF
06693 
06694   END SUBROUTINE create_smear_section
06695 
06696 ! *****************************************************************************
06703   SUBROUTINE create_mixing_section(section,error)
06704 
06705     TYPE(section_type), POINTER              :: section
06706     TYPE(cp_error_type), INTENT(INOUT)       :: error
06707 
06708     CHARACTER(LEN=*), PARAMETER :: routineN = 'create_mixing_section', 
06709       routineP = moduleN//':'//routineN
06710 
06711     LOGICAL                                  :: failure
06712     TYPE(keyword_type), POINTER              :: keyword
06713 
06714     failure = .FALSE.
06715 
06716     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
06717 
06718     IF (.NOT.failure) THEN
06719 
06720       CALL section_create(section,&
06721                           name="MIXING",&
06722                           description="Define type and parameters for mixing"//&
06723                           "procedures to be applied to the density matrix. Normally, "//&
06724                           "only one type of mixing method should be accepted. The mixing "//&
06725                           "procedures activated by this section are only active for diagonalization "//&
06726                           "methods, i.e. not with minimization methods based on OT.",&
06727                           n_keywords=16,&
06728                           n_subsections=0,&
06729                           repeats=.FALSE.,&
06730                           required=.FALSE.,&
06731                           error=error)
06732 
06733       NULLIFY (keyword)
06734 
06735       CALL keyword_create(keyword,&
06736                           name="_SECTION_PARAMETERS_",&
06737                           description="Controls the activation of the mixing procedure",&
06738                           usage="&MIXING ON",&
06739                           default_l_val=.TRUE.,&
06740                           lone_keyword_l_val=.TRUE.,&
06741                           error=error)
06742       CALL section_add_keyword(section,keyword,error=error)
06743       CALL keyword_release(keyword,error=error)
06744 
06745       CALL keyword_create(keyword,&
06746                           name="METHOD",&
06747                           description="Mixing method to be applied",&
06748                           required=.FALSE.,&
06749                           repeats=.FALSE.,&
06750                           usage="METHOD KERKER_MIXING",&
06751                           default_i_val=direct_p_mix,&
06752                           enum_c_vals=s2a("NONE",&
06753                                           "DIRECT_P_MIXING",&
06754                                           "KERKER_MIXING",&
06755                                           "PULAY_MIXING",&
06756                                           "BROYDEN_MIXING",&
06757                                           "BROYDEN_MIXING_NEW",&
06758                                           "MULTISECANT_MIXING"),&
06759                           enum_i_vals=(/no_mix,direct_p_mix,kerker_mix,pulay_mix,broy_mix,&
06760                           broy_mix_new,multisec_mix/),&
06761                           enum_desc=s2a("No mixing is applied",&
06762                              "Direct mixing of new and old density matrices",&
06763                              "Mixing of the potential in reciprocal space using the Kerker damping",&
06764                              "Pulay mixing","Broyden mixing","Broyden mixing second version",&
06765                              "Multisecant scheme for mixing" ),&
06766                           error=error)
06767       CALL section_add_keyword(section,keyword,error=error)
06768       CALL keyword_release(keyword,error=error)
06769 
06770       CALL keyword_create(keyword,&
06771                           name="ALPHA",&
06772                           description="Fraction of new density to be included",&
06773                           required=.FALSE.,&
06774                           repeats=.FALSE.,&
06775                           n_var=1,&
06776                           type_of_var=real_t,&
06777                           default_r_val=0.4_dp,&
06778                           usage="ALPHA 0.2",&
06779                           error=error)
06780       CALL section_add_keyword(section,keyword,error=error)
06781       CALL keyword_release(keyword,error=error)
06782 
06783       CALL keyword_create(keyword,&
06784                           name="BETA",&
06785                           description="Denominator parameter in Kerker damping "//&
06786                              "introduced to suppress charge sloshing: rho_mix(g) ="//&
06787                              "rho_in(g) + alpha*g^2/(g^2 + beta^2)*(rho_out(g)-"//&
06788                              "rho_in(g))",&
06789                           required=.FALSE.,&
06790                           repeats=.FALSE.,&
06791                           n_var=1,&
06792                           type_of_var=real_t,&
06793                           default_r_val=0.5_dp,&
06794                           unit_str="bohr^-1",&
06795                           usage="BETA 1.5",&
06796                           error=error)
06797       CALL section_add_keyword(section,keyword,error=error)
06798       CALL keyword_release(keyword,error=error)
06799 
06800       CALL keyword_create(keyword,&
06801                           name="PULAY_ALPHA",&
06802                           description="Fraction of new density to be added to the Pulay expansion",&
06803                           required=.FALSE.,&
06804                           repeats=.FALSE.,&
06805                           n_var=1,&
06806                           type_of_var=real_t,&
06807                           default_r_val=0.0_dp,&
06808                           usage="PULAY_ALPHA 0.2",&
06809                           error=error)
06810       CALL section_add_keyword(section,keyword,error=error)
06811       CALL keyword_release(keyword,error=error)
06812 
06813       CALL keyword_create(keyword,&
06814                           name="PULAY_BETA",&
06815                           description="Fraction of residual contribution to be added to Pulay expansion",&
06816                           required=.FALSE.,&
06817                           repeats=.FALSE.,&
06818                           n_var=1,&
06819                           type_of_var=real_t,&
06820                           default_r_val=1.0_dp,&
06821                           usage="PULAY_BETA 0.2",&
06822                           error=error)
06823       CALL section_add_keyword(section,keyword,error=error)
06824       CALL keyword_release(keyword,error=error)
06825 
06826       CALL keyword_create(keyword, name="NMIXING",&
06827             description="Minimal number of density mixing (should be greater than 0),"//&
06828             "before starting DIIS",&
06829             usage="NMIXING 1", default_i_val=2,error=error)
06830       CALL section_add_keyword(section,keyword,error=error)
06831       CALL keyword_release(keyword,error=error)
06832 
06833       CALL keyword_create(keyword, name="NBUFFER",&
06834                           variants=s2a("NPULAY","NBROYDEN","NMULTISECANT"),&
06835                           description="Number of previous steps stored for the actual mixing scheme",&
06836                           usage="NBUFFER 2", default_i_val=4,error=error)
06837       CALL section_add_keyword(section,keyword,error=error)
06838       CALL keyword_release(keyword,error=error)
06839 
06840       CALL keyword_create(keyword,&
06841                           name="BROY_W0",&
06842                           description=" w0 parameter used in Broyden mixing",&
06843                           required=.FALSE.,&
06844                           repeats=.FALSE.,&
06845                           n_var=1,&
06846                           type_of_var=real_t,&
06847                           default_r_val=0.01_dp,&
06848                           usage="BROY_W0 0.03",&
06849                           error=error)
06850       CALL section_add_keyword(section,keyword,error=error)
06851       CALL keyword_release(keyword,error=error)
06852 
06853       CALL keyword_create(keyword,&
06854                           name="BROY_WREF",&
06855                           description="",&
06856                           required=.FALSE.,&
06857                           repeats=.FALSE.,&
06858                           n_var=1,&
06859                           type_of_var=real_t,&
06860                           default_r_val=100.0_dp,&
06861                           usage="BROY_WREF 0.2",&
06862                           error=error)
06863       CALL section_add_keyword(section,keyword,error=error)
06864       CALL keyword_release(keyword,error=error)
06865 
06866       CALL keyword_create(keyword,&
06867                           name="BROY_WMAX",&
06868                           description="",&
06869                           required=.FALSE.,&
06870                           repeats=.FALSE.,&
06871                           n_var=1,&
06872                           type_of_var=real_t,&
06873                           default_r_val=30.0_dp,&
06874                           usage="BROY_WMAX 10.0",&
06875                           error=error)
06876       CALL section_add_keyword(section,keyword,error=error)
06877       CALL keyword_release(keyword,error=error)
06878 
06879       CALL keyword_create(keyword,&
06880                           name="REGULARIZATION",&
06881                           description="Regularization parameter to stabilize "//&
06882                           "the inversion of the residual matrix {Yn^t Yn} in the "//&
06883                           "multisecant mixing scheme (noise)",&
06884                           required=.FALSE.,&
06885                           repeats=.FALSE.,&
06886                           n_var=1,&
06887                           type_of_var=real_t,&
06888                           default_r_val=0.00001_dp,&
06889                           usage="REGULARIZATION 0.000001",&
06890                           error=error)
06891       CALL section_add_keyword(section,keyword,error=error)
06892       CALL keyword_release(keyword,error=error)
06893 
06894       CALL keyword_create(keyword,&
06895                           name="MAX_STEP",&
06896                           description="Upper bound for the magnitude of the "//&
06897                           "unpredicted step size in the update by the "//&
06898                           "multisecant mixing scheme",&
06899                           required=.FALSE.,&
06900                           repeats=.FALSE.,&
06901                           n_var=1,&
06902                           type_of_var=real_t,&
06903                           default_r_val=0.1_dp,&
06904                           usage="MAX_STEP .2",&
06905                           error=error)
06906       CALL section_add_keyword(section,keyword,error=error)
06907       CALL keyword_release(keyword,error=error)
06908 
06909       CALL keyword_create(keyword,&
06910                           name="R_FACTOR",&
06911                           description="Control factor for the magnitude of the "//&
06912                           "unpredicted step size in the update by the "//&
06913                           "multisecant mixing scheme",&
06914                           required=.FALSE.,&
06915                           repeats=.FALSE.,&
06916                           n_var=1,&
06917                           type_of_var=real_t,&
06918                           default_r_val=0.05_dp,&
06919                           usage="R_FACTOR .12",&
06920                           error=error)
06921       CALL section_add_keyword(section,keyword,error=error)
06922       CALL keyword_release(keyword,error=error)
06923 
06924       CALL keyword_create(keyword, name="NSKIP",&
06925                           variants=(/"NSKIP_MIXING"/),&
06926             description="Number of initial iteration for which the mixing is skipped",&
06927             usage="NSKIP 10", default_i_val=0,error=error)
06928       CALL section_add_keyword(section,keyword,error=error)
06929       CALL keyword_release(keyword,error=error)
06930 
06931       CALL keyword_create(keyword, name="N_SIMPLE_MIX",&
06932                           variants=(/"NSIMPLEMIX"/),&
06933             description="Number of kerker damping iterations before starting other mixing procedures",&
06934             usage="NSIMPLEMIX", default_i_val=0,error=error)
06935       CALL section_add_keyword(section,keyword,error=error)
06936       CALL keyword_release(keyword,error=error)
06937 
06938       CALL keyword_create(keyword, name="KERKER_MIN",&
06939                           description="Minimal Kerker damping factor: MAX(g^2/(g^2 + beta^2),KERKER_MIN)",&
06940                           required=.FALSE.,&
06941                           repeats=.FALSE.,&
06942                           n_var=1,&
06943                           type_of_var=real_t,&
06944                           default_r_val=0.1_dp,&
06945                           usage="KERKER_MIN 0.05",&
06946                           error=error)
06947       CALL section_add_keyword(section,keyword,error=error)
06948       CALL keyword_release(keyword,error=error)
06949 
06950       CALL keyword_create(keyword, name="MAX_GVEC_EXP",&
06951                           description="Restricts the G-space mixing to lower part of G-vector spectrum,"//&
06952                           " up to a G0, by assigning the exponent of the Gaussian that can be "//&
06953                           "represented by vectors smaller than G0 within a certain accuracy. ",&
06954                           required=.FALSE.,&
06955                           repeats=.FALSE.,&
06956                           n_var=1,&
06957                           type_of_var=real_t,&
06958                           default_r_val=-1._dp,&
06959                           usage="MAX_GVEC_EXP 3.",&
06960                           error=error)
06961       CALL section_add_keyword(section,keyword,error=error)
06962       CALL keyword_release(keyword,error=error)
06963 
06964     END IF
06965 
06966   END SUBROUTINE create_mixing_section
06967 
06968 ! *****************************************************************************
06969   SUBROUTINE create_rtp_section(section,error)
06970     TYPE(section_type), POINTER              :: section
06971     TYPE(cp_error_type), INTENT(inout)       :: error
06972 
06973     CHARACTER(len=*), PARAMETER :: routineN = 'create_rtp_section', 
06974       routineP = moduleN//':'//routineN
06975 
06976     LOGICAL                                  :: failure
06977     TYPE(keyword_type), POINTER              :: keyword
06978     TYPE(section_type), POINTER              :: print_key, print_section
06979 
06980     failure=.FALSE.
06981     NULLIFY(keyword)
06982     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
06983     IF (.NOT. failure) THEN
06984        CALL section_create(section,"REAL_TIME_PROPAGATION",&
06985             description="Parameters needed to set up the real time propagation"//&
06986             " for the electron dynamics",&
06987             n_keywords=4, n_subsections=4, repeats=.FALSE., required=.FALSE.,&
06988             citations=(/Kunert2003/),&
06989             error=error)
06990 
06991        CALL keyword_create(keyword, name="MAX_ITER",&
06992             description="Maximal number of iterations for the self consistent propagator loop.",&
06993             usage="MAX_ITER 10",&
06994             default_i_val=10,&
06995             error=error)
06996        CALL section_add_keyword(section,keyword,error=error)
06997        CALL keyword_release(keyword,error=error)
06998 
06999        CALL keyword_create(keyword, name="EPS_ITER",&
07000             description="Convergence criterium for the self consistent propagator loop.",&
07001             usage="EPS_ITER 1.0E-5",&
07002             default_r_val=1.0E-7_dp,&
07003             error=error)
07004        CALL section_add_keyword(section,keyword,error=error)
07005        CALL keyword_release(keyword,error=error)
07006 
07007        CALL keyword_create(keyword, name="ASPC_ORDER",&
07008             description="Speciefies how many steps will be used for extrapolation. "//&
07009             "One will be always used which is means X(t+dt)=X(t)",&
07010             usage="ASPC_ORDER 3",&
07011             default_i_val=3,&
07012             error=error)
07013        CALL section_add_keyword(section,keyword,error=error)
07014        CALL keyword_release(keyword,error=error)
07015 
07016        CALL keyword_create(keyword, name="EXTRAPOLATION",&
07017             description="Controls which quantity is extrapolated",&
07018             usage="EXTRAPOLATION MOS",default_i_val=extr_mos, &
07019             enum_c_vals=s2a("MOS","S_KS"),&
07020             enum_i_vals=(/extr_mos,extr_s_ks/),&
07021             enum_desc=s2a("Direct extrapolation on the MO matrices",&
07022             "Extrapolation on the Kohn-Sham matrix, resp. the exponential in case of ETRS"),&
07023             error=error)
07024        CALL section_add_keyword(section,keyword,error=error)
07025        CALL keyword_release(keyword,error=error)
07026 
07027        CALL keyword_create(keyword, name="MAT_EXP",&
07028             description="Which method should be used to calculate the exponential"//&
07029             " in the propagator. For Ehrenfest MD only the Taylor method works, "//&
07030             "for real time propagation diagonalization works as well.",&
07031             usage="MAT_EXP TAYLOR",default_i_val=do_arnoldi, &
07032             enum_c_vals=s2a("TAYLOR","DIAG","PADE","ARNOLDI"),&
07033             enum_i_vals=(/do_taylor,do_diag,do_pade,do_arnoldi/),&
07034             enum_desc=s2a("exponential is evaluated using scaling and squaring in combination"//&
07035             " with a taylor expansion of the exponential.",&
07036             "uses the eignvalues an eigenvectors to calculate the exponential.",&
07037             "uses scaling and squaring together with the pade approximation",&
07038             "uses arnoldi subspace algorithm to compute exp(H)*MO directly, can't be used in "//&
07039             "combination with Crank Nicholson"),&
07040             error=error)
07041        CALL section_add_keyword(section,keyword,error=error)
07042        CALL keyword_release(keyword,error=error)
07043 
07044        CALL keyword_create(keyword, name="SC_CHECK_START",&
07045             description="Speciefies how many iteration steps will be done without "//&
07046             "a check for self consistency. Can save some time in big calculations.",&
07047             usage="SC_CHECK_START 3",&
07048             default_i_val=0,&
07049             error=error)
07050        CALL section_add_keyword(section,keyword,error=error)
07051        CALL keyword_release(keyword,error=error)
07052 
07053        CALL keyword_create(keyword, name="EXP_ACCURACY",&
07054             description="Accuracy for the taylor and pade approximation. "//&
07055             "This is only an upper bound bound since the norm used for the guess "//&
07056             "is an upper bound for the needed one.",&
07057             usage="EXP_ACCURACY 1.0E-6",&
07058             default_r_val=1.0E-9_dp,&
07059             error=error)
07060        CALL section_add_keyword(section,keyword,error=error)
07061        CALL keyword_release(keyword,error=error)
07062 
07063        CALL keyword_create(keyword, name="PROPAGATOR",&
07064             description="Which propagator should be used for the orbitals",&
07065             usage="PROPAGATOR ETRS",default_i_val=do_etrs, &
07066             enum_c_vals=s2a("ETRS","CN","EM"),&
07067             enum_i_vals=(/do_etrs,do_cn,do_em/),&
07068             enum_desc=s2a("enforced time reversible symmetry",&
07069             "Crank Nicholson propagator",&
07070             "Exponential midpoint propagator"),&
07071             error=error)
07072        CALL section_add_keyword(section,keyword,error=error)
07073        CALL keyword_release(keyword,error=error)
07074 
07075        CALL keyword_create(keyword, name="INITIAL_WFN",&
07076             description="Controls the initial WFN used for propagation.",&
07077             usage="INITIAL_WFN SCF_WFN",default_i_val=use_scf_wfn, &
07078             enum_c_vals=s2a("SCF_WFN","RESTART_WFN","RT_RESTART"),&
07079             enum_i_vals=(/use_scf_wfn,use_restart_wfn,use_rt_restart/),&
07080             enum_desc=s2a("An SCF run is performed to get the initial state.",&
07081             "A wavefunction from a previous scf is propageted. Especially useful,"//&
07082             " if electronic constraints or restraints are used in the previous calculation, "//&
07083             "since these do not work in the rtp scheme.",&
07084             "use the wavefunction of a real time propagation/ehrenfest run"),&
07085             error=error)
07086        CALL section_add_keyword(section,keyword,error=error)
07087        CALL keyword_release(keyword,error=error)
07088 
07089        CALL keyword_create(keyword, name="APPLY_DELTA_PULSE",&
07090             description="Applies a delta kick to the initial wfn (only RTP for now - the EMD "//&
07091             " case is not yet implemented).",&
07092             usage="APPLY_DELTA_PULSE",&
07093             default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
07094        CALL section_add_keyword(section,keyword,error=error)
07095        CALL keyword_release(keyword,error=error)
07096 
07097        CALL keyword_create(keyword, name="PERIODIC",&
07098             description="Apply a delta-kick that is compatible with periodic boundary conditions"//&
07099             " for any value of DELTA_PULSE_SCALE. Uses perturbation theory for the preparation of"//&
07100             " the initial wfn. Note that the pulse is only applied when INITIAL_WFN is set to SCF_WFN,"//&
07101             " and not for restarts (RT_RESTART).",&
07102             usage="PERIODIC",&
07103             default_l_val=.TRUE.,lone_keyword_l_val=.TRUE.,error=error)
07104        CALL section_add_keyword(section,keyword,error=error)
07105        CALL keyword_release(keyword,error=error)
07106 
07107        CALL keyword_create(keyword, name="DELTA_PULSE_DIRECTION",&
07108             description="Direction of the applied electric field. The k vector is given as"//&
07109             " 2*Pi*[i,j,k]*inv(h_mat), which for PERIODIC .FALSE. yields exp(ikr) periodic with"//&
07110             " the unit cell, only if DELTA_PULSE_SCALE is set to unity. For an orthorhombic cell"//&
07111             " [1,0,0] yields [2*Pi/L_x,0,0]. For small cells, this results in a very large kick.",&
07112             usage="DELTA_PULSE_DIRECTION 1 1 1",n_var=3,default_i_vals=(/1,0,0/),&
07113             type_of_var=integer_t,error=error)
07114        CALL section_add_keyword(section,keyword,error=error)
07115        CALL keyword_release(keyword,error=error)
07116 
07117        CALL keyword_create(keyword, name="DELTA_PULSE_SCALE",&
07118             description="Scale the k vector, which for PERIODIC .FALSE. results in exp(ikr) no"//&
07119             " longer being periodic with the unit cell. The norm of k is the strength of the"//&
07120             " applied electric field in atomic units.",&
07121             usage="DELTA_PULSE_SCALE 0.01 ",n_var=1,default_r_val=0.001_dp,error=error)
07122        CALL section_add_keyword(section,keyword,error=error)
07123        CALL keyword_release(keyword,error=error)
07124 
07125        CALL keyword_create(keyword, name="HFX_BALANCE_IN_CORE",&
07126             description="If HFX is used, this keyword forces a redistribution/recalculation"//&
07127             " of the integrals, balanced with respect to the in core steps.",&
07128             usage="HFX_BALANCE_IN_CORE",&
07129             default_l_val=.FALSE.,lone_keyword_l_val=.TRUE.,error=error)
07130        CALL section_add_keyword(section,keyword,error=error)
07131        CALL keyword_release(keyword,error=error)
07132 
07133 
07134        NULLIFY(print_section)
07135        CALL section_create(print_section,name="PRINT",&
07136             description="Section of possible print options for an RTP runs",&
07137             repeats=.FALSE., required=.TRUE.,error=error)
07138 
07139        NULLIFY(print_key)
07140        CALL cp_print_key_section_create(print_key,"PROGRAM_RUN_INFO",&
07141             description="Controls the printing within real time propagation and Eherenfest dynamics",&
07142             print_level=low_print_level,filename="__STD_OUT__",&
07143             error=error)
07144        CALL section_add_subsection(print_section,print_key,error=error)
07145        CALL section_release(print_key,error=error)
07146 
07147 
07148        CALL cp_print_key_section_create(print_key,"RESTART",&
07149             description="Controls the dumping of the MO restart file during rtp."//&
07150                         "By default keeps a short history of three restarts."//&
07151                         "See also RESTART_HISTORY", &
07152             print_level=low_print_level, common_iter_levels=3,&
07153             each_iter_names=s2a("MD"),each_iter_values=(/20/), &
07154             add_last=add_last_numeric,filename="RESTART",error=error)
07155        CALL keyword_create(keyword, name="BACKUP_COPIES",&
07156             description="Specifies the maximum index of backup copies.",&
07157             usage="BACKUP_COPIES {int}",&
07158             default_i_val=3, error=error)
07159        CALL section_add_keyword(print_key,keyword,error=error)
07160        CALL keyword_release(keyword,error=error)
07161        CALL section_add_subsection(print_section,print_key,error=error)
07162        CALL section_release(print_key,error=error)
07163 
07164        CALL cp_print_key_section_create(print_key,"RESTART_HISTORY",&
07165             description="Dumps unique MO restart files during the run keeping all of them.",&
07166             print_level=low_print_level, common_iter_levels=0,&
07167             each_iter_names=s2a("MD"),&
07168             each_iter_values=(/500/), &
07169             filename="RESTART",error=error)
07170        CALL keyword_create(keyword, name="BACKUP_COPIES",&
07171             description="Specifies the maximum index of backup copies.",&
07172             usage="BACKUP_COPIES {int}",&
07173             default_i_val=3, error=error)
07174        CALL section_add_keyword(print_key,keyword,error=error)
07175        CALL keyword_release(keyword,error=error)
07176        CALL section_add_subsection(print_section,print_key,error=error)
07177        CALL section_release(print_key,error=error)
07178 
07179        CALL section_add_subsection(section,print_section,error=error)
07180        CALL section_release(print_section,error=error)
07181 
07182 
07183     END IF
07184   END SUBROUTINE create_rtp_section
07185 
07186 ! *****************************************************************************
07187   SUBROUTINE create_constant_env_section(section,error)
07188     TYPE(section_type), POINTER              :: section
07189     TYPE(cp_error_type), INTENT(inout)       :: error
07190 
07191     CHARACTER(len=*), PARAMETER :: routineN = 'create_constant_env_section', 
07192       routineP = moduleN//':'//routineN
07193 
07194     LOGICAL                                  :: failure
07195     TYPE(keyword_type), POINTER              :: keyword
07196 
07197     failure=.FALSE.
07198 
07199     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
07200     IF (.NOT. failure) THEN
07201        CALL section_create(section,"CONSTANT_ENV",&
07202             description="parameters for a constant envelop",&
07203             n_keywords=6, n_subsections=1, repeats=.TRUE., required=.TRUE.,&
07204             error=error)
07205 
07206        NULLIFY(keyword)
07207 
07208        CALL keyword_create(keyword, name="START_STEP",&
07209             description="First step the field is applied ",&
07210             usage="START_STEP 0",&
07211             default_i_val=0,&
07212             error=error)
07213        CALL section_add_keyword(section,keyword,error=error)
07214        CALL keyword_release(keyword,error=error)
07215 
07216        CALL keyword_create(keyword, name="END_STEP",&
07217             description="Last step the field is applied",&
07218             usage="END_STEP 2",&
07219             default_i_val=-1,&
07220             error=error)
07221        CALL section_add_keyword(section,keyword,error=error)
07222        CALL keyword_release(keyword,error=error)
07223     END IF
07224 
07225   END SUBROUTINE create_constant_env_section
07226 
07227   SUBROUTINE create_gaussian_env_section(section,error)
07228     TYPE(section_type), POINTER              :: section
07229     TYPE(cp_error_type), INTENT(inout)       :: error
07230 
07231     CHARACTER(len=*), PARAMETER :: routineN = 'create_gaussian_env_section', 
07232       routineP = moduleN//':'//routineN
07233 
07234     LOGICAL                                  :: failure
07235     TYPE(keyword_type), POINTER              :: keyword
07236 
07237     failure=.FALSE.
07238 
07239     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
07240     IF (.NOT. failure) THEN
07241        CALL section_create(section,"GAUSSIAN_ENV",&
07242             description="parameters for a gaussian envelop",&
07243             n_keywords=6, n_subsections=1, repeats=.TRUE., required=.TRUE.,&
07244             error=error)
07245 
07246        NULLIFY(keyword)
07247 
07248        CALL keyword_create(keyword, name="T0",&
07249             description="Center of the gaussian envelop (maximum of the gaussian)",&
07250             usage="T0 2.0E0",&
07251             default_r_val=0.0E0_dp,&
07252             unit_str="fs",error=error)
07253        CALL section_add_keyword(section,keyword,error=error)
07254        CALL keyword_release(keyword,error=error)
07255 
07256        CALL keyword_create(keyword, name="SIGMA",&
07257             description="Width of the gaussian ",&
07258             usage="SIGMA 2.0E0",&
07259             default_r_val=-1.0E0_dp,&
07260             unit_str="fs",error=error)
07261        CALL section_add_keyword(section,keyword,error=error)
07262        CALL keyword_release(keyword,error=error)
07263     END IF
07264 
07265   END SUBROUTINE create_gaussian_env_section
07266 ! *****************************************************************************
07267   SUBROUTINE create_ramp_env_section(section,error)
07268     TYPE(section_type), POINTER              :: section
07269     TYPE(cp_error_type), INTENT(inout)       :: error
07270 
07271     CHARACTER(len=*), PARAMETER :: routineN = 'create_ramp_env_section', 
07272       routineP = moduleN//':'//routineN
07273 
07274     LOGICAL                                  :: failure
07275     TYPE(keyword_type), POINTER              :: keyword
07276 
07277     failure=.FALSE.
07278 
07279     CPPrecondition(.NOT.ASSOCIATED(section),cp_failure_level,routineP,error,failure)
07280     IF (.NOT. failure) THEN
07281        CALL section_create(section,"RAMP_ENV",&
07282             description="Parameters for an trapeziodal envelop ",&
07283             n_keywords=6, n_subsections=1, repeats=.TRUE., required=.TRUE.,&
07284             error=error)
07285 
07286        NULLIFY(keyword)
07287 
07288        CALL keyword_create(keyword, name="START_STEP_IN",&
07289             description="Step when the electric field starts to be applied ",&
07290             usage="START_STEP_IN 0",&
07291             default_i_val=0,&
07292             error=error)
07293        CALL section_add_keyword(section,keyword,error=error)
07294        CALL keyword_release(keyword,error=error)
07295 
07296        CALL keyword_create(keyword, name="END_STEP_IN",&
07297             description="Step when the field reaches the full strength",&
07298             usage="END_STEP_IN 2",&
07299             default_i_val=-1,&
07300             error=error)
07301        CALL section_add_keyword(section,keyword,error=error)
07302        CALL keyword_release(keyword,error=error)
07303 
07304        CALL keyword_create(keyword, name="START_STEP_OUT",&
07305             description="Step when the field starts to vanish ",&
07306             usage="START_STEP 0",&
07307             default_i_val=0,&
07308             error=error)
07309        CALL section_add_keyword(section,keyword,error=error)
07310        CALL keyword_release(keyword,error=error)
07311 
07312        CALL keyword_create(keyword, name="END_STEP_OUT",&
07313             description="Step when the field disappears",&
07314             usage="END_TIME 2",&
07315             default_i_val=-1,&
07316             error=error)
07317        CALL section_add_keyword(section,keyword,error=error)
07318        CALL keyword_release(keyword,error=error)
07319     END IF
07320 
07321   END SUBROUTINE create_ramp_env_section
07322 
07323 
07324 END MODULE input_cp2k_dft