LCOV - code coverage report
Current view: top level - src - qmmmx_create.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:c7c47bf) Lines: 17 17 100.0 %
Date: 2024-12-29 23:06:28 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 Initialize a QM/MM calculation with Force-Mixing
      10             : !> \author Ole Schuett
      11             : ! **************************************************************************************************
      12             : MODULE qmmmx_create
      13             :    USE cp_subsys_types,                 ONLY: cp_subsys_type
      14             :    USE global_types,                    ONLY: global_environment_type
      15             :    USE input_section_types,             ONLY: section_vals_get_subs_vals,&
      16             :                                               section_vals_release,&
      17             :                                               section_vals_type
      18             :    USE message_passing,                 ONLY: mp_para_env_type
      19             :    USE qmmm_create,                     ONLY: qmmm_env_create
      20             :    USE qmmm_types,                      ONLY: qmmm_env_get,&
      21             :                                               qmmm_env_release,&
      22             :                                               qmmm_env_type
      23             :    USE qmmmx_types,                     ONLY: qmmmx_env_type
      24             :    USE qmmmx_util,                      ONLY: setup_force_mixing_qmmm_sections,&
      25             :                                               update_force_mixing_labels
      26             : #include "./base/base_uses.f90"
      27             : 
      28             :    IMPLICIT NONE
      29             :    PRIVATE
      30             : 
      31             :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      32             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qmmmx_create'
      33             : 
      34             :    PUBLIC :: qmmmx_env_create
      35             : 
      36             : CONTAINS
      37             : 
      38             : ! **************************************************************************************************
      39             : !> \brief ...
      40             : !> \param qmmmx_env ...
      41             : !> \param root_section ...
      42             : !> \param para_env ...
      43             : !> \param globenv ...
      44             : !> \param force_env_section ...
      45             : !> \param subsys_section ...
      46             : !> \param use_motion_section ...
      47             : !> \par History
      48             : !>      02.2012 created [noam]
      49             : !> \author Noam Bernstein
      50             : ! **************************************************************************************************
      51           8 :    SUBROUTINE qmmmx_env_create(qmmmx_env, root_section, para_env, globenv, &
      52             :                                force_env_section, subsys_section, use_motion_section)
      53             :       TYPE(qmmmx_env_type), INTENT(OUT)                  :: qmmmx_env
      54             :       TYPE(section_vals_type), POINTER                   :: root_section
      55             :       TYPE(mp_para_env_type), POINTER                    :: para_env
      56             :       TYPE(global_environment_type), POINTER             :: globenv
      57             :       TYPE(section_vals_type), POINTER                   :: force_env_section, subsys_section
      58             :       LOGICAL, INTENT(IN)                                :: use_motion_section
      59             : 
      60             :       TYPE(cp_subsys_type), POINTER                      :: subsys
      61             :       TYPE(qmmm_env_type), POINTER                       :: dummy_qmmm_env
      62             :       TYPE(section_vals_type), POINTER                   :: qmmm_core_section, &
      63             :                                                             qmmm_extended_section, qmmm_section
      64             : 
      65           8 :       NULLIFY (dummy_qmmm_env)
      66             : 
      67           8 :       qmmm_section => section_vals_get_subs_vals(force_env_section, "QMMM")
      68             : 
      69           8 :       ALLOCATE (dummy_qmmm_env)
      70             :       CALL qmmm_env_create(dummy_qmmm_env, root_section, para_env, globenv, &
      71             :                            force_env_section, qmmm_section, subsys_section, use_motion_section, &
      72           8 :                            ignore_outside_box=.TRUE.)
      73           8 :       CALL qmmm_env_get(dummy_qmmm_env, subsys=subsys)
      74             : 
      75           8 :       CALL update_force_mixing_labels(subsys, qmmm_section)
      76             : 
      77             :       ! using CUR_INDICES and CUR_LABELS, create appropriate QM_KIND sections for two QM/MM calculations
      78           8 :       CALL setup_force_mixing_qmmm_sections(subsys, qmmm_section, qmmm_core_section, qmmm_extended_section)
      79             : 
      80           8 :       ALLOCATE (qmmmx_env%core)
      81             :       CALL qmmm_env_create(qmmmx_env%core, root_section, para_env, globenv, &
      82             :                            force_env_section, qmmm_core_section, subsys_section, use_motion_section, &
      83           8 :                            ignore_outside_box=.TRUE.)
      84             : 
      85           8 :       ALLOCATE (qmmmx_env%ext)
      86             :       CALL qmmm_env_create(qmmmx_env%ext, root_section, para_env, globenv, &
      87             :                            force_env_section, qmmm_extended_section, subsys_section, use_motion_section, &
      88           8 :                            ignore_outside_box=.TRUE.)
      89             : 
      90           8 :       CALL section_vals_release(qmmm_core_section)
      91           8 :       CALL section_vals_release(qmmm_extended_section)
      92           8 :       CALL qmmm_env_release(dummy_qmmm_env)
      93           8 :       DEALLOCATE (dummy_qmmm_env)
      94             : 
      95           8 :    END SUBROUTINE qmmmx_env_create
      96             : 
      97             : END MODULE qmmmx_create

Generated by: LCOV version 1.15