/* * get_hkl.c * * Small program to write out a list of h,k,l,I values given a structure * * (c) 2006-2010 Thomas White * * Part of CrystFEL - crystallography with a FEL * */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include "utils.h" #include "sfac.h" #include "reflections.h" #include "symmetry.h" static void show_help(const char *s) { printf("Syntax: %s [options]\n\n", s); printf( "Write idealised intensity lists.\n" "\n" " -h, --help Display this help message.\n" "\n" " -t, --template= Only include reflections mentioned in file.\n" " --poisson Simulate Poisson samples.\n" " -y, --symmetry= The symmetry of the input file (-i).\n" " -w, --twin= Generate twinned data according to the given\n" " point group.\n" " -o, --output= Output filename (default: stdout).\n" " -i, --intensities= Read intensities from file instead of\n" " calculating them from scratch. You might use\n" " this if you need to apply noise or twinning.\n" " -p, --pdb= PDB file from which to get the structure.\n" " --no-phases Do not try to use phases in the input file.\n" " --multiplicity Multiply intensities by the number of\n" " equivalent reflections.\n" ); } /* Apply Poisson noise to all reflections */ static void noisify_reflections(double *ref) { signed int h, k, l; for ( h=-INDMAX; hh, it->k, it->l, &h, &k, &l, holo); if ( find_item(new, h, k, l) ) continue; n = num_equivs(h, k, l, holo); mean = 0.0; skip = 0; for ( j=0; jh, it->k, it->l); inty *= num_equivs(it->h, it->k, it->l, mero); set_intensity(ideal_ref, it->h, it->k, it->l, inty); STATUS("%i %i %i %i\n", it->h, it->k, it->l, num_equivs(it->h, it->k, it->l, mero)); } } if ( template ) { /* Write out only reflections which are in the template * (and which we have in the input) */ ReflItemList *template_items; template_items = read_reflections(template, NULL, NULL, NULL, NULL); write_items = intersection_items(input_items, template_items); delete_items(template_items); } else { /* Write out all reflections */ write_items = new_items(); /* (quick way of copying a list) */ union_items(write_items, input_items); } write_reflections(output, write_items, ideal_ref, phases, NULL, mol->cell); delete_items(input_items); delete_items(write_items); return 0; }