diff options
author | Thomas White <taw@physics.org> | 2014-03-06 17:55:51 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-03-06 17:55:51 +0100 |
commit | fc647d846dc8fbec9ef13c41382be260ff5e8e9a (patch) | |
tree | c5d813ce938b167c3eb7badef8890ab6db2f5a75 | |
parent | b361d7c9bd36a831c712aac55e60f733aa15f7b3 (diff) |
Add --stop-after
-rw-r--r-- | src/ambigator.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ambigator.c b/src/ambigator.c index 8d7cd4f2..fe295cf7 100644 --- a/src/ambigator.c +++ b/src/ambigator.c @@ -68,6 +68,7 @@ static void show_help(const char *s) " --end-assignments=<fn> Save end assignments to file <fn>.\n" " --fg-graph=<fn> Save f and g correlation values to file <fn>.\n" " --ncorr=<n> Use <n> correlations per crystal. Default 1000\n" +" --stop-after=<n> Use at most the first <n> crystals.\n" ); } @@ -482,6 +483,7 @@ int main(int argc, char *argv[]) FILE *fgfh = NULL; struct cc_list *ccs; int ncorr = 1000; + int stop_after = 0; /* Long options */ const struct option longopts[] = { @@ -495,6 +497,7 @@ int main(int argc, char *argv[]) {"end-assignments", 1, NULL, 4}, {"fg-graph", 1, NULL, 5}, {"ncorr", 1, NULL, 6}, + {"stop-after", 1, NULL, 7}, {0, 0, NULL, 0} }; @@ -557,6 +560,13 @@ int main(int argc, char *argv[]) } break; + case 7 : + if ( sscanf(optarg, "%i", &stop_after) != 1 ) { + ERROR("Invalid value for --stop-after\n"); + return 1; + } + break; + case 0 : break; @@ -659,14 +669,17 @@ int main(int argc, char *argv[]) amb); cell_free(cell); n_crystals++; - reflist_free(list); + if ( stop_after && (n_crystals == stop_after) ) break; + } fprintf(stderr, "Loaded %i crystals from %i chunks\r", n_crystals, ++n_chunks); + if ( stop_after && (n_crystals == stop_after) ) break; + } while ( 1 ); fprintf(stderr, "\n"); |