Index: Makefile.am
===================================================================
--- Makefile.am	(revision f7054cab5c6c0b7c73d7b4866501383e989b50da)
+++ Makefile.am	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -1,4 +1,4 @@
 ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = LinearAlgebra data/icons src src/unittests src/Tesselation/TriangleMatcher tests utils doc
+SUBDIRS = LinearAlgebra data/icons src src/unittests src/Tesselation/TriangleMatcher src/Bond/AdjacencyMatcher tests utils doc
 
 AUTOMAKE_OPTIONS = subdir-objects
Index: configure.ac
===================================================================
--- configure.ac	(revision f7054cab5c6c0b7c73d7b4866501383e989b50da)
+++ configure.ac	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -436,4 +436,5 @@
 AC_CONFIG_FILES([tests/GuiChecks/molecuilder], [chmod +x tests/GuiChecks/molecuilder])
 AC_CONFIG_FILES([tests/GuiChecks/molecuilderguitest], [chmod +x tests/GuiChecks/molecuilderguitest])
+AC_CONFIG_FILES([tests/GuiChecks/adjacencymatcher], [chmod +x tests/GuiChecks/adjacencymatcher])
 AC_CONFIG_FILES([tests/GuiChecks/trianglematcher], [chmod +x tests/GuiChecks/trianglematcher])
 
@@ -449,4 +450,5 @@
 	tests/regression/Makefile])
 AC_CONFIG_FILES([tests/regression/molecuilder], [chmod +x tests/regression/molecuilder])
+AC_CONFIG_FILES([tests/regression/adjacencymatcher], [chmod +x tests/regression/adjacencymatcher])
 AC_CONFIG_FILES([tests/regression/trianglematcher], [chmod +x tests/regression/trianglematcher])
 AC_CONFIG_FILES([tests/regression/runpython], [chmod +x tests/regression/runpython])
@@ -472,4 +474,5 @@
 	Makefile 
 	src/Makefile
+	src/Bond/AdjacencyMatcher/Makefile
 	src/Tesselation/TriangleMatcher/Makefile
 	data/icons/Makefile
Index: src/Bond/AdjacencyMatcher/Adjacency.hpp
===================================================================
--- src/Bond/AdjacencyMatcher/Adjacency.hpp	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
+++ src/Bond/AdjacencyMatcher/Adjacency.hpp	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -0,0 +1,143 @@
+/*
+ * Adjacency.hpp
+ *
+ *  Created on: Jun 15, 2015
+ *      Author: heber
+ */
+
+#ifndef ADJACENCY_HPP_
+#define ADJACENCY_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cassert>
+#include <iosfwd>
+#include <utility>
+#include <vector>
+
+namespace detail {
+
+struct Adjacency
+{
+	//!> typedef for the adjacency index type
+	typedef size_t index_t;
+
+	//!> typedef for the structure to store adjacency indices
+	typedef std::vector<index_t> indices_t;
+
+	//!> constant for invalid index
+	enum { INVALIDINDEX=-1 };
+
+	/** Constructor for struct adjacency.
+	 *
+	 */
+	Adjacency()
+	{}
+
+	/** Constructor for struct adjacency.
+	 *
+	 * \param _indices initial indices to set
+	 */
+	Adjacency(const indices_t &_indices) :
+		indices(_indices)
+	{
+		if (!isSorted())
+			sortIndices();
+	}
+
+	/** Setter for the indices of the adjacency.
+	 *
+	 * \param _elements indices to be set (need not be sorted)
+	 */
+	void set(const indices_t &_elements) {
+		indices = _elements;
+		if (!isSorted())
+			sortIndices();
+	}
+
+	/** Getter for the indices.
+	 *
+	 * \return set of sorted indices
+	 */
+	const indices_t &get() const {
+		return indices;
+	}
+
+	/** Less comparator for adjacency, comparing indices.
+	 *
+	 * \return true - at least one index in this adjacency is smaller
+	 */
+	bool operator<(const Adjacency &_other) const {
+		return indices < _other.indices;
+	}
+
+	/** Comparator for equivalence of adjacency.
+	 *
+	 * \return true - both index triples are the same
+	 */
+	bool operator==(const Adjacency &_other) const {
+		return indices == _other.indices;
+	}
+
+	/** Comparator for non-equivalence of adjacency.
+	 *
+	 * \return true - both index triples are not the same
+	 */
+	bool operator!=(const Adjacency &_other) const {
+		return !(*this == _other);
+	}
+
+private:
+	/** Sort the indices.
+	 *
+	 */
+	void sortIndices() {
+		std::sort(indices.begin(), indices.end());
+//		if (indices[0] > indices[1]) {
+//			if (indices[0] > indices[2])
+//				std::swap(indices[0], indices[2]);
+//			if (indices[0] > indices[1])
+//				std::swap(indices[0], indices[1]);
+//		} else {
+//			// last element in between or up front?
+//			if (indices[0] > indices[2]) {
+//				std::swap(indices[1], indices[2]);
+//				std::swap(indices[0], indices[1]);
+//			} else
+//				std::swap(indices[1], indices[2]);
+//		}
+		assert( isSorted() );
+	}
+
+private:
+	/** Check whether indices are sorted.
+	 *
+	 * \return true - indices are sorted ascendingly
+	 */
+	bool isSorted() const
+	{
+	  bool status = true;
+	  indices_t::const_iterator advancer = indices.begin();
+	  indices_t::const_iterator iter = advancer++;
+	  for (; advancer != indices.end(); iter = advancer++)
+	    status &= *iter <= *advancer;
+	  return status;
+	}
+
+private:
+	//!> fixed size array for containing indices
+	indices_t indices;
+};
+
+}; /* namespace detail */
+
+std::ostream& operator<<(std::ostream &_ost, const detail::Adjacency &_t) {
+	const detail::Adjacency::indices_t &indices = _t.get();
+	_ost << "[" << indices[0] << ","  << indices[1] << "," << indices[2] << "]";
+	return _ost;
+}
+
+#endif /* ADJACENCY_HPP_ */
Index: src/Bond/AdjacencyMatcher/AdjacencyMatcher.cpp
===================================================================
--- src/Bond/AdjacencyMatcher/AdjacencyMatcher.cpp	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
+++ src/Bond/AdjacencyMatcher/AdjacencyMatcher.cpp	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -0,0 +1,193 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2015 Frederik Heber. All rights reserved.
+ *
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * AdjacencyMatcher.cpp
+ *
+ *  Created on: Jul 19, 2015
+ *      Author: heber
+ *
+ *
+ *  This is mostly copy&pasted from AdjacencyMatcher.cpp
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <boost/exception/all.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+#include <boost/tokenizer.hpp>
+
+#include <algorithm>
+#include <fstream>
+#include <iostream>
+#include <iterator>
+#include <map>
+#include <set>
+#include <sstream>
+#include <string>
+
+#include "Adjacency.hpp"
+
+#include "CodePatterns/toString.hpp"
+
+typedef std::set<detail::Adjacency> adjacencies_t;
+
+using namespace detail;
+
+namespace bf = boost::filesystem;
+
+typedef boost::error_info<
+		struct tag_IllegalTesselationFileContent_LineNumber,
+		int> IllegalTesselationFileContent_LineNumber;
+
+typedef boost::error_info<
+		struct tag_IllegalTesselationFileContent_Entries,
+		int> IllegalTesselationFileContent_Entries;
+
+typedef boost::error_info<
+		struct tag_IllegalTesselationFileContent_Line,
+		int> IllegalTesselationFileContent_Line;
+
+//!> Exception for illegal lines encountered in adjacencies files
+struct IllegalTesselationFileContentException:
+		virtual boost::exception, virtual std::exception { };
+
+Adjacency::index_t toIndex(const std::string &_element)
+{
+	Adjacency::index_t index;
+	std::stringstream tokenstring(_element);
+	tokenstring >> index;
+	return index;
+}
+
+template <class T>
+std::ostream& operator<<(
+		std::ostream &_ost,
+		const std::set<T> &elements)
+{
+	for( const T elem : elements)
+		_ost << elem << std::endl;
+	return _ost;
+}
+
+/** Parses a adjacencies file into a vector of Adjacencys.
+ *
+ * \param _filename name of file to parse
+ * \return adjacencies_t structure filled with adjacency index triples
+ */
+const adjacencies_t parseFile(const boost::filesystem::path &_filename)
+{
+	adjacencies_t adjacencies;
+
+	std::ifstream infile(_filename.string().c_str());
+	boost::char_separator<char> sep(" \t");
+
+	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+	std::string line;
+	while (!infile.eof()) {
+		std::getline(infile, line);
+		tokenizer tokens(line, sep);
+		Adjacency::indices_t indices;
+		const int entries = std::distance( tokens.begin(), tokens.end() );
+		// check for empty lines
+		if (entries == 0)
+			continue;
+		std::transform(
+				tokens.begin(),
+				tokens.end(),
+				std::back_inserter(indices),
+				toIndex);
+		adjacencies.insert(Adjacency(indices));
+	}
+	infile.close();
+
+	return adjacencies;
+}
+
+int main(int argc, char **argv) {
+
+	/// check arguments and give usage
+	if (argc <= 2) {
+		std::cerr << "Usage: " << argv[0] << " <list of files>\n";
+		std::cerr << "At least two adjacencies files need to be specified that contain\n";
+		std::cerr << "each three indices per line.\n";
+
+		return 255;
+	}
+
+	/// read in files and parse into structures
+	typedef std::multimap<adjacencies_t, std::string> adjacencies_filename_t;
+	//!> contains all adjacencies parsed from files
+	adjacencies_filename_t adjacencyfiles;
+	for (int i=1; i<argc;++i) {
+		const bf::path filename(argv[i]);
+		if (bf::exists(filename)) {
+			try {
+				adjacencies_t adjacencies = parseFile(filename);
+				adjacencyfiles.insert(
+						std::make_pair(adjacencies, filename.string()) );
+			} catch (IllegalTesselationFileContentException &e) {
+				std::cerr << "Illegal line at "
+						<< *boost::get_error_info<IllegalTesselationFileContent_LineNumber>(e)
+						<< " encountered with "
+						<< *boost::get_error_info<IllegalTesselationFileContent_Entries>(e)
+						<< " entries in "
+						<< filename.string()
+						<< ", aborting.\n";
+				return 5;
+			}
+		} else {
+			std::cerr << "The following file does not exist "
+					<< filename.string() << ", aborting.\n";
+			return 5;
+		}
+	}
+
+	/// make comparison for equivalence
+	assert( adjacencyfiles.size() >= 2 );
+	adjacencies_filename_t::const_iterator advancer = adjacencyfiles.begin();
+	adjacencies_filename_t::const_iterator iter = advancer++;
+
+	bool AllEqual = true;
+	while( advancer != adjacencyfiles.end() ) {
+//	  std::cout << "Comparing " << *advancer << " with " << *iter << std::endl;
+		if (advancer->first == iter->first) {
+			std::cout << "MATCH: "
+					<< advancer->second << " and " << iter->second
+					<< std::endl;
+		} else {
+			std::cout << advancer->first << " and " << iter->first
+					<< " don't match.\n";
+			AllEqual = false;
+		}
+		iter = advancer++;
+	}
+
+	// exit (convert bool to int)
+	return (AllEqual ? 0 : 1);
+}
Index: src/Bond/AdjacencyMatcher/Makefile.am
===================================================================
--- src/Bond/AdjacencyMatcher/Makefile.am	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
+++ src/Bond/AdjacencyMatcher/Makefile.am	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -0,0 +1,33 @@
+# PLEASE adhere to the alphabetical ordering in this Makefile!
+# Also indentation by a single tab
+
+MOSTLYCLEANFILES =
+lib_LTLIBRARIES =
+noinst_LTLIBRARIES =
+pyexec_LTLIBRARIES =
+BUILT_SOURCES =
+bin_PROGRAMS =
+EXTRA_DIST =
+
+AM_LDFLAGS = -ldl ${BOOST_LDFLAGS} ${CodePatterns_LDFLAGS}
+AM_CPPFLAGS = \
+	${BOOST_CPPFLAGS} \
+	${CodePatterns_CFLAGS}
+
+bin_PROGRAMS += \
+	adjacencymatcher
+
+adjacencymatcher_SOURCES = \
+	Adjacency.hpp \
+	types.hpp \
+	AdjacencyMatcher.cpp
+adjacencymatcher_CPPFLAGS = \
+	$(AM_CPPFLAGS) \
+	-std=c++0x
+adjacencymatcher_LDFLAGS = \
+	$(AM_LDFLAGS) \
+	$(BOOST_FILESYSTEM_LDFLAGS) \
+	$(BOOST_SYSTEM_LDFLAGS)
+adjacencymatcher_LDADD = \
+	$(BOOST_FILESYSTEM_LIBS) \
+	$(BOOST_SYSTEM_LIBS)	
Index: src/Tesselation/TriangleMatcher/TriangleMatcher.cpp
===================================================================
--- src/Tesselation/TriangleMatcher/TriangleMatcher.cpp	(revision f7054cab5c6c0b7c73d7b4866501383e989b50da)
+++ src/Tesselation/TriangleMatcher/TriangleMatcher.cpp	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -24,5 +24,5 @@
  * TriangleMatcher.cpp
  *
- *  Created on: Jun 15, 2016
+ *  Created on: Jun 15, 2015
  *      Author: heber
  *
Index: tests/GuiChecks/Bond/AdjacencyMatcher/testsuite-bond-adjacencymatcher.at
===================================================================
--- tests/GuiChecks/Bond/AdjacencyMatcher/testsuite-bond-adjacencymatcher.at	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
+++ tests/GuiChecks/Bond/AdjacencyMatcher/testsuite-bond-adjacencymatcher.at	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -0,0 +1,34 @@
+#
+#    MoleCuilder - creates and alters molecular systems
+#    Copyright (C) 2015 Frederik Heber
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+### adjacencymatcher helper
+
+AT_SETUP([Bond - AdjacencyMatcher])
+AT_KEYWORDS([Bond adjacencymatcher])
+
+# matches
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test.adj], 0, [ignore], [ignore])
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test2.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test2.adj], 0, [ignore], [ignore])
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test2.adj], 0, [ignore], [ignore])
+
+# no matches
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/notequal.adj], 1, [ignore], [ignore])
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/notequal2.adj], 1, [ignore], [ignore])
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test2.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/notequal.adj], 1, [ignore], [ignore])
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test2.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/notequal2.adj], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/GuiChecks/Bond/testsuite-bond.at
===================================================================
--- tests/GuiChecks/Bond/testsuite-bond.at	(revision f7054cab5c6c0b7c73d7b4866501383e989b50da)
+++ tests/GuiChecks/Bond/testsuite-bond.at	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -25,2 +25,5 @@
 m4_include([Bond/Remove/testsuite-bond-remove.at])
 m4_include([Bond/Remove/testsuite-bond-remove_multiple.at])
+
+# adjacency matcher
+m4_include([Bond/AdjacencyMatcher/testsuite-bond-adjacencymatcher.at])
Index: tests/GuiChecks/Makefile.am
===================================================================
--- tests/GuiChecks/Makefile.am	(revision f7054cab5c6c0b7c73d7b4866501383e989b50da)
+++ tests/GuiChecks/Makefile.am	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -157,4 +157,5 @@
 	$(srcdir)/./Bond/Remove/testsuite-bond-remove.at \
 	$(srcdir)/./Bond/testsuite-bond.at \
+	$(srcdir)/./Bond/AdjacencyMatcher/testsuite-bond-adjacencymatcher.at \
 	$(srcdir)/./Molecules/SaveBonds/testsuite-molecules-save-bonds.at \
 	$(srcdir)/./Molecules/RotateToPrincipalAxisSystem/testsuite-molecules-rotate-to-principal-axis-system.at \
Index: tests/GuiChecks/Molecules/SaveAdjacency/testsuite-molecules-save-adjacency.at
===================================================================
--- tests/GuiChecks/Molecules/SaveAdjacency/testsuite-molecules-save-adjacency.at	(revision f7054cab5c6c0b7c73d7b4866501383e989b50da)
+++ tests/GuiChecks/Molecules/SaveAdjacency/testsuite-molecules-save-adjacency.at	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -26,5 +26,5 @@
 AT_CHECK([grep -v "Command.*DryRun" session-molecules-save-adjacency.py >session-molecules-save-adjacency_new.py], 0, [ignore], [ignore])
 AT_CHECK([../../molecuilderguitest session-molecules-save-adjacency_new.py], 0, [stdout], [stderr])
-AT_CHECK([file=test.adj; diff $file ${abs_top_srcdir}/tests/regression/Molecules/SaveAdjacency/post/test.adj], 0, [ignore], [ignore])
+AT_CHECK([file=test.adj; ../../adjacencymatcher $file $file ${abs_top_srcdir}/tests/regression/Molecules/SaveAdjacency/post/$file], 0, [ignore], [ignore])
 
 AT_CLEANUP
Index: tests/GuiChecks/Tesselation/TriangleMatcher/testsuite-tesselation-trianglematcher.at
===================================================================
--- tests/GuiChecks/Tesselation/TriangleMatcher/testsuite-tesselation-trianglematcher.at	(revision f7054cab5c6c0b7c73d7b4866501383e989b50da)
+++ tests/GuiChecks/Tesselation/TriangleMatcher/testsuite-tesselation-trianglematcher.at	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -18,5 +18,5 @@
 ### trianglematcher helper
 
-AT_SETUP([Tesselation - TriangleMather])
+AT_SETUP([Tesselation - TriangleMatcher])
 AT_KEYWORDS([Tesselation trianglematcher])
 
Index: tests/GuiChecks/adjacencymatcher.in
===================================================================
--- tests/GuiChecks/adjacencymatcher.in	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
+++ tests/GuiChecks/adjacencymatcher.in	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# wrapper for testing with adjacencymatcher
+
+. ../../atlocal
+
+if test ! -z ${valgrind}
+then
+G_SLICE=always-malloc G_DEBUG=gc-friendly \
+libtool --mode=execute \
+${valgrind} -v \
+--log-file=valgrind.log \
+--xml=yes \
+--xml-file=valgrind.err \
+--time-stamp=yes \
+--error-exitcode=255 \
+--leak-check=full \
+--leak-resolution=high \
+--num-callers=20 \
+--track-origins=yes \
+--show-reachable=yes \
+"${AUTOTEST_PATH}/Bond/AdjacencyMatcher/adjacencymatcher" \
+${1+"$@"}
+else
+"${AUTOTEST_PATH}/Bond/AdjacencyMatcher/adjacencymatcher" \
+${1+"$@"}
+fi
+
+status=$?
+
+exit $status
Index: tests/regression/Bond/AdjacencyMatcher/pre/notequal.adj
===================================================================
--- tests/regression/Bond/AdjacencyMatcher/pre/notequal.adj	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
+++ tests/regression/Bond/AdjacencyMatcher/pre/notequal.adj	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -0,0 +1,9 @@
+1 9
+2 9
+3 9
+4 10
+6 11
+7 11
+9 1 2 3 10
+10 4 5 9
+11 10 6 7 8
Index: tests/regression/Bond/AdjacencyMatcher/pre/notequal2.adj
===================================================================
--- tests/regression/Bond/AdjacencyMatcher/pre/notequal2.adj	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
+++ tests/regression/Bond/AdjacencyMatcher/pre/notequal2.adj	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -0,0 +1,11 @@
+1 9
+2 9
+3 9
+4 10
+5 10
+6 11
+7 11
+8 11
+9 2 3 10
+10 11 4 5 9
+11 10 6 7 8
Index: tests/regression/Bond/AdjacencyMatcher/pre/test.adj
===================================================================
--- tests/regression/Bond/AdjacencyMatcher/pre/test.adj	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
+++ tests/regression/Bond/AdjacencyMatcher/pre/test.adj	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -0,0 +1,11 @@
+1 9
+2 9
+3 9
+4 10
+5 10
+6 11
+7 11
+8 11
+9 1 2 3 10
+10 11 4 5 9
+11 10 6 7 8
Index: tests/regression/Bond/AdjacencyMatcher/pre/test2.adj
===================================================================
--- tests/regression/Bond/AdjacencyMatcher/pre/test2.adj	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
+++ tests/regression/Bond/AdjacencyMatcher/pre/test2.adj	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -0,0 +1,12 @@
+1 9
+2 9
+3 9
+4 10
+5 10
+6 11
+7 11
+8 11
+9 1 2 3 10
+10 4 5 9 11
+11 6 7 8 10
+
Index: tests/regression/Bond/AdjacencyMatcher/testsuite-bond-adjacencymatcher.at
===================================================================
--- tests/regression/Bond/AdjacencyMatcher/testsuite-bond-adjacencymatcher.at	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
+++ tests/regression/Bond/AdjacencyMatcher/testsuite-bond-adjacencymatcher.at	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -0,0 +1,34 @@
+#
+#    MoleCuilder - creates and alters molecular systems
+#    Copyright (C) 2015 Frederik Heber
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+### adjacencymatcher helper
+
+AT_SETUP([Bond - AdjacencyMatcher])
+AT_KEYWORDS([Bond adjacencymatcher])
+
+# matches
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test.adj], 0, [ignore], [ignore])
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test2.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test2.adj], 0, [ignore], [ignore])
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test2.adj], 0, [ignore], [ignore])
+
+# no matches
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/notequal.adj], 1, [ignore], [ignore])
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/notequal2.adj], 1, [ignore], [ignore])
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test2.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/notequal.adj], 1, [ignore], [ignore])
+AT_CHECK([../../adjacencymatcher ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/test2.adj ${abs_top_srcdir}/tests/regression/Bond/AdjacencyMatcher/pre/notequal2.adj], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/regression/Bond/testsuite-bond.at
===================================================================
--- tests/regression/Bond/testsuite-bond.at	(revision f7054cab5c6c0b7c73d7b4866501383e989b50da)
+++ tests/regression/Bond/testsuite-bond.at	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -25,2 +25,5 @@
 m4_include([Bond/Remove/testsuite-bond-remove.at])
 m4_include([Bond/Remove/testsuite-bond-remove_multiple.at])
+
+# adjacency matcher
+m4_include([Bond/AdjacencyMatcher/testsuite-bond-adjacencymatcher.at])
Index: tests/regression/Makefile.am
===================================================================
--- tests/regression/Makefile.am	(revision f7054cab5c6c0b7c73d7b4866501383e989b50da)
+++ tests/regression/Makefile.am	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -50,4 +50,5 @@
 	$(srcdir)/Bond/Remove/testsuite-bond-remove.at \
 	$(srcdir)/Bond/Remove/testsuite-bond-remove_multiple.at \
+	$(srcdir)/Bond/AdjacencyMatcher/testsuite-bond-adjacencymatcher.at \
 	$(srcdir)/Analysis/testsuite-analysis.at \
 	$(srcdir)/Analysis/DipoleAngularCorrelation/testsuite-analysis-dipole-angular-correlation.at \
Index: tests/regression/Molecules/SaveAdjacency/testsuite-molecules-save-adjacency.at
===================================================================
--- tests/regression/Molecules/SaveAdjacency/testsuite-molecules-save-adjacency.at	(revision f7054cab5c6c0b7c73d7b4866501383e989b50da)
+++ tests/regression/Molecules/SaveAdjacency/testsuite-molecules-save-adjacency.at	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -24,5 +24,5 @@
 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Molecules/SaveAdjacency/pre/test.conf $file], 0)
 AT_CHECK([../../molecuilder -i $file  -v 1 --select-all-atoms --create-adjacency --select-molecule-by-id 0 -J test.adj], 0, [stdout], [stderr])
-AT_CHECK([file=test.adj; diff $file ${abs_top_srcdir}/tests/regression/Molecules/SaveAdjacency/post/test.adj], 0, [ignore], [ignore])
+AT_CHECK([file=test.adj; ../../adjacencymatcher $file $file ${abs_top_srcdir}/tests/regression/Molecules/SaveAdjacency/post/$file], 0, [ignore], [ignore])
 
 AT_CLEANUP
Index: tests/regression/Tesselation/TriangleMatcher/testsuite-tesselation-trianglematcher.at
===================================================================
--- tests/regression/Tesselation/TriangleMatcher/testsuite-tesselation-trianglematcher.at	(revision f7054cab5c6c0b7c73d7b4866501383e989b50da)
+++ tests/regression/Tesselation/TriangleMatcher/testsuite-tesselation-trianglematcher.at	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -18,5 +18,5 @@
 ### trianglematcher helper
 
-AT_SETUP([Tesselation - TriangleMather])
+AT_SETUP([Tesselation - TriangleMatcher])
 AT_KEYWORDS([Tesselation trianglematcher])
 
Index: tests/regression/adjacencymatcher.in
===================================================================
--- tests/regression/adjacencymatcher.in	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
+++ tests/regression/adjacencymatcher.in	(revision c66ae6684084ff864820af9b907d9f3b9725530d)
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# wrapper for testing with adjacencymatcher
+
+. ../../atlocal
+
+if test ! -z ${valgrind}
+then
+G_SLICE=always-malloc G_DEBUG=gc-friendly \
+libtool --mode=execute \
+${valgrind} -v \
+--log-file=valgrind.log \
+--xml=yes \
+--xml-file=valgrind.err \
+--time-stamp=yes \
+--error-exitcode=255 \
+--leak-check=full \
+--leak-resolution=high \
+--num-callers=20 \
+--track-origins=yes \
+--show-reachable=yes \
+"${AUTOTEST_PATH}/Bond/AdjacencyMatcher/adjacencymatcher" \
+${1+"$@"}
+else
+"${AUTOTEST_PATH}/Bond/AdjacencyMatcher/adjacencymatcher" \
+${1+"$@"}
+fi
+
+status=$?
+
+exit $status
