aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-06-26 10:21:13 +0200
committerThomas White <taw@physics.org>2014-06-26 10:27:20 +0200
commitf623ac19805a60e0eb9ad58c9132fbc655dfdb98 (patch)
tree662117d82e68e8b65dac0f8d7c09a9407891bfc1 /libcrystfel
parent2a795e8605e20f0fa3e20fed094f0c906b147628 (diff)
Tidy up / fussiness
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/symmetry.c49
-rw-r--r--libcrystfel/src/symmetry.h4
2 files changed, 10 insertions, 43 deletions
diff --git a/libcrystfel/src/symmetry.c b/libcrystfel/src/symmetry.c
index 14b108b7..1a4fee1e 100644
--- a/libcrystfel/src/symmetry.c
+++ b/libcrystfel/src/symmetry.c
@@ -8,6 +8,7 @@
*
* Authors:
* 2010-2014 Thomas White <taw@physics.org>
+ * 2014 Kenneth Beyerlein <kenneth.beyerlein@desy.de>
*
* This file is part of CrystFEL.
*
@@ -215,7 +216,7 @@ static void add_symop_v(SymOpList *ops,
* contained in the symmetry operator list, and identified by the specified
* index.
**/
-IntegerMatrix* get_symop(const SymOpList *ops, const SymOpMask *m, int idx)
+IntegerMatrix *get_symop(const SymOpList *ops, const SymOpMask *m, int idx)
{
const int n = num_ops(ops);
@@ -255,6 +256,7 @@ IntegerMatrix* get_symop(const SymOpList *ops, const SymOpMask *m, int idx)
return ops->ops[idx];
}
+
static signed int *v(signed int h, signed int k, signed int i, signed int l)
{
signed int *vec = malloc(3*sizeof(signed int));
@@ -1130,47 +1132,10 @@ 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)
{
- const int n = num_ops(ops);
-
- if ( m != NULL ) {
-
- int i, c;
-
- c = 0;
- for ( i=0; i<n; i++ ) {
-
- if ( (c == idx) && m->mask[i] ) {
- do_op(ops->ops[i], h, k, l, he, ke, le);
- return;
- }
-
- if ( m->mask[i] ) {
- c++;
- }
-
- }
-
- ERROR("Index %i out of range for point group '%s' with"
- " reflection %i %i %i\n",
- idx, symmetry_name(ops), h, k, l);
-
- *he = 0; *ke = 0; *le = 0;
-
- return;
-
- }
-
- if ( idx >= n ) {
-
- ERROR("Index %i out of range for point group '%s'\n", idx,
- symmetry_name(ops));
-
- *he = 0; *ke = 0; *le = 0;
- return;
-
- }
-
- do_op(ops->ops[idx], h, k, l, he, ke, le);
+ IntegerMatrix *op;
+ op = get_symop(ops, m, idx);
+ if ( op == NULL ) return;
+ do_op(op, h, k, l, he, ke, le);
}
diff --git a/libcrystfel/src/symmetry.h b/libcrystfel/src/symmetry.h
index 42cbd9b3..d7373ba2 100644
--- a/libcrystfel/src/symmetry.h
+++ b/libcrystfel/src/symmetry.h
@@ -8,6 +8,7 @@
*
* Authors:
* 2010-2014 Thomas White <taw@physics.org>
+ * 2014 Kenneth Beyerlein <kenneth.beyerlein@desy.de>
*
* This file is part of CrystFEL.
*
@@ -61,7 +62,6 @@ extern "C" {
extern void free_symoplist(SymOpList *ops);
extern SymOpList *get_pointgroup(const char *sym);
-extern IntegerMatrix* get_symop(const SymOpList *ops, const SymOpMask *m, int idx);
extern SymOpMask *new_symopmask(const SymOpList *list);
extern void free_symopmask(SymOpMask *m);
@@ -75,6 +75,8 @@ 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);