Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4 : ! !
5 : ! SPDX-License-Identifier: GPL-2.0-or-later !
6 : !--------------------------------------------------------------------------------------------------!
7 :
8 : ! **************************************************************************************************
9 : !> \brief Space Group Symmetry Type Module (version 1.0, Ferbruary 12, 2021)
10 : !> \par History
11 : !> Pierre-André Cazade [pcazade] 02.2021 - University of Limerick
12 : !> \author Pierre-André Cazade (first version)
13 : ! **************************************************************************************************
14 : MODULE space_groups_types
15 :
16 : USE cell_types, ONLY: cell_release,&
17 : cell_type
18 : USE kinds, ONLY: dp
19 : #include "../base/base_uses.f90"
20 :
21 : IMPLICIT NONE
22 :
23 : PRIVATE
24 :
25 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'space_groups_types'
26 :
27 : TYPE spgr_type
28 : LOGICAL :: keep_space_group = .FALSE.
29 : LOGICAL :: show_space_group = .FALSE.
30 : LOGICAL :: symlib = .FALSE.
31 : LOGICAL :: print_atoms = .FALSE.
32 : INTEGER :: iunit = -1
33 : INTEGER :: istriz = -1
34 : REAL(KIND=dp) :: eps_symmetry = 1.0e-4_dp
35 : INTEGER :: nparticle = 0
36 : INTEGER :: nparticle_sym = 0
37 : INTEGER :: n_atom = 0
38 : INTEGER :: n_core = 0
39 : INTEGER :: n_shell = 0
40 : INTEGER :: n_atom_sym = 0
41 : INTEGER :: n_core_sym = 0
42 : INTEGER :: n_shell_sym = 0
43 : INTEGER, DIMENSION(:), ALLOCATABLE :: atype
44 : INTEGER, DIMENSION(:, :), ALLOCATABLE :: eqatom
45 : LOGICAL, DIMENSION(:), ALLOCATABLE :: lop, lat
46 : REAL(KIND=dp), DIMENSION(3) :: pol = 0.0_dp
47 : !SPGLIB
48 : INTEGER :: space_group_number = 0
49 : CHARACTER(len=11) :: international_symbol = ""
50 : CHARACTER(len=6) :: pointgroup_symbol = ""
51 : CHARACTER(len=7) :: schoenflies = ""
52 : INTEGER :: n_operations = 0
53 : INTEGER :: n_reduced_operations = 0
54 : INTEGER :: n_operations_subset = 0
55 : INTEGER, DIMENSION(:, :, :), ALLOCATABLE :: rotations
56 : INTEGER, DIMENSION(:, :, :), ALLOCATABLE :: rotations_subset
57 : REAL(KIND=dp), DIMENSION(:, :), ALLOCATABLE :: translations
58 : TYPE(cell_type), POINTER :: cell_ref => NULL()
59 : END TYPE spgr_type
60 :
61 : PUBLIC :: spgr_type, release_spgr_type, cleanup_spgr_type
62 :
63 : CONTAINS
64 :
65 : ! **************************************************************************************************
66 : !> \brief Release the SPGR type
67 : !> \param spgr The SPGR type
68 : !> \par History
69 : !> 01.2020 created [pcazade]
70 : !> \author Pierre-André Cazade (first version)
71 : ! **************************************************************************************************
72 2046 : SUBROUTINE release_spgr_type(spgr)
73 :
74 : TYPE(spgr_type), POINTER :: spgr
75 :
76 2046 : IF (ASSOCIATED(spgr)) THEN
77 2046 : CALL cleanup_spgr_type(spgr)
78 2046 : DEALLOCATE (spgr)
79 : END IF
80 :
81 2046 : END SUBROUTINE release_spgr_type
82 :
83 : ! **************************************************************************************************
84 : !> \brief Cleanup all buffers the SPGR type
85 : !> \param spgr The SPGR type
86 : !> \par History
87 : !> 01.2020 created [pcazade]
88 : !> \author Pierre-André Cazade (first version)
89 : ! **************************************************************************************************
90 2060 : SUBROUTINE cleanup_spgr_type(spgr)
91 :
92 : TYPE(spgr_type), INTENT(INOUT) :: spgr
93 :
94 2060 : IF (ALLOCATED(spgr%rotations)) THEN
95 14 : DEALLOCATE (spgr%rotations)
96 : END IF
97 2060 : IF (ALLOCATED(spgr%rotations_subset)) THEN
98 14 : DEALLOCATE (spgr%rotations_subset)
99 : END IF
100 2060 : IF (ALLOCATED(spgr%translations)) THEN
101 14 : DEALLOCATE (spgr%translations)
102 : END IF
103 2060 : IF (ALLOCATED(spgr%atype)) THEN
104 14 : DEALLOCATE (spgr%atype)
105 : END IF
106 2060 : IF (ALLOCATED(spgr%eqatom)) THEN
107 14 : DEALLOCATE (spgr%eqatom)
108 : END IF
109 2060 : IF (ALLOCATED(spgr%lop)) THEN
110 14 : DEALLOCATE (spgr%lop)
111 : END IF
112 2060 : IF (ALLOCATED(spgr%lat)) THEN
113 14 : DEALLOCATE (spgr%lat)
114 : END IF
115 :
116 2060 : CALL cell_release(spgr%cell_ref)
117 :
118 2060 : END SUBROUTINE cleanup_spgr_type
119 :
120 0 : END MODULE space_groups_types
|