aboutsummaryrefslogtreecommitdiff
path: root/src/indexamajig.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/indexamajig.c')
-rw-r--r--src/indexamajig.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 5a47254f..e0871fe7 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -32,6 +32,7 @@
#include "detector.h"
#include "sfac.h"
#include "filters.h"
+#include "reflections.h"
static void show_help(const char *s)
@@ -77,6 +78,8 @@ static void show_help(const char *s)
" --no-match Don't attempt to match the indexed cell to the\n"
" model, just proceed with the one generated by the\n"
" auto-indexing procedure.\n"
+" --intensities=<file> Specify file containing reflection intensities\n"
+" to use.\n"
);
}
@@ -138,30 +141,22 @@ static struct image *get_simage(struct image *template, int alternate)
image->lambda = ph_en_to_lambda(eV_to_J(1.8e3));
- image->molecule = copy_molecule(template->molecule);
- free(image->molecule->cell);
- image->molecule->cell = cell_new_from_cell(template->indexed_cell);
-
return image;
}
-static void simulate_and_write(struct image *simage,
- struct gpu_context **gctx)
+static void simulate_and_write(struct image *simage, struct gpu_context **gctx,
+ double *intensities, UnitCell *cell)
{
/* Set up GPU if necessary */
if ( (gctx != NULL) && (*gctx == NULL) ) {
- *gctx = setup_gpu(0, simage, simage->molecule);
+ *gctx = setup_gpu(0, simage, intensities);
}
if ( (gctx != NULL) && (*gctx != NULL) ) {
- get_diffraction_gpu(*gctx, simage, 24, 24, 40);
+ get_diffraction_gpu(*gctx, simage, 24, 24, 40, cell);
} else {
- get_diffraction(simage, 24, 24, 40, 0, 0);
- }
- if ( simage->molecule == NULL ) {
- ERROR("Couldn't open molecule.pdb\n");
- return;
+ get_diffraction(simage, 24, 24, 40, intensities, cell, 0);
}
record_image(simage, 0);
@@ -193,6 +188,9 @@ int main(int argc, char *argv[])
IndexingMethod indm;
char *indm_str = NULL;
struct image image;
+ UnitCell *cell;
+ double *intensities = NULL;
+ char *intfile = NULL;
/* Long options */
const struct option longopts[] = {
@@ -210,6 +208,7 @@ int main(int argc, char *argv[])
{"no-match", 0, &config_nomatch, 1},
{"verbose", 0, &config_verbose, 1},
{"alternate", 0, &config_alternate, 1},
+ {"intensities", 0, NULL, 'q'},
{0, 0, NULL, 0}
};
@@ -232,6 +231,11 @@ int main(int argc, char *argv[])
break;
}
+ case 'q' : {
+ intfile = strdup(optarg);
+ break;
+ }
+
case 0 : {
break;
}
@@ -257,6 +261,12 @@ int main(int argc, char *argv[])
return 1;
}
+ if ( intfile != NULL ) {
+ intensities = read_reflections(intfile);
+ } else {
+ intensities = NULL;
+ }
+
if ( indm_str == NULL ) {
STATUS("You didn't specify an indexing method, so I won't"
" try to index anything.\n"
@@ -273,10 +283,9 @@ int main(int argc, char *argv[])
}
free(indm_str);
- image.molecule = load_molecule();
- if ( image.molecule == NULL ) {
- ERROR("You must provide molecule.pdb in the working "
- "directory.\n");
+ cell = load_cell_from_pdb("molecule.pdb");
+ if ( cell == NULL ) {
+ ERROR("Couldn't read unit cell (from molecule.pdb)\n");
return 1;
}
@@ -354,7 +363,7 @@ int main(int argc, char *argv[])
/* Calculate orientation matrix (by magic) */
if ( config_writedrx || (indm != INDEXING_NONE) ) {
- index_pattern(&image, indm, config_nomatch,
+ index_pattern(&image, cell, indm, config_nomatch,
config_verbose);
}
@@ -376,16 +385,17 @@ int main(int argc, char *argv[])
/* Simulate if requested */
if ( config_simulate ) {
if ( config_gpu ) {
- simulate_and_write(simage, &gctx);
+ simulate_and_write(simage, &gctx, intensities,
+ cell);
} else {
- simulate_and_write(simage, NULL);
+ simulate_and_write(simage, NULL, intensities,
+ cell);
}
}
/* Finished with alternate image */
if ( simage->twotheta != NULL ) free(simage->twotheta);
if ( simage->data != NULL ) free(simage->data);
- free_molecule(simage->molecule);
free(simage);
/* Only free cell if found */
@@ -402,7 +412,6 @@ done:
} while ( rval != NULL );
fclose(fh);
- free_molecule(image.molecule);
STATUS("There were %i images.\n", n_images);
STATUS("%i hits were found.\n", n_hits);