Commit 747ef478 authored by Thomas White's avatar Thomas White
Browse files

get_hkl: Fix resolution cutoff

The units needed to be clarified.
parent 39f9e154
...@@ -406,6 +406,7 @@ static RefList *trim_centrics(RefList *in, const SymOpList *sym) ...@@ -406,6 +406,7 @@ static RefList *trim_centrics(RefList *in, const SymOpList *sym)
} }
/* lowres and highres are 1/d values in m^-1 */
static RefList *apply_resolution_cutoff(RefList *input, double lowres, static RefList *apply_resolution_cutoff(RefList *input, double lowres,
double highres, UnitCell *cell) double highres, UnitCell *cell)
{ {
...@@ -424,14 +425,13 @@ static RefList *apply_resolution_cutoff(RefList *input, double lowres, ...@@ -424,14 +425,13 @@ static RefList *apply_resolution_cutoff(RefList *input, double lowres,
double res; double res;
get_indices(refl, &h, &k, &l); get_indices(refl, &h, &k, &l);
res = 2.0 * resolution(cell, h, k, l); res = 2.0 * resolution(cell, h, k, l);
if ( (res < 1e10/highres) && (res > 1e10/lowres) ) { if ( (res < highres) && (res > lowres) ) {
Reflection *a; Reflection *a;
a = add_refl(n, h, k, l); a = add_refl(n, h, k, l);
copy_data(a, refl); copy_data(a, refl);
} }
} }
cell_free(cell);
reflist_free(input); reflist_free(input);
return n; return n;
} }
...@@ -464,8 +464,8 @@ int main(int argc, char *argv[]) ...@@ -464,8 +464,8 @@ int main(int argc, char *argv[])
char *cellfile = NULL; char *cellfile = NULL;
char *reindex_str = NULL; char *reindex_str = NULL;
SymOpList *reindex = NULL; SymOpList *reindex = NULL;
float lowres = 0.0; float lowres = 0.0; /* 1/d value */
double highres = INFINITY; double highres = INFINITY; /* 1/d value */
UnitCell *cell = NULL; UnitCell *cell = NULL;
/* Long options */ /* Long options */
...@@ -553,6 +553,8 @@ int main(int argc, char *argv[]) ...@@ -553,6 +553,8 @@ int main(int argc, char *argv[])
ERROR("Invalid value for --lowres\n"); ERROR("Invalid value for --lowres\n");
return 1; return 1;
} }
lowres /= 1e10; /* Angstroms -> m */
lowres = 1.0/lowres; /* m -> m^-1 */
break; break;
case 0 : case 0 :
...@@ -581,6 +583,11 @@ int main(int argc, char *argv[]) ...@@ -581,6 +583,11 @@ int main(int argc, char *argv[])
/* Convert Angstroms -> m */ /* Convert Angstroms -> m */
cutn1 /= 1e10; cutn2 /= 1e10; cutn3 /= 1e10; cutn1 /= 1e10; cutn2 /= 1e10; cutn3 /= 1e10;
/* Convert m -> m^-1 */
cutn1 = 1.0/cutn1;
cutn2 = 1.0/cutn2;
cutn3 = 1.0/cutn3;
/* Set isotropic cutoff to the largest */ /* Set isotropic cutoff to the largest */
highres = biggest(cutn1, biggest(cutn2, cutn3)); highres = biggest(cutn1, biggest(cutn2, cutn3));
...@@ -589,7 +596,13 @@ int main(int argc, char *argv[]) ...@@ -589,7 +596,13 @@ int main(int argc, char *argv[])
char *rval; char *rval;
errno = 0; errno = 0;
/* highres is in m */
highres = strtod(cutoff_str, &rval); highres = strtod(cutoff_str, &rval);
/* Convert Angstroms -> m -> m^-1 */
highres /= 1e10;
highres = 1.0/highres;
if ( *rval != '\0' ) { if ( *rval != '\0' ) {
ERROR("Invalid value for --cutoff-angstroms.\n"); ERROR("Invalid value for --cutoff-angstroms.\n");
return 1; return 1;
...@@ -655,8 +668,7 @@ int main(int argc, char *argv[]) ...@@ -655,8 +668,7 @@ int main(int argc, char *argv[])
mero = NULL; mero = NULL;
} }
if ( (expand != NULL) || (holo != NULL) || config_trimc if ( (expand != NULL) || (holo != NULL) || config_trimc || config_multi ) {
|| config_multi ) {
if ( mero == NULL ) { if ( mero == NULL ) {
ERROR("You must specify the point group with -y.\n"); ERROR("You must specify the point group with -y.\n");
} }
...@@ -821,9 +833,9 @@ int main(int argc, char *argv[]) ...@@ -821,9 +833,9 @@ int main(int argc, char *argv[])
get_indices(refl, &h, &k, &l); get_indices(refl, &h, &k, &l);
sum = pow(h*as*cutn1, 2.0); sum = pow(h*as/cutn1, 2.0);
sum += pow(k*bs*cutn2, 2.0); sum += pow(k*bs/cutn2, 2.0);
sum += pow(l*cs*cutn3, 2.0); sum += pow(l*cs/cutn3, 2.0);
if ( sum < 1.0 ) { if ( sum < 1.0 ) {
Reflection *a; Reflection *a;
......
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