diff --git a/src/parser.c b/src/parser.c
index 581f3a0cffd531b5c879e80dc6c256e6761666ee..1f77eae7ca67a7e60c9fd9f98f692a877bdaa033 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -152,6 +152,7 @@ void parser_set_param(struct swift_params *params, const char *namevalue) {
   if (!updated) {
     strcpy(params->data[params->paramCount].name, name);
     strcpy(params->data[params->paramCount].value, value);
+    params->data[params->paramCount].used = 0;
     params->paramCount++;
     if (params->paramCount == PARSER_MAX_NO_OF_PARAMS)
       error("Too many parameters, current maximum is %d.", params->paramCount);
@@ -368,6 +369,7 @@ static void parse_value(char *line, struct swift_params *params) {
        * section. */
       strcpy(params->data[params->paramCount].name, tmpStr);
       strcpy(params->data[params->paramCount].value, token);
+      params->data[params->paramCount].used = 0;
       if (params->paramCount == PARSER_MAX_NO_OF_PARAMS - 1) {
         error(
             "Maximal number of parameters in parameter file reached. Aborting "
@@ -427,6 +429,7 @@ static void parse_section_param(char *line, int *isFirstParam,
 
   strcpy(params->data[params->paramCount].name, paramName);
   strcpy(params->data[params->paramCount].value, token);
+  params->data[params->paramCount].used = 0;
   if (params->paramCount == PARSER_MAX_NO_OF_PARAMS - 1) {
     error("Maximal number of parameters in parameter file reached. Aborting !");
   } else {
@@ -445,6 +448,7 @@ int parser_get_param_int(const struct swift_params *params, const char *name) {
 
   char str[PARSER_MAX_LINE_SIZE];
   int retParam = 0;
+  struct swift_params *tmp = (struct swift_params*) params;
 
   for (int i = 0; i < params->paramCount; i++) {
     if (!strcmp(name, params->data[i].name)) {
@@ -456,6 +460,9 @@ int parser_get_param_int(const struct swift_params *params, const char *name) {
             params->data[i].name, params->data[i].value, str);
       }
 
+      /* this parameter has been used */
+      tmp->data[i].used = 1;
+
       return retParam;
     }
   }
@@ -477,6 +484,7 @@ char parser_get_param_char(const struct swift_params *params,
 
   char str[PARSER_MAX_LINE_SIZE];
   char retParam = 0;
+  struct swift_params *tmp = (struct swift_params*) params;
 
   for (int i = 0; i < params->paramCount; i++) {
     if (!strcmp(name, params->data[i].name)) {
@@ -488,6 +496,9 @@ char parser_get_param_char(const struct swift_params *params,
             params->data[i].name, params->data[i].value, str);
       }
 
+      /* this parameter has been used */
+      tmp->data[i].used = 1;
+
       return retParam;
     }
   }
@@ -509,6 +520,7 @@ float parser_get_param_float(const struct swift_params *params,
 
   char str[PARSER_MAX_LINE_SIZE];
   float retParam = 0.f;
+  struct swift_params *tmp = (struct swift_params*) params;
 
   for (int i = 0; i < params->paramCount; i++) {
     if (!strcmp(name, params->data[i].name)) {
@@ -520,6 +532,9 @@ float parser_get_param_float(const struct swift_params *params,
             params->data[i].name, params->data[i].value, str);
       }
 
+      /* this parameter has been used */
+      tmp->data[i].used = 1;
+
       return retParam;
     }
   }
@@ -541,6 +556,7 @@ double parser_get_param_double(const struct swift_params *params,
 
   char str[PARSER_MAX_LINE_SIZE];
   double retParam = 0.;
+  struct swift_params *tmp = (struct swift_params*) params;
 
   for (int i = 0; i < params->paramCount; i++) {
     if (!strcmp(name, params->data[i].name)) {
@@ -551,6 +567,10 @@ double parser_get_param_double(const struct swift_params *params,
             "characters '%s'.",
             params->data[i].name, params->data[i].value, str);
       }
+
+      /* this parameter has been used */
+      tmp->data[i].used = 1;
+
       return retParam;
     }
   }
@@ -569,9 +589,12 @@ double parser_get_param_double(const struct swift_params *params,
  */
 void parser_get_param_string(const struct swift_params *params,
                              const char *name, char *retParam) {
+  struct swift_params *tmp = (struct swift_params*) params;
   for (int i = 0; i < params->paramCount; i++) {
     if (!strcmp(name, params->data[i].name)) {
       strcpy(retParam, params->data[i].value);
+      /* this parameter has been used */
+      tmp->data[i].used = 1;
       return;
     }
   }
@@ -592,6 +615,7 @@ int parser_get_opt_param_int(const struct swift_params *params,
 
   char str[PARSER_MAX_LINE_SIZE];
   int retParam = 0;
+  struct swift_params *tmp = (struct swift_params*) params;
 
   for (int i = 0; i < params->paramCount; i++) {
     if (!strcmp(name, params->data[i].name)) {
@@ -603,6 +627,9 @@ int parser_get_opt_param_int(const struct swift_params *params,
             params->data[i].name, params->data[i].value, str);
       }
 
+      /* this parameter has been used */
+      tmp->data[i].used = 1;
+      
       return retParam;
     }
   }
@@ -623,6 +650,7 @@ char parser_get_opt_param_char(const struct swift_params *params,
 
   char str[PARSER_MAX_LINE_SIZE];
   char retParam = 0;
+  struct swift_params *tmp = (struct swift_params*) params;
 
   for (int i = 0; i < params->paramCount; i++) {
     if (!strcmp(name, params->data[i].name)) {
@@ -634,6 +662,9 @@ char parser_get_opt_param_char(const struct swift_params *params,
             params->data[i].name, params->data[i].value, str);
       }
 
+      /* this parameter has been used */
+      tmp->data[i].used = 1;
+
       return retParam;
     }
   }
@@ -654,6 +685,7 @@ float parser_get_opt_param_float(const struct swift_params *params,
 
   char str[PARSER_MAX_LINE_SIZE];
   float retParam = 0.f;
+  struct swift_params *tmp = (struct swift_params*) params;
 
   for (int i = 0; i < params->paramCount; i++) {
     if (!strcmp(name, params->data[i].name)) {
@@ -665,6 +697,9 @@ float parser_get_opt_param_float(const struct swift_params *params,
             params->data[i].name, params->data[i].value, str);
       }
 
+      /* this parameter has been used */
+      tmp->data[i].used = 1;
+
       return retParam;
     }
   }
@@ -685,6 +720,7 @@ double parser_get_opt_param_double(const struct swift_params *params,
 
   char str[PARSER_MAX_LINE_SIZE];
   double retParam = 0.;
+  struct swift_params *tmp = (struct swift_params*) params;
 
   for (int i = 0; i < params->paramCount; i++) {
     if (!strcmp(name, params->data[i].name)) {
@@ -695,6 +731,10 @@ double parser_get_opt_param_double(const struct swift_params *params,
             "characters '%s'.",
             params->data[i].name, params->data[i].value, str);
       }
+
+      /* this parameter has been used */
+      tmp->data[i].used = 1;
+
       return retParam;
     }
   }
@@ -713,9 +753,14 @@ double parser_get_opt_param_double(const struct swift_params *params,
 void parser_get_opt_param_string(const struct swift_params *params,
                                  const char *name, char *retParam,
                                  const char *def) {
+  struct swift_params *tmp = (struct swift_params*) params;
   for (int i = 0; i < params->paramCount; i++) {
     if (!strcmp(name, params->data[i].name)) {
       strcpy(retParam, params->data[i].value);
+
+      /* this parameter has been used */
+      tmp->data[i].used = 1;
+
       return;
     }
   }
@@ -736,6 +781,7 @@ void parser_print_params(const struct swift_params *params) {
   for (int i = 0; i < params->paramCount; i++) {
     printf("Parameter name: %s\n", params->data[i].name);
     printf("Parameter value: %s\n", params->data[i].value);
+    printf("Parameter used: %i\n", params->data[i].used);
   }
 }
 
@@ -757,6 +803,14 @@ void parser_write_params_to_file(const struct swift_params *params,
   fprintf(file, "%s\n", PARSER_START_OF_FILE);
 
   for (int i = 0; i < params->paramCount; i++) {
+    if (!params->data[i].used) {
+#ifdef SWIFT_DEBUG_CHECKS
+      message("Parameter `%s` was not used. "
+	      "Only the parameter used are written.",
+	      params->data[i].name);
+#endif
+      continue;
+    }
     /* Check that the parameter name contains a section name. */
     if (strchr(params->data[i].name, PARSER_VALUE_CHAR)) {
       /* Copy the parameter name into a temporary string and find the section
@@ -790,8 +844,11 @@ void parser_write_params_to_file(const struct swift_params *params,
 #if defined(HAVE_HDF5)
 void parser_write_params_to_hdf5(const struct swift_params *params, hid_t grp) {
 
-  for (int i = 0; i < params->paramCount; i++)
+  for (int i = 0; i < params->paramCount; i++) {
+    if (!params->data[i].used)
+      continue;
     io_write_attribute_s(grp, params->data[i].name, params->data[i].value);
+  }
 }
 #endif
 
diff --git a/src/parser.h b/src/parser.h
index dc4520b9860798ac1d902a1f100346f22ec3b0e3..25d815af3e07274285c0c9439cd49572ec82b501 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -39,6 +39,7 @@
 struct parameter {
   char name[PARSER_MAX_LINE_SIZE];
   char value[PARSER_MAX_LINE_SIZE];
+  int used;
 };
 
 struct section {