From f623ac19805a60e0eb9ad58c9132fbc655dfdb98 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 26 Jun 2014 10:21:13 +0200 Subject: Tidy up / fussiness --- libcrystfel/src/symmetry.c | 49 +++++++--------------------------------------- libcrystfel/src/symmetry.h | 4 +++- 2 files changed, 10 insertions(+), 43 deletions(-) (limited to 'libcrystfel') 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 + * 2014 Kenneth Beyerlein * * 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; imask[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 + * 2014 Kenneth Beyerlein * * 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); -- cgit v1.2.3