aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/fom.h
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-01-22 15:45:09 +0100
committerThomas White <taw@physics.org>2021-01-22 15:45:09 +0100
commita8911944b66861b692e5e36c8e9374439b9649b2 (patch)
treec4c14c84db60ee47b227e64d48563c6eb0aeee0a /libcrystfel/src/fom.h
parent27a6976e7ec7a5309475bcfe360ec13cb418175f (diff)
Move figure of merit calculation into libcrystfel
Diffstat (limited to 'libcrystfel/src/fom.h')
-rw-r--r--libcrystfel/src/fom.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/libcrystfel/src/fom.h b/libcrystfel/src/fom.h
new file mode 100644
index 00000000..968278b4
--- /dev/null
+++ b/libcrystfel/src/fom.h
@@ -0,0 +1,109 @@
+/*
+ * fom.h
+ *
+ * Figure of merit calculation
+ *
+ * Copyright © 2012-2021 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Authors:
+ * 2010-2021 Thomas White <taw@physics.org>
+ * 2013 Lorenzo Galli <lorenzo.galli@desy.de>
+ *
+ * This file is part of CrystFEL.
+ *
+ * CrystFEL is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CrystFEL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef FOM_H
+#define FOM_H
+
+/**
+ * \file fom.h
+ * Figure of merit calculation
+ */
+
+#include <reflist.h>
+#include <symmetry.h>
+
+enum fom
+{
+ FOM_R1I,
+ FOM_R1F,
+ FOM_R2,
+ FOM_RSPLIT,
+ FOM_CC,
+ FOM_CCSTAR,
+ FOM_CCANO,
+ FOM_CRDANO,
+ FOM_RANO,
+ FOM_RANORSPLIT,
+ FOM_D1SIG,
+ FOM_D2SIG
+};
+
+struct shells
+{
+ int config_intshells;
+ int nshells;
+ double *rmins;
+ double *rmaxs;
+};
+
+struct fom_context
+{
+ enum fom fom;
+ int nshells;
+ int *cts;
+
+ /* For R-factors */
+ double *num;
+ double *den;
+
+ /* For "double" R-factors */
+ double *num2;
+ double *den2;
+
+ /* For CCs */
+ double **vec1;
+ double **vec2;
+ int *n;
+ int nmax;
+
+ /* For "counting" things e.g. d1sig or d2sig */
+ int *n_within;
+};
+
+
+extern struct fom_context *fom_calculate(RefList *list1, RefList *list2,
+ UnitCell *cell, struct shells *shells,
+ enum fom fom, int noscale,
+ SymOpList *sym);
+
+extern struct shells *make_resolution_shells(double rmin, double rmax,
+ int nshells);
+
+extern struct shells *make_intensity_shells(double min_I, double max_I,
+ int nshells);
+
+extern double shell_label(struct shells *s, int i);
+
+extern double fom_shell(struct fom_context *fctx, int i);
+
+extern double fom_overall(struct fom_context *fctx);
+
+extern enum fom get_fom(const char *s);
+
+#endif /* FOM */