(git:374b731)
Loading...
Searching...
No Matches
mdctrl_methods.F
Go to the documentation of this file.
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! **************************************************************************************************
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
30CONTAINS
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 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 cpassert(ASSOCIATED(md_env))
44 cpassert(ASSOCIATED(mdctrl))
45
46 IF (ASSOCIATED(mdctrl%glbopt)) THEN
47 CALL glbopt_md_callback(mdctrl%glbopt, md_env, should_stop)
48
49 !ELSE IF(ASSOCIATED(mdctrl%your_own_hook)) THEN ...
50
51 ELSE
52 cpabort("mdctrl_callback: No hook found.")
53 END IF
54
55 END SUBROUTINE mdctrl_callback
56
57END MODULE mdctrl_methods
58
Callback used by global geometry optimization schemes.
subroutine, public glbopt_md_callback(mdctrl_data, md_env, should_stop)
Callback used to hook into the main MD-loop. It recognizes and counts bumps in the potential energy....
A common interface (wrapper) for a callback into the md_run loop. Currently this is only used by the ...
subroutine, public mdctrl_callback(mdctrl, md_env, should_stop)
This is called by md_run for each step during during its main-loop.
A common interface for passing a callback into the md_run loop.