aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-03-05 16:29:41 +0100
committerThomas White <taw@physics.org>2014-03-05 16:30:21 +0100
commit533c8aad7b256cceeb1ae9cae346ce00827cc3b1 (patch)
tree5ecbe67f2f66be662e12aa21f3687e82b7e58e2e
parentfba54b335b3c9dcdbf31d7ae92b6ed307b2efd21 (diff)
Add --end-assignments
-rw-r--r--src/ambigator.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ambigator.c b/src/ambigator.c
index bd85ea8e..7aa9a2ae 100644
--- a/src/ambigator.c
+++ b/src/ambigator.c
@@ -363,6 +363,7 @@ int main(int argc, char *argv[])
int c;
const char *infile;
char *outfile = NULL;
+ char *end_ass_fn = NULL;
char *s_sym_str = NULL;
SymOpList *s_sym;
char *w_sym_str = NULL;
@@ -390,6 +391,7 @@ int main(int argc, char *argv[])
{"highres", 1, NULL, 2},
{"lowres", 1, NULL, 3},
+ {"end-assignments", 1, NULL, 4},
{0, 0, NULL, 0}
};
@@ -437,6 +439,10 @@ int main(int argc, char *argv[])
rmin = 1.0 / (lowres/1e10);
break;
+ case 4 :
+ end_ass_fn = strdup(optarg);
+ break;
+
case 0 :
break;
@@ -574,6 +580,18 @@ int main(int argc, char *argv[])
detwin(crystals, n_crystals, assignments, amb);
}
+ if ( end_ass_fn != NULL ) {
+ FILE *fh = fopen(end_ass_fn, "w");
+ if ( fh == NULL ) {
+ ERROR("Failed to open '%s'\n", end_ass_fn);
+ } else {
+ for ( i=0; i<n_crystals; i++ ) {
+ fprintf(fh, "%i\n", assignments[i]);
+ }
+ }
+ fclose(fh);
+ }
+
n_dif = 0;
for ( i=0; i<n_crystals; i++ ) {
if ( orig_assignments[i] != assignments[i] ) n_dif++;