LCOV - code coverage report
Current view: top level - src - input_cp2k_read.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:2fce0f8) Lines: 13 13 100.0 %
Date: 2024-12-21 06:28:57 Functions: 1 1 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             : !> \brief parse cp2k input files
      10             : !> \par History
      11             : !>      06.2004 created [fawzi]
      12             : !>      03.2014 moved into separate module [Ole Schuett]
      13             : !> \author fawzi
      14             : ! **************************************************************************************************
      15             : MODULE input_cp2k_read
      16             :    USE cp_parser_types,                 ONLY: cp_parser_type,&
      17             :                                               empty_initial_variables,&
      18             :                                               parser_create,&
      19             :                                               parser_release
      20             :    USE cp_units,                        ONLY: cp_unit_set_create,&
      21             :                                               cp_unit_set_release,&
      22             :                                               cp_unit_set_type
      23             :    USE input_parsing,                   ONLY: section_vals_parse
      24             :    USE input_section_types,             ONLY: section_type,&
      25             :                                               section_vals_create,&
      26             :                                               section_vals_type,&
      27             :                                               typo_match_section
      28             :    USE message_passing,                 ONLY: mp_para_env_type
      29             : #include "./base/base_uses.f90"
      30             : 
      31             :    IMPLICIT NONE
      32             :    PRIVATE
      33             : 
      34             :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      35             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_read'
      36             : 
      37             :    PUBLIC :: read_input, empty_initial_variables
      38             : 
      39             : CONTAINS
      40             : 
      41             : ! **************************************************************************************************
      42             : !> \brief reads the cp2k input from the given filepath and returns a section_vals
      43             : !>      containing the input
      44             : !> \param input_declaration ...
      45             : !> \param file_path path where the input should be read
      46             : !> \param initial_variables ...
      47             : !> \param para_env ...
      48             : !> \return ...
      49             : !> \author fawzi
      50             : ! **************************************************************************************************
      51        9768 :    FUNCTION read_input(input_declaration, file_path, initial_variables, para_env) RESULT(res)
      52             :       TYPE(section_type), POINTER                        :: input_declaration
      53             :       CHARACTER(len=*), INTENT(in)                       :: file_path
      54             :       CHARACTER(len=*), DIMENSION(:, :)                  :: initial_variables
      55             :       TYPE(mp_para_env_type), POINTER                    :: para_env
      56             :       TYPE(section_vals_type), POINTER                   :: res
      57             : 
      58             :       CHARACTER(len=*), PARAMETER                        :: routineN = 'read_input'
      59             : 
      60             :       INTEGER                                            :: handle
      61             :       TYPE(cp_parser_type)                               :: cpparser
      62             :       TYPE(cp_unit_set_type)                             :: default_units
      63             : 
      64        9768 :       CALL timeset(routineN, handle)
      65        9768 :       NULLIFY (res)
      66        9768 :       CALL section_vals_create(res, input_declaration)
      67             :       CALL parser_create(cpparser, initial_variables=initial_variables, file_name=file_path, &
      68        9768 :                          para_env=para_env)
      69        9768 :       CALL cp_unit_set_create(default_units, "OUTPUT")
      70        9768 :       typo_match_section => input_declaration
      71             :       CALL section_vals_parse(res, cpparser, root_section=.FALSE., &
      72        9768 :                               default_units=default_units)
      73        9768 :       typo_match_section => NULL()
      74        9768 :       CALL cp_unit_set_release(default_units)
      75        9768 :       CALL parser_release(cpparser)
      76        9768 :       CALL timestop(handle)
      77      126984 :    END FUNCTION read_input
      78             : 
      79             : END MODULE input_cp2k_read

Generated by: LCOV version 1.15