LCOV - code coverage report
Current view: top level - src - input_cp2k_motion_print.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:4dc10b3) Lines: 100 100 100.0 %
Date: 2024-11-21 06:45:46 Functions: 2 2 100.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2024 CP2K developers group <https://cp2k.org>                                   !
       4             : !                                                                                                  !
       5             : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6             : !--------------------------------------------------------------------------------------------------!
       7             : 
       8             : ! **************************************************************************************************
       9             : !> \par History
      10             : !>      - taken out of input_cp2k_motion
      11             : !> \author Ole Schuett
      12             : ! **************************************************************************************************
      13             : MODULE input_cp2k_motion_print
      14             :    USE cp_output_handling,              ONLY: add_last_numeric,&
      15             :                                               cp_print_key_section_create,&
      16             :                                               high_print_level,&
      17             :                                               low_print_level,&
      18             :                                               silent_print_level
      19             :    USE input_constants,                 ONLY: dump_atomic,&
      20             :                                               dump_dcd,&
      21             :                                               dump_dcd_aligned_cell,&
      22             :                                               dump_pdb,&
      23             :                                               dump_xmol
      24             :    USE input_cp2k_subsys,               ONLY: create_structure_data_section
      25             :    USE input_keyword_types,             ONLY: keyword_create,&
      26             :                                               keyword_release,&
      27             :                                               keyword_type
      28             :    USE input_section_types,             ONLY: section_add_keyword,&
      29             :                                               section_add_subsection,&
      30             :                                               section_create,&
      31             :                                               section_release,&
      32             :                                               section_type
      33             :    USE string_utilities,                ONLY: s2a
      34             : #include "./base/base_uses.f90"
      35             : 
      36             :    IMPLICIT NONE
      37             :    PRIVATE
      38             : 
      39             :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      40             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_motion_print'
      41             : 
      42             :    PUBLIC :: create_motion_print_section, add_format_keyword
      43             : 
      44             : CONTAINS
      45             : 
      46             : ! **************************************************************************************************
      47             : !> \brief creates the motion%print section
      48             : !> \param section the section to be created
      49             : !> \author teo
      50             : ! **************************************************************************************************
      51        8530 :    SUBROUTINE create_motion_print_section(section)
      52             :       TYPE(section_type), POINTER                        :: section
      53             : 
      54             :       TYPE(keyword_type), POINTER                        :: keyword
      55             :       TYPE(section_type), POINTER                        :: print_key
      56             : 
      57        8530 :       NULLIFY (keyword, section, print_key)
      58             : 
      59             :       CALL section_create(section, __LOCATION__, name="print", &
      60             :                           description="Controls the printing properties during an MD/Optimization run", &
      61        8530 :                           n_keywords=1, n_subsections=1, repeats=.TRUE.)
      62             : 
      63             :       CALL keyword_create(keyword, __LOCATION__, name="MEMORY_INFO", &
      64             :                           variants=(/"MEMORY"/), &
      65             :                           description="Whether overall memory usage should be sampled and printed "// &
      66             :                           "at each MD/Optimization step.", &
      67             :                           usage="MEMORY_INFO LOGICAL", &
      68       17060 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
      69        8530 :       CALL section_add_keyword(section, keyword)
      70        8530 :       CALL keyword_release(keyword)
      71             : 
      72             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "TRAJECTORY", &
      73             :                                        description="Controls the output of the trajectory", &
      74             :                                        print_level=low_print_level, common_iter_levels=1, &
      75        8530 :                                        filename="", unit_str="angstrom")
      76             :       CALL add_format_keyword(keyword, print_key, pos=.TRUE., &
      77        8530 :                               description="Specifies the format of the output file for the trajectory.")
      78        8530 :       CALL section_add_subsection(section, print_key)
      79        8530 :       CALL section_release(print_key)
      80             : 
      81             :       CALL cp_print_key_section_create( &
      82             :          print_key, __LOCATION__, "SHELL_TRAJECTORY", &
      83             :          description="Controls the output of the trajectory of shells when the shell-model is used ", &
      84             :          print_level=high_print_level, common_iter_levels=1, &
      85        8530 :          filename="", unit_str="angstrom")
      86             :       CALL add_format_keyword(keyword, print_key, pos=.TRUE., &
      87        8530 :                               description="Specifies the format of the output file for the trajectory of shells.")
      88        8530 :       CALL section_add_subsection(section, print_key)
      89        8530 :       CALL section_release(print_key)
      90             : 
      91             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CORE_TRAJECTORY", &
      92             :                                        description="Controls the output of the trajectory of cores when the shell-model is used ", &
      93             :                                        print_level=high_print_level, common_iter_levels=1, &
      94        8530 :                                        filename="", unit_str="angstrom")
      95             :       CALL add_format_keyword(keyword, print_key, pos=.TRUE., &
      96        8530 :                               description="Specifies the format of the output file for the trajectory of cores.")
      97        8530 :       CALL section_add_subsection(section, print_key)
      98        8530 :       CALL section_release(print_key)
      99             : 
     100             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CELL", &
     101             :                                        description="Controls the output of the simulation cell. "// &
     102             :                                        "For later analysis of the trajectory it is recommendable that the "// &
     103             :                                        "frequency of printing is the same as the one used for the trajectory file.", &
     104             :                                        print_level=high_print_level, common_iter_levels=1, &
     105        8530 :                                        filename="")
     106        8530 :       CALL section_add_subsection(section, print_key)
     107        8530 :       CALL section_release(print_key)
     108             : 
     109             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "VELOCITIES", &
     110             :                                        description="Controls the output of the atomic velocities. "// &
     111             :                                        "The default unit for the atomic velocities $v$ is bohr/au_time. "// &
     112             :                                        "The kinetic energy $K_i$ in [hartree] of an atom $i$ with mass $m_i$ in "// &
     113             :                                        "atomic mass units [amu] (or just [u]) and velocity $v_i$ can be obtained by "// &
     114             :                                        "$K_i = \frac{1}{2}f_u\,m_i\,v_i^2$ with $f_u = 1822.888$ as conversion factor "// &
     115             :                                        "from [u] to [a.u.]. $f_u$ is printed in full precision in the top of the CP2K "// &
     116             :                                        "output for print level MEDIUM or higher.", &
     117             :                                        print_level=high_print_level, common_iter_levels=1, &
     118        8530 :                                        filename="", unit_str="bohr*au_t^-1")
     119             :       CALL add_format_keyword(keyword, print_key, pos=.FALSE., &
     120        8530 :                               description="Specifies the format of the output file for the velocities.")
     121        8530 :       CALL section_add_subsection(section, print_key)
     122        8530 :       CALL section_release(print_key)
     123             : 
     124             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "SHELL_VELOCITIES", &
     125             :                                        description="Controls the output of the velocities of shells when the shell model is used", &
     126             :                                        print_level=high_print_level, common_iter_levels=1, &
     127        8530 :                                        filename="", unit_str="bohr*au_t^-1")
     128             :       CALL add_format_keyword(keyword, print_key, pos=.FALSE., &
     129        8530 :                               description="Specifies the format of the output file for the velocities of shells.")
     130        8530 :       CALL section_add_subsection(section, print_key)
     131        8530 :       CALL section_release(print_key)
     132             : 
     133             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CORE_VELOCITIES", &
     134             :                                        description="controls the output of the velocities of cores when the shell model is used", &
     135             :                                        print_level=high_print_level, common_iter_levels=1, &
     136        8530 :                                        filename="", unit_str="bohr*au_t^-1")
     137             :       CALL add_format_keyword(keyword, print_key, pos=.FALSE., &
     138        8530 :                               description="Specifies the format of the output file for the velocities of cores.")
     139        8530 :       CALL section_add_subsection(section, print_key)
     140        8530 :       CALL section_release(print_key)
     141             : 
     142        8530 :       CALL create_structure_data_section(print_key)
     143        8530 :       CALL section_add_subsection(section, print_key)
     144        8530 :       CALL section_release(print_key)
     145             : 
     146             :       CALL cp_print_key_section_create( &
     147             :          print_key, __LOCATION__, "FORCE_MIXING_LABELS", &
     148             :          description="Controls the output of the force mixing (FORCE_EVAL&QMMM&FORCE_MIXING) labels", &
     149             :          print_level=high_print_level, common_iter_levels=1, &
     150        8530 :          filename="")
     151             :       CALL add_format_keyword(keyword, print_key, pos=.FALSE., &
     152        8530 :                               description="Specifies the format of the output file for the force mixing labels.")
     153        8530 :       CALL section_add_subsection(section, print_key)
     154        8530 :       CALL section_release(print_key)
     155             : 
     156             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FORCES", &
     157             :                                        description="Controls the output of the forces", &
     158             :                                        print_level=high_print_level, common_iter_levels=1, &
     159        8530 :                                        filename="", unit_str="hartree*bohr^-1")
     160             :       CALL add_format_keyword(keyword, print_key, pos=.FALSE., &
     161        8530 :                               description="Specifies the format of the output file for the forces.")
     162        8530 :       CALL section_add_subsection(section, print_key)
     163        8530 :       CALL section_release(print_key)
     164             : 
     165             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "SHELL_FORCES", &
     166             :                                        description="Controls the output of the forces on shells when shell-model is used", &
     167             :                                        print_level=high_print_level, common_iter_levels=1, &
     168        8530 :                                        filename="", unit_str="hartree*bohr^-1")
     169             :       CALL add_format_keyword(keyword, print_key, pos=.FALSE., &
     170        8530 :                               description="Specifies the format of the output file for the forces on shells.")
     171        8530 :       CALL section_add_subsection(section, print_key)
     172        8530 :       CALL section_release(print_key)
     173             : 
     174             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CORE_FORCES", &
     175             :                                        description="Controls the output of the forces on cores when shell-model is used", &
     176             :                                        print_level=high_print_level, common_iter_levels=1, &
     177        8530 :                                        filename="", unit_str="hartree*bohr^-1")
     178             :       CALL add_format_keyword(keyword, print_key, pos=.FALSE., &
     179        8530 :                               description="Specifies the format of the output file for the forces on cores.")
     180        8530 :       CALL section_add_subsection(section, print_key)
     181        8530 :       CALL section_release(print_key)
     182             : 
     183             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MIXED_ENERGIES", &
     184             :                                        description="Controls the output of the energies of the two "// &
     185             :                                        "regular FORCE_EVALS in the MIXED method "// &
     186             :                                        "printed is step,time,Etot,E_F1,E_F2,CONS_QNT", &
     187             :                                        print_level=low_print_level, common_iter_levels=1, &
     188        8530 :                                        filename="")
     189        8530 :       CALL section_add_subsection(section, print_key)
     190        8530 :       CALL section_release(print_key)
     191             : 
     192             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "STRESS", &
     193             :                                        description="Controls the output of the stress tensor", &
     194             :                                        print_level=high_print_level, common_iter_levels=1, &
     195        8530 :                                        filename="")
     196        8530 :       CALL section_add_subsection(section, print_key)
     197        8530 :       CALL section_release(print_key)
     198             : 
     199             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "POLAR_MATRIX", &
     200             :                                        description="Controls the output of the polarisability tensor during an MD run", &
     201             :                                        print_level=low_print_level, common_iter_levels=1, &
     202        8530 :                                        filename="")
     203        8530 :       CALL section_add_subsection(section, print_key)
     204        8530 :       CALL section_release(print_key)
     205             : 
     206             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
     207             :                                        description="Controls the dumping of the restart file during runs. "// &
     208             :                                        "By default keeps a short history of three restarts. See also RESTART_HISTORY", &
     209             :                                        each_iter_names=s2a("MD"), each_iter_values=(/20/), &
     210             :                                        print_level=silent_print_level, common_iter_levels=1, &
     211        8530 :                                        add_last=add_last_numeric, filename="")
     212             : 
     213             :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
     214             :                           description="Specifies the maximum number of backup copies.", &
     215             :                           usage="BACKUP_COPIES {int}", &
     216        8530 :                           default_i_val=1)
     217        8530 :       CALL section_add_keyword(print_key, keyword)
     218        8530 :       CALL keyword_release(keyword)
     219             : 
     220             :       CALL keyword_create(keyword, __LOCATION__, name="SPLIT_RESTART_FILE", &
     221             :                           description="If specified selected input sections, which are growing with the "// &
     222             :                           "number of atoms in the system, are written to another restart file "// &
     223             :                           "in binary format instead of the default restart file in human "// &
     224             :                           "readable ASCII format. This split of the restart file may "// &
     225             :                           "provide significant memory savings and an accelerated I/O for "// &
     226             :                           "systems with a very large number of atoms", &
     227             :                           usage="SPLIT_RESTART_FILE yes", &
     228             :                           default_l_val=.FALSE., &
     229        8530 :                           lone_keyword_l_val=.TRUE.)
     230        8530 :       CALL section_add_keyword(print_key, keyword)
     231        8530 :       CALL keyword_release(keyword)
     232             : 
     233        8530 :       CALL section_add_subsection(section, print_key)
     234        8530 :       CALL section_release(print_key)
     235             : 
     236             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART_HISTORY", &
     237             :                                        description="Dumps unique restart files during the run keeping all of them. "// &
     238             :                                        "Most useful if recovery is needed at a later point.", &
     239             :                                        print_level=low_print_level, common_iter_levels=0, &
     240             :                                        each_iter_names=s2a("MD", "GEO_OPT", "ROT_OPT"), each_iter_values=(/500, 500, 500/), &
     241        8530 :                                        filename="")
     242        8530 :       CALL section_add_subsection(section, print_key)
     243        8530 :       CALL section_release(print_key)
     244             : 
     245             :       CALL cp_print_key_section_create(print_key, __LOCATION__, "TRANSLATION_VECTOR", &
     246             :                                        description="Dumps the translation vector applied along an MD (if any). Useful"// &
     247             :                                        " for postprocessing of QMMM trajectories in which the QM fragment is continuously"// &
     248             :                                        " centered in the QM box", &
     249             :                                        print_level=high_print_level, common_iter_levels=1, &
     250        8530 :                                        filename="")
     251        8530 :       CALL section_add_subsection(section, print_key)
     252        8530 :       CALL section_release(print_key)
     253             : 
     254        8530 :    END SUBROUTINE create_motion_print_section
     255             : 
     256             : ! **************************************************************************************************
     257             : !> \brief creates the FORMAT keyword
     258             : !> \param keyword ...
     259             : !> \param section will contain the pint section
     260             : !> \param pos ...
     261             : !> \param description ...
     262             : !> \author Teodoro Laino 10.2008 [tlaino]
     263             : ! **************************************************************************************************
     264      145122 :    SUBROUTINE add_format_keyword(keyword, section, pos, description)
     265             :       TYPE(keyword_type), POINTER                        :: keyword
     266             :       TYPE(section_type), POINTER                        :: section
     267             :       LOGICAL, INTENT(IN)                                :: pos
     268             :       CHARACTER(LEN=*), INTENT(IN)                       :: description
     269             : 
     270      145122 :       CPASSERT(ASSOCIATED(section))
     271      145122 :       CPASSERT(.NOT. ASSOCIATED(keyword))
     272             : 
     273      145122 :       IF (pos) THEN
     274             : 
     275             :          CALL keyword_create( &
     276             :             keyword, __LOCATION__, name="FORMAT", &
     277             :             description=description, usage="FORMAT (ATOMIC|DCD|PDB|XMOL|XYZ)", &
     278             :             default_i_val=dump_xmol, &
     279             :             enum_c_vals=s2a("ATOMIC", "DCD", "DCD_ALIGNED_CELL", "PDB", "XMOL", "XYZ"), &
     280             :             enum_i_vals=(/dump_atomic, dump_dcd, dump_dcd_aligned_cell, dump_pdb, dump_xmol, dump_xmol/), &
     281             :             enum_desc=s2a("Write only the coordinates X,Y,Z without element symbols to a formatted file", &
     282             :                           "Write the coordinates (no element labels) and the cell information to a binary file", &
     283             :                           "Like DCD, but the dumped coordinates refer to an aligned cell following the common convention: "// &
     284             :                           "the cell vector **a** is aligned with the *x* axis and the cell vector **b** lies in "// &
     285             :                           "the *xy* plane. This allows the reconstruction of scaled coordinates from the DCD data only.", &
     286             :                           "Write the atomic information in PDB format to a formatted file", &
     287             :                           "Mostly known as XYZ format, provides in a formatted file: element_symbol X Y Z", &
     288       76882 :                           "Alias name for XMOL"))
     289       76882 :          CALL section_add_keyword(section, keyword)
     290       76882 :          CALL keyword_release(keyword)
     291             : 
     292             :          CALL keyword_create(keyword, __LOCATION__, name="CHARGE_OCCUP", &
     293             :                              variants=(/"CHARGE_O"/), &
     294             :                              description="Write the MM charges to the OCCUP field of the PDB file", &
     295             :                              usage="CHARGE_OCCUP logical", &
     296      153764 :                              default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     297       76882 :          CALL section_add_keyword(section, keyword)
     298       76882 :          CALL keyword_release(keyword)
     299             : 
     300             :          CALL keyword_create(keyword, __LOCATION__, name="CHARGE_BETA", &
     301             :                              variants=(/"CHARGE_B"/), &
     302             :                              description="Write the MM charges to the BETA field of the PDB file", &
     303             :                              usage="CHARGE_BETA logical", &
     304      153764 :                              default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     305       76882 :          CALL section_add_keyword(section, keyword)
     306       76882 :          CALL keyword_release(keyword)
     307             : 
     308             :          CALL keyword_create(keyword, __LOCATION__, name="CHARGE_EXTENDED", &
     309             :                              description="Write the MM charges to the very last field of the PDB file (starting from column 81)", &
     310             :                              usage="CHARGE_EXTENDED logical", &
     311       76882 :                              default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     312       76882 :          CALL section_add_keyword(section, keyword)
     313       76882 :          CALL keyword_release(keyword)
     314             : 
     315             :       ELSE
     316             : 
     317             :          CALL keyword_create(keyword, __LOCATION__, name="FORMAT", &
     318             :                              description=description, usage="FORMAT (ATOMIC|DCD|XMOL|XYZ)", &
     319             :                              default_i_val=dump_xmol, &
     320             :                              enum_c_vals=s2a("ATOMIC", "DCD", "XMOL", "XYZ"), &
     321             :                              enum_i_vals=(/dump_atomic, dump_dcd, dump_xmol, dump_xmol/), &
     322             :                              enum_desc=s2a("Write only the coordinates X,Y,Z without element symbols to a formatted file", &
     323             :                                            "Write the coordinates (no element labels) and the cell information to a binary file", &
     324             :                                            "Mostly known as XYZ format, provides in a formatted file: element_symbol X Y Z", &
     325       68240 :                                            "Alias name for XMOL"))
     326       68240 :          CALL section_add_keyword(section, keyword)
     327       68240 :          CALL keyword_release(keyword)
     328             : 
     329             :       END IF
     330             : 
     331             :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_ATOM_KIND", &
     332             :                           description="Write the atom kind given in the subsys section instead of the element symbol. "// &
     333             :                           "Only valid for the XMOL format.", &
     334             :                           usage="PRINT_ELEMENT_NAME logical", &
     335      145122 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     336      145122 :       CALL section_add_keyword(section, keyword)
     337      145122 :       CALL keyword_release(keyword)
     338             : 
     339      145122 :    END SUBROUTINE add_format_keyword
     340             : 
     341             : END MODULE input_cp2k_motion_print

Generated by: LCOV version 1.15