aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/reflist-utils.c16
-rw-r--r--src/reflist.c8
2 files changed, 14 insertions, 10 deletions
diff --git a/src/reflist-utils.c b/src/reflist-utils.c
index 3991600d..af43b1ff 100644
--- a/src/reflist-utils.c
+++ b/src/reflist-utils.c
@@ -106,12 +106,10 @@ unsigned char *flags_from_list(RefList *list)
int check_list_symmetry(RefList *list, const SymOpList *sym)
{
- unsigned char *flags;
Reflection *refl;
RefListIterator *iter;
SymOpMask *mask;
- flags = flags_from_list(list);
mask = new_symopmask(sym);
if ( mask == NULL ) {
ERROR("Couldn't create mask for list symmetry check.\n");
@@ -135,26 +133,24 @@ int check_list_symmetry(RefList *list, const SymOpList *sym)
for ( j=0; j<n; j++ ) {
signed int he, ke, le;
- get_equiv(sym, mask, j, h, k, l, &he, &ke, &le);
+ Reflection *f;
- if ( abs(he) > INDMAX ) continue;
- if ( abs(le) > INDMAX ) continue;
- if ( abs(ke) > INDMAX ) continue;
+ get_equiv(sym, mask, j, h, k, l, &he, &ke, &le);
- found += lookup_flag(flags, he, ke, le);
+ f = find_refl(list, he, ke, le);
+ if ( f != NULL ) found++;
}
+ assert(found != 0); /* That'd just be silly */
if ( found > 1 ) {
- free(flags);
free_symopmask(mask);
- STATUS("Found %i %i %i twice\n", h, k, l);
+ STATUS("Found %i %i %i: %i times\n", h, k, l, found);
return 1; /* Symmetry is wrong! */
}
}
- free(flags);
free_symopmask(mask);
return 0;
diff --git a/src/reflist.c b/src/reflist.c
index aefbf4e2..45cd132e 100644
--- a/src/reflist.c
+++ b/src/reflist.c
@@ -212,6 +212,14 @@ Reflection *find_refl(const RefList *list,
if ( list->head == NULL ) return NULL;
+ /* Indices greater than or equal to 256 are filtered out when
+ * reflections are added, so don't even bother looking.
+ * (also, looking for such reflections causes trouble because the search
+ * serial number would be invalid) */
+ if ( abs(h) >= 256 ) return NULL;
+ if ( abs(k) >= 256 ) return NULL;
+ if ( abs(l) >= 256 ) return NULL;
+
refl = list->head;
while ( refl != NULL ) {