aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcppxfel <helenginn@Helen'sMacBookPro>2017-07-01 13:44:53 +0100
committercppxfel <helenginn@Helen'sMacBookPro>2017-07-01 13:44:53 +0100
commit4f6fdb75716cc884ce0db7ce9970574e23af3bc8 (patch)
tree91de420d92772966cfa2cc3e0a5c203d906d0ee0
parent938f1672ad2ae66af6b5732f87b52351bb048391 (diff)
Adding a cutoff for maximum allowed vectors (100,000) to stop Tom's computer (and others) falling apart again.
-rw-r--r--libcrystfel/src/taketwo.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libcrystfel/src/taketwo.c b/libcrystfel/src/taketwo.c
index 2984959f..4cd90cd4 100644
--- a/libcrystfel/src/taketwo.c
+++ b/libcrystfel/src/taketwo.c
@@ -110,6 +110,10 @@ struct TakeTwoCell
/* Maximum dead ends for a single branch extension during indexing */
#define MAX_DEAD_ENDS (10)
+/* Maximum observed vectors before TakeTwo gives up and deals with
+ * what is already there. */
+#define MAX_OBS_VECTORS 100000
+
/* Tolerance for two angles to be considered the same */
#define ANGLE_TOLERANCE (deg2rad(0.6))
@@ -1291,7 +1295,7 @@ static int gen_observed_vecs(struct rvec *rlps, int rlp_count,
/* maximum distance squared for comparisons */
double max_sq_length = pow(MAX_RECIP_DISTANCE, 2);
- for ( i=0; i<rlp_count-1; i++ ) {
+ for ( i=0; i<rlp_count-1 && count < MAX_OBS_VECTORS; i++ ) {
for ( j=i+1; j<rlp_count; j++ ) {