diff options
author | Thomas White <taw@physics.org> | 2012-08-09 11:47:00 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-08-09 11:47:00 +0200 |
commit | 73e607d41d86db212cb1a6943a2174ad099c8720 (patch) | |
tree | 9fc4c38ef3d59692425b916df8aa2098df553abb /libcrystfel | |
parent | 931d4c78be9cce10c4a95ab42a180e90047e7411 (diff) |
Fix crash when there are too many unit cell candidates
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/cell.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/libcrystfel/src/cell.c b/libcrystfel/src/cell.c index 84361414..3d2a28bf 100644 --- a/libcrystfel/src/cell.c +++ b/libcrystfel/src/cell.c @@ -783,18 +783,28 @@ UnitCell *match_cell(UnitCell *cell, UnitCell *template, int verbose, continue; } - cand[i][ncand[i]].vec.u = tx; - cand[i][ncand[i]].vec.v = ty; - cand[i][ncand[i]].vec.w = tz; - cand[i][ncand[i]].na = n1; - cand[i][ncand[i]].nb = n2; - cand[i][ncand[i]].nc = n3; - cand[i][ncand[i]].fom = fabs(lengths[i] - tlen); if ( ncand[i] == MAX_CAND ) { - ERROR("Too many candidates\n"); + ERROR("Too many cell candidates - "); + ERROR("consider tightening the unit "); + ERROR("cell tolerances.\n"); } else { + + double fom; + + fom = fabs(lengths[i] - tlen); + + cand[i][ncand[i]].vec.u = tx; + cand[i][ncand[i]].vec.v = ty; + cand[i][ncand[i]].vec.w = tz; + cand[i][ncand[i]].na = n1; + cand[i][ncand[i]].nb = n2; + cand[i][ncand[i]].nc = n3; + cand[i][ncand[i]].fom = fom; + ncand[i]++; + } + } } |