aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am8
-rw-r--r--Makefile.in28
-rw-r--r--data/defs.h23
-rw-r--r--data/diffraction.cl6
-rw-r--r--libcrystfel/Makefile.am18
-rw-r--r--libcrystfel/Makefile.in31
-rw-r--r--libcrystfel/src/peaks.c1
-rw-r--r--libcrystfel/src/reflist-utils.c70
-rw-r--r--libcrystfel/src/reflist-utils.h4
-rw-r--r--libcrystfel/src/utils.h26
-rw-r--r--src/diffraction-gpu.c (renamed from libcrystfel/src/diffraction-gpu.c)1
-rw-r--r--src/diffraction-gpu.h (renamed from libcrystfel/src/diffraction-gpu.h)0
-rw-r--r--src/diffraction.c (renamed from libcrystfel/src/diffraction.c)1
-rw-r--r--src/diffraction.h (renamed from libcrystfel/src/diffraction.h)0
-rw-r--r--src/list_tmp.h (renamed from libcrystfel/src/list_tmp.h)0
-rw-r--r--src/pattern_sim.c71
-rw-r--r--src/pattern_sim.h50
17 files changed, 174 insertions, 164 deletions
diff --git a/Makefile.am b/Makefile.am
index 5e7d8d19..f0e5053d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,12 +35,14 @@ LDADD += $(top_builddir)/libcrystfel/libcrystfel.la
src_partial_sim_SOURCES = src/partial_sim.c
-src_pattern_sim_SOURCES = src/pattern_sim.c
+src_pattern_sim_SOURCES = src/pattern_sim.c src/diffraction.c \
+ src/diffraction-gpu.c
if HAVE_OPENCL
TESTS += tests/gpu_sim_check
noinst_PROGRAMS += tests/gpu_sim_check
-tests_gpu_sim_check_SOURCES = tests/gpu_sim_check.c
+tests_gpu_sim_check_SOURCES = tests/gpu_sim_check.c src/diffraction.c \
+ src/diffraction-gpu.c
endif
src_process_hkl_SOURCES = src/process_hkl.c
@@ -88,7 +90,7 @@ EXTRA_DIST += src/dw-hdfsee.h src/hdfsee.h src/render_hkl.h \
src/post-refinement.h src/hrs-scaling.h src/scaling-report.h
crystfeldir = $(datadir)/crystfel
-crystfel_DATA = data/diffraction.cl data/defs.h data/hdfsee.ui
+crystfel_DATA = data/diffraction.cl data/hdfsee.ui
EXTRA_DIST += $(crystfel_DATA)
diff --git a/Makefile.in b/Makefile.in
index a1d869fc..87142b72 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -142,7 +142,8 @@ src_partialator_OBJECTS = $(am_src_partialator_OBJECTS)
src_partialator_LDADD = $(LDADD)
src_partialator_DEPENDENCIES = $(top_builddir)/lib/libgnu.a \
$(top_builddir)/libcrystfel/libcrystfel.la
-am_src_pattern_sim_OBJECTS = src/pattern_sim.$(OBJEXT)
+am_src_pattern_sim_OBJECTS = src/pattern_sim.$(OBJEXT) \
+ src/diffraction.$(OBJEXT) src/diffraction-gpu.$(OBJEXT)
src_pattern_sim_OBJECTS = $(am_src_pattern_sim_OBJECTS)
src_pattern_sim_LDADD = $(LDADD)
src_pattern_sim_DEPENDENCIES = $(top_builddir)/lib/libgnu.a \
@@ -163,9 +164,12 @@ src_render_hkl_OBJECTS = $(am_src_render_hkl_OBJECTS)
src_render_hkl_LDADD = $(LDADD)
src_render_hkl_DEPENDENCIES = $(top_builddir)/lib/libgnu.a \
$(top_builddir)/libcrystfel/libcrystfel.la
-am__tests_gpu_sim_check_SOURCES_DIST = tests/gpu_sim_check.c
+am__tests_gpu_sim_check_SOURCES_DIST = tests/gpu_sim_check.c \
+ src/diffraction.c src/diffraction-gpu.c
@HAVE_OPENCL_TRUE@am_tests_gpu_sim_check_OBJECTS = \
-@HAVE_OPENCL_TRUE@ tests/gpu_sim_check.$(OBJEXT)
+@HAVE_OPENCL_TRUE@ tests/gpu_sim_check.$(OBJEXT) \
+@HAVE_OPENCL_TRUE@ src/diffraction.$(OBJEXT) \
+@HAVE_OPENCL_TRUE@ src/diffraction-gpu.$(OBJEXT)
tests_gpu_sim_check_OBJECTS = $(am_tests_gpu_sim_check_OBJECTS)
tests_gpu_sim_check_LDADD = $(LDADD)
tests_gpu_sim_check_DEPENDENCIES = $(top_builddir)/lib/libgnu.a \
@@ -567,8 +571,12 @@ AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I$(top_builddir)/lib \
LDADD = $(top_builddir)/lib/libgnu.a @IGNORE_UNUSED_LIBRARIES_CFLAGS@ \
$(top_builddir)/libcrystfel/libcrystfel.la
src_partial_sim_SOURCES = src/partial_sim.c
-src_pattern_sim_SOURCES = src/pattern_sim.c
-@HAVE_OPENCL_TRUE@tests_gpu_sim_check_SOURCES = tests/gpu_sim_check.c
+src_pattern_sim_SOURCES = src/pattern_sim.c src/diffraction.c \
+ src/diffraction-gpu.c
+
+@HAVE_OPENCL_TRUE@tests_gpu_sim_check_SOURCES = tests/gpu_sim_check.c src/diffraction.c \
+@HAVE_OPENCL_TRUE@ src/diffraction-gpu.c
+
src_process_hkl_SOURCES = src/process_hkl.c
src_indexamajig_SOURCES = src/indexamajig.c
@BUILD_HDFSEE_TRUE@src_hdfsee_SOURCES = src/hdfsee.c src/dw-hdfsee.c
@@ -588,7 +596,7 @@ tests_pr_gradient_check_SOURCES = tests/pr_gradient_check.c \
INCLUDES = -I$(top_srcdir)/libcrystfel/src -I$(top_srcdir)/data
crystfeldir = $(datadir)/crystfel
-crystfel_DATA = data/diffraction.cl data/defs.h data/hdfsee.ui
+crystfel_DATA = data/diffraction.cl data/hdfsee.ui
man_MANS = doc/man/indexamajig.1 doc/man/process_hkl.1 doc/man/pattern_sim.1 \
doc/man/crystfel_geometry.1 doc/man/powder_plot.1
@@ -777,6 +785,10 @@ src/partialator$(EXEEXT): $(src_partialator_OBJECTS) $(src_partialator_DEPENDENC
$(AM_V_CCLD)$(LINK) $(src_partialator_OBJECTS) $(src_partialator_LDADD) $(LIBS)
src/pattern_sim.$(OBJEXT): src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
+src/diffraction.$(OBJEXT): src/$(am__dirstamp) \
+ src/$(DEPDIR)/$(am__dirstamp)
+src/diffraction-gpu.$(OBJEXT): src/$(am__dirstamp) \
+ src/$(DEPDIR)/$(am__dirstamp)
src/pattern_sim$(EXEEXT): $(src_pattern_sim_OBJECTS) $(src_pattern_sim_DEPENDENCIES) src/$(am__dirstamp)
@rm -f src/pattern_sim$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(src_pattern_sim_OBJECTS) $(src_pattern_sim_LDADD) $(LIBS)
@@ -832,6 +844,8 @@ mostlyclean-compile:
-rm -f src/calibrate_detector.$(OBJEXT)
-rm -f src/check_hkl.$(OBJEXT)
-rm -f src/compare_hkl.$(OBJEXT)
+ -rm -f src/diffraction-gpu.$(OBJEXT)
+ -rm -f src/diffraction.$(OBJEXT)
-rm -f src/dw-hdfsee.$(OBJEXT)
-rm -f src/get_hkl.$(OBJEXT)
-rm -f src/hdfsee.$(OBJEXT)
@@ -857,6 +871,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/calibrate_detector.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/check_hkl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/compare_hkl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/diffraction-gpu.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/diffraction.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dw-hdfsee.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/get_hkl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/hdfsee.Po@am__quote@
diff --git a/data/defs.h b/data/defs.h
deleted file mode 100644
index 088c533a..00000000
--- a/data/defs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * defs.h
- *
- * Constant definitions which must be consistent throughout
- *
- * (c) 2006-2010 Thomas White <taw@physics.org>
- *
- * Part of CrystFEL - crystallography with a FEL
- *
- */
-
-#ifndef DEFS_H
-#define DEFS_H
-
-
-/* Maxmimum index to hold values up to (can be increased if necessary) */
-#define INDMAX 140
-
-/* Array size */
-#define IDIM (INDMAX*2 +1)
-
-
-#endif /* DEFS_H */
diff --git a/data/diffraction.cl b/data/diffraction.cl
index 9f939413..0a463007 100644
--- a/data/diffraction.cl
+++ b/data/diffraction.cl
@@ -10,7 +10,11 @@
*/
-#include <defs.h>
+/* Maxmimum index to hold values up to (can be increased if necessary)
+ * WARNING: Altering this value constitutes an ABI change, and means you must
+ * update src/pattern_sim.h then recompile and reinstall everything. */
+#define INDMAX 140
+
#ifndef M_PI
#define M_PI ((float)(3.14159265))
#endif
diff --git a/libcrystfel/Makefile.am b/libcrystfel/Makefile.am
index 576044a6..141842ff 100644
--- a/libcrystfel/Makefile.am
+++ b/libcrystfel/Makefile.am
@@ -1,22 +1,22 @@
lib_LTLIBRARIES = libcrystfel.la
+
libcrystfel_la_SOURCES = src/reflist.c src/utils.c src/cell.c src/detector.c \
src/thread-pool.c src/image.c src/hdf5-file.c \
src/beam-parameters.c src/geometry.c src/statistics.c \
src/symmetry.c src/stream.c src/peaks.c \
- src/reflist-utils.c src/filters.c src/diffraction.c \
- src/diffraction-gpu.c src/cl-utils.c src/render.c \
- src/index.c src/dirax.c src/mosflm.c src/reax.c
+ src/reflist-utils.c src/filters.c src/cl-utils.c \
+ src/render.c src/index.c src/dirax.c src/mosflm.c \
+ src/reax.c
libcrystfel_la_includedir=$(includedir)/crystfel/
-libcrystfel_la_include_HEADERS = src/beam-parameters.h src/diffraction-gpu.h \
- src/hdf5-file.h src/reflist.h src/symmetry.h \
- src/cell.h src/diffraction.h src/image.h \
+
+libcrystfel_la_include_HEADERS = src/beam-parameters.h src/hdf5-file.h \
+ src/reflist.h src/symmetry.h src/cell.h \
src/reflist-utils.h src/thread-pool.h \
- src/cl-utils.h src/filters.h src/list_tmp.h \
+ src/cl-utils.h src/filters.h \
src/statistics.h src/utils.h src/detector.h \
src/geometry.h src/peaks.h src/stream.h \
- src/render.h src/index.h \
- ../data/defs.h
+ src/render.h src/index.h src/image.h
INCLUDES = "-I$(top_srcdir)/data"
AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I$(top_builddir)/lib
diff --git a/libcrystfel/Makefile.in b/libcrystfel/Makefile.in
index a0b527e4..8992f9ed 100644
--- a/libcrystfel/Makefile.in
+++ b/libcrystfel/Makefile.in
@@ -88,9 +88,9 @@ am_libcrystfel_la_OBJECTS = src/reflist.lo src/utils.lo src/cell.lo \
src/detector.lo src/thread-pool.lo src/image.lo \
src/hdf5-file.lo src/beam-parameters.lo src/geometry.lo \
src/statistics.lo src/symmetry.lo src/stream.lo src/peaks.lo \
- src/reflist-utils.lo src/filters.lo src/diffraction.lo \
- src/diffraction-gpu.lo src/cl-utils.lo src/render.lo \
- src/index.lo src/dirax.lo src/mosflm.lo src/reax.lo
+ src/reflist-utils.lo src/filters.lo src/cl-utils.lo \
+ src/render.lo src/index.lo src/dirax.lo src/mosflm.lo \
+ src/reax.lo
libcrystfel_la_OBJECTS = $(am_libcrystfel_la_OBJECTS)
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
@@ -351,20 +351,18 @@ libcrystfel_la_SOURCES = src/reflist.c src/utils.c src/cell.c src/detector.c \
src/thread-pool.c src/image.c src/hdf5-file.c \
src/beam-parameters.c src/geometry.c src/statistics.c \
src/symmetry.c src/stream.c src/peaks.c \
- src/reflist-utils.c src/filters.c src/diffraction.c \
- src/diffraction-gpu.c src/cl-utils.c src/render.c \
- src/index.c src/dirax.c src/mosflm.c src/reax.c
+ src/reflist-utils.c src/filters.c src/cl-utils.c \
+ src/render.c src/index.c src/dirax.c src/mosflm.c \
+ src/reax.c
libcrystfel_la_includedir = $(includedir)/crystfel/
-libcrystfel_la_include_HEADERS = src/beam-parameters.h src/diffraction-gpu.h \
- src/hdf5-file.h src/reflist.h src/symmetry.h \
- src/cell.h src/diffraction.h src/image.h \
+libcrystfel_la_include_HEADERS = src/beam-parameters.h src/hdf5-file.h \
+ src/reflist.h src/symmetry.h src/cell.h \
src/reflist-utils.h src/thread-pool.h \
- src/cl-utils.h src/filters.h src/list_tmp.h \
+ src/cl-utils.h src/filters.h \
src/statistics.h src/utils.h src/detector.h \
src/geometry.h src/peaks.h src/stream.h \
- src/render.h src/index.h \
- ../data/defs.h
+ src/render.h src/index.h src/image.h
INCLUDES = "-I$(top_srcdir)/data"
AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I$(top_builddir)/lib \
@@ -457,9 +455,6 @@ src/peaks.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/reflist-utils.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/filters.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
-src/diffraction.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
-src/diffraction-gpu.lo: src/$(am__dirstamp) \
- src/$(DEPDIR)/$(am__dirstamp)
src/cl-utils.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/render.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/index.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
@@ -479,10 +474,6 @@ mostlyclean-compile:
-rm -f src/cl-utils.lo
-rm -f src/detector.$(OBJEXT)
-rm -f src/detector.lo
- -rm -f src/diffraction-gpu.$(OBJEXT)
- -rm -f src/diffraction-gpu.lo
- -rm -f src/diffraction.$(OBJEXT)
- -rm -f src/diffraction.lo
-rm -f src/dirax.$(OBJEXT)
-rm -f src/dirax.lo
-rm -f src/filters.$(OBJEXT)
@@ -525,8 +516,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/cell.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/cl-utils.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/detector.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/diffraction-gpu.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/diffraction.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dirax.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/filters.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/geometry.Plo@am__quote@
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index ad524c61..854db1d1 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -29,7 +29,6 @@
#include "peaks.h"
#include "detector.h"
#include "filters.h"
-#include "diffraction.h"
#include "reflist-utils.h"
#include "beam-parameters.h"
diff --git a/libcrystfel/src/reflist-utils.c b/libcrystfel/src/reflist-utils.c
index b64e9979..6e2f9c4a 100644
--- a/libcrystfel/src/reflist-utils.c
+++ b/libcrystfel/src/reflist-utils.c
@@ -34,76 +34,6 @@
**/
-double *intensities_from_list(RefList *list)
-{
- Reflection *refl;
- RefListIterator *iter;
- double *out = new_list_intensity();
-
- for ( refl = first_refl(list, &iter);
- refl != NULL;
- refl = next_refl(refl, iter) ) {
-
- signed int h, k, l;
- double intensity = get_intensity(refl);
-
- get_indices(refl, &h, &k, &l);
-
- set_intensity(out, h, k, l, intensity);
-
- }
-
- return out;
-}
-
-
-double *phases_from_list(RefList *list)
-{
- Reflection *refl;
- RefListIterator *iter;
- double *out = new_list_phase();
-
- for ( refl = first_refl(list, &iter);
- refl != NULL;
- refl = next_refl(refl, iter) ) {
-
- signed int h, k, l;
- double phase = get_phase(refl, NULL);
-
- get_indices(refl, &h, &k, &l);
-
- set_phase(out, h, k, l, phase);
-
- }
-
- return out;
-
-}
-
-
-unsigned char *flags_from_list(RefList *list)
-{
- Reflection *refl;
- RefListIterator *iter;
- unsigned char *out = new_list_flag();
-
- for ( refl = first_refl(list, &iter);
- refl != NULL;
- refl = next_refl(refl, iter) ) {
-
- signed int h, k, l;
-
- get_indices(refl, &h, &k, &l);
-
- set_flag(out, h, k, l, 1);
-
- }
-
- return out;
-
-}
-
-
int check_list_symmetry(RefList *list, const SymOpList *sym)
{
Reflection *refl;
diff --git a/libcrystfel/src/reflist-utils.h b/libcrystfel/src/reflist-utils.h
index d14e5f8e..c451954b 100644
--- a/libcrystfel/src/reflist-utils.h
+++ b/libcrystfel/src/reflist-utils.h
@@ -33,10 +33,6 @@ extern RefList *read_reflections_from_file(FILE *fh);
extern RefList *read_reflections(const char *filename);
-extern double *intensities_from_list(RefList *list);
-extern double *phases_from_list(RefList *list);
-extern unsigned char *flags_from_list(RefList *list);
-
extern int check_list_symmetry(RefList *list, const SymOpList *sym);
extern int find_equiv_in_list(RefList *list, signed int h, signed int k,
signed int l, const SymOpList *sym, signed int *hu,
diff --git a/libcrystfel/src/utils.h b/libcrystfel/src/utils.h
index 1179a57f..7b8d8fa8 100644
--- a/libcrystfel/src/utils.h
+++ b/libcrystfel/src/utils.h
@@ -175,32 +175,6 @@ static inline int within_tolerance(double a, double b, double percent)
#define UNUSED __attribute__((unused))
-/* -------------------- Indexed lists for specified types ------------------- */
-
-#include "defs.h"
-
-#define LIST_SIZE (IDIM*IDIM*IDIM)
-
-/* Create functions for storing reflection intensities indexed as h,k,l */
-#define LABEL(x) x##_intensity
-#define TYPE double
-#include "list_tmp.h"
-
-/* CAs above, but for phase values */
-#define LABEL(x) x##_phase
-#define TYPE double
-#include "list_tmp.h"
-
-/* As above, but for (unsigned) integer counts */
-#define LABEL(x) x##_count
-#define TYPE unsigned int
-#include "list_tmp.h"
-
-/* As above, but for simple flags */
-#define LABEL(x) x##_flag
-#define TYPE unsigned char
-#include "list_tmp.h"
-
/* ------------------------------ Message macros ---------------------------- */
diff --git a/libcrystfel/src/diffraction-gpu.c b/src/diffraction-gpu.c
index 605b1514..c365cecb 100644
--- a/libcrystfel/src/diffraction-gpu.c
+++ b/src/diffraction-gpu.c
@@ -31,6 +31,7 @@
#include "diffraction.h"
#include "cl-utils.h"
#include "beam-parameters.h"
+#include "pattern_sim.h"
#define SAMPLING (4)
diff --git a/libcrystfel/src/diffraction-gpu.h b/src/diffraction-gpu.h
index a3bde4e1..a3bde4e1 100644
--- a/libcrystfel/src/diffraction-gpu.h
+++ b/src/diffraction-gpu.h
diff --git a/libcrystfel/src/diffraction.c b/src/diffraction.c
index 9532a6ce..de994133 100644
--- a/libcrystfel/src/diffraction.c
+++ b/src/diffraction.c
@@ -24,6 +24,7 @@
#include "diffraction.h"
#include "beam-parameters.h"
#include "symmetry.h"
+#include "pattern_sim.h"
#define SAMPLING (4)
diff --git a/libcrystfel/src/diffraction.h b/src/diffraction.h
index f71d3cce..f71d3cce 100644
--- a/libcrystfel/src/diffraction.h
+++ b/src/diffraction.h
diff --git a/libcrystfel/src/list_tmp.h b/src/list_tmp.h
index a524b2f9..a524b2f9 100644
--- a/libcrystfel/src/list_tmp.h
+++ b/src/list_tmp.h
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 758e9c85..88781f15 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -33,6 +33,7 @@
#include "symmetry.h"
#include "reflist.h"
#include "reflist-utils.h"
+#include "pattern_sim.h"
static void show_help(const char *s)
@@ -141,6 +142,76 @@ static void show_details()
}
+static double *intensities_from_list(RefList *list)
+{
+ Reflection *refl;
+ RefListIterator *iter;
+ double *out = new_list_intensity();
+
+ for ( refl = first_refl(list, &iter);
+ refl != NULL;
+ refl = next_refl(refl, iter) ) {
+
+ signed int h, k, l;
+ double intensity = get_intensity(refl);
+
+ get_indices(refl, &h, &k, &l);
+
+ set_intensity(out, h, k, l, intensity);
+
+ }
+
+ return out;
+}
+
+
+static double *phases_from_list(RefList *list)
+{
+ Reflection *refl;
+ RefListIterator *iter;
+ double *out = new_list_phase();
+
+ for ( refl = first_refl(list, &iter);
+ refl != NULL;
+ refl = next_refl(refl, iter) ) {
+
+ signed int h, k, l;
+ double phase = get_phase(refl, NULL);
+
+ get_indices(refl, &h, &k, &l);
+
+ set_phase(out, h, k, l, phase);
+
+ }
+
+ return out;
+
+}
+
+
+static unsigned char *flags_from_list(RefList *list)
+{
+ Reflection *refl;
+ RefListIterator *iter;
+ unsigned char *out = new_list_flag();
+
+ for ( refl = first_refl(list, &iter);
+ refl != NULL;
+ refl = next_refl(refl, iter) ) {
+
+ signed int h, k, l;
+
+ get_indices(refl, &h, &k, &l);
+
+ set_flag(out, h, k, l, 1);
+
+ }
+
+ return out;
+
+}
+
+
static struct quaternion read_quaternion()
{
do {
diff --git a/src/pattern_sim.h b/src/pattern_sim.h
new file mode 100644
index 00000000..4476a34a
--- /dev/null
+++ b/src/pattern_sim.h
@@ -0,0 +1,50 @@
+/*
+ * pattern_sim.h
+ *
+ * Simulate diffraction patterns from small crystals
+ *
+ * (c) 2006-2011 Thomas White <taw@physics.org>
+ *
+ * Part of CrystFEL - crystallography with a FEL
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef PATTERN_SIM_H
+#define PATTERN_SIM_H
+
+
+/* Maxmimum index to hold values up to (can be increased if necessary)
+ * WARNING: Altering this value constitutes an ABI change, and means you must
+ * update data/diffraction.cl then recompile and reinstall everything. */
+#define INDMAX 140
+
+/* Array size */
+#define IDIM (INDMAX*2 +1)
+#define LIST_SIZE (IDIM*IDIM*IDIM)
+
+/* Create functions for storing reflection intensities indexed as h,k,l */
+#define LABEL(x) x##_intensity
+#define TYPE double
+#include "list_tmp.h"
+
+/* CAs above, but for phase values */
+#define LABEL(x) x##_phase
+#define TYPE double
+#include "list_tmp.h"
+
+/* As above, but for (unsigned) integer counts */
+#define LABEL(x) x##_count
+#define TYPE unsigned int
+#include "list_tmp.h"
+
+/* As above, but for simple flags */
+#define LABEL(x) x##_flag
+#define TYPE unsigned char
+#include "list_tmp.h"
+
+
+#endif /* PATTERN_SIM_H */