Commit 82170d86 authored by Thomas White's avatar Thomas White
Browse files

Add --no-sfac option for ignoring structure factors

parent 1374dfa3
......@@ -133,7 +133,7 @@ double water_intensity(struct rvec q, double en,
}
void get_diffraction(struct image *image, int na, int nb, int nc)
void get_diffraction(struct image *image, int na, int nb, int nc, int no_sfac)
{
int x, y;
double ax, ay, az;
......@@ -158,11 +158,13 @@ void get_diffraction(struct image *image, int na, int nb, int nc)
na, nb, nc, na*a/1.0e-9, nb*b/1.0e-9, nc*c/1.0e-9);
image->sfacs = malloc(image->width * image->height
* sizeof(double complex));
* sizeof(double complex));
if ( image->molecule->reflections == NULL ) {
get_reflections_cached(image->molecule,
ph_lambda_to_en(image->lambda));
if ( !no_sfac ) {
if ( image->molecule->reflections == NULL ) {
get_reflections_cached(image->molecule,
ph_lambda_to_en(image->lambda));
}
}
for ( x=0; x<image->width; x++ ) {
......@@ -177,8 +179,12 @@ void get_diffraction(struct image *image, int na, int nb, int nc)
f_lattice = lattice_factor(q, ax,ay,az,bx,by,bz,cx,cy,cz,
na, nb, nc);
f_molecule = molecule_factor(image->molecule, q,
if ( no_sfac ) {
f_molecule = 1.0;
} else {
f_molecule = molecule_factor(image->molecule, q,
ax,ay,az,bx,by,bz,cx,cy,cz);
}
val = f_molecule * f_lattice;
image->sfacs[x + image->width*y] = val;
......
......@@ -19,7 +19,8 @@
#include "image.h"
#include "cell.h"
extern void get_diffraction(struct image *image, int na, int nb, int nc);
extern void get_diffraction(struct image *image, int na, int nb, int nc,
int nosfac);
extern double water_intensity(struct rvec q, double en,
double beam_r, double water_r);
......
......@@ -259,7 +259,7 @@ int main(int argc, char *argv[])
image.data = NULL;
get_diffraction(&image, 8, 8, 8);
get_diffraction(&image, 8, 8, 8, 0);
if ( image.molecule == NULL ) {
ERROR("Couldn't open molecule.pdb\n");
return 1;
......
......@@ -156,6 +156,7 @@ int main(int argc, char *argv[])
int config_nowater = 0;
int config_nonoise = 0;
int config_nobloom = 0;
int config_nosfac = 0;
int number = 1; /* Index for the current image */
int n_images = 1; /* Generate one image by default */
int done = 0;
......@@ -171,6 +172,7 @@ int main(int argc, char *argv[])
{"no-water", 0, &config_nowater, 1},
{"no-noise", 0, &config_nonoise, 1},
{"no-bloom", 0, &config_nobloom, 1},
{"no-sfac", 0, &config_nosfac, 1},
{0, 0, NULL, 0}
};
......@@ -272,7 +274,7 @@ int main(int argc, char *argv[])
image.twotheta = NULL;
image.hdr = NULL;
get_diffraction(&image, na, nb, nc);
get_diffraction(&image, na, nb, nc, config_nosfac);
if ( image.molecule == NULL ) {
ERROR("Couldn't open molecule.pdb\n");
return 1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment