aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/cell.c42
-rw-r--r--libcrystfel/src/cell.h5
-rw-r--r--libcrystfel/src/dirax.c54
3 files changed, 32 insertions, 69 deletions
diff --git a/libcrystfel/src/cell.c b/libcrystfel/src/cell.c
index 0dfeaa1e..ec591e24 100644
--- a/libcrystfel/src/cell.c
+++ b/libcrystfel/src/cell.c
@@ -71,9 +71,6 @@ struct _unitcell {
CellRepresentation rep;
int have_parameters;
- int have_a;
- int have_b;
- int have_c;
/* Crystallographic representation */
double a; /* m */
@@ -130,9 +127,6 @@ UnitCell *cell_new()
cell->centering = 'P';
cell->unique_axis = '?';
cell->have_parameters = 0;
- cell->have_a = 0;
- cell->have_b = 0;
- cell->have_c = 0;
return cell;
}
@@ -199,42 +193,6 @@ void cell_set_cartesian(UnitCell *cell,
}
-void cell_set_cartesian_a(UnitCell *cell, double ax, double ay, double az)
-{
- if ( cell == NULL ) return;
- cell->ax = ax; cell->ay = ay; cell->az = az;
- cell->rep = CELL_REP_CART;
- cell->have_a = 1;
- if ( cell->have_a && cell->have_b && cell->have_c ) {
- cell->have_parameters = 1;
- }
-}
-
-
-void cell_set_cartesian_b(UnitCell *cell, double bx, double by, double bz)
-{
- if ( cell == NULL ) return;
- cell->bx = bx; cell->by = by; cell->bz = bz;
- cell->rep = CELL_REP_CART;
- cell->have_b = 1;
- if ( cell->have_a && cell->have_b && cell->have_c ) {
- cell->have_parameters = 1;
- }
-}
-
-
-void cell_set_cartesian_c(UnitCell *cell, double cx, double cy, double cz)
-{
- if ( cell == NULL ) return;
- cell->cx = cx; cell->cy = cy; cell->cz = cz;
- cell->rep = CELL_REP_CART;
- cell->have_c = 1;
- if ( cell->have_a && cell->have_b && cell->have_c ) {
- cell->have_parameters = 1;
- }
-}
-
-
UnitCell *cell_new_from_parameters(double a, double b, double c,
double alpha, double beta, double gamma)
{
diff --git a/libcrystfel/src/cell.h b/libcrystfel/src/cell.h
index 919933b7..46927134 100644
--- a/libcrystfel/src/cell.h
+++ b/libcrystfel/src/cell.h
@@ -127,11 +127,6 @@ extern void cell_set_cartesian(UnitCell *cell,
extern void cell_set_parameters(UnitCell *cell, double a, double b, double c,
double alpha, double beta, double gamma);
-extern void cell_set_cartesian_a(UnitCell *cell, double ax, double ay, double az);
-extern void cell_set_cartesian_b(UnitCell *cell, double bx, double by, double bz);
-extern void cell_set_cartesian_c(UnitCell *cell, double cx, double cy, double cz);
-
-
extern int cell_get_parameters(UnitCell *cell, double *a, double *b, double *c,
double *alpha, double *beta, double *gamma);
diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c
index e61a4bfb..4c674313 100644
--- a/libcrystfel/src/dirax.c
+++ b/libcrystfel/src/dirax.c
@@ -3,11 +3,11 @@
*
* Invoke the DirAx auto-indexing program
*
- * Copyright © 2012-2013 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
*
* Authors:
- * 2010-2013 Thomas White <taw@physics.org>
+ * 2010-2014 Thomas White <taw@physics.org>
*
* This file is part of CrystFEL.
*
@@ -93,10 +93,19 @@ struct dirax_data {
int best_acl_nh;
int acls_tried[MAX_DIRAX_CELL_CANDIDATES];
int n_acls_tried;
- UnitCell *cur_cell;
int done;
int success;
+ float ax;
+ float ay;
+ float az;
+ float bx;
+ float by;
+ float bz;
+ float cx;
+ float cy;
+ float cz;
+
struct dirax_private *dp;
};
@@ -174,7 +183,6 @@ static void dirax_parseline(const char *line, struct image *image,
if ( line[i] == 'R' ) rf = 1;
if ( (line[i] == 'D') && rf ) {
dirax->read_cell = 1;
- dirax->cur_cell = cell_new();
return;
}
i++;
@@ -184,66 +192,68 @@ static void dirax_parseline(const char *line, struct image *image,
if ( dirax->read_cell == 1 ) {
/* First row of unit cell values */
- float ax, ay, az;
int r;
r = sscanf(line, "%f %f %f %f %f %f",
- &d, &d, &d, &ax, &ay, &az);
+ &d, &d, &d, &dirax->ax, &dirax->ay, &dirax->az);
if ( r != 6 ) {
ERROR("Couldn't understand cell line:\n");
ERROR("'%s'\n", line);
dirax->read_cell = 0;
- cell_free(dirax->cur_cell);
return;
}
- cell_set_cartesian_a(dirax->cur_cell,
- ax*1e-10, ay*1e-10, az*1e-10);
+ dirax->ax *= 1e-10;
+ dirax->ay *= 1e-10;
+ dirax->az *= 1e-10;
dirax->read_cell++;
return;
} else if ( dirax->read_cell == 2 ) {
/* Second row of unit cell values */
- float bx, by, bz;
int r;
r = sscanf(line, "%f %f %f %f %f %f",
- &d, &d, &d, &bx, &by, &bz);
+ &d, &d, &d, &dirax->bx, &dirax->by, &dirax->bz);
if ( r != 6 ) {
ERROR("Couldn't understand cell line:\n");
ERROR("'%s'\n", line);
dirax->read_cell = 0;
- cell_free(dirax->cur_cell);
return;
}
- cell_set_cartesian_b(dirax->cur_cell,
- bx*1e-10, by*1e-10, bz*1e-10);
+ dirax->bx *= 1e-10;
+ dirax->by *= 1e-10;
+ dirax->bz *= 1e-10;
dirax->read_cell++;
return;
} else if ( dirax->read_cell == 3 ) {
/* Third row of unit cell values */
- float cx, cy, cz;
int r;
+ UnitCell *cell;
+
r = sscanf(line, "%f %f %f %f %f %f",
- &d, &d, &d, &cx, &cy, &cz);
+ &d, &d, &d, &dirax->cx, &dirax->cy, &dirax->cz);
if ( r != 6 ) {
ERROR("Couldn't understand cell line:\n");
ERROR("'%s'\n", line);
dirax->read_cell = 0;
- cell_free(dirax->cur_cell);
return;
}
- cell_set_cartesian_c(dirax->cur_cell,
- cx*1e-10, cy*1e-10, cz*1e-10);
+ dirax->cx *= 1e-10;
+ dirax->cy *= 1e-10;
+ dirax->cz *= 1e-10;
dirax->read_cell = 0;
+ cell = cell_new();
+ cell_set_cartesian(cell, dirax->ax, dirax->ay, dirax->az,
+ dirax->bx, dirax->by, dirax->bz,
+ dirax->cx, dirax->cy, dirax->cz);
+
/* Finished reading a cell. Time to check it... */
- if ( check_cell(dirax->dp, image, dirax->cur_cell) ) {
+ if ( check_cell(dirax->dp, image, cell) ) {
dirax->done = 1;
dirax->success = 1;
}
- cell_free(dirax->cur_cell);
- dirax->cur_cell = NULL;
return;