aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/crystal.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2024-01-17 16:43:32 +0100
committerThomas White <taw@physics.org>2024-02-06 16:59:34 +0100
commit513827a44d1ddd395f677a74617b42934ca9bc64 (patch)
treec0ca0b1d14afb8026c9ff4e1f081453f3f3cfed3 /libcrystfel/src/crystal.c
parent4ad424f132dc3311502567e58b695fecdeb10106 (diff)
Crystals shouldn't own RefLists (part 1)
This is a terrible bit of API. A Crystal contains both the parameters for a calculation (e.g. prediction) and the results. Just look at post-refinement.c for an example of the mess this makes when trying to do calculations. This commit removes the reflection list from the Crystal structure. Future commits in this series will fix the resulting build carnage. This also gets rid of vestigial field pr_dud, and adds initialisers for all (remaining) fields.
Diffstat (limited to 'libcrystfel/src/crystal.c')
-rw-r--r--libcrystfel/src/crystal.c55
1 files changed, 13 insertions, 42 deletions
diff --git a/libcrystfel/src/crystal.c b/libcrystfel/src/crystal.c
index e5978795..a21283f9 100644
--- a/libcrystfel/src/crystal.c
+++ b/libcrystfel/src/crystal.c
@@ -3,11 +3,11 @@
*
* A class representing a single crystal
*
- * Copyright © 2013-2021 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2013-2024 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
*
* Authors:
- * 2013-2020 Thomas White <taw@physics.org>
+ * 2013-2024 Thomas White <taw@physics.org>
* 2016 Valerio Mariani
*
* This file is part of CrystFEL.
@@ -31,7 +31,6 @@
#include "crystal.h"
#include "utils.h"
-#include "reflist-utils.h"
/**
@@ -41,30 +40,18 @@
struct _crystal
{
- /* Information about the crystal */
- UnitCell *cell;
+ UnitCell *cell;
double m; /* Mosaicity in radians */
double osf;
double Bfac;
double profile_radius;
- int pr_dud;
double resolution_limit;
-
- /* Integrated (or about-to-be-integrated) reflections */
- RefList *reflections;
- long long int n_saturated; /* Number of overloads */
- long long int n_implausible; /* Number of implausibly
- * negative reflectionss */
-
- /* User flag, e.g. for "this is a bad crystal". */
+ long long int n_saturated; /* Number of overloads */
+ long long int n_implausible; /* Number of implausibly negative reflectionss */
int user_flag;
-
- /* Text notes, which go in the stream */
- char *notes;
-
- /* Detector shift in metres */
- double det_shift_x;
- double det_shift_y;
+ char *notes; /* Text notes, which go in the stream */
+ double det_shift_x; /* Detector x-shift in metres */
+ double det_shift_y; /* Detector y-shift in metres */
};
@@ -85,12 +72,15 @@ Crystal *crystal_new()
if ( cryst == NULL ) return NULL;
cryst->cell = NULL;
- cryst->reflections = NULL;
+ cryst->m = 0.0;
+ cryst->osf = 1.0;
+ cryst->Bfac = 0.0;
+ cryst->profile_radius = 0.0;
cryst->resolution_limit = INFINITY;
cryst->n_saturated = 0;
cryst->n_implausible = 0;
- cryst->notes = NULL;
cryst->user_flag = 0;
+ cryst->notes = NULL;
cryst->det_shift_x = 0;
cryst->det_shift_y = 0;
@@ -149,13 +139,6 @@ Crystal *crystal_copy_deep(const Crystal *cryst)
c->cell = cell;
}
- if ( cryst->reflections != NULL ) {
- RefList *refls;
- refls = copy_reflist(cryst->reflections);
- if ( refls == NULL ) return NULL;
- c->reflections = refls;
- }
-
return c;
}
@@ -195,12 +178,6 @@ double crystal_get_profile_radius(const Crystal *cryst)
}
-RefList *crystal_get_reflections(Crystal *cryst)
-{
- return cryst->reflections;
-}
-
-
double crystal_get_resolution_limit(Crystal *cryst)
{
return cryst->resolution_limit;
@@ -272,12 +249,6 @@ void crystal_set_profile_radius(Crystal *cryst, double r)
}
-void crystal_set_reflections(Crystal *cryst, RefList *reflist)
-{
- cryst->reflections = reflist;
-}
-
-
void crystal_set_resolution_limit(Crystal *cryst, double res)
{
cryst->resolution_limit = res;