diff options
-rw-r--r-- | src/cell.c | 26 | ||||
-rw-r--r-- | src/cell.h | 7 | ||||
-rw-r--r-- | src/stream.c | 4 |
3 files changed, 30 insertions, 7 deletions
@@ -188,7 +188,8 @@ UnitCell *cell_new_from_parameters(double a, double b, double c, } -UnitCell *cell_new_from_axes(struct rvec as, struct rvec bs, struct rvec cs) +UnitCell *cell_new_from_reciprocal_axes(struct rvec as, struct rvec bs, + struct rvec cs) { UnitCell *cell; @@ -205,6 +206,23 @@ UnitCell *cell_new_from_axes(struct rvec as, struct rvec bs, struct rvec cs) } +UnitCell *cell_new_from_direct_axes(struct rvec a, struct rvec b, struct rvec c) +{ + UnitCell *cell; + + cell = cell_new(); + if ( cell == NULL ) return NULL; + + cell->ax = a.u; cell->ay = a.v; cell->az = a.w; + cell->bx = b.u; cell->by = b.v; cell->bz = b.w; + cell->cx = c.u; cell->cy = c.v; cell->cz = c.w; + + cell->rep = CELL_REP_CART; + + return cell; +} + + UnitCell *cell_new_from_cell(UnitCell *orig) { UnitCell *new; @@ -807,9 +825,9 @@ UnitCell *match_cell(UnitCell *cell, UnitCell *template, int verbose, if ( fom3 < best_fom ) { if ( new_cell != NULL ) free(new_cell); - new_cell = cell_new_from_axes(cand[0][i].vec, - cand[1][j].vec, - cand[2][k].vec); + new_cell = cell_new_from_reciprocal_axes( + cand[0][i].vec, cand[1][j].vec, + cand[2][k].vec); best_fom = fom3; } @@ -43,8 +43,11 @@ extern void cell_free(UnitCell *cell); extern UnitCell *cell_new_from_parameters(double a, double b, double c, double alpha, double beta, double gamma); -extern UnitCell *cell_new_from_axes(struct rvec as, struct rvec bs, - struct rvec cs); +extern UnitCell *cell_new_from_reciprocal_axes(struct rvec as, struct rvec bs, + struct rvec cs); + +extern UnitCell *cell_new_from_direct_axes(struct rvec as, struct rvec bs, + struct rvec cs); extern void cell_set_cartesian(UnitCell *cell, double ax, double ay, double az, diff --git a/src/stream.c b/src/stream.c index 4157e34e..99344404 100644 --- a/src/stream.c +++ b/src/stream.c @@ -377,7 +377,9 @@ int read_chunk(FILE *fh, struct image *image) ERROR("Duplicate cell found in stream!\n"); cell_free(image->indexed_cell); } - image->indexed_cell = cell_new_from_axes(as, bs, cs); + image->indexed_cell = cell_new_from_reciprocal_axes(as, + bs, + cs); have_cell = 1; have_as = 0; have_bs = 0; have_cs = 0; } |