aboutsummaryrefslogtreecommitdiff
path: root/src/process_hkl.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-12-04 14:17:35 +0100
committerThomas White <taw@physics.org>2009-12-04 14:21:46 +0100
commit3849a9692813ddd850b5e2ce1bec8a32b43b5900 (patch)
tree2e8287f897dd1431ff37e8af386ff9673db7f6f4 /src/process_hkl.c
parentba72cc21bb8a36e3fb0ac8e7da69157ae1aed918 (diff)
Add new program: get_hkl, for generating ideal intensity lists
Diffstat (limited to 'src/process_hkl.c')
-rw-r--r--src/process_hkl.c70
1 files changed, 1 insertions, 69 deletions
diff --git a/src/process_hkl.c b/src/process_hkl.c
index aed9856e..9142d5c7 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -24,6 +24,7 @@
#include "utils.h"
#include "statistics.h"
#include "sfac.h"
+#include "reflections.h"
/* Number of divisions for R vs |q| graphs */
@@ -124,72 +125,6 @@ static void write_RvsQ(const char *name, double *ref, double *trueref,
}
-static void write_reflections(const char *filename, unsigned int *counts,
- double *ref, int zone_axis, UnitCell *cell)
-{
- FILE *fh;
- signed int h, k, l;
-
- fh = fopen(filename, "w");
-
- /* Write spacings and angle if zone axis pattern */
- if ( zone_axis ) {
- double a, b, c, alpha, beta, gamma;
- cell_get_parameters(cell, &a, &b, &c, &alpha, &beta, &gamma);
- fprintf(fh, "a %5.3f nm\n", a*1e9);
- fprintf(fh, "b %5.3f nm\n", b*1e9);
- fprintf(fh, "angle %5.3f deg\n", rad2deg(gamma));
- fprintf(fh, "scale 10\n");
- }
-
- for ( h=-INDMAX; h<INDMAX; h++ ) {
- for ( k=-INDMAX; k<INDMAX; k++ ) {
- for ( l=-INDMAX; l<INDMAX; l++ ) {
-
- int N;
- double F;
-
- if ( counts ) {
- N = lookup_count(counts, h, k, l);
- if ( N == 0 ) continue;
- } else {
- N = 1;
- }
-
- F = lookup_intensity(ref, h, k, l) / N;
- if ( zone_axis && (l != 0) ) continue;
-
- fprintf(fh, "%3i %3i %3i %f\n", h, k, l, F);
-
- }
- }
- }
- fclose(fh);
-}
-
-
-static double *ideal_intensities(double complex *sfac)
-{
- double *ref;
- signed int h, k, l;
-
- ref = new_list_intensity();
-
- /* Generate ideal reflections from complex structure factors */
- for ( h=-INDMAX; h<=INDMAX; h++ ) {
- for ( k=-INDMAX; k<=INDMAX; k++ ) {
- for ( l=-INDMAX; l<=INDMAX; l++ ) {
- double complex F = lookup_sfac(sfac, h, k, l);
- double intensity = pow(cabs(F), 2.0);
- set_intensity(ref, h, k, l, intensity);
- }
- }
- }
-
- return ref;
-}
-
-
static void process_reflections(double *ref, double *trueref,
unsigned int *counts, unsigned int n_patterns,
UnitCell *cell, int do_rvsq, int do_zoneaxis)
@@ -315,9 +250,6 @@ int main(int argc, char *argv[])
counts = new_list_count();
trueref = ideal_intensities(mol->reflections);
- write_reflections("results/ideal-reflections.hkl", NULL, trueref, 1,
- mol->cell);
-
if ( strcmp(filename, "-") == 0 ) {
fh = stdin;
} else {