aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/cell-utils.c12
-rw-r--r--libcrystfel/src/cell-utils.h2
-rw-r--r--src/cell_tool.c11
3 files changed, 15 insertions, 10 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c
index 2a3bcfa2..847ddb55 100644
--- a/libcrystfel/src/cell-utils.c
+++ b/libcrystfel/src/cell-utils.c
@@ -1875,7 +1875,7 @@ static int cmpcand(const void *av, const void *bv)
static Rational *find_candidates(double len, double *a, double *b, double *c,
- double ltl, int *pncand)
+ double ltl, int csl, int *pncand)
{
Rational *r;
struct cand *cands;
@@ -1890,7 +1890,7 @@ static Rational *find_candidates(double len, double *a, double *b, double *c,
cands = malloc(max_cand * sizeof(struct cand));
if ( cands == NULL ) return NULL;
- rat = rtnl_list(-5, 5, 1, 4, &nrat);
+ rat = rtnl_list(-5, 5, 1, csl ? 4 : 1, &nrat);
if ( rat == NULL ) return NULL;
for ( ia=0; ia<nrat; ia++ ) {
@@ -1999,7 +1999,7 @@ static double g6_distance(double a1, double b1, double c1,
*
*/
int compare_reindexed_cell_parameters(UnitCell *cell_in, UnitCell *reference_in,
- double ltl, double atl,
+ double ltl, double atl, int csl,
RationalMatrix **pmb)
{
UnitCell *cell;
@@ -2036,9 +2036,9 @@ int compare_reindexed_cell_parameters(UnitCell *cell_in, UnitCell *reference_in,
&cv[0], &cv[1], &cv[2]);
/* Find vectors in 'cell' with lengths close to a, b and c */
- cand_a = find_candidates(a, av, bv, cv, ltl, &ncand_a);
- cand_b = find_candidates(b, av, bv, cv, ltl, &ncand_b);
- cand_c = find_candidates(c, av, bv, cv, ltl, &ncand_c);
+ cand_a = find_candidates(a, av, bv, cv, ltl, csl, &ncand_a);
+ cand_b = find_candidates(b, av, bv, cv, ltl, csl, &ncand_b);
+ cand_c = find_candidates(c, av, bv, cv, ltl, csl, &ncand_c);
if ( (ncand_a==0) || (ncand_b==0) || (ncand_c==0) ) {
*pmb = NULL;
diff --git a/libcrystfel/src/cell-utils.h b/libcrystfel/src/cell-utils.h
index a97f2bfb..79c98e61 100644
--- a/libcrystfel/src/cell-utils.h
+++ b/libcrystfel/src/cell-utils.h
@@ -97,7 +97,7 @@ extern int compare_reindexed_cell_parameters_and_orientation(UnitCell *a,
IntegerMatrix **pmb);
extern int compare_reindexed_cell_parameters(UnitCell *cell, UnitCell *reference,
- double ltl, double atl,
+ double ltl, double atl, int csl,
RationalMatrix **pmb);
#ifdef __cplusplus
diff --git a/src/cell_tool.c b/src/cell_tool.c
index 652df885..cd457f25 100644
--- a/src/cell_tool.c
+++ b/src/cell_tool.c
@@ -67,12 +67,13 @@ static void show_help(const char *s)
" --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"
+" --csl Allow --compare to find coincidence site lattice relationships.\n"
);
}
static int comparecells(UnitCell *cell, const char *comparecell,
- double ltl, double atl)
+ double ltl, double atl, int csl)
{
UnitCell *cell2;
RationalMatrix *m;
@@ -90,7 +91,7 @@ static int comparecells(UnitCell *cell, const char *comparecell,
cell_print(cell2);
STATUS("------------------> The comparison results:\n");
- if ( !compare_reindexed_cell_parameters(cell, cell2, ltl, atl, &m) ) {
+ if ( !compare_reindexed_cell_parameters(cell, cell2, ltl, atl, csl, &m) ) {
STATUS("No relationship found between lattices.\n");
return 0;
} else {
@@ -425,6 +426,7 @@ int main(int argc, char *argv[])
float highres;
double rmax = 1/(2.0e-10);
char *trans_str = NULL;
+ int csl = 0;
/* Long options */
const struct option longopts[] = {
@@ -440,8 +442,10 @@ int main(int argc, char *argv[])
{"rings", 0, &mode, CT_RINGS},
{"compare-cell", 1, NULL, 3},
{"cell-choices", 0, &mode, CT_CHOICES},
+
{"transform", 1, NULL, 4},
{"highres", 1, NULL, 5},
+ {"csl", 0, &csl, 1},
{0, 0, NULL, 0}
};
@@ -568,7 +572,8 @@ 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, rmax);
- if ( mode == CT_COMPARE ) return comparecells(cell, comparecell, ltl, atl);
+ if ( mode == CT_COMPARE ) return comparecells(cell, comparecell,
+ ltl, atl, csl);
if ( mode == CT_TRANSFORM ) return transform(cell, trans_str, out_file);
if ( mode == CT_CHOICES ) return cell_choices(cell);