-
Notifications
You must be signed in to change notification settings - Fork 1
/
spglib_f08.F
341 lines (299 loc) · 14.4 KB
/
spglib_f08.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
!--------------------------------------------------------------------------------------------------!
! 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 !
!--------------------------------------------------------------------------------------------------!
! **************************************************************************************************
!> \brief Interface for SPGLIB symmetry routines
!> \par History
!> \author jgh
! **************************************************************************************************
#ifdef __SPGLIB
MODULE spglib_f08
USE iso_c_binding, ONLY: c_char,&
c_double,&
c_int
IMPLICIT NONE
PRIVATE
INTERFACE
FUNCTION spg_get_symmetry(rotation, translation, max_size, lattice, &
position, types, num_atom, symprec) bind(c)
import c_int, c_double
INTEGER(c_int), INTENT(inout) :: rotation(3, 3, *)
REAL(c_double), INTENT(inout) :: translation(3, *)
INTEGER(c_int), INTENT(in), value :: max_size
REAL(c_double), INTENT(in) :: lattice(3, 3), position(3, *)
INTEGER(c_int), INTENT(in) :: types(*)
INTEGER(c_int), INTENT(in), value :: num_atom
REAL(c_double), INTENT(in), value :: symprec
INTEGER(c_int) :: spg_get_symmetry
END FUNCTION spg_get_symmetry
FUNCTION spg_get_multiplicity(lattice, position, types, num_atom, symprec) bind(c)
import c_int, c_double
REAL(c_double), INTENT(in) :: lattice(3, 3), position(3, *)
INTEGER(c_int), INTENT(in) :: types(*)
INTEGER(c_int), INTENT(in), value :: num_atom
REAL(c_double), INTENT(in), value :: symprec
INTEGER(c_int) :: spg_get_multiplicity
END FUNCTION spg_get_multiplicity
FUNCTION spg_get_international(symbol, lattice, position, types, num_atom, symprec) bind(c)
import c_char, c_int, c_double
CHARACTER(kind=c_char), INTENT(out) :: symbol(11)
REAL(c_double), INTENT(in) :: lattice(3, 3), position(3, *)
INTEGER(c_int), INTENT(in) :: types(*)
INTEGER(c_int), INTENT(in), value :: num_atom
REAL(c_double), INTENT(in), value :: symprec
INTEGER(c_int) :: spg_get_international ! the number corresponding to 'symbol'. 0 on failure
END FUNCTION spg_get_international
FUNCTION spg_get_schoenflies(symbol, lattice, position, types, num_atom, symprec) bind(c)
import c_char, c_int, c_double
CHARACTER(kind=c_char), INTENT(out) :: symbol(7)
REAL(c_double), INTENT(in) :: lattice(3, 3), position(3, *)
INTEGER(c_int), INTENT(in) :: types(*)
INTEGER(c_int), INTENT(in), value :: num_atom
REAL(c_double), INTENT(in), value :: symprec
INTEGER(c_int) :: spg_get_schoenflies ! the number corresponding to 'symbol'. 0 on failure
END FUNCTION spg_get_schoenflies
FUNCTION spg_get_pointgroup(symbol, trans_mat, rotations, num_rotations) bind(c)
import c_char, c_int, c_double
CHARACTER(kind=c_char) :: symbol(6)
INTEGER(c_int), INTENT(inout) :: trans_mat(3, 3)
INTEGER(c_int), INTENT(in) :: rotations(3, 3, *)
INTEGER(c_int), INTENT(in), value :: num_rotations
INTEGER(c_int) :: spg_get_pointgroup
END FUNCTION spg_get_pointgroup
FUNCTION spg_get_ir_reciprocal_mesh(grid_point, map, mesh, &
is_shift, is_time_reversal, lattice, position, types, num_atom, symprec) bind(c)
import c_int, c_double
! Beware the map refers to positions starting at 0
INTEGER(c_int), INTENT(out) :: grid_point(3, *), map(*) ! size is product(mesh)
INTEGER(c_int), INTENT(in) :: mesh(3), is_shift(3)
INTEGER(c_int), INTENT(in), value :: is_time_reversal
REAL(c_double), INTENT(in) :: lattice(3, 3), position(3, *)
INTEGER(c_int), INTENT(in) :: types(*)
INTEGER(c_int), INTENT(in), value :: num_atom
REAL(c_double), INTENT(in), value :: symprec
INTEGER(c_int) :: spg_get_ir_reciprocal_mesh ! the number of points in the reduced mesh
END FUNCTION spg_get_ir_reciprocal_mesh
FUNCTION spg_get_major_version() bind(c)
import c_int
INTEGER(c_int) :: spg_get_major_version
END FUNCTION spg_get_major_version
FUNCTION spg_get_minor_version() bind(c)
import c_int
INTEGER(c_int) :: spg_get_minor_version
END FUNCTION spg_get_minor_version
FUNCTION spg_get_micro_version() bind(c)
import c_int
INTEGER(c_int) :: spg_get_micro_version
END FUNCTION spg_get_micro_version
END INTERFACE
PUBLIC :: spg_get_symmetry, spg_get_multiplicity, spg_get_international, spg_get_schoenflies, &
spg_get_pointgroup, spg_get_ir_reciprocal_mesh, &
spg_get_major_version, spg_get_minor_version, spg_get_micro_version
END MODULE spglib_f08
#else
! **************************************************************************************************
!> \brief This is a stub for the Interface for SPGLIB symmetry routines
!> \par History
!> \author jgh
! **************************************************************************************************
MODULE spglib_f08
USE kinds, ONLY: dp
#include "./base/base_uses.f90"
IMPLICIT NONE
PRIVATE
PUBLIC :: spg_get_symmetry, spg_get_multiplicity, spg_get_international, spg_get_schoenflies, &
spg_get_pointgroup, spg_get_ir_reciprocal_mesh, &
spg_get_major_version, spg_get_minor_version, spg_get_micro_version
CONTAINS
! **************************************************************************************************
!> \brief ...
!> \param rotation ...
!> \param translation ...
!> \param max_size ...
!> \param lattice ...
!> \param position ...
!> \param types ...
!> \param num_atom ...
!> \param symprec ...
!> \return ...
! **************************************************************************************************
FUNCTION spg_get_symmetry(rotation, translation, max_size, lattice, &
position, types, num_atom, symprec)
INTEGER, INTENT(inout) :: rotation(:, :, :)
REAL(KIND=dp), INTENT(inout) :: translation(:, :)
INTEGER, INTENT(in) :: max_size
REAL(KIND=dp), INTENT(in) :: lattice(:, :), position(:, :)
INTEGER, INTENT(in) :: types(:), num_atom
REAL(KIND=dp), INTENT(in) :: symprec
INTEGER :: spg_get_symmetry
MARK_USED(rotation)
MARK_USED(translation)
MARK_USED(max_size)
MARK_USED(lattice)
MARK_USED(position)
MARK_USED(types)
MARK_USED(num_atom)
MARK_USED(symprec)
spg_get_symmetry = 0
CPABORT("Requires linking to the SPGLIB library.")
END FUNCTION spg_get_symmetry
! **************************************************************************************************
!> \brief ...
!> \param lattice ...
!> \param position ...
!> \param types ...
!> \param num_atom ...
!> \param symprec ...
!> \return ...
! **************************************************************************************************
FUNCTION spg_get_multiplicity(lattice, position, types, num_atom, symprec)
REAL(KIND=dp), INTENT(in) :: lattice(:, :), position(:, :)
INTEGER, INTENT(in) :: types(:), num_atom
REAL(KIND=dp), INTENT(in) :: symprec
INTEGER :: spg_get_multiplicity
MARK_USED(lattice)
MARK_USED(position)
MARK_USED(types)
MARK_USED(num_atom)
MARK_USED(symprec)
spg_get_multiplicity = 0
CPABORT("Requires linking to the SPGLIB library.")
END FUNCTION spg_get_multiplicity
! **************************************************************************************************
!> \brief ...
!> \param symbol ...
!> \param lattice ...
!> \param position ...
!> \param types ...
!> \param num_atom ...
!> \param symprec ...
!> \return ...
! **************************************************************************************************
FUNCTION spg_get_international(symbol, lattice, position, types, num_atom, symprec)
CHARACTER, INTENT(out) :: symbol(11)
REAL(KIND=dp), INTENT(in) :: lattice(:, :), position(:, :)
INTEGER, INTENT(in) :: types(:), num_atom
REAL(KIND=dp), INTENT(in) :: symprec
INTEGER :: spg_get_international
! the number corresponding to 'symbol'. 0 on failure
MARK_USED(lattice)
MARK_USED(position)
MARK_USED(types)
MARK_USED(num_atom)
MARK_USED(symprec)
spg_get_international = 0
symbol = " "
CPABORT("Requires linking to the SPGLIB library.")
END FUNCTION spg_get_international
! **************************************************************************************************
!> \brief ...
!> \param symbol ...
!> \param lattice ...
!> \param position ...
!> \param types ...
!> \param num_atom ...
!> \param symprec ...
!> \return ...
! **************************************************************************************************
FUNCTION spg_get_schoenflies(symbol, lattice, position, types, num_atom, symprec)
CHARACTER, INTENT(out) :: symbol(7)
REAL(KIND=dp), INTENT(in) :: lattice(:, :), position(:, :)
INTEGER, INTENT(in) :: types(:), num_atom
REAL(KIND=dp), INTENT(in) :: symprec
INTEGER :: spg_get_schoenflies
! the number corresponding to 'symbol'. 0 on failure
MARK_USED(lattice)
MARK_USED(position)
MARK_USED(types)
MARK_USED(num_atom)
MARK_USED(symprec)
spg_get_schoenflies = 0
symbol = " "
CPABORT("Requires linking to the SPGLIB library.")
END FUNCTION spg_get_schoenflies
! **************************************************************************************************
!> \brief ...
!> \param symbol ...
!> \param trans_mat ...
!> \param rotations ...
!> \param num_rotations ...
!> \return ...
! **************************************************************************************************
FUNCTION spg_get_pointgroup(symbol, trans_mat, rotations, num_rotations)
CHARACTER :: symbol(6)
INTEGER, INTENT(inout) :: trans_mat(:, :)
INTEGER, INTENT(in) :: rotations(:, :, :), num_rotations
INTEGER :: spg_get_pointgroup
MARK_USED(trans_mat)
MARK_USED(rotations)
MARK_USED(num_rotations)
spg_get_pointgroup = 0
symbol = " "
CPABORT("Requires linking to the SPGLIB library.")
END FUNCTION spg_get_pointgroup
! **************************************************************************************************
!> \brief ...
!> \param grid_point ...
!> \param map ...
!> \param mesh ...
!> \param is_shift ...
!> \param is_time_reversal ...
!> \param lattice ...
!> \param position ...
!> \param types ...
!> \param num_atom ...
!> \param symprec ...
!> \return ...
! **************************************************************************************************
FUNCTION spg_get_ir_reciprocal_mesh(grid_point, map, mesh, &
is_shift, is_time_reversal, lattice, position, types, num_atom, symprec)
INTEGER, INTENT(out) :: grid_point(:, :), map(:)
INTEGER, INTENT(in) :: mesh(:), is_shift(:), is_time_reversal
REAL(KIND=dp), INTENT(in) :: lattice(:, :), position(:, :)
INTEGER, INTENT(in) :: types(:), num_atom
REAL(KIND=dp), INTENT(in) :: symprec
INTEGER :: spg_get_ir_reciprocal_mesh
! size is product(mesh)
! the number of points in the reduced mesh
MARK_USED(grid_point)
MARK_USED(map)
MARK_USED(mesh)
MARK_USED(is_shift)
MARK_USED(is_time_reversal)
MARK_USED(lattice)
MARK_USED(position)
MARK_USED(types)
MARK_USED(num_atom)
MARK_USED(symprec)
spg_get_ir_reciprocal_mesh = 0
CPABORT("Requires linking to the SPGLIB library.")
END FUNCTION spg_get_ir_reciprocal_mesh
! **************************************************************************************************
!> \brief ...
!> \return ...
! **************************************************************************************************
FUNCTION spg_get_major_version()
INTEGER :: spg_get_major_version
spg_get_major_version = 0
END FUNCTION spg_get_major_version
! **************************************************************************************************
!> \brief ...
!> \return ...
! **************************************************************************************************
FUNCTION spg_get_minor_version()
INTEGER :: spg_get_minor_version
spg_get_minor_version = 0
END FUNCTION spg_get_minor_version
! **************************************************************************************************
!> \brief ...
!> \return ...
! **************************************************************************************************
FUNCTION spg_get_micro_version()
INTEGER :: spg_get_micro_version
spg_get_micro_version = 0
END FUNCTION spg_get_micro_version
END MODULE spglib_f08
#endif