aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/fom.c24
-rw-r--r--libcrystfel/src/fom.h23
-rw-r--r--src/compare_hkl.c14
3 files changed, 32 insertions, 29 deletions
diff --git a/libcrystfel/src/fom.c b/libcrystfel/src/fom.c
index 1296b53f..e10df5b8 100644
--- a/libcrystfel/src/fom.c
+++ b/libcrystfel/src/fom.c
@@ -43,7 +43,7 @@
#include "reflist.h"
#include "reflist-utils.h"
-enum fom get_fom(const char *s)
+enum fom_type fom_type_from_string(const char *s)
{
if ( strcasecmp(s, "r1i") == 0 ) return FOM_R1I;
if ( strcasecmp(s, "r1f") == 0 ) return FOM_R1F;
@@ -63,7 +63,7 @@ enum fom get_fom(const char *s)
}
-static struct fom_context *init_fom(enum fom fom, int nmax, int nshells)
+static struct fom_context *init_fom(enum fom_type fom, int nmax, int nshells)
{
struct fom_context *fctx;
int i;
@@ -427,9 +427,10 @@ double fom_shell(struct fom_context *fctx, int i)
}
-struct shells *make_intensity_shells(double min_I, double max_I, int nshells)
+struct fom_shells *fom_make_intensity_shells(double min_I, double max_I,
+ int nshells)
{
- struct shells *s;
+ struct fom_shells *s;
int i;
if ( min_I >= max_I ) {
@@ -441,7 +442,7 @@ struct shells *make_intensity_shells(double min_I, double max_I, int nshells)
* populated part of the reflections */
max_I = min_I + (max_I-min_I)/5000.0;
- s = malloc(sizeof(struct shells));
+ s = malloc(sizeof(struct fom_shells));
if ( s == NULL ) return NULL;
s->rmins = malloc(nshells*sizeof(double));
@@ -467,13 +468,14 @@ struct shells *make_intensity_shells(double min_I, double max_I, int nshells)
}
-struct shells *make_resolution_shells(double rmin, double rmax, int nshells)
+struct fom_shells *fom_make_resolution_shells(double rmin, double rmax,
+ int nshells)
{
- struct shells *s;
+ struct fom_shells *s;
double total_vol, vol_per_shell;
int i;
- s = malloc(sizeof(struct shells));
+ s = malloc(sizeof(struct fom_shells));
if ( s == NULL ) return NULL;
s->rmins = malloc(nshells*sizeof(double));
@@ -509,7 +511,7 @@ struct shells *make_resolution_shells(double rmin, double rmax, int nshells)
}
-double shell_label(struct shells *s, int i)
+double fom_shell_label(struct fom_shells *s, int i)
{
if ( s->config_intshells ) {
return (i+0.5) / s->nshells;
@@ -519,7 +521,7 @@ double shell_label(struct shells *s, int i)
}
-static int get_bin(struct shells *s, Reflection *refl, UnitCell *cell)
+static int get_bin(struct fom_shells *s, Reflection *refl, UnitCell *cell)
{
if ( s->config_intshells ) {
@@ -674,7 +676,7 @@ static int wilson_scale(RefList *list1, RefList *list2, UnitCell *cell)
struct fom_context *fom_calculate(RefList *list1, RefList *list2, UnitCell *cell,
- struct shells *shells, enum fom fom,
+ struct fom_shells *shells, enum fom_type fom,
int noscale, SymOpList *sym)
{
Reflection *refl1;
diff --git a/libcrystfel/src/fom.h b/libcrystfel/src/fom.h
index 968278b4..8af434e8 100644
--- a/libcrystfel/src/fom.h
+++ b/libcrystfel/src/fom.h
@@ -38,7 +38,7 @@
#include <reflist.h>
#include <symmetry.h>
-enum fom
+enum fom_type
{
FOM_R1I,
FOM_R1F,
@@ -54,7 +54,7 @@ enum fom
FOM_D2SIG
};
-struct shells
+struct fom_shells
{
int config_intshells;
int nshells;
@@ -64,7 +64,7 @@ struct shells
struct fom_context
{
- enum fom fom;
+ enum fom_type fom;
int nshells;
int *cts;
@@ -88,22 +88,23 @@ struct fom_context
extern struct fom_context *fom_calculate(RefList *list1, RefList *list2,
- UnitCell *cell, struct shells *shells,
- enum fom fom, int noscale,
+ UnitCell *cell,
+ struct fom_shells *shells,
+ enum fom_type fom, int noscale,
SymOpList *sym);
-extern struct shells *make_resolution_shells(double rmin, double rmax,
- int nshells);
+extern struct fom_shells *fom_make_resolution_shells(double rmin, double rmax,
+ int nshells);
-extern struct shells *make_intensity_shells(double min_I, double max_I,
- int nshells);
+extern struct fom_shells *fom_make_intensity_shells(double min_I, double max_I,
+ int nshells);
-extern double shell_label(struct shells *s, int i);
+extern double fom_shell_label(struct fom_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);
+extern enum fom_type fom_type_from_string(const char *s);
#endif /* FOM */
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index d4efcd05..1d82f01c 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -83,12 +83,12 @@ static void show_help(const char *s)
static void do_fom(RefList *list1, RefList *list2, UnitCell *cell,
- double rmin, double rmax, enum fom fom,
+ double rmin, double rmax, enum fom_type fom,
int config_unity, int nshells, const char *filename,
int config_intshells, double min_I, double max_I,
SymOpList *sym)
{
- struct shells *shells;
+ struct fom_shells *shells;
struct fom_context *fctx;
FILE *fh;
int i;
@@ -96,9 +96,9 @@ static void do_fom(RefList *list1, RefList *list2, UnitCell *cell,
/* Calculate the bins */
if ( config_intshells ) {
- shells = make_intensity_shells(min_I, max_I, nshells);
+ shells = fom_make_intensity_shells(min_I, max_I, nshells);
} else {
- shells = make_resolution_shells(rmin, rmax, nshells);
+ shells = fom_make_resolution_shells(rmin, rmax, nshells);
}
if ( shells == NULL ) {
@@ -234,7 +234,7 @@ static void do_fom(RefList *list1, RefList *list2, UnitCell *cell,
double r, cen;
- cen = shell_label(shells, i);
+ cen = fom_shell_label(shells, i);
r = fom_shell(fctx, i);
switch ( fom ) {
@@ -349,7 +349,7 @@ int main(int argc, char *argv[])
RefList *list2;
RefList *list1_raw;
RefList *list2_raw;
- enum fom fom = FOM_R1I;
+ enum fom_type fom = FOM_R1I;
char *cellfile = NULL;
float rmin_fix = -1.0;
float rmax_fix = -1.0;
@@ -439,7 +439,7 @@ int main(int argc, char *argv[])
break;
case 4 :
- fom = get_fom(optarg);
+ fom = fom_type_from_string(optarg);
break;
case 5 :