aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/indexers/xgandalf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/indexers/xgandalf.c')
-rw-r--r--libcrystfel/src/indexers/xgandalf.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/libcrystfel/src/indexers/xgandalf.c b/libcrystfel/src/indexers/xgandalf.c
index 2d2dca48..3a44bf04 100644
--- a/libcrystfel/src/indexers/xgandalf.c
+++ b/libcrystfel/src/indexers/xgandalf.c
@@ -382,23 +382,37 @@ static void xgandalf_show_help()
}
+int xgandalf_default_options(XGandalfOptions **opts_ptr)
+{
+ XGandalfOptions *opts;
+
+ opts = malloc(sizeof(struct xgandalf_options));
+ if ( opts == NULL ) return ENOMEM;
+
+ opts->sampling_pitch = 6;
+ opts->grad_desc_iterations = 4;
+ opts->tolerance = 0.02;
+ opts->no_deviation_from_provided_cell = 0;
+ opts->minLatticeVectorLength_A = 30;
+ opts->maxLatticeVectorLength_A = 250;
+ opts->maxPeaksForIndexing = 250;
+
+ *opts_ptr = opts;
+ return 0;
+}
+
+
static error_t xgandalf_parse_arg(int key, char *arg,
struct argp_state *state)
{
struct xgandalf_options **opts_ptr = state->input;
+ int r;
switch ( key ) {
case ARGP_KEY_INIT :
- *opts_ptr = malloc(sizeof(struct xgandalf_options));
- if ( *opts_ptr == NULL ) return ENOMEM;
- (*opts_ptr)->sampling_pitch = 6;
- (*opts_ptr)->grad_desc_iterations = 4;
- (*opts_ptr)->tolerance = 0.02;
- (*opts_ptr)->no_deviation_from_provided_cell = 0;
- (*opts_ptr)->minLatticeVectorLength_A = 30;
- (*opts_ptr)->maxLatticeVectorLength_A = 250;
- (*opts_ptr)->maxPeaksForIndexing = 250;
+ r = xgandalf_default_options(opts_ptr);
+ if ( r ) return r;
break;
case 1 :