aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/symmetry.h
blob: 42a2b9fba9ef6a319b983490090c080809865c86 (plain)
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
/*
 * symmetry.h
 *
 * Symmetry
 *
 * Copyright © 2012-2019 Deutsches Elektronen-Synchrotron DESY,
 *                       a research centre of the Helmholtz Association.
 *
 * Authors:
 *   2010-2019 Thomas White <taw@physics.org>
 *   2014      Kenneth Beyerlein <kenneth.beyerlein@desy.de>
 *
 * This file is part of CrystFEL.
 *
 * CrystFEL is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * CrystFEL is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with CrystFEL.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef SYMMETRY_H
#define SYMMETRY_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif


#include "integer_matrix.h"
#include "rational.h"

/**
 * \file symmetry.h
 * Point group symmetry
 */

/**
 * The SymOpList is an opaque data structure containing a list of point symmetry
 * operations.  It could represent an point group or a list of indexing
 * ambiguities (twin laws), or similar.
 **/
typedef struct _symoplist SymOpList;

/**
 * The SymOpMask is an opaque data structure containing a list of flags
 * associated with point symmetry operations in a specific \ref SymOpList.  It is
 * used to filter the operations in the \ref SymOpList to avoid duplicating
 * equivalent reflections when the reflection is somehow special (e.g. 'hk0').
 **/
typedef struct _symopmask SymOpMask;

#ifdef __cplusplus
extern "C" {
#endif

extern void free_symoplist(SymOpList *ops);
extern SymOpList *get_pointgroup(const char *sym);

extern SymOpMask *new_symopmask(const SymOpList *list);
extern void free_symopmask(SymOpMask *m);

extern void special_position(const SymOpList *ops, SymOpMask *m,
                             signed int h, signed int k, signed int l);
extern void get_asymm(const SymOpList *ops,
                      signed int h, signed int k, signed int l,
                      signed int *hp, signed int *kp, signed int *lp);
extern int num_equivs(const SymOpList *ops, const SymOpMask *m);
extern void get_equiv(const SymOpList *ops, const SymOpMask *m, int idx,
                      signed int h, signed int k, signed int l,
                      signed int *he, signed int *ke, signed int *le);
extern IntegerMatrix *get_symop(const SymOpList *ops, const SymOpMask *m,
                                int idx);

extern SymOpList *get_ambiguities(const SymOpList *source,
                                  const SymOpList *target);
extern int is_subgroup(const SymOpList *source, const SymOpList *target);

extern int is_centrosymmetric(const SymOpList *s);
extern const char *symmetry_name(const SymOpList *ops);
extern void set_symmetry_name(SymOpList *ops, const char *name);
extern void describe_symmetry(const SymOpList *s);

extern int is_centric(signed int h, signed int k, signed int l,
                      const SymOpList *ops);

extern void pointgroup_warning(const char *sym);

extern void add_symop(SymOpList *ops, IntegerMatrix *m);
extern RationalMatrix *parse_symmetry_operation(const char *s);
extern SymOpList *parse_symmetry_operations(const char *s);
extern RationalMatrix *parse_cell_transformation(const char *s);
extern char *get_matrix_name(const IntegerMatrix *m, int row);

#ifdef __cplusplus
}
#endif

#endif	/* SYMMETRY_H */