aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-04-24 16:52:16 +0200
committerThomas White <taw@physics.org>2023-07-28 13:22:04 +0200
commit99849c8ed87a424a76e4826ed39ad65cacfaecfb (patch)
tree23c1b0f505527cf7550f65e0f004d505e2efe2a9 /libcrystfel
parentc8fb149760f7a8ef4e018f22e79bcb48e1e3c444 (diff)
indexamajig: Hooks for Mille
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/index.c18
-rw-r--r--libcrystfel/src/index.h8
-rw-r--r--libcrystfel/src/predict-refine.c35
-rw-r--r--libcrystfel/src/predict-refine.h9
4 files changed, 59 insertions, 11 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index 02b01757..e3512b4a 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -591,7 +591,8 @@ static float real_time()
/* Return non-zero for "success" */
static int try_indexer(struct image *image, IndexingMethod indm,
- IndexingPrivate *ipriv, void *mpriv, char *last_task)
+ IndexingPrivate *ipriv, void *mpriv, char *last_task,
+ Mille *mille)
{
int i, r;
int n_bad = 0;
@@ -719,7 +720,7 @@ static int try_indexer(struct image *image, IndexingMethod indm,
{
int r;
profile_start("refine");
- r = refine_prediction(image, cr);
+ r = refine_prediction(image, cr, mille);
profile_end("refine");
if ( r ) {
crystal_set_user_flag(cr, 1);
@@ -920,19 +921,26 @@ static int finished_retry(IndexingMethod indm, IndexingFlags flags,
void index_pattern(struct image *image, IndexingPrivate *ipriv)
{
- index_pattern_3(image, ipriv, NULL, NULL);
+ index_pattern_4(image, ipriv, NULL, NULL, NULL);
}
void index_pattern_2(struct image *image, IndexingPrivate *ipriv, int *ping)
{
- index_pattern_3(image, ipriv, ping, NULL);
+ index_pattern_4(image, ipriv, ping, NULL, NULL);
}
void index_pattern_3(struct image *image, IndexingPrivate *ipriv, int *ping,
char *last_task)
{
+ index_pattern_4(image, ipriv, ping, last_task, NULL);
+}
+
+
+void index_pattern_4(struct image *image, IndexingPrivate *ipriv, int *ping,
+ char *last_task, Mille *mille)
+{
int n = 0;
ImageFeatureList *orig;
@@ -982,7 +990,7 @@ void index_pattern_3(struct image *image, IndexingPrivate *ipriv, int *ping,
r = try_indexer(image, ipriv->methods[n],
ipriv, ipriv->engine_private[n],
- last_task);
+ last_task, mille);
success += r;
ntry++;
done = finished_retry(ipriv->methods[n], ipriv->flags,
diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h
index 94018904..fa371276 100644
--- a/libcrystfel/src/index.h
+++ b/libcrystfel/src/index.h
@@ -3,13 +3,13 @@
*
* Perform indexing (somehow)
*
- * Copyright © 2012-2021 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2023 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
* Copyright © 2012 Richard Kirian
* Copyright © 2012 Lorenzo Galli
*
* Authors:
- * 2010-2021 Thomas White <taw@physics.org>
+ * 2010-2023 Thomas White <taw@physics.org>
* 2010 Richard Kirian
* 2012 Lorenzo Galli
* 2015 Kenneth Beyerlein <kenneth.beyerlein@desy.de>
@@ -210,6 +210,7 @@ extern char *base_indexer_str(IndexingMethod indm);
#include "cell.h"
#include "image.h"
#include "datatemplate.h"
+#include "predict-refine.h"
extern struct argp felix_argp;
extern struct argp pinkIndexer_argp;
@@ -251,6 +252,9 @@ extern void index_pattern_2(struct image *image, IndexingPrivate *ipriv,
extern void index_pattern_3(struct image *image, IndexingPrivate *ipriv,
int *ping, char *last_task);
+extern void index_pattern_4(struct image *image, IndexingPrivate *ipriv,
+ int *ping, char *last_task, Mille *mille);
+
extern void cleanup_indexing(IndexingPrivate *ipriv);
#ifdef __cplusplus
diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c
index 19c689cd..d45388b9 100644
--- a/libcrystfel/src/predict-refine.c
+++ b/libcrystfel/src/predict-refine.c
@@ -3,11 +3,11 @@
*
* Prediction refinement
*
- * Copyright © 2012-2021 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2023 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
*
* Authors:
- * 2010-2020 Thomas White <taw@physics.org>
+ * 2010-2023 Thomas White <taw@physics.org>
* 2016 Valerio Mariani
*
* This file is part of CrystFEL.
@@ -37,6 +37,11 @@
#include "image.h"
#include "geometry.h"
#include "cell-utils.h"
+#include "predict-refine.h"
+
+#ifdef HAVE_MILLEPEDE
+#include <mille_c_wrap.h>
+#endif
/** \file predict-refine.h */
@@ -569,7 +574,7 @@ static void free_rps_noreflist(struct reflpeak *rps, int n)
}
-int refine_prediction(struct image *image, Crystal *cr)
+int refine_prediction(struct image *image, Crystal *cr, Mille *mille)
{
int n;
int i;
@@ -654,5 +659,29 @@ int refine_prediction(struct image *image, Crystal *cr)
return 1;
}
+ if ( mille != NULL ) {
+ printf("Mille mode!\n");
+ }
+
return 0;
}
+
+
+Mille *crystfel_mille_new(const char *outFileName,
+ int asBinary,
+ int writeZero)
+{
+ #ifdef HAVE_MILLEPEDE
+ return mille_new(outFileName, asBinary, writeZero);
+ #else
+ return NULL;
+ #endif
+}
+
+
+void crystfel_mille_free(Mille *m)
+{
+ #ifdef HAVE_MILLEPEDE
+ mille_free(m);
+ #endif
+}
diff --git a/libcrystfel/src/predict-refine.h b/libcrystfel/src/predict-refine.h
index 5607e356..91b44e07 100644
--- a/libcrystfel/src/predict-refine.h
+++ b/libcrystfel/src/predict-refine.h
@@ -33,12 +33,19 @@
struct image;
+typedef void *Mille;
+
/**
* \file predict-refine.h
* Prediction refinement: refinement of indexing solutions before integration.
*/
-extern int refine_prediction(struct image *image, Crystal *cr);
+extern Mille *crystfel_mille_new(const char *outFileName,
+ int asBinary,
+ int writeZero);
+extern void crystfel_mille_free(Mille *m);
+
+extern int refine_prediction(struct image *image, Crystal *cr, Mille *mille);
extern int refine_radius(Crystal *cr, struct image *image);