aboutsummaryrefslogtreecommitdiff
path: root/src/templates.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates.c')
-rw-r--r--src/templates.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/templates.c b/src/templates.c
index db28b9b9..98182bbe 100644
--- a/src/templates.c
+++ b/src/templates.c
@@ -16,6 +16,8 @@
#include "index.h"
#include "index-priv.h"
+#include "symmetry.h"
+#include "utils.h"
/* Private data for template indexing */
@@ -25,13 +27,36 @@ struct _indexingprivate_template
};
+/* Generate templates for the given cell using a representative image */
IndexingPrivate *generate_templates(UnitCell *cell, const char *filename)
{
struct _indexingprivate_template *priv;
+ const char *holo;
+ double omega_max, phi_max;
priv = calloc(1, sizeof(struct _indexingprivate_template));
priv->base.indm = INDEXING_TEMPLATE;
+ /* We can only distinguish orientations within the holohedral cell */
+ holo = get_holohedral(cell_get_pointgroup(cell));
+ STATUS("%s\n", holo);
+
+ /* These define the orientation in space */
+ if ( is_polyhedral(holo) ) {
+ ERROR("WARNING: Holohedral point group is polyhedral.\n");
+ ERROR("This means I can't properly determine the orientation");
+ ERROR(" ranges for template matching. Expect trouble.\n");
+ }
+ omega_max = 2.0*M_PI / rotational_order(holo);
+ if ( has_bisecting_mirror_or_diad(holo) ) omega_max /= 2.0;
+ phi_max = M_PI;
+ if ( has_perpendicular_mirror(holo) ) phi_max /= 2.0;
+
+ /* One more axis would define the rotation in the plane of the image */
+
+ STATUS("Orientation ranges: %5.0f -> %5.0f, %5.0f -> %5.0f deg.\n",
+ 0.0, rad2deg(omega_max), 0.0, rad2deg(phi_max));
+
return (struct _indexingprivate *)priv;
}