(git:1f285aa)
mc_environment_types.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 contains the subroutines for dealing with the mc_env
10 !> \author MJM Oct. 15-2003
11 ! **************************************************************************************************
13 
14  USE force_env_types, ONLY: force_env_type
15  USE mc_types, ONLY: mc_simpar_type
16 #include "../../base/base_uses.f90"
17 
18  IMPLICIT NONE
19 
20  PRIVATE
21 
22 ! **************************************************************************************************
23  TYPE mc_environment_type
24  TYPE(mc_simpar_type), POINTER :: mc_par => null()
25  TYPE(force_env_type), POINTER :: force_env => null()
26  END TYPE mc_environment_type
27 
28 ! **************************************************************************************************
29  TYPE mc_environment_p_type
30  TYPE(mc_environment_type), POINTER :: mc_env => null()
31  END TYPE mc_environment_p_type
32 
33 ! *** Public subroutines and data types ***
34  PUBLIC :: mc_environment_type, mc_environment_p_type, &
37 
38 ! *** Global parameters ***
39 
40  CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mc_environment_types'
41 
42 CONTAINS
43 
44 ! **************************************************************************************************
45 !> \brief creates and initializes an mc_env
46 !> \param mc_env the mc_environment you want to create
47 !>
48 !> Suitable for parallel use.
49 !> \author MJM
50 ! **************************************************************************************************
51  SUBROUTINE mc_env_create(mc_env)
52 
53  TYPE(mc_environment_type), INTENT(OUT) :: mc_env
54 
55  mark_used(mc_env)
56 
57  END SUBROUTINE mc_env_create
58 
59 ! **************************************************************************************************
60 !> \brief provides a method for attaching various structures to an mc_env
61 !> \param mc_env the mc_environment you want to change
62 !> \param mc_par the mc parameters you want to associate with this mc_env
63 !> \param force_env the force environment type you want to associate
64 !> with this mc_env
65 !>
66 !> Suitable for parallel.
67 !> \author MJM
68 ! **************************************************************************************************
69  SUBROUTINE set_mc_env(mc_env, mc_par, force_env)
70 
71  TYPE(mc_environment_type), INTENT(INOUT) :: mc_env
72  TYPE(mc_simpar_type), OPTIONAL, POINTER :: mc_par
73  TYPE(force_env_type), OPTIONAL, POINTER :: force_env
74 
75  IF (PRESENT(mc_par)) mc_env%mc_par => mc_par
76  IF (PRESENT(force_env)) THEN
77  mc_env%force_env => force_env
78  END IF
79 
80  END SUBROUTINE set_mc_env
81 
82 ! **************************************************************************************************
83 !> \brief provides a method for getting the various structures attached
84 !> to an mc_env
85 !> \param mc_env the mc_environment you want to get information on
86 !> \param mc_par the mc parameters you want to point to the parameters
87 !> associated with this mc_env
88 !> \param force_env the force environment type you want to point to the
89 !> force environment associated with this mc_env
90 !>
91 !> Suitable for parallel.
92 !> \author MJM
93 ! **************************************************************************************************
94  SUBROUTINE get_mc_env(mc_env, mc_par, force_env)
95 
96  TYPE(mc_environment_type), INTENT(IN) :: mc_env
97  TYPE(mc_simpar_type), OPTIONAL, POINTER :: mc_par
98  TYPE(force_env_type), OPTIONAL, POINTER :: force_env
99 
100  IF (PRESENT(mc_par)) mc_par => mc_env%mc_par
101  IF (PRESENT(force_env)) force_env => mc_env%force_env
102 
103  END SUBROUTINE get_mc_env
104 
105 ! **************************************************************************************************
106 !> \brief releases the given mc env
107 !> \param mc_env the mc environment to release
108 !> \author MJM
109 !> \note
110 !> see doc/ReferenceCounting.html
111 ! **************************************************************************************************
112  SUBROUTINE mc_env_release(mc_env)
113  TYPE(mc_environment_type), INTENT(INOUT) :: mc_env
114 
115  NULLIFY (mc_env%mc_par)
116  NULLIFY (mc_env%force_env)
117 
118  END SUBROUTINE mc_env_release
119 
120 END MODULE mc_environment_types
121 
Interface for the force calculations.
contains the subroutines for dealing with the mc_env
subroutine, public get_mc_env(mc_env, mc_par, force_env)
provides a method for getting the various structures attached to an mc_env
subroutine, public mc_env_create(mc_env)
creates and initializes an mc_env
subroutine, public set_mc_env(mc_env, mc_par, force_env)
provides a method for attaching various structures to an mc_env
subroutine, public mc_env_release(mc_env)
releases the given mc env
holds all the structure types needed for Monte Carlo, except the mc_environment_type
Definition: mc_types.F:15