Index: src/Parser/TremoloParser.cpp
===================================================================
--- src/Parser/TremoloParser.cpp	(revision 27cfdeacce55974976b6b373d8be5469cb571627)
+++ src/Parser/TremoloParser.cpp	(revision 5b0581944c6a32b73762473862229922ce1b40eb)
@@ -187,4 +187,51 @@
 }
 
+struct usedFieldsWeakComparator
+{
+  /** Special comparator regards "neighbors=4" and "neighbors=2" as equal
+   *
+   * \note This one is used for making usedFields unique, i.e. throwing out the "smaller"
+   * neighbors.
+   */
+  bool operator()(const std::string &a, const std::string &b) const
+  {
+    // only compare up to first equality sign
+    return (a.substr(0, a.find_first_of('=')) == b.substr(0, b.find_first_of('=')));
+  }
+};
+
+struct usedFieldsSpecialOrderer
+{
+  /** Special string comparator that regards "neighbors=4" < "neighbors=2" as true and
+   * the other way round as false.
+   *
+   * Here, we implement the operator "\a < \b" in a special way to allow the
+   * above.
+   *
+   * \note This one is used for sorting usedFields in preparation for making it unique.
+   */
+  bool operator()(const std::string &a, const std::string &b) const
+  {
+    // only compare up to first equality sign
+    size_t a_equality = a.find_first_of('=');
+    size_t b_equality = b.find_first_of('=');
+    // if key before equality is not equal, return whether it is smaller or not
+    if (a.substr(0, a_equality) != b.substr(0, b_equality)) {
+      return a.substr(0, a_equality) < b.substr(0, b_equality);
+    } else { // now we know that the key before equality is the same in either string
+      // if one of them has no equality, the one with equality must go before
+      if ((a_equality != std::string::npos) && (b_equality == std::string::npos))
+        return true;
+      if ((a_equality == std::string::npos) && (b_equality != std::string::npos))
+        return false;
+      // if both don't have equality (and the token before is equal), it is not "<" but "=="
+      if ((a_equality == std::string::npos) && (b_equality == std::string::npos))
+        return false;
+      // if now both have equality sign, the larger value after it, must come first
+      return a.substr(a_equality, std::string::npos) > b.substr(b_equality, std::string::npos);
+    }
+  }
+};
+
 /** Helper function to make \given fields unique while preserving the order of first appearance.
  *
@@ -200,7 +247,9 @@
   // std::unique only removes if predecessor is equal, not over whole range, hence do it manually
   usedFields_t temp_fields(fields);
-  std::sort(temp_fields.begin(), temp_fields.end());
+  usedFieldsSpecialOrderer SpecialOrderer;
+  usedFieldsWeakComparator WeakComparator;
+  std::sort(temp_fields.begin(), temp_fields.end(), SpecialOrderer);
   usedFields_t::iterator it =
-      std::unique(temp_fields.begin(), temp_fields.end()); // skips all duplicates in the vector
+      std::unique(temp_fields.begin(), temp_fields.end(), WeakComparator);
   temp_fields.erase(it, temp_fields.end());
   usedFields_t usedfields(fields);
Index: tests/regression/Makefile.am
===================================================================
--- tests/regression/Makefile.am	(revision 27cfdeacce55974976b6b373d8be5469cb571627)
+++ tests/regression/Makefile.am	(revision 5b0581944c6a32b73762473862229922ce1b40eb)
@@ -135,4 +135,5 @@
 	$(srcdir)/Parser/Tremolo/testsuite-parser-tremolo-load-multiply.at \
 	$(srcdir)/Parser/Tremolo/testsuite-parser-tremolo-save.at \
+	$(srcdir)/Parser/Tremolo/testsuite-parser-tremolo-save-unique_usedfields.at \
 	$(srcdir)/Parser/Tremolo-Exttypes/testsuite-parser-tremolo-save-selected-atoms-as-exttypes.at \
 	$(srcdir)/Parser/Tremolo-Potentials/testsuite-parser-tremolo-potentials.at \
Index: tests/regression/Parser/Tremolo/post/output.data
===================================================================
--- tests/regression/Parser/Tremolo/post/output.data	(revision 5b0581944c6a32b73762473862229922ce1b40eb)
+++ tests/regression/Parser/Tremolo/post/output.data	(revision 5b0581944c6a32b73762473862229922ce1b40eb)
@@ -0,0 +1,5 @@
+# ATOMDATA	Id	type	x=3	neighbors=4	name	resName	resSeq	charge
+# Box	20	0	0	0	20	0	0	0	20
+1	O	1.583	1.785	1.48	2	3	0	0	OH2	TIP3	1	-0.834	
+2	H	1.186	1.643	2.213	1	0	0	0	H1	TIP3	1	0.417	
+3	H	2.642	1.896	1.73	1	0	0	0	H2	TIP3	1	0.417	
Index: tests/regression/Parser/Tremolo/pre/water-neighbors.data
===================================================================
--- tests/regression/Parser/Tremolo/pre/water-neighbors.data	(revision 5b0581944c6a32b73762473862229922ce1b40eb)
+++ tests/regression/Parser/Tremolo/pre/water-neighbors.data	(revision 5b0581944c6a32b73762473862229922ce1b40eb)
@@ -0,0 +1,4 @@
+# ATOMDATA Id name resName resSeq x=3 charge type neighbors=2
+  1  OH2 TIP3  1   1.583   1.785   1.480 -0.8340  O    2   3
+  2  H1  TIP3  1   1.186   1.643   2.213  0.4170  H    1   0
+  3  H2  TIP3  1   2.642   1.896   1.730  0.4170  H    1   0
Index: tests/regression/Parser/Tremolo/testsuite-parser-tremolo-save-unique_usedfields.at
===================================================================
--- tests/regression/Parser/Tremolo/testsuite-parser-tremolo-save-unique_usedfields.at	(revision 5b0581944c6a32b73762473862229922ce1b40eb)
+++ tests/regression/Parser/Tremolo/testsuite-parser-tremolo-save-unique_usedfields.at	(revision 5b0581944c6a32b73762473862229922ce1b40eb)
@@ -0,0 +1,10 @@
+### parsing tremolo
+
+
+AT_SETUP([Parser - saving tremolo file contains unique usedFields])
+AT_KEYWORDS([parser output tremolo])
+
+AT_CHECK([../../molecuilder -i output.data -o tremolo --set-tremolo-atomdata "Id type x=3 neighbors=4" -l ${abs_top_srcdir}/tests/regression/Parser/Tremolo/pre/water-neighbors.data], 0, [ignore], [ignore])
+AT_CHECK([diff -w -I '#.*' output.data ${abs_top_srcdir}/tests/regression/Parser/Tremolo/post/output.data], 0, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/regression/Parser/testsuite-parser.at
===================================================================
--- tests/regression/Parser/testsuite-parser.at	(revision 27cfdeacce55974976b6b373d8be5469cb571627)
+++ tests/regression/Parser/testsuite-parser.at	(revision 5b0581944c6a32b73762473862229922ce1b40eb)
@@ -50,4 +50,5 @@
 m4_include([Parser/Tremolo/testsuite-parser-tremolo-load-multiply.at])
 m4_include([Parser/Tremolo/testsuite-parser-tremolo-save.at])
+m4_include([Parser/Tremolo/testsuite-parser-tremolo-save-unique_usedfields.at])
 
 # parsing tremolo with .potentials
