aboutsummaryrefslogtreecommitdiff
path: root/src/cell_tool.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-02-21 16:14:30 +0100
committerThomas White <taw@physics.org>2019-03-11 16:49:36 +0100
commit50f27f725b3ce7cd636eb5c92c9f05fee8d6364b (patch)
tree348ba1b83f2d849758aad655d5ea813536ead514 /src/cell_tool.c
parentb7d39a5087e2cb4bfaf4bf98b660625f66df8d41 (diff)
cell_tool --rings: Add --highres
Diffstat (limited to 'src/cell_tool.c')
-rw-r--r--src/cell_tool.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/cell_tool.c b/src/cell_tool.c
index 5aaa68a6..e8e60f30 100644
--- a/src/cell_tool.c
+++ b/src/cell_tool.c
@@ -64,6 +64,7 @@ static void show_help(const char *s)
" -y <pointgroup> Real point group of the structure.\n"
" --tolerance=<tol> Set the tolerances for cell comparison.\n"
" Default: 5,1.5 (axis percentage, angle deg).\n"
+" --highres=n Resolution limit (Angstroms) for --rings\n"
);
}
@@ -164,22 +165,19 @@ static int cmpres(const void *av, const void *bv)
}
-static int all_rings(UnitCell *cell, SymOpList *sym)
+static int all_rings(UnitCell *cell, SymOpList *sym, double mres)
{
double ax, ay, az;
double bx, by, bz;
double cx, cy, cz;
int hmax, kmax, lmax;
- double mres;
signed int h, k, l;
RefList *list;
int i, n;
RefListIterator *iter;
Reflection *refl;
struct sortmerefl *sortus;
- double highres = 2.0; /* Angstroms */
- mres = 1.0/(highres*1e-10);
cell_get_cartesian(cell, &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz);
hmax = mres * modulus(ax, ay, az);
kmax = mres * modulus(bx, by, bz);
@@ -240,7 +238,7 @@ static int all_rings(UnitCell *cell, SymOpList *sym)
qsort(sortus, n, sizeof(struct sortmerefl), cmpres);
- STATUS("\nAll powder rings up to %f Ångstrøms.\n", highres);
+ STATUS("\nAll powder rings up to %f Ångstrøms.\n", 1e+10/mres);
STATUS("Note that screw axis or glide plane absences are not "
"omitted from this list.\n");
STATUS("\n d (Å) 1/d (m^-1) h k l multiplicity\n");
@@ -394,6 +392,8 @@ int main(int argc, char *argv[])
int mode = CT_NOTHING;
char *comparecell = NULL;
char *out_file = NULL;
+ float highres;
+ double rmax = 1/(2.0e-10);
/* Long options */
const struct option longopts[] = {
@@ -444,6 +444,14 @@ int main(int argc, char *argv[])
mode = CT_COMPARE;
break;
+ case 5 :
+ if ( sscanf(optarg, "%e", &highres) != 1 ) {
+ ERROR("Invalid value for --highres\n");
+ return 1;
+ }
+ rmax = 1.0 / (highres/1e10);
+ break;
+
case 0 :
break;
@@ -521,7 +529,7 @@ int main(int argc, char *argv[])
if ( mode == CT_FINDAMBI ) return find_ambi(cell, sym, ltl, atl);
if ( mode == CT_UNCENTER ) return uncenter(cell, out_file);
- if ( mode == CT_RINGS ) return all_rings(cell, sym);
+ if ( mode == CT_RINGS ) return all_rings(cell, sym, rmax);
if ( mode == CT_COMPARE ) return comparecells(cell, comparecell, ltl, atl);
/* FIXME: Everything else */