-
Notifications
You must be signed in to change notification settings - Fork 1
/
mixed_energy_types.F
89 lines (74 loc) · 3.57 KB
/
mixed_energy_types.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
!--------------------------------------------------------------------------------------------------!
! CP2K: A general program to perform molecular dynamics simulations !
! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
! !
! SPDX-License-Identifier: GPL-2.0-or-later !
!--------------------------------------------------------------------------------------------------!
! **************************************************************************************************
!> \author fschiff
!> \date 11.06
! **************************************************************************************************
MODULE mixed_energy_types
USE kinds, ONLY: dp
#include "./base/base_uses.f90"
IMPLICIT NONE
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mixed_energy_types'
PRIVATE
! **************************************************************************************************
TYPE mixed_energy_type
REAL(kind=dp) :: pot = 0.0_dp
REAL(kind=dp) :: kin = 0.0_dp
END TYPE mixed_energy_type
! **************************************************************************************************
TYPE mixed_force_type
REAL(KIND=dp), DIMENSION(:, :), POINTER :: forces => NULL()
END TYPE mixed_force_type
! Public data types
PUBLIC :: mixed_energy_type, &
mixed_force_type
! Public subroutines
PUBLIC :: allocate_mixed_energy, &
deallocate_mixed_energy
CONTAINS
! **************************************************************************************************
!> \brief Allocate and/or initialise a mixed energy data structure.
!> \param mixed_energy ...
!> \date 11.06
!> \author fschiff
!> \version 1.0
! **************************************************************************************************
SUBROUTINE allocate_mixed_energy(mixed_energy)
TYPE(mixed_energy_type), POINTER :: mixed_energy
IF (.NOT. ASSOCIATED(mixed_energy)) THEN
ALLOCATE (mixed_energy)
END IF
CALL init_mixed_energy(mixed_energy)
END SUBROUTINE allocate_mixed_energy
! **************************************************************************************************
!> \brief Deallocate a mixed energy data structure.
!> \param mixed_energy ...
!> \date 11.06
!> \author fschiff
!> \version 1.0
! **************************************************************************************************
SUBROUTINE deallocate_mixed_energy(mixed_energy)
TYPE(mixed_energy_type), POINTER :: mixed_energy
IF (ASSOCIATED(mixed_energy)) THEN
DEALLOCATE (mixed_energy)
END IF
END SUBROUTINE deallocate_mixed_energy
! **************************************************************************************************
!> \brief ...
!> \param mixed_energy ...
! **************************************************************************************************
SUBROUTINE init_mixed_energy(mixed_energy)
TYPE(mixed_energy_type), POINTER :: mixed_energy
IF (ASSOCIATED(mixed_energy)) THEN
mixed_energy%pot = 0.0_dp
ELSE
CALL cp_abort(__LOCATION__, &
"The mixed_energy pointer is not associated "// &
"and cannot be initialised")
END IF
END SUBROUTINE init_mixed_energy
END MODULE mixed_energy_types