aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-05-30 17:17:11 +0200
committerThomas White <taw@physics.org>2012-05-30 17:17:11 +0200
commit4e0fe58f0d35f2a73f718917b2b99dc17fb9f7dd (patch)
tree4b1279360d9d4de28825e4608f554c187ed6ee0d
parent781b32aa84eb9fb3092636beb3f6e4fee43add6c (diff)
Formatting
-rw-r--r--libcrystfel/src/cell.c28
-rw-r--r--libcrystfel/src/dirax.c22
-rw-r--r--libcrystfel/src/hdf5-file.c15
-rw-r--r--libcrystfel/src/index.c52
-rw-r--r--libcrystfel/src/mosflm.c20
-rw-r--r--libcrystfel/src/render.c69
-rw-r--r--libcrystfel/src/statistics.c37
-rw-r--r--src/check_hkl.c17
-rw-r--r--src/cl-utils.c87
-rw-r--r--src/compare_hkl.c22
-rw-r--r--src/get_hkl.c22
-rw-r--r--src/hdfsee.c23
-rw-r--r--src/partial_sim.c30
-rw-r--r--src/partialator.c24
-rw-r--r--src/pattern_sim.c34
-rw-r--r--src/post-refinement.c24
-rw-r--r--src/powder_plot.c57
-rw-r--r--src/render_hkl.c58
18 files changed, 375 insertions, 266 deletions
diff --git a/libcrystfel/src/cell.c b/libcrystfel/src/cell.c
index 8412fc62..31d3b9b1 100644
--- a/libcrystfel/src/cell.c
+++ b/libcrystfel/src/cell.c
@@ -424,7 +424,7 @@ int cell_get_parameters(UnitCell *cell, double *a, double *b, double *c,
switch ( cell->rep ) {
- case CELL_REP_CRYST:
+ case CELL_REP_CRYST:
/* Direct response */
*a = cell->a;
*b = cell->b;
@@ -434,7 +434,7 @@ int cell_get_parameters(UnitCell *cell, double *a, double *b, double *c,
*gamma = cell->gamma;
return 0;
- case CELL_REP_CART:
+ case CELL_REP_CART:
/* Convert cartesian -> crystallographic */
*a = modulus(cell->ax, cell->ay, cell->az);
*b = modulus(cell->bx, cell->by, cell->bz);
@@ -448,7 +448,7 @@ int cell_get_parameters(UnitCell *cell, double *a, double *b, double *c,
cell->bx, cell->by, cell->bz);
return 0;
- case CELL_REP_RECIP:
+ case CELL_REP_RECIP:
/* Convert reciprocal -> crystallographic.
* Start by converting reciprocal -> cartesian */
cell_invert(cell->axs, cell->ays, cell->azs,
@@ -480,21 +480,21 @@ int cell_get_cartesian(UnitCell *cell,
switch ( cell->rep ) {
- case CELL_REP_CRYST:
+ case CELL_REP_CRYST:
/* Convert crystallographic -> cartesian. */
return cell_crystallographic_to_cartesian(cell,
ax, ay, az,
bx, by, bz,
cx, cy, cz);
- case CELL_REP_CART:
+ case CELL_REP_CART:
/* Direct response */
*ax = cell->ax; *ay = cell->ay; *az = cell->az;
*bx = cell->bx; *by = cell->by; *bz = cell->bz;
*cx = cell->cx; *cy = cell->cy; *cz = cell->cz;
return 0;
- case CELL_REP_RECIP:
+ case CELL_REP_RECIP:
/* Convert reciprocal -> cartesian */
return cell_invert(cell->axs, cell->ays, cell->azs,
cell->bxs, cell->bys, cell->bzs,
@@ -518,7 +518,7 @@ int cell_get_reciprocal(UnitCell *cell,
switch ( cell->rep ) {
- case CELL_REP_CRYST:
+ case CELL_REP_CRYST:
/* Convert crystallographic -> reciprocal */
r = cell_crystallographic_to_cartesian(cell,
&ax, &ay, &az,
@@ -528,7 +528,7 @@ int cell_get_reciprocal(UnitCell *cell,
return cell_invert(ax, ay, az,bx, by, bz, cx, cy, cz,
asx, asy, asz, bsx, bsy, bsz, csx, csy, csz);
- case CELL_REP_CART:
+ case CELL_REP_CART:
/* Convert cartesian -> reciprocal */
cell_invert(cell->ax, cell->ay, cell->az,
cell->bx, cell->by, cell->bz,
@@ -536,7 +536,7 @@ int cell_get_reciprocal(UnitCell *cell,
asx, asy, asz, bsx, bsy, bsz, csx, csy, csz);
return 0;
- case CELL_REP_RECIP:
+ case CELL_REP_RECIP:
/* Direct response */
*asx = cell->axs; *asy = cell->ays; *asz = cell->azs;
*bsx = cell->bxs; *bsy = cell->bys; *bsz = cell->bzs;
@@ -569,12 +569,16 @@ const char *cell_get_spacegroup(UnitCell *cell)
static const char *cell_rep(UnitCell *cell)
{
switch ( cell->rep ) {
- case CELL_REP_CRYST:
+
+ case CELL_REP_CRYST:
return "crystallographic, direct space";
- case CELL_REP_CART:
+
+ case CELL_REP_CART:
return "cartesian, direct space";
- case CELL_REP_RECIP:
+
+ case CELL_REP_RECIP:
return "cartesian, reciprocal space";
+
}
return "unknown";
diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c
index 20f48bd3..43de6c6e 100644
--- a/libcrystfel/src/dirax.c
+++ b/libcrystfel/src/dirax.c
@@ -226,37 +226,37 @@ static void dirax_send_next(struct image *image, struct dirax_data *dirax)
switch ( dirax->step ) {
- case 1 :
+ case 1 :
dirax_sendline("\\echo off\n", dirax);
break;
- case 2 :
+ case 2 :
snprintf(tmp, 31, "read xfel-%i.drx\n", image->id);
dirax_sendline(tmp, dirax);
break;
- case 3 :
+ case 3 :
dirax_sendline("dmax 1000\n", dirax);
break;
- case 4 :
+ case 4 :
dirax_sendline("indexfit 2\n", dirax);
break;
- case 5 :
+ case 5 :
dirax_sendline("levelfit 1000\n", dirax);
break;
- case 6 :
+ case 6 :
dirax_sendline("go\n", dirax);
dirax->finished_ok = 1;
break;
- case 7 :
+ case 7 :
dirax_sendline("acl\n", dirax);
break;
- case 8 :
+ case 8 :
if ( dirax->best_acl_nh == 0 ) {
/* At this point, DirAx is presenting its ACL prompt
* and waiting for a single number. Use an extra
@@ -270,11 +270,11 @@ static void dirax_send_next(struct image *image, struct dirax_data *dirax)
dirax_sendline(tmp, dirax);
break;
- case 9 :
+ case 9 :
dirax_sendline("cell\n", dirax);
break;
- case 10 :
+ case 10 :
if ( dirax->n_acls_tried == MAX_DIRAX_CELL_CANDIDATES ) {
dirax_sendline("exit\n", dirax);
} else {
@@ -285,7 +285,7 @@ static void dirax_send_next(struct image *image, struct dirax_data *dirax)
}
break;
- default:
+ default:
dirax_sendline("exit\n", dirax);
return;
diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c
index 88d11bff..9924e665 100644
--- a/libcrystfel/src/hdf5-file.c
+++ b/libcrystfel/src/hdf5-file.c
@@ -719,6 +719,9 @@ char *hdfile_get_string_value(struct hdfile *f, const char *name)
hsize_t max_size;
hid_t type;
hid_t class;
+ herr_t r;
+ int buf;
+ char *tmp;
dh = H5Dopen2(f->fh, name, H5P_DEFAULT);
if ( dh < 0 ) return NULL;
@@ -761,11 +764,8 @@ char *hdfile_get_string_value(struct hdfile *f, const char *name)
}
switch ( class ) {
- case H5T_FLOAT : {
- herr_t r;
- double buf;
- char *tmp;
+ case H5T_FLOAT :
r = H5Dread(dh, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
H5P_DEFAULT, &buf);
@@ -776,12 +776,8 @@ char *hdfile_get_string_value(struct hdfile *f, const char *name)
return tmp;
- }
- case H5T_INTEGER : {
+ case H5T_INTEGER :
- herr_t r;
- int buf;
- char *tmp;
r = H5Dread(dh, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
H5P_DEFAULT, &buf);
@@ -791,6 +787,7 @@ char *hdfile_get_string_value(struct hdfile *f, const char *name)
snprintf(tmp, 255, "%d", buf);
return tmp;
+
}
default : {
goto fail;
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index 3d0f164b..f4bc9d6c 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -83,18 +83,23 @@ IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell,
for ( n=0; n<nm; n++ ) {
switch ( indm[n] ) {
- case INDEXING_NONE :
+
+ case INDEXING_NONE :
ERROR("Tried to prepare INDEXING_NONE!\n");
break;
- case INDEXING_DIRAX :
+
+ case INDEXING_DIRAX :
iprivs[n] = indexing_private(indm[n]);
break;
- case INDEXING_MOSFLM :
+
+ case INDEXING_MOSFLM :
iprivs[n] = indexing_private(indm[n]);
break;
- case INDEXING_REAX :
+
+ case INDEXING_REAX :
iprivs[n] = reax_prepare();
break;
+
}
}
@@ -113,18 +118,23 @@ void cleanup_indexing(IndexingPrivate **priv)
while ( priv[n] != NULL ) {
switch ( priv[n]->indm ) {
- case INDEXING_NONE :
+
+ case INDEXING_NONE :
free(priv[n]);
break;
- case INDEXING_DIRAX :
+
+ case INDEXING_DIRAX :
free(priv[n]);
break;
- case INDEXING_MOSFLM :
+
+ case INDEXING_MOSFLM :
free(priv[n]);
break;
- case INDEXING_REAX :
+
+ case INDEXING_REAX :
reax_cleanup(priv[n]);
break;
+
}
n++;
@@ -173,17 +183,22 @@ void index_pattern(struct image *image, UnitCell *cell, IndexingMethod *indm,
/* Index as appropriate */
switch ( indm[n] ) {
- case INDEXING_NONE :
+
+ case INDEXING_NONE :
return;
- case INDEXING_DIRAX :
+
+ case INDEXING_DIRAX :
run_dirax(image);
break;
- case INDEXING_MOSFLM :
+
+ case INDEXING_MOSFLM :
run_mosflm(image, cell);
break;
- case INDEXING_REAX :
+
+ case INDEXING_REAX :
reax_index(ipriv[n], image, cell);
break;
+
}
if ( image->ncells == 0 ) {
n++;
@@ -205,20 +220,25 @@ void index_pattern(struct image *image, UnitCell *cell, IndexingMethod *indm,
/* Match or reduce the cell as appropriate */
switch ( cellr ) {
- case CELLR_NONE :
+
+ case CELLR_NONE :
new_cell = cell_new_from_cell(cand);
break;
- case CELLR_REDUCE :
+
+ case CELLR_REDUCE :
new_cell = match_cell(cand, cell, verbose,
ltl, 1);
break;
- case CELLR_COMPARE :
+
+ case CELLR_COMPARE :
new_cell = match_cell(cand, cell, verbose,
ltl, 0);
break;
- case CELLR_COMPARE_AB :
+
+ case CELLR_COMPARE_AB :
new_cell = match_cell_ab(cand, cell);
break;
+
}
/* No cell? Move on to the next candidate */
diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c
index 3e29a4f8..410b779a 100644
--- a/libcrystfel/src/mosflm.c
+++ b/libcrystfel/src/mosflm.c
@@ -283,13 +283,13 @@ static void mosflm_send_next(struct image *image, struct mosflm_data *mosflm)
switch ( mosflm->step ) {
- case 1 :
+ case 1 :
mosflm_sendline("DETECTOR ROTATION HORIZONTAL"
" ANTICLOCKWISE ORIGIN LL FAST HORIZONTAL"
" RECTANGULAR\n", mosflm);
break;
- case 2 :
+ case 2 :
if ( mosflm->target_cell != NULL ) {
cell_get_parameters(mosflm->target_cell, &a, &b, &c,
&alpha, &beta, &gamma);
@@ -303,7 +303,7 @@ static void mosflm_send_next(struct image *image, struct mosflm_data *mosflm)
}
break;
- case 3 :
+ case 3 :
if ( mosflm->target_cell != NULL ) {
sg = cell_get_spacegroup(mosflm->target_cell);
/* Remove white space from space group */
@@ -321,31 +321,31 @@ static void mosflm_send_next(struct image *image, struct mosflm_data *mosflm)
}
break;
- case 4 :
+ case 4 :
mosflm_sendline("DISTANCE 67.8\n", mosflm);
break;
- case 5 :
+ case 5 :
mosflm_sendline("BEAM 0.0 0.0\n", mosflm);
break;
- case 6 :
+ case 6 :
wavelength = image->lambda*1e10;
snprintf(tmp, 255, "WAVELENGTH %10.5f\n", wavelength);
mosflm_sendline(tmp, mosflm);
break;
- case 7 :
+ case 7 :
snprintf(tmp, 255, "NEWMAT %s\n", mosflm->newmatfile);
mosflm_sendline(tmp, mosflm);
break;
- case 8 :
+ case 8 :
snprintf(tmp, 255, "IMAGE %s phi 0 0\n", mosflm->imagefile);
mosflm_sendline(tmp, mosflm);
break;
- case 9 :
+ case 9 :
snprintf(tmp, 255, "AUTOINDEX DPS FILE %s"
" IMAGE 1 MAXCELL 1000 REFINE\n",
mosflm->sptfile);
@@ -357,7 +357,7 @@ static void mosflm_send_next(struct image *image, struct mosflm_data *mosflm)
mosflm_sendline(tmp, mosflm);
break;
- case 10 :
+ case 10 :
mosflm_sendline("GO\n", mosflm);
mosflm->finished_ok = 1;
break;
diff --git a/libcrystfel/src/render.c b/libcrystfel/src/render.c
index c9e1f01e..5d0cf9e8 100644
--- a/libcrystfel/src/render.c
+++ b/libcrystfel/src/render.c
@@ -64,34 +64,35 @@ static void render_rgb(double val, double max,
s = 6;
}
switch ( s ) {
- case 0 : { /* Black to blue */
- r = 0; g = 0; b = p;
- break;
- }
- case 1 : { /* Blue to pink */
- r = p; g = 0; b = 1.0;
- break;
- }
- case 2 : { /* Pink to red */
- r = 1.0; g = 0; b = (1.0-p)*1.0;
- break;
- }
- case 3 : { /* Red to Orange */
- r = 1.0; g = 0.5*p; b = 0;
- break;
- }
- case 4 : { /* Orange to Yellow */
- r = 1.0; g = 0.5 + 0.5*p; b = 0;
- break;
- }
- case 5 : { /* Yellow to White */
- r = 1.0; g = 1.0; b = 1.0*p;
- break;
- }
- case 6 : { /* Pixel has hit the maximum value */
- r = 1.0; g = 1.0; b = 1.0;
- break;
- }
+
+ case 0 : /* Black to blue */
+ r = 0; g = 0; b = p;
+ break;
+
+ case 1 : /* Blue to pink */
+ r = p; g = 0; b = 1.0;
+ break;
+
+ case 2 : /* Pink to red */
+ r = 1.0; g = 0; b = (1.0-p)*1.0;
+ break;
+
+ case 3 : /* Red to Orange */
+ r = 1.0; g = 0.5*p; b = 0;
+ break;
+
+ case 4 : /* Orange to Yellow */
+ r = 1.0; g = 0.5 + 0.5*p; b = 0;
+ break;
+
+ case 5 : /* Yellow to White */
+ r = 1.0; g = 1.0; b = 1.0*p;
+ break;
+
+ case 6 : /* Pixel has hit the maximum value */
+ r = 1.0; g = 1.0; b = 1.0;
+ break;
+
}
*rp = r;
@@ -144,16 +145,20 @@ void render_scale(double val, double max, int scale,
double *rp, double *gp, double *bp)
{
switch ( scale ) {
- case SCALE_COLOUR :
+
+ case SCALE_COLOUR :
render_rgb(val, max, rp, gp, bp);
break;
- case SCALE_MONO :
+
+ case SCALE_MONO :
render_mono(val, max, rp, gp, bp);
break;
- case SCALE_INVMONO :
+
+ case SCALE_INVMONO :
render_invmono(val, max, rp, gp, bp);
break;
- case SCALE_RATIO :
+
+ case SCALE_RATIO :
render_ratio(val, max, rp, gp, bp);
break;
}
diff --git a/libcrystfel/src/statistics.c b/libcrystfel/src/statistics.c
index 6ddf2850..56273fdb 100644
--- a/libcrystfel/src/statistics.c
+++ b/libcrystfel/src/statistics.c
@@ -407,22 +407,28 @@ static double calc_r(double scale, void *params)
struct r_params *rp = params;
switch ( rp->fom ) {
- case R_1_ZERO :
+
+ case R_1_ZERO :
return internal_r1_negstozero(rp->list1, rp->list2, scale);
- case R_1_IGNORE :
+
+ case R_1_IGNORE :
return internal_r1_ignorenegs(rp->list1, rp->list2, scale);
- case R_2 :
+
+ case R_2 :
return internal_r2(rp->list1, rp->list2, scale);
- case R_1_I :
+ case R_1_I :
return internal_r_i(rp->list1, rp->list2, scale);
- case R_DIFF_ZERO :
+ case R_DIFF_ZERO :
return internal_rdiff_negstozero(rp->list1, rp->list2,scale);
- case R_DIFF_IGNORE :
+
+ case R_DIFF_IGNORE :
return internal_rdiff_ignorenegs(rp->list1, rp->list2, scale);
- case R_DIFF_INTENSITY :
+
+ case R_DIFF_INTENSITY :
return internal_rdiff_intensity(rp->list1, rp->list2, scale);
+
}
ERROR("No such FoM!\n");
@@ -457,17 +463,20 @@ static double r_minimised(RefList *list1, RefList *list2, double *scalep, int fo
/* Initial guess */
switch ( fom ) {
- case R_1_ZERO :
- case R_1_IGNORE :
- case R_DIFF_ZERO :
- case R_DIFF_IGNORE :
+
+ case R_1_ZERO :
+ case R_1_IGNORE :
+ case R_DIFF_ZERO :
+ case R_DIFF_IGNORE :
scale = stat_scale_sqrti(list1, list2);
break;
- case R_2 :
- case R_1_I :
- case R_DIFF_INTENSITY :
+
+ case R_2 :
+ case R_1_I :
+ case R_DIFF_INTENSITY :
scale = stat_scale_intensity(list1, list2);
break;
+
}
//STATUS("Initial scale factor estimate: %5.2e\n", scale);
diff --git a/src/check_hkl.c b/src/check_hkl.c
index 649b86af..4927e60e 100644
--- a/src/check_hkl.c
+++ b/src/check_hkl.c
@@ -339,43 +339,44 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "hy:p:", longopts, NULL)) != -1) {
switch (c) {
- case 'h' :
+
+ case 'h' :
show_help(argv[0]);
return 0;
- case 'y' :
+ case 'y' :
sym_str = strdup(optarg);
break;
- case 'p' :
+ case 'p' :
pdb = strdup(optarg);
break;
- case 0 :
+ case 0 :
break;
- case 2 :
+ case 2 :
if ( sscanf(optarg, "%e", &rmin_fix) != 1 ) {
ERROR("Invalid value for --rmin\n");
return 1;
}
break;
- case 3 :
+ case 3 :
if ( sscanf(optarg, "%e", &rmax_fix) != 1 ) {
ERROR("Invalid value for --rmax\n");
return 1;
}
break;
- case 4 :
+ case 4 :
if ( sscanf(optarg, "%f", &sigma_cutoff) != 1 ) {
ERROR("Invalid value for --sigma-cutoff\n");
return 1;
}
break;
- default :
+ default :
return 1;
}
diff --git a/src/cl-utils.c b/src/cl-utils.c
index ae146ed0..71ff25b5 100644
--- a/src/cl-utils.c
+++ b/src/cl-utils.c
@@ -46,28 +46,71 @@
const char *clError(cl_int err)
{
switch ( err ) {
- case CL_SUCCESS : return "no error";
- case CL_INVALID_PLATFORM : return "invalid platform";
- case CL_INVALID_KERNEL : return "invalid kernel";
- case CL_INVALID_ARG_INDEX : return "invalid argument index";
- case CL_INVALID_ARG_VALUE : return "invalid argument value";
- case CL_INVALID_MEM_OBJECT : return "invalid memory object";
- case CL_INVALID_SAMPLER : return "invalid sampler";
- case CL_INVALID_ARG_SIZE : return "invalid argument size";
- case CL_INVALID_COMMAND_QUEUE : return "invalid command queue";
- case CL_INVALID_CONTEXT : return "invalid context";
- case CL_INVALID_VALUE : return "invalid value";
- case CL_INVALID_EVENT_WAIT_LIST : return "invalid wait list";
- case CL_MAP_FAILURE : return "map failure";
- case CL_MEM_OBJECT_ALLOCATION_FAILURE : return "object allocation failure";
- case CL_OUT_OF_HOST_MEMORY : return "out of host memory";
- case CL_OUT_OF_RESOURCES : return "out of resources";
- case CL_INVALID_KERNEL_NAME : return "invalid kernel name";
- case CL_INVALID_KERNEL_ARGS : return "invalid kernel arguments";
- case CL_INVALID_WORK_GROUP_SIZE : return "invalid work group size";
- case CL_IMAGE_FORMAT_NOT_SUPPORTED : return "image format not supported";
- case CL_INVALID_WORK_DIMENSION : return "invalid work dimension";
- default :
+
+ case CL_SUCCESS :
+ return "no error";
+
+ case CL_INVALID_PLATFORM :
+ return "invalid platform";
+
+ case CL_INVALID_KERNEL :
+ return "invalid kernel";
+
+ case CL_INVALID_ARG_INDEX :
+ return "invalid argument index";
+
+ case CL_INVALID_ARG_VALUE :
+ return "invalid argument value";
+
+ case CL_INVALID_MEM_OBJECT :
+ return "invalid memory object";
+
+ case CL_INVALID_SAMPLER :
+ return "invalid sampler";
+
+ case CL_INVALID_ARG_SIZE :
+ return "invalid argument size";
+
+ case CL_INVALID_COMMAND_QUEUE :
+ return "invalid command queue";
+
+ case CL_INVALID_CONTEXT :
+ return "invalid context";
+
+ case CL_INVALID_VALUE :
+ return "invalid value";
+
+ case CL_INVALID_EVENT_WAIT_LIST :
+ return "invalid wait list";
+
+ case CL_MAP_FAILURE :
+ return "map failure";
+
+ case CL_MEM_OBJECT_ALLOCATION_FAILURE :
+ return "object allocation failure";
+
+ case CL_OUT_OF_HOST_MEMORY :
+ return "out of host memory";
+
+ case CL_OUT_OF_RESOURCES :
+ return "out of resources";
+
+ case CL_INVALID_KERNEL_NAME :
+ return "invalid kernel name";
+
+ case CL_INVALID_KERNEL_ARGS :
+ return "invalid kernel arguments";
+
+ case CL_INVALID_WORK_GROUP_SIZE :
+ return "invalid work group size";
+
+ case CL_IMAGE_FORMAT_NOT_SUPPORTED :
+ return "image format not supported";
+
+ case CL_INVALID_WORK_DIMENSION :
+ return "invalid work dimension";
+
+ default :
return "unknown error";
}
}
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index 5846682f..b926c3ae 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -331,49 +331,51 @@ int main(int argc, char *argv[])
{
switch (c) {
- case 'h' :
+
+ case 'h' :
show_help(argv[0]);
return 0;
- case 'o' :
+ case 'o' :
ratiofile = strdup(optarg);
break;
- case 'y' :
+ case 'y' :
sym_str = strdup(optarg);
break;
- case 'p' :
+ case 'p' :
pdb = strdup(optarg);
break;
- case 'u' :
+ case 'u' :
config_unity = 1;
break;
- case 0 :
+ case 0 :
break;
- case 2 :
+ case 2 :
if ( sscanf(optarg, "%e", &rmin_fix) != 1 ) {
ERROR("Invalid value for --rmin\n");
return 1;
}
break;
- case 3 :
+ case 3 :
if ( sscanf(optarg, "%e", &rmax_fix) != 1 ) {
ERROR("Invalid value for --rmax\n");
return 1;
}
break;
- case 4 :
+ case 4 :
config_shells = get_r_shell(optarg);
break;
- default :
+ default :
return 1;
+
}
}
diff --git a/src/get_hkl.c b/src/get_hkl.c
index 9f86f0f7..de5d74de 100644
--- a/src/get_hkl.c
+++ b/src/get_hkl.c
@@ -391,44 +391,46 @@ int main(int argc, char *argv[])
longopts, NULL)) != -1) {
switch (c) {
- case 'h' :
+
+ case 'h' :
show_help(argv[0]);
return 0;
- case 't' :
+ case 't' :
template = strdup(optarg);
break;
- case 'o' :
+ case 'o' :
output = strdup(optarg);
break;
- case 'i' :
+ case 'i' :
input_file = strdup(optarg);
break;
- case 'y' :
+ case 'y' :
mero_str = strdup(optarg);
break;
- case 'w' :
+ case 'w' :
holo_str = strdup(optarg);
break;
- case 'e' :
+ case 'e' :
expand_str = strdup(optarg);
break;
- case 2 :
+ case 2 :
adu_per_photon = strtof(optarg, NULL);
have_adu_per_photon = 1;
break;
- case 0 :
+ case 0 :
break;
- default :
+ default :
return 1;
+
}
}
diff --git a/src/hdfsee.c b/src/hdfsee.c
index 22302ec8..613572a2 100644
--- a/src/hdfsee.c
+++ b/src/hdfsee.c
@@ -151,15 +151,16 @@ int main(int argc, char *argv[])
char *test;
switch (c) {
- case 'h' :
+
+ case 'h' :
show_help(argv[0]);
return 0;
- case 'p' :
+ case 'p' :
peaks = strdup(optarg);
break;
- case 'i' :
+ case 'i' :
boost = atoi(optarg);
if ( boost < 1 ) {
ERROR("Intensity boost must be a positive"
@@ -168,7 +169,7 @@ int main(int argc, char *argv[])
}
break;
- case 'b' :
+ case 'b' :
binning = atoi(optarg);
if ( binning < 1 ) {
ERROR("Binning must be a positive integer.\n");
@@ -176,19 +177,19 @@ int main(int argc, char *argv[])
}
break;
- case 'c' :
+ case 'c' :
cscale = strdup(optarg);
break;
- case 'e' :
+ case 'e' :
element = strdup(optarg);
break;
- case 'g' :
+ case 'g' :
geometry = strdup(optarg);
break;
- case 2 :
+ case 2 :
ring_size = strtod(optarg, &test);
if ( test == optarg ) {
ERROR("Ring size must be numerical.\n");
@@ -196,7 +197,7 @@ int main(int argc, char *argv[])
}
break;
- case 'r' :
+ case 'r' :
config_showrings = 1;
reslist = strdup(optarg);
int nchar = strlen(reslist);
@@ -219,10 +220,10 @@ int main(int argc, char *argv[])
}
break;
- case 0 :
+ case 0 :
break;
- default :
+ default :
return 1;
}
diff --git a/src/partial_sim.c b/src/partial_sim.c
index 39621a6c..6b99864e 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -343,47 +343,48 @@ int main(int argc, char *argv[])
longopts, NULL)) != -1)
{
switch (c) {
- case 'h' :
+
+ case 'h' :
show_help(argv[0]);
return 0;
- case 'o' :
+ case 'o' :
output_file = strdup(optarg);
break;
- case 'i' :
+ case 'i' :
input_file = strdup(optarg);
break;
- case 'b' :
+ case 'b' :
beamfile = strdup(optarg);
break;
- case 'p' :
+ case 'p' :
cellfile = strdup(optarg);
break;
- case 'g' :
+ case 'g' :
geomfile = strdup(optarg);
break;
- case 'y' :
+ case 'y' :
sym_str = strdup(optarg);
break;
- case 'n' :
+ case 'n' :
n = atoi(optarg);
break;
- case 'r' :
+ case 'r' :
save_file = strdup(optarg);
break;
- case 'j' :
+ case 'j' :
n_threads = atoi(optarg);
break;
- case 'c' :
+ case 'c' :
cnoise = strtod(optarg, &rval);
if ( *rval != '\0' ) {
ERROR("Invalid cell noise value.\n");
@@ -391,15 +392,16 @@ int main(int argc, char *argv[])
}
break;
- case 2 :
+ case 2 :
phist_file = strdup(optarg);
break;
- case 0 :
+ case 0 :
break;
- default :
+ default :
return 1;
+
}
}
diff --git a/src/partialator.c b/src/partialator.c
index 91f2ff99..4fa8c2bd 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -325,35 +325,36 @@ int main(int argc, char *argv[])
{
switch (c) {
- case 'h' :
+
+ case 'h' :
show_help(argv[0]);
return 0;
- case 'i' :
+ case 'i' :
infile = strdup(optarg);
break;
- case 'g' :
+ case 'g' :
geomfile = strdup(optarg);
break;
- case 'j' :
+ case 'j' :
nthreads = atoi(optarg);
break;
- case 'y' :
+ case 'y' :
sym_str = strdup(optarg);
break;
- case 'o' :
+ case 'o' :
outfile = strdup(optarg);
break;
- case 'n' :
+ case 'n' :
n_iter = atoi(optarg);
break;
- case 'b' :
+ case 'b' :
beam = get_beam_parameters(optarg);
if ( beam == NULL ) {
ERROR("Failed to load beam parameters"
@@ -362,15 +363,16 @@ int main(int argc, char *argv[])
}
break;
- case 'r' :
+ case 'r' :
reference_file = strdup(optarg);
break;
- case 0 :
+ case 0 :
break;
- default :
+ default :
return 1;
+
}
}
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index c207e0dc..03b009b4 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -294,15 +294,16 @@ int main(int argc, char *argv[])
longopts, NULL)) != -1) {
switch (c) {
- case 'h' :
+
+ case 'h' :
show_help(argv[0]);
return 0;
- case 'r' :
+ case 'r' :
config_randomquat = 1;
break;
- case 'n' :
+ case 'n' :
n_images = strtol(optarg, &rval, 10);
if ( *rval != '\0' ) {
ERROR("Invalid number of images.\n");
@@ -310,43 +311,43 @@ int main(int argc, char *argv[])
}
break;
- case 'i' :
+ case 'i' :
intfile = strdup(optarg);
break;
- case 't' :
+ case 't' :
grad_str = strdup(optarg);
break;
- case 'p' :
+ case 'p' :
filename = strdup(optarg);
break;
- case 'o' :
+ case 'o' :
outfile = strdup(optarg);
break;
- case 'w' :
+ case 'w' :
powder_fn = strdup(optarg);
break;
- case 'g' :
+ case 'g' :
geometry = strdup(optarg);
break;
- case 'b' :
+ case 'b' :
beamfile = strdup(optarg);
break;
- case 'y' :
+ case 'y' :
sym_str = strdup(optarg);
break;
- case 2 :
+ case 2 :
gpu_dev = atoi(optarg);
break;
- case 3 :
+ case 3 :
min_size = strtod(optarg, &rval);
if ( *rval != '\0' ) {
ERROR("Invalid minimum size.\n");
@@ -355,7 +356,7 @@ int main(int argc, char *argv[])
random_size++;
break;
- case 4 :
+ case 4 :
max_size = strtod(optarg, &rval);
if ( *rval != '\0' ) {
ERROR("Invalid maximum size.\n");
@@ -364,11 +365,12 @@ int main(int argc, char *argv[])
random_size++;
break;
- case 0 :
+ case 0 :
break;
- default :
+ default :
return 1;
+
}
}
diff --git a/src/post-refinement.c b/src/post-refinement.c
index cf7b2576..78c47d07 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -241,7 +241,7 @@ static void apply_shift(struct image *image, int k, double shift)
{
switch ( k ) {
- case REF_DIV :
+ case REF_DIV :
if ( isnan(shift) ) {
ERROR("NaN divergence shift\n");
} else {
@@ -250,23 +250,23 @@ static void apply_shift(struct image *image, int k, double shift)
}
break;
- case REF_R :
+ case REF_R :
image->profile_radius += shift;
break;
- case REF_ASX :
- case REF_ASY :
- case REF_ASZ :
- case REF_BSX :
- case REF_BSY :
- case REF_BSZ :
- case REF_CSX :
- case REF_CSY :
- case REF_CSZ :
+ case REF_ASX :
+ case REF_ASY :
+ case REF_ASZ :
+ case REF_BSX :
+ case REF_BSY :
+ case REF_BSZ :
+ case REF_CSX :
+ case REF_CSY :
+ case REF_CSZ :
apply_cell_shift(image->indexed_cell, k, shift);
break;
- default :
+ default :
ERROR("No shift defined for parameter %i\n", k);
abort();
diff --git a/src/powder_plot.c b/src/powder_plot.c
index 3f49695a..049b9c0e 100644
--- a/src/powder_plot.c
+++ b/src/powder_plot.c
@@ -775,51 +775,51 @@ int main(int argc, char *argv[])
switch (c) {
- case 'h' :
+ case 'h' :
show_help(argv[0]);
return 0;
- case 'i' :
+ case 'i' :
filename = strdup(optarg);
break;
- case 'o' :
+ case 'o' :
output = strdup(optarg);
break;
- case 'g' :
+ case 'g' :
geometry = strdup(optarg);
break;
- case 'b' :
+ case 'b' :
beamf = strdup(optarg);
break;
- case 'p' :
+ case 'p' :
pdb = strdup(optarg);
break;
- case 'y' :
+ case 'y' :
sym_str = strdup(optarg);
break;
- case 's' :
+ case 's' :
hist_info.histsize = atoi(optarg);
break;
- case 'e' :
+ case 'e' :
element = strdup(optarg);
break;
- case 1 :
+ case 1 :
hist_info.q_max = atof(optarg);
break;
- case 2 :
+ case 2 :
hist_info.q_min = atof(optarg);
break;
- case 3 :
+ case 3 :
if (strcmp(optarg, "linear") == 0 ) {
hist_info.spacing = LINEAR;
} else if (strcmp(optarg, "wilson") == 0 ) {
@@ -832,14 +832,14 @@ int main(int argc, char *argv[])
}
break;
- case 'd' :
+ case 'd' :
datatype = strdup(optarg);
break;
- case 0 :
+ case 0 :
break;
- default :
+ default :
return 1;
}
@@ -1096,45 +1096,50 @@ int main(int argc, char *argv[])
}
/* Process reflections based on file type and data type */
- switch (file_type) {
- case FILE_H5 :
+ switch ( file_type ) {
+ case FILE_H5 :
n_patterns++;
n_peaks = process_h5(&image, &hist_info, histdata);
free(image.data);
break;
- case FILE_HKL :
+ case FILE_HKL :
n_patterns++; //inc number of patterns used
n_peaks = process_hkl(&image, sym, cell, &hist_info, histdata,
q_scaling, use_redundancy);
break;
- case FILE_STREAM :
- switch (data_type) {
- case PLOT_REFL :
+ case FILE_STREAM :
+ switch ( data_type ) {
+
+ case PLOT_REFL :
n_peaks = process_stream_reflection(fh, &image,
&hist_info, histdata, &n_patterns);
break;
- case PLOT_HKL :
+
+ case PLOT_HKL :
n_peaks = process_stream_hkl(fh, &image, &hist_info,
+
histdata, cell, &n_patterns);
break;
- case PLOT_PEAKS :
+ case PLOT_PEAKS :
n_peaks = process_stream_peaks(fh, &image, &hist_info,
histdata, &n_patterns, only_indexed);
break;
- case PLOT_H5 :
+
+ case PLOT_H5 :
n_peaks = process_stream_h5(fh, &image, &hist_info,
histdata, config_satcorr, only_indexed,
&n_patterns, element);
break;
- default :
+
+ default :
break;
}
fclose(fh);
break;
- default :
+ default :
break;
}
diff --git a/src/render_hkl.c b/src/render_hkl.c
index a63cbad3..a01e7609 100644
--- a/src/render_hkl.c
+++ b/src/render_hkl.c
@@ -118,23 +118,29 @@ static double max_value(RefList *list, int wght, const SymOpList *sym)
n = num_equivs(sym, m);
switch ( wght ) {
- case WGHT_I :
+
+ case WGHT_I :
val = get_intensity(refl);
break;
- case WGHT_SQRTI :
+
+ case WGHT_SQRTI :
val = get_intensity(refl);
val = (val>0.0) ? sqrt(val) : 0.0;
break;
- case WGHT_COUNTS :
+
+ case WGHT_COUNTS :
val = get_redundancy(refl);
val /= (double)n;
break;
- case WGHT_RAWCOUNTS :
+
+ case WGHT_RAWCOUNTS :
val = get_redundancy(refl);
break;
- default :
+
+ default :
ERROR("Invalid weighting.\n");
abort();
+
}
if ( val > max ) max = val;
@@ -192,23 +198,29 @@ static void draw_circles(double xh, double xk, double xl,
yi = (h*yh + k*yk + l*yl) / ny;
switch ( wght) {
- case WGHT_I :
+
+ case WGHT_I :
val = get_intensity(refl);
break;
- case WGHT_SQRTI :
+
+ case WGHT_SQRTI :
val = get_intensity(refl);
val = (val>0.0) ? sqrt(val) : 0.0;
break;
- case WGHT_COUNTS :
+
+ case WGHT_COUNTS :
val = get_redundancy(refl);
val /= (double)n;
break;
- case WGHT_RAWCOUNTS :
+
+ case WGHT_RAWCOUNTS :
val = get_redundancy(refl);
break;
- default :
+
+ default :
ERROR("Invalid weighting.\n");
abort();
+
}
/* Absolute location in image based on 2D basis */
@@ -621,43 +633,44 @@ int main(int argc, char *argv[])
longopts, NULL)) != -1) {
switch (c) {
- case 'h' :
+
+ case 'h' :
show_help(argv[0]);
return 0;
- case 'p' :
+ case 'p' :
pdb = strdup(optarg);
break;
- case 'b' :
+ case 'b' :
boost = atof(optarg);
break;
- case 'y' :
+ case 'y' :
sym_str = strdup(optarg);
break;
- case 'w' :
+ case 'w' :
weighting = strdup(optarg);
break;
- case 'c' :
+ case 'c' :
cscale = strdup(optarg);
break;
- case 'd' :
+ case 'd' :
down = strdup(optarg);
break;
- case 'r' :
+ case 'r' :
right = strdup(optarg);
break;
- case 'o' :
+ case 'o' :
outfile = strdup(optarg);
break;
- case 2 :
+ case 2 :
errno = 0;
scale_top = strtod(optarg, &endptr);
if ( !( (optarg[0] != '\0') && (endptr[0] == '\0') )
@@ -672,11 +685,12 @@ int main(int argc, char *argv[])
}
break;
- case 0 :
+ case 0 :
break;
- default :
+ default :
return 1;
+
}
}