diff options
author | Thomas White <taw@physics.org> | 2010-01-22 15:50:41 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-01-22 15:50:41 +0100 |
commit | 75d30a3f2a7d8484575f5b6ba6ed07587dc19f1e (patch) | |
tree | 58c78fbccd5544eabe7d8484fbaf6358ed87327d | |
parent | ef9281fb30a07b8ee099ada3e1f7a0a10cbca5c0 (diff) |
Add --near-bragg and --simulate options to indexamajig
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/diffraction.c | 4 | ||||
-rw-r--r-- | src/indexamajig.c | 46 |
3 files changed, 46 insertions, 7 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 57ee19c4..a80ba7a2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,7 +17,8 @@ process_hkl_SOURCES = process_hkl.c sfac.c statistics.c cell.c utils.c \ process_hkl_LDADD = @LIBS@ indexamajig_SOURCES = indexamajig.c hdf5-file.c utils.c dirax.c cell.c image.c \ - intensities.c ewald.c peaks.c index.c filters.c + intensities.c ewald.c peaks.c index.c filters.c \ + diffraction.c detector.c sfac.c indexamajig_LDADD = @LIBS@ if HAVE_GTK diff --git a/src/diffraction.c b/src/diffraction.c index a0248450..b7bdb75a 100644 --- a/src/diffraction.c +++ b/src/diffraction.c @@ -142,7 +142,9 @@ void get_diffraction(struct image *image, int na, int nb, int nc) double a, b, c, d; /* Generate the array of reciprocal space vectors in image->qvecs */ - get_ewald(image); + if ( image->qvecs == NULL ) { + get_ewald(image); + } if ( image->molecule == NULL ) { image->molecule = load_molecule(); diff --git a/src/indexamajig.c b/src/indexamajig.c index 68b39c20..3142b748 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -28,6 +28,8 @@ #include "intensities.h" #include "ewald.h" #include "peaks.h" +#include "diffraction.h" +#include "detector.h" static void show_help(const char *s) @@ -45,6 +47,9 @@ static void show_help(const char *s) " don't actually index.\n" " --dirax Use DirAx for indexing.\n" " --dump-peaks Write the results of the peak search to stdout.\n" +" --near-bragg Output a list of reflection intensities to stdout.\n" +" --simulate Simulate the diffraction pattern using the indexed\n" +" unit cell.\n" "\n"); } @@ -60,6 +65,8 @@ int main(int argc, char *argv[]) int config_noindex = 0; int config_dumpfound = 0; int config_dirax = 0; + int config_nearbragg = 0; + int config_simulate = 0; /* Long options */ const struct option longopts[] = { @@ -67,7 +74,9 @@ int main(int argc, char *argv[]) {"input", 1, NULL, 'i'}, {"no-index", 0, &config_noindex, 1}, {"dump-peaks", 0, &config_dumpfound, 1}, + {"near-bragg", 0, &config_nearbragg, 1}, {"dirax", 0, &config_dirax, 1}, + {"simulate", 0, &config_simulate, 1}, {0, 0, NULL, 0} }; @@ -149,13 +158,16 @@ int main(int argc, char *argv[]) if ( config_dumpfound ) dump_peaks(&image); - if ( !config_noindex ) { + /* Not indexing? Then there's nothing left to do. */ + if ( config_noindex ) goto done; - /* Calculate orientation matrix (by magic) */ - index_pattern(&image, config_noindex, - config_dirax); + /* Calculate orientation matrix (by magic) */ + index_pattern(&image, config_noindex, + config_dirax); - if ( image.molecule == NULL ) goto done; + if ( image.molecule == NULL ) goto done; + + if ( config_nearbragg || config_simulate ) { /* View head-on (unit cell is tilted) */ image.orientation.w = 1.0; @@ -164,10 +176,34 @@ int main(int argc, char *argv[]) image.orientation.z = 0.0; get_ewald(&image); + } + + if ( config_nearbragg ) { /* Read h,k,l,I */ output_intensities(&image); } + if ( config_simulate ) { + + /* Simulate a diffraction pattern */ + image.sfacs = NULL; + image.data = NULL; + image.twotheta = NULL; + image.hdr = NULL; + image.molecule = NULL; + + get_diffraction(&image, 8, 8, 8); + if ( image.molecule == NULL ) { + ERROR("Couldn't open molecule.pdb\n"); + return 1; + } + record_image(&image, 0, 0, 0); + + hdf5_write("simulated.h5", image.data, + image.width, image.height); + + } + } done: |