LCOV - code coverage report
Current view: top level - src/motion - mdctrl_methods.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:262480d) Lines: 6 7 85.7 %
Date: 2024-11-22 07:00:40 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 A common interface (wrapper) for a callback into the md_run loop.
      10             : !>        Currently this is only used by the glbopt machinery, but its meant
      11             : !>        to be extended if others need to control the md_run loop, too.
      12             : !>
      13             : !> \par History
      14             : !>      11.2012 created [Ole]
      15             : !> \author Ole
      16             : ! **************************************************************************************************
      17             : MODULE mdctrl_methods
      18             :    USE glbopt_callback,                 ONLY: glbopt_md_callback
      19             :    USE md_environment_types,            ONLY: md_environment_type
      20             :    USE mdctrl_types,                    ONLY: mdctrl_type
      21             : #include "../base/base_uses.f90"
      22             : 
      23             :    IMPLICIT NONE
      24             :    PRIVATE
      25             : 
      26             :    PUBLIC :: mdctrl_callback
      27             : 
      28             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mdctrl_methods'
      29             : 
      30             : CONTAINS
      31             : 
      32             : ! **************************************************************************************************
      33             : !> \brief This is called by md_run for each step during during its main-loop.
      34             : !> \param mdctrl data which is passed on to the wrapped client-routine
      35             : !> \param md_env contains the current state of the md_run
      36             : !> \param should_stop can be used to abort the md_run
      37             : ! **************************************************************************************************
      38        4075 :    SUBROUTINE mdctrl_callback(mdctrl, md_env, should_stop)
      39             :       TYPE(mdctrl_type), POINTER                         :: mdctrl
      40             :       TYPE(md_environment_type), POINTER                 :: md_env
      41             :       LOGICAL, INTENT(inout)                             :: should_stop
      42             : 
      43        4075 :       CPASSERT(ASSOCIATED(md_env))
      44        4075 :       CPASSERT(ASSOCIATED(mdctrl))
      45             : 
      46        4075 :       IF (ASSOCIATED(mdctrl%glbopt)) THEN
      47        4075 :          CALL glbopt_md_callback(mdctrl%glbopt, md_env, should_stop)
      48             : 
      49             :          !ELSE IF(ASSOCIATED(mdctrl%your_own_hook)) THEN ...
      50             : 
      51             :       ELSE
      52           0 :          CPABORT("mdctrl_callback: No hook found.")
      53             :       END IF
      54             : 
      55        4075 :    END SUBROUTINE mdctrl_callback
      56             : 
      57             : END MODULE mdctrl_methods
      58             : 

Generated by: LCOV version 1.15