aboutsummaryrefslogtreecommitdiff
path: root/src/whirligig.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-06-23 14:59:08 +0200
committerThomas White <taw@physics.org>2015-01-29 13:23:37 +0100
commit74bd9234db193e81e82772fe25d16ed082669d56 (patch)
treef1636030c794116a61d82d15b28412e0d0e4ddc4 /src/whirligig.c
parent5cc72b91690a6eb7736bc3f8a75dd5a8f24457b8 (diff)
Compare each new cell against transformed version of previous one in series
Diffstat (limited to 'src/whirligig.c')
-rw-r--r--src/whirligig.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/whirligig.c b/src/whirligig.c
index 716b89d0..138accf0 100644
--- a/src/whirligig.c
+++ b/src/whirligig.c
@@ -198,19 +198,26 @@ static int try_all(struct image *a, struct image *b, int *c1, int *c2,
/* Try to continue the rotation series from crystal c1 in image a, using any
* crystal from image b */
static int try_cont(struct image *a, struct image *b, int c1, int *c2,
- IntegerMatrix **m2)
+ IntegerMatrix *m1, IntegerMatrix **m2)
{
int j;
+ UnitCell *ref;
+ UnitCellTransformation *tfn;
+
+ tfn = tfn_from_intmat(m1);
+ ref = cell_transform(crystal_get_cell(a->crystals[c1]), tfn);
+ tfn_free(tfn);
for ( j=0; j<b->n_crystals; j++ ) {
- if ( gatinator(crystal_get_cell(a->crystals[c1]),
- crystal_get_cell(b->crystals[j]), m2) )
- {
+ if ( gatinator(ref, crystal_get_cell(b->crystals[j]), m2) ) {
*c2 = j;
+ cell_free(ref);
return 1;
}
}
+ cell_free(ref);
+
return 0;
}
@@ -350,7 +357,7 @@ int main(int argc, char *argv[])
}
} else {
if ( try_cont(&win[pos-1], cur, ser[pos-1], &c2,
- &mat[pos]) )
+ mat[pos-1], &mat[pos]) )
{
ser[pos] = c2;
} else {