1!--------------------------------------------------------------------------------------------------! 2! CP2K: A general program to perform molecular dynamics simulations ! 3! Copyright (C) 2000 - 2020 CP2K developers group ! 4!--------------------------------------------------------------------------------------------------! 5 6! ************************************************************************************************** 7!> \brief A common interface (wrapper) for a callback into the md_run loop. 8!> Currently this is only used by the glbopt machinery, but its meant 9!> to be extended if others need to control the md_run loop, too. 10!> 11!> \par History 12!> 11.2012 created [Ole] 13!> \author Ole 14! ************************************************************************************************** 15MODULE mdctrl_methods 16 USE glbopt_callback, ONLY: glbopt_md_callback 17 USE md_environment_types, ONLY: md_environment_type 18 USE mdctrl_types, ONLY: mdctrl_type 19#include "../base/base_uses.f90" 20 21 IMPLICIT NONE 22 PRIVATE 23 24 PUBLIC :: mdctrl_callback 25 26 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mdctrl_methods' 27 28CONTAINS 29 30! ************************************************************************************************** 31!> \brief This is called by md_run for each step during during its main-loop. 32!> \param mdctrl data which is passed on to the wrapped client-routine 33!> \param md_env contains the current state of the md_run 34!> \param should_stop can be used to abort the md_run 35! ************************************************************************************************** 36 SUBROUTINE mdctrl_callback(mdctrl, md_env, should_stop) 37 TYPE(mdctrl_type), POINTER :: mdctrl 38 TYPE(md_environment_type), POINTER :: md_env 39 LOGICAL, INTENT(inout) :: should_stop 40 41 CHARACTER(len=*), PARAMETER :: routineN = 'mdctrl_callback', & 42 routineP = moduleN//':'//routineN 43 44 CPASSERT(ASSOCIATED(md_env)) 45 CPASSERT(ASSOCIATED(mdctrl)) 46 47 IF (ASSOCIATED(mdctrl%glbopt)) THEN 48 CALL glbopt_md_callback(mdctrl%glbopt, md_env, should_stop) 49 50 !ELSE IF(ASSOCIATED(mdctrl%your_own_hook)) THEN ... 51 52 ELSE 53 CPABORT("mdctrl_callback: No hook found.") 54 ENDIF 55 56 END SUBROUTINE mdctrl_callback 57 58END MODULE mdctrl_methods 59 60