aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/asdf.c32
-rw-r--r--libcrystfel/src/dirax.c34
2 files changed, 21 insertions, 45 deletions
diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c
index bbfd1a56..6fee6952 100644
--- a/libcrystfel/src/asdf.c
+++ b/libcrystfel/src/asdf.c
@@ -269,23 +269,6 @@ static int calc_reciprocal(gsl_vector **direct, gsl_vector **reciprocal)
}
-static int check_cell(struct asdf_private *dp, struct image *image,
- UnitCell *cell)
-{
- Crystal *cr;
-
- cr = crystal_new();
- if ( cr == NULL ) {
- ERROR("Failed to allocate crystal.\n");
- return 0;
- }
- crystal_set_cell(cr, cell);
- image_add_crystal(image, cr);
-
- return 1;
-}
-
-
static int compare_doubles(const void *a, const void *b)
{
const double *da = (const double *) a;
@@ -1150,7 +1133,9 @@ int run_asdf(struct image *image, void *ipriv)
}
if ( j ) {
+
UnitCell *uc;
+ Crystal *cr;
uc = cell_new();
cell_set_cartesian(uc, gsl_vector_get(c->axes[0], 0) * 1e-10,
@@ -1163,13 +1148,16 @@ int run_asdf(struct image *image, void *ipriv)
gsl_vector_get(c->axes[2], 1) * 1e-10,
gsl_vector_get(c->axes[2], 2) * 1e-10);
- if ( check_cell(dp, image, uc) ) {
- asdf_cell_free(c);
- cell_free(uc);
- return 1;
+ cr = crystal_new();
+ if ( cr == NULL ) {
+ ERROR("Failed to allocate crystal.\n");
+ return 0;
}
+ crystal_set_cell(cr, uc);
+ image_add_crystal(image, cr);
+ asdf_cell_free(c);
+ return 1;
- cell_free(uc);
}
asdf_cell_free(c);
diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c
index 29b735ad..ecf8a4fd 100644
--- a/libcrystfel/src/dirax.c
+++ b/libcrystfel/src/dirax.c
@@ -105,23 +105,6 @@ struct dirax_data {
};
-static int check_cell(struct dirax_private *dp, struct image *image,
- UnitCell *cell)
-{
- Crystal *cr;
-
- cr = crystal_new();
- if ( cr == NULL ) {
- ERROR("Failed to allocate crystal.\n");
- return 0;
- }
- crystal_set_cell(cr, cell);
- image_add_crystal(image, cr);
-
- return 1;
-}
-
-
static void dirax_parseline(const char *line, struct image *image,
struct dirax_data *dirax)
{
@@ -199,6 +182,7 @@ static void dirax_parseline(const char *line, struct image *image,
/* Third row of unit cell values */
int r;
UnitCell *cell;
+ Crystal *cr;
r = sscanf(line, "%f %f %f %f %f %f",
&d, &d, &d, &dirax->cx, &dirax->cy, &dirax->cz);
@@ -218,13 +202,17 @@ static void dirax_parseline(const char *line, struct image *image,
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, cell) ) {
- dirax->done = 1;
- dirax->success = 1;
- }
+ /* Finished reading a cell. */
- cell_free(cell);
+ cr = crystal_new();
+ if ( cr == NULL ) {
+ ERROR("Failed to allocate crystal.\n");
+ return;
+ }
+ crystal_set_cell(cr, cell);
+ image_add_crystal(image, cr);
+ dirax->done = 1;
+ dirax->success = 1;
return;