Index: .gitignore
===================================================================
--- .gitignore	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ .gitignore	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -13,4 +13,5 @@
 *.in
 build*
+debug*
 aclocal.m4
 autom4te.cache
Index: AUTHORS
===================================================================
--- AUTHORS	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ AUTHORS	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,1 +1,5 @@
-Frederik Heber	(heber@ins.uni-bonn.de)
+Tillmann Crueger	(crueger@ins.uni-bonn.de)
+Daniel Dueck		(dueck@ins.uni-bonn.de)
+Frederik Heber		(heber@ins.uni-bonn.de)
+Saskia Metzler		(metzler@ins.uni-bonn.de)
+Christian Neuen		(neuen@ins.uni-bonn.de)
Index: COPYING
===================================================================
--- COPYING	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ COPYING	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,23 +1,2 @@
-<<<<<<< HEAD
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-=======
 		    GNU GENERAL PUBLIC LICENSE
 		       Version 2, June 1991
@@ -38,5 +17,4 @@
 using it.  (Some other Free Software Foundation software is covered by
 the GNU Library General Public License instead.)  You can apply it to
->>>>>>> FETCH_HEAD
 your programs, too.
 
@@ -44,605 +22,4 @@
 price.  Our General Public Licenses are designed to make sure that you
 have the freedom to distribute copies of free software (and charge for
-<<<<<<< HEAD
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-=======
 this service if you wish), that you receive source code or can get it
 if you want it, that you can change the software or use pieces of it
@@ -909,5 +286,4 @@
 
 	    How to Apply These Terms to Your New Programs
->>>>>>> FETCH_HEAD
 
   If you develop a new program, and you want it to be of the greatest
@@ -917,23 +293,13 @@
   To do so, attach the following notices to the program.  It is safest
 to attach them to the start of each source file to most effectively
-<<<<<<< HEAD
-state the exclusion of warranty; and each file should have at least
-=======
 convey the exclusion of warranty; and each file should have at least
->>>>>>> FETCH_HEAD
 the "copyright" line and a pointer to where the full notice is found.
 
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-<<<<<<< HEAD
-    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
-=======
+    MoleCuilder - to create and alter molecular systems
+    Copyright (C) 2010  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 2 of the License, or
->>>>>>> FETCH_HEAD
     (at your option) any later version.
 
@@ -944,15 +310,4 @@
 
     You should have received a copy of the GNU General Public License
-<<<<<<< HEAD
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-=======
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -964,27 +319,12 @@
 when it starts in an interactive mode:
 
-    Gnomovision version 69, Copyright (C) year  name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
->>>>>>> FETCH_HEAD
+    MoleCuilder version ??, Copyright (C) 2010  Frederik Heber
+    MoleCuilder comes with ABSOLUTELY NO WARRANTY; for details type 
+    `molecuilder --help-warranty'.
     This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
+    under certain conditions; type `molecuilder --help-redistribute' 
+    for details.
 
 The hypothetical commands `show w' and `show c' should show the appropriate
-<<<<<<< HEAD
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
-=======
 parts of the General Public License.  Of course, the commands you use may
 be called something other than `show w' and `show c'; they could even be
@@ -995,9 +335,8 @@
 necessary.  Here is a sample; alter the names:
 
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
+  University of Bonn, hereby disclaims all copyright interest in the program
+  `MoleCuilder' (which creates molecular systems) written by Frederik Heber.
+
+  Frederik Heber, 17 Aug 2010
 
 This General Public License does not permit incorporating your program into
@@ -1006,3 +345,2 @@
 library.  If this is what you want to do, use the GNU Library General
 Public License instead of this License.
->>>>>>> FETCH_HEAD
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -9,2 +9,5 @@
 doc:
 	cd doc && make doxygen-docs
+	
+unity:
+	cd src && make unity
Index: README
===================================================================
--- README	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ README	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,45 +1,27 @@
-<<<<<<< HEAD
-# Project: Molecuilder
+# Project: MoleCuilder
 #
 # heber@ins.uni-bonn.de
 
-	Molecuilder
+	MoleCuilder
 
-... is a tool that started as a mean to edit pcp configuration files (adding/remvoing groups of atoms, measuring bond lengths and so forth) and has grown into the many-body fragmentation test base of a new method coined BOSSANOVA (Bond Order diSSection in an ANOVA (ANalysis Of VAriance) -like fashion). It spills out configuration files for each fragment and includes joining and analyzing programs, to put together the partial energies and forces of each fragment to the total energy and forces. It allows for a complete Born-Oppenheimer molecular dynamics run.
-=======
-# Project: ParallelCarParrinello
-# Jan Hamaekers
-# Frederik Heber
-# 2005
-#
-# File: README
+... is a tool that started as a mean to edit pcp configuration files (adding/
+removing groups of atoms, measuring bond lengths and so forth), grew forth into 
+a many-body fragmentation test base of a new method coined BOSSANOVA (Bond
+Order diSSection in an ANOVA (ANalysis Of VAriance) - like fashion). It spilled 
+out configuration files for each fragment and included joining and analyzing 
+programs, to put together the partial energies and forces of each fragment to 
+the total energy and forces. Since then it has evolved into a complete toolbox
+for creating molecular systems and worlds.
 
-	Electronic Structure PACKage
-
-Is a collection of mathematical-physical programs to calculate via various ab-initio methods
-such as density functional theory or Hartree-Fock electronic(-magnetic) properties including
-the molecular (Car&Parrinello) dynamics of a many electron system. Especially, the linear
-response of the system to a external magnetic field in a perturbation approach in terms of 
-susceptibility and chemical shielding is implemented via the Density Functional Perturbation
-Theory. It was developed mainly by Jan Hamaekers (pcp) with additional code by Frederik Heber 
-(dfpt part in pcp) and also Ralf Wildenhuis (Gauss) at the Institute for Numerical Simulation 
-at the University of Bonn[1].
-
-
->>>>>>> FETCH_HEAD
 
 INSTALLATION NOTES
 ==================
 
-<<<<<<< HEAD
 The following packages are needed
 * GCC or alike
 * GSL (GNU Scientific Library, available at http://www.gnu.org/software/gsl)
 * Boost 1.4 or newer
-=======
-In general gcc or alike is needed to compile the sources, for more specific demands see the README files in the sub directory of each package part.
 
 LINKS
 =====
 [1] http://www.ins.uni-bonn.de/
->>>>>>> FETCH_HEAD
Index: TestRunnerClient.cpp
===================================================================
--- TestRunnerClient.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ TestRunnerClient.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -45,5 +45,5 @@
 #endif
 
-#define MAX_HOSTNAME_SIZE		255
+enum { MAX_HOSTNAME_SIZE=255 };
 
 /*
Index: togen.sh
===================================================================
--- autogen.sh	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,2 +1,0 @@
-#!/bin/sh
-autoreconf --force --install -I config -I m4
Index: bootstrap
===================================================================
--- bootstrap	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ bootstrap	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,14 @@
+#! /bin/sh
+# bootstrap git sources
+# This file is not distributed.
+
+set -x
+
+if git log > ChangeLog.t \
+   && diff ChangeLog.t ChangeLog >/dev/null 2>&1; then
+	mv -f ChangeLog.t ChangeLog
+else
+	rm -f ChangeLog.t
+fi
+
+autoreconf -v -i -I config -I m4
Index: configure.ac
===================================================================
--- configure.ac	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ configure.ac	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -3,5 +3,5 @@
 
 AC_PREREQ(2.59)
-AC_INIT(Molecuilder, 1.0, heber@ins.uni-bonn.de, molecuilder)
+AC_INIT(MoleCuilder, 1.0.0, heber@ins.uni-bonn.de, molecuilder)
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_SRCDIR([src/builder.cpp])
@@ -9,5 +9,5 @@
 AC_CONFIG_MACRO_DIR([m4])
 
-AM_INIT_AUTOMAKE(dist-bzip2 parallel-tests)
+AM_INIT_AUTOMAKE([dist-bzip2 1.11 parallel-tests color-tests])
 
 # Checks for programs.
@@ -15,6 +15,4 @@
 AC_PROG_CXX
 AC_PROG_CC
-# obselete by LT_INIT
-#AC_PROG_RANLIB
 AC_PROG_INSTALL
 AC_CHECK_PROG([LATEX],[latex],[latex],[:])
@@ -82,5 +80,5 @@
 fi
 
-# add replacement/saturation hydrogen or not 
+# use CppUnit TestRunner or not
 AC_ARG_ENABLE([ecut],AS_HELP_STRING([--enable-ecut],[Use ECut TestRunnerClient (default is no)]),
               [enable_ecut=$enableval], [enable_ecut=no])
@@ -88,4 +86,24 @@
   AC_DEFINE(HAVE_ECUT,1, ["Use ECut TestRunnerClient instead of our own."])
   AC_SUBST(HAVE_ECUT)
+fi
+
+# with valgrinding testsuite or not
+AC_ARG_WITH([valgrind],AS_HELP_STRING([--with-valgrind],[Use Valgrind on the testsuite (default is no)]),
+              [with_valgrind=$withval], [with_valgrind=no])
+if test x"$with_valgrind" = xyes; then
+  AC_CHECK_HEADER([valgrind/valgrind.h],
+    [
+      # check header
+      AC_DEFINE(HAVE_VALGRIND_TESTSUITE,1, ["Use Valgrind to check the testsuite."])
+      # check path
+      AC_PATH_PROG(VALGRIND, [valgrind], [/bin/false])
+      # set variables 
+      AC_SUBST(HAVE_VALGRIND_TESTSUITE)
+      AC_SUBST(VALGRIND)
+    ],
+    [
+      AC_MSG_ERROR(["Valgrind support requested but headers not available."])
+    ]
+  )
 fi
 
@@ -128,4 +146,6 @@
 	src/Actions/Makefile
   src/Exceptions/Makefile
+  src/Helpers/Makefile
+  src/LinearAlgebra/Makefile
   src/Parser/Makefile
 	src/UIElements/Makefile
Index: src/Actions/Action.cpp
===================================================================
--- src/Actions/Action.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/Action.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * Action.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -18,6 +30,6 @@
 #include "UIElements/UIFactory.hpp"
 
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 
 using namespace std;
Index: src/Actions/Action.hpp
===================================================================
--- src/Actions/Action.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/Action.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -87,9 +87,37 @@
  * <H2> Building your own actions </H2>
  *
- * Building actions is fairly easy. Simply derive from the abstract Action base class and implement
- * the virtual methods. The main code that needs to be executed upon call() should be implemented in
- * the performCall() method. Any user interaction should be placed into the dialog returned by
- * createDialog(). You should also indicate whether the action supports undo by implementing
- * the shouldUndo() and canUndo() methods to return the appropriate flags.
+ * Building actions is easy. Each specific ...Action is derived from the base class Action.
+ * In order to create all the reoccuring stuff, macros have been created which you can simply
+ * include and then don't need to worry about it.
+ * There are three major virtual functions: performCall(), performUndo(), performRedo() which
+ * you have to write, to equip your action with some actual capabilities.
+ * Each Action definition and implementation consists of of three files:
+ * -# cpp: contains performX() which you have to write, also some boilerplate functions which are
+ *         constructed automatically when including your def and "Actions/action_impl_pre.hpp"
+ * -# hpp: boilerplate definitions created simply by including your def and
+ *         "Actions/action_impl_header.hpp"
+ * -# def: macro definitions of all your parameters and additional variables needed for the state,
+ *         also name and category and token of your action.
+ *
+ * Best thing to do is look at one of the already present triples and you should soon understand
+ * what you have to add:
+ * -# pick the right category, i.e. the right folder in src/Actions
+ * -# pick the right name
+ * -# decide which parameters your actions need and what the type, the variable name and the token
+ *    to reference it from the command-line should be. Check whether already present and fitting
+ *    tokens exists, e.g. "position" as token for a Vector representing a position.
+ * -# consider which additional information you need to undo your action
+ * -# don't forget to include your .def file followed by "action_impl_pre.hpp" in .cpp or
+ *    "action_impl_header.hpp" in the .hpp
+ * -# continue to write the functionality of your action in performCall(), undo and redo in performUndo()
+ *    and performRedo().
+ * -# You should indicate whether the action supports undo by implementing the shouldUndo() and
+ *    canUndo() methods to return the appropriate flags.
+ *
+ * <H3> Specific notes on the macros </H3>
+ *
+ * The following functions are created by the macros, i.e. you don't need to worry about it:
+ *
+ * Any user interaction should be placed into the dialog returned by fillDialog().
  *
  * Also, create the global function to allow for easy calling of your function internally (i.e.
@@ -135,10 +163,13 @@
  *
  * <ul>
- *  <li/> derive YourAction from Action
- *  <li/> pass name and flag for registry to the base constructor
- *  <li/> implement createDialog(), performCall(), performUndo(), performRedo()
- *  <li/> implement the global function call/macro.
- *  <li/> implement the functions that return the flags for the undo mechanism
- *  <li/> Derive YourActionState from ActionState as necessary
+ *  <li/> create parameter tupels (type, token, reference), put into def. Access them later in
+ *        the performX() via the structure params.###.
+ *  <li/> think of name, category and token for your action, put into def
+ *  <li/> create additional state variables tupels (type, reference) for storing extra information
+ *        that you need for undo/redo in the ActionState. You can always access the parameters
+ *        of your Action by state.params.### (i.e. they are copied to the state by default).
+ *  <li/> implement performCall(), first line should be calling of getParametersfromValueStorage().
+ *  <li/> performUndo(), performRedo()
+ *  <li/> implement the functions that return the flags for the undo mechanism, i.e. true/false.
  * </ul>
  *
@@ -146,15 +177,9 @@
  *
  * <ul>
- *  <li/> createDialog():
- *  <ul>
- *   <li/> Call makeDialog() from the UIFactory.
- *   <li/> Call any needed Dialog->Query...() for the values you need with specific keywords.
- *   <li/> if the action needs to save a state return a custom state object
- *   <li/> otherwise return Action::success
- *  </ul>
  *  <li/> performCall():
  *  <ul>
- *   <li/> obtain parameters you need by ValueStorage::getCurrentValue, matching
- *         key words from createDialog().
+ *   <li/> first line should be calling of getParametersfromValueStorage().
+ *   <li/> Access your parameters by the structure params.### (where ### stands for the reference/
+ *         variable name chosen in the tupel).
  *   <li/> do whatever is needed to make the action work
  *   <li/> if the action was abborted return Action::failure
@@ -165,5 +190,5 @@
  *  <ul>
  *   <li/> typecast the ActionState pointer to a Pointer to YourActionState if necessary
- *   <li/> undo the action using the information from the state
+ *   <li/> undo the action using the extra information and the Action's parameters in the state
  *   <li/> produce a new state that can be used for redoing and return it
  *  </ul>
@@ -171,5 +196,5 @@
  *  <ul>
  *   <li/> take the ActionState produced by performUndo and typecast it to a pointer to YourActionState if necessary
- *   <li/> redo the undone action using the information from the state
+ *   <li/> redo the undone action using the extra information and the Action's parameters in the state
  *   <li/> produce a new state that can be used by performUndo() and return it
  *  </ul>
@@ -377,4 +402,16 @@
 private:
 
+  /**
+   * This is called internally before the Action::performCall(). It initializes the
+   * necessary ActionParameters by retrieving the values from ValueStorage.
+   */
+  virtual void getParametersfromValueStorage()=0;
+
+  /**
+   * This is called internally before the action is processed. This adds necessary queries
+   * to a given dialog to obtain parameters for the user for processing the action accordingly.
+   * The dialog will be given to the user before Action::performCall() is initiated, values
+   * are transfered via ValueStorage.
+   */
   virtual Dialog * fillDialog(Dialog*)=0;
 
@@ -420,3 +457,16 @@
 };
 
+/**
+ * This class can be used by actions to contain parameters.
+ *
+ * The base class is completely empty, since no general parameters can be given. The
+ * Action performing the function should construct its own parameter class derived
+ * from it.
+ */
+class ActionParameters{
+public:
+  ActionParameters(){}
+  virtual ~ActionParameters(){}
+};
+
 #endif /* ACTION_H_ */
Index: src/Actions/ActionHistory.cpp
===================================================================
--- src/Actions/ActionHistory.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ActionHistory.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ActionHistory.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -67,6 +79,9 @@
 
 /****************** Contained actions *******************/
+
+const char ActionHistory::UndoAction::NAME[] = "undo";
+
 ActionHistory::UndoAction::UndoAction(ActionHistory *_hist) :
-  Action("Undo"),
+  Action(NAME),
   hist(_hist)
 {}
@@ -86,4 +101,7 @@
 }
 
+void ActionHistory::UndoAction::getParametersfromValueStorage()
+{}
+
 Dialog* ActionHistory::UndoAction::fillDialog(Dialog *dialog){
   ASSERT(dialog,"No Dialog given when filling action dialog");
@@ -92,4 +110,5 @@
 
 Action::state_ptr ActionHistory::UndoAction::performCall(){
+  std::cout << "Undo" << std::endl;
   hist->undoLast();
   return Action::success;
@@ -106,6 +125,8 @@
 }
 
+const char ActionHistory::RedoAction::NAME[] = "redo";
+
 ActionHistory::RedoAction::RedoAction(ActionHistory *_hist) :
-    Action("Redo"),
+    Action(NAME),
     hist(_hist)
 {}
@@ -125,4 +146,7 @@
 }
 
+void ActionHistory::RedoAction::getParametersfromValueStorage()
+{}
+
 Dialog* ActionHistory::RedoAction::fillDialog(Dialog *dialog){
   ASSERT(dialog,"No Dialog given when filling action dialog");
@@ -131,4 +155,5 @@
 
 Action::state_ptr ActionHistory::RedoAction::performCall(){
+  std::cout << "Redo" << std::endl;
   hist->redoLast();
   return Action::success;
Index: src/Actions/ActionHistory.hpp
===================================================================
--- src/Actions/ActionHistory.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ActionHistory.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -41,9 +41,12 @@
     virtual Dialog * fillDialog(Dialog *dialog);
   private:
-    virtual Action::state_ptr performCall();
+    virtual void getParametersfromValueStorage();
+  virtual Action::state_ptr performCall();
     virtual Action::state_ptr performUndo(Action::state_ptr);
     virtual Action::state_ptr performRedo(Action::state_ptr);
 
     ActionHistory *hist;
+
+    static const char NAME[];
   };
 
@@ -61,4 +64,5 @@
     virtual Dialog * fillDialog(Dialog *dialog);
   private:
+    virtual void getParametersfromValueStorage();
     virtual Action::state_ptr performCall();
     virtual Action::state_ptr performUndo(Action::state_ptr);
@@ -66,4 +70,6 @@
 
     ActionHistory *hist;
+
+    static const char NAME[];
   };
 
Index: src/Actions/ActionRegistry.cpp
===================================================================
--- src/Actions/ActionRegistry.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ActionRegistry.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * Registry<Action>.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Actions/ActionSequence.cpp
===================================================================
--- src/Actions/ActionSequence.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ActionSequence.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ActionSequenze.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Actions/Action_impl_header.hpp
===================================================================
--- src/Actions/Action_impl_header.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/Action_impl_header.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,132 @@
+/*
+ * Action_impl_header.hpp
+ *
+ *  Created on: Aug 25, 2010
+ *      Author: heber
+ */
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/comparison/not_equal.hpp>
+#include <boost/preprocessor/control/if.hpp>
+#include <boost/preprocessor/debug/assert.hpp>
+#include <boost/preprocessor/iteration/local.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/seq/elem.hpp>
+#include <boost/preprocessor/seq/push_back.hpp>
+#include <boost/preprocessor/seq/seq.hpp>
+#include <boost/preprocessor/seq/size.hpp>
+#include <boost/preprocessor/seq/transform.hpp>
+
+// some derived names
+#define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action))
+#define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME)
+#define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters))
+
+// check if no lists given
+#ifndef paramtypes
+#define MAXPARAMTYPES 0
+#else
+#define MAXPARAMTYPES BOOST_PP_SEQ_SIZE(paramtypes)
+#endif
+
+// check user has given name and category
+#ifndef CATEGORY
+ERROR: No "CATEGORY" defined in: __FILE__
+#endif
+
+#ifndef ACTIONNAME
+ERROR: No "ACTIONNAME" defined in: __FILE__
+#endif
+
+// calculate numbers and check whether all have same size
+#ifdef paramtokens
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramtokens)),\
+  ERROR: There are not the same number of "paramtokens" and "paramtypes" in: __FILE__ \
+)
+#endif
+#ifdef paramreferences
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramreferences)),\
+  ERROR: There are not the same number of "paramtokens" and "paramreferences" in: __FILE__ \
+)
+#endif
+
+// print a list of type ref followed by a separator, i.e. "int i;"
+#define type_print(z,n,TYPELIST, VARLIST, separator) \
+  BOOST_PP_SEQ_ELEM(n, TYPELIST) \
+  BOOST_PP_SEQ_ELEM(n, VARLIST)\
+  separator
+
+// print a list of type ref followed, i.e. "int i, double position"
+#define type_list(z,n,TYPELIST, VARLIST) \
+  BOOST_PP_COMMA_IF(n)\
+  BOOST_PP_SEQ_ELEM(n, TYPELIST) \
+  BOOST_PP_SEQ_ELEM(n, VARLIST)
+
+#if defined paramtypes && defined paramreferences
+void COMMAND(
+#define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, paramtypes, paramreferences)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+    );
+# else
+void COMMAND();
+#endif
+
+class ACTION : public Action {
+  friend
+  #if defined paramtypes && defined paramreferences
+  void COMMAND(
+  #define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, paramtypes, paramreferences)
+  #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+  #include BOOST_PP_LOCAL_ITERATE()
+      );
+  # else
+  void COMMAND();
+  #endif
+
+public:
+  ACTION();
+  virtual ~ACTION();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+
+  struct PARAMS : ActionParameters {
+  #if defined paramtypes && defined paramreferences
+  #define BOOST_PP_LOCAL_MACRO(n) type_print(~, n, paramtypes, paramreferences, ;)
+  #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+  #include BOOST_PP_LOCAL_ITERATE()
+  #endif
+  } params;
+
+protected:
+  virtual Dialog * fillDialog(Dialog*);
+private:
+  virtual void getParametersfromValueStorage();
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+#undef MAXPARAMTYPES
+#undef statetypes
+#undef statereferences
+#undef MAXSTATETYPES
+
+#undef ACTION
+#undef COMMAND
+#undef COMMANDFULL
+#undef PARAMS
+
+#undef ACTIONNAME
+#undef CATEGORY
+#undef TOKEN
Index: src/Actions/Action_impl_pre.hpp
===================================================================
--- src/Actions/Action_impl_pre.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/Action_impl_pre.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,228 @@
+/*
+ * Action_impl.hpp
+ *
+ *  Created on: Aug 25, 2010
+ *      Author: heber
+ */
+
+/** These macros define the following functions, necessary but repetitive for
+ * every Action:
+ *  -# Dialog* fillDialog()
+ *  -# action command (e.g. AnalysisMolecularVolume() )
+ *  -# void getParametersfromValuStorage()
+ *  -# struct Action...Parameters
+ *
+ *  For this, the user has the define the following values, each with
+ *  parenthesis, for the values/parameters the action needs
+ *  -# paramtypes, e.g. (int)(double)
+ *  -# paramtokens, e.g. ("Z")("length")
+ *  -# paramreferences, e.g. (Z)(length)
+ *  and for additional values/parameters to save in the state
+ *  -# statetypes, e.g. (int)(double)
+ *  -# statereferences, e.g. (Z)(length)
+ *  and the name and category of the action
+ *  -# CATEGORY, e.g. Analysis
+ *  -# ACTIONNAME, e.g. MolecularVolume
+ */
+
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/expand.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor/comparison/not_equal.hpp>
+#include <boost/preprocessor/control/if.hpp>
+#include <boost/preprocessor/debug/assert.hpp>
+#include <boost/preprocessor/iteration/local.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/seq/elem.hpp>
+#include <boost/preprocessor/seq/push_back.hpp>
+#include <boost/preprocessor/seq/seq.hpp>
+#include <boost/preprocessor/seq/size.hpp>
+#include <boost/preprocessor/seq/transform.hpp>
+
+// some derived names
+#define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action))
+#define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME)
+#define STATE BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, State))
+#define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters))
+
+// check if no lists given
+#ifndef paramtypes
+#define MAXPARAMTYPES 0
+#else
+#define MAXPARAMTYPES BOOST_PP_SEQ_SIZE(paramtypes)
+#endif
+#ifndef statetypes
+#define MAXSTATETYPES 0
+#else
+#define MAXSTATETYPES BOOST_PP_SEQ_SIZE(statetypes)
+#endif
+
+// check user has given name and category
+#ifndef CATEGORY
+ERROR: No "CATEGORY" defined in: __FILE__
+#endif
+
+#ifndef ACTIONNAME
+ERROR: No "ACTIONNAME" defined in: __FILE__
+#endif
+
+// calculate numbers and check whether all have same size
+#ifdef paramtokens
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramtokens)),\
+  ERROR: There are not the same number of "paramtokens" and "paramtypes" in: __FILE__ \
+)
+#endif
+#ifdef paramreferences
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramreferences)),\
+  ERROR: There are not the same number of "paramtokens" and "paramreferences" in: __FILE__ \
+)
+#endif
+
+#ifdef statetypes
+BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXSTATETYPES, BOOST_PP_SEQ_SIZE(statereferences)),\
+  ERROR: There are not the same number of "statetypes" and "statereferences" in: __FILE__ \
+)
+#endif
+
+// print a list of type ref followed by a separator, i.e. "int i;"
+#define initialiser_print(z,n,initialiserlist) \
+  BOOST_PP_SEQ_ELEM(n, initialiserlist) \
+  (BOOST_PP_CAT(_, BOOST_PP_SEQ_ELEM(n, initialiserlist))),
+
+// print a list of ref(_ref) followed by a separator, i.e. "id(_id),"
+#define type_print(z,n,TYPELIST, VARLIST, separator) \
+  BOOST_PP_SEQ_ELEM(n, TYPELIST) \
+  BOOST_PP_SEQ_ELEM(n, VARLIST)\
+  separator
+
+// print a list of type ref followed, i.e. "int i, double position"
+#define type_list(z,n,TYPELIST,VARLIST) \
+  BOOST_PP_COMMA_IF(n)\
+  BOOST_PP_SEQ_ELEM(n, TYPELIST) \
+  BOOST_PP_SEQ_ELEM(n, VARLIST)
+
+// prints dialog->query calls for paramtypes with tokens
+#define dialog_print(z,n,unused) \
+  dialog->query<\
+  BOOST_PP_SEQ_ELEM(n, paramtypes)\
+  >(\
+  BOOST_PP_SEQ_ELEM(n, paramtokens)\
+  , ValueStorage::getInstance().getDescription(\
+  BOOST_PP_SEQ_ELEM(n, paramtokens)\
+  ));
+
+// prints set/queryCurrentValue (command) for paramreferences and paramtokens
+#define value_print(z,n,command, prefix) \
+  ValueStorage::getInstance(). command (\
+  BOOST_PP_SEQ_ELEM(n, paramtokens)\
+  , \
+  prefix\
+  BOOST_PP_SEQ_ELEM(n, paramreferences)\
+  );
+
+#include "Actions/ActionRegistry.hpp"
+#include "UIElements/Dialog.hpp"
+#include "Actions/ValueStorage.hpp"
+
+
+// =========== memento to remember the state when undoing ===========
+class STATE : public ActionState {
+public:
+  STATE(
+#if defined statetypes && defined statereferences // if we have parameters, we have to add "_" before each reference and add the params as the last one
+#define OP(s,data,elem) BOOST_PP_CAT(data, elem)  // OP to add "_"
+#define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, BOOST_PP_SEQ_PUSH_BACK(statetypes, const ACTION::PARAMS &), BOOST_PP_SEQ_TRANSFORM(OP, _, BOOST_PP_SEQ_PUSH_BACK(statereferences, params)))
+#else /// if not, params is only list
+#define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, (const ACTION::PARAMS &), (_params))
+#endif
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXSTATETYPES)
+#include BOOST_PP_LOCAL_ITERATE()
+) :
+#if defined statetypes && defined statereferences // do we have parameters at all?
+BOOST_PP_REPEAT(MAXSTATETYPES, initialiser_print, statereferences)
+#endif
+params(_params)
+  {}
+
+#if defined statetypes && defined statereferences // do we have parameters at all?
+#define BOOST_PP_LOCAL_MACRO(n) type_print(~, n, statetypes, statereferences, ;)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXSTATETYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+  ACTION::PARAMS params;
+};
+
+// =========== name of action ===========
+const char ACTION::NAME[] = TOKEN;
+
+// =========== constructor ===========
+ACTION::ACTION () :
+  Action(NAME)
+{}
+
+// =========== destructor ===========
+ACTION::~ACTION ()
+{}
+
+// =========== fill a dialog ===========
+Dialog* ACTION::fillDialog(Dialog *dialog) {
+        ASSERT(dialog,"No Dialog given when filling actionname's dialog");
+#if BOOST_PP_EQUAL(MAXPARAMTYPES,0)
+        dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
+#else
+#define BOOST_PP_LOCAL_MACRO(n) dialog_print(~, n, ~)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+        return dialog;
+};
+
+// =========== command for calling action directly ===========
+#if defined paramtypes && defined paramreferences
+void COMMAND(
+#define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, paramtypes, paramreferences)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+)
+#else
+void COMMAND()
+#endif
+{
+  ACTION::PARAMS params;
+  Action *ToCall = ActionRegistry::getInstance().getActionByName( ACTION::NAME ); //->clone(params);
+#if BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
+#define BOOST_PP_LOCAL_MACRO(n) value_print(~, n, setCurrentValue, )
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+  ToCall->call(Action::NonInteractive);
+};
+
+// =========== obtain parameters from Storage, used by performCall() ===========
+void ACTION::getParametersfromValueStorage() {
+#if BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
+#define BOOST_PP_LOCAL_MACRO(n) value_print(~, n, queryCurrentValue, params.)
+#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
+#include BOOST_PP_LOCAL_ITERATE()
+#endif
+};
+
+// free up defines
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+#undef MAXPARAMTYPES
+#undef statetypes
+#undef statereferences
+#undef MAXSTATETYPES
+
+#undef ACTION
+#undef COMMAND
+#undef PARAMS
+#undef STATE
+
+#undef ACTIONNAME
+#undef CATEGORY
+#undef TOKEN
Index: src/Actions/AnalysisAction/MolecularVolumeAction.cpp
===================================================================
--- src/Actions/AnalysisAction/MolecularVolumeAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AnalysisAction/MolecularVolumeAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MolecularVolumeAction.cpp
@@ -6,14 +13,18 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "boundary.hpp"
 #include "config.hpp"
 #include "molecule.hpp"
 #include "linkedcell.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "tesselation.hpp"
 #include "World.hpp"
 
@@ -23,32 +34,14 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
 
-const char AnalysisMolecularVolumeAction::NAME[] = "molecular-volume";
+// and construct the stuff
+#include "MolecularVolumeAction.def"
+#include "Action_impl_pre.hpp"
 
-AnalysisMolecularVolumeAction::AnalysisMolecularVolumeAction() :
-  Action(NAME)
-{}
-
-AnalysisMolecularVolumeAction::~AnalysisMolecularVolumeAction()
-{}
-
-void AnalysisMolecularVolume() {
-  ActionRegistry::getInstance().getActionByName(AnalysisMolecularVolumeAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog * AnalysisMolecularVolumeAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+/** =========== define the function ====================== */
 Action::state_ptr AnalysisMolecularVolumeAction::performCall() {
-  int molID = -1;
   // obtain information
-  ValueStorage::getInstance().queryCurrentValue(NAME, molID);
+  getParametersfromValueStorage();
 
   // execute action
@@ -58,7 +51,7 @@
     const LinkedCell *LCList = NULL;
     DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope.");
-    LCList = new LinkedCell(mol, 10.);
+    LCList = new LinkedCell(*mol, 10.);
     config * const configuration = World::getInstance().getConfig();
-    Boundaries *BoundaryPoints = NULL;
+    //Boundaries *BoundaryPoints = NULL;
     //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
     FindNonConvexBorder(mol, TesselStruct, LCList, 5., NULL);
@@ -93,2 +86,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/AnalysisAction/MolecularVolumeAction.def
===================================================================
--- src/Actions/AnalysisAction/MolecularVolumeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AnalysisAction/MolecularVolumeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,21 @@
+/*
+ * MolecularVolumeAction.def
+ *
+ *  Created on: Aug 25, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+//#define paramtypes (int)
+//#define paramreferences (molID)
+//#define paramtokens (NAME)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Analysis
+#define ACTIONNAME MolecularVolume
+#define TOKEN "molecular-volume"
+
Index: src/Actions/AnalysisAction/MolecularVolumeAction.hpp
===================================================================
--- src/Actions/AnalysisAction/MolecularVolumeAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AnalysisAction/MolecularVolumeAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -9,28 +9,13 @@
 #define MOLECULARVOLUMEACTION_HPP_
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Actions/Action.hpp"
 
-void AnalysisMolecularVolume();
-
-class AnalysisMolecularVolumeAction : public Action {
-  friend void AnalysisMolecularVolume();
-public:
-  AnalysisMolecularVolumeAction();
-  virtual ~AnalysisMolecularVolumeAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-
-protected:
-  virtual Dialog * fillDialog(Dialog*);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "MolecularVolumeAction.def"
+#include "Actions/Action_impl_header.hpp"
 
 #endif /* MOLECULARVOLUMEACTION_HPP_ */
Index: src/Actions/AnalysisAction/PairCorrelationAction.cpp
===================================================================
--- src/Actions/AnalysisAction/PairCorrelationAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AnalysisAction/PairCorrelationAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * PairCorrelationAction.cpp
@@ -6,17 +13,20 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/AnalysisAction/PairCorrelationAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "analysis_correlation.hpp"
 #include "boundary.hpp"
 #include "linkedcell.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "element.hpp"
 #include "molecule.hpp"
 #include "periodentafel.hpp"
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 #include "World.hpp"
 
@@ -26,79 +36,32 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/AnalysisAction/PairCorrelationAction.hpp"
 
-const char AnalysisPairCorrelationAction::NAME[] = "pair-correlation";
+// and construct the stuff
+#include "PairCorrelationAction.def"
+#include "Action_impl_pre.hpp"
 
-AnalysisPairCorrelationAction::AnalysisPairCorrelationAction() :
-  Action(NAME)
-{}
-
-AnalysisPairCorrelationAction::~AnalysisPairCorrelationAction()
-{}
-
-void AnalysisPairCorrelation(std::vector< element *> &elements, double BinStart, double BinWidth, double BinEnd, string &outputname, string &binoutputname, bool periodic) {
-  ValueStorage::getInstance().setCurrentValue("elements", elements);
-  ValueStorage::getInstance().setCurrentValue("bin-start", BinStart);
-  ValueStorage::getInstance().setCurrentValue("bin-width", BinWidth);
-  ValueStorage::getInstance().setCurrentValue("bin-end", BinEnd);
-  ValueStorage::getInstance().setCurrentValue("output-file", outputname);
-  ValueStorage::getInstance().setCurrentValue("bin-output-file", binoutputname);
-  ValueStorage::getInstance().setCurrentValue("periodic", periodic);
-  ActionRegistry::getInstance().getActionByName(AnalysisPairCorrelationAction::NAME)->call(Action::NonInteractive);
-};
-
-
-Dialog* AnalysisPairCorrelationAction::fillDialog(Dialog* dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements"));
-  dialog->queryDouble("bin-start", ValueStorage::getInstance().getDescription("bin-start"));
-  dialog->queryDouble("bin-width", ValueStorage::getInstance().getDescription("bin-width"));
-  dialog->queryDouble("bin-end", ValueStorage::getInstance().getDescription("bin-end"));
-  dialog->queryString("output-file", ValueStorage::getInstance().getDescription("output-file"));
-  dialog->queryString("bin-output-file", ValueStorage::getInstance().getDescription("bin-output-file"));
-  dialog->queryBoolean("periodic", ValueStorage::getInstance().getDescription("periodic"));
-
-  return dialog;
-}
-
+/** =========== define the function ====================== */
 Action::state_ptr AnalysisPairCorrelationAction::performCall() {
   int ranges[3] = {1, 1, 1};
-  double BinEnd = 0.;
-  double BinStart = 0.;
-  double BinWidth = 0.;
-  molecule *Boundary = NULL;
-  string outputname;
-  string binoutputname;
-  bool periodic;
   ofstream output;
   ofstream binoutput;
-  std::vector< element *> elements;
   string type;
-  Vector Point;
   BinPairMap *binmap = NULL;
 
   // obtain information
-  ValueStorage::getInstance().queryCurrentValue("elements", elements);
-  ValueStorage::getInstance().queryCurrentValue("bin-start", BinStart);
-  ValueStorage::getInstance().queryCurrentValue("bin-width", BinWidth);
-  ValueStorage::getInstance().queryCurrentValue("bin-end", BinEnd);
-  ValueStorage::getInstance().queryCurrentValue("output-file", outputname);
-  ValueStorage::getInstance().queryCurrentValue("bin-output-file", binoutputname);
-  ValueStorage::getInstance().queryCurrentValue("periodic", periodic);
+  getParametersfromValueStorage();
 
   // execute action
-  output.open(outputname.c_str());
-  binoutput.open(binoutputname.c_str());
+  output.open(params.outputname.c_str());
+  binoutput.open(params.binoutputname.c_str());
   PairCorrelationMap *correlationmap = NULL;
   std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
-  if (periodic)
-    correlationmap = PeriodicPairCorrelation(molecules, elements, ranges);
+  if (params.periodic)
+    correlationmap = PeriodicPairCorrelation(molecules, params.elements, ranges);
   else
-    correlationmap = PairCorrelation(molecules, elements);
+    correlationmap = PairCorrelation(molecules, params.elements);
   OutputPairCorrelation(&output, correlationmap);
-  binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
+  binmap = BinData( correlationmap, params.BinWidth, params.BinStart, params.BinEnd );
   OutputCorrelation ( &binoutput, binmap );
   delete(binmap);
@@ -128,2 +91,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/AnalysisAction/PairCorrelationAction.def
===================================================================
--- src/Actions/AnalysisAction/PairCorrelationAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AnalysisAction/PairCorrelationAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,23 @@
+/*
+ * PairCorrelationAction.def
+ *
+ *  Created on: Aug 25, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include <string>
+#include <vector>
+class element;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::vector<const element *>)(double)(double)(double)(std::string)(std::string)(bool)
+#define paramreferences (elements)(BinStart)(BinWidth)(BinEnd)(outputname)(binoutputname)(periodic)
+#define paramtokens ("elements")("bin-start")("bin-width")("bin-end")("output-file")("bin-output-file")("periodic")
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Analysis
+#define ACTIONNAME PairCorrelation
+#define TOKEN "pair-correlation"
Index: src/Actions/AnalysisAction/PairCorrelationAction.hpp
===================================================================
--- src/Actions/AnalysisAction/PairCorrelationAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AnalysisAction/PairCorrelationAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -9,31 +9,13 @@
 #define PAIRCORRELATIONACTION_HPP_
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Actions/Action.hpp"
-#include <string>
-#include <vector>
 
-class element;
-
-void AnalysisPairCorrelation(std::vector< element *> &elements, double BinStart, double BinWidth, double BinEnd, std::string &outputname, std::string &binoutputname, bool periodic);
-
-class AnalysisPairCorrelationAction : public Action {
-  friend void AnalysisPairCorrelation(std::vector< element *> &elements, double BinStart, double BinWidth, double BinEnd, std::string &outputname, std::string &binoutputname, bool periodic);
-public:
-  AnalysisPairCorrelationAction();
-  virtual ~AnalysisPairCorrelationAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog*);
-private:
-   virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "PairCorrelationAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* PAIRCORRELATIONACTION_HPP_ */
Index: src/Actions/AnalysisAction/PointCorrelationAction.cpp
===================================================================
--- src/Actions/AnalysisAction/PointCorrelationAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AnalysisAction/PointCorrelationAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * PointCorrelationAction.cpp
@@ -6,19 +13,23 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/AnalysisAction/PointCorrelationAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "analysis_correlation.hpp"
 #include "boundary.hpp"
 #include "linkedcell.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "element.hpp"
 #include "molecule.hpp"
 #include "periodentafel.hpp"
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 #include "World.hpp"
 
+#include <cmath>
 #include <iostream>
 #include <string>
@@ -26,84 +37,36 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/AnalysisAction/PointCorrelationAction.hpp"
 
-const char AnalysisPointCorrelationAction::NAME[] = "point-correlation";
 
-AnalysisPointCorrelationAction::AnalysisPointCorrelationAction() :
-  Action(NAME)
-{}
+// and construct the stuff
+#include "PointCorrelationAction.def"
+#include "Action_impl_pre.hpp"
 
-AnalysisPointCorrelationAction::~AnalysisPointCorrelationAction()
-{}
-
-void AnalysisPointCorrelation(std::vector< element *> &elements, Vector &position, double BinStart, double BinWidth, double BinEnd, string &outputname, string &binoutputname, bool periodic) {
-  ValueStorage::getInstance().setCurrentValue("elements", elements);
-  ValueStorage::getInstance().setCurrentValue("position", position);
-  ValueStorage::getInstance().setCurrentValue("bin-start", BinStart);
-  ValueStorage::getInstance().setCurrentValue("bin-width", BinWidth);
-  ValueStorage::getInstance().setCurrentValue("bin-end", BinEnd);
-  ValueStorage::getInstance().setCurrentValue("output-file", outputname);
-  ValueStorage::getInstance().setCurrentValue("bin-output-file", binoutputname);
-  ValueStorage::getInstance().setCurrentValue("periodic", periodic);
-  ActionRegistry::getInstance().getActionByName(AnalysisPointCorrelationAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* AnalysisPointCorrelationAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
-  dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements"));
-  dialog->queryDouble("bin-start", ValueStorage::getInstance().getDescription("bin-start"));
-  dialog->queryDouble("bin-width", ValueStorage::getInstance().getDescription("bin-width"));
-  dialog->queryDouble("bin-end", ValueStorage::getInstance().getDescription("bin-end"));
-  dialog->queryString("output-file", ValueStorage::getInstance().getDescription("output-file"));
-  dialog->queryString("bin-output-file", ValueStorage::getInstance().getDescription("bin-output-file"));
-  dialog->queryBoolean("periodic", ValueStorage::getInstance().getDescription("periodic"));
-
-  return dialog;
-}
-
+/** =========== define the function ====================== */
 Action::state_ptr AnalysisPointCorrelationAction::performCall() {
   int ranges[3] = {1, 1, 1};
-  double BinEnd = 0.;
-  double BinStart = 0.;
-  double BinWidth = 0.;
-  molecule *Boundary = NULL;
-  string outputname;
-  string binoutputname;
-  bool periodic;
   ofstream output;
   ofstream binoutput;
-  std::vector< element *> elements;
   string type;
-  Vector Point;
   BinPairMap *binmap = NULL;
 
   // obtain information
-  ValueStorage::getInstance().queryCurrentValue("position", Point);
-  ValueStorage::getInstance().queryCurrentValue("elements", elements);
-  ValueStorage::getInstance().queryCurrentValue("bin-start", BinStart);
-  ValueStorage::getInstance().queryCurrentValue("bin-width", BinWidth);
-  ValueStorage::getInstance().queryCurrentValue("bin-end", BinEnd);
-  ValueStorage::getInstance().queryCurrentValue("output-file", outputname);
-  ValueStorage::getInstance().queryCurrentValue("bin-output-file", binoutputname);
-  ValueStorage::getInstance().queryCurrentValue("periodic", periodic);
+  getParametersfromValueStorage();
 
   // execute action
-  output.open(outputname.c_str());
-  binoutput.open(binoutputname.c_str());
-  cout << "Point to correlate to is  " << Point << endl;
+  output.open(params.outputname.c_str());
+  binoutput.open(params.binoutputname.c_str());
+  cout << "Point to correlate to is  " << params.Point << endl;
   CorrelationToPointMap *correlationmap = NULL;
-  for(std::vector< element *>::iterator iter = elements.begin(); iter != elements.end(); ++iter)
-    cout << "element is " << (*iter)->symbol << endl;
+  for(std::vector<const element *>::iterator iter = params.elements.begin(); iter != params.elements.end(); ++iter)
+    cout << "element is " << (*iter)->getSymbol() << endl;
   std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
-  if (periodic)
-    correlationmap  = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges);
+  if (params.periodic)
+    correlationmap  = PeriodicCorrelationToPoint(molecules, params.elements, &params.Point, ranges);
   else
-    correlationmap = CorrelationToPoint(molecules, elements, &Point);
+    correlationmap = CorrelationToPoint(molecules, params.elements, &params.Point);
   OutputCorrelationToPoint(&output, correlationmap);
-  binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
+  binmap = BinData( correlationmap, params.BinWidth, params.BinStart, params.BinEnd );
   OutputCorrelation ( &binoutput, binmap );
   delete(binmap);
@@ -133,2 +96,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/AnalysisAction/PointCorrelationAction.def
===================================================================
--- src/Actions/AnalysisAction/PointCorrelationAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AnalysisAction/PointCorrelationAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * PointCorrelationAction.def
+ *
+ *  Created on: Aug 25, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "LinearAlgebra/Vector.hpp"
+#include <vector>
+#include <string>
+
+class element;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::vector<const element *>)(Vector)(double)(double)(double)(std::string)(std::string)(bool)
+#define paramreferences (elements)(Point)(BinStart)(BinWidth)(BinEnd)(outputname)(binoutputname)(periodic)
+#define paramtokens ("elements")("position")("bin-start")("bin-width")("bin-end")("output-file")("bin-output-file")("periodic")
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Analysis
+#define ACTIONNAME PointCorrelation
+#define TOKEN "point-correlation"
Index: src/Actions/AnalysisAction/PointCorrelationAction.hpp
===================================================================
--- src/Actions/AnalysisAction/PointCorrelationAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AnalysisAction/PointCorrelationAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -9,31 +9,13 @@
 #define POINTCORRELATIONACTION_HPP_
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Actions/Action.hpp"
-#include "vector.hpp"
 
-class element;
-
-void AnalysisPointCorrelation(std::vector< element *> &elements, Vector &position, double BinStart, double BinWidth, double BinEnd, std::string &outputname, std::string &binoutputname, bool periodic);
-
-class AnalysisPointCorrelationAction : public Action {
-  friend void AnalysisPointCorrelation(std::vector< element *> &elements, Vector &position, double BinStart, double BinWidth, double BinEnd, std::string &outputname, std::string &binoutputname, bool periodic);
-
-public:
-  AnalysisPointCorrelationAction();
-  virtual ~AnalysisPointCorrelationAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog*);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "PointCorrelationAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* POINTCORRELATIONACTION_HPP_ */
Index: src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp
===================================================================
--- src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * PrincipalAxisSystemAction.cpp
@@ -6,11 +13,17 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
-#include "Actions/ActionRegistry.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Matrix.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "element.hpp"
 #include "molecule.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
 
 #include <iostream>
@@ -19,37 +32,39 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
 
-const char AnalysisPrincipalAxisSystemAction::NAME[] = "principal-axis-system";
+// and construct the stuff
+#include "PrincipalAxisSystemAction.def"
+#include "Action_impl_pre.hpp"
 
-AnalysisPrincipalAxisSystemAction::AnalysisPrincipalAxisSystemAction() :
-  Action(NAME)
-{}
+/** =========== define the function ====================== */
+Action::state_ptr AnalysisPrincipalAxisSystemAction::performCall() {
+  Matrix InertiaTensor;
 
-AnalysisPrincipalAxisSystemAction::~AnalysisPrincipalAxisSystemAction()
-{}
-
-void AnalysisPrincipalAxisSystem() {
-  ActionRegistry::getInstance().getActionByName(AnalysisPrincipalAxisSystemAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* AnalysisPrincipalAxisSystemAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr AnalysisPrincipalAxisSystemAction::performCall() {
-  molecule *mol = NULL;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, mol);
   DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl);
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     molecule *mol = iter->second;
-    mol->PrincipalAxisSystem(false);
+    Vector *CenterOfGravity = mol->DetermineCenterOfGravity();
+
+    // reset inertia tensor
+    InertiaTensor.zero();
+
+    // sum up inertia tensor
+    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+      Vector x = (*iter)->getPosition();
+      x -= *CenterOfGravity;
+      const double mass = (*iter)->getType()->getMass();
+      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
+      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
+      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
+      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
+      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
+      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
+      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
+      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
+      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
+    }
+    // print InertiaTensor for debugging
+    DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << InertiaTensor << endl);
   }
   return Action::success;
@@ -75,2 +90,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/AnalysisAction/PrincipalAxisSystemAction.def
===================================================================
--- src/Actions/AnalysisAction/PrincipalAxisSystemAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AnalysisAction/PrincipalAxisSystemAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,17 @@
+/*
+ * PrincipalAxisSystemAction.def
+ *
+ *  Created on: Aug 25, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Analysis
+#define ACTIONNAME PrincipalAxisSystem
+#define TOKEN "principal-axis-system"
Index: src/Actions/AnalysisAction/PrincipalAxisSystemAction.hpp
===================================================================
--- src/Actions/AnalysisAction/PrincipalAxisSystemAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AnalysisAction/PrincipalAxisSystemAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void AnalysisPrincipalAxisSystem();
-
-class AnalysisPrincipalAxisSystemAction : public Action {
-  friend void AnalysisPrincipalAxisSystem();
-
-public:
-  AnalysisPrincipalAxisSystemAction();
-  virtual ~AnalysisPrincipalAxisSystemAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "PrincipalAxisSystemAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* PRINCIPALAXISSYSTEMACTION_HPP_ */
Index: src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp
===================================================================
--- src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SurfaceCorrelationAction.cpp
@@ -6,17 +13,21 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/AnalysisAction/SurfaceCorrelationAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "analysis_correlation.hpp"
 #include "boundary.hpp"
 #include "linkedcell.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "element.hpp"
 #include "molecule.hpp"
 #include "periodentafel.hpp"
-#include "vector.hpp"
+#include "tesselation.hpp"
+#include "LinearAlgebra/Vector.hpp"
 #include "World.hpp"
 
@@ -26,80 +37,30 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/AnalysisAction/SurfaceCorrelationAction.hpp"
 
-const char AnalysisSurfaceCorrelationAction::NAME[] = "surface-correlation";
+// and construct the stuff
+#include "SurfaceCorrelationAction.def"
+#include "Action_impl_pre.hpp"
 
-AnalysisSurfaceCorrelationAction::AnalysisSurfaceCorrelationAction() :
-  Action(NAME)
-{}
-
-AnalysisSurfaceCorrelationAction::~AnalysisSurfaceCorrelationAction()
-{}
-
-void AnalysisSurfaceCorrelation(std::vector< element *> &elements, molecule *mol, double BinStart, double BinWidth, double BinEnd, std::string &outputname, std::string &binoutputname, bool periodic) {
-  ValueStorage::getInstance().setCurrentValue("elements", elements);
-  ValueStorage::getInstance().setCurrentValue("molecule-by-id", mol);
-  ValueStorage::getInstance().setCurrentValue("bin-start", BinStart);
-  ValueStorage::getInstance().setCurrentValue("bin-width", BinWidth);
-  ValueStorage::getInstance().setCurrentValue("bin-end", BinEnd);
-  ValueStorage::getInstance().setCurrentValue("output-file", outputname);
-  ValueStorage::getInstance().setCurrentValue("bin-output-file", binoutputname);
-  ValueStorage::getInstance().setCurrentValue("periodic", periodic);
-  ActionRegistry::getInstance().getActionByName(AnalysisSurfaceCorrelationAction::NAME)->call(Action::NonInteractive);
-};
-
-
-Dialog* AnalysisSurfaceCorrelationAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryMolecule("molecule-by-id", ValueStorage::getInstance().getDescription("molecule-by-id"));
-  dialog->queryElements("elements", ValueStorage::getInstance().getDescription("elements"));
-  dialog->queryDouble("bin-start", ValueStorage::getInstance().getDescription("bin-start"));
-  dialog->queryDouble("bin-width", ValueStorage::getInstance().getDescription("bin-width"));
-  dialog->queryDouble("bin-end", ValueStorage::getInstance().getDescription("bin-end"));
-  dialog->queryString("output-file", ValueStorage::getInstance().getDescription("output-file"));
-  dialog->queryString("bin-output-file", ValueStorage::getInstance().getDescription("bin-output-file"));
-  dialog->queryBoolean("periodic", ValueStorage::getInstance().getDescription("periodic"));
-
-  return dialog;
-}
-
+/** =========== define the function ====================== */
 Action::state_ptr AnalysisSurfaceCorrelationAction::performCall() {
   int ranges[3] = {1, 1, 1};
-  double BinEnd = 0.;
-  double BinStart = 0.;
-  double BinWidth = 0.;
-  molecule *Boundary = NULL;
-  string outputname;
-  string binoutputname;
-  bool periodic;
   ofstream output;
   ofstream binoutput;
-  std::vector< element *> elements;
   string type;
-  Vector Point;
   BinPairMap *binmap = NULL;
 
   // obtain information
-  ValueStorage::getInstance().queryCurrentValue("molecule-by-id", Boundary);
-  ValueStorage::getInstance().queryCurrentValue("elements", elements);
-  ValueStorage::getInstance().queryCurrentValue("bin-start", BinStart);
-  ValueStorage::getInstance().queryCurrentValue("bin-width", BinWidth);
-  ValueStorage::getInstance().queryCurrentValue("bin-end", BinEnd);
-  ValueStorage::getInstance().queryCurrentValue("output-file", outputname);
-  ValueStorage::getInstance().queryCurrentValue("bin-output-file", binoutputname);
-  ValueStorage::getInstance().queryCurrentValue("periodic", periodic);
+  getParametersfromValueStorage();
 
   // execute action
-  output.open(outputname.c_str());
-  binoutput.open(binoutputname.c_str());
-  ASSERT(Boundary != NULL, "No molecule specified for SurfaceCorrelation.");
+  output.open(params.outputname.c_str());
+  binoutput.open(params.binoutputname.c_str());
+  ASSERT(params.Boundary != NULL, "No molecule specified for SurfaceCorrelation.");
   const double radius = 4.;
   double LCWidth = 20.;
-  if (BinEnd > 0) {
-    if (BinEnd > 2.*radius)
-      LCWidth = BinEnd;
+  if (params.BinEnd > 0) {
+    if (params.BinEnd > 2.*radius)
+      LCWidth = params.BinEnd;
     else
       LCWidth = 2.*radius;
@@ -111,12 +72,12 @@
   // find biggest molecule
   std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
-  int counter  = molecules.size();
-  LCList = new LinkedCell(Boundary, LCWidth);
-  FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
+  std::cout << "There are " << molecules.size() << " selected molecules." << std::endl;
+  LCList = new LinkedCell(*params.Boundary, LCWidth);
+  FindNonConvexBorder(params.Boundary, TesselStruct, LCList, radius, NULL);
   CorrelationToSurfaceMap *surfacemap = NULL;
-  if (periodic)
-    surfacemap = PeriodicCorrelationToSurface( molecules, elements, TesselStruct, LCList, ranges);
+  if (params.periodic)
+    surfacemap = PeriodicCorrelationToSurface( molecules, params.elements, TesselStruct, LCList, ranges);
   else
-    surfacemap = CorrelationToSurface( molecules, elements, TesselStruct, LCList);
+    surfacemap = CorrelationToSurface( molecules, params.elements, TesselStruct, LCList);
   delete LCList;
   OutputCorrelationToSurface(&output, surfacemap);
@@ -128,5 +89,5 @@
       DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl);
   }
-  binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd );
+  binmap = BinData( surfacemap, params.BinWidth, params.BinStart, params.BinEnd );
   OutputCorrelation ( &binoutput, binmap );
   delete TesselStruct;  // surfacemap contains refs to triangles! delete here, not earlier!
@@ -157,2 +118,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/AnalysisAction/SurfaceCorrelationAction.def
===================================================================
--- src/Actions/AnalysisAction/SurfaceCorrelationAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AnalysisAction/SurfaceCorrelationAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,24 @@
+/*
+ * SurfaceCorrelationAction.def
+ *
+ *  Created on: Aug 25, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include <string>
+#include <vector>
+class element;
+class molecule;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::vector<const element *>)(molecule *)(double)(double)(double)(std::string)(std::string)(bool)
+#define paramreferences (elements)(Boundary)(BinStart)(BinWidth)(BinEnd)(outputname)(binoutputname)(periodic)
+#define paramtokens ("elements")("molecule-by-id")("bin-start")("bin-width")("bin-end")("output-file")("bin-output-file")("periodic")
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Analysis
+#define ACTIONNAME SurfaceCorrelation
+#define TOKEN "surface-correlation"
Index: src/Actions/AnalysisAction/SurfaceCorrelationAction.hpp
===================================================================
--- src/Actions/AnalysisAction/SurfaceCorrelationAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AnalysisAction/SurfaceCorrelationAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,31 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include <string>
-#include <vector>
 
-class element;
-class molecule;
-
-void AnalysisSurfaceCorrelation(std::vector< element *> &elements, molecule *mol, double BinStart, double BinWidth, double BinEnd, std::string &outputname, std::string &binoutputname, bool periodic);
-
-class AnalysisSurfaceCorrelationAction : public Action {
-  friend void AnalysisSurfaceCorrelation(std::vector< element *> &elements, molecule *mol, double BinStart, double BinWidth, double BinEnd, std::string &outputname, std::string &binoutputname, bool periodic);
-public:
-  AnalysisSurfaceCorrelationAction();
-  virtual ~AnalysisSurfaceCorrelationAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog*);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "SurfaceCorrelationAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* SURFACECORRELATIONACTION_HPP_ */
Index: src/Actions/AtomAction/AddAction.cpp
===================================================================
--- src/Actions/AtomAction/AddAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AtomAction/AddAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AddAction.cpp
@@ -6,14 +13,18 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/AtomAction/AddAction.hpp"
-#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/AtomIdDescriptor.hpp"
 #include "atom.hpp"
 #include "element.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
-#include "vector.hpp"
-#include "verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -23,45 +34,19 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/AtomAction/AddAction.hpp"
 
-const char AtomAddAction::NAME[] = "add-atom";
-
-AtomAddAction::AtomAddAction() :
-  Action(NAME)
-{}
-
-AtomAddAction::~AtomAddAction()
-{}
-
-void AtomAdd(element *elemental, Vector &position) {
-  ValueStorage::getInstance().setCurrentValue(AtomAddAction::NAME, elemental);
-  ValueStorage::getInstance().setCurrentValue("position", elemental);
-  ActionRegistry::getInstance().getActionByName(AtomAddAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog * AtomAddAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryElement(NAME, ValueStorage::getInstance().getDescription(NAME));
-  dialog->queryVector("position", true, ValueStorage::getInstance().getDescription("position"));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "AddAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr AtomAddAction::performCall() {
-  element * elemental = NULL;
-  Vector position;
-
   // obtain information
-  ValueStorage::getInstance().queryCurrentValue(NAME, elemental);
-  ValueStorage::getInstance().queryCurrentValue("position", position);
+  getParametersfromValueStorage();
 
   // execute action
   atom * first = World::getInstance().createAtom();
-  first->type = elemental;
-  first->x = position;
-  DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << first->type->name << " at " << (first->x) << "." << endl);
+  first->setType(params.elemental);
+  first->setPosition(params.position);
+  DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << first->getType()->getName() << " at " << (first->getPosition()) << "." << endl);
   // TODO: remove when all of World's atoms are stored.
   std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
@@ -70,27 +55,41 @@
     (*iter)->AddAtom(first);
   }
-  return Action::success;
+  return Action::state_ptr(new AtomAddState(first->getId(), params));
 }
 
 Action::state_ptr AtomAddAction::performUndo(Action::state_ptr _state) {
-//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
+  AtomAddState *state = assert_cast<AtomAddState*>(_state.get());
 
-  return Action::failure;
-//  string newName = state->mol->getName();
-//  state->mol->setName(state->lastName);
-//
-//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
+  DoLog(1) && (Log() << Verbose(1) << "Removing atom with id " << state->id << "." << endl);
+  World::getInstance().destroyAtom(state->id);
+
+  return Action::state_ptr(_state);
 }
 
 Action::state_ptr AtomAddAction::performRedo(Action::state_ptr _state){
-  return Action::failure;
+  AtomAddState *state = assert_cast<AtomAddState*>(_state.get());
+
+  atom * first = World::getInstance().createAtom();
+  first->setType(state->params.elemental);
+  first->setPosition(state->params.position);
+  DoLog(1) && (Log() << Verbose(1) << "Re-adding new atom with element " << state->params.elemental->getName() << " at " << state->params.position << "." << endl);
+  // TODO: remove when all of World's atoms are stored.
+  std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
+  if (!molecules.empty()) {
+    std::vector<molecule *>::iterator iter = molecules.begin();
+    (*iter)->AddAtom(first);
+  }
+  if (first->getId() != state->id)
+    if (!first->changeId(state->id))
+      return Action::failure;
+  return Action::state_ptr(_state);
 }
 
 bool AtomAddAction::canUndo() {
-  return false;
+  return true;
 }
 
 bool AtomAddAction::shouldUndo() {
-  return false;
+  return true;
 }
 
@@ -98,2 +97,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/AtomAction/AddAction.def
===================================================================
--- src/Actions/AtomAction/AddAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AtomAction/AddAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,26 @@
+/*
+ * AddAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "LinearAlgebra/BoxVector.hpp"
+#include "World.hpp"
+class element;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (const element *)(BoxVector)
+#define paramtokens (ACTION::NAME)("position")
+#define paramreferences (elemental)(position)
+
+#define statetypes (const atomId_t)
+#define statereferences (id)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Atom
+#define ACTIONNAME Add
+#define TOKEN "add-atom"
Index: src/Actions/AtomAction/AddAction.hpp
===================================================================
--- src/Actions/AtomAction/AddAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AtomAction/AddAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,30 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "vector.hpp"
 
-class element;
-
-void AtomAdd(element *elemental, Vector &position);
-
-class AtomAddAction : public Action {
-  friend void AtomAdd(element *elemental, Vector &position);
-
-public:
-  AtomAddAction();
-  virtual ~AtomAddAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "AddAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* ADDACTION_HPP_ */
Index: src/Actions/AtomAction/ChangeElementAction.cpp
===================================================================
--- src/Actions/AtomAction/ChangeElementAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AtomAction/ChangeElementAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ChangeElementAction.cpp
@@ -6,80 +13,95 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/AtomAction/ChangeElementAction.hpp"
-#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/AtomIdDescriptor.hpp"
 #include "atom.hpp"
 #include "element.hpp"
-#include "log.hpp"
-#include "vector.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Verbose.hpp"
+#include "molecule.hpp"
 #include "World.hpp"
 
 #include <iostream>
+#include <map>
 #include <string>
 
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/AtomAction/ChangeElementAction.hpp"
 
-const char AtomChangeElementAction::NAME[] = "change-element";
-
-AtomChangeElementAction::AtomChangeElementAction() :
-  Action(NAME)
-{}
-
-AtomChangeElementAction::~AtomChangeElementAction()
-{}
-
-void AtomChangeElement(element *elemental) {
-  ValueStorage::getInstance().setCurrentValue(AtomChangeElementAction::NAME, elemental);
-  ActionRegistry::getInstance().getActionByName(AtomChangeElementAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* AtomChangeElementAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryElement(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-return dialog;
-}
-
+// and construct the stuff
+#include "ChangeElementAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr AtomChangeElementAction::performCall() {
   atom *first = NULL;
-  element *elemental = NULL;
+  molecule *mol = NULL;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, elemental);
+  // obtain information
+  getParametersfromValueStorage();
+
+  // create undo state
+  ElementMap Elements;
+  for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection(); iter != World::getInstance().endAtomSelection(); ++iter) {
+    Elements.insert(std::pair<int, const element *> (iter->second->getId(), iter->second->getType()));
+  }
+  AtomChangeElementState *UndoState = new AtomChangeElementState(Elements, params);
 
   for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection(); iter != World::getInstance().endAtomSelection(); ++iter) {
     first = iter->second;
-    DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << elemental->symbol << "." << endl);
-    first->type = elemental;
+    DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << *params.elemental << "." << endl);
+    mol = first->getMolecule();
+    first->removeFromMolecule(); // remove atom
+    first->setType(params.elemental);
+    mol->AddAtom(first);  // add atom to ensure correctness of formula
   }
-  return Action::success;
+  return Action::state_ptr(UndoState);
 }
 
 Action::state_ptr AtomChangeElementAction::performUndo(Action::state_ptr _state) {
-//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
+  AtomChangeElementState *state = assert_cast<AtomChangeElementState*>(_state.get());
+  atom *first = NULL;
+  molecule *mol = NULL;
 
-  return Action::failure;
-//  string newName = state->mol->getName();
-//  state->mol->setName(state->lastName);
-//
-//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
+  for(ElementMap::const_iterator iter = state->Elements.begin(); iter != state->Elements.end(); ++iter) {
+    first = World::getInstance().getAtom(AtomById(iter->first));
+    mol = first->getMolecule();
+    first->removeFromMolecule(); // remove atom
+    first->setType(iter->second);
+    mol->AddAtom(first);  // add atom to ensure correctness of formula
+  }
+
+  return Action::state_ptr(_state);
 }
 
 Action::state_ptr AtomChangeElementAction::performRedo(Action::state_ptr _state){
-  return Action::failure;
+  AtomChangeElementState *state = assert_cast<AtomChangeElementState*>(_state.get());
+  atom *first = NULL;
+  molecule *mol = NULL;
+
+  for(ElementMap::const_iterator iter = state->Elements.begin(); iter != state->Elements.end(); ++iter) {
+    first = World::getInstance().getAtom(AtomById(iter->first));
+    mol = first->getMolecule();
+    first->removeFromMolecule(); // remove atom
+    first->setType(state->params.elemental);
+    mol->AddAtom(first);  // add atom to ensure correctness of formula
+  }
+
+  return Action::state_ptr(_state);
 }
 
 bool AtomChangeElementAction::canUndo() {
-  return false;
+  return true;
 }
 
 bool AtomChangeElementAction::shouldUndo() {
-  return false;
+  return true;
 }
 
@@ -87,2 +109,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/AtomAction/ChangeElementAction.def
===================================================================
--- src/Actions/AtomAction/ChangeElementAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AtomAction/ChangeElementAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * ChangeElementAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class element;
+typedef std::map<int, const element *> ElementMap;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (const element *)
+#define paramtokens (ACTION::NAME)
+#define paramreferences (elemental)
+
+#define statetypes (ElementMap)
+#define statereferences (Elements)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Atom
+#define ACTIONNAME ChangeElement
+#define TOKEN "change-element"
Index: src/Actions/AtomAction/ChangeElementAction.hpp
===================================================================
--- src/Actions/AtomAction/ChangeElementAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AtomAction/ChangeElementAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -9,30 +9,9 @@
 #define CHANGELEMENTACTION_HPP_
 
+
 #include "Actions/Action.hpp"
 
-class element;
-
-void AtomChangeElement(element *elemental);
-
-class AtomChangeElementAction : public Action {
-  friend void AtomChangeElement(element *elemental);
-
-public:
-  AtomChangeElementAction();
-  virtual ~AtomChangeElementAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog*);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "ChangeElementAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* CHANGELEMENTACTION_HPP_ */
Index: src/Actions/AtomAction/Remove.def
===================================================================
--- src/Actions/AtomAction/Remove.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AtomAction/Remove.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,27 @@
+/*
+ * Remove.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+#include "Actions/Action.hpp"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+
+
+
+
+
+
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Atom
+#define ACTIONNAME Remove
+#define TOKEN ""remove-atom";"
+
+EOF;
Index: src/Actions/AtomAction/RemoveAction.cpp
===================================================================
--- src/Actions/AtomAction/RemoveAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AtomAction/RemoveAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * RemoveAction.cpp
@@ -6,13 +13,17 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/AtomAction/RemoveAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "atom.hpp"
+#include "AtomicInfo.hpp"
 #include "Descriptors/AtomDescriptor.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -22,66 +33,77 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/AtomAction/RemoveAction.hpp"
 
-const char AtomRemoveAction::NAME[] = "remove-atom";
-
-AtomRemoveAction::AtomRemoveAction() :
-  Action(NAME)
-{}
-
-AtomRemoveAction::~AtomRemoveAction()
-{}
-
-void AtomRemove() {
-  ActionRegistry::getInstance().getActionByName(AtomRemoveAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* AtomRemoveAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "RemoveAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr AtomRemoveAction::performCall() {
   atom *first = NULL;
 
-  std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
+  // create undo state
+  std::vector<AtomicInfo> Walkers;
+  for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection(); iter != World::getInstance().endAtomSelection(); ++iter) {
+    Walkers.push_back(AtomicInfo(*(iter->second)));
+  }
+  AtomRemoveState *UndoState = new AtomRemoveState(Walkers, params);
+
+  // remove all selected atoms
+//  std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
   for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection(); iter != World::getInstance().endAtomSelection(); ++iter) {
     first = iter->second;
     DoLog(1) && (Log() << Verbose(1) << "Removing atom " << first->getId() << "." << endl);
-    // TODO: this is not necessary when atoms and their storing to file are handled by the World
-    // simply try to erase in every molecule found
-    for (std::vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end(); ++iter) {
-      (*iter)->erase(first);
-    }
+//    // TODO: this is not necessary when atoms and their storing to file are handled by the World
+//    // simply try to erase in every molecule found
+//    for (std::vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end(); ++iter) {
+//      (*iter)->erase(first);
+//    }
     World::getInstance().destroyAtom(first);
   }
-  return Action::success;
+  return Action::state_ptr(UndoState);
 }
 
 Action::state_ptr AtomRemoveAction::performUndo(Action::state_ptr _state) {
-//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
+  AtomRemoveState *state = assert_cast<AtomRemoveState*>(_state.get());
 
-  return Action::failure;
-//  string newName = state->mol->getName();
-//  state->mol->setName(state->lastName);
-//
-//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
+  size_t i=0;
+  for (; i<state->Walkers.size(); ++i) {
+    // re-create the atom
+    DoLog(1) && (Log() << Verbose(1) << "Re-adding atom " << state->Walkers[i].getId() << "." << endl);
+    atom *Walker = World::getInstance().createAtom();
+    if (!state->Walkers[i].setAtom(*Walker)) {
+      DoeLog(1) && (eLog() << Verbose(1) << "Failed to set id." << endl);
+      World::getInstance().destroyAtom(Walker);
+      break;
+    }
+  }
+  if (i<state->Walkers.size()) {
+    // remove all previous ones, too
+    for (size_t j=0;j<i;++j)
+      World::getInstance().destroyAtom(state->Walkers[j].getId());
+    // and announce the failure of the undo
+    return Action::failure;
+  }
+  return Action::state_ptr(_state);
 }
 
 Action::state_ptr AtomRemoveAction::performRedo(Action::state_ptr _state){
-  return Action::failure;
+  AtomRemoveState *state = assert_cast<AtomRemoveState*>(_state.get());
+
+  // simple remove again all previously added atoms
+  for (size_t i=0; i<state->Walkers.size(); ++i) {
+    DoLog(1) && (Log() << Verbose(1) << "Re-removing atom " << state->Walkers[i].getId() << "." << endl);
+    World::getInstance().destroyAtom(state->Walkers[i].getId());
+  }
+
+  return Action::state_ptr(_state);
 }
 
 bool AtomRemoveAction::canUndo() {
-  return false;
+  return true;
 }
 
 bool AtomRemoveAction::shouldUndo() {
-  return false;
+  return true;
 }
 
@@ -89,2 +111,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/AtomAction/RemoveAction.def
===================================================================
--- src/Actions/AtomAction/RemoveAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AtomAction/RemoveAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * RemoveAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#define statetypes (std::vector<AtomicInfo>)
+#define statereferences (Walkers)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Atom
+#define ACTIONNAME Remove
+#define TOKEN "remove-atom"
+
Index: src/Actions/AtomAction/RemoveAction.hpp
===================================================================
--- src/Actions/AtomAction/RemoveAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/AtomAction/RemoveAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void AtomRemove();
-
-class AtomRemoveAction : public Action {
-  friend void AtomRemove();
-
-public:
-  AtomRemoveAction();
-  virtual ~AtomRemoveAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog*);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "RemoveAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* REMOVEACTION_HPP_ */
Index: src/Actions/AtomAction/RotateAroundOriginByAngleAction.cpp
===================================================================
--- src/Actions/AtomAction/RotateAroundOriginByAngleAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AtomAction/RotateAroundOriginByAngleAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,104 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * RotateAroundOriginByAngleAction.cpp
+ *
+ *  Created on: Aug 06, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Line.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "molecule.hpp"
+
+
+#include <cmath>
+#include <iostream>
+#include <fstream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/AtomAction/RotateAroundOriginByAngleAction.hpp"
+
+// and construct the stuff
+#include "RotateAroundOriginByAngleAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr AtomRotateAroundOriginByAngleAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  // check whether Axis is valid
+  if (params.Axis.IsZero())
+    return Action::failure;
+
+  // convert from degrees to radian
+  params.angle *= M_PI/180.;
+
+  // Creation Line that is the rotation axis
+  Line RotationAxis(Vector(0.,0.,0.), params.Axis);
+
+  DoLog(0) && (Log() << Verbose(0) << "Rotate around origin by " << params.angle << " radian, axis from origin to " << params.Axis << "." << endl);
+  // TODO: use AtomSet::rotate?
+  for (std::vector<atom *>::iterator iter = selectedAtoms.begin(); iter != selectedAtoms.end(); ++iter) {
+    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), params.angle));
+  }
+  DoLog(0) && (Log() << Verbose(0) << "done." << endl);
+  return Action::state_ptr(new AtomRotateAroundOriginByAngleState(World::getInstance().getSelectedAtoms(), params));
+}
+
+Action::state_ptr AtomRotateAroundOriginByAngleAction::performUndo(Action::state_ptr _state) {
+  AtomRotateAroundOriginByAngleState *state = assert_cast<AtomRotateAroundOriginByAngleState*>(_state.get());
+
+  // Creation Line that is the rotation axis
+  Line RotationAxis(Vector(0.,0.,0.), state->params.Axis);
+
+  for (std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter) {
+    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), -state->params.angle));
+  }
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr AtomRotateAroundOriginByAngleAction::performRedo(Action::state_ptr _state){
+  AtomRotateAroundOriginByAngleState *state = assert_cast<AtomRotateAroundOriginByAngleState*>(_state.get());
+
+  // Creation Line that is the rotation axis
+  Line RotationAxis(Vector(0.,0.,0.), state->params.Axis);
+
+  for (std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter) {
+    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), state->params.angle));
+  }
+
+  return Action::state_ptr(_state);
+}
+
+bool AtomRotateAroundOriginByAngleAction::canUndo() {
+  return true;
+}
+
+bool AtomRotateAroundOriginByAngleAction::shouldUndo() {
+  return true;
+}
+
+const string AtomRotateAroundOriginByAngleAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/AtomAction/RotateAroundOriginByAngleAction.def
===================================================================
--- src/Actions/AtomAction/RotateAroundOriginByAngleAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AtomAction/RotateAroundOriginByAngleAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * RotateAroundOriginByAngleAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "LinearAlgebra/Vector.hpp"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (double) (Vector)
+#define paramtokens (AtomRotateAroundOriginByAngleAction::NAME) ("position")
+#define paramreferences (angle) (Axis)
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Atom
+#define ACTIONNAME RotateAroundOriginByAngle
+#define TOKEN "rotate-origin"
+
Index: src/Actions/AtomAction/RotateAroundOriginByAngleAction.hpp
===================================================================
--- src/Actions/AtomAction/RotateAroundOriginByAngleAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AtomAction/RotateAroundOriginByAngleAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * RotateAroundOriginByAngleAction.hpp
+ *
+ *  Created on: Aug 06, 2010
+ *      Author: heber
+ */
+
+#ifndef ROTATEAROUNDORIGINBYANGLEACTION_HPP
+#define ROTATEAROUNDORIGINBYANGLEACTION_HPP
+
+#include "Actions/Action.hpp"
+
+#include "RotateAroundOriginByAngleAction.def"
+#include "Action_impl_header.hpp"
+
+#endif // ROTATEAROUNDORIGINBYANGLEACTION_HPP
Index: src/Actions/AtomAction/TranslateAction.cpp
===================================================================
--- src/Actions/AtomAction/TranslateAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AtomAction/TranslateAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,94 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * TranslateAction.cpp
+ *
+ *  Created on: May 10, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Helpers/Log.hpp"
+#include "atom.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/AtomAction/TranslateAction.hpp"
+
+// and construct the stuff
+#include "TranslateAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr AtomTranslateAction::performCall() {
+  Box &domain = World::getInstance().getDomain();
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  // TODO: use AtomSet::translate
+  for (std::vector<atom *>::iterator iter = selectedAtoms.begin(); iter != selectedAtoms.end(); ++iter) {
+    *(*iter) += params.x;
+    if (params.periodic)
+      (*iter)->setPosition(domain.WrapPeriodically((*iter)->getPosition()));
+  }
+
+  return Action::state_ptr(new AtomTranslateState(selectedAtoms, params));
+}
+
+Action::state_ptr AtomTranslateAction::performUndo(Action::state_ptr _state) {
+  AtomTranslateState *state = assert_cast<AtomTranslateState*>(_state.get());
+  Box &domain = World::getInstance().getDomain();
+
+  for (std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter) {
+    *(*iter) -= state->params.x;
+    if (state->params.periodic)
+      (*iter)->setPosition(domain.WrapPeriodically((*iter)->getPosition()));
+  }
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr AtomTranslateAction::performRedo(Action::state_ptr _state){
+  AtomTranslateState *state = assert_cast<AtomTranslateState*>(_state.get());
+  Box &domain = World::getInstance().getDomain();
+
+  for (std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter) {
+    *(*iter) += state->params.x;
+    if (state->params.periodic)
+      (*iter)->setPosition(domain.WrapPeriodically((*iter)->getPosition()));
+  }
+
+  return Action::state_ptr(_state);
+}
+
+bool AtomTranslateAction::canUndo() {
+  return true;
+}
+
+bool AtomTranslateAction::shouldUndo() {
+  return true;
+}
+
+const string AtomTranslateAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/AtomAction/TranslateAction.def
===================================================================
--- src/Actions/AtomAction/TranslateAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AtomAction/TranslateAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * TranslateAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "LinearAlgebra/Vector.hpp"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (Vector) (bool)
+#define paramtokens (AtomTranslateAction::NAME) ("periodic")
+#define paramreferences (x) (periodic)
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Atom
+#define ACTIONNAME Translate
+#define TOKEN "translate-atoms"
+
Index: src/Actions/AtomAction/TranslateAction.hpp
===================================================================
--- src/Actions/AtomAction/TranslateAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/AtomAction/TranslateAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * TranslateAction.hpp
+ *
+ *  Created on: May 10, 2010
+ *      Author: heber
+ */
+
+#ifndef TRANSLATEACTION_HPP
+#define TRANSLATEACTION_HPP
+
+#include "Actions/Action.hpp"
+
+#include "TranslateAction.def"
+#include "Action_impl_header.hpp"
+
+#endif // TRANSLATEACTION_HPP
Index: src/Actions/Calculation.hpp
===================================================================
--- src/Actions/Calculation.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/Calculation.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -64,4 +64,5 @@
   virtual T* doCalc()=0;
 private:
+  virtual void getParametersfromValueStorage();
   virtual Action::state_ptr performCall();
   virtual Action::state_ptr performUndo(Action::state_ptr);
Index: src/Actions/Calculation_impl.hpp
===================================================================
--- src/Actions/Calculation_impl.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/Calculation_impl.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -27,4 +27,8 @@
 
 // methods inherited from Action
+
+template<typename T>
+void Calculation<T>::getParametersfromValueStorage()
+{}
 
 template<typename T>
Index: c/Actions/CmdAction/BondLengthTableAction.cpp
===================================================================
--- src/Actions/CmdAction/BondLengthTableAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * BondLengthTableAction.cpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Actions/CmdAction/BondLengthTableAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "bondgraph.hpp"
-#include "config.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
-#include "World.hpp"
-
-#include <iostream>
-#include <string>
-
-using namespace std;
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-
-const char CommandLineBondLengthTableAction::NAME[] = "bond-table";
-
-CommandLineBondLengthTableAction::CommandLineBondLengthTableAction() :
-  Action(NAME)
-{}
-
-CommandLineBondLengthTableAction::~CommandLineBondLengthTableAction()
-{}
-
-void CommandBondLengthTable(std::string &BondGraphFileName) {
-  ValueStorage::getInstance().setCurrentValue(CommandLineBondLengthTableAction::NAME, BondGraphFileName);
-  ActionRegistry::getInstance().getActionByName(CommandLineBondLengthTableAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* CommandLineBondLengthTableAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr CommandLineBondLengthTableAction::performCall() {
-  ostringstream usage;
-  string BondGraphFileName;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, BondGraphFileName);
-  DoLog(0) && (Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl);
-  config *configuration = World::getInstance().getConfig();
-  if (configuration->BG == NULL) {
-    configuration->BG = new BondGraph(configuration->GetIsAngstroem());
-    if ((!BondGraphFileName.empty()) && (configuration->BG->LoadBondLengthTable(BondGraphFileName))) {
-      DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
-      return Action::success;
-    } else {
-      DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
-      return Action::failure;
-    }
-  } else {
-    DoLog(0) && (Log() << Verbose(0) << "Bond length table already present." << endl);
-    return Action::failure;
-  }
-}
-
-Action::state_ptr CommandLineBondLengthTableAction::performUndo(Action::state_ptr _state) {
-//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
-
-  return Action::failure;
-//  string newName = state->mol->getName();
-//  state->mol->setName(state->lastName);
-//
-//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
-}
-
-Action::state_ptr CommandLineBondLengthTableAction::performRedo(Action::state_ptr _state){
-  return Action::failure;
-}
-
-bool CommandLineBondLengthTableAction::canUndo() {
-  return false;
-}
-
-bool CommandLineBondLengthTableAction::shouldUndo() {
-  return false;
-}
-
-const string CommandLineBondLengthTableAction::getName() {
-  return NAME;
-}
Index: c/Actions/CmdAction/BondLengthTableAction.hpp
===================================================================
--- src/Actions/CmdAction/BondLengthTableAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * BondLengthTableAction.hpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#ifndef BONDLENGTHTABLEACTION_HPP_
-#define BONDLENGTHTABLEACTION_HPP_
-
-#include "Actions/Action.hpp"
-
-void CommandBondLengthTable(std::string &BondGraphFileName);
-
-class CommandLineBondLengthTableAction : public Action {
-  friend void CommandBondLengthTable(std::string &BondGraphFileName);
-
-public:
-  CommandLineBondLengthTableAction();
-  virtual ~CommandLineBondLengthTableAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
-#endif /* BONDLENGTHTABLEACTION_HPP_ */
Index: c/Actions/CmdAction/ElementDbAction.cpp
===================================================================
--- src/Actions/CmdAction/ElementDbAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * ElementDbAction.cpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Actions/CmdAction/ElementDbAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "config.hpp"
-#include "log.hpp"
-#include "periodentafel.hpp"
-#include "verbose.hpp"
-#include "World.hpp"
-
-#include <iostream>
-#include <string>
-
-using namespace std;
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-
-const char CommandLineElementDbAction::NAME[] = "element-db";
-
-CommandLineElementDbAction::CommandLineElementDbAction() :
-  Action(NAME)
-{}
-
-CommandLineElementDbAction::~CommandLineElementDbAction()
-{}
-
-void CommandElementDb(std::string &databasepath) {
-  ValueStorage::getInstance().setCurrentValue(CommandLineElementDbAction::NAME, databasepath);
-  ActionRegistry::getInstance().getActionByName(CommandLineElementDbAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* CommandLineElementDbAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr CommandLineElementDbAction::performCall() {
-  ostringstream usage;
-  string databasepath;
-
-  // get the path
-  // TODO: Make databasepath a std::string
-  config *configuration = World::getInstance().getConfig();
-  ValueStorage::getInstance().queryCurrentValue(NAME, databasepath);
-  strcpy(configuration->databasepath, databasepath.c_str());
-
-  // load table
-  periodentafel *periode = World::getInstance().getPeriode();
-  if (periode->LoadPeriodentafel(configuration->databasepath)) {
-    DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
-    //periode->Output();
-    return Action::success;
-  } else {
-    DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
-    return Action::failure;
-  }
-
-}
-
-Action::state_ptr CommandLineElementDbAction::performUndo(Action::state_ptr _state) {
-//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
-
-  return Action::failure;
-//  string newName = state->mol->getName();
-//  state->mol->setName(state->lastName);
-//
-//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
-}
-
-Action::state_ptr CommandLineElementDbAction::performRedo(Action::state_ptr _state){
-  return Action::failure;
-}
-
-bool CommandLineElementDbAction::canUndo() {
-  return false;
-}
-
-bool CommandLineElementDbAction::shouldUndo() {
-  return false;
-}
-
-const string CommandLineElementDbAction::getName() {
-  return NAME;
-}
Index: c/Actions/CmdAction/ElementDbAction.hpp
===================================================================
--- src/Actions/CmdAction/ElementDbAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * ElementDbAction.hpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#ifndef ELEMENTDBACTION_HPP_
-#define ELEMENTDBACTION_HPP_
-
-#include "Actions/Action.hpp"
-
-void CommandElementDb(std::string &databasepath);
-
-class CommandLineElementDbAction : public Action {
-  friend void CommandElementDb(std::string &databasepath);
-
-public:
-  CommandLineElementDbAction();
-  virtual ~CommandLineElementDbAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
-#endif /* ELEMENTDBACTION_HPP_ */
Index: c/Actions/CmdAction/FastParsingAction.cpp
===================================================================
--- src/Actions/CmdAction/FastParsingAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * FastParsingAction.cpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Actions/CmdAction/FastParsingAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "config.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
-#include "World.hpp"
-
-#include <iostream>
-#include <string>
-
-using namespace std;
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-
-// memento to remember the state when undoing
-
-class CommandLineFastParsingState : public ActionState {
-public:
-  CommandLineFastParsingState(bool _bool) :
-    boolean(_bool)
-  {}
-  bool boolean;
-};
-
-
-const char CommandLineFastParsingAction::NAME[] = "fastparsing";
-
-CommandLineFastParsingAction::CommandLineFastParsingAction() :
-  Action(NAME)
-{}
-
-CommandLineFastParsingAction::~CommandLineFastParsingAction()
-{}
-
-void CommandFastParsing(bool fastparsing) {
-  ValueStorage::getInstance().setCurrentValue(CommandLineFastParsingAction::NAME, fastparsing);
-  ActionRegistry::getInstance().getActionByName(CommandLineFastParsingAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* CommandLineFastParsingAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryBoolean(NAME, MapOfActions::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr CommandLineFastParsingAction::performCall() {
-
-  config *configuration = World::getInstance().getConfig();
-  ValueStorage::getInstance().queryCurrentValue(NAME, configuration->FastParsing);
-  if (configuration->FastParsing)
-    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
-  else
-    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
-  return Action::success;
-}
-
-Action::state_ptr CommandLineFastParsingAction::performUndo(Action::state_ptr _state) {
-  CommandLineFastParsingState *state = assert_cast<CommandLineFastParsingState*>(_state.get());
-
-  config *configuration = World::getInstance().getConfig();
-  configuration->FastParsing = state->boolean;
-
-  return Action::state_ptr(new CommandLineFastParsingState(!state->boolean));
-}
-
-Action::state_ptr CommandLineFastParsingAction::performRedo(Action::state_ptr _state){
-  performUndo(_state);
-}
-
-bool CommandLineFastParsingAction::canUndo() {
-  return true;
-}
-
-bool CommandLineFastParsingAction::shouldUndo() {
-  return true;
-}
-
-const string CommandLineFastParsingAction::getName() {
-  return NAME;
-}
Index: c/Actions/CmdAction/FastParsingAction.hpp
===================================================================
--- src/Actions/CmdAction/FastParsingAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * FastParsingAction.hpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#ifndef FASTPARSINGACTION_HPP_
-#define FASTPARSINGACTION_HPP_
-
-#include "Actions/Action.hpp"
-
-void CommandFastParsing(bool fastparsing);
-
-class CommandLineFastParsingAction : public Action {
-  friend void CommandFastParsing(bool fastparsing);
-
-public:
-  CommandLineFastParsingAction();
-  virtual ~CommandLineFastParsingAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
-#endif /* FASTPARSINGACTION_HPP_ */
Index: c/Actions/CmdAction/HelpAction.cpp
===================================================================
--- src/Actions/CmdAction/HelpAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * HelpAction.cpp
- *
- *  Created on: May 8, 2010
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Actions/CmdAction/HelpAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "CommandLineParser.hpp"
-
-#include <iostream>
-#include <string>
-
-using namespace std;
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/MapOfActions.hpp"
-
-const char CommandLineHelpAction::NAME[] = "help";
-
-CommandLineHelpAction::CommandLineHelpAction() :
-  Action(NAME)
-{}
-
-CommandLineHelpAction::~CommandLineHelpAction()
-{}
-
-void CommandHelp() {
-  ActionRegistry::getInstance().getActionByName(CommandLineHelpAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* CommandLineHelpAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  ostringstream usage;
-  usage << CommandLineParser::getInstance().visible << endl;
-  dialog->queryEmpty(NAME, usage.str());
-
-  return dialog;
-}
-
-Action::state_ptr CommandLineHelpAction::performCall() {
-  return Action::success;
-}
-
-Action::state_ptr CommandLineHelpAction::performUndo(Action::state_ptr _state) {
-  return Action::success;
-}
-
-Action::state_ptr CommandLineHelpAction::performRedo(Action::state_ptr _state){
-  return Action::success;
-}
-
-bool CommandLineHelpAction::canUndo() {
-  return true;
-}
-
-bool CommandLineHelpAction::shouldUndo() {
-  return true;
-}
-
-const string CommandLineHelpAction::getName() {
-  return NAME;
-}
Index: c/Actions/CmdAction/HelpAction.hpp
===================================================================
--- src/Actions/CmdAction/HelpAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * HelpAction.hpp
- *
- *  Created on: May 8, 2010
- *      Author: heber
- */
-
-#ifndef HELPACTION_HPP_
-#define HELPACTION_HPP_
-
-#include "Actions/Action.hpp"
-
-void CommandHelp();
-
-class CommandLineHelpAction : public Action {
-  friend void CommandHelp();
-
-public:
-  CommandLineHelpAction();
-  virtual ~CommandLineHelpAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
-#endif /* HELPACTION_HPP_ */
Index: c/Actions/CmdAction/VerboseAction.cpp
===================================================================
--- src/Actions/CmdAction/VerboseAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * VerboseAction.cpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Actions/CmdAction/VerboseAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
-
-#include <iostream>
-#include <string>
-
-using namespace std;
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-
-// memento to remember the state when undoing
-
-class CommandLineVerboseState : public ActionState {
-public:
-  CommandLineVerboseState(int _verbosity) :
-    verbosity(_verbosity)
-  {}
-  int verbosity;
-};
-
-
-const char CommandLineVerboseAction::NAME[] = "verbose";
-
-CommandLineVerboseAction::CommandLineVerboseAction() :
-  Action(NAME)
-{}
-
-CommandLineVerboseAction::~CommandLineVerboseAction()
-{}
-
-void CommandVerbose(int verbosity) {
-  ValueStorage::getInstance().setCurrentValue(CommandLineVerboseAction::NAME, verbosity);
-  ActionRegistry::getInstance().getActionByName(CommandLineVerboseAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* CommandLineVerboseAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryInt(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr CommandLineVerboseAction::performCall() {
-  int verbosity = 2;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, verbosity);
-
-  setVerbosity(verbosity);
-  DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl);
-  return Action::success;
-}
-
-Action::state_ptr CommandLineVerboseAction::performUndo(Action::state_ptr _state) {
-  CommandLineVerboseState *state = assert_cast<CommandLineVerboseState*>(_state.get());
-
-  int verbosity = 2;
-  ValueStorage::getInstance().queryCurrentValue(NAME, verbosity);
-
-  setVerbosity(state->verbosity);
-  return Action::state_ptr(new CommandLineVerboseState(verbosity));
-}
-
-Action::state_ptr CommandLineVerboseAction::performRedo(Action::state_ptr _state){
-  performUndo(_state);
-}
-
-bool CommandLineVerboseAction::canUndo() {
-  return true;
-}
-
-bool CommandLineVerboseAction::shouldUndo() {
-  return true;
-}
-
-const string CommandLineVerboseAction::getName() {
-  return NAME;
-}
Index: c/Actions/CmdAction/VerboseAction.hpp
===================================================================
--- src/Actions/CmdAction/VerboseAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * VerboseAction.hpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#ifndef VERBOSEACTION_HPP_
-#define VERBOSEACTION_HPP_
-
-#include "Actions/Action.hpp"
-
-void CommandVerbose(int verbosity);
-
-class CommandLineVerboseAction : public Action {
-  friend void CommandVerbose(int verbosity);
-
-public:
-  CommandLineVerboseAction();
-  virtual ~CommandLineVerboseAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
-#endif /* VERBOSEACTION_HPP_ */
Index: c/Actions/CmdAction/VersionAction.cpp
===================================================================
--- src/Actions/CmdAction/VersionAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * VersionAction.cpp
- *
- *  Created on: May 8, 2010
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Actions/CmdAction/VersionAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "version.h"
-
-#include <iostream>
-#include <string>
-
-using namespace std;
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-
-const char CommandLineVersionAction::NAME[] = "version";
-
-CommandLineVersionAction::CommandLineVersionAction() :
-  Action(NAME)
-{}
-
-CommandLineVersionAction::~CommandLineVersionAction()
-{}
-
-void CommandVersion() {
-  ActionRegistry::getInstance().getActionByName(CommandLineVersionAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* CommandLineVersionAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, ESPACKVersion);
-
-  return dialog;
-}
-
-Action::state_ptr CommandLineVersionAction::performCall() {
-  return Action::success;
-}
-
-Action::state_ptr CommandLineVersionAction::performUndo(Action::state_ptr _state) {
-  return Action::success;
-}
-
-Action::state_ptr CommandLineVersionAction::performRedo(Action::state_ptr _state){
-  return Action::success;
-}
-
-bool CommandLineVersionAction::canUndo() {
-  return true;
-}
-
-bool CommandLineVersionAction::shouldUndo() {
-  return true;
-}
-
-const string CommandLineVersionAction::getName() {
-  return NAME;
-}
Index: c/Actions/CmdAction/VersionAction.hpp
===================================================================
--- src/Actions/CmdAction/VersionAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * VersionAction.hpp
- *
- *  Created on: May 8, 2010
- *      Author: heber
- */
-
-#ifndef VERSIONACTION_HPP_
-#define VERSIONACTION_HPP_
-
-#include "Actions/Action.hpp"
-#include "version.h"
-
-void CommandVersion();
-
-class CommandLineVersionAction : public Action {
-  friend void CommandVersion();
-
-public:
-  CommandLineVersionAction();
-  virtual ~CommandLineVersionAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
-#endif /* VERSIONACTION_HPP_ */
Index: src/Actions/CommandAction/BondLengthTableAction.cpp
===================================================================
--- src/Actions/CommandAction/BondLengthTableAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/BondLengthTableAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,87 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * BondLengthTableAction.cpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "bondgraph.hpp"
+#include "config.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/CommandAction/BondLengthTableAction.hpp"
+
+// and construct the stuff
+#include "BondLengthTableAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr CommandBondLengthTableAction::performCall() {
+  ostringstream usage;
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  DoLog(0) && (Log() << Verbose(0) << "Using " << params.BondGraphFileName << " as bond length table." << endl);
+  config *configuration = World::getInstance().getConfig();
+  if (configuration->BG == NULL) {
+    configuration->BG = new BondGraph(configuration->GetIsAngstroem());
+    if ((!params.BondGraphFileName.empty()) && (configuration->BG->LoadBondLengthTable(params.BondGraphFileName))) {
+      DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
+      return Action::success;
+    } else {
+      DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
+      return Action::failure;
+    }
+  } else {
+    DoLog(0) && (Log() << Verbose(0) << "Bond length table already present." << endl);
+    return Action::failure;
+  }
+}
+
+Action::state_ptr CommandBondLengthTableAction::performUndo(Action::state_ptr _state) {
+//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
+
+  return Action::failure;
+//  string newName = state->mol->getName();
+//  state->mol->setName(state->lastName);
+//
+//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
+}
+
+Action::state_ptr CommandBondLengthTableAction::performRedo(Action::state_ptr _state){
+  return Action::failure;
+}
+
+bool CommandBondLengthTableAction::canUndo() {
+  return false;
+}
+
+bool CommandBondLengthTableAction::shouldUndo() {
+  return false;
+}
+
+const string CommandBondLengthTableAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/CommandAction/BondLengthTableAction.def
===================================================================
--- src/Actions/CommandAction/BondLengthTableAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/BondLengthTableAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * BondLengthTableAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (CommandBondLengthTableAction::NAME)
+#define paramreferences (BondGraphFileName)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Command
+#define ACTIONNAME BondLengthTable
+#define TOKEN "bond-table"
+
Index: src/Actions/CommandAction/BondLengthTableAction.hpp
===================================================================
--- src/Actions/CommandAction/BondLengthTableAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/BondLengthTableAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * BondLengthTableAction.hpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+#ifndef BONDLENGTHTABLEACTION_HPP_
+#define BONDLENGTHTABLEACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "BondLengthTableAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* BONDLENGTHTABLEACTION_HPP_ */
Index: src/Actions/CommandAction/ElementDbAction.cpp
===================================================================
--- src/Actions/CommandAction/ElementDbAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/ElementDbAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,88 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * ElementDbAction.cpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "config.hpp"
+#include "Helpers/Log.hpp"
+#include "periodentafel.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/CommandAction/ElementDbAction.hpp"
+
+// and construct the stuff
+#include "ElementDbAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr CommandElementDbAction::performCall() {
+  ostringstream usage;
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  // get the path
+  // TODO: Make databasepath a std::string
+  config *configuration = World::getInstance().getConfig();
+  strcpy(configuration->databasepath, params.databasepath.c_str());
+
+  // load table
+  periodentafel *periode = World::getInstance().getPeriode();
+  if (periode->LoadPeriodentafel(configuration->databasepath)) {
+    DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
+    //periode->Output();
+    return Action::success;
+  } else {
+    DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
+    return Action::failure;
+  }
+
+}
+
+Action::state_ptr CommandElementDbAction::performUndo(Action::state_ptr _state) {
+//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
+
+  return Action::failure;
+//  string newName = state->mol->getName();
+//  state->mol->setName(state->lastName);
+//
+//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
+}
+
+Action::state_ptr CommandElementDbAction::performRedo(Action::state_ptr _state){
+  return Action::failure;
+}
+
+bool CommandElementDbAction::canUndo() {
+  return false;
+}
+
+bool CommandElementDbAction::shouldUndo() {
+  return false;
+}
+
+const string CommandElementDbAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/CommandAction/ElementDbAction.def
===================================================================
--- src/Actions/CommandAction/ElementDbAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/ElementDbAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * ElementDbAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (CommandElementDbAction::NAME)
+#define paramreferences (databasepath)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Command
+#define ACTIONNAME ElementDb
+#define TOKEN "element-db"
+
Index: src/Actions/CommandAction/ElementDbAction.hpp
===================================================================
--- src/Actions/CommandAction/ElementDbAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/ElementDbAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * ElementDbAction.hpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+#ifndef ELEMENTDBACTION_HPP_
+#define ELEMENTDBACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "ElementDbAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* ELEMENTDBACTION_HPP_ */
Index: src/Actions/CommandAction/FastParsingAction.cpp
===================================================================
--- src/Actions/CommandAction/FastParsingAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/FastParsingAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,90 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * FastParsingAction.cpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "config.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/CommandAction/FastParsingAction.hpp"
+
+// and construct the stuff
+#include "FastParsingAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr CommandFastParsingAction::performCall() {
+  config *configuration = World::getInstance().getConfig();
+  bool oldvalue = configuration->FastParsing;
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  configuration->FastParsing = params.fastparsing;
+  if (configuration->FastParsing)
+    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
+  else
+    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
+  return Action::state_ptr(new CommandFastParsingState(oldvalue, params));
+}
+
+Action::state_ptr CommandFastParsingAction::performUndo(Action::state_ptr _state) {
+  CommandFastParsingState *state = assert_cast<CommandFastParsingState*>(_state.get());
+
+  config *configuration = World::getInstance().getConfig();
+  configuration->FastParsing = state->oldvalue;
+  if (configuration->FastParsing)
+    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
+  else
+    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr CommandFastParsingAction::performRedo(Action::state_ptr _state){
+  CommandFastParsingState *state = assert_cast<CommandFastParsingState*>(_state.get());
+
+  config *configuration = World::getInstance().getConfig();
+  configuration->FastParsing = state->params.fastparsing;
+  if (configuration->FastParsing)
+    DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl);
+  else
+    DoLog(0) && (Log() << Verbose(0) << "I will parse trajectories." << endl);
+
+  return Action::state_ptr(_state);
+}
+
+bool CommandFastParsingAction::canUndo() {
+  return true;
+}
+
+bool CommandFastParsingAction::shouldUndo() {
+  return true;
+}
+
+const string CommandFastParsingAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/CommandAction/FastParsingAction.def
===================================================================
--- src/Actions/CommandAction/FastParsingAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/FastParsingAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * FastParsingAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (bool)
+#define paramtokens (CommandFastParsingAction::NAME)
+#define paramreferences (fastparsing)
+
+#define statetypes (bool)
+#define statereferences (oldvalue)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Command
+#define ACTIONNAME FastParsing
+#define TOKEN "fastparsing"
+
Index: src/Actions/CommandAction/FastParsingAction.hpp
===================================================================
--- src/Actions/CommandAction/FastParsingAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/FastParsingAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * FastParsingAction.hpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+#ifndef FASTPARSINGACTION_HPP_
+#define FASTPARSINGACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "FastParsingAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* FASTPARSINGACTION_HPP_ */
Index: src/Actions/CommandAction/HelpAction.cpp
===================================================================
--- src/Actions/CommandAction/HelpAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/HelpAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,61 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * HelpAction.cpp
+ *
+ *  Created on: May 8, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "CommandLineParser.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/CommandAction/HelpAction.hpp"
+
+// and construct the stuff
+#include "HelpAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr CommandHelpAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
+
+  return Action::success;
+}
+
+Action::state_ptr CommandHelpAction::performUndo(Action::state_ptr _state) {
+  return Action::success;
+}
+
+Action::state_ptr CommandHelpAction::performRedo(Action::state_ptr _state){
+  return Action::success;
+}
+
+bool CommandHelpAction::canUndo() {
+  return true;
+}
+
+bool CommandHelpAction::shouldUndo() {
+  return false;
+}
+
+const string CommandHelpAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/CommandAction/HelpAction.def
===================================================================
--- src/Actions/CommandAction/HelpAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/HelpAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * HelpAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Command
+#define ACTIONNAME Help
+#define TOKEN "help"
+
Index: src/Actions/CommandAction/HelpAction.hpp
===================================================================
--- src/Actions/CommandAction/HelpAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/HelpAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * HelpAction.hpp
+ *
+ *  Created on: May 8, 2010
+ *      Author: heber
+ */
+
+#ifndef HELPACTION_HPP_
+#define HELPACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "HelpAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* HELPACTION_HPP_ */
Index: src/Actions/CommandAction/VerboseAction.cpp
===================================================================
--- src/Actions/CommandAction/VerboseAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/VerboseAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,82 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * VerboseAction.cpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/CommandAction/VerboseAction.hpp"
+
+// and construct the stuff
+#include "VerboseAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr CommandVerboseAction::performCall() {
+  int oldverbosity = getVerbosity();
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  if (oldverbosity != params.verbosity) {
+    CommandVerboseState *UndoState = new CommandVerboseState(oldverbosity, params);
+    setVerbosity(params.verbosity);
+    DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << oldverbosity << " to " << params.verbosity << "." << endl);
+    return Action::state_ptr(UndoState);
+  } else {
+    DoLog(0) && (Log() << Verbose(0) << "Verbosity remains unchanged at " << oldverbosity << "." << endl);
+    return Action::failure;
+  }
+}
+
+Action::state_ptr CommandVerboseAction::performUndo(Action::state_ptr _state) {
+  CommandVerboseState *state = assert_cast<CommandVerboseState*>(_state.get());
+
+  DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << state->params.verbosity << " to " << state->oldverbosity << "." << endl);
+  setVerbosity(state->oldverbosity);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr CommandVerboseAction::performRedo(Action::state_ptr _state){
+  CommandVerboseState *state = assert_cast<CommandVerboseState*>(_state.get());
+
+  DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << state->oldverbosity << " to " << state->params.verbosity << "." << endl);
+  setVerbosity(state->params.verbosity);
+
+  return Action::state_ptr(_state);
+}
+
+bool CommandVerboseAction::canUndo() {
+  return true;
+}
+
+bool CommandVerboseAction::shouldUndo() {
+  return true;
+}
+
+const string CommandVerboseAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/CommandAction/VerboseAction.def
===================================================================
--- src/Actions/CommandAction/VerboseAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/VerboseAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * VerboseAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (int)
+#define paramtokens (CommandVerboseAction::NAME)
+#define paramreferences (verbosity)
+
+#define statetypes (int)
+#define statereferences (oldverbosity)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Command
+#define ACTIONNAME Verbose
+#define TOKEN "verbose"
+
Index: src/Actions/CommandAction/VerboseAction.hpp
===================================================================
--- src/Actions/CommandAction/VerboseAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/VerboseAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * VerboseAction.hpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+#ifndef VERBOSEACTION_HPP_
+#define VERBOSEACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "VerboseAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* VERBOSEACTION_HPP_ */
Index: src/Actions/CommandAction/VersionAction.cpp
===================================================================
--- src/Actions/CommandAction/VersionAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/VersionAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,61 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * VersionAction.cpp
+ *
+ *  Created on: May 8, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "version.h"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/CommandAction/VersionAction.hpp"
+
+// and construct the stuff
+#include "VersionAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr CommandVersionAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
+
+  return Action::success;
+}
+
+Action::state_ptr CommandVersionAction::performUndo(Action::state_ptr _state) {
+  return Action::success;
+}
+
+Action::state_ptr CommandVersionAction::performRedo(Action::state_ptr _state){
+  return Action::success;
+}
+
+bool CommandVersionAction::canUndo() {
+  return true;
+}
+
+bool CommandVersionAction::shouldUndo() {
+  return false;
+}
+
+const string CommandVersionAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/CommandAction/VersionAction.def
===================================================================
--- src/Actions/CommandAction/VersionAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/VersionAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * VersionAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "version.h"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Command
+#define ACTIONNAME Version
+#define TOKEN "version"
+
Index: src/Actions/CommandAction/VersionAction.hpp
===================================================================
--- src/Actions/CommandAction/VersionAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/CommandAction/VersionAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * VersionAction.hpp
+ *
+ *  Created on: May 8, 2010
+ *      Author: heber
+ */
+
+#ifndef VERSIONACTION_HPP_
+#define VERSIONACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "VersionAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* VERSIONACTION_HPP_ */
Index: src/Actions/ErrorAction.cpp
===================================================================
--- src/Actions/ErrorAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ErrorAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ErrorAction.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -11,6 +23,6 @@
 
 #include "Actions/ErrorAction.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "Helpers/Assert.hpp"
 
@@ -30,4 +42,7 @@
   return NULL;
 }
+
+void ErrorAction::getParametersfromValueStorage()
+{}
 
 Action::state_ptr ErrorAction::performCall() {
Index: src/Actions/ErrorAction.hpp
===================================================================
--- src/Actions/ErrorAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ErrorAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -23,4 +23,5 @@
 private:
   virtual Dialog * createDialog();
+  virtual void getParametersfromValueStorage();
   virtual Action::state_ptr performCall();
   virtual Action::state_ptr performUndo(Action::state_ptr);
Index: src/Actions/FragmentationAction/ConstructBondGraphAction.cpp
===================================================================
--- src/Actions/FragmentationAction/ConstructBondGraphAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/FragmentationAction/ConstructBondGraphAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,180 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * ConstructBondGraphAction.cpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/AtomIdDescriptor.hpp"
+#include "Descriptors/MoleculeDescriptor.hpp"
+
+#include "atom.hpp"
+#include "bond.hpp"
+#include "bondgraph.hpp"
+#include "config.hpp"
+#include "linkedcell.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "molecule.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+typedef std::map< moleculeId_t, std::vector<atomId_t> > MolAtomList;
+
+using namespace std;
+
+#include "Actions/FragmentationAction/ConstructBondGraphAction.hpp"
+
+// and construct the stuff
+#include "ConstructBondGraphAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr FragmentationConstructBondGraphAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
+
+  DoLog(1) && (Log() << Verbose(1) << "Constructing bond graph for selected atoms ... " << endl);
+
+  config *configuration = World::getInstance().getConfig();
+  BondGraph *BG = configuration->BG;
+  ASSERT(BG != NULL, "FragmentationConstructBondGraphAction: BondGraph is NULL.");
+  double BondDistance = BG->getMaxDistance();
+  bool IsAngstroem = configuration->GetIsAngstroem();
+
+  atom *Walker = NULL;
+  atom *OtherWalker = NULL;
+  int n[NDIM];
+  double MinDistance, MaxDistance;
+  LinkedCell *LC = NULL;
+  Box &domain = World::getInstance().getDomain();
+
+  // remove every bond from the selected atoms' list
+  int AtomCount = 0;
+  for (World::AtomSelectionIterator AtomRunner = World::getInstance().beginAtomSelection(); AtomRunner != World::getInstance().endAtomSelection(); ++AtomRunner) {
+    AtomCount++;
+    for(BondList::iterator BondRunner = (AtomRunner->second)->ListOfBonds.begin(); !(AtomRunner->second)->ListOfBonds.empty(); BondRunner = (AtomRunner->second)->ListOfBonds.begin())
+      if ((*BondRunner)->leftatom == AtomRunner->second)
+        delete((*BondRunner));
+  }
+  int BondCount = 0;
+
+  // count atoms in molecule = dimension of matrix (also give each unique name and continuous numbering)
+  DoLog(1) && (Log() << Verbose(1) << "AtomCount " << AtomCount << " and bonddistance is " << BondDistance << "." << endl);
+
+  if ((AtomCount > 1) && (BondDistance > 1.)) {
+    DoLog(2) && (Log() << Verbose(2) << "Creating Linked Cell structure ... " << endl);
+    LinkedCell::LinkedNodes list;
+    for (World::AtomSelectionIterator AtomRunner = World::getInstance().beginAtomSelection(); AtomRunner != World::getInstance().endAtomSelection(); ++AtomRunner) {
+      list.push_back(AtomRunner->second);
+    }
+    LC = new LinkedCell(list, BondDistance);
+
+    // create a list to map Tesselpoint::nr to atom *
+    DoLog(2) && (Log() << Verbose(2) << "Creating TesselPoint to atom map ... " << endl);
+
+    // set numbers for atoms that can later be used
+    std::map<TesselPoint *, int> AtomIds;
+    int i=0;
+    for (World::AtomSelectionIterator AtomRunner = World::getInstance().beginAtomSelection(); AtomRunner != World::getInstance().endAtomSelection(); ++AtomRunner) {
+      AtomIds.insert(pair<TesselPoint *, int> (AtomRunner->second, i++) );
+    }
+
+    // 3a. go through every cell
+    DoLog(2) && (Log() << Verbose(2) << "Celling ... " << endl);
+    for (LC->n[0] = 0; LC->n[0] < LC->N[0]; LC->n[0]++)
+      for (LC->n[1] = 0; LC->n[1] < LC->N[1]; LC->n[1]++)
+        for (LC->n[2] = 0; LC->n[2] < LC->N[2]; LC->n[2]++) {
+          const LinkedCell::LinkedNodes *List = LC->GetCurrentCell();
+//          Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
+          if (List != NULL) {
+            for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
+              Walker = dynamic_cast<atom*>(*Runner);
+              ASSERT(Walker,"Tesselpoint that was not an atom retrieved from LinkedNode");
+              //Log() << Verbose(0) << "Current Atom is " << *Walker << "." << endl;
+              // 3c. check for possible bond between each atom in this and every one in the 27 cells
+              for (n[0] = -1; n[0] <= 1; n[0]++)
+                for (n[1] = -1; n[1] <= 1; n[1]++)
+                  for (n[2] = -1; n[2] <= 1; n[2]++) {
+                    const LinkedCell::LinkedNodes *OtherList = LC->GetRelativeToCurrentCell(n);
+//                    Log() << Verbose(2) << "Current relative cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl;
+                    if (OtherList != NULL) {
+                      for (LinkedCell::LinkedNodes::const_iterator OtherRunner = OtherList->begin(); OtherRunner != OtherList->end(); OtherRunner++) {
+                        if (AtomIds.find(*OtherRunner)->second > AtomIds.find(Walker)->second) {
+                          OtherWalker = dynamic_cast<atom*>(*OtherRunner);
+                          ASSERT(OtherWalker,"TesselPoint that was not an atom retrieved from LinkedNode");
+                          //Log() << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
+                          BG->CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
+                          const double distance = domain.periodicDistanceSquared(OtherWalker->getPosition(),Walker->getPosition());
+                          const bool status = (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance);
+//                          Log() << Verbose(1) << "MinDistance is " << MinDistance << " and MaxDistance is " << MaxDistance << "." << endl;
+                          if (AtomIds[OtherWalker->father] > AtomIds[Walker->father]) {
+                            if (status) { // create bond if distance is smaller
+//                              Log() << Verbose(1) << "Adding Bond between " << *Walker << " and " << *OtherWalker << " in distance " << sqrt(distance) << "." << endl;
+                              bond * const Binder = new bond(Walker->father, OtherWalker->father, 1, BondCount++);
+                              Walker->father->RegisterBond(Binder);
+                              OtherWalker->father->RegisterBond(Binder);
+                            } else {
+//                              Log() << Verbose(1) << "Not Adding: distance too great." << endl;
+                            }
+                          } else {
+//                            Log() << Verbose(1) << "Not Adding: Wrong order of labels." << endl;
+                          }
+                        }
+                      }
+                    }
+                  }
+            }
+          }
+        }
+    delete (LC);
+    DoLog(1) && (Log() << Verbose(1) << "I detected " << BondCount << " bonds in the molecule with distance " << BondDistance << "." << endl);
+
+    // correct bond degree by comparing valence and bond degree
+    DoLog(2) && (Log() << Verbose(2) << "Correcting bond degree ... " << endl);
+    //CorrectBondDegree();
+
+  } else
+    DoLog(1) && (Log() << Verbose(1) << "AtomCount is " << AtomCount << ", thus no bonds, no connections!." << endl);
+  DoLog(0) && (Log() << Verbose(0) << "End of CreateAdjacencyList." << endl);
+
+  return Action::success;
+}
+
+Action::state_ptr FragmentationConstructBondGraphAction::performUndo(Action::state_ptr _state) {
+//  FragmentationConstructBondGraphState *state = assert_cast<FragmentationConstructBondGraphState*>(_state.get());
+
+  return Action::success;
+}
+
+Action::state_ptr FragmentationConstructBondGraphAction::performRedo(Action::state_ptr _state){
+  return Action::success;
+}
+
+bool FragmentationConstructBondGraphAction::canUndo() {
+  return false;
+}
+
+bool FragmentationConstructBondGraphAction::shouldUndo() {
+  return false;
+}
+
+const string FragmentationConstructBondGraphAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/FragmentationAction/ConstructBondGraphAction.def
===================================================================
--- src/Actions/FragmentationAction/ConstructBondGraphAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/FragmentationAction/ConstructBondGraphAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * ConstructBondGraphAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Fragmentation
+#define ACTIONNAME ConstructBondGraph
+#define TOKEN "construct-bondgraph"
+
Index: src/Actions/FragmentationAction/ConstructBondGraphAction.hpp
===================================================================
--- src/Actions/FragmentationAction/ConstructBondGraphAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/FragmentationAction/ConstructBondGraphAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * ConstructBondGraphAction.hpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+#ifndef CONSTRUCTBONDGRAPHACTION_HPP_
+#define CONSTRUCTBONDGRAPHACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "ConstructBondGraphAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* CONSTRUCTBONDGRAPHACTION_HPP_ */
Index: src/Actions/FragmentationAction/DepthFirstSearchAction.cpp
===================================================================
--- src/Actions/FragmentationAction/DepthFirstSearchAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/FragmentationAction/DepthFirstSearchAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * DepthFirstSearchAction.cpp
@@ -6,17 +13,20 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "atom.hpp"
 #include "bondgraph.hpp"
 #include "config.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "Descriptors/MoleculeDescriptor.hpp"
 #include "Descriptors/MoleculeIdDescriptor.hpp"
 #include "stackclass.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -26,34 +36,13 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
 
-const char FragmentationDepthFirstSearchAction::NAME[] = "depth-first-search";
-
-FragmentationDepthFirstSearchAction::FragmentationDepthFirstSearchAction() :
-  Action(NAME)
-{}
-
-FragmentationDepthFirstSearchAction::~FragmentationDepthFirstSearchAction()
-{}
-
-void FragmentationDepthFirstSearch(double distance) {
-  ValueStorage::getInstance().setCurrentValue(FragmentationDepthFirstSearchAction::NAME, distance);
-  ActionRegistry::getInstance().getActionByName(FragmentationDepthFirstSearchAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* FragmentationDepthFirstSearchAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryDouble(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "DepthFirstSearchAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr FragmentationDepthFirstSearchAction::performCall() {
-  double distance;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, distance);
+  // obtain information
+  getParametersfromValueStorage();
 
   DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl);
@@ -64,5 +53,5 @@
   class StackClass<bond *> *BackEdgeStack = NULL;
   class StackClass<bond *> *LocalBackEdgeStack = NULL;
-  mol->CreateAdjacencyList(distance, World::getInstance().getConfig()->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
+  mol->CreateAdjacencyList(params.distance, World::getInstance().getConfig()->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
   Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
   if (Subgraphs != NULL) {
@@ -106,2 +95,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/FragmentationAction/DepthFirstSearchAction.def
===================================================================
--- src/Actions/FragmentationAction/DepthFirstSearchAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/FragmentationAction/DepthFirstSearchAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * DepthFirstSearchAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (double)
+#define paramtokens (FragmentationDepthFirstSearchAction::NAME)
+#define paramreferences (distance)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Fragmentation
+#define ACTIONNAME DepthFirstSearch
+#define TOKEN "depth-first-search"
+
Index: src/Actions/FragmentationAction/DepthFirstSearchAction.hpp
===================================================================
--- src/Actions/FragmentationAction/DepthFirstSearchAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/FragmentationAction/DepthFirstSearchAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void FragmentationDepthFirstSearch(double distance);
-
-class FragmentationDepthFirstSearchAction : public Action {
-  friend void FragmentationDepthFirstSearch(double distance);
-
-public:
-  FragmentationDepthFirstSearchAction();
-  virtual ~FragmentationDepthFirstSearchAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "DepthFirstSearchAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* DEPTHFIRSTSEARCHACTION_HPP_ */
Index: src/Actions/FragmentationAction/FragmentationAction.cpp
===================================================================
--- src/Actions/FragmentationAction/FragmentationAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/FragmentationAction/FragmentationAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * FragmentationAction.cpp
@@ -6,12 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/FragmentationAction/FragmentationAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "atom.hpp"
 #include "bondgraph.hpp"
 #include "config.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "Descriptors/MoleculeDescriptor.hpp"
@@ -24,57 +34,29 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/FragmentationAction/FragmentationAction.hpp"
 
-const char FragmentationFragmentationAction::NAME[] = "fragment-mol";
-
-FragmentationFragmentationAction::FragmentationFragmentationAction() :
-  Action(NAME)
-{}
-
-FragmentationFragmentationAction::~FragmentationFragmentationAction()
-{}
-
-void FragmentationFragmentation(std::string &path, double distance, int order) {
-  ValueStorage::getInstance().setCurrentValue(FragmentationFragmentationAction::NAME, path);
-  ValueStorage::getInstance().setCurrentValue("distance", distance);
-  ValueStorage::getInstance().setCurrentValue("order", order);
-  ActionRegistry::getInstance().getActionByName(FragmentationFragmentationAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* FragmentationFragmentationAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-  dialog->queryDouble("distance", ValueStorage::getInstance().getDescription("distance"));
-  dialog->queryInt("order", ValueStorage::getInstance().getDescription("order"));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "FragmentationAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr FragmentationFragmentationAction::performCall() {
   clock_t start,end;
   molecule *mol = NULL;
-  double distance = -1.;
-  int order = 0;
-  std::string path;
   config *configuration = World::getInstance().getConfig();
   int ExitFlag = 0;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, path);
-  ValueStorage::getInstance().queryCurrentValue("distance", distance);
-  ValueStorage::getInstance().queryCurrentValue("order", order);
+  // obtain information
+  getParametersfromValueStorage();
 
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     mol = iter->second;
     ASSERT(mol != NULL, "No molecule has been picked for fragmentation.");
-    DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with bond distance " << distance << " angstroem, order of " << order << "." << endl);
+    DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with bond distance " << params.distance << " angstroem, order of " << params.order << "." << endl);
     DoLog(0) && (Log() << Verbose(0) << "Creating connection matrix..." << endl);
     start = clock();
-    mol->CreateAdjacencyList(distance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
+    mol->CreateAdjacencyList(params.distance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
     DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl);
     if (mol->hasBondStructure()) {
-      ExitFlag = mol->FragmentMolecule(order, path);
+      ExitFlag = mol->FragmentMolecule(params.order, params.path);
     }
     World::getInstance().setExitFlag(ExitFlag);
@@ -104,2 +86,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/FragmentationAction/FragmentationAction.def
===================================================================
--- src/Actions/FragmentationAction/FragmentationAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/FragmentationAction/FragmentationAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * FragmentationAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string) (double) (int)
+#define paramtokens (FragmentationFragmentationAction::NAME) ("distance") ("order")
+#define paramreferences (path) (distance) (order)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Fragmentation
+#define ACTIONNAME Fragmentation
+#define TOKEN "fragment-mol"
+
Index: src/Actions/FragmentationAction/FragmentationAction.hpp
===================================================================
--- src/Actions/FragmentationAction/FragmentationAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/FragmentationAction/FragmentationAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void FragmentationFragmentation(std::string &path, double distance, int order);
-
-class FragmentationFragmentationAction : public Action {
-  friend void FragmentationFragmentation(std::string &path, double distance, int order);
-
-public:
-  FragmentationFragmentationAction();
-  virtual ~FragmentationFragmentationAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "FragmentationAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* FRAGMENTATIONACTION_HPP_ */
Index: src/Actions/FragmentationAction/SubgraphDissectionAction.cpp
===================================================================
--- src/Actions/FragmentationAction/SubgraphDissectionAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/FragmentationAction/SubgraphDissectionAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SubgraphDissectionAction.cpp
@@ -6,13 +13,21 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
-#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/AtomIdDescriptor.hpp"
+#include "Descriptors/MoleculeDescriptor.hpp"
+
 #include "atom.hpp"
+#include "bond.hpp"
+#include "bondgraph.hpp"
 #include "config.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "molecule.hpp"
-#include "Descriptors/MoleculeDescriptor.hpp"
 #include "stackclass.hpp"
 #include "World.hpp"
@@ -21,60 +36,179 @@
 #include <string>
 
+typedef std::map< moleculeId_t, std::vector<atomId_t> > MolAtomList;
+typedef std::map< atomId_t, atomId_t > AtomAtomList;
+
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-
-const char FragmentationSubgraphDissectionAction::NAME[] = "subgraph-dissect";
-
-FragmentationSubgraphDissectionAction::FragmentationSubgraphDissectionAction() :
-  Action(NAME)
-{}
-
-FragmentationSubgraphDissectionAction::~FragmentationSubgraphDissectionAction()
-{}
-
-void FragmentationSubgraphDissection() {
-  ActionRegistry::getInstance().getActionByName(FragmentationSubgraphDissectionAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* FragmentationSubgraphDissectionAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, MapOfActions::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-
+#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
+
+// and construct the stuff
+#include "SubgraphDissectionAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr FragmentationSubgraphDissectionAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
+
   DoLog(1) && (Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl);
-  // @TODO rather do the dissection afterwards
+
+  // first create stuff for undo state
+  MolAtomList moleculelist;
+  vector<molecule *> allmolecules = World::getInstance().getAllMolecules();
+  for (vector<molecule *>::const_iterator moliter = allmolecules.begin(); moliter != allmolecules.end(); ++moliter) {
+    std::vector<atomId_t> atomlist;
+    atomlist.resize((*moliter)->size());
+    for (molecule::const_iterator atomiter = (*moliter)->begin(); atomiter != (*moliter)->end(); ++atomiter) {
+      atomlist.push_back((*atomiter)->getId());
+    }
+    moleculelist.insert( std::pair< moleculeId_t, std::vector<atomId_t> > ((*moliter)->getId(), atomlist));
+  }
+  FragmentationSubgraphDissectionState *UndoState = new FragmentationSubgraphDissectionState(moleculelist, params);
+
+  // 0a. remove all present molecules
   MoleculeListClass *molecules = World::getInstance().getMolecules();
-  molecules->DissectMoleculeIntoConnectedSubgraphs(World::getInstance().getPeriode(), World::getInstance().getConfig());
-  return Action::success;
+  for (vector<molecule *>::iterator MolRunner = allmolecules.begin(); MolRunner != allmolecules.end(); ++MolRunner) {
+    molecules->erase(*MolRunner);
+    World::getInstance().destroyMolecule(*MolRunner);
+  }
+
+  // 0b. remove all bonds and construct a molecule with all atoms
+  molecule *mol = World::getInstance().createMolecule();
+  int BondCount = 0;
+  {
+    vector <atom *> allatoms = World::getInstance().getAllAtoms();
+    for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {
+      BondCount += (*AtomRunner)->ListOfBonds.size();
+//      for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
+//        delete(*BondRunner);
+      mol->AddAtom(*AtomRunner);
+    }
+  }
+
+  // 1. create the bond structure of the single molecule
+  if (BondCount == 0) {
+    config * const configuration = World::getInstance().getConfig();
+    if ((configuration->BG != NULL)) {
+      if (!configuration->BG->ConstructBondGraph(mol)) {
+        World::getInstance().destroyMolecule(mol);
+        DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);
+        return Action::failure;
+      }
+    } else {
+      DoeLog(1) && (eLog()<< Verbose(1) << "There is no BondGraph class present to create bonds." << endl);
+      return Action::failure;
+    }
+  }
+
+  // 2. scan for connected subgraphs
+  MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
+  class StackClass<bond *> *BackEdgeStack = NULL;
+  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
+  delete(BackEdgeStack);
+  if ((Subgraphs == NULL) || (Subgraphs->next == NULL)) {
+    //World::getInstance().destroyMolecule(mol);
+    DoeLog(1) && (eLog()<< Verbose(1) << "There are no atoms." << endl);
+    return Action::failure;
+  }
+
+  //int FragmentCounter = Subgraphs->next->Count();
+
+  // TODO: When DepthFirstSearchAnalysis does not use AddCopyAtom() anymore, we don't need to delete all original atoms
+  {
+    {
+      atom **ListOfAtoms = NULL;
+      // 3a. re-create bond structure and insert molecules into general MoleculeListClass
+      MoleculeLeafClass *MoleculeWalker = Subgraphs->next;
+      while (MoleculeWalker->next != NULL) {
+        ListOfAtoms = NULL;
+        MoleculeWalker->FillBondStructureFromReference(mol, ListOfAtoms, true);  // we want to keep the created ListOfLocalAtoms
+        molecules->insert(MoleculeWalker->Leaf);
+        MoleculeWalker = MoleculeWalker->next;
+      }
+      molecules->insert(MoleculeWalker->Leaf);
+      ListOfAtoms = NULL;
+      MoleculeWalker->FillBondStructureFromReference(mol, ListOfAtoms, true);  // we want to keep the created ListOfLocalAtoms
+    }
+
+    // 3b. store map from new to old ids for 3d
+    vector <atom *> allatoms = World::getInstance().getAllAtoms();
+    AtomAtomList newtooldlist;
+    for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner)
+      if ((*AtomRunner)->father != (*AtomRunner))
+        newtooldlist.insert( std::pair<atomId_t, atomId_t> ((*AtomRunner)->getId(),(*AtomRunner)->father->getId()) );
+
+    {
+      // 3c. destroy the original molecule
+      for (molecule::iterator AtomRunner = mol->begin(); !mol->empty(); AtomRunner = mol->begin())
+        World::getInstance().destroyAtom(*AtomRunner);
+      World::getInstance().destroyMolecule(mol);
+    }
+
+    {
+      // 3d. convert to old Ids and correct fathers (AddCopyAtom sets father to original atom, which has been destroyed).
+      vector <atom *> allatoms = World::getInstance().getAllAtoms();
+      for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {
+        World::getInstance().changeAtomId((*AtomRunner)->getId(), newtooldlist[(*AtomRunner)->getId()]);
+        (*AtomRunner)->father = *AtomRunner;
+      }
+    }
+  }
+
+  // 4. free Leafs
+  MoleculeLeafClass *MolecularWalker = Subgraphs;
+  while (MolecularWalker->next != NULL) {
+    MolecularWalker->Leaf = NULL;
+    MolecularWalker = MolecularWalker->next;
+    delete(MolecularWalker->previous);
+  }
+  MolecularWalker->Leaf = NULL;
+  delete(MolecularWalker);
+  DoLog(1) && (Log() << Verbose(1) << "I scanned " << molecules->ListOfMolecules.size() << " molecules." << endl);
+
+  return Action::state_ptr(UndoState);
 }
 
 Action::state_ptr FragmentationSubgraphDissectionAction::performUndo(Action::state_ptr _state) {
-//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
-
-  return Action::failure;
-//  string newName = state->mol->getName();
-//  state->mol->setName(state->lastName);
-//
-//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
+  FragmentationSubgraphDissectionState *state = assert_cast<FragmentationSubgraphDissectionState*>(_state.get());
+
+  {
+    // remove all present molecules
+    MoleculeListClass *molecules = World::getInstance().getMolecules();
+    vector<molecule *> allmolecules = World::getInstance().getAllMolecules();
+    for (vector<molecule *>::iterator MolRunner = allmolecules.begin(); MolRunner != allmolecules.end(); ++MolRunner) {
+      molecules->erase(*MolRunner);
+      World::getInstance().destroyMolecule(*MolRunner);
+    }
+  }
+
+  {
+    // construct the old state
+    MoleculeListClass *molecules = World::getInstance().getMolecules();
+    molecule *mol = NULL;
+    for (MolAtomList::const_iterator iter = state->moleculelist.begin(); iter != state->moleculelist.end(); ++iter) {
+      mol = World::getInstance().createMolecule();
+      if (mol->getId() != (*iter).first)
+        World::getInstance().changeMoleculeId(mol->getId(), (*iter).first);
+      for (std::vector<atomId_t>::const_iterator atomiter = (*iter).second.begin(); atomiter != (*iter).second.end(); ++atomiter) {
+        atom *Walker = World::getInstance().getAtom(AtomById(*atomiter));
+        mol->AddAtom(Walker);
+      }
+      molecules->insert(mol);
+    }
+  }
+
+  return Action::state_ptr(_state);
 }
 
 Action::state_ptr FragmentationSubgraphDissectionAction::performRedo(Action::state_ptr _state){
-  return Action::failure;
+  return performCall();
 }
 
 bool FragmentationSubgraphDissectionAction::canUndo() {
-  return false;
+  return true;
 }
 
 bool FragmentationSubgraphDissectionAction::shouldUndo() {
-  return false;
+  return true;
 }
 
@@ -82,2 +216,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/FragmentationAction/SubgraphDissectionAction.def
===================================================================
--- src/Actions/FragmentationAction/SubgraphDissectionAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/FragmentationAction/SubgraphDissectionAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * SubgraphDissectionAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#define statetypes (MolAtomList)
+#define statereferences (moleculelist)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Fragmentation
+#define ACTIONNAME SubgraphDissection
+#define TOKEN "subgraph-dissect"
+
Index: src/Actions/FragmentationAction/SubgraphDissectionAction.hpp
===================================================================
--- src/Actions/FragmentationAction/SubgraphDissectionAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/FragmentationAction/SubgraphDissectionAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -7,30 +7,10 @@
 
 #ifndef SUBGRAPHDISSECTIONACTION_HPP_
-#define SUBGRAPHDISSECTIONACTION_HPP_f
+#define SUBGRAPHDISSECTIONACTION_HPP_
 
 #include "Actions/Action.hpp"
 
-void FragmentationSubgraphDissection();
-
-class FragmentationSubgraphDissectionAction : public Action {
-  friend void FragmentationSubgraphDissection();
-
-public:
-  FragmentationSubgraphDissectionAction();
-  virtual ~FragmentationSubgraphDissectionAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "SubgraphDissectionAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* SUBGRAPHDISSECTIONACTION_HPP_ */
Index: src/Actions/Makefile.am
===================================================================
--- src/Actions/Makefile.am	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -50,30 +50,36 @@
   AtomAction/AddAction.cpp \
   AtomAction/ChangeElementAction.cpp \
-  AtomAction/RemoveAction.cpp
+  AtomAction/RemoveAction.cpp \
+  AtomAction/RotateAroundOriginByAngleAction.cpp \
+  AtomAction/TranslateAction.cpp
 ATOMACTIONHEADER = \
   AtomAction/AddAction.hpp \
   AtomAction/ChangeElementAction.hpp \
-  AtomAction/RemoveAction.cpp
+  AtomAction/RemoveAction.cpp \
+  AtomAction/RotateAroundOriginByAngleAction.hpp \
+  AtomAction/TranslateAction.hpp
 
 CMDACTIONSOURCE = \
-  CmdAction/BondLengthTableAction.cpp \
-  CmdAction/ElementDbAction.cpp \
-  CmdAction/FastParsingAction.cpp \
-  CmdAction/HelpAction.cpp \
-  CmdAction/VerboseAction.cpp \
-  CmdAction/VersionAction.cpp
+  CommandAction/BondLengthTableAction.cpp \
+  CommandAction/ElementDbAction.cpp \
+  CommandAction/FastParsingAction.cpp \
+  CommandAction/HelpAction.cpp \
+  CommandAction/VerboseAction.cpp \
+  CommandAction/VersionAction.cpp
 CMDACTIONHEADER = \
-  CmdAction/BondLengthTableAction.hpp \
-  CmdAction/ElementDbAction.hpp \
-  CmdAction/FastParsingAction.hpp \
-  CmdAction/HelpAction.hpp \
-  CmdAction/VerboseAction.hpp \
-  CmdAction/VersionAction.hpp
+  CommandAction/BondLengthTableAction.hpp \
+  CommandAction/ElementDbAction.hpp \
+  CommandAction/FastParsingAction.hpp \
+  CommandAction/HelpAction.hpp \
+  CommandAction/VerboseAction.hpp \
+  CommandAction/VersionAction.hpp
 
 FRAGMENTATIONACTIONSOURCE = \
+  FragmentationAction/ConstructBondGraphAction.cpp \
   FragmentationAction/DepthFirstSearchAction.cpp \
   FragmentationAction/FragmentationAction.cpp \
   FragmentationAction/SubgraphDissectionAction.cpp               
 FRAGMENTATIONACTIONHEADER = \
+  FragmentationAction/ConstructBondGraphAction.hpp \
   FragmentationAction/DepthFirstSearchAction.hpp \
   FragmentationAction/FragmentationAction.hpp \
@@ -83,6 +89,8 @@
   MoleculeAction/BondFileAction.cpp \
   MoleculeAction/ChangeNameAction.cpp \
+  MoleculeAction/CopyAction.cpp \
   MoleculeAction/FillWithMoleculeAction.cpp \
   MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp \
+  MoleculeAction/RotateAroundSelfByAngleAction.cpp \
   MoleculeAction/RotateToPrincipalAxisSystemAction.cpp \
   MoleculeAction/SaveAdjacencyAction.cpp \
@@ -90,11 +98,12 @@
   MoleculeAction/SaveTemperatureAction.cpp \
   MoleculeAction/SuspendInWaterAction.cpp \
-  MoleculeAction/TranslateAction.cpp \
   MoleculeAction/VerletIntegrationAction.cpp
 MOLECULEACTIONHEADER = \
   MoleculeAction/BondFileAction.hpp \
   MoleculeAction/ChangeNameAction.hpp \
+  MoleculeAction/CopyAction.hpp \
   MoleculeAction/FillWithMoleculeAction.hpp \
   MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp \
+  MoleculeAction/RotateAroundSelfByAngleAction.hpp \
   MoleculeAction/RotateToPrincipalAxisSystemAction.hpp \
   MoleculeAction/SaveAdjacencyAction.hpp \
@@ -102,5 +111,4 @@
   MoleculeAction/SaveTemperatureAction.hpp \
   MoleculeAction/SuspendInWaterAction.hpp \
-  MoleculeAction/TranslateAction.hpp \
   MoleculeAction/VerletIntegrationAction.hpp
                  
@@ -114,20 +122,48 @@
 SELECTIONACTIONSOURCE = \
 	SelectionAction/AllAtomsAction.cpp \
+	SelectionAction/AllAtomsInsideCuboidAction.cpp \
+	SelectionAction/AllAtomsInsideSphereAction.cpp \
+	SelectionAction/AllAtomsOfMoleculeAction.cpp \
 	SelectionAction/AllMoleculesAction.cpp \
+	SelectionAction/AtomByElementAction.cpp \
 	SelectionAction/AtomByIdAction.cpp \
+	SelectionAction/ClearAllAtomsAction.cpp \
+	SelectionAction/ClearAllMoleculesAction.cpp \
+	SelectionAction/MoleculeByFormulaAction.cpp \
 	SelectionAction/MoleculeByIdAction.cpp \
+	SelectionAction/MoleculeOfAtomAction.cpp \
 	SelectionAction/NotAllAtomsAction.cpp \
+	SelectionAction/NotAllAtomsInsideCuboidAction.cpp \
+	SelectionAction/NotAllAtomsInsideSphereAction.cpp \
+	SelectionAction/NotAllAtomsOfMoleculeAction.cpp \
 	SelectionAction/NotAllMoleculesAction.cpp \
+	SelectionAction/NotAtomByElementAction.cpp \
 	SelectionAction/NotAtomByIdAction.cpp \
-	SelectionAction/NotMoleculeByIdAction.cpp
+	SelectionAction/NotMoleculeByFormulaAction.cpp \
+	SelectionAction/NotMoleculeByIdAction.cpp \
+	SelectionAction/NotMoleculeOfAtomAction.cpp
 SELECTIONACTIONHEADER = \
 	SelectionAction/AllAtomsAction.hpp \
+	SelectionAction/AllAtomsInsideCuboidAction.hpp \
+	SelectionAction/AllAtomsInsideSphereAction.hpp \
+	SelectionAction/AllAtomsOfMoleculeAction.hpp \
 	SelectionAction/AllMoleculesAction.hpp \
+	SelectionAction/AtomByElementAction.hpp \
 	SelectionAction/AtomByIdAction.hpp \
+	SelectionAction/ClearAllAtomsAction.hpp \
+	SelectionAction/ClearAllMoleculesAction.hpp \
+	SelectionAction/MoleculeByFormulaAction.hpp \
 	SelectionAction/MoleculeByIdAction.hpp \
+	SelectionAction/MoleculeOfAtomAction.hpp \
 	SelectionAction/NotAllAtomsAction.hpp \
+	SelectionAction/NotAllAtomsInsideCuboidAction.hpp \
+	SelectionAction/NotAllAtomsInsideSphereAction.hpp \
+	SelectionAction/NotAllAtomsOfMoleculeAction.hpp \
 	SelectionAction/NotAllMoleculesAction.hpp \
+	SelectionAction/NotAtomByElementAction.hpp \
 	SelectionAction/NotAtomByIdAction.hpp \
-	SelectionAction/NotMoleculeByIdAction.hpp
+	SelectionAction/NotMoleculeByFormulaAction.hpp \
+	SelectionAction/NotMoleculeByIdAction.hpp \
+	SelectionAction/NotMoleculeOfAtomAction.cpp
 
 TESSELATIONACTIONSOURCE = \
@@ -146,5 +182,4 @@
   WorldAction/InputAction.cpp \
   WorldAction/OutputAction.cpp \
-  WorldAction/RemoveSphereOfAtomsAction.cpp \
   WorldAction/RepeatBoxAction.cpp \
   WorldAction/ScaleBoxAction.cpp \
@@ -160,5 +195,4 @@
   WorldAction/InputAction.hpp \
   WorldAction/OutputAction.hpp \
-  WorldAction/RemoveSphereOfAtomsAction.hpp \
   WorldAction/RepeatBoxAction.hpp \
   WorldAction/ScaleBoxAction.hpp \
@@ -170,5 +204,7 @@
 lib_LTLIBRARIES = libMolecuilderActions-@MOLECUILDER_API_VERSION@.la
 libMolecuilderActions_includedir = $(includedir)/molecuilder-$(MOLECUILDER_API_VERSION)/Actions/
-libMolecuilderActions_libs = ../Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la
+libMolecuilderActions_libs = \
+	../Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la \
+	../UIElements/libMolecuilderUI-@MOLECUILDER_API_VERSION@.la
 nobase_libMolecuilderActions_include_HEADERS = ${ACTIONSHEADER}
 
@@ -209,2 +245,9 @@
 pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc
 
+unity.cpp:
+	echo "" >  unity.cpp; \
+	list='$(ACTIONSSOURCE)'; for file in $$list; do \
+	  echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
+	done;
+	
+MOSTLYCLEANFILES = unity.cpp
Index: src/Actions/MakroAction.cpp
===================================================================
--- src/Actions/MakroAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MakroAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MakroAction.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -44,4 +56,7 @@
 }
 
+void MakroAction::getParametersfromValueStorage()
+{};
+
 Dialog* MakroAction::fillDialog(Dialog *dialog) {
   return actions->fillAllDialogs(dialog);
Index: src/Actions/MakroAction.hpp
===================================================================
--- src/Actions/MakroAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MakroAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -32,4 +32,5 @@
   virtual Dialog *fillDialog(Dialog *dialog);
 private:
+  virtual void getParametersfromValueStorage();
   virtual Action::state_ptr performCall();
   virtual Action::state_ptr performUndo(Action::state_ptr);
Index: src/Actions/ManipulateAtomsProcess.cpp
===================================================================
--- src/Actions/ManipulateAtomsProcess.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ManipulateAtomsProcess.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ManipulateAtomsProcess.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -26,4 +38,7 @@
 ManipulateAtomsProcess::~ManipulateAtomsProcess()
 {}
+
+void ManipulateAtomsProcess::getParametersfromValueStorage()
+{};
 
 Dialog* ManipulateAtomsProcess::fillDialog(Dialog *dialog){
Index: src/Actions/ManipulateAtomsProcess.hpp
===================================================================
--- src/Actions/ManipulateAtomsProcess.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ManipulateAtomsProcess.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -31,4 +31,5 @@
   virtual Dialog * fillDialog(Dialog*);
 private:
+  virtual void getParametersfromValueStorage();
   virtual Action::state_ptr performCall();
   virtual Action::state_ptr performUndo(Action::state_ptr);
Index: src/Actions/MapOfActions.cpp
===================================================================
--- src/Actions/MapOfActions.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MapOfActions.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MapOfActions.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -26,10 +38,11 @@
 #include "CommandLineParser.hpp"
 #include "element.hpp"
-#include "log.hpp"
-#include "Matrix.hpp"
+#include "Helpers/Log.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "molecule.hpp"
 #include "periodentafel.hpp"
-#include "vector.hpp"
-#include "verbose.hpp"
+#include "LinearAlgebra/BoxVector.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Verbose.hpp"
 
 #include "Actions/ActionRegistry.hpp"
@@ -42,10 +55,13 @@
 #include "Actions/AtomAction/ChangeElementAction.hpp"
 #include "Actions/AtomAction/RemoveAction.hpp"
-#include "Actions/CmdAction/BondLengthTableAction.hpp"
-#include "Actions/CmdAction/ElementDbAction.hpp"
-#include "Actions/CmdAction/FastParsingAction.hpp"
-#include "Actions/CmdAction/HelpAction.hpp"
-#include "Actions/CmdAction/VerboseAction.hpp"
-#include "Actions/CmdAction/VersionAction.hpp"
+#include "Actions/AtomAction/RotateAroundOriginByAngleAction.hpp"
+#include "Actions/AtomAction/TranslateAction.hpp"
+#include "Actions/CommandAction/BondLengthTableAction.hpp"
+#include "Actions/CommandAction/ElementDbAction.hpp"
+#include "Actions/CommandAction/FastParsingAction.hpp"
+#include "Actions/CommandAction/HelpAction.hpp"
+#include "Actions/CommandAction/VerboseAction.hpp"
+#include "Actions/CommandAction/VersionAction.hpp"
+#include "Actions/FragmentationAction/ConstructBondGraphAction.hpp"
 #include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
 #include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
@@ -53,6 +69,8 @@
 #include "Actions/MoleculeAction/BondFileAction.hpp"
 #include "Actions/MoleculeAction/ChangeNameAction.hpp"
+#include "Actions/MoleculeAction/CopyAction.hpp"
 #include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
 #include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
+#include "Actions/MoleculeAction/RotateAroundSelfByAngleAction.hpp"
 #include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"
 #include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
@@ -60,16 +78,29 @@
 #include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
 #include "Actions/MoleculeAction/SuspendInWaterAction.hpp"
-#include "Actions/MoleculeAction/TranslateAction.hpp"
 #include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
 #include "Actions/ParserAction/LoadXyzAction.hpp"
 #include "Actions/ParserAction/SaveXyzAction.hpp"
 #include "Actions/SelectionAction/AllAtomsAction.hpp"
+#include "Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp"
+#include "Actions/SelectionAction/AllAtomsInsideSphereAction.hpp"
+#include "Actions/SelectionAction/AllAtomsOfMoleculeAction.hpp"
 #include "Actions/SelectionAction/AllMoleculesAction.hpp"
+#include "Actions/SelectionAction/AtomByElementAction.hpp"
 #include "Actions/SelectionAction/AtomByIdAction.hpp"
+#include "Actions/SelectionAction/ClearAllAtomsAction.hpp"
+#include "Actions/SelectionAction/ClearAllMoleculesAction.hpp"
+#include "Actions/SelectionAction/MoleculeByFormulaAction.hpp"
 #include "Actions/SelectionAction/MoleculeByIdAction.hpp"
+#include "Actions/SelectionAction/MoleculeOfAtomAction.hpp"
 #include "Actions/SelectionAction/NotAllAtomsAction.hpp"
+#include "Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp"
+#include "Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp"
+#include "Actions/SelectionAction/NotAllAtomsOfMoleculeAction.hpp"
 #include "Actions/SelectionAction/NotAllMoleculesAction.hpp"
+#include "Actions/SelectionAction/NotAtomByElementAction.hpp"
 #include "Actions/SelectionAction/NotAtomByIdAction.hpp"
+#include "Actions/SelectionAction/NotMoleculeByFormulaAction.hpp"
 #include "Actions/SelectionAction/NotMoleculeByIdAction.hpp"
+#include "Actions/SelectionAction/NotMoleculeOfAtomAction.hpp"
 #include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
 #include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp"
@@ -81,5 +112,4 @@
 #include "Actions/WorldAction/InputAction.hpp"
 #include "Actions/WorldAction/OutputAction.hpp"
-#include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp"
 #include "Actions/WorldAction/RepeatBoxAction.hpp"
 #include "Actions/WorldAction/ScaleBoxAction.hpp"
@@ -182,5 +212,9 @@
   DescriptionMap["change-element"] = "change the element of an atom";
   DescriptionMap["change-molname"] = "change the name of a molecule";
+  DescriptionMap["clear-atom-selection"] = "clear the atom selection";
+  DescriptionMap["clear-molecule-selection"] = "clear the molecule selection";
+  DescriptionMap["construct-bondgraph"] = "construct the bond graph of the selected atoms";
   DescriptionMap["convex-envelope"] = "create the convex envelope for a molecule";
+  DescriptionMap["copy-molecule"] = "copies a molecule with all atoms and bonds";
   DescriptionMap["default-molname"] = "set the default name of new molecules";
   DescriptionMap["depth-first-search"] = "Depth-First Search analysis of the molecular system";
@@ -200,7 +234,9 @@
   DescriptionMap["point-correlation"] = "pair correlation analysis between element and point";
   DescriptionMap["principal-axis-system"] = "calculate the principal axis system of the specified molecule";
+  DescriptionMap["redo"] = "redo last action";
   DescriptionMap["remove-atom"] = "remove a specified atom";
-  DescriptionMap["remove-sphere"] = "remove sphere of atoms of around a specified atom";
   DescriptionMap["repeat-box"] = "create periodic copies of the simulation box per axis";
+  DescriptionMap["rotate-origin"] = "rotate selected atoms by a specific angle around origin";
+  DescriptionMap["rotate-self"] = "rotates molecules by a specific angle around own center of gravity";
   DescriptionMap["rotate-to-pas"] = "calculate the principal axis system of the specified molecule and rotate specified axis to align with main axis";
   DescriptionMap["save-adjacency"] = "name of the adjacency file to write to";
@@ -211,6 +247,12 @@
   DescriptionMap["select-all-atoms"] = "select all atoms";
   DescriptionMap["select-all-molecules"] = "select all molecules";
+  DescriptionMap["select-atom-by-element"] = "select an atom by element";
   DescriptionMap["select-atom-by-id"] = "select an atom by index";
+  DescriptionMap["select-atoms-inside-cuboid"] = "select all atoms inside a cuboid";
+  DescriptionMap["select-atoms-inside-sphere"] = "select all atoms inside a sphere";
   DescriptionMap["select-molecule-by-id"] = "select a molecule by index";
+  DescriptionMap["select-molecule-by-formula"] = "select a molecule by chemical formula";
+  DescriptionMap["select-molecule-of-atom"] = "select a molecule to which a given atom belongs";
+  DescriptionMap["select-molecules-atoms"] = "select all atoms of a molecule";
   DescriptionMap["set-basis"] = "set the name of the gaussian basis set for MPQC";
   DescriptionMap["set-output"] = "specify output formats";
@@ -218,13 +260,23 @@
   DescriptionMap["surface-correlation"] = "pair correlation analysis between element and surface";
   DescriptionMap["suspend-in-water"] = "suspend the given molecule in water such that in the domain the mean density is as specified";
-  DescriptionMap["translate-mol"] = "translate molecule by given vector";
+  DescriptionMap["translate-atoms"] = "translate all selected atoms by given vector";
+  DescriptionMap["undo"] = "undo last action";
   DescriptionMap["unselect-all-atoms"] = "unselect all atoms";
   DescriptionMap["unselect-all-molecules"] = "unselect all molecules";
+  DescriptionMap["unselect-atom-by-element"] = "unselect an atom by element";
   DescriptionMap["unselect-atom-by-id"] = "unselect an atom by index";
+  DescriptionMap["unselect-atoms-inside-cuboid"] = "unselect all atoms inside a cuboid";
+  DescriptionMap["unselect-atoms-inside-sphere"] = "unselect all atoms inside a sphere";
+  DescriptionMap["unselect-molecule-by-formula"] = "unselect a molecule by chemical formula";
   DescriptionMap["unselect-molecule-by-id"] = "unselect a molecule by index";
+  DescriptionMap["unselect-molecule-of-atom"] = "unselect a molecule to which a given atom belongs";
+  DescriptionMap["unselect-molecules-atoms"] = "unselect all atoms of a molecule";
   DescriptionMap["verbose"] = "set verbosity level";
   DescriptionMap["verlet-integrate"] = "perform verlet integration of a given force file";
   DescriptionMap["version"] = "show version";
   // keys for values
+  DescriptionMap["angle-x"] = "angle of a rotation around x axis";
+  DescriptionMap["angle-y"] = "angle of a rotation around y axis";
+  DescriptionMap["angle-z"] = "angle of a rotation around z axis";
   DescriptionMap["bin-output-file"] = "name of the bin output file";
   DescriptionMap["bin-end"] = "start of the last bin";
@@ -275,5 +327,4 @@
   ShortFormMap["parse-xyz"] = "p";
   ShortFormMap["remove-atom"] = "r";
-  ShortFormMap["remove-sphere"] = "R";
   ShortFormMap["repeat-box"] = "d";
   ShortFormMap["rotate-to-pas"] = "m";
@@ -286,5 +337,5 @@
   ShortFormMap["subgraph-dissect"] = "I";
   ShortFormMap["suspend-in-water"] = "u";
-  ShortFormMap["translate-mol"] = "t";
+  ShortFormMap["translate-atoms"] = "t";
   ShortFormMap["verbose"] = "v";
   ShortFormMap["verlet-integrate"] = "P";
@@ -292,5 +343,5 @@
 
   // value types for the actions
-  TypeMap["add-atom"] = &typeid(element);
+  TypeMap["add-atom"] = &typeid(const element);
   TypeMap["bond-file"] = &typeid(std::string);
   TypeMap["bond-table"] = &typeid(std::string);
@@ -298,7 +349,11 @@
   TypeMap["center-in-box"] = &typeid(BoxValue);
   TypeMap["change-box"] = &typeid(BoxValue);
-  TypeMap["change-element"] = &typeid(element);
+  TypeMap["change-element"] = &typeid(const element);
   TypeMap["change-molname"] = &typeid(std::string);
+  TypeMap["clear-atom-selection"] = &typeid(void);
+  TypeMap["clear-molecule-selection"] = &typeid(void);
+  TypeMap["construct-bondgraph"] = &typeid(void);
   TypeMap["convex-envelope"] = &typeid(void);
+  TypeMap["copy-molecule"] = &typeid(molecule);
   TypeMap["default-molname"] = &typeid(std::string);
   TypeMap["depth-first-search"] = &typeid(double);
@@ -316,12 +371,24 @@
   TypeMap["point-correlation"] = &typeid(void);
   TypeMap["principal-axis-system"] = &typeid(void);
+  TypeMap["redo"] = &typeid(void);
   TypeMap["remove-atom"] = &typeid(void);
-  TypeMap["remove-sphere"] = &typeid(double);
   TypeMap["repeat-box"] = &typeid(VectorValue);
-  TypeMap["rotate-to-pas"] = &typeid(molecule);
+  TypeMap["rotate-origin"] = &typeid(double);
+  TypeMap["rotate-self"] = &typeid(double);
+  TypeMap["rotate-to-pas"] = &typeid(VectorValue);
   TypeMap["save-adjacency"] = &typeid(std::string);
   TypeMap["save-bonds"] = &typeid(std::string);
   TypeMap["save-temperature"] = &typeid(std::string);
   TypeMap["scale-box"] = &typeid(VectorValue);
+  TypeMap["select-all-atoms"] = &typeid(void);
+  TypeMap["select-all-molecules"] = &typeid(void);
+  TypeMap["select-atom-by-element"] = &typeid(const element);
+  TypeMap["select-atom-by-id"] = &typeid(atom);
+  TypeMap["select-atoms-inside-cuboid"] = &typeid(VectorValue);
+  TypeMap["select-atoms-inside-sphere"] = &typeid(double);
+  TypeMap["select-molecule-by-formula"] = &typeid(std::string);
+  TypeMap["select-molecule-by-id"] = &typeid(molecule);
+  TypeMap["select-molecule-of-atom"] = &typeid(atom);
+  TypeMap["select-molecules-atoms"] = &typeid(molecule);
   TypeMap["set-basis"] = &typeid(std::string);
   TypeMap["set-output"] = &typeid(std::vector<std::string>);
@@ -329,9 +396,23 @@
   TypeMap["surface-correlation"] = &typeid(void);
   TypeMap["suspend-in-water"] = &typeid(double);
-  TypeMap["translate-mol"] = &typeid(VectorValue);
+  TypeMap["translate-atoms"] = &typeid(VectorValue);
+  TypeMap["undo"] = &typeid(void);
+  TypeMap["unselect-all-atoms"] = &typeid(void);
+  TypeMap["unselect-all-molecules"] = &typeid(void);
+  TypeMap["unselect-atom-by-element"] = &typeid(const element);
+  TypeMap["unselect-atom-by-id"] = &typeid(atom);
+  TypeMap["unselect-atoms-inside-cuboid"] = &typeid(VectorValue);
+  TypeMap["unselect-atoms-inside-sphere"] = &typeid(double);
+  TypeMap["unselect-molecule-by-formula"] = &typeid(std::string);
+  TypeMap["unselect-molecule-by-id"] = &typeid(molecule);
+  TypeMap["unselect-molecule-of-atom"] = &typeid(atom);
+  TypeMap["unselect-molecules-atoms"] = &typeid(molecule);
   TypeMap["verlet-integrate"] = &typeid(std::string);
   TypeMap["verbose"] = &typeid(int);
 
   // value types for the values
+  TypeMap["angle-x"] = &typeid(double);
+  TypeMap["angle-y"] = &typeid(double);
+  TypeMap["angle-z"] = &typeid(double);
   TypeMap["bin-output-file"] = &typeid(std::string);
   TypeMap["bin-end"] = &typeid(double);
@@ -342,6 +423,6 @@
   TypeMap["distances"] = &typeid(VectorValue);
   TypeMap["DoRotate"] = &typeid(bool);
-  TypeMap["element"] = &typeid(element);
-  TypeMap["elements"] = &typeid(std::vector<element *>);
+  TypeMap["element"] = &typeid(const element);
+  TypeMap["elements"] = &typeid(std::vector<const element *>);
   TypeMap["end-step"] = &typeid(int);
   TypeMap["id-mapping"] = &typeid(bool);
@@ -355,13 +436,5 @@
   TypeMap["periodic"] = &typeid(bool);
   TypeMap["position"] = &typeid(VectorValue);
-  TypeMap["select-all-atoms"] = &typeid(void);
-  TypeMap["select-all-molecules"] = &typeid(void);
-  TypeMap["select-atom-by-id"] = &typeid(atom);
-  TypeMap["select-molecule-by-id"] = &typeid(molecule);
   TypeMap["start-step"] = &typeid(int);
-  TypeMap["unselect-all-atoms"] = &typeid(void);
-  TypeMap["unselect-all-molecules"] = &typeid(void);
-  TypeMap["unselect-atom-by-id"] = &typeid(atom);
-  TypeMap["unselect-molecule-by-id"] = &typeid(molecule);
 
   TypeEnumMap[&typeid(void)] = None;
@@ -380,6 +453,6 @@
   TypeEnumMap[&typeid(atom)] = Atom;
   TypeEnumMap[&typeid(std::vector<atom *>)] = ListOfAtoms;
-  TypeEnumMap[&typeid(element)] = Element;
-  TypeEnumMap[&typeid(std::vector<element *>)] = ListOfElements;
+  TypeEnumMap[&typeid(const element)] = Element;
+  TypeEnumMap[&typeid(std::vector<const element *>)] = ListOfElements;
 
   // default values for any action that needs one (always string!)
@@ -408,4 +481,5 @@
   MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "change-element") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "remove-atom") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "translate-atoms") );
 
   MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "bond-table") );
@@ -415,4 +489,5 @@
   MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "version") );
 
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "construct-bondgraph") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "depth-first-search") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "fragment-mol") );
@@ -420,7 +495,10 @@
 
   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "bond-file") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "copy-molecule") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "change-molname") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "fill-molecule") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "linear-interpolate") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-origin") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-self") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-to-pas") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-adjacency") );
@@ -428,5 +506,4 @@
   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-temperature") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "suspend-in-water") );
-  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "translate-mol") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "verlet-integrate") );
 
@@ -434,8 +511,26 @@
   MenuContainsActionMap.insert( pair<std::string, std::string> ("parser", "SaveXyz") );
 
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "clear-atom-selection") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "clear-molecule-selection") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-all-atoms") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-all-molecules") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atom-by-element") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atom-by-id") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atoms-inside-cuboid") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atoms-inside-sphere") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecule-by-id") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecule-by-formula") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecule-of-atom") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecules-atoms") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-all-atoms") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-all-molecules") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atom-by-element") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atom-by-id") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atoms-inside-cuboid") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atoms-inside-sphere") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecule-by-formula") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecule-by-id") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecule-of-atom") );
+  MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecules-atoms") );
 
   MenuContainsActionMap.insert( pair<std::string, std::string> ("tesselation", "convex-envelope") );
@@ -449,5 +544,4 @@
   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "input") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "output") );
-  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "remove-sphere") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "repeat-box") );
   MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "scale-box") );
@@ -466,6 +560,10 @@
 	generic.insert("change-box");
 //  generic.insert("change-molname");
-	generic.insert("change-element");
+  generic.insert("change-element");
+  generic.insert("clear-atom-selection");
+  generic.insert("clear-molecule-selection");
+  generic.insert("construct-bondgraph");
   generic.insert("convex-envelope");
+  generic.insert("copy-molecule");
 	generic.insert("default-molname");
 	generic.insert("depth-first-search");
@@ -484,7 +582,9 @@
   generic.insert("point-correlation");
 //  generic.insert("principal-axis-system");
+  generic.insert("redo");
   generic.insert("remove-atom");
-  generic.insert("remove-sphere");
   generic.insert("repeat-box");
+  generic.insert("rotate-origin");
+  generic.insert("rotate-self");
   generic.insert("rotate-to-pas");
 	generic.insert("save-adjacency");
@@ -494,6 +594,12 @@
   generic.insert("select-all-atoms");
   generic.insert("select-all-molecules");
+  generic.insert("select-atom-by-element");
   generic.insert("select-atom-by-id");
+  generic.insert("select-atoms-inside-cuboid");
+  generic.insert("select-atoms-inside-sphere");
   generic.insert("select-molecule-by-id");
+  generic.insert("select-molecule-by-formula");
+  generic.insert("select-molecule-of-atom");
+  generic.insert("select-molecules-atoms");
   generic.insert("set-basis");
   generic.insert("set-output");
@@ -501,9 +607,16 @@
   generic.insert("surface-correlation");
   generic.insert("suspend-in-water");
-  generic.insert("translate-mol");
+  generic.insert("translate-atoms");
+  generic.insert("undo");
   generic.insert("unselect-all-atoms");
   generic.insert("unselect-all-molecules");
+  generic.insert("unselect-atom-by-element");
   generic.insert("unselect-atom-by-id");
+  generic.insert("unselect-atoms-inside-cuboid");
+  generic.insert("unselect-atoms-inside-sphere");
+  generic.insert("unselect-molecule-by-formula");
   generic.insert("unselect-molecule-by-id");
+  generic.insert("unselect-molecule-of-atom");
+  generic.insert("unselect-molecules-atoms");
 	generic.insert("verbose");
   generic.insert("verlet-integrate");
@@ -514,4 +627,7 @@
 
     // hidden arguments
+  hidden.insert("angle-x");
+  hidden.insert("angle-y");
+  hidden.insert("angle-z");
   hidden.insert("bin-end");
   hidden.insert("bin-output-file");
@@ -545,4 +661,9 @@
 }
 
+bool MapOfActions::isCurrentValuePresent(const char *name) const
+{
+  return (CurrentValue.find(name) != CurrentValue.end());
+}
+
 void MapOfActions::queryCurrentValue(const char * name, class atom * &_T)
 {
@@ -558,7 +679,7 @@
 }
 
-void MapOfActions::queryCurrentValue(const char * name, class element * &_T)  {
+void MapOfActions::queryCurrentValue(const char * name, const element * &_T)  {
   int Z = -1;
-  if (typeid( element ) == *TypeMap[name]) {
+  if (typeid(const element ) == *TypeMap[name]) {
     if (CurrentValue.find(name) == CurrentValue.end())
       throw MissingValueException(__FILE__, __LINE__);
@@ -621,4 +742,15 @@
 }
 
+void MapOfActions::queryCurrentValue(const char * name, class BoxVector &_T) {
+  if (typeid( VectorValue ) == *TypeMap[name]) {
+    std::istringstream stream(CurrentValue[name]);
+    CurrentValue.erase(name);
+    stream >> _T[0];
+    stream >> _T[1];
+    stream >> _T[2];
+  } else
+    throw IllegalTypeException(__FILE__,__LINE__);
+}
+
 void MapOfActions::queryCurrentValue(const char * name, std::vector<atom *>&_T)
 {
@@ -642,9 +774,9 @@
 }
 
-void MapOfActions::queryCurrentValue(const char * name, std::vector<element *>&_T)
+void MapOfActions::queryCurrentValue(const char * name, std::vector<const element *>&_T)
 {
   int Z = -1;
-  element *elemental = NULL;
-  if (typeid( std::vector<element *> ) == *TypeMap[name]) {
+  const element *elemental = NULL;
+  if (typeid( std::vector<const element *> ) == *TypeMap[name]) {
     if (CurrentValue.find(name) == CurrentValue.end())
       throw MissingValueException(__FILE__, __LINE__);
@@ -694,9 +826,9 @@
 }
 
-void MapOfActions::setCurrentValue(const char * name, class element * &_T)
-{
-  if (typeid( element ) == *TypeMap[name]) {
+void MapOfActions::setCurrentValue(const char * name, const element * &_T)
+{
+  if (typeid(const element ) == *TypeMap[name]) {
     std::ostringstream stream;
-    stream << _T->Z;
+    stream << _T->getAtomicNumber();
     CurrentValue[name] = stream.str();
   } else
@@ -742,4 +874,16 @@
 }
 
+void MapOfActions::setCurrentValue(const char * name, class BoxVector &_T)
+{
+  if (typeid( VectorValue ) == *TypeMap[name]){
+    std::ostringstream stream;
+    stream << _T[0] << " ";
+    stream << _T[1] << " ";
+    stream << _T[2] << " ";
+    CurrentValue[name] = stream.str();
+  } else
+    throw IllegalTypeException(__FILE__,__LINE__);
+}
+
 void MapOfActions::setCurrentValue(const char * name, std::vector<atom *>&_T)
 {
@@ -754,10 +898,10 @@
 }
 
-void MapOfActions::setCurrentValue(const char * name, std::vector<element *>&_T)
-{
-  if (typeid( std::vector<element *> ) == *TypeMap[name]) {
+void MapOfActions::setCurrentValue(const char * name, std::vector<const element *>&_T)
+{
+  if (typeid( std::vector<const element *> ) == *TypeMap[name]) {
     std::ostringstream stream;
-    for (std::vector<element *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) {
-      stream << (*iter)->Z << " ";
+    for (std::vector<const element *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) {
+      stream << (*iter)->getAtomicNumber() << " ";
     }
     CurrentValue[name] = stream.str();
@@ -791,12 +935,15 @@
   new AtomChangeElementAction();
   new AtomRemoveAction();
-
-  new CommandLineBondLengthTableAction();
-  new CommandLineElementDbAction();
-  new CommandLineFastParsingAction();
-  new CommandLineHelpAction();
-  new CommandLineVerboseAction();
-  new CommandLineVersionAction();
-
+  new AtomRotateAroundOriginByAngleAction();
+  new AtomTranslateAction();
+
+  new CommandBondLengthTableAction();
+  new CommandElementDbAction();
+  new CommandFastParsingAction();
+  new CommandHelpAction();
+  new CommandVerboseAction();
+  new CommandVersionAction();
+
+  new FragmentationConstructBondGraphAction();
   new FragmentationDepthFirstSearchAction();
   new FragmentationFragmentationAction();
@@ -805,6 +952,8 @@
   new MoleculeBondFileAction();
   new MoleculeChangeNameAction();
+  new MoleculeCopyAction();
   new MoleculeFillWithMoleculeAction();
   new MoleculeLinearInterpolationofTrajectoriesAction();
+  new MoleculeRotateAroundSelfByAngleAction();
   new MoleculeRotateToPrincipalAxisSystemAction();
   new MoleculeSaveAdjacencyAction();
@@ -812,5 +961,4 @@
   new MoleculeSaveTemperatureAction();
   new MoleculeSuspendInWaterAction();
-  new MoleculeTranslateAction();
   new MoleculeVerletIntegrationAction();
 
@@ -818,12 +966,26 @@
   new ParserSaveXyzAction();
 
+  new SelectionClearAllAtomsAction();
+  new SelectionClearAllMoleculesAction();
   new SelectionAllAtomsAction();
+  new SelectionAllAtomsInsideCuboidAction();
+  new SelectionAllAtomsInsideSphereAction();
+  new SelectionAllAtomsOfMoleculeAction();
   new SelectionAllMoleculesAction();
+  new SelectionAtomByElementAction();
   new SelectionAtomByIdAction();
   new SelectionMoleculeByIdAction();
+  new SelectionMoleculeByFormulaAction();
+  new SelectionMoleculeOfAtomAction();
   new SelectionNotAllAtomsAction();
+  new SelectionNotAllAtomsInsideCuboidAction();
+  new SelectionNotAllAtomsInsideSphereAction();
+  new SelectionNotAllAtomsOfMoleculeAction();
   new SelectionNotAllMoleculesAction();
+  new SelectionNotAtomByElementAction();
   new SelectionNotAtomByIdAction();
+  new SelectionNotMoleculeByFormulaAction();
   new SelectionNotMoleculeByIdAction();
+  new SelectionNotMoleculeOfAtomAction();
 
   new TesselationConvexEnvelopeAction();
@@ -837,5 +999,4 @@
   new WorldInputAction();
   new WorldOutputAction();
-  new WorldRemoveSphereOfAtomsAction();
   new WorldRepeatBoxAction();
   new WorldScaleBoxAction();
Index: src/Actions/MapOfActions.hpp
===================================================================
--- src/Actions/MapOfActions.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MapOfActions.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,4 +10,5 @@
 
 #include <boost/program_options.hpp>
+#include <boost/lexical_cast.hpp>
 
 #include <map>
@@ -162,11 +163,13 @@
   void populateActions();
 
+  bool isCurrentValuePresent(const char *name) const;
   void queryCurrentValue(const char * name, class atom * &_T);
-  void queryCurrentValue(const char * name, class element * &_T);
+  void queryCurrentValue(const char * name, const element * &_T);
   void queryCurrentValue(const char * name, class molecule * &_T);
   void queryCurrentValue(const char * name, class Box &_T);
   void queryCurrentValue(const char * name, class Vector &_T);
+  void queryCurrentValue(const char * name, class BoxVector &_T);
   void queryCurrentValue(const char * name, std::vector<atom *>&_T);
-  void queryCurrentValue(const char * name, std::vector<element *>&_T);
+  void queryCurrentValue(const char * name, std::vector<const element *>&_T);
   void queryCurrentValue(const char * name, std::vector<molecule *>&_T);
   template<typename T> void queryCurrentValue(const char * name, T &_T)
@@ -197,10 +200,11 @@
 
   void setCurrentValue(const char * name, class atom * &_T);
-  void setCurrentValue(const char * name, class element * &_T);
+  void setCurrentValue(const char * name, const element * &_T);
   void setCurrentValue(const char * name, class molecule * &_T);
   void setCurrentValue(const char * name, class Box &_T);
   void setCurrentValue(const char * name, class Vector &_T);
+  void setCurrentValue(const char * name, class BoxVector &_T);
   void setCurrentValue(const char * name, std::vector<atom *>&_T);
-  void setCurrentValue(const char * name, std::vector<element *>&_T);
+  void setCurrentValue(const char * name, std::vector<const element *>&_T);
   void setCurrentValue(const char * name, std::vector<molecule *>&_T);
   template<class T> void setCurrentValue(const char * name, T &_T)
Index: src/Actions/MethodAction.cpp
===================================================================
--- src/Actions/MethodAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MethodAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MethodAction.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -25,4 +37,7 @@
 MethodAction::~MethodAction()
 {}
+
+void MethodAction::getParametersfromValueStorage()
+{};
 
 Dialog* MethodAction::fillDialog(Dialog *dialog) {
Index: src/Actions/MethodAction.hpp
===================================================================
--- src/Actions/MethodAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MethodAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -28,4 +28,5 @@
   virtual Dialog * fillDialog(Dialog *dialog);
 private:
+  virtual void getParametersfromValueStorage();
   virtual Action::state_ptr performCall();
   virtual Action::state_ptr performUndo(Action::state_ptr);
Index: src/Actions/MoleculeAction/BondFileAction.cpp
===================================================================
--- src/Actions/MoleculeAction/BondFileAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/BondFileAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * BondFileAction.cpp
@@ -6,11 +13,14 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/MoleculeAction/BondFileAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -21,55 +31,20 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/MoleculeAction/BondFileAction.hpp"
 
-
-/****** MoleculeBondFileAction *****/
-
-// memento to remember the state when undoing
-
-//class MoleculeBondFileState : public ActionState {
-//public:
-//  MoleculeBondFileState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char MoleculeBondFileAction::NAME[] = "bond-file";
-
-MoleculeBondFileAction::MoleculeBondFileAction() :
-  Action(NAME)
-{}
-
-MoleculeBondFileAction::~MoleculeBondFileAction()
-{}
-
-void MoleculeBondFile(std::string &bondfile) {
-  ValueStorage::getInstance().setCurrentValue(MoleculeBondFileAction::NAME, bondfile);
-  ActionRegistry::getInstance().getActionByName(MoleculeBondFileAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* MoleculeBondFileAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, MapOfActions::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "BondFileAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr MoleculeBondFileAction::performCall() {
-  string filename;
   molecule *mol = NULL;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
+  // obtain information
+  getParametersfromValueStorage();
 
   if(World::getInstance().countSelectedMolecules() == 1) {
     mol = World::getInstance().beginMoleculeSelection()->second;
-    DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << filename << "." << endl);
-    ifstream input(filename.c_str());
+    DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << params.bondfile << "." << endl);
+    ifstream input(params.bondfile.c_str());
     mol->CreateAdjacencyListFromDbondFile(&input);
     input.close();
@@ -104,2 +79,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/BondFileAction.def
===================================================================
--- src/Actions/MoleculeAction/BondFileAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/BondFileAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * BondFileAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class MoleculeListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (MoleculeBondFileAction::NAME)
+#define paramreferences (bondfile)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME BondFile
+#define TOKEN "bond-file"
+
Index: src/Actions/MoleculeAction/BondFileAction.hpp
===================================================================
--- src/Actions/MoleculeAction/BondFileAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/BondFileAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,31 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-class MoleculeListClass;
-
-void MoleculeBondFile(std::string &bondfile);
-
-class MoleculeBondFileAction : public Action {
-  friend void MoleculeBondFile(std::string &bondfile);
-
-public:
-  MoleculeBondFileAction();
-  virtual ~MoleculeBondFileAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
+#include "BondFileAction.def"
+#include "Action_impl_header.hpp"
 
 #endif // BONDFILEACTION_HPP
Index: src/Actions/MoleculeAction/ChangeNameAction.cpp
===================================================================
--- src/Actions/MoleculeAction/ChangeNameAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/ChangeNameAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ChangeNameAction.cpp
@@ -6,8 +13,11 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/MoleculeAction/ChangeNameAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "atom.hpp"
 #include "molecule.hpp"
@@ -18,55 +28,21 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/MoleculeAction/ChangeNameAction.hpp"
 
-/****** MoleculeChangeNameAction *****/
-
-// memento to remember the state when undoing
-
-class MoleculeChangeNameState : public ActionState {
-public:
-  MoleculeChangeNameState(molecule* _mol,std::string _lastName) :
-    mol(_mol),
-    lastName(_lastName)
-  {}
-  molecule* mol;
-  std::string lastName;
-};
-
-const char MoleculeChangeNameAction::NAME[] = "change-molname";
-
-MoleculeChangeNameAction::MoleculeChangeNameAction() :
-  Action(NAME)
-{}
-
-MoleculeChangeNameAction::~MoleculeChangeNameAction()
-{}
-
-void MoleculeChangeName(std::string &name) {
-  ValueStorage::getInstance().setCurrentValue(MoleculeChangeNameAction::NAME, name);
-  ActionRegistry::getInstance().getActionByName(MoleculeChangeNameAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* MoleculeChangeNameAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "ChangeNameAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr MoleculeChangeNameAction::performCall() {
-  string filename;
   molecule *mol = NULL;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
+  // obtain information
+  getParametersfromValueStorage();
 
   if (World::getInstance().countSelectedMolecules() == 1) {
     mol = World::getInstance().beginMoleculeSelection()->second;
     string oldName = mol->getName();
-    mol->setName(filename);
-    return Action::state_ptr(new MoleculeChangeNameState(mol,oldName));
+    mol->setName(params.name);
+    return Action::state_ptr(new MoleculeChangeNameState(mol,params));
   } else
     return Action::failure;
@@ -77,7 +53,8 @@
 
   string newName = state->mol->getName();
-  state->mol->setName(state->lastName);
+  state->mol->setName(state->params.name);
+  state->params.name = newName;
 
-  return Action::state_ptr(new MoleculeChangeNameState(state->mol,newName));
+  return Action::state_ptr(_state);
 }
 
@@ -98,2 +75,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/ChangeNameAction.def
===================================================================
--- src/Actions/MoleculeAction/ChangeNameAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/ChangeNameAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * ChangeNameAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class MoleculeListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (MoleculeChangeNameAction::NAME)
+#define paramreferences (name)
+
+#define statetypes (molecule*)
+#define statereferences (mol)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME ChangeName
+#define TOKEN "change-molname"
+
Index: src/Actions/MoleculeAction/ChangeNameAction.hpp
===================================================================
--- src/Actions/MoleculeAction/ChangeNameAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/ChangeNameAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,32 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-class MoleculeListClass;
-
-void MoleculeChangeName(std::string &name);
-
-class MoleculeChangeNameAction : public Action {
-  friend void MoleculeChangeName(std::string &name);
-
-public:
-  MoleculeChangeNameAction();
-  virtual ~MoleculeChangeNameAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  MoleculeListClass *molecules;
-  static const char NAME[];
-};
-
+#include "ChangeNameAction.def"
+#include "Action_impl_header.hpp"
 
 #endif // CHANGENAMEACTION_HPP
Index: src/Actions/MoleculeAction/CopyAction.cpp
===================================================================
--- src/Actions/MoleculeAction/CopyAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/CopyAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,97 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * CopyAction.cpp
+ *
+ *  Created on: May 10, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "atom.hpp"
+#include "bond.hpp"
+#include "molecule.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/MoleculeAction/CopyAction.hpp"
+
+// and construct the stuff
+#include "CopyAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr MoleculeCopyAction::performCall() {
+  molecule *copy = NULL;
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  copy = params.mol->CopyMolecule();
+  Vector *Center = params.mol->DetermineCenterOfAll();
+  *Center *= -1.;
+  *Center += params.position;
+  copy->Translate(Center);
+  delete(Center);
+
+  return Action::state_ptr(new MoleculeCopyState(copy,params));
+}
+
+Action::state_ptr MoleculeCopyAction::performUndo(Action::state_ptr _state) {
+  MoleculeCopyState *state = assert_cast<MoleculeCopyState*>(_state.get());
+
+  for (molecule::iterator AtomRunner = state->copy->begin(); !state->copy->empty(); AtomRunner = state->copy->begin()) {
+    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
+      delete(*BondRunner);
+    atom *Walker = *AtomRunner;
+    state->copy->erase(AtomRunner);
+    World::getInstance().destroyAtom(Walker);
+  }
+  World::getInstance().destroyMolecule(state->copy);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr MoleculeCopyAction::performRedo(Action::state_ptr _state){
+  MoleculeCopyState *state = assert_cast<MoleculeCopyState*>(_state.get());
+
+  molecule *copy = state->params.mol->CopyMolecule();
+  Vector *Center = state->params.mol->DetermineCenterOfAll();
+  *Center *= -1.;
+  *Center += state->params.position;
+  copy->Translate(Center);
+  delete(Center);
+
+  return Action::state_ptr(new MoleculeCopyState(copy,state->params));
+}
+
+bool MoleculeCopyAction::canUndo() {
+  return true;
+}
+
+bool MoleculeCopyAction::shouldUndo() {
+  return true;
+}
+
+const string MoleculeCopyAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/CopyAction.def
===================================================================
--- src/Actions/MoleculeAction/CopyAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/CopyAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * CopyAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class MoleculeListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (molecule *) (Vector)
+#define paramtokens (MoleculeCopyAction::NAME) ("position")
+#define paramreferences (mol) (position)
+
+#define statetypes (molecule *)
+#define statereferences (copy)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME Copy
+#define TOKEN "copy-molecule"
+
Index: src/Actions/MoleculeAction/CopyAction.hpp
===================================================================
--- src/Actions/MoleculeAction/CopyAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/CopyAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * CopyAction.hpp
+ *
+ *  Created on: May 10, 2010
+ *      Author: heber
+ */
+
+#ifndef COPYACTION_HPP
+#define COPYACTION_HPP
+
+#include "Actions/Action.hpp"
+
+#include "CopyAction.def"
+#include "Action_impl_header.hpp"
+
+#endif // COPYACTION_HPP
Index: src/Actions/MoleculeAction/FillWithMoleculeAction.cpp
===================================================================
--- src/Actions/MoleculeAction/FillWithMoleculeAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/FillWithMoleculeAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * FillWithMoleculeAction.cpp
@@ -6,8 +13,11 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "atom.hpp"
 #include "bondgraph.hpp"
@@ -15,5 +25,5 @@
 #include "config.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -24,72 +34,22 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
 
-/****** MoleculeFillWithMoleculeAction *****/
+// and construct the stuff
+#include "FillWithMoleculeAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr MoleculeFillWithMoleculeAction::performCall() {
 
-// memento to remember the state when undoing
+  // obtain information
+  getParametersfromValueStorage();
 
-//class MoleculeFillWithMoleculeState : public ActionState {
-//public:
-//  MoleculeFillWithMoleculeState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char MoleculeFillWithMoleculeAction::NAME[] = "fill-molecule";
-
-MoleculeFillWithMoleculeAction::MoleculeFillWithMoleculeAction() :
-  Action(NAME)
-{}
-
-MoleculeFillWithMoleculeAction::~MoleculeFillWithMoleculeAction()
-{}
-
-void MoleculeFillWithMolecule(std::string &fillername, Vector &distances, Vector &lengths, double MaxDistance, bool DoRotate) {
-  ValueStorage::getInstance().setCurrentValue(MoleculeFillWithMoleculeAction::NAME, fillername);
-  ValueStorage::getInstance().setCurrentValue("distances", distances);
-  ValueStorage::getInstance().setCurrentValue("lengths", lengths);
-  ValueStorage::getInstance().setCurrentValue("DoRotate", MaxDistance);
-  ValueStorage::getInstance().setCurrentValue("MaxDistance", DoRotate);
-  ActionRegistry::getInstance().getActionByName(MoleculeFillWithMoleculeAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* MoleculeFillWithMoleculeAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-  dialog->queryVector("distances", false, ValueStorage::getInstance().getDescription("distances"));
-  dialog->queryVector("lengths", false, ValueStorage::getInstance().getDescription("lengths"));
-  dialog->queryBoolean("DoRotate", ValueStorage::getInstance().getDescription("DoRotate"));
-  dialog->queryDouble("MaxDistance", ValueStorage::getInstance().getDescription("MaxDistance"));
-
-  return dialog;
-}
-
-Action::state_ptr MoleculeFillWithMoleculeAction::performCall() {
-  string filename;
-  Vector distances;
-  Vector lengths;
-  double MaxDistance = -1.;
-  bool DoRotate = false;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
-  ValueStorage::getInstance().queryCurrentValue("distances", distances);
-  ValueStorage::getInstance().queryCurrentValue("lengths", lengths);
-  ValueStorage::getInstance().queryCurrentValue("DoRotate", DoRotate);
-  ValueStorage::getInstance().queryCurrentValue("MaxDistance", MaxDistance);
-
-  DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules, lengths(" << lengths[0] << "," << lengths[1] << "," << lengths[2] << "), distances (" << distances[0] << "," << distances[1] << "," << distances[2] << "), MaxDistance " << MaxDistance << ", DoRotate " << DoRotate << "." << endl);
+  DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules, lengths(" << params.lengths[0] << "," << params.lengths[1] << "," << params.lengths[2] << "), distances (" << params.distances[0] << "," << params.distances[1] << "," << params.distances[2] << "), MaxDistance " << params.MaxDistance << ", DoRotate " << params.DoRotate << "." << endl);
   // construct water molecule
   molecule *filler = World::getInstance().createMolecule();
-  if (!filler->AddXYZFile(filename)) {
-    DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << filename << "." << endl);
+  if (!filler->AddXYZFile(params.fillername)) {
+    DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << params.fillername << "." << endl);
   }
-  filler->SetNameFromFilename(filename.c_str());
+  filler->SetNameFromFilename(params.fillername.c_str());
   molecule *Filling = NULL;
 //    atom *first = NULL, *second = NULL, *third = NULL;
@@ -113,6 +73,6 @@
   double distance[NDIM];
   for (int i=0;i<NDIM;i++)
-    distance[i] = distances[i];
-  Filling = FillBoxWithMolecule(World::getInstance().getMolecules(), filler, *(World::getInstance().getConfig()), MaxDistance, distance, lengths[0], lengths[1], lengths[2], DoRotate);
+    distance[i] = params.distances[i];
+  Filling = FillBoxWithMolecule(World::getInstance().getMolecules(), filler, *(World::getInstance().getConfig()), params.MaxDistance, distance, params.lengths[0], params.lengths[1], params.lengths[2], params.DoRotate);
   if (Filling != NULL) {
     Filling->ActiveFlag = false;
@@ -154,2 +114,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/FillWithMoleculeAction.def
===================================================================
--- src/Actions/MoleculeAction/FillWithMoleculeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/FillWithMoleculeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,26 @@
+/*
+ * FillWithMoleculeAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "LinearAlgebra/Vector.hpp"
+class MoleculeListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string) (Vector) (Vector) (double) (bool)
+#define paramtokens (MoleculeFillWithMoleculeAction::NAME) ("distances") ("lengths") ("MaxDistance") ("DoRotate")
+#define paramreferences (fillername) (distances) (lengths) (MaxDistance) (DoRotate)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME FillWithMolecule
+#define TOKEN "fill-molecule"
+
Index: src/Actions/MoleculeAction/FillWithMoleculeAction.hpp
===================================================================
--- src/Actions/MoleculeAction/FillWithMoleculeAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/FillWithMoleculeAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,32 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
-#include "vector.hpp"
 
-class MoleculeListClass;
-
-void MoleculeFillWithMolecule(std::string &fillername, Vector &distances, Vector &lengths, double MaxDistance, bool DoRotate);
-
-class MoleculeFillWithMoleculeAction : public Action {
-  friend void MoleculeFillWithMolecule(std::string &fillername, Vector &distances, Vector &lengths, double MaxDistance, bool DoRotate);
-
-public:
-  MoleculeFillWithMoleculeAction();
-  virtual ~MoleculeFillWithMoleculeAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
+#include "FillWithMoleculeAction.def"
+#include "Action_impl_header.hpp"
 
 #endif // FILLWITHMOLECULEACTION_HPP
Index: src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp
===================================================================
--- src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * LinearInterpolationofTrajectoriesAction.cpp
@@ -6,13 +13,16 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "atom.hpp"
 #include "defs.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -23,72 +33,25 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
 
+// and construct the stuff
+#include "LinearInterpolationofTrajectoriesAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr MoleculeLinearInterpolationofTrajectoriesAction::performCall() {
+  molecule *mol = NULL;
 
-/****** MoleculeLinearInterpolationofTrajectoriesAction *****/
-
-// memento to remember the state when undoing
-
-//class MoleculeLinearInterpolationofTrajectoriesState : public ActionState {
-//public:
-//  MoleculeLinearInterpolationofTrajectoriesState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char MoleculeLinearInterpolationofTrajectoriesAction::NAME[] = "linear-interpolate";
-
-MoleculeLinearInterpolationofTrajectoriesAction::MoleculeLinearInterpolationofTrajectoriesAction() :
-  Action(NAME)
-{}
-
-MoleculeLinearInterpolationofTrajectoriesAction::~MoleculeLinearInterpolationofTrajectoriesAction()
-{}
-
-void MoleculeLinearInterpolationofTrajectories(std::string &filename, int start, int end, bool IdMapping) {
-  ValueStorage::getInstance().setCurrentValue(MoleculeLinearInterpolationofTrajectoriesAction::NAME, filename);
-  ValueStorage::getInstance().setCurrentValue("start-step", start);
-  ValueStorage::getInstance().setCurrentValue("end-step", end);
-  ValueStorage::getInstance().setCurrentValue("id-mapping", IdMapping);
-  ActionRegistry::getInstance().getActionByName(MoleculeLinearInterpolationofTrajectoriesAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* MoleculeLinearInterpolationofTrajectoriesAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, MapOfActions::getInstance().getDescription(NAME));
-  dialog->queryInt("start-step", MapOfActions::getInstance().getDescription("start-step"));
-  dialog->queryInt("end-step", MapOfActions::getInstance().getDescription("end-step"));
-  dialog->queryBoolean("id-mapping", MapOfActions::getInstance().getDescription("id-mapping"));
-
-  return dialog;
-}
-
-Action::state_ptr MoleculeLinearInterpolationofTrajectoriesAction::performCall() {
-  string filename;
-  molecule *mol = NULL;
-  int start = -1;
-  int end = -1;
-  bool IdMapping = true;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
-  ValueStorage::getInstance().queryCurrentValue("start-step", start);
-  ValueStorage::getInstance().queryCurrentValue("end-step", end);
-  ValueStorage::getInstance().queryCurrentValue("id-mapping", IdMapping);
+  // obtain information
+  getParametersfromValueStorage();
 
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     mol = iter->second;
-    DoLog(1) && (Log() << Verbose(1) << "Linear interpolation between configuration " << start << " and " << end << "." << endl);
-    if (IdMapping)
+    DoLog(1) && (Log() << Verbose(1) << "Linear interpolation between configuration " << params.start << " and " << params.end << "." << endl);
+    if (params.IdMapping)
       DoLog(1) && (Log() << Verbose(1) << "Using Identity for the permutation map." << endl);
-    if (!mol->LinearInterpolationBetweenConfiguration(start, end, filename, *(World::getInstance().getConfig()), IdMapping))
-      DoLog(2) && (Log() << Verbose(2) << "Could not store " << filename << " files." << endl);
+    if (!mol->LinearInterpolationBetweenConfiguration(params.start, params.end, params.filename, *(World::getInstance().getConfig()), params.IdMapping))
+      DoLog(2) && (Log() << Verbose(2) << "Could not store " << params.filename << " files." << endl);
     else
-      DoLog(2) && (Log() << Verbose(2) << "Steps created and " << filename << " files stored." << endl);
+      DoLog(2) && (Log() << Verbose(2) << "Steps created and " << params.filename << " files stored." << endl);
   }
   return Action::success;
@@ -120,2 +83,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.def
===================================================================
--- src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * LinearInterpolationofTrajectoriesAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class MoleculeListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string) (int) (int) (bool)
+#define paramtokens (MoleculeLinearInterpolationofTrajectoriesAction::NAME) ("start-step") ("end-step") ("id-mapping")
+#define paramreferences (filename) (start) (end) (IdMapping)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME LinearInterpolationofTrajectories
+#define TOKEN "linear-interpolate"
+
Index: src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp
===================================================================
--- src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,31 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-class MoleculeListClass;
+#include "LinearInterpolationofTrajectoriesAction.def"
+#include "Action_impl_header.hpp"
 
-void MoleculeLinearInterpolationofTrajectories(std::string &filename, int start, int end, bool IdMapping);
-
-class MoleculeLinearInterpolationofTrajectoriesAction : public Action {
-  friend void MoleculeLinearInterpolationofTrajectories(std::string &filename, int start, int end, bool IdMapping);
-
-public:
-  MoleculeLinearInterpolationofTrajectoriesAction();
-  virtual ~MoleculeLinearInterpolationofTrajectoriesAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
-
-#endif // LINEARINTERPOLATIONOFTRAJECTORIES_HPP
+#endif /* LINEARINTERPOLATIONOFTRAJECTORIES_HPP */
Index: src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp
===================================================================
--- src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,113 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * RotateAroundSelfByAngleAction.cpp
+ *
+ *  Created on: Aug 06, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Line.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "atom.hpp"
+#include "molecule.hpp"
+
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/MoleculeAction/RotateAroundSelfByAngleAction.hpp"
+
+// and construct the stuff
+#include "RotateAroundSelfByAngleAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr MoleculeRotateAroundSelfByAngleAction::performCall() {
+  molecule *mol = NULL;
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  // check whether a single atom and molecule is selected
+  if (World::getInstance().getSelectedMolecules().size() != 1)
+    return Action::failure;
+  mol = World::getInstance().beginMoleculeSelection()->second;
+
+  // check whether Axis is valid
+  if (params.Axis.IsZero())
+    return Action::failure;
+
+  // convert from degrees to radian
+  params.angle *= M_PI/180.;
+
+  // Creation Line that is the rotation axis
+  Vector *CenterOfGravity = mol->DetermineCenterOfGravity();
+  Line RotationAxis(*CenterOfGravity, params.Axis);
+  delete(CenterOfGravity);
+  DoLog(0) && (Log() << Verbose(0) << "Rotate around self by " << params.angle << " along " << RotationAxis << "." << endl);
+
+  for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), params.angle));
+  }
+  DoLog(0) && (Log() << Verbose(0) << "done." << endl);
+
+  return Action::state_ptr(new MoleculeRotateAroundSelfByAngleState(mol, params));
+}
+
+Action::state_ptr MoleculeRotateAroundSelfByAngleAction::performUndo(Action::state_ptr _state) {
+  MoleculeRotateAroundSelfByAngleState *state = assert_cast<MoleculeRotateAroundSelfByAngleState*>(_state.get());
+
+  Vector *CenterOfGravity = state->mol->DetermineCenterOfGravity();
+  Line RotationAxis(*CenterOfGravity, state->params.Axis);
+  delete(CenterOfGravity);
+
+  for (molecule::iterator iter = state->mol->begin(); iter != state->mol->end(); ++iter) {
+    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), -state->params.angle));
+  }
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr MoleculeRotateAroundSelfByAngleAction::performRedo(Action::state_ptr _state){
+  MoleculeRotateAroundSelfByAngleState *state = assert_cast<MoleculeRotateAroundSelfByAngleState*>(_state.get());
+
+  Vector *CenterOfGravity = state->mol->DetermineCenterOfGravity();
+  Line RotationAxis(*CenterOfGravity, state->params.Axis);
+  delete(CenterOfGravity);
+
+  for (molecule::iterator iter = state->mol->begin(); iter != state->mol->end(); ++iter) {
+    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), state->params.angle));
+  }
+
+  return Action::state_ptr(_state);
+}
+
+bool MoleculeRotateAroundSelfByAngleAction::canUndo() {
+  return true;
+}
+
+bool MoleculeRotateAroundSelfByAngleAction::shouldUndo() {
+  return true;
+}
+
+const string MoleculeRotateAroundSelfByAngleAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.def
===================================================================
--- src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,26 @@
+/*
+ * RotateAroundSelfByAngleAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class MoleculeListClass;
+class Vector;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (double) (Vector)
+#define paramtokens (MoleculeRotateAroundSelfByAngleAction::NAME) ("position")
+#define paramreferences (angle) (Axis)
+
+#define statetypes (molecule * const)
+#define statereferences (mol)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME RotateAroundSelfByAngle
+#define TOKEN "rotate-self"
+
Index: src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.hpp
===================================================================
--- src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * RotateAroundSelfByAngleAction.hpp
+ *
+ *  Created on: Aug 06, 2010
+ *      Author: heber
+ */
+
+#ifndef ROTATEAROUNDSELFBYANGLEACTION_HPP
+#define ROTATEAROUNDSELFBYANGLEACTION_HPP
+
+#include "Actions/Action.hpp"
+
+#include "RotateAroundSelfByAngleAction.def"
+#include "Action_impl_header.hpp"
+
+#endif // ROTATEAROUNDSELFBYANGLEACTION_HPP
Index: src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp
===================================================================
--- src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * RotateToPrincipalAxisSystemAction.cpp
@@ -6,11 +13,18 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Line.hpp"
+#include "LinearAlgebra/Matrix.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "element.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
 
 
@@ -21,50 +35,96 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"
 
-/****** MoleculeRotateToPrincipalAxisSystemAction *****/
-
-// memento to remember the state when undoing
-
-//class MoleculeRotateToPrincipalAxisSystemState : public ActionState {
-//public:
-//  MoleculeRotateToPrincipalAxisSystemState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char MoleculeRotateToPrincipalAxisSystemAction::NAME[] = "rotate-to-pas";
-
-MoleculeRotateToPrincipalAxisSystemAction::MoleculeRotateToPrincipalAxisSystemAction() :
-  Action(NAME)
-{}
-
-MoleculeRotateToPrincipalAxisSystemAction::~MoleculeRotateToPrincipalAxisSystemAction()
-{}
-
-void MoleculeRotateToPrincipalAxisSystem() {
-  ActionRegistry::getInstance().getActionByName(MoleculeRotateToPrincipalAxisSystemAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* MoleculeRotateToPrincipalAxisSystemAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, MapOfActions::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "RotateToPrincipalAxisSystemAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr MoleculeRotateToPrincipalAxisSystemAction::performCall() {
   molecule *mol = NULL;
+
+  // obtain information
+  getParametersfromValueStorage();
 
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     mol = iter->second;
     DoLog(0) && (Log() << Verbose(0) << "Converting to prinicipal axis system." << endl);
-    mol->PrincipalAxisSystem(true);
+    Matrix InertiaTensor;
+    Vector *CenterOfGravity = mol->DetermineCenterOfGravity();
+
+    // reset inertia tensor
+    InertiaTensor.zero();
+
+    // sum up inertia tensor
+    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+      Vector x = (*iter)->getPosition();
+      x -= *CenterOfGravity;
+      const double mass = (*iter)->getType()->getMass();
+      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
+      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
+      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
+      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
+      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
+      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
+      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
+      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
+      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
+    }
+    // print InertiaTensor for debugging
+    DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << InertiaTensor << endl);
+
+    // diagonalize to determine principal axis system
+    Vector Eigenvalues = InertiaTensor.transformToEigenbasis();
+
+    for(int i=0;i<NDIM;i++)
+      DoLog(0) && (Log() << Verbose(0) << "eigenvalue = " << Eigenvalues[i] << ", eigenvector = " << InertiaTensor.column(i) << endl);
+
+    // check whether we rotate or not
+    DoLog(0) && (Log() << Verbose(0) << "Transforming molecule into PAS ... ");
+
+    // obtain first column, eigenvector to biggest eigenvalue
+    Vector BiggestEigenvector(InertiaTensor.column(Eigenvalues.SmallestComponent()));
+    Vector DesiredAxis(params.Axis);
+
+    // Creation Line that is the rotation axis
+    DesiredAxis.VectorProduct(BiggestEigenvector);
+    Line RotationAxis(Vector(0.,0.,0.), DesiredAxis);
+
+    // determine angle
+    const double alpha = BiggestEigenvector.Angle(params.Axis);
+
+    DoLog(0) && (Log() << Verbose(0) << alpha << endl);
+
+    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+      *(*iter) -= *CenterOfGravity;
+      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), alpha));
+      *(*iter) += *CenterOfGravity;
+    }
+    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
+
+    // summing anew for debugging (resulting matrix has to be diagonal!)
+    // reset inertia tensor
+    InertiaTensor.zero();
+
+    // sum up inertia tensor
+    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
+      Vector x = (*iter)->getPosition();
+      x -= *CenterOfGravity;
+      const double mass = (*iter)->getType()->getMass();
+      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
+      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
+      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
+      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
+      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
+      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
+      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
+      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
+      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
+      // print InertiaTensor for debugging
+      DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << InertiaTensor << endl);
+    }
+
+    // free everything
+    delete(CenterOfGravity);
   }
   return Action::success;
@@ -96,2 +156,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.def
===================================================================
--- src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,26 @@
+/*
+ * RotateToPrincipalAxisSystemAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "LinearAlgebra/Vector.hpp"
+class MoleculeListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (Vector)
+#define paramtokens (MoleculeRotateToPrincipalAxisSystemAction::NAME)
+#define paramreferences (Axis)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME RotateToPrincipalAxisSystem
+#define TOKEN "rotate-to-pas"
+
Index: src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp
===================================================================
--- src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,31 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-class MoleculeListClass;
-
-void MoleculeRotateToPrincipalAxisSystem();
-
-class MoleculeRotateToPrincipalAxisSystemAction : public Action {
-  friend void MoleculeRotateToPrincipalAxisSystem();
-
-public:
-  MoleculeRotateToPrincipalAxisSystemAction();
-  virtual ~MoleculeRotateToPrincipalAxisSystemAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
+#include "RotateToPrincipalAxisSystemAction.def"
+#include "Action_impl_header.hpp"
 
 #endif // ROTATETOPRINCIPALAXISSYSTEMACTION_HPP
Index: src/Actions/MoleculeAction/SaveAdjacencyAction.cpp
===================================================================
--- src/Actions/MoleculeAction/SaveAdjacencyAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/SaveAdjacencyAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SaveAdjacencyAction.cpp
@@ -6,13 +13,16 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "bondgraph.hpp"
 #include "config.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -24,56 +34,22 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
 
-/****** MoleculeSaveAdjacencyAction *****/
-
-// memento to remember the state when undoing
-
-//class MoleculeSaveAdjacencyState : public ActionState {
-//public:
-//  MoleculeSaveAdjacencyState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char MoleculeSaveAdjacencyAction::NAME[] = "save-adjacency";
-
-MoleculeSaveAdjacencyAction::MoleculeSaveAdjacencyAction() :
-  Action(NAME)
-{}
-
-MoleculeSaveAdjacencyAction::~MoleculeSaveAdjacencyAction()
-{}
-
-void MoleculeSaveAdjacency(std::string &adjacencyfile) {
-  ValueStorage::getInstance().setCurrentValue(MoleculeSaveAdjacencyAction::NAME, adjacencyfile);
-  ActionRegistry::getInstance().getActionByName(MoleculeSaveAdjacencyAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* MoleculeSaveAdjacencyAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "SaveAdjacencyAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr MoleculeSaveAdjacencyAction::performCall() {
-  string filename;
   molecule *mol = NULL;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
+  // obtain information
+  getParametersfromValueStorage();
 
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     mol = iter->second;
-    DoLog(0) && (Log() << Verbose(0) << "Storing adjacency to path " << filename << "." << endl);
+    DoLog(0) && (Log() << Verbose(0) << "Storing adjacency to path " << params.adjacencyfile << "." << endl);
     World::getInstance().getConfig()->BG->ConstructBondGraph(mol);
     // TODO: sollte stream nicht filename benutzen, besser fuer unit test
-    mol->StoreAdjacencyToFile(filename);
+    mol->StoreAdjacencyToFile(params.adjacencyfile);
   }
   return Action::success;
@@ -105,2 +81,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/SaveAdjacencyAction.def
===================================================================
--- src/Actions/MoleculeAction/SaveAdjacencyAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/SaveAdjacencyAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * SaveAdjacencyAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class MoleculeListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (MoleculeSaveAdjacencyAction::NAME)
+#define paramreferences (adjacencyfile)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME SaveAdjacency
+#define TOKEN "save-adjacency"
+
Index: src/Actions/MoleculeAction/SaveAdjacencyAction.hpp
===================================================================
--- src/Actions/MoleculeAction/SaveAdjacencyAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/SaveAdjacencyAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,31 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-class MoleculeListClass;
-
-void MoleculeSaveAdjacency(std::string &adjacencyfile);
-
-class MoleculeSaveAdjacencyAction : public Action {
-  friend void MoleculeSaveAdjacency(std::string &adjacencyfile);
-
-public:
-  MoleculeSaveAdjacencyAction();
-  virtual ~MoleculeSaveAdjacencyAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
+#include "SaveAdjacencyAction.def"
+#include "Action_impl_header.hpp"
 
 #endif // SAVEADJACENCYACTION_HPP
Index: src/Actions/MoleculeAction/SaveBondsAction.cpp
===================================================================
--- src/Actions/MoleculeAction/SaveBondsAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/SaveBondsAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SaveBondsAction.cpp
@@ -6,13 +13,16 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/MoleculeAction/SaveBondsAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "bondgraph.hpp"
 #include "config.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -24,56 +34,22 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/MoleculeAction/SaveBondsAction.hpp"
 
-/****** MoleculeSaveBondsAction *****/
-
-// memento to remember the state when undoing
-
-//class MoleculeSaveBondsState : public ActionState {
-//public:
-//  MoleculeSaveBondsState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char MoleculeSaveBondsAction::NAME[] = "save-bonds";
-
-MoleculeSaveBondsAction::MoleculeSaveBondsAction() :
-  Action(NAME)
-{}
-
-MoleculeSaveBondsAction::~MoleculeSaveBondsAction()
-{}
-
-void MoleculeSaveBonds(std::string &bondsfile) {
-  ValueStorage::getInstance().setCurrentValue(MoleculeSaveBondsAction::NAME, bondsfile);
-  ActionRegistry::getInstance().getActionByName(MoleculeSaveBondsAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* MoleculeSaveBondsAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "SaveBondsAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr MoleculeSaveBondsAction::performCall() {
-  string filename;
   molecule *mol = NULL;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
+  // obtain information
+  getParametersfromValueStorage();
 
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     mol = iter->second;
-    DoLog(0) && (Log() << Verbose(0) << "Storing bonds to path " << filename << "." << endl);
+    DoLog(0) && (Log() << Verbose(0) << "Storing bonds to path " << params.bondsfile << "." << endl);
     World::getInstance().getConfig()->BG->ConstructBondGraph(mol);
     // TODO: sollte stream, nicht filenamen direkt nutzen, besser fuer unit tests
-    mol->StoreBondsToFile(filename);
+    mol->StoreBondsToFile(params.bondsfile);
   }
   return Action::success;
@@ -105,2 +81,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/SaveBondsAction.def
===================================================================
--- src/Actions/MoleculeAction/SaveBondsAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/SaveBondsAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * SaveBondsAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class MoleculeListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (MoleculeSaveBondsAction::NAME)
+#define paramreferences (bondsfile)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME SaveBonds
+#define TOKEN "save-bonds"
+
Index: src/Actions/MoleculeAction/SaveBondsAction.hpp
===================================================================
--- src/Actions/MoleculeAction/SaveBondsAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/SaveBondsAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,31 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-class MoleculeListClass;
-
-void MoleculeSaveBonds(std::string &bondsfile);
-
-class MoleculeSaveBondsAction : public Action {
-  friend void MoleculeSaveBonds(std::string &bondsfile);
-
-public:
-  MoleculeSaveBondsAction();
-  virtual ~MoleculeSaveBondsAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
+#include "SaveBondsAction.def"
+#include "Action_impl_header.hpp"
 
 #endif // SAVEBONDSACTION_HPP
Index: src/Actions/MoleculeAction/SaveTemperatureAction.cpp
===================================================================
--- src/Actions/MoleculeAction/SaveTemperatureAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/SaveTemperatureAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SaveTemperatureAction.cpp
@@ -6,11 +13,14 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -21,55 +31,21 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
 
-/****** MoleculeSaveTemperatureAction *****/
-
-// memento to remember the state when undoing
-
-//class MoleculeSaveTemperatureState : public ActionState {
-//public:
-//  MoleculeSaveTemperatureState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char MoleculeSaveTemperatureAction::NAME[] = "save-temperature";
-
-MoleculeSaveTemperatureAction::MoleculeSaveTemperatureAction() :
-  Action(NAME)
-{}
-
-MoleculeSaveTemperatureAction::~MoleculeSaveTemperatureAction()
-{}
-
-void MoleculeSaveTemperature(std::string &temperaturefile) {
-  ValueStorage::getInstance().setCurrentValue(MoleculeSaveTemperatureAction::NAME, temperaturefile);
-  ActionRegistry::getInstance().getActionByName(MoleculeSaveTemperatureAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* MoleculeSaveTemperatureAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "SaveTemperatureAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr MoleculeSaveTemperatureAction::performCall() {
-  string filename;
   molecule *mol = NULL;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
+  // obtain information
+  getParametersfromValueStorage();
 
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     mol = iter->second;
-    DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << params.temperaturefile << "." << endl);
     ofstream output;
-    output.open(filename.c_str(), ios::trunc);
+    output.open(params.temperaturefile.c_str(), ios::trunc);
     if (output.fail() || !mol->OutputTemperatureFromTrajectories((ofstream * const) &output, 0, mol->MDSteps))
       DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl);
@@ -106,2 +82,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/SaveTemperatureAction.def
===================================================================
--- src/Actions/MoleculeAction/SaveTemperatureAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/SaveTemperatureAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * SaveTemperatureAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class MoleculeListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (MoleculeSaveTemperatureAction::NAME)
+#define paramreferences (temperaturefile)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME SaveTemperature
+#define TOKEN "save-temperature"
+
Index: src/Actions/MoleculeAction/SaveTemperatureAction.hpp
===================================================================
--- src/Actions/MoleculeAction/SaveTemperatureAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/SaveTemperatureAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,31 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-class MoleculeListClass;
-
-void MoleculeSaveTemperature(std::string &temperaturefile);
-
-class MoleculeSaveTemperatureAction : public Action {
-  friend void MoleculeSaveTemperature(std::string &temperaturefile);
-
-public:
-  MoleculeSaveTemperatureAction();
-  virtual ~MoleculeSaveTemperatureAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
+#include "SaveTemperatureAction.def"
+#include "Action_impl_header.hpp"
 
 #endif // SAVETEMPERATUREACTION_HPP
Index: src/Actions/MoleculeAction/SuspendInWaterAction.cpp
===================================================================
--- src/Actions/MoleculeAction/SuspendInWaterAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/SuspendInWaterAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SuspendInWaterAction.cpp
@@ -6,12 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/MoleculeAction/SuspendInWaterAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "boundary.hpp"
 #include "config.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -21,58 +31,24 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/MoleculeAction/SuspendInWaterAction.hpp"
 
-/****** MoleculeSuspendInWaterAction *****/
-
-// memento to remember the state when undoing
-
-//class MoleculeSuspendInWaterState : public ActionState {
-//public:
-//  MoleculeSuspendInWaterState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char MoleculeSuspendInWaterAction::NAME[] = "suspend-in-water";
-
-MoleculeSuspendInWaterAction::MoleculeSuspendInWaterAction() :
-  Action(NAME)
-{}
-
-MoleculeSuspendInWaterAction::~MoleculeSuspendInWaterAction()
-{}
-
-void MoleculeSuspendInWater(double density) {
-  ValueStorage::getInstance().setCurrentValue(MoleculeSuspendInWaterAction::NAME, density);
-  ActionRegistry::getInstance().getActionByName(MoleculeSuspendInWaterAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* MoleculeSuspendInWaterAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryDouble(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "SuspendInWaterAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr MoleculeSuspendInWaterAction::performCall() {
   molecule *mol = NULL;
-  double density;
   double volume = 0.;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, density);
+  // obtain information
+  getParametersfromValueStorage();
 
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     mol = iter->second;
     DoLog(0) && (Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water.");
-    if (density < 1.0) {
+    if (params.density < 1.0) {
       DoeLog(1) && (eLog()<< Verbose(1) << "Density must be greater than 1.0g/cm^3!" << endl);
     } else {
-      PrepareClustersinWater(World::getInstance().getConfig(), mol, volume, density);  // if volume == 0, will calculate from ConvexEnvelope
+      PrepareClustersinWater(World::getInstance().getConfig(), mol, volume, params.density);  // if volume == 0, will calculate from ConvexEnvelope
     }
   }
@@ -105,2 +81,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/SuspendInWaterAction.def
===================================================================
--- src/Actions/MoleculeAction/SuspendInWaterAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/SuspendInWaterAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * SuspendInWaterAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class MoleculeListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (double)
+#define paramtokens (MoleculeSuspendInWaterAction::NAME)
+#define paramreferences (density)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME SuspendInWater
+#define TOKEN "suspend-in-water"
+
Index: src/Actions/MoleculeAction/SuspendInWaterAction.hpp
===================================================================
--- src/Actions/MoleculeAction/SuspendInWaterAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/SuspendInWaterAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,31 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-class MoleculeListClass;
-
-void MoleculeSuspendInWater(double density);
-
-class MoleculeSuspendInWaterAction : public Action {
-  friend void MoleculeSuspendInWater(double density);
-
-public:
-  MoleculeSuspendInWaterAction();
-  virtual ~MoleculeSuspendInWaterAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
+#include "SuspendInWaterAction.def"
+#include "Action_impl_header.hpp"
 
 #endif // SUSPENDINWATERACTION_HPP
Index: c/Actions/MoleculeAction/TranslateAction.cpp
===================================================================
--- src/Actions/MoleculeAction/TranslateAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * TranslateAction.cpp
- *
- *  Created on: May 10, 2010
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Actions/MoleculeAction/TranslateAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "log.hpp"
-#include "molecule.hpp"
-#include "vector.hpp"
-#include "verbose.hpp"
-#include "World.hpp"
-
-#include <iostream>
-#include <fstream>
-#include <string>
-
-using namespace std;
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-
-/****** MoleculeTranslateAction *****/
-
-// memento to remember the state when undoing
-
-//class MoleculeTranslateState : public ActionState {
-//public:
-//  MoleculeTranslateState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char MoleculeTranslateAction::NAME[] = "translate-mol";
-
-MoleculeTranslateAction::MoleculeTranslateAction() :
-  Action(NAME)
-{}
-
-MoleculeTranslateAction::~MoleculeTranslateAction()
-{}
-
-void MoleculeTranslate(Vector &x, bool periodic) {
-  ValueStorage::getInstance().setCurrentValue(MoleculeTranslateAction::NAME, x);
-  ValueStorage::getInstance().setCurrentValue("periodic", periodic);
-  ActionRegistry::getInstance().getActionByName(MoleculeTranslateAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* MoleculeTranslateAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME));
-  dialog->queryBoolean("periodic", ValueStorage::getInstance().getDescription("periodic"));
-
-  return dialog;
-}
-
-Action::state_ptr MoleculeTranslateAction::performCall() {
-  molecule *mol = NULL;
-  Vector x;
-  bool periodic = false;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, x);
-  ValueStorage::getInstance().queryCurrentValue("periodic", periodic);
-
-  for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
-    mol = iter->second;
-    DoLog(1) && (Log() << Verbose(1) << "Translating all ions by given vector." << endl);
-    if (periodic)
-      mol->TranslatePeriodically((const Vector *)&x);
-    else
-      mol->Translate((const Vector *)&x);
-  }
-  return Action::success;
-}
-
-Action::state_ptr MoleculeTranslateAction::performUndo(Action::state_ptr _state) {
-//  MoleculeTranslateState *state = assert_cast<MoleculeTranslateState*>(_state.get());
-
-//  string newName = state->mol->getName();
-//  state->mol->setName(state->lastName);
-
-  return Action::failure;
-}
-
-Action::state_ptr MoleculeTranslateAction::performRedo(Action::state_ptr _state){
-  // Undo and redo have to do the same for this action
-  return performUndo(_state);
-}
-
-bool MoleculeTranslateAction::canUndo() {
-  return false;
-}
-
-bool MoleculeTranslateAction::shouldUndo() {
-  return false;
-}
-
-const string MoleculeTranslateAction::getName() {
-  return NAME;
-}
Index: c/Actions/MoleculeAction/TranslateAction.hpp
===================================================================
--- src/Actions/MoleculeAction/TranslateAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * TranslateAction.hpp
- *
- *  Created on: May 10, 2010
- *      Author: heber
- */
-
-#ifndef TRANSLATEACTION_HPP
-#define TRANSLATEACTION_HPP
-
-#include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
-#include "vector.hpp"
-
-class MoleculeListClass;
-
-void MoleculeTranslate(Vector &x, bool periodic);
-
-class MoleculeTranslateAction : public Action {
-  friend void MoleculeTranslate(Vector &x, bool periodic);
-
-public:
-  MoleculeTranslateAction();
-  virtual ~MoleculeTranslateAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
-
-#endif // TRANSLATEACTION_HPP
Index: src/Actions/MoleculeAction/VerletIntegrationAction.cpp
===================================================================
--- src/Actions/MoleculeAction/VerletIntegrationAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/VerletIntegrationAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * VerletIntegrationAction.cpp
@@ -6,11 +13,14 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -21,49 +31,15 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
 
-/****** MoleculeVerletIntegrationAction *****/
-
-// memento to remember the state when undoing
-
-//class MoleculeVerletIntegrationState : public ActionState {
-//public:
-//  MoleculeVerletIntegrationState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char MoleculeVerletIntegrationAction::NAME[] = "verlet-integrate";
-
-MoleculeVerletIntegrationAction::MoleculeVerletIntegrationAction() :
-  Action(NAME)
-{}
-
-MoleculeVerletIntegrationAction::~MoleculeVerletIntegrationAction()
-{}
-
-void MoleculeVerletIntegration(std::string &forcesfile) {
-  ValueStorage::getInstance().setCurrentValue(MoleculeVerletIntegrationAction::NAME, forcesfile);
-  ActionRegistry::getInstance().getActionByName(MoleculeVerletIntegrationAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* MoleculeVerletIntegrationAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "VerletIntegrationAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr MoleculeVerletIntegrationAction::performCall() {
-  string filename;
   molecule *mol = NULL;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
+  // obtain information
+  getParametersfromValueStorage();
 
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
@@ -72,9 +48,9 @@
     // TODO: sollte besser stream nutzen, nicht filename direkt (es sei denn, ist prefix), besser fuer unit test
     char outputname[MAXSTRINGSIZE];
-    strcpy(outputname, filename.c_str());
+    strcpy(outputname, params.forcesfile.c_str());
     if (!mol->VerletForceIntegration(outputname, *(World::getInstance().getConfig()), 0))
-      DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);
+      DoLog(2) && (Log() << Verbose(2) << "File " << params.forcesfile << " not found." << endl);
     else
-      DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl);
+      DoLog(2) && (Log() << Verbose(2) << "File " << params.forcesfile << " found and parsed." << endl);
   }
   return Action::success;
@@ -106,2 +82,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/VerletIntegrationAction.def
===================================================================
--- src/Actions/MoleculeAction/VerletIntegrationAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/MoleculeAction/VerletIntegrationAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * VerletIntegrationAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class MoleculeListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (MoleculeVerletIntegrationAction::NAME)
+#define paramreferences (forcesfile)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define ACTIONNAME VerletIntegration
+#define TOKEN "verlet-integrate"
+
Index: src/Actions/MoleculeAction/VerletIntegrationAction.hpp
===================================================================
--- src/Actions/MoleculeAction/VerletIntegrationAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/MoleculeAction/VerletIntegrationAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,31 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-class MoleculeListClass;
-
-void MoleculeVerletIntegration(std::string &forcesfile);
-
-class MoleculeVerletIntegrationAction : public Action {
-  friend void MoleculeVerletIntegration(std::string &forcesfile);
-
-public:
-  MoleculeVerletIntegrationAction();
-  virtual ~MoleculeVerletIntegrationAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
+#include "VerletIntegrationAction.def"
+#include "Action_impl_header.hpp"
 
 #endif // VERLETINTEGRATIONACTION_HPP
Index: src/Actions/ParserAction/LoadXyzAction.cpp
===================================================================
--- src/Actions/ParserAction/LoadXyzAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ParserAction/LoadXyzAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * LoadXyzAction.cpp
@@ -6,102 +13,38 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
+
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Parser/XyzParser.hpp"
+
+#include <iostream>
 
 using namespace std;
 
 #include "Actions/ParserAction/LoadXyzAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "Parser/XyzParser.hpp"
-#include "atom.hpp"
-#include "log.hpp"
-#include "molecule.hpp"
-#include "verbose.hpp"
-#include "World.hpp"
 
-#include <iostream>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-
-/****** ParserLoadXyzAction *****/
-
-//// memento to remember the state when undoing
-//
-//class ParserLoadXyzState : public ActionState {
-//public:
-//  ParserLoadXyzState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char ParserLoadXyzAction::NAME[] = "parse-xyz";
-
-ParserLoadXyzAction::ParserLoadXyzAction() :
-  Action(NAME)
-{}
-
-ParserLoadXyzAction::~ParserLoadXyzAction()
-{}
-
-void ParserLoadXyz(std::string &filename) {
-  ValueStorage::getInstance().setCurrentValue(ParserLoadXyzAction::NAME, filename);
-  ActionRegistry::getInstance().getActionByName(ParserLoadXyzAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* ParserLoadXyzAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "LoadXyzAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr ParserLoadXyzAction::performCall() {
-  string filename;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
+  // obtain information
+  getParametersfromValueStorage();
 
   DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl);
   // parse xyz file
   ifstream input;
-  input.open(filename.c_str());
+  input.open(params.filename.c_str());
   if (!input.fail()) {
-    // TODO: Remove the insertion into molecule when saving does not depend on them anymore. Also, remove molecule.hpp include
-    set <atom*> UniqueList;
-    {
-      vector<atom *> ListBefore = World::getInstance().getAllAtoms();
-      for (vector<atom *>::iterator runner = ListBefore.begin();runner != ListBefore.end(); ++runner)
-        UniqueList.insert(*runner);
-    }
     XyzParser parser; // briefly instantiate a parser which is removed at end of focus
     parser.load(&input);
-    {
-      vector<atom *> ListAfter = World::getInstance().getAllAtoms();
-      pair< set<atom *>::iterator, bool > Inserter;
-      if (UniqueList.size() != ListAfter.size()) { // only create if new atoms have been parsed
-        MoleculeListClass *molecules = World::getInstance().getMolecules();
-        molecule *mol = World::getInstance().createMolecule();
-        molecules->insert(mol);
-        for (vector<atom *>::iterator runner = ListAfter.begin(); runner != ListAfter.end(); ++runner) {
-          Inserter = UniqueList.insert(*runner);
-          if (Inserter.second) { // if not present, then new (just parsed) atom, add ...
-            cout << "Adding new atom " << **runner << " to new mol." << endl;
-            mol->AddAtom(*runner);
-          }
-        }
-        mol->doCountAtoms();
-      } else {
-        cout << "No atoms parsed?" << endl;
-      }
-    }
   } else {
-    DoeLog(1) && (eLog() << Verbose(1) << "Could not open file " << filename << "." << endl);
+    DoeLog(1) && (eLog() << Verbose(1) << "Could not open file " << params.filename << "." << endl);
   }
   input.close();
@@ -134,2 +77,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/ParserAction/LoadXyzAction.def
===================================================================
--- src/Actions/ParserAction/LoadXyzAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/ParserAction/LoadXyzAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * LoadXyzAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (ParserLoadXyzAction::NAME)
+#define paramreferences (filename)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Parser
+#define ACTIONNAME LoadXyz
+#define TOKEN "parse-xyz"
+
Index: src/Actions/ParserAction/LoadXyzAction.hpp
===================================================================
--- src/Actions/ParserAction/LoadXyzAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ParserAction/LoadXyzAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,28 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-void ParserLoadXyz(std::string &filename);
-
-class ParserLoadXyzAction : public Action {
-  friend void ParserLoadXyz(std::string &filename);
-
-public:
-  ParserLoadXyzAction();
-  virtual ~ParserLoadXyzAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "LoadXyzAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* LOADXYZACTION_HPP_ */
Index: src/Actions/ParserAction/SaveXyzAction.cpp
===================================================================
--- src/Actions/ParserAction/SaveXyzAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ParserAction/SaveXyzAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SaveXyzAction.cpp
@@ -6,8 +13,11 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/ParserAction/SaveXyzAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "Parser/XyzParser.hpp"
 #include "atom.hpp"
@@ -19,54 +29,19 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/ParserAction/SaveXyzAction.hpp"
 
-
-/****** ParserSaveXyzAction *****/
-
-//// memento to remember the state when undoing
-//
-//class ParserSaveXyzState : public ActionState {
-//public:
-//  ParserSaveXyzState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char ParserSaveXyzAction::NAME[] = "SaveXyz";
-
-ParserSaveXyzAction::ParserSaveXyzAction() :
-  Action(NAME)
-{}
-
-ParserSaveXyzAction::~ParserSaveXyzAction()
-{}
-
-void ParserSaveXyz(std::string &filename) {
-  ValueStorage::getInstance().setCurrentValue(ParserSaveXyzAction::NAME, filename);
-  ActionRegistry::getInstance().getActionByName(ParserSaveXyzAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* ParserSaveXyzAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "SaveXyzAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr ParserSaveXyzAction::performCall() {
-  string filename;
   XyzParser parser;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
+  // obtain information
+  getParametersfromValueStorage();
 
   // store xyz file
   ofstream output;
-  output.open(filename.c_str());
+  output.open(params.filename.c_str());
   if (!output.fail())
     parser.save(&output);
@@ -102,2 +77,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/ParserAction/SaveXyzAction.def
===================================================================
--- src/Actions/ParserAction/SaveXyzAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/ParserAction/SaveXyzAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * SaveXyzAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (ParserSaveXyzAction::NAME)
+#define paramreferences (filename)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Parser
+#define ACTIONNAME SaveXyz
+#define TOKEN "SaveXyz"
+
Index: src/Actions/ParserAction/SaveXyzAction.hpp
===================================================================
--- src/Actions/ParserAction/SaveXyzAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ParserAction/SaveXyzAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,28 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-void ParserSaveXyz(std::string &filename);
-
-class ParserSaveXyzAction : public Action {
-  friend void ParserSaveXyz(std::string &filename);
-
-public:
-  ParserSaveXyzAction();
-  virtual ~ParserSaveXyzAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "SaveXyzAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* SAVEXYZACTION_HPP_ */
Index: src/Actions/Process.cpp
===================================================================
--- src/Actions/Process.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/Process.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * Process.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Actions/SelectionAction/AllAtomsAction.cpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/AllAtomsAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AllAtomsAction.cpp
@@ -6,12 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/SelectionAction/AllAtomsAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "Descriptors/AtomDescriptor.hpp"
 #include "atom.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -21,45 +31,18 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/SelectionAction/AllAtomsAction.hpp"
 
+// and construct the stuff
+#include "AllAtomsAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionAllAtomsAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
-// memento to remember the state when undoing
-
-class SelectionAllAtomsState : public ActionState {
-public:
-  SelectionAllAtomsState(std::vector<atom*> _selectedAtoms) :
-    selectedAtoms(_selectedAtoms)
-  {}
-  std::vector<atom*> selectedAtoms;
-};
-
-const char SelectionAllAtomsAction::NAME[] = "select-all-atoms";
-
-SelectionAllAtomsAction::SelectionAllAtomsAction() :
-  Action(NAME)
-{}
-
-SelectionAllAtomsAction::~SelectionAllAtomsAction()
-{}
-
-void SelectionAllAtoms() {
-  ActionRegistry::getInstance().getActionByName(SelectionAllAtomsAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* SelectionAllAtomsAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr SelectionAllAtomsAction::performCall() {
   std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
   DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms." << endl);
   World::getInstance().selectAllAtoms(AllAtoms());
-  return Action::state_ptr(new SelectionAllAtomsState(selectedAtoms));
+  return Action::state_ptr(new SelectionAllAtomsState(selectedAtoms,params));
 }
 
@@ -71,13 +54,13 @@
     World::getInstance().selectAtom(*iter);
 
-  return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
+  return Action::state_ptr(_state);
 }
 
 Action::state_ptr SelectionAllAtomsAction::performRedo(Action::state_ptr _state){
-  SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
+  //SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
 
   World::getInstance().selectAllAtoms(AllAtoms());
 
-  return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
+  return Action::state_ptr(_state);
 }
 
@@ -93,2 +76,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/AllAtomsAction.def
===================================================================
--- src/Actions/SelectionAction/AllAtomsAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AllAtomsAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * AllAtomsAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME AllAtoms
+#define TOKEN "select-all-atoms"
+
Index: src/Actions/SelectionAction/AllAtomsAction.hpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/AllAtomsAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void SelectionAllAtoms();
-
-class SelectionAllAtomsAction : public Action {
-  friend void SelectionAllAtoms();
-
-public:
-  SelectionAllAtomsAction();
-  virtual ~SelectionAllAtomsAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "AllAtomsAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* ALLATOMSACTION_HPP_ */
Index: src/Actions/SelectionAction/AllAtomsInsideCuboidAction.cpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsInsideCuboidAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AllAtomsInsideCuboidAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,92 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * AllAtomsInsideCuboidAction.cpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/AtomDescriptor.hpp"
+#include "Descriptors/AtomShapeDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Matrix.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Shapes/BaseShapes.hpp"
+#include "Shapes/Shape.hpp"
+#include "Shapes/ShapeOps.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp"
+
+// and construct the stuff
+#include "AllAtomsInsideCuboidAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionAllAtomsInsideCuboidAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+  Matrix RotationMatrix;
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  RotationMatrix.rotation(params.Xangle, params.Yangle, params.Zangle);
+
+  DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms inside a rotated " << RotationMatrix << " cuboid at " << params.position << " and extension of " << params.extension << "." << endl);
+  Shape s = translate(transform(stretch(Cuboid(),params.extension),RotationMatrix),params.position);
+  World::getInstance().selectAllAtoms(AtomByShape(s));
+  return Action::state_ptr(new SelectionAllAtomsInsideCuboidState(selectedAtoms, params));
+}
+
+Action::state_ptr SelectionAllAtomsInsideCuboidAction::performUndo(Action::state_ptr _state) {
+  SelectionAllAtomsInsideCuboidState *state = assert_cast<SelectionAllAtomsInsideCuboidState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionAllAtomsInsideCuboidAction::performRedo(Action::state_ptr _state){
+  SelectionAllAtomsInsideCuboidState *state = assert_cast<SelectionAllAtomsInsideCuboidState*>(_state.get());
+  Matrix RotationMatrix;
+
+  RotationMatrix.rotation(state->params.Xangle, state->params.Yangle, state->params.Zangle);
+  Shape s = translate(transform(stretch(Cuboid(),state->params.extension),RotationMatrix),state->params.position);
+  World::getInstance().selectAllAtoms(AtomByShape(s));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionAllAtomsInsideCuboidAction::canUndo() {
+  return true;
+}
+
+bool SelectionAllAtomsInsideCuboidAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionAllAtomsInsideCuboidAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/AllAtomsInsideCuboidAction.def
===================================================================
--- src/Actions/SelectionAction/AllAtomsInsideCuboidAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AllAtomsInsideCuboidAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * AllAtomsInsideCuboidAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class Vector;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (Vector) (Vector) (double) (double) (double)
+#define paramtokens (SelectionAllAtomsInsideCuboidAction::NAME) ("position") ("angle-x") ("angle-y") ("angle-z")
+#define paramreferences (extension) (position) (Xangle) (Yangle) (Zangle)
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME AllAtomsInsideCuboid
+#define TOKEN "select-atoms-inside-cuboid"
+
Index: src/Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * AllAtomsInsideCuboidAction.hpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#ifndef ALLATOMSINSIDECUBOIDACTION_HPP_
+#define ALLATOMSINSIDECUBOIDACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "AllAtomsInsideCuboidAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* ALLATOMSINSIDECUBOIDACTION_HPP_ */
Index: src/Actions/SelectionAction/AllAtomsInsideSphereAction.cpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsInsideSphereAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AllAtomsInsideSphereAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,86 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * AllAtomsInsideSphereAction.cpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/AtomDescriptor.hpp"
+#include "Descriptors/AtomShapeDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Shapes/BaseShapes.hpp"
+#include "Shapes/Shape.hpp"
+#include "Shapes/ShapeOps.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/AllAtomsInsideSphereAction.hpp"
+
+// and construct the stuff
+#include "AllAtomsInsideSphereAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionAllAtomsInsideSphereAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms inside a sphere at " << params.position << " with radius " << params.radius << "." << endl);
+  Shape s = translate(resize(Sphere(),params.radius),params.position);
+  World::getInstance().selectAllAtoms(AtomByShape(s));
+  return Action::state_ptr(new SelectionAllAtomsInsideSphereState(selectedAtoms, params));
+}
+
+Action::state_ptr SelectionAllAtomsInsideSphereAction::performUndo(Action::state_ptr _state) {
+  SelectionAllAtomsInsideSphereState *state = assert_cast<SelectionAllAtomsInsideSphereState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionAllAtomsInsideSphereAction::performRedo(Action::state_ptr _state){
+  SelectionAllAtomsInsideSphereState *state = assert_cast<SelectionAllAtomsInsideSphereState*>(_state.get());
+
+  Shape s = translate(resize(Sphere(),state->params.radius),state->params.position);
+  World::getInstance().selectAllAtoms(AtomByShape(s));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionAllAtomsInsideSphereAction::canUndo() {
+  return true;
+}
+
+bool SelectionAllAtomsInsideSphereAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionAllAtomsInsideSphereAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/AllAtomsInsideSphereAction.def
===================================================================
--- src/Actions/SelectionAction/AllAtomsInsideSphereAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AllAtomsInsideSphereAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * AllAtomsInsideSphereAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class Vector;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (double) (Vector)
+#define paramtokens (SelectionAllAtomsInsideSphereAction::NAME) ("position")
+#define paramreferences (radius) (position)
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME AllAtomsInsideSphere
+#define TOKEN "select-atoms-inside-sphere"
+
Index: src/Actions/SelectionAction/AllAtomsInsideSphereAction.hpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsInsideSphereAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AllAtomsInsideSphereAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * AllAtomsInsideSphereAction.hpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#ifndef ALLATOMSINSIDESPHEREACTION_HPP_
+#define ALLATOMSINSIDESPHEREACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "AllAtomsInsideSphereAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* ALLATOMSINSIDESPHEREACTION_HPP_ */
Index: src/Actions/SelectionAction/AllAtomsOfMoleculeAction.cpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsOfMoleculeAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AllAtomsOfMoleculeAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,80 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * AllAtomsOfMoleculeAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/AtomDescriptor.hpp"
+#include "atom.hpp"
+#include "molecule.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/AllAtomsOfMoleculeAction.hpp"
+
+// and construct the stuff
+#include "AllAtomsOfMoleculeAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionAllAtomsOfMoleculeAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms of molecule " << params.mol->getName() << "." << endl);
+  World::getInstance().selectAtomsOfMolecule(params.mol);
+  return Action::state_ptr(new SelectionAllAtomsOfMoleculeState(selectedAtoms, params));
+}
+
+Action::state_ptr SelectionAllAtomsOfMoleculeAction::performUndo(Action::state_ptr _state) {
+  SelectionAllAtomsOfMoleculeState *state = assert_cast<SelectionAllAtomsOfMoleculeState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionAllAtomsOfMoleculeAction::performRedo(Action::state_ptr _state){
+  SelectionAllAtomsOfMoleculeState *state = assert_cast<SelectionAllAtomsOfMoleculeState*>(_state.get());
+
+  World::getInstance().selectAtomsOfMolecule(state->params.mol);
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionAllAtomsOfMoleculeAction::canUndo() {
+  return true;
+}
+
+bool SelectionAllAtomsOfMoleculeAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionAllAtomsOfMoleculeAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/AllAtomsOfMoleculeAction.def
===================================================================
--- src/Actions/SelectionAction/AllAtomsOfMoleculeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AllAtomsOfMoleculeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * AllAtomsOfMoleculeAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class molecule;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (molecule *)
+#define paramtokens (SelectionAllAtomsOfMoleculeAction::NAME)
+#define paramreferences (mol)
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME AllAtomsOfMolecule
+#define TOKEN "select-molecules-atoms"
+
Index: src/Actions/SelectionAction/AllAtomsOfMoleculeAction.hpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsOfMoleculeAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AllAtomsOfMoleculeAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * AllAtomsOfMoleculeAction.hpp
+ *
+ *  Created on: Aug 09, 2010
+ *      Author: heber
+ */
+
+#ifndef ALLATOMSOFMOLECULEACTION_HPP_
+#define ALLATOMSOFMOLECULEACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "AllAtomsOfMoleculeAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* ALLATOMSOFMOLECULEACTION_HPP_ */
Index: src/Actions/SelectionAction/AllMoleculesAction.cpp
===================================================================
--- src/Actions/SelectionAction/AllMoleculesAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/AllMoleculesAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AllMoleculesAction.cpp
@@ -6,12 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/SelectionAction/AllMoleculesAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "Descriptors/MoleculeDescriptor.hpp"
 #include "atom.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -21,45 +31,18 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/SelectionAction/AllMoleculesAction.hpp"
 
+// and construct the stuff
+#include "AllMoleculesAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionAllMoleculesAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
-// memento to remember the state when undoing
-
-class SelectionAllMoleculesState : public ActionState {
-public:
-  SelectionAllMoleculesState(std::vector<molecule*> selectedMolecules) :
-    selectedMolecules(selectedMolecules)
-  {}
-  std::vector<molecule*> selectedMolecules;
-};
-
-const char SelectionAllMoleculesAction::NAME[] = "select-all-molecules";
-
-SelectionAllMoleculesAction::SelectionAllMoleculesAction() :
-  Action(NAME)
-{}
-
-SelectionAllMoleculesAction::~SelectionAllMoleculesAction()
-{}
-
-void SelectionAllMolecules() {
-  ActionRegistry::getInstance().getActionByName(SelectionAllMoleculesAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* SelectionAllMoleculesAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr SelectionAllMoleculesAction::performCall() {
   std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
   DoLog(1) && (Log() << Verbose(1) << "Selecting all molecules." << endl);
   World::getInstance().selectAllMolecules(AllMolecules());
-  return Action::state_ptr(new SelectionAllMoleculesState(selectedMolecules));
+  return Action::state_ptr(new SelectionAllMoleculesState(selectedMolecules,params));
 }
 
@@ -71,13 +54,13 @@
     World::getInstance().selectMolecule(*iter);
 
-  return Action::state_ptr(new SelectionAllMoleculesState(state->selectedMolecules));
+  return Action::state_ptr(_state);
 }
 
 Action::state_ptr SelectionAllMoleculesAction::performRedo(Action::state_ptr _state){
-  SelectionAllMoleculesState *state = assert_cast<SelectionAllMoleculesState*>(_state.get());
+  //SelectionAllMoleculesState *state = assert_cast<SelectionAllMoleculesState*>(_state.get());
 
   World::getInstance().selectAllMolecules(AllMolecules());
 
-  return Action::state_ptr(new SelectionAllMoleculesState(state->selectedMolecules));
+  return Action::state_ptr(_state);
 }
 
@@ -93,2 +76,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/AllMoleculesAction.def
===================================================================
--- src/Actions/SelectionAction/AllMoleculesAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AllMoleculesAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,24 @@
+/*
+ * AllMoleculesAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#define statetypes (std::vector<molecule*>)
+#define statereferences (selectedMolecules)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME AllMolecules
+#define TOKEN "select-all-molecules"
+
Index: src/Actions/SelectionAction/AllMoleculesAction.hpp
===================================================================
--- src/Actions/SelectionAction/AllMoleculesAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/AllMoleculesAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -2,5 +2,5 @@
  * AllMoleculesAction.hpp
  *
- *  Created on: May 12, 2010
+ *  Created on: Aug 09, 2010
  *      Author: heber
  */
@@ -9,28 +9,9 @@
 #define ALLMOLECULESSACTION_HPP_
 
+
 #include "Actions/Action.hpp"
 
-void SelectionAllMolecules();
-
-class SelectionAllMoleculesAction : public Action {
-  friend void SelectionAllMolecules();
-
-public:
-  SelectionAllMoleculesAction();
-  virtual ~SelectionAllMoleculesAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "AllMoleculesAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* ALLMOLECULESSACTION_HPP_ */
Index: src/Actions/SelectionAction/AtomByElementAction.cpp
===================================================================
--- src/Actions/SelectionAction/AtomByElementAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AtomByElementAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,80 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * AtomByElementAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/AtomTypeDescriptor.hpp"
+#include "atom.hpp"
+#include "element.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/AtomByElementAction.hpp"
+
+// and construct the stuff
+#include "AtomByElementAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionAtomByElementAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  DoLog(1) && (Log() << Verbose(1) << "Selecting atoms of type " << *params.elemental << endl);
+  World::getInstance().selectAllAtoms(AtomByType(params.elemental));
+  return Action::state_ptr(new SelectionAtomByElementState(selectedAtoms,params));
+}
+
+Action::state_ptr SelectionAtomByElementAction::performUndo(Action::state_ptr _state) {
+  SelectionAtomByElementState *state = assert_cast<SelectionAtomByElementState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionAtomByElementAction::performRedo(Action::state_ptr _state){
+  SelectionAtomByElementState *state = assert_cast<SelectionAtomByElementState*>(_state.get());
+
+  World::getInstance().selectAllAtoms(AtomByType(state->params.elemental));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionAtomByElementAction::canUndo() {
+  return true;
+}
+
+bool SelectionAtomByElementAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionAtomByElementAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/AtomByElementAction.def
===================================================================
--- src/Actions/SelectionAction/AtomByElementAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AtomByElementAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * AtomByElementAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class element;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (const element*)
+#define paramtokens (SelectionAtomByElementAction::NAME)
+#define paramreferences (elemental)
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME AtomByElement
+#define TOKEN "select-atom-by-element"
+
Index: src/Actions/SelectionAction/AtomByElementAction.hpp
===================================================================
--- src/Actions/SelectionAction/AtomByElementAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AtomByElementAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * AtomByElementAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef ATOMBYELEMENTACTION_HPP_
+#define ATOMBYELEMENTACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "AtomByElementAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* ATOMBYELEMENTACTION_HPP_ */
Index: src/Actions/SelectionAction/AtomByIdAction.cpp
===================================================================
--- src/Actions/SelectionAction/AtomByIdAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/AtomByIdAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AtomByIdAction.cpp
@@ -6,11 +13,14 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/SelectionAction/AtomByIdAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "atom.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -20,50 +30,18 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/SelectionAction/AtomByIdAction.hpp"
 
+// and construct the stuff
+#include "AtomByIdAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionAtomByIdAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
-// memento to remember the state when undoing
-
-class SelectionAtomByIdState : public ActionState {
-public:
-  SelectionAtomByIdState(atom* _walker) :
-    walker(_walker)
-  {}
-  atom* walker;
-};
-
-const char SelectionAtomByIdAction::NAME[] = "select-atom-by-id";
-
-SelectionAtomByIdAction::SelectionAtomByIdAction() :
-  Action(NAME)
-{}
-
-SelectionAtomByIdAction::~SelectionAtomByIdAction()
-{}
-
-void SelectionAtomById(atom *_atom) {
-  ValueStorage::getInstance().setCurrentValue(SelectionAtomByIdAction::NAME, _atom);
-  ActionRegistry::getInstance().getActionByName(SelectionAtomByIdAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* SelectionAtomByIdAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryAtom(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr SelectionAtomByIdAction::performCall() {
-  atom *Walker = NULL;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, Walker);
-
-  if (!World::getInstance().isSelected(Walker)) {
-    DoLog(1) && (Log() << Verbose(1) << "Selecting atom " << *Walker << endl);
-    World::getInstance().selectAtom(Walker);
-    return Action::state_ptr(new SelectionAtomByIdState(Walker));
+  if (!World::getInstance().isSelected(params.Walker)) {
+    DoLog(1) && (Log() << Verbose(1) << "Selecting atom " << *params.Walker << endl);
+    World::getInstance().selectAtom(params.Walker);
+    return Action::state_ptr(new SelectionAtomByIdState(params));
   } else {
     return Action::success;
@@ -74,8 +52,8 @@
   SelectionAtomByIdState *state = assert_cast<SelectionAtomByIdState*>(_state.get());
 
-  if (state->walker != NULL)
-    World::getInstance().unselectAtom(state->walker);
+  if (state->params.Walker != NULL)
+    World::getInstance().unselectAtom(state->params.Walker);
 
-  return Action::state_ptr(new SelectionAtomByIdState(state->walker));
+  return Action::state_ptr(_state);
 }
 
@@ -83,8 +61,8 @@
   SelectionAtomByIdState *state = assert_cast<SelectionAtomByIdState*>(_state.get());
 
-  if (state->walker != NULL)
-    World::getInstance().selectAtom(state->walker);
+  if (state->params.Walker != NULL)
+    World::getInstance().selectAtom(state->params.Walker);
 
-  return Action::state_ptr(new SelectionAtomByIdState(state->walker));
+  return Action::state_ptr(_state);
 }
 
@@ -100,2 +78,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/AtomByIdAction.def
===================================================================
--- src/Actions/SelectionAction/AtomByIdAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/AtomByIdAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * AtomByIdAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class atom;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (atom*)
+#define paramtokens (SelectionAtomByIdAction::NAME)
+#define paramreferences (Walker)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME AtomById
+#define TOKEN "select-atom-by-id"
+
Index: src/Actions/SelectionAction/AtomByIdAction.hpp
===================================================================
--- src/Actions/SelectionAction/AtomByIdAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/AtomByIdAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,28 +11,6 @@
 #include "Actions/Action.hpp"
 
-class atom;
-
-void SelectionAtomById(atom *_atom);
-
-class SelectionAtomByIdAction : public Action {
-  friend void SelectionAtomById(atom *_atom);
-
-public:
-  SelectionAtomByIdAction();
-  virtual ~SelectionAtomByIdAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "AtomByIdAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* ATOMBYIDACTION_HPP_ */
Index: src/Actions/SelectionAction/ClearAllAtomsAction.cpp
===================================================================
--- src/Actions/SelectionAction/ClearAllAtomsAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/ClearAllAtomsAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,78 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * ClearAllAtomsAction.cpp
+ *
+ *  Created on: Aug 09, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/AtomDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/ClearAllAtomsAction.hpp"
+
+// and construct the stuff
+#include "ClearAllAtomsAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionClearAllAtomsAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
+
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+  DoLog(1) && (Log() << Verbose(1) << "Clearing atoms selection." << endl);
+  World::getInstance().clearAtomSelection();
+  return Action::state_ptr(new SelectionClearAllAtomsState(selectedAtoms, params));
+}
+
+Action::state_ptr SelectionClearAllAtomsAction::performUndo(Action::state_ptr _state) {
+  SelectionClearAllAtomsState *state = assert_cast<SelectionClearAllAtomsState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionClearAllAtomsAction::performRedo(Action::state_ptr _state){
+  //SelectionClearAllAtomsState *state = assert_cast<SelectionClearAllAtomsState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionClearAllAtomsAction::canUndo() {
+  return true;
+}
+
+bool SelectionClearAllAtomsAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionClearAllAtomsAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/ClearAllAtomsAction.def
===================================================================
--- src/Actions/SelectionAction/ClearAllAtomsAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/ClearAllAtomsAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,24 @@
+/*
+ * ClearAllAtomsAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME ClearAllAtoms
+#define TOKEN "clear-atom-selection"
+
Index: src/Actions/SelectionAction/ClearAllAtomsAction.hpp
===================================================================
--- src/Actions/SelectionAction/ClearAllAtomsAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/ClearAllAtomsAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * ClearAllAtomsAction.hpp
+ *
+ *  Created on: Aug 09, 2010
+ *      Author: heber
+ */
+
+#ifndef CLEARALLATOMSACTION_HPP_
+#define CLEARALLATOMSACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "ClearAllAtomsAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* CLEARALLATOMSACTION_HPP_ */
Index: src/Actions/SelectionAction/ClearAllMoleculesAction.cpp
===================================================================
--- src/Actions/SelectionAction/ClearAllMoleculesAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/ClearAllMoleculesAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,78 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * ClearAllMoleculesAction.cpp
+ *
+ *  Created on: Aug 09, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/MoleculeDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/ClearAllMoleculesAction.hpp"
+
+// and construct the stuff
+#include "ClearAllMoleculesAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionClearAllMoleculesAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
+
+  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+  DoLog(1) && (Log() << Verbose(1) << "Clearing molecule selection." << endl);
+  World::getInstance().clearMoleculeSelection();
+  return Action::state_ptr(new SelectionClearAllMoleculesState(selectedMolecules,params));
+}
+
+Action::state_ptr SelectionClearAllMoleculesAction::performUndo(Action::state_ptr _state) {
+  SelectionClearAllMoleculesState *state = assert_cast<SelectionClearAllMoleculesState*>(_state.get());
+
+  World::getInstance().clearMoleculeSelection();
+  for(std::vector<molecule *>::iterator iter = state->selectedMolecules.begin(); iter != state->selectedMolecules.end(); ++iter)
+    World::getInstance().selectMolecule(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionClearAllMoleculesAction::performRedo(Action::state_ptr _state){
+  //SelectionClearAllMoleculesState *state = assert_cast<SelectionClearAllMoleculesState*>(_state.get());
+
+  World::getInstance().clearMoleculeSelection();
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionClearAllMoleculesAction::canUndo() {
+  return true;
+}
+
+bool SelectionClearAllMoleculesAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionClearAllMoleculesAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/ClearAllMoleculesAction.def
===================================================================
--- src/Actions/SelectionAction/ClearAllMoleculesAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/ClearAllMoleculesAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,24 @@
+/*
+ * ClearAllMoleculesAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#define statetypes (std::vector<molecule*>)
+#define statereferences (selectedMolecules)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME ClearAllMolecules
+#define TOKEN "clear-molecule-selection"
+
Index: src/Actions/SelectionAction/ClearAllMoleculesAction.hpp
===================================================================
--- src/Actions/SelectionAction/ClearAllMoleculesAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/ClearAllMoleculesAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * ClearAllMoleculesAction.hpp
+ *
+ *  Created on: Aug 09, 2010
+ *      Author: heber
+ */
+
+#ifndef CLEARALLMOLECULESSACTION_HPP_
+#define CLEARALLMOLECULESSACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "ClearAllMoleculesAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* CLEARALLMOLECULESSACTION_HPP_ */
Index: src/Actions/SelectionAction/MoleculeByFormulaAction.cpp
===================================================================
--- src/Actions/SelectionAction/MoleculeByFormulaAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/MoleculeByFormulaAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,83 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * MoleculeByFormulaAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/MoleculeFormulaDescriptor.hpp"
+#include "molecule.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/MoleculeByFormulaAction.hpp"
+
+// and construct the stuff
+#include "MoleculeByFormulaAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionMoleculeByFormulaAction::performCall() {
+  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  DoLog(1) && (Log() << Verbose(1) << "Selecting molecules with chemical formula " << params.formula << ":" << endl);
+  std::vector<molecule *> matchingMolecules = World::getInstance().getAllMolecules(MoleculeByFormula(params.formula));
+  for (std::vector<molecule *>::const_iterator iter = matchingMolecules.begin(); iter != matchingMolecules.end(); ++iter) {
+    DoLog(1) && (Log() << Verbose(1) << "\t" << (*iter)->getId() << ", " << (*iter)->getName() << "." << endl);
+  }
+  World::getInstance().selectAllMolecules(MoleculeByFormula(params.formula));
+  return Action::state_ptr(new SelectionMoleculeByFormulaState(selectedMolecules,params));
+}
+
+Action::state_ptr SelectionMoleculeByFormulaAction::performUndo(Action::state_ptr _state) {
+  SelectionMoleculeByFormulaState *state = assert_cast<SelectionMoleculeByFormulaState*>(_state.get());
+
+  World::getInstance().clearMoleculeSelection();
+  for(std::vector<molecule *>::iterator iter = state->selectedMolecules.begin(); iter != state->selectedMolecules.end(); ++iter)
+    World::getInstance().selectMolecule(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionMoleculeByFormulaAction::performRedo(Action::state_ptr _state){
+  SelectionMoleculeByFormulaState *state = assert_cast<SelectionMoleculeByFormulaState*>(_state.get());
+
+  World::getInstance().selectAllMolecules(MoleculeByFormula(state->params.formula));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionMoleculeByFormulaAction::canUndo() {
+  return true;
+}
+
+bool SelectionMoleculeByFormulaAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionMoleculeByFormulaAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/MoleculeByFormulaAction.def
===================================================================
--- src/Actions/SelectionAction/MoleculeByFormulaAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/MoleculeByFormulaAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * MoleculeByFormulaAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class molecule;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (SelectionMoleculeByFormulaAction::NAME)
+#define paramreferences (formula)
+
+#define statetypes (std::vector<molecule*>)
+#define statereferences (selectedMolecules)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME MoleculeByFormula
+#define TOKEN "select-molecule-by-formula"
+
Index: src/Actions/SelectionAction/MoleculeByFormulaAction.hpp
===================================================================
--- src/Actions/SelectionAction/MoleculeByFormulaAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/MoleculeByFormulaAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * MoleculeByFormulaAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef MOLECULEBYFORMULAACTION_HPP_
+#define MOLECULEBYFORMULAACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "MoleculeByFormulaAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* MOLECULEBYFORMULAACTION_HPP_ */
Index: src/Actions/SelectionAction/MoleculeByIdAction.cpp
===================================================================
--- src/Actions/SelectionAction/MoleculeByIdAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/MoleculeByIdAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MoleculeByIdAction.cpp
@@ -6,11 +13,14 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/SelectionAction/MoleculeByIdAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "molecule.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -20,50 +30,18 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/SelectionAction/MoleculeByIdAction.hpp"
 
+// and construct the stuff
+#include "MoleculeByIdAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionMoleculeByIdAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
-// memento to remember the state when undoing
-
-class SelectionMoleculeByIdState : public ActionState {
-public:
-  SelectionMoleculeByIdState(molecule* _mol) :
-    mol(_mol)
-  {}
-  molecule* mol;
-};
-
-const char SelectionMoleculeByIdAction::NAME[] = "select-molecule-by-id";
-
-SelectionMoleculeByIdAction::SelectionMoleculeByIdAction() :
-  Action(NAME)
-{}
-
-SelectionMoleculeByIdAction::~SelectionMoleculeByIdAction()
-{}
-
-void SelectionMoleculeById(molecule *_mol) {
-  ValueStorage::getInstance().setCurrentValue(SelectionMoleculeByIdAction::NAME, _mol);
-  ActionRegistry::getInstance().getActionByName(SelectionMoleculeByIdAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* SelectionMoleculeByIdAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryMolecule(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr SelectionMoleculeByIdAction::performCall() {
-  molecule *mol = NULL;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, mol);
-
-  if (!World::getInstance().isSelected(mol)) {
-    DoLog(1) && (Log() << Verbose(1) << "Selecting molecule " << mol->name << endl);
-    World::getInstance().selectMolecule(mol);
-    return Action::state_ptr(new SelectionMoleculeByIdState(mol));
+  if (!World::getInstance().isSelected(params.mol)) {
+    DoLog(1) && (Log() << Verbose(1) << "Selecting molecule " << params.mol->name << endl);
+    World::getInstance().selectMolecule(params.mol);
+    return Action::state_ptr(new SelectionMoleculeByIdState(params));
   } else {
     return Action::success;
@@ -74,8 +52,8 @@
   SelectionMoleculeByIdState *state = assert_cast<SelectionMoleculeByIdState*>(_state.get());
 
-  if (state->mol != NULL)
-    World::getInstance().unselectMolecule(state->mol);
+  if (state->params.mol != NULL)
+    World::getInstance().unselectMolecule(state->params.mol);
 
-  return Action::state_ptr(new SelectionMoleculeByIdState(state->mol));
+  return Action::state_ptr(_state);
 }
 
@@ -83,8 +61,8 @@
   SelectionMoleculeByIdState *state = assert_cast<SelectionMoleculeByIdState*>(_state.get());
 
-  if (state->mol != NULL)
-    World::getInstance().selectMolecule(state->mol);
+  if (state->params.mol != NULL)
+    World::getInstance().selectMolecule(state->params.mol);
 
-  return Action::state_ptr(new SelectionMoleculeByIdState(state->mol));
+  return Action::state_ptr(state);
 }
 
@@ -100,2 +78,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/MoleculeByIdAction.def
===================================================================
--- src/Actions/SelectionAction/MoleculeByIdAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/MoleculeByIdAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * MoleculeByIdAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class molecule;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (molecule*)
+#define paramtokens (SelectionMoleculeByIdAction::NAME)
+#define paramreferences (mol)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME MoleculeById
+#define TOKEN "select-molecule-by-id"
+
Index: src/Actions/SelectionAction/MoleculeByIdAction.hpp
===================================================================
--- src/Actions/SelectionAction/MoleculeByIdAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/MoleculeByIdAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,28 +11,6 @@
 #include "Actions/Action.hpp"
 
-class molecule;
-
-void SelectionMoleculeById(molecule *_mol);
-
-class SelectionMoleculeByIdAction : public Action {
-  friend void SelectionMoleculeById(molecule *_mol);
-
-public:
-  SelectionMoleculeByIdAction();
-  virtual ~SelectionMoleculeByIdAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "MoleculeByIdAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* MOLECULEBYIDACTION_HPP_ */
Index: src/Actions/SelectionAction/MoleculeOfAtomAction.cpp
===================================================================
--- src/Actions/SelectionAction/MoleculeOfAtomAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/MoleculeOfAtomAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,78 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * MoleculeOfAtomAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/MoleculeDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/MoleculeOfAtomAction.hpp"
+
+// and construct the stuff
+#include "MoleculeOfAtomAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionMoleculeOfAtomAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
+
+  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+  DoLog(1) && (Log() << Verbose(1) << "Selecting molecule to which " << params.Walker->getName() << " belongs." << endl);
+  World::getInstance().selectMoleculeOfAtom(params.Walker);
+  return Action::state_ptr(new SelectionMoleculeOfAtomState(selectedMolecules, params));
+}
+
+Action::state_ptr SelectionMoleculeOfAtomAction::performUndo(Action::state_ptr _state) {
+  SelectionMoleculeOfAtomState *state = assert_cast<SelectionMoleculeOfAtomState*>(_state.get());
+
+  World::getInstance().clearMoleculeSelection();
+  for(std::vector<molecule *>::iterator iter = state->selectedMolecules.begin(); iter != state->selectedMolecules.end(); ++iter)
+    World::getInstance().selectMolecule(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionMoleculeOfAtomAction::performRedo(Action::state_ptr _state){
+  SelectionMoleculeOfAtomState *state = assert_cast<SelectionMoleculeOfAtomState*>(_state.get());
+
+  World::getInstance().selectMoleculeOfAtom(state->params.Walker);
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionMoleculeOfAtomAction::canUndo() {
+  return true;
+}
+
+bool SelectionMoleculeOfAtomAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionMoleculeOfAtomAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/MoleculeOfAtomAction.def
===================================================================
--- src/Actions/SelectionAction/MoleculeOfAtomAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/MoleculeOfAtomAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,24 @@
+/*
+ * MoleculeOfAtomAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (atom*)
+#define paramtokens (SelectionMoleculeOfAtomAction::NAME)
+#define paramreferences (Walker)
+
+#define statetypes (std::vector<molecule*>)
+#define statereferences (selectedMolecules)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME MoleculeOfAtom
+#define TOKEN "select-molecule-of-atom"
+
Index: src/Actions/SelectionAction/MoleculeOfAtomAction.hpp
===================================================================
--- src/Actions/SelectionAction/MoleculeOfAtomAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/MoleculeOfAtomAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * MoleculeOfAtomAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef MOLECULEOFATOMSACTION_HPP_
+#define MOLECULEOFATOMSACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "MoleculeOfAtomAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* MOLECULEOFATOMSACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAllAtomsAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/NotAllAtomsAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * NotAllAtomsAction.cpp
@@ -6,12 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/SelectionAction/NotAllAtomsAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "Descriptors/AtomDescriptor.hpp"
 #include "atom.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -21,49 +31,22 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/SelectionAction/NotAllAtomsAction.hpp"
 
+// and construct the stuff
+#include "NotAllAtomsAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionNotAllAtomsAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
-// memento to remember the state when undoing
-
-class SelectionAllAtomsState : public ActionState {
-public:
-  SelectionAllAtomsState(std::vector<atom*> _selectedAtoms) :
-    selectedAtoms(_selectedAtoms)
-  {}
-  std::vector<atom*> selectedAtoms;
-};
-
-const char SelectionNotAllAtomsAction::NAME[] = "unselect-all-atoms";
-
-SelectionNotAllAtomsAction::SelectionNotAllAtomsAction() :
-  Action(NAME)
-{}
-
-SelectionNotAllAtomsAction::~SelectionNotAllAtomsAction()
-{}
-
-void SelectionNotAllAtoms() {
-  ActionRegistry::getInstance().getActionByName(SelectionNotAllAtomsAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* SelectionNotAllAtomsAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr SelectionNotAllAtomsAction::performCall() {
   std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
   DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms." << endl);
   World::getInstance().clearAtomSelection();
-  return Action::state_ptr(new SelectionAllAtomsState(selectedAtoms));
+  return Action::state_ptr(new SelectionNotAllAtomsState(selectedAtoms, params));
 }
 
 Action::state_ptr SelectionNotAllAtomsAction::performUndo(Action::state_ptr _state) {
-  SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
+  SelectionNotAllAtomsState *state = assert_cast<SelectionNotAllAtomsState*>(_state.get());
 
   World::getInstance().clearAtomSelection();
@@ -71,13 +54,13 @@
     World::getInstance().selectAtom(*iter);
 
-  return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
+  return Action::state_ptr(_state);
 }
 
 Action::state_ptr SelectionNotAllAtomsAction::performRedo(Action::state_ptr _state){
-  SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
+  //SelectionNotAllAtomsState *state = assert_cast<SelectionNotAllAtomsState*>(_state.get());
 
   World::getInstance().clearAtomSelection();
 
-  return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
+  return Action::state_ptr(_state);
 }
 
@@ -93,2 +76,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/NotAllAtomsAction.def
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAllAtomsAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * NotAllAtomsAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME NotAllAtoms
+#define TOKEN "unselect-all-atoms"
+
Index: src/Actions/SelectionAction/NotAllAtomsAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/NotAllAtomsAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void SelectionNotAllAtoms();
-
-class SelectionNotAllAtomsAction : public Action {
-  friend void SelectionNotAllAtoms();
-
-public:
-  SelectionNotAllAtomsAction();
-  virtual ~SelectionNotAllAtomsAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "NotAllAtomsAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* NOTALLATOMSACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,92 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * NotAllAtomsInsideCuboidAction.cpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/AtomDescriptor.hpp"
+#include "Descriptors/AtomShapeDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Matrix.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Shapes/BaseShapes.hpp"
+#include "Shapes/Shape.hpp"
+#include "Shapes/ShapeOps.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp"
+
+// and construct the stuff
+#include "NotAllAtomsInsideCuboidAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionNotAllAtomsInsideCuboidAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+  Matrix RotationMatrix;
+
+  // obtain information
+  getParametersfromValueStorage();
+  RotationMatrix.rotation(params.Xangle, params.Yangle, params.Zangle);
+
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms inside a rotated " << RotationMatrix << " cuboid at " << params.position << " and extension of " << params.extension << "." << endl);
+  Shape s = translate(transform(stretch(Cuboid(),params.extension),RotationMatrix),params.position);
+
+  World::getInstance().unselectAllAtoms(AtomByShape(s));
+  return Action::state_ptr(new SelectionNotAllAtomsInsideCuboidState(selectedAtoms, params));
+}
+
+Action::state_ptr SelectionNotAllAtomsInsideCuboidAction::performUndo(Action::state_ptr _state) {
+  SelectionNotAllAtomsInsideCuboidState *state = assert_cast<SelectionNotAllAtomsInsideCuboidState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionNotAllAtomsInsideCuboidAction::performRedo(Action::state_ptr _state){
+  SelectionNotAllAtomsInsideCuboidState *state = assert_cast<SelectionNotAllAtomsInsideCuboidState*>(_state.get());
+  Matrix RotationMatrix;
+
+  RotationMatrix.rotation(state->params.Xangle, state->params.Yangle, state->params.Zangle);
+  Shape s = translate(transform(stretch(Cuboid(),state->params.extension),RotationMatrix),state->params.position);
+  World::getInstance().unselectAllAtoms(AtomByShape(s));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionNotAllAtomsInsideCuboidAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotAllAtomsInsideCuboidAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotAllAtomsInsideCuboidAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.def
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * NotAllAtomsInsideCuboidAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class Vector;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (Vector) (Vector) (double) (double) (double)
+#define paramtokens (SelectionNotAllAtomsInsideCuboidAction::NAME) ("position") ("angle-x") ("angle-y") ("angle-z")
+#define paramreferences (extension) (position) (Xangle) (Yangle) (Zangle)
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME NotAllAtomsInsideCuboid
+#define TOKEN "unselect-atoms-inside-cuboid"
+
Index: src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * NotAllAtomsInsideCuboidAction.hpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTALLATOMSINSIDECUBOIDACTION_HPP_
+#define NOTALLATOMSINSIDECUBOIDACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "NotAllAtomsInsideCuboidAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* NOTALLATOMSINSIDECUBOIDACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,86 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * NotAllAtomsInsideSphereAction.cpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/AtomDescriptor.hpp"
+#include "Descriptors/AtomShapeDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Shapes/BaseShapes.hpp"
+#include "Shapes/Shape.hpp"
+#include "Shapes/ShapeOps.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp"
+
+// and construct the stuff
+#include "NotAllAtomsInsideSphereAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionNotAllAtomsInsideSphereAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms inside a sphere at " << params.position << " with radius " << params.radius << "." << endl);
+  Shape s = translate(resize(Sphere(),params.radius),params.position);
+  World::getInstance().unselectAllAtoms(AtomByShape(s));
+  return Action::state_ptr(new SelectionNotAllAtomsInsideSphereState(selectedAtoms, params));
+}
+
+Action::state_ptr SelectionNotAllAtomsInsideSphereAction::performUndo(Action::state_ptr _state) {
+  SelectionNotAllAtomsInsideSphereState *state = assert_cast<SelectionNotAllAtomsInsideSphereState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionNotAllAtomsInsideSphereAction::performRedo(Action::state_ptr _state){
+  SelectionNotAllAtomsInsideSphereState *state = assert_cast<SelectionNotAllAtomsInsideSphereState*>(_state.get());
+
+  Shape s = translate(resize(Sphere(),state->params.radius),state->params.position);
+  World::getInstance().unselectAllAtoms(AtomByShape(s));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionNotAllAtomsInsideSphereAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotAllAtomsInsideSphereAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotAllAtomsInsideSphereAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.def
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * NotAllAtomsInsideSphereAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class Vector;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (double) (Vector)
+#define paramtokens (SelectionNotAllAtomsInsideSphereAction::NAME) ("position")
+#define paramreferences (radius) (position)
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME NotAllAtomsInsideSphere
+#define TOKEN "unselect-atoms-inside-sphere"
+
Index: src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * NotAllAtomsInsideSphereAction.hpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTALLATOMSINSIDESPHEREACTION_HPP_
+#define NOTALLATOMSINSIDESPHEREACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "NotAllAtomsInsideSphereAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* NOTALLATOMSINSIDESPHEREACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,80 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * NotAllAtomsOfMoleculeAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/AtomDescriptor.hpp"
+#include "atom.hpp"
+#include "molecule.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/NotAllAtomsOfMoleculeAction.hpp"
+
+// and construct the stuff
+#include "NotAllAtomsOfMoleculeAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionNotAllAtomsOfMoleculeAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms of molecule " << params.mol->getName() << "." << endl);
+  World::getInstance().unselectAtomsOfMolecule(params.mol);
+  return Action::state_ptr(new SelectionNotAllAtomsOfMoleculeState(selectedAtoms, params));
+}
+
+Action::state_ptr SelectionNotAllAtomsOfMoleculeAction::performUndo(Action::state_ptr _state) {
+  SelectionNotAllAtomsOfMoleculeState *state = assert_cast<SelectionNotAllAtomsOfMoleculeState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionNotAllAtomsOfMoleculeAction::performRedo(Action::state_ptr _state){
+  SelectionNotAllAtomsOfMoleculeState *state = assert_cast<SelectionNotAllAtomsOfMoleculeState*>(_state.get());
+
+  World::getInstance().unselectAtomsOfMolecule(state->params.mol);
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionNotAllAtomsOfMoleculeAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotAllAtomsOfMoleculeAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotAllAtomsOfMoleculeAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.def
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * NotAllAtomsOfMoleculeAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (molecule*)
+#define paramtokens (SelectionNotAllAtomsOfMoleculeAction::NAME)
+#define paramreferences (mol)
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME NotAllAtomsOfMolecule
+#define TOKEN "unselect-molecules-atoms"
+
Index: src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * NotAllAtomsOfMoleculeAction.hpp
+ *
+ *  Created on: Aug 09, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTALLATOMSOFMOLECULEACTION_HPP_
+#define NOTALLATOMSOFMOLECULEACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "NotAllAtomsOfMoleculeAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* NOTALLATOMSOFMOLECULEACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAllMoleculesAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAllMoleculesAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/NotAllMoleculesAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * NotAllMoleculesAction.cpp
@@ -6,12 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/SelectionAction/NotAllMoleculesAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "Descriptors/MoleculeDescriptor.hpp"
 #include "atom.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -21,45 +31,18 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/SelectionAction/NotAllMoleculesAction.hpp"
 
+// and construct the stuff
+#include "NotAllMoleculesAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionNotAllMoleculesAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
-// memento to remember the state when undoing
-
-class SelectionNotAllMoleculesState : public ActionState {
-public:
-  SelectionNotAllMoleculesState(std::vector<molecule*> selectedMolecules) :
-    selectedMolecules(selectedMolecules)
-  {}
-  std::vector<molecule*> selectedMolecules;
-};
-
-const char SelectionNotAllMoleculesAction::NAME[] = "unselect-all-molecules";
-
-SelectionNotAllMoleculesAction::SelectionNotAllMoleculesAction() :
-  Action(NAME)
-{}
-
-SelectionNotAllMoleculesAction::~SelectionNotAllMoleculesAction()
-{}
-
-void SelectionNotAllMolecules() {
-  ActionRegistry::getInstance().getActionByName(SelectionNotAllMoleculesAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* SelectionNotAllMoleculesAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr SelectionNotAllMoleculesAction::performCall() {
   std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
   DoLog(1) && (Log() << Verbose(1) << "Unselecting all molecules." << endl);
   World::getInstance().clearMoleculeSelection();
-  return Action::state_ptr(new SelectionNotAllMoleculesState(selectedMolecules));
+  return Action::state_ptr(new SelectionNotAllMoleculesState(selectedMolecules,params));
 }
 
@@ -71,13 +54,13 @@
     World::getInstance().selectMolecule(*iter);
 
-  return Action::state_ptr(new SelectionNotAllMoleculesState(state->selectedMolecules));
+  return Action::state_ptr(_state);
 }
 
 Action::state_ptr SelectionNotAllMoleculesAction::performRedo(Action::state_ptr _state){
-  SelectionNotAllMoleculesState *state = assert_cast<SelectionNotAllMoleculesState*>(_state.get());
+  //SelectionNotAllMoleculesState *state = assert_cast<SelectionNotAllMoleculesState*>(_state.get());
 
   World::getInstance().clearMoleculeSelection();
 
-  return Action::state_ptr(new SelectionNotAllMoleculesState(state->selectedMolecules));
+  return Action::state_ptr(_state);
 }
 
@@ -93,2 +76,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/NotAllMoleculesAction.def
===================================================================
--- src/Actions/SelectionAction/NotAllMoleculesAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAllMoleculesAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,24 @@
+/*
+ * NotAllMoleculesAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#define statetypes (std::vector<molecule*>)
+#define statereferences (selectedMolecules)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME NotAllMolecules
+#define TOKEN "unselect-all-molecules"
+
Index: src/Actions/SelectionAction/NotAllMoleculesAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAllMoleculesAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/NotAllMoleculesAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -2,5 +2,5 @@
  * NotAllMoleculesAction.hpp
  *
- *  Created on: May 12, 2010
+ *  Created on: Aug 09, 2010
  *      Author: heber
  */
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void SelectionNotAllMolecules();
-
-class SelectionNotAllMoleculesAction : public Action {
-  friend void SelectionNotAllMolecules();
-
-public:
-  SelectionNotAllMoleculesAction();
-  virtual ~SelectionNotAllMoleculesAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "NotAllMoleculesAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* NOTALLMOLECULESSACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAtomByElementAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAtomByElementAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAtomByElementAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,80 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * NotAtomByElementAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/AtomTypeDescriptor.hpp"
+#include "atom.hpp"
+#include "element.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/NotAtomByElementAction.hpp"
+
+// and construct the stuff
+#include "NotAtomByElementAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionNotAtomByElementAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting atoms of type " << *params.elemental << endl);
+  World::getInstance().unselectAllAtoms(AtomByType(params.elemental));
+  return Action::state_ptr(new SelectionNotAtomByElementState(selectedAtoms,params));
+}
+
+Action::state_ptr SelectionNotAtomByElementAction::performUndo(Action::state_ptr _state) {
+  SelectionNotAtomByElementState *state = assert_cast<SelectionNotAtomByElementState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionNotAtomByElementAction::performRedo(Action::state_ptr _state){
+  SelectionNotAtomByElementState *state = assert_cast<SelectionNotAtomByElementState*>(_state.get());
+
+  World::getInstance().unselectAllAtoms(AtomByType(state->params.elemental));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionNotAtomByElementAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotAtomByElementAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotAtomByElementAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/NotAtomByElementAction.def
===================================================================
--- src/Actions/SelectionAction/NotAtomByElementAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAtomByElementAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * NotAtomByElementAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class element;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (const element*)
+#define paramtokens (SelectionNotAtomByElementAction::NAME)
+#define paramreferences (elemental)
+
+#define statetypes (std::vector<atom*>)
+#define statereferences (selectedAtoms)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME NotAtomByElement
+#define TOKEN "unselect-atom-by-element"
+
Index: src/Actions/SelectionAction/NotAtomByElementAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAtomByElementAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAtomByElementAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * NotAtomByElementAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTATOMBYELEMENTACTION_HPP_
+#define NOTATOMBYELEMENTACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "NotAtomByElementAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* NOTATOMBYELEMENTACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAtomByIdAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAtomByIdAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/NotAtomByIdAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * NotAtomByIdAction.cpp
@@ -6,11 +13,14 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/SelectionAction/NotAtomByIdAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "atom.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -20,50 +30,18 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/SelectionAction/NotAtomByIdAction.hpp"
 
+// and construct the stuff
+#include "NotAtomByIdAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionNotAtomByIdAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
-// memento to remember the state when undoing
-
-class SelectionNotAtomByIdState : public ActionState {
-public:
-  SelectionNotAtomByIdState(atom* _walker) :
-    walker(_walker)
-  {}
-  atom* walker;
-};
-
-const char SelectionNotAtomByIdAction::NAME[] = "unselect-atom-by-id";
-
-SelectionNotAtomByIdAction::SelectionNotAtomByIdAction() :
-  Action(NAME)
-{}
-
-SelectionNotAtomByIdAction::~SelectionNotAtomByIdAction()
-{}
-
-void SelectionNotAtomById(atom *_atom) {
-  ValueStorage::getInstance().setCurrentValue(SelectionNotAtomByIdAction::NAME, _atom);
-  ActionRegistry::getInstance().getActionByName(SelectionNotAtomByIdAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* SelectionNotAtomByIdAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryAtom(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr SelectionNotAtomByIdAction::performCall() {
-  atom *Walker = NULL;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, Walker);
-
-  if (World::getInstance().isSelected(Walker)) {
-    DoLog(1) && (Log() << Verbose(1) << "Unselecting atom " << *Walker << endl);
-    World::getInstance().unselectAtom(Walker);
-    return Action::state_ptr(new SelectionNotAtomByIdState(Walker));
+  if (World::getInstance().isSelected(params.Walker)) {
+    DoLog(1) && (Log() << Verbose(1) << "Unselecting atom " << *params.Walker << endl);
+    World::getInstance().unselectAtom(params.Walker);
+    return Action::state_ptr(new SelectionNotAtomByIdState(params));
   } else {
     return Action::success;
@@ -74,8 +52,8 @@
   SelectionNotAtomByIdState *state = assert_cast<SelectionNotAtomByIdState*>(_state.get());
 
-  if (state->walker != NULL)
-    World::getInstance().selectAtom(state->walker);
+  if (state->params.Walker != NULL)
+    World::getInstance().selectAtom(state->params.Walker);
 
-  return Action::state_ptr(new SelectionNotAtomByIdState(state->walker));
+  return Action::state_ptr(_state);
 }
 
@@ -83,8 +61,8 @@
   SelectionNotAtomByIdState *state = assert_cast<SelectionNotAtomByIdState*>(_state.get());
 
-  if (state->walker != NULL)
-    World::getInstance().unselectAtom(state->walker);
+  if (state->params.Walker != NULL)
+    World::getInstance().unselectAtom(state->params.Walker);
 
-  return Action::state_ptr(new SelectionNotAtomByIdState(state->walker));
+  return Action::state_ptr(_state);
 }
 
@@ -100,2 +78,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/NotAtomByIdAction.def
===================================================================
--- src/Actions/SelectionAction/NotAtomByIdAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotAtomByIdAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * NotAtomByIdAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class atom;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (atom*)
+#define paramtokens (SelectionNotAtomByIdAction::NAME)
+#define paramreferences (Walker)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME NotAtomById
+#define TOKEN "unselect-atom-by-id"
+
Index: src/Actions/SelectionAction/NotAtomByIdAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAtomByIdAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/NotAtomByIdAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,28 +11,6 @@
 #include "Actions/Action.hpp"
 
-class atom;
-
-void SelectionNotAtomById(atom *_atom);
-
-class SelectionNotAtomByIdAction : public Action {
-  friend void SelectionNotAtomById(atom *_atom);
-
-public:
-  SelectionNotAtomByIdAction();
-  virtual ~SelectionNotAtomByIdAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "NotAtomByIdAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* NOTATOMBYIDACTION_HPP_ */
Index: src/Actions/SelectionAction/NotMoleculeByFormulaAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotMoleculeByFormulaAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotMoleculeByFormulaAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,83 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * NotMoleculeByFormulaAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/MoleculeFormulaDescriptor.hpp"
+#include "molecule.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/NotMoleculeByFormulaAction.hpp"
+
+// and construct the stuff
+#include "NotMoleculeByFormulaAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionNotMoleculeByFormulaAction::performCall() {
+  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+
+  // obtain information
+  getParametersfromValueStorage();
+
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting molecules with chemical formula " << params.formula << ":" << endl);
+  std::vector<molecule *> matchingMolecules = World::getInstance().getAllMolecules(MoleculeByFormula(params.formula));
+  for (std::vector<molecule *>::const_iterator iter = matchingMolecules.begin(); iter != matchingMolecules.end(); ++iter) {
+    DoLog(1) && (Log() << Verbose(1) << "\t" << (*iter)->getId() << ", " << (*iter)->getName() << "." << endl);
+  }
+  World::getInstance().unselectAllMolecules(MoleculeByFormula(params.formula));
+  return Action::state_ptr(new SelectionNotMoleculeByFormulaState(selectedMolecules,params));
+}
+
+Action::state_ptr SelectionNotMoleculeByFormulaAction::performUndo(Action::state_ptr _state) {
+  SelectionNotMoleculeByFormulaState *state = assert_cast<SelectionNotMoleculeByFormulaState*>(_state.get());
+
+  World::getInstance().clearMoleculeSelection();
+  for(std::vector<molecule *>::iterator iter = state->selectedMolecules.begin(); iter != state->selectedMolecules.end(); ++iter)
+    World::getInstance().selectMolecule(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionNotMoleculeByFormulaAction::performRedo(Action::state_ptr _state){
+  SelectionNotMoleculeByFormulaState *state = assert_cast<SelectionNotMoleculeByFormulaState*>(_state.get());
+
+  World::getInstance().unselectAllMolecules(MoleculeByFormula(state->params.formula));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionNotMoleculeByFormulaAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotMoleculeByFormulaAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotMoleculeByFormulaAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/NotMoleculeByFormulaAction.def
===================================================================
--- src/Actions/SelectionAction/NotMoleculeByFormulaAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotMoleculeByFormulaAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * NotMoleculeByFormulaAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class molecule;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (SelectionNotMoleculeByFormulaAction::NAME)
+#define paramreferences (formula)
+
+#define statetypes (std::vector<molecule*>)
+#define statereferences (selectedMolecules)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME NotMoleculeByFormula
+#define TOKEN "unselect-molecule-by-formula"
+
Index: src/Actions/SelectionAction/NotMoleculeByFormulaAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotMoleculeByFormulaAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotMoleculeByFormulaAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * NotMoleculeByFormulaAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTMOLECULEBYFORMULAACTION_HPP_
+#define NOTMOLECULEBYFORMULAACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "NotMoleculeByFormulaAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* NOTMOLECULEBYFORMULAACTION_HPP_ */
Index: src/Actions/SelectionAction/NotMoleculeByIdAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotMoleculeByIdAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/NotMoleculeByIdAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * NotMoleculeByIdAction.cpp
@@ -6,11 +13,14 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/SelectionAction/NotMoleculeByIdAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "molecule.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -20,50 +30,18 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/SelectionAction/NotMoleculeByIdAction.hpp"
 
+// and construct the stuff
+#include "NotMoleculeByIdAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionNotMoleculeByIdAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
-// memento to remember the state when undoing
-
-class SelectionNotMoleculeByIdState : public ActionState {
-public:
-  SelectionNotMoleculeByIdState(molecule* _mol) :
-    mol(_mol)
-  {}
-  molecule* mol;
-};
-
-const char SelectionNotMoleculeByIdAction::NAME[] = "unselect-molecule-by-id";
-
-SelectionNotMoleculeByIdAction::SelectionNotMoleculeByIdAction() :
-  Action(NAME)
-{}
-
-SelectionNotMoleculeByIdAction::~SelectionNotMoleculeByIdAction()
-{}
-
-void SelectionNotMoleculeById(molecule *_mol) {
-  ValueStorage::getInstance().setCurrentValue(SelectionNotMoleculeByIdAction::NAME, _mol);
-  ActionRegistry::getInstance().getActionByName(SelectionNotMoleculeByIdAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* SelectionNotMoleculeByIdAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryMolecule(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr SelectionNotMoleculeByIdAction::performCall() {
-  molecule *mol = NULL;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, mol);
-
-  if (World::getInstance().isSelected(mol)) {
-    DoLog(1) && (Log() << Verbose(1) << "Unselecting molecule " << mol->name << endl);
-    World::getInstance().unselectMolecule(mol);
-    return Action::state_ptr(new SelectionNotMoleculeByIdState(mol));
+  if (World::getInstance().isSelected(params.mol)) {
+    DoLog(1) && (Log() << Verbose(1) << "Unselecting molecule " << params.mol->name << endl);
+    World::getInstance().unselectMolecule(params.mol);
+    return Action::state_ptr(new SelectionNotMoleculeByIdState(params));
   } else {
     return Action::success;
@@ -74,8 +52,8 @@
   SelectionNotMoleculeByIdState *state = assert_cast<SelectionNotMoleculeByIdState*>(_state.get());
 
-  if (state->mol != NULL)
-    World::getInstance().selectMolecule(state->mol);
+  if (state->params.mol != NULL)
+    World::getInstance().selectMolecule(state->params.mol);
 
-  return Action::state_ptr(new SelectionNotMoleculeByIdState(state->mol));
+  return Action::state_ptr(_state);
 }
 
@@ -83,8 +61,8 @@
   SelectionNotMoleculeByIdState *state = assert_cast<SelectionNotMoleculeByIdState*>(_state.get());
 
-  if (state->mol != NULL)
-    World::getInstance().unselectMolecule(state->mol);
+  if (state->params.mol != NULL)
+    World::getInstance().unselectMolecule(state->params.mol);
 
-  return Action::state_ptr(new SelectionNotMoleculeByIdState(state->mol));
+  return Action::state_ptr(_state);
 }
 
@@ -100,2 +78,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/NotMoleculeByIdAction.def
===================================================================
--- src/Actions/SelectionAction/NotMoleculeByIdAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotMoleculeByIdAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * NotMoleculeByIdAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class molecule;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (molecule*)
+#define paramtokens (SelectionNotMoleculeByIdAction::NAME)
+#define paramreferences (mol)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME NotMoleculeById
+#define TOKEN "unselect-molecule-by-id"
+
Index: src/Actions/SelectionAction/NotMoleculeByIdAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotMoleculeByIdAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/SelectionAction/NotMoleculeByIdAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,28 +11,6 @@
 #include "Actions/Action.hpp"
 
-class molecule;
-
-void SelectionNotMoleculeById(molecule *_mol);
-
-class SelectionNotMoleculeByIdAction : public Action {
-  friend void SelectionNotMoleculeById(molecule *_mol);
-
-public:
-  SelectionNotMoleculeByIdAction();
-  virtual ~SelectionNotMoleculeByIdAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "NotMoleculeByIdAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* NOTMOLECULEBYIDACTION_HPP_ */
Index: src/Actions/SelectionAction/NotMoleculeOfAtomAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotMoleculeOfAtomAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotMoleculeOfAtomAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,78 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * NotMoleculeOfAtomAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Descriptors/MoleculeDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "Actions/SelectionAction/NotMoleculeOfAtomAction.hpp"
+
+// and construct the stuff
+#include "NotMoleculeOfAtomAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr SelectionNotMoleculeOfAtomAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
+
+  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting molecule to which " << params.Walker->getName() << " belongs." << endl);
+  World::getInstance().unselectMoleculeOfAtom(params.Walker);
+  return Action::state_ptr(new SelectionNotMoleculeOfAtomState(selectedMolecules, params));
+}
+
+Action::state_ptr SelectionNotMoleculeOfAtomAction::performUndo(Action::state_ptr _state) {
+  SelectionNotMoleculeOfAtomState *state = assert_cast<SelectionNotMoleculeOfAtomState*>(_state.get());
+
+  World::getInstance().clearMoleculeSelection();
+  for(std::vector<molecule *>::iterator iter = state->selectedMolecules.begin(); iter != state->selectedMolecules.end(); ++iter)
+    World::getInstance().selectMolecule(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionNotMoleculeOfAtomAction::performRedo(Action::state_ptr _state){
+  SelectionNotMoleculeOfAtomState *state = assert_cast<SelectionNotMoleculeOfAtomState*>(_state.get());
+
+  World::getInstance().unselectMoleculeOfAtom(state->params.Walker);
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionNotMoleculeOfAtomAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotMoleculeOfAtomAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotMoleculeOfAtomAction::getName() {
+  return NAME;
+}
+/** =========== end of function ====================== */
Index: src/Actions/SelectionAction/NotMoleculeOfAtomAction.def
===================================================================
--- src/Actions/SelectionAction/NotMoleculeOfAtomAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotMoleculeOfAtomAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,24 @@
+/*
+ * NotMoleculeOfAtomAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (atom*)
+#define paramtokens (SelectionNotMoleculeOfAtomAction::NAME)
+#define paramreferences (Walker)
+
+#define statetypes (std::vector<molecule*>)
+#define statereferences (selectedMolecules)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Selection
+#define ACTIONNAME NotMoleculeOfAtom
+#define TOKEN "unselect-molecule-of-atom"
+
Index: src/Actions/SelectionAction/NotMoleculeOfAtomAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotMoleculeOfAtomAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/SelectionAction/NotMoleculeOfAtomAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,16 @@
+/*
+ * NotMoleculeOfAtomAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTMOLECULEOFATOMSACTION_HPP_
+#define NOTMOLECULEOFATOMSACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+#include "NotMoleculeOfAtomAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* NOTMOLECULEOFATOMSACTION_HPP_ */
Index: src/Actions/TesselationAction/ConvexEnvelopeAction.cpp
===================================================================
--- src/Actions/TesselationAction/ConvexEnvelopeAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/TesselationAction/ConvexEnvelopeAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ConvexEnvelopeAction.cpp
@@ -6,14 +13,18 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "boundary.hpp"
 #include "config.hpp"
 #include "linkedcell.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
+#include "tesselation.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -23,56 +34,17 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
 
-/****** TesselationConvexEnvelopeAction *****/
-
-// memento to remember the state when undoing
-
-//class TesselationConvexEnvelopeState : public ActionState {
-//public:
-//  TesselationConvexEnvelopeState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char TesselationConvexEnvelopeAction::NAME[] = "convex-envelope";
-
-TesselationConvexEnvelopeAction::TesselationConvexEnvelopeAction() :
-  Action(NAME)
-{}
-
-TesselationConvexEnvelopeAction::~TesselationConvexEnvelopeAction()
-{}
-
-void TesselationConvexEnvelope(std::string &filenameConvex, std::string &filenameNonConvex) {
-  ValueStorage::getInstance().setCurrentValue("convex-file", filenameConvex);
-  ValueStorage::getInstance().setCurrentValue("nonconvex-file", filenameConvex);
-  ActionRegistry::getInstance().getActionByName(TesselationConvexEnvelopeAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* TesselationConvexEnvelopeAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
-  dialog->queryString("convex-file", ValueStorage::getInstance().getDescription("convex-file"));
-  dialog->queryString("nonconvex-file", ValueStorage::getInstance().getDescription("nonconvex-file"));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "ConvexEnvelopeAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr TesselationConvexEnvelopeAction::performCall() {
-  string filenameConvex;
-  string filenameNonConvex;
   molecule * mol = NULL;
   bool Success = true;
   config *configuration = World::getInstance().getConfig();
 
-  ValueStorage::getInstance().queryCurrentValue("convex-file", filenameConvex);
-  ValueStorage::getInstance().queryCurrentValue("nonconvex-file", filenameNonConvex);
+  // obtain information
+  getParametersfromValueStorage();
 
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
@@ -81,13 +53,13 @@
     const LinkedCell *LCList = NULL;
     DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope.");
-    DoLog(1) && (Log() << Verbose(1) << "Storing tecplot convex data in " << filenameConvex << "." << endl);
-    DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << filenameNonConvex << "." << endl);
-    LCList = new LinkedCell(mol, 100.);
-    Boundaries *BoundaryPoints = NULL;
+    DoLog(1) && (Log() << Verbose(1) << "Storing tecplot convex data in " << params.filenameConvex << "." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << params.filenameNonConvex << "." << endl);
+    LCList = new LinkedCell(*mol, 100.);
+    //Boundaries *BoundaryPoints = NULL;
     //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
     // TODO: Beide Funktionen sollten streams anstelle des Filenamen benutzen, besser fuer unit tests
-    FindNonConvexBorder(mol, TesselStruct, LCList, 50., filenameNonConvex.c_str());
+    FindNonConvexBorder(mol, TesselStruct, LCList, 50., params.filenameNonConvex.c_str());
     //RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]);
-    const double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, filenameConvex.c_str());
+    const double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, params.filenameConvex.c_str());
     const double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration);
     DoLog(0) && (Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration->GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl);
@@ -127,2 +99,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/TesselationAction/ConvexEnvelopeAction.def
===================================================================
--- src/Actions/TesselationAction/ConvexEnvelopeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/TesselationAction/ConvexEnvelopeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * ConvexEnvelopeAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class TesselationListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string) (std::string)
+#define paramtokens ("convex-file") ("nonconvex-file")
+#define paramreferences (filenameConvex) (filenameNonConvex)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Tesselation
+#define ACTIONNAME ConvexEnvelope
+#define TOKEN "convex-envelope"
+
Index: src/Actions/TesselationAction/ConvexEnvelopeAction.hpp
===================================================================
--- src/Actions/TesselationAction/ConvexEnvelopeAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/TesselationAction/ConvexEnvelopeAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,30 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-class TesselationListClass;
-
-void TesselationConvexEnvelope(std::string &filenameConvex, std::string &filenameNonConvex);
-
-class TesselationConvexEnvelopeAction : public Action {
-  friend void TesselationConvexEnvelope(std::string &filenameConvex, std::string &filenameNonConvex);
-
-public:
-  TesselationConvexEnvelopeAction();
-  virtual ~TesselationConvexEnvelopeAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "ConvexEnvelopeAction.def"
+#include "Action_impl_header.hpp"
 
 #endif // CONVEXENVELOPEACTION_HPP
Index: src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp
===================================================================
--- src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * NonConvexEnvelopeAction.cpp
@@ -6,13 +13,17 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "boundary.hpp"
 #include "linkedcell.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
+#include "tesselation.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -22,55 +33,17 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp"
 
-/****** TesselationNonConvexEnvelopeAction *****/
-
-// memento to remember the state when undoing
-
-//class TesselationNonConvexEnvelopeState : public ActionState {
-//public:
-//  TesselationNonConvexEnvelopeState(molecule* _mol,std::string _lastName) :
-//    mol(_mol),
-//    lastName(_lastName)
-//  {}
-//  molecule* mol;
-//  std::string lastName;
-//};
-
-const char TesselationNonConvexEnvelopeAction::NAME[] = "nonconvex-envelope";
-
-TesselationNonConvexEnvelopeAction::TesselationNonConvexEnvelopeAction() :
-  Action(NAME)
-{}
-
-TesselationNonConvexEnvelopeAction::~TesselationNonConvexEnvelopeAction()
-{}
-
-void TesselationNonConvexEnvelope(double radius, std::string &filename) {
-  ValueStorage::getInstance().setCurrentValue(TesselationNonConvexEnvelopeAction::NAME, radius);
-  ValueStorage::getInstance().setCurrentValue("nonconvex-file", filename);
-  ActionRegistry::getInstance().getActionByName(TesselationNonConvexEnvelopeAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* TesselationNonConvexEnvelopeAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryDouble(NAME, MapOfActions::getInstance().getDescription(NAME));
-  dialog->queryString("nonconvex-file", MapOfActions::getInstance().getDescription("nonconvex-file"));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "NonConvexEnvelopeAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr TesselationNonConvexEnvelopeAction::performCall() {
-  string filename;
   molecule * Boundary = NULL;
-  double SphereRadius = 0;
   bool Success = false;
   clock_t start,end;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, SphereRadius);
-  ValueStorage::getInstance().queryCurrentValue("nonconvex-file", filename);
+  // obtain information
+  getParametersfromValueStorage();
 
   for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
@@ -79,10 +52,10 @@
     const LinkedCell *LCList = NULL;
     DoLog(0) && (Log() << Verbose(0) << "Evaluating non-convex envelope of molecule." << Boundary->getId() << endl);
-    DoLog(1) && (Log() << Verbose(1) << "Using rolling ball of radius " << SphereRadius << " and storing tecplot data in " << filename << "." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "Using rolling ball of radius " << params.SphereRadius << " and storing tecplot data in " << params.filename << "." << endl);
     DoLog(1) && (Log() << Verbose(1) << "Specified molecule has " << Boundary->getAtomCount() << " atoms." << endl);
     start = clock();
-    LCList = new LinkedCell(Boundary, SphereRadius*2.);
-    Success = FindNonConvexBorder(Boundary, T, LCList, SphereRadius, filename.c_str());
-    //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str());
+    LCList = new LinkedCell(*Boundary, params.SphereRadius*2.);
+    Success = FindNonConvexBorder(Boundary, T, LCList, params.SphereRadius, params.filename.c_str());
+    //FindDistributionOfEllipsoids(T, &LCList, N, number, params.filename.c_str());
     end = clock();
     DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);
@@ -121,2 +94,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/TesselationAction/NonConvexEnvelopeAction.def
===================================================================
--- src/Actions/TesselationAction/NonConvexEnvelopeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/TesselationAction/NonConvexEnvelopeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * NonConvexEnvelopeAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+class TesselationListClass;
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (double) (std::string)
+#define paramtokens (TesselationNonConvexEnvelopeAction::NAME) ("nonconvex-file")
+#define paramreferences (SphereRadius) (filename)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Tesselation
+#define ACTIONNAME NonConvexEnvelope
+#define TOKEN "nonconvex-envelope"
+
Index: src/Actions/TesselationAction/NonConvexEnvelopeAction.hpp
===================================================================
--- src/Actions/TesselationAction/NonConvexEnvelopeAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/TesselationAction/NonConvexEnvelopeAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,31 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Actions/Process.hpp"
 
-class TesselationListClass;
-
-void TesselationNonConvexEnvelope(double radius, std::string &filename);
-
-class TesselationNonConvexEnvelopeAction : public Action {
-  friend void TesselationNonConvexEnvelope(double radius, std::string &filename);
-
-public:
-  TesselationNonConvexEnvelopeAction();
-  virtual ~TesselationNonConvexEnvelopeAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
+#include "NonConvexEnvelopeAction.def"
+#include "Action_impl_header.hpp"
 
 #endif // NONCONVEXENVELOPEACTION_HPP
Index: src/Actions/ValueStorage.cpp
===================================================================
--- src/Actions/ValueStorage.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ValueStorage.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ValueStorage.cpp
@@ -6,9 +13,17 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
 
 #include "ValueStorage.hpp"
 #include "Patterns/Singleton_impl.hpp"
 
-ValueStorage::ValueStorage() {};
+ValueStorage::ValueStorage() :
+  MapOfActions_instance(MapOfActions::getInstance())
+{};
 
 ValueStorage::~ValueStorage() {};
Index: src/Actions/ValueStorage.hpp
===================================================================
--- src/Actions/ValueStorage.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/ValueStorage.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -8,5 +8,4 @@
 #ifndef VALUESTORAGE_HPP_
 #define VALUESTORAGE_HPP_
-
 
 #include "Actions/MapOfActions.hpp"
@@ -22,11 +21,31 @@
 
 public:
-  template <typename T> void queryCurrentValue(const char *name, T &_T) {
-    MapOfActions::getInstance().queryCurrentValue(name, _T);
-  }
-  template <typename T> void setCurrentValue(const char *name, T &_T) {
-    MapOfActions::getInstance().setCurrentValue(name, _T);
+  /** Gets a value from the storage
+   * If the value is not present, an ASSERT is thrown unless optional is set to true.
+   * \param _T key of value
+   * \param optional whether this value is optional, i.e. may actually not be in the storage (i.e. may return false in this case).
+   * \return true - value present, false - value not present (only given when optional set to true)
+   */
+  template <typename T> bool queryCurrentValue(const char *name, T &_T, const bool optional = false) {
+    if (optional) {
+      if (!MapOfActions_instance.isCurrentValuePresent(name))
+        return false;
+    }
+    MapOfActions_instance.queryCurrentValue(name, _T);
+    return true;
   }
 
+  /** Sets a value in the storage.
+   * \param name key of value
+   * \param _T value
+   */
+  template <typename T> void setCurrentValue(const char *name, T &_T) {
+    MapOfActions_instance.setCurrentValue(name, _T);
+  }
+
+  /** Obtain a descriptive text for a given key.
+   * \param actionname key
+   * \return text describing the key's contents
+   */
   std::string getDescription(std::string actionname);
 
@@ -34,4 +53,6 @@
   ValueStorage();
   ~ValueStorage();
+
+  MapOfActions &MapOfActions_instance;
 };
 
Index: src/Actions/WorldAction/AddEmptyBoundaryAction.cpp
===================================================================
--- src/Actions/WorldAction/AddEmptyBoundaryAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/AddEmptyBoundaryAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AddEmptyBoundaryAction.cpp
@@ -6,11 +13,14 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/AddEmptyBoundaryAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "atom.hpp"
-#include "log.hpp"
-#include "vector.hpp"
+#include "Helpers/Log.hpp"
+#include "LinearAlgebra/Vector.hpp"
 #include "World.hpp"
 
@@ -21,38 +31,17 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-#include "Helpers/Assert.hpp"
+#include "Actions/WorldAction/AddEmptyBoundaryAction.hpp"
 
-const char WorldAddEmptyBoundaryAction::NAME[] = "boundary";
-
-WorldAddEmptyBoundaryAction::WorldAddEmptyBoundaryAction() :
-  Action(NAME)
-{}
-
-WorldAddEmptyBoundaryAction::~WorldAddEmptyBoundaryAction()
-{}
-
-void WorldAddEmptyBoundary(Vector &boundary) {
-  ValueStorage::getInstance().setCurrentValue(WorldAddEmptyBoundaryAction::NAME, boundary);
-  ActionRegistry::getInstance().getActionByName(WorldAddEmptyBoundaryAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldAddEmptyBoundaryAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "AddEmptyBoundaryAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr WorldAddEmptyBoundaryAction::performCall() {
-  Vector boundary;
   Vector Min;
   Vector Max;
   int j=0;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, boundary);
+  // obtain information
+  getParametersfromValueStorage();
 
   // get maximum and minimum
@@ -60,12 +49,12 @@
   ASSERT(AllAtoms.size() > 0, "There must be atoms present for AddingEmptyBoundary.");
   vector<atom *>::iterator AtomRunner = AllAtoms.begin();
-  Min = (*AtomRunner)->x;
-  Max = (*AtomRunner)->x;
+  Min = (*AtomRunner)->getPosition();
+  Max = (*AtomRunner)->getPosition();
   for (; AtomRunner != AllAtoms.end(); ++AtomRunner) {
     for (int i=0;i<NDIM;i++) {
-      if ((*AtomRunner)->x[i] > Max[i])
-        Max[i] = (*AtomRunner)->x[i];
-      if ((*AtomRunner)->x[i] < Min[i])
-        Min[i] = (*AtomRunner)->x[i];
+      if ((*AtomRunner)->at(i) > Max[i])
+        Max[i] = (*AtomRunner)->at(i);
+      if ((*AtomRunner)->at(i) < Min[i])
+        Min[i] = (*AtomRunner)->at(i);
     }
   }
@@ -77,5 +66,5 @@
   for (int i=0;i<NDIM;i++) {
     j += i+1;
-    cell_size[j] = (Max[i]-Min[i]+2.*boundary[i]);
+    cell_size[j] = (Max[i]-Min[i]+2.*params.boundary[i]);
   }
   World::getInstance().setDomain(cell_size);
@@ -84,5 +73,5 @@
   AtomRunner = AllAtoms.begin();
   for (; AtomRunner != AllAtoms.end(); ++AtomRunner)
-    (*AtomRunner)->x -= Min - boundary;
+    *(*AtomRunner) -= Min - params.boundary;
   return Action::success;
 }
@@ -113,2 +102,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/AddEmptyBoundaryAction.def
===================================================================
--- src/Actions/WorldAction/AddEmptyBoundaryAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/AddEmptyBoundaryAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * AddEmptyBoundaryAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "LinearAlgebra/Vector.hpp"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (Vector)
+#define paramtokens (WorldAddEmptyBoundaryAction::NAME)
+#define paramreferences (boundary)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME AddEmptyBoundary
+#define TOKEN "boundary"
+
Index: src/Actions/WorldAction/AddEmptyBoundaryAction.hpp
===================================================================
--- src/Actions/WorldAction/AddEmptyBoundaryAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/AddEmptyBoundaryAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,28 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "vector.hpp"
 
-void WorldAddEmptyBoundary(Vector &boundary);
-
-class WorldAddEmptyBoundaryAction : public Action {
-  friend void WorldAddEmptyBoundary(Vector &boundary);
-
-public:
-  WorldAddEmptyBoundaryAction();
-  virtual ~WorldAddEmptyBoundaryAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "AddEmptyBoundaryAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* ADDEMPTYBOUNDARYACTION_HPP_ */
Index: src/Actions/WorldAction/BoundInBoxAction.cpp
===================================================================
--- src/Actions/WorldAction/BoundInBoxAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/BoundInBoxAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * BoundInBoxAction.cpp
@@ -6,9 +13,12 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/BoundInBoxAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "World.hpp"
@@ -20,30 +30,13 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/WorldAction/BoundInBoxAction.hpp"
 
-const char WorldBoundInBoxAction::NAME[] = "bound-in-box";
-
-WorldBoundInBoxAction::WorldBoundInBoxAction() :
-  Action(NAME)
-{}
-
-WorldBoundInBoxAction::~WorldBoundInBoxAction()
-{}
-
-void WorldBoundInBox() {
-  ActionRegistry::getInstance().getActionByName(WorldBoundInBoxAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldBoundInBoxAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "BoundInBoxAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr WorldBoundInBoxAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
   // center
@@ -80,2 +73,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/BoundInBoxAction.def
===================================================================
--- src/Actions/WorldAction/BoundInBoxAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/BoundInBoxAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * BoundInBoxAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME BoundInBox
+#define TOKEN "bound-in-box"
+
Index: src/Actions/WorldAction/BoundInBoxAction.hpp
===================================================================
--- src/Actions/WorldAction/BoundInBoxAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/BoundInBoxAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void WorldBoundInBox();
-
-class WorldBoundInBoxAction : public Action {
-  friend void WorldBoundInBox();
-
-public:
-  WorldBoundInBoxAction();
-  virtual ~WorldBoundInBoxAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "BoundInBoxAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* BOUNDINBOXACTION_HPP_ */
Index: src/Actions/WorldAction/CenterInBoxAction.cpp
===================================================================
--- src/Actions/WorldAction/CenterInBoxAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/CenterInBoxAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * CenterInBoxAction.cpp
@@ -6,10 +13,13 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/CenterInBoxAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "Box.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "World.hpp"
@@ -20,35 +30,15 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/WorldAction/CenterInBoxAction.hpp"
 
-const char WorldCenterInBoxAction::NAME[] = "center-in-box";
+// and construct the stuff
+#include "CenterInBoxAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr WorldCenterInBoxAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
-WorldCenterInBoxAction::WorldCenterInBoxAction() :
-  Action(NAME)
-{}
-
-WorldCenterInBoxAction::~WorldCenterInBoxAction()
-{}
-
-void WorldCenterInBox(Box &_box) {
-  ValueStorage::getInstance().setCurrentValue(WorldCenterInBoxAction::NAME, _box);
-  ActionRegistry::getInstance().getActionByName(WorldCenterInBoxAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldCenterInBoxAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryBox(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr WorldCenterInBoxAction::performCall() {
-
-  Box& cell_size = World::getInstance().getDomain();
-  ValueStorage::getInstance().queryCurrentValue(NAME, cell_size);
-  World::getInstance().setDomain(cell_size.getM());
+  World::getInstance().setDomain(params.cell_size.getM());
 
   // center
@@ -85,2 +75,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/CenterInBoxAction.def
===================================================================
--- src/Actions/WorldAction/CenterInBoxAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/CenterInBoxAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * CenterInBoxAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "Box.hpp"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (Box)
+#define paramtokens (WorldCenterInBoxAction::NAME)
+#define paramreferences (cell_size)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME CenterInBox
+#define TOKEN "center-in-box"
+
Index: src/Actions/WorldAction/CenterInBoxAction.hpp
===================================================================
--- src/Actions/WorldAction/CenterInBoxAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/CenterInBoxAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,28 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Box.hpp"
 
-void WorldCenterInBox(Box &_box);
-
-class WorldCenterInBoxAction : public Action {
-  friend void WorldCenterInBox(Box &_box);
-
-public:
-  WorldCenterInBoxAction();
-  virtual ~WorldCenterInBoxAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "CenterInBoxAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* CENTERINBOXACTION_HPP_ */
Index: src/Actions/WorldAction/CenterOnEdgeAction.cpp
===================================================================
--- src/Actions/WorldAction/CenterOnEdgeAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/CenterOnEdgeAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * CenterOnEdgeAction.cpp
@@ -6,13 +13,16 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/CenterOnEdgeAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "atom.hpp"
-#include "log.hpp"
-#include "vector.hpp"
+#include "Helpers/Log.hpp"
+#include "LinearAlgebra/Vector.hpp"
 #include "World.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 
 #include <iostream>
@@ -21,33 +31,16 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-#include "Helpers/Assert.hpp"
+#include "Actions/WorldAction/CenterOnEdgeAction.hpp"
 
-const char WorldCenterOnEdgeAction::NAME[] = "center-edge";
-
-WorldCenterOnEdgeAction::WorldCenterOnEdgeAction() :
-  Action(NAME)
-{}
-
-WorldCenterOnEdgeAction::~WorldCenterOnEdgeAction()
-{}
-
-void WorldCenterOnEdge() {
-  ActionRegistry::getInstance().getActionByName(WorldCenterOnEdgeAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldCenterOnEdgeAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "CenterOnEdgeAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr WorldCenterOnEdgeAction::performCall() {
   Vector Min;
   Vector Max;
+
+  // obtain information
+  getParametersfromValueStorage();
 
   // get maximum and minimum
@@ -55,12 +48,12 @@
   ASSERT(AllAtoms.size() > 0, "For CenteronEdge atoms must be present.");
   vector<atom *>::iterator AtomRunner = AllAtoms.begin();
-  Min = (*AtomRunner)->x;
-  Max = (*AtomRunner)->x;
+  Min = (*AtomRunner)->getPosition();
+  Max = (*AtomRunner)->getPosition();
   for (; AtomRunner != AllAtoms.end(); ++AtomRunner) {
     for (int i=0;i<NDIM;i++) {
-      if ((*AtomRunner)->x[i] > Max[i])
-        Max[i] = (*AtomRunner)->x[i];
-      if ((*AtomRunner)->x[i] < Min[i])
-        Min[i] = (*AtomRunner)->x[i];
+      if ((*AtomRunner)->at(i) > Max[i])
+        Max[i] = (*AtomRunner)->at(i);
+      if ((*AtomRunner)->at(i) < Min[i])
+        Min[i] = (*AtomRunner)->at(i);
     }
   }
@@ -75,5 +68,5 @@
   // translate all atoms, such that Min is aty (0,0,0)
   for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner)
-    (*AtomRunner)->x -= Min;
+    *(*AtomRunner) -= Min;
 
   return Action::success;
@@ -105,2 +98,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/CenterOnEdgeAction.def
===================================================================
--- src/Actions/WorldAction/CenterOnEdgeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/CenterOnEdgeAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * CenterOnEdgeAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME CenterOnEdge
+#define TOKEN "center-edge"
+
Index: src/Actions/WorldAction/CenterOnEdgeAction.hpp
===================================================================
--- src/Actions/WorldAction/CenterOnEdgeAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/CenterOnEdgeAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void WorldCenterOnEdge();
-
-class WorldCenterOnEdgeAction : public Action {
-  friend void WorldCenterOnEdge();
-
-public:
-  WorldCenterOnEdgeAction();
-  virtual ~WorldCenterOnEdgeAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "CenterOnEdgeAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* CENTERONEDGEACTION_HPP_ */
Index: src/Actions/WorldAction/ChangeBoxAction.cpp
===================================================================
--- src/Actions/WorldAction/ChangeBoxAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/ChangeBoxAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ChangeBoxAction.cpp
@@ -6,13 +13,16 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/ChangeBoxAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 #include "Box.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 
 #include <iostream>
@@ -21,35 +31,15 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/WorldAction/ChangeBoxAction.hpp"
 
-const char WorldChangeBoxAction::NAME[] = "change-box";
+// and construct the stuff
+#include "ChangeBoxAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr WorldChangeBoxAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
-WorldChangeBoxAction::WorldChangeBoxAction() :
-  Action(NAME)
-{}
-
-WorldChangeBoxAction::~WorldChangeBoxAction()
-{}
-
-void WorldChangeBox(Box &_box) {
-  ValueStorage::getInstance().setCurrentValue(WorldChangeBoxAction::NAME, _box);
-  ActionRegistry::getInstance().getActionByName(WorldChangeBoxAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldChangeBoxAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryBox(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr WorldChangeBoxAction::performCall() {
-
-  Box cell_size;
-  ValueStorage::getInstance().queryCurrentValue(NAME, cell_size);
-  World::getInstance().setDomain(cell_size.getM()); // this is needed as only this function is OBSERVEd.
+  World::getInstance().setDomain(params.cell_size.getM()); // this is needed as only this function is OBSERVEd.
 
   DoLog(0) && (Log() << Verbose(0) << "Setting box domain to " << World::getInstance().getDomain().getM() << endl);
@@ -82,2 +72,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/ChangeBoxAction.def
===================================================================
--- src/Actions/WorldAction/ChangeBoxAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/ChangeBoxAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * ChangeBoxAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "Box.hpp"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (Box)
+#define paramtokens (WorldChangeBoxAction::NAME)
+#define paramreferences (cell_size)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME ChangeBox
+#define TOKEN "change-box"
+
Index: src/Actions/WorldAction/ChangeBoxAction.hpp
===================================================================
--- src/Actions/WorldAction/ChangeBoxAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/ChangeBoxAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,28 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "Box.hpp"
 
-void WorldChangeBox(Box &_box);
-
-class WorldChangeBoxAction : public Action {
-  friend void WorldChangeBox(Box &_box);
-
-public:
-  WorldChangeBoxAction();
-  virtual ~WorldChangeBoxAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "ChangeBoxAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* CHANGEBOXACTION_HPP_ */
Index: src/Actions/WorldAction/InputAction.cpp
===================================================================
--- src/Actions/WorldAction/InputAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/InputAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * InputAction.cpp
@@ -6,13 +13,16 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/InputAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "Parser/FormatParserStorage.hpp"
 #include "Parser/PcpParser.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -22,46 +32,26 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/WorldAction/InputAction.hpp"
 
-const char WorldInputAction::NAME[] = "input";
-
-WorldInputAction::WorldInputAction() :
-  Action(NAME)
-{}
-
-WorldInputAction::~WorldInputAction()
-{}
-
-void WorldInput(std::string &filename) {
-  ValueStorage::getInstance().setCurrentValue(WorldInputAction::NAME, filename);
-  ActionRegistry::getInstance().getActionByName(WorldInputAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldInputAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "InputAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr WorldInputAction::performCall() {
   MoleculeListClass *molecules = World::getInstance().getMolecules();
   molecule *mol = NULL;
-  std::string filename;
   std::ifstream test;
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
+  // obtain information
+  getParametersfromValueStorage();
 
   DoLog(0) && (Log() << Verbose(0) << "Config file given." << endl);
-  if (filename.find('.') != string::npos) {
-    std::string FilenamePrefix = filename.substr(0,filename.find_last_of('.'));
-    std::string FilenameSuffix = filename.substr(filename.find_last_of('.')+1, filename.length());
+  if (params.filename.find('.') != string::npos) {
+    std::string FilenamePrefix = params.filename.substr(0,params.filename.find_last_of('.'));
+    std::string FilenameSuffix = params.filename.substr(params.filename.find_last_of('.')+1, params.filename.length());
     DoLog(1) && (Log() << Verbose(1) << "Setting config file name prefix to " << FilenamePrefix << "." << endl);
-    test.open(filename.c_str());
+    test.open(params.filename.c_str());
     if (test == NULL) {
-      DoLog(1) && (Log() << Verbose(1) << "Specified config file " << filename << " not found." << endl);
+      DoLog(1) && (Log() << Verbose(1) << "Specified config file " << params.filename << " not found." << endl);
     } else {
       DoLog(1) && (Log() << Verbose(1) << "Specified config file found, parsing ... ");
@@ -83,5 +73,5 @@
       molecules->insert(mol);
     }
-    mol->SetNameFromFilename(filename.substr(0,filename.find('.')).c_str());
+    mol->SetNameFromFilename(params.filename.substr(0,params.filename.find('.')).c_str());
   } else {
     DoeLog(1) && (eLog() << Verbose(1) << "Input file does not have a suffix, cannot recognize format." << endl);
@@ -115,2 +105,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/InputAction.def
===================================================================
--- src/Actions/WorldAction/InputAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/InputAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * InputAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (WorldInputAction::NAME)
+#define paramreferences (filename)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME Input
+#define TOKEN "input"
+
Index: src/Actions/WorldAction/InputAction.hpp
===================================================================
--- src/Actions/WorldAction/InputAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/InputAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void WorldInput(std::string &filename);
-
-class WorldInputAction : public Action {
-  friend void WorldInput(std::string &filename);
-
-public:
-  WorldInputAction();
-  virtual ~WorldInputAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "InputAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* INPUTACTION_HPP_ */
Index: src/Actions/WorldAction/OutputAction.cpp
===================================================================
--- src/Actions/WorldAction/OutputAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/OutputAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * OutputAction.cpp
@@ -6,11 +13,14 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/OutputAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "Parser/ChangeTracker.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -20,30 +30,13 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/WorldAction/OutputAction.hpp"
 
-const char WorldOutputAction::NAME[] = "output";
-
-WorldOutputAction::WorldOutputAction() :
-  Action(NAME)
-{}
-
-WorldOutputAction::~WorldOutputAction()
-{}
-
-void WorldOutput() {
-  ActionRegistry::getInstance().getActionByName(WorldOutputAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldOutputAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "OutputAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr WorldOutputAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
   DoLog(0) && (Log() << Verbose(0) << "Saving world to files." << endl);
@@ -77,2 +70,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/OutputAction.def
===================================================================
--- src/Actions/WorldAction/OutputAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/OutputAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * OutputAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#undef paramtypes
+#undef paramtokens
+#undef paramreferences
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME Output
+#define TOKEN "output"
+
Index: src/Actions/WorldAction/OutputAction.hpp
===================================================================
--- src/Actions/WorldAction/OutputAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/OutputAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void WorldOutput();
-
-class WorldOutputAction : public Action {
-  friend void WorldOutput();
-
-public:
-  WorldOutputAction();
-  virtual ~WorldOutputAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "OutputAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* OUTPUTACTION_HPP_ */
Index: c/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp
===================================================================
--- src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * RemoveSphereOfAtomsAction.cpp
- *
- *  Created on: May 12, 2010
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "Descriptors/AtomDescriptor.hpp"
-#include "atom.hpp"
-#include "log.hpp"
-#include "molecule.hpp"
-#include "vector.hpp"
-#include "verbose.hpp"
-#include "World.hpp"
-
-#include <iostream>
-#include <string>
-
-using namespace std;
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-
-const char WorldRemoveSphereOfAtomsAction::NAME[] = "remove-sphere";
-
-WorldRemoveSphereOfAtomsAction::WorldRemoveSphereOfAtomsAction() :
-  Action(NAME)
-{}
-
-WorldRemoveSphereOfAtomsAction::~WorldRemoveSphereOfAtomsAction()
-{}
-
-void WorldRemoveSphereOfAtoms(double radius, Vector &point) {
-  ValueStorage::getInstance().setCurrentValue(WorldRemoveSphereOfAtomsAction::NAME, radius);
-  ValueStorage::getInstance().setCurrentValue("position", point);
-  ActionRegistry::getInstance().getActionByName(WorldRemoveSphereOfAtomsAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldRemoveSphereOfAtomsAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryDouble(NAME, ValueStorage::getInstance().getDescription(NAME));
-  dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
-
-  return dialog;
-}
-
-Action::state_ptr WorldRemoveSphereOfAtomsAction::performCall() {
-  double radius = 0.;
-  Vector point;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, radius);
-  ValueStorage::getInstance().queryCurrentValue("position", point);
-
-  DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << point << " with radius " << radius << "." << endl);
-  vector<atom*> AllAtoms = World::getInstance().getAllAtoms();
-  vector<molecule *> molecules = World::getInstance().getAllMolecules();
-  for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
-    if (point.DistanceSquared((*AtomRunner)->x) > radius*radius) { // distance to first above radius ...
-      // TODO: This is not necessary anymore when atoms are completely handled by World (create/destroy and load/save)
-      for (vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end();++iter)
-        (*iter)->erase(*AtomRunner);
-      World::getInstance().destroyAtom(*AtomRunner);
-    }
-  }
-  return Action::success;
-}
-
-Action::state_ptr WorldRemoveSphereOfAtomsAction::performUndo(Action::state_ptr _state) {
-//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
-
-  return Action::failure;
-//  string newName = state->mol->getName();
-//  state->mol->setName(state->lastName);
-//
-//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
-}
-
-Action::state_ptr WorldRemoveSphereOfAtomsAction::performRedo(Action::state_ptr _state){
-  return Action::failure;
-}
-
-bool WorldRemoveSphereOfAtomsAction::canUndo() {
-  return false;
-}
-
-bool WorldRemoveSphereOfAtomsAction::shouldUndo() {
-  return false;
-}
-
-const string WorldRemoveSphereOfAtomsAction::getName() {
-  return NAME;
-}
Index: c/Actions/WorldAction/RemoveSphereOfAtomsAction.hpp
===================================================================
--- src/Actions/WorldAction/RemoveSphereOfAtomsAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * RemoveSphereOfAtomsAction.hpp
- *
- *  Created on: May 9, 2010
- *      Author: heber
- */
-
-#ifndef REMOVESPHEREOFATOMS_HPP_
-#define REMOVESPHEREOFATOMS_HPP_
-
-#include "Actions/Action.hpp"
-#include "vector.hpp"
-
-
-void WorldRemoveSphereOfAtoms(double radius, Vector &point);
-
-class WorldRemoveSphereOfAtomsAction : public Action {
-  friend void WorldRemoveSphereOfAtoms(double radius, Vector &point);
-
-public:
-  WorldRemoveSphereOfAtomsAction();
-  virtual ~WorldRemoveSphereOfAtomsAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
-
-#endif /* REMOVESPHEREOFATOMS_HPP_ */
Index: src/Actions/WorldAction/RepeatBoxAction.cpp
===================================================================
--- src/Actions/WorldAction/RepeatBoxAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/RepeatBoxAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * RepeatBoxAction.cpp
@@ -6,14 +13,18 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/RepeatBoxAction.hpp"
-#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/MoleculePtrDescriptor.hpp"
 #include "atom.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
-#include "vector.hpp"
-#include "Matrix.hpp"
-#include "verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Matrix.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 #include "Box.hpp"
@@ -21,37 +32,15 @@
 #include <iostream>
 #include <string>
+#include <vector>
 
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
-#include "Descriptors/MoleculeDescriptor.hpp"
-#include "Descriptors/MoleculePtrDescriptor.hpp"
+#include "Actions/WorldAction/RepeatBoxAction.hpp"
 
-const char WorldRepeatBoxAction::NAME[] = "repeat-box";
-
-WorldRepeatBoxAction::WorldRepeatBoxAction() :
-  Action(NAME)
-{}
-
-WorldRepeatBoxAction::~WorldRepeatBoxAction()
-{}
-
-void WorldRepeatBox(Vector &Repeater) {
-  ValueStorage::getInstance().setCurrentValue(WorldRepeatBoxAction::NAME, Repeater);
-  ActionRegistry::getInstance().getActionByName(WorldRepeatBoxAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog * WorldRepeatBoxAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "RepeatBoxAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr WorldRepeatBoxAction::performCall() {
-  Vector Repeater;
   int count;
   const element ** Elements;
@@ -61,5 +50,6 @@
   MoleculeListClass *molecules = World::getInstance().getMolecules();
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, Repeater);
+  // obtain information
+  getParametersfromValueStorage();
 
   vector<molecule *> AllMolecules;
@@ -72,5 +62,5 @@
   }
 
-  (cout << "Repeating box " << Repeater << " times for (x,y,z) axis." << endl);
+  (cout << "Repeating box " << params.Repeater << " times for (x,y,z) axis." << endl);
   Matrix M = World::getInstance().getDomain().getM();
   Matrix newM = M;
@@ -79,10 +69,10 @@
   Matrix repMat;
   for (int axis = 0; axis < NDIM; axis++) {
-    Repeater[axis] = floor(Repeater[axis]);
-    if (Repeater[axis] < 1) {
+    params.Repeater[axis] = floor(params.Repeater[axis]);
+    if (params.Repeater[axis] < 1) {
       DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor must be greater than 1!" << endl);
-      Repeater[axis] = 1;
+      params.Repeater[axis] = 1;
     }
-    repMat.at(axis,axis) = Repeater[axis];
+    repMat.at(axis,axis) = params.Repeater[axis];
   }
   newM *= repMat;
@@ -90,10 +80,10 @@
 
   molecule *newmol = NULL;
-  Vector ** vectors = NULL;
-  for (n[0] = 0; n[0] < Repeater[0]; n[0]++) {
+  std::vector<Vector> vectors;
+  for (n[0] = 0; n[0] < params.Repeater[0]; n[0]++) {
     y[0] = n[0];
-    for (n[1] = 0; n[1] < Repeater[1]; n[1]++) {
+    for (n[1] = 0; n[1] < params.Repeater[1]; n[1]++) {
       y[1] = n[1];
-      for (n[2] = 0; n[2] < Repeater[2]; n[2]++) {
+      for (n[2] = 0; n[2] < params.Repeater[2]; n[2]++) {
         y[2] = n[2];
         if ((n[0] == 0) && (n[1] == 0) && (n[2] == 0))
@@ -105,9 +95,9 @@
           if (count != 0) {  // if there is more than none
             Elements = new const element *[count];
-            vectors = new Vector *[count];
+            vectors.resize(count);
             j = 0;
             for(molecule::iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) {
-              Elements[j] = (*AtomRunner)->type;
-              vectors[j] = &(*AtomRunner)->x;
+              Elements[j] = (*AtomRunner)->getType();
+              vectors[j] = (*AtomRunner)->getPosition();
               j++;
             }
@@ -120,6 +110,6 @@
             for (int k=count;k--;) { // go through every atom of the original cell
               Walker = World::getInstance().createAtom(); // create a new body
-              Walker->x = (*vectors[k]) + x;
-              Walker->type = Elements[k];  // insert original element
+              Walker->setPosition((vectors[k]) + x);
+              Walker->setType(Elements[k]);  // insert original element
               cout << "new atom is " << *Walker << endl;
               newmol->AddAtom(Walker);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
@@ -127,5 +117,4 @@
             // free memory
             delete[](Elements);
-            delete[](vectors);
           } else {
             DoLog(1) && (Log() << Verbose(1) << "\t ... is empty." << endl);
@@ -163,2 +152,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/RepeatBoxAction.def
===================================================================
--- src/Actions/WorldAction/RepeatBoxAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/RepeatBoxAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * RepeatBoxAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "LinearAlgebra/Vector.hpp"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (Vector)
+#define paramtokens (WorldRepeatBoxAction::NAME)
+#define paramreferences (Repeater)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME RepeatBox
+#define TOKEN "repeat-box"
+
Index: src/Actions/WorldAction/RepeatBoxAction.hpp
===================================================================
--- src/Actions/WorldAction/RepeatBoxAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/RepeatBoxAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,28 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "vector.hpp"
 
-void WorldRepeatBox(Vector &Repeater);
-
-class WorldRepeatBoxAction : public Action {
-  friend void WorldRepeatBox(Vector &Repeater);
-
-public:
-  WorldRepeatBoxAction();
-  virtual ~WorldRepeatBoxAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "RepeatBoxAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* REPEATBOXACTION_HPP_ */
Index: src/Actions/WorldAction/ScaleBoxAction.cpp
===================================================================
--- src/Actions/WorldAction/ScaleBoxAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/ScaleBoxAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ScaleBoxAction.cpp
@@ -6,15 +13,18 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/ScaleBoxAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "atom.hpp"
-#include "log.hpp"
-#include "vector.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 #include "Box.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 
 #include <iostream>
@@ -23,42 +33,22 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/WorldAction/ScaleBoxAction.hpp"
 
-const char WorldScaleBoxAction::NAME[] = "scale-box";
-
-WorldScaleBoxAction::WorldScaleBoxAction() :
-  Action(NAME)
-{}
-
-WorldScaleBoxAction::~WorldScaleBoxAction()
-{}
-
-void WorldScaleBox(Vector &Scaler) {
-  ValueStorage::getInstance().setCurrentValue(WorldScaleBoxAction::NAME, Scaler);
-  ActionRegistry::getInstance().getActionByName(WorldScaleBoxAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldScaleBoxAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "ScaleBoxAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr WorldScaleBoxAction::performCall() {
-  Vector Scaler;
   double x[NDIM];
 
-  ValueStorage::getInstance().queryCurrentValue(NAME, Scaler);
+  // obtain information
+  getParametersfromValueStorage();
 
   DoLog(1) && (Log() << Verbose(1) << "Scaling all atomic positions by factor." << endl);
   for (int i=0;i<NDIM;i++)
-    x[i] = Scaler[i];
+    x[i] = params.Scaler[i];
   vector<atom*> AllAtoms = World::getInstance().getAllAtoms();
   for(vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
-    (*AtomRunner)->x.ScaleAll(x);
+    (*AtomRunner)->ScaleAll(x);
   }
 
@@ -100,2 +90,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/ScaleBoxAction.def
===================================================================
--- src/Actions/WorldAction/ScaleBoxAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/ScaleBoxAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * ScaleBoxAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "LinearAlgebra/Vector.hpp"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (Vector)
+#define paramtokens (WorldScaleBoxAction::NAME)
+#define paramreferences (Scaler)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME ScaleBox
+#define TOKEN "scale-box"
+
Index: src/Actions/WorldAction/ScaleBoxAction.hpp
===================================================================
--- src/Actions/WorldAction/ScaleBoxAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/ScaleBoxAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,28 +10,7 @@
 
 #include "Actions/Action.hpp"
-#include "vector.hpp"
 
-void WorldScaleBox(Vector &Scaler);
-
-class WorldScaleBoxAction : public Action {
-  friend void WorldScaleBox(Vector &Scaler);
-
-public:
-  WorldScaleBoxAction();
-  virtual ~WorldScaleBoxAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "ScaleBoxAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* SCALEBOXACTION_HPP_ */
Index: src/Actions/WorldAction/SetDefaultNameAction.cpp
===================================================================
--- src/Actions/WorldAction/SetDefaultNameAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/SetDefaultNameAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SetDefaultNameAction.cpp
@@ -6,10 +13,13 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/SetDefaultNameAction.hpp"
-#include "Actions/ActionRegistry.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -19,52 +29,21 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/WorldAction/SetDefaultNameAction.hpp"
 
+// and construct the stuff
+#include "SetDefaultNameAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr WorldSetDefaultNameAction::performCall() {
+  string Worldsdefaultname;
+  Worldsdefaultname = World::getInstance().getDefaultName();
+  WorldSetDefaultNameState *UndoState = new WorldSetDefaultNameState(Worldsdefaultname, params);
 
-// memento to remember the state when undoing
+  // obtain information
+  getParametersfromValueStorage();
 
-class WorldSetDefaultNameState : public ActionState {
-public:
-  WorldSetDefaultNameState(std::string _lastName) :
-    lastName(_lastName)
-  {}
-  std::string lastName;
-};
-
-const char WorldSetDefaultNameAction::NAME[] = "default-molname";
-
-WorldSetDefaultNameAction::WorldSetDefaultNameAction() :
-  Action(NAME)
-{}
-
-WorldSetDefaultNameAction::~WorldSetDefaultNameAction()
-{}
-
-void WorldSetDefaultName(std::string &defaultname) {
-  ValueStorage::getInstance().setCurrentValue(WorldSetDefaultNameAction::NAME, defaultname);
-  ActionRegistry::getInstance().getActionByName(WorldSetDefaultNameAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldSetDefaultNameAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  string defaultname = World::getInstance().getDefaultName();
-  ValueStorage::getInstance().setCurrentValue(NAME, defaultname);
-  dialog->queryString(NAME, MapOfActions::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr WorldSetDefaultNameAction::performCall() {
-  string defaultname;
-
-  defaultname = World::getInstance().getDefaultName();
-  ValueStorage::getInstance().queryCurrentValue(NAME, defaultname);
-
-  World::getInstance().setDefaultName(defaultname);
+  World::getInstance().setDefaultName(params.newname);
   DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << World::getInstance().getDefaultName() << "." << endl);
-  return Action::success;
+  return Action::state_ptr(UndoState);
 }
 
@@ -72,12 +51,17 @@
   WorldSetDefaultNameState *state = assert_cast<WorldSetDefaultNameState*>(_state.get());
 
-  string newName = World::getInstance().getDefaultName();
-  World::getInstance().setDefaultName(state->lastName);
+  World::getInstance().setDefaultName(state->lastname);
+  DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << World::getInstance().getDefaultName() << "." << endl);
 
-  return Action::state_ptr(new WorldSetDefaultNameState(newName));
+  return Action::state_ptr(_state);
 }
 
 Action::state_ptr WorldSetDefaultNameAction::performRedo(Action::state_ptr _state){
-  performUndo(_state);
+  WorldSetDefaultNameState *state = assert_cast<WorldSetDefaultNameState*>(_state.get());
+
+  World::getInstance().setDefaultName(state->params.newname);
+  DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << World::getInstance().getDefaultName() << "." << endl);
+
+  return Action::state_ptr(_state);
 }
 
@@ -93,2 +77,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/SetDefaultNameAction.def
===================================================================
--- src/Actions/WorldAction/SetDefaultNameAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/SetDefaultNameAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * SetDefaultNameAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (WorldSetDefaultNameAction::NAME)
+#define paramreferences (newname)
+
+#define statetypes (std::string)
+#define statereferences (lastname)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME SetDefaultName
+#define TOKEN "default-molname"
+
Index: src/Actions/WorldAction/SetDefaultNameAction.hpp
===================================================================
--- src/Actions/WorldAction/SetDefaultNameAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/SetDefaultNameAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void WorldSetDefaultName(std::string &defaultname);
-
-class WorldSetDefaultNameAction : public Action {
-  friend void WorldSetDefaultName(std::string &defaultname);
-
-public:
-  WorldSetDefaultNameAction();
-  virtual ~WorldSetDefaultNameAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "SetDefaultNameAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* SETDEFAULTNAMEACTION_HPP_ */
Index: src/Actions/WorldAction/SetGaussianBasisAction.cpp
===================================================================
--- src/Actions/WorldAction/SetGaussianBasisAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/SetGaussianBasisAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SetGaussianBasisAction.cpp
@@ -6,11 +13,14 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/SetGaussianBasisAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "config.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -20,50 +30,20 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/WorldAction/SetGaussianBasisAction.hpp"
 
-
-// memento to remember the state when undoing
-
-class WorldSetGaussianBasisState : public ActionState {
-public:
-  WorldSetGaussianBasisState(std::string _lastName) :
-    lastName(_lastName)
-  {}
-  std::string lastName;
-};
-
-
-const char WorldSetGaussianBasisAction::NAME[] = "set-basis";
-
-WorldSetGaussianBasisAction::WorldSetGaussianBasisAction() :
-  Action(NAME)
-{}
-
-WorldSetGaussianBasisAction::~WorldSetGaussianBasisAction()
-{}
-
-void WorldSetGaussianBasis(std::string &basisname) {
-  ValueStorage::getInstance().setCurrentValue(WorldSetGaussianBasisAction::NAME, basisname);
-  ActionRegistry::getInstance().getActionByName(WorldSetGaussianBasisAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldSetGaussianBasisAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
+// and construct the stuff
+#include "SetGaussianBasisAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
 Action::state_ptr WorldSetGaussianBasisAction::performCall() {
   config *configuration = World::getInstance().getConfig();
 
   string lastname = configuration->basis;
-  ValueStorage::getInstance().queryCurrentValue(NAME, configuration->basis);
+  // obtain information
+  getParametersfromValueStorage();
+  configuration->basis = params.newname;
 
   DoLog(1) && (Log() << Verbose(1) << "Setting MPQC basis to " << configuration->basis << "." << endl);
-  return Action::success;
+  return Action::state_ptr(new WorldSetGaussianBasisState(lastname, params));
 }
 
@@ -72,12 +52,16 @@
 
   config *configuration = World::getInstance().getConfig();
-  string newName = configuration->basis;
-  configuration->basis = state->lastName;
+  configuration->basis = state->lastname;
 
-  return Action::state_ptr(new WorldSetGaussianBasisState(newName));
+  return Action::state_ptr(_state);
 }
 
 Action::state_ptr WorldSetGaussianBasisAction::performRedo(Action::state_ptr _state){
-  performUndo(_state);
+  WorldSetGaussianBasisState *state = assert_cast<WorldSetGaussianBasisState*>(_state.get());
+
+  config *configuration = World::getInstance().getConfig();
+  configuration->basis = state->params.newname;
+
+  return Action::state_ptr(_state);
 }
 
@@ -93,2 +77,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/SetGaussianBasisAction.def
===================================================================
--- src/Actions/WorldAction/SetGaussianBasisAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/SetGaussianBasisAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * SetGaussianBasisAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (std::string)
+#define paramtokens (WorldSetGaussianBasisAction::NAME)
+#define paramreferences (newname)
+
+#define statetypes (std::string)
+#define statereferences (lastname)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME SetGaussianBasis
+#define TOKEN "set-basis"
+
Index: src/Actions/WorldAction/SetGaussianBasisAction.hpp
===================================================================
--- src/Actions/WorldAction/SetGaussianBasisAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/SetGaussianBasisAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,26 +11,6 @@
 #include "Actions/Action.hpp"
 
-void WorldSetGaussianBasis(std::string &basisname);
-
-class WorldSetGaussianBasisAction : public Action {
-  friend void WorldSetGaussianBasis(std::string &basisname);
-
-public:
-  WorldSetGaussianBasisAction();
-  virtual ~WorldSetGaussianBasisAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "SetGaussianBasisAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* SETGAUSSIANBASISACTION_HPP_ */
Index: src/Actions/WorldAction/SetOutputFormatsAction.cpp
===================================================================
--- src/Actions/WorldAction/SetOutputFormatsAction.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/SetOutputFormatsAction.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SetOutputFormatsAction.cpp
@@ -6,12 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "Actions/WorldAction/SetOutputFormatsAction.hpp"
-#include "Actions/ActionRegistry.hpp"
 #include "Parser/ChangeTracker.hpp"
 #include "Parser/FormatParserStorage.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -21,50 +31,17 @@
 using namespace std;
 
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Actions/ValueStorage.hpp"
+#include "Actions/WorldAction/SetOutputFormatsAction.hpp"
 
-const char WorldSetOutputFormatsAction::NAME[] = "set-output";
+// and construct the stuff
+#include "SetOutputFormatsAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr WorldSetOutputFormatsAction::performCall() {
+  // obtain information
+  getParametersfromValueStorage();
 
-WorldSetOutputFormatsAction::WorldSetOutputFormatsAction() :
-  Action(NAME)
-{}
-
-WorldSetOutputFormatsAction::~WorldSetOutputFormatsAction()
-{}
-
-void WorldSetOutputFormats(vector<std::string> &FormatList) {
-  ValueStorage::getInstance().setCurrentValue(WorldSetOutputFormatsAction::NAME, FormatList);
-  ActionRegistry::getInstance().getActionByName(WorldSetOutputFormatsAction::NAME)->call(Action::NonInteractive);
-};
-
-Dialog* WorldSetOutputFormatsAction::fillDialog(Dialog *dialog) {
-  ASSERT(dialog,"No Dialog given when filling action dialog");
-
-  dialog->queryStrings(NAME, ValueStorage::getInstance().getDescription(NAME));
-
-  return dialog;
-}
-
-Action::state_ptr WorldSetOutputFormatsAction::performCall() {
-  vector<std::string> FormatList;
-
-  ValueStorage::getInstance().queryCurrentValue(NAME, FormatList);
-
-  for (vector<std::string>::iterator iter = FormatList.begin(); iter != FormatList.end(); ++iter) {
-    if (*iter == "mpqc") {
-      FormatParserStorage::getInstance().addMpqc();
-      DoLog(0) && (Log() << Verbose(0) << "Adding mpqc type to output." << endl);
-    } else if (*iter == "pcp") {
-      FormatParserStorage::getInstance().addPcp();
-      DoLog(0) && (Log() << Verbose(0) << "Adding pcp type to output." << endl);
-    } else if (*iter == "tremolo") {
-      FormatParserStorage::getInstance().addTremolo();
-      DoLog(0) && (Log() << Verbose(0) << "Adding tremolo type to output." << endl);
-    } else if (*iter == "xyz") {
-      FormatParserStorage::getInstance().addXyz();
-      DoLog(0) && (Log() << Verbose(0) << "Adding xyz type to output." << endl);
-    } else {
-      DoeLog(1) && (eLog() << Verbose(1) << "Unknown format:" << *iter << endl);
+  for (vector<std::string>::iterator iter = params.FormatList.begin(); iter != params.FormatList.end(); ++iter) {
+    if (!FormatParserStorage::getInstance().add(*iter)) {
+      DoeLog(1) && (eLog() << Verbose(1) << "Unknown parser format in WorldSetOutputFormatsAction:" << *iter << endl);
     }
   }
@@ -98,2 +75,3 @@
   return NAME;
 }
+/** =========== end of function ====================== */
Index: src/Actions/WorldAction/SetOutputFormatsAction.def
===================================================================
--- src/Actions/WorldAction/SetOutputFormatsAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Actions/WorldAction/SetOutputFormatsAction.def	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * SetOutputFormatsAction.def
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include <vector>
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required
+#define paramtypes (vector<std::string>)
+#define paramtokens (WorldSetOutputFormatsAction::NAME)
+#define paramreferences (FormatList)
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY World
+#define ACTIONNAME SetOutputFormats
+#define TOKEN "set-output"
+
Index: src/Actions/WorldAction/SetOutputFormatsAction.hpp
===================================================================
--- src/Actions/WorldAction/SetOutputFormatsAction.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Actions/WorldAction/SetOutputFormatsAction.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,28 +11,6 @@
 #include "Actions/Action.hpp"
 
-#include <vector>
-
-void WorldSetOutputFormats(std::vector<std::string> &FormatList);
-
-class WorldSetOutputFormatsAction : public Action {
-  friend void WorldSetOutputFormats(std::vector<std::string> &FormatList);
-
-public:
-  WorldSetOutputFormatsAction();
-  virtual ~WorldSetOutputFormatsAction();
-
-  bool canUndo();
-  bool shouldUndo();
-
-  virtual const std::string getName();
-protected:
-  virtual Dialog * fillDialog(Dialog *dialog);
-private:
-  virtual Action::state_ptr performCall();
-  virtual Action::state_ptr performUndo(Action::state_ptr);
-  virtual Action::state_ptr performRedo(Action::state_ptr);
-
-  static const char NAME[];
-};
+#include "SetOutputFormatsAction.def"
+#include "Action_impl_header.hpp"
 
 #endif /* SETOUTPUTFORMATSACTION_HPP_ */
Index: src/AtomSet.hpp
===================================================================
--- src/AtomSet.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/AtomSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,4 +11,5 @@
 
 #include <functional>
+#include <numeric>
 #include <algorithm>
 #include <boost/foreach.hpp>
@@ -22,5 +23,4 @@
 
 #include "atom.hpp"
-#include <list>
 
 // this tests, whether we actually have a Vector
@@ -56,7 +56,11 @@
    */
   void translate(const Vector &translater);
+  void addVelocityAtStep(const Vector velocity, unsigned int step);
 
   template<class Function>
   void transformNodes(Function f);
+  double totalMass() const;
+  double totalTemperatureAtStep(unsigned int step) const;
+  Vector totalMomentumAtStep(unsigned int step) const;
 
 private:
@@ -65,8 +69,43 @@
     workOnNodePointer(Function &_f) : f(_f){}
     void operator()(atom *atom){
-      if(atom->node)
-        *atom->node = f(*atom->node);
+      atom->setPosition(f(atom->getPosition()));
     }
     Function &f;
+  };
+
+  template<class T>
+  struct valueSum {
+    valueSum(T (atom::*_f)() const,T startValue) :
+      f(_f),
+      value(startValue)
+    {}
+    T operator+(atom *atom){
+      return value + (atom->*f)();
+    }
+    T operator=(T _value){
+      value = _value;
+      return value;
+    }
+    T (atom::*f)() const;
+    T value;
+  };
+
+  template<class T>
+  struct stepValueSum {
+    stepValueSum(unsigned int _step, T (atom::*_f)(unsigned int) const,T startValue) :
+      step(_step),
+      f(_f),
+      value(startValue)
+    {}
+    T operator+(atom *atom){
+      return value + (atom->*f)(step);
+    }
+    T operator=(T _value){
+      value = _value;
+      return value;
+    }
+    unsigned int step;
+    T (atom::*f)(unsigned int) const;
+    T value;
   };
 };
@@ -75,7 +114,12 @@
 inline void AtomSetMixin<Set>::translate(const Vector &translater){
   BOOST_FOREACH(atom *atom,*this){
-    if(atom->node){
-      *(atom->node) += translater;
-    }
+    *(atom) += translater;
+  }
+}
+
+template<class Set>
+inline void AtomSetMixin<Set>::addVelocityAtStep(const Vector velocity, unsigned int step){
+  BOOST_FOREACH(atom *atom,*this){
+    atom->Trajectory.U.at(step) += velocity;
   }
 }
@@ -89,4 +133,19 @@
 }
 
+template<class Set>
+inline double AtomSetMixin<Set>::totalMass() const{
+  return accumulate(this->begin(),this->end(),valueSum<double>(&atom::getMass,0)).value;
+}
+
+template<class Set>
+inline double AtomSetMixin<Set>::totalTemperatureAtStep(unsigned int step) const{
+  return accumulate(this->begin(),this->end(),stepValueSum<double>(step,&atom::getKineticEnergy,0)).value;
+}
+
+template<class Set>
+inline Vector AtomSetMixin<Set>::totalMomentumAtStep(unsigned int step) const{
+  return accumulate(this->begin(),this->end(),stepValueSum<Vector>(step,&atom::getMomentum,Vector())).value;
+}
+
 // allows simpler definition of AtomSets
 #define ATOMSET(container_type) AtomSetMixin<container_type<atom*> >
Index: src/AtomicInfo.cpp
===================================================================
--- src/AtomicInfo.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/AtomicInfo.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,69 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * AtomicInfo.cpp
+ *
+ *  Created on: Aug 10, 2010
+ *      Author: heber
+ */
+
+#include "atom.hpp"
+#include "AtomicInfo.hpp"
+#include "element.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
+/********************************** Functions for class AtomicInfo **********************************/
+
+AtomicInfo::AtomicInfo() :
+    Type(NULL),
+    Father(NULL),
+    Id(-1)
+{}
+AtomicInfo::AtomicInfo(const atom &_atom) :
+    Position(_atom.getPosition()),
+    Type(_atom.getType()),
+    Velocity(_atom.AtomicVelocity),
+    Father(_atom.father),
+    Mol(_atom.getMolecule()),
+    Id(_atom.getId())
+{}
+
+AtomicInfo::~AtomicInfo()
+{}
+
+
+bool AtomicInfo::setAtom(atom &_atom) const
+{
+  _atom.setPosition(Position);
+  _atom.setType(Type);
+  _atom.father = const_cast<atom *>(Father); // TODO: Actually, atom::father should be const atom *!
+  _atom.setMolecule(const_cast<molecule *>(Mol)); // this is ok, mol is const within AtomicInfo, but not outside (atoms need to register)
+  _atom.AtomicVelocity = Velocity;
+  if (_atom.getId() == Id)
+    return true;
+  else
+    return (_atom.changeId(Id));
+}
+
+atomId_t AtomicInfo::getId() const {
+  return Id;
+}
+
+AtomicInfo& AtomicInfo::operator=(const AtomicInfo& AI)
+{
+  if (&AI == this)  // check self-assignment
+    return *this;
+  Position = AI.Position;
+  Type = AI.Type;
+  Father = AI.Father;
+  Mol = AI.Mol;
+  Velocity = AI.Velocity;
+  Id = AI.Id;
+  return *this;
+}
+
Index: src/AtomicInfo.hpp
===================================================================
--- src/AtomicInfo.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/AtomicInfo.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,40 @@
+/*
+ * AtomicInfo.hpp
+ *
+ *  Created on: Aug 10, 2010
+ *      Author: heber
+ */
+
+#ifndef ATOMICINFO_HPP_
+#define ATOMICINFO_HPP_
+
+class atom;
+class element;
+class molecule;
+class Vector;
+
+/** This is for storing and transfering the information contained within an atom.
+ * This is needed for Undo/Redo operations of AtomActions.
+ */
+class AtomicInfo {
+public:
+  AtomicInfo();
+  AtomicInfo(const atom &_atom);
+  ~AtomicInfo();
+
+  bool setAtom(atom &_atom) const;
+  atomId_t getId() const;
+
+  AtomicInfo& operator=(const AtomicInfo&);
+
+private:
+  Vector Position;
+  const element * Type;
+  Vector Velocity;
+  const atom * Father;
+  const molecule * Mol;
+  atomId_t Id;
+};
+
+
+#endif /* ATOMICINFO_HPP_ */
Index: src/BoundaryLineSet.cpp
===================================================================
--- src/BoundaryLineSet.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/BoundaryLineSet.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,299 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * BoundaryLineSet.cpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "BoundaryLineSet.hpp"
+
+#include <iostream>
+
+#include "BoundaryPointSet.hpp"
+#include "BoundaryTriangleSet.hpp"
+#include "TesselPoint.hpp"
+
+#include "Helpers/Assert.hpp"
+#include "Helpers/Info.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "tesselationhelpers.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
+using namespace std;
+
+/** Constructor of BoundaryLineSet.
+ */
+BoundaryLineSet::BoundaryLineSet() :
+  Nr(-1)
+{
+  Info FunctionInfo(__func__);
+  for (int i = 0; i < 2; i++)
+    endpoints[i] = NULL;
+}
+;
+
+/** Constructor of BoundaryLineSet with two endpoints.
+ * Adds line automatically to each endpoints' LineMap
+ * \param *Point[2] array of two boundary points
+ * \param number number of the list
+ */
+BoundaryLineSet::BoundaryLineSet(BoundaryPointSet * const Point[2], const int number)
+{
+  Info FunctionInfo(__func__);
+  // set number
+  Nr = number;
+  // set endpoints in ascending order
+  SetEndpointsOrdered(endpoints, Point[0], Point[1]);
+  // add this line to the hash maps of both endpoints
+  Point[0]->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding.
+  Point[1]->AddLine(this); //
+  // set skipped to false
+  skipped = false;
+  // clear triangles list
+  DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);
+}
+;
+
+/** Constructor of BoundaryLineSet with two endpoints.
+ * Adds line automatically to each endpoints' LineMap
+ * \param *Point1 first boundary point
+ * \param *Point2 second boundary point
+ * \param number number of the list
+ */
+BoundaryLineSet::BoundaryLineSet(BoundaryPointSet * const Point1, BoundaryPointSet * const Point2, const int number) :
+  Nr(number),
+  skipped(false)
+{
+  Info FunctionInfo(__func__);
+  // set endpoints in ascending order
+  SetEndpointsOrdered(endpoints, Point1, Point2);
+  // add this line to the hash maps of both endpoints
+  Point1->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding.
+  Point2->AddLine(this); //
+  // clear triangles list
+  DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);
+}
+;
+
+/** Destructor for BoundaryLineSet.
+ * Removes itself from each endpoints' LineMap, calling RemoveTrianglePoint() when point not connected anymore.
+ * \note When removing lines from a class Tesselation, use RemoveTesselationLine()
+ */
+BoundaryLineSet::~BoundaryLineSet()
+{
+  Info FunctionInfo(__func__);
+  int Numbers[2];
+
+  // get other endpoint number of finding copies of same line
+  if (endpoints[1] != NULL)
+    Numbers[0] = endpoints[1]->Nr;
+  else
+    Numbers[0] = -1;
+  if (endpoints[0] != NULL)
+    Numbers[1] = endpoints[0]->Nr;
+  else
+    Numbers[1] = -1;
+
+  for (int i = 0; i < 2; i++) {
+    if (endpoints[i] != NULL) {
+      if (Numbers[i] != -1) { // as there may be multiple lines with same endpoints, we have to go through each and find in the endpoint's line list this line set
+        pair<LineMap::iterator, LineMap::iterator> erasor = endpoints[i]->lines.equal_range(Numbers[i]);
+        for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
+          if ((*Runner).second == this) {
+            //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
+            endpoints[i]->lines.erase(Runner);
+            break;
+          }
+      } else { // there's just a single line left
+        if (endpoints[i]->lines.erase(Nr)) {
+          //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
+        }
+      }
+      if (endpoints[i]->lines.empty()) {
+        //Log() << Verbose(0) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;
+        if (endpoints[i] != NULL) {
+          delete (endpoints[i]);
+          endpoints[i] = NULL;
+        }
+      }
+    }
+  }
+  if (!triangles.empty())
+    DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some triangles." << endl);
+}
+;
+
+/** Add triangle to TriangleMap of this boundary line.
+ * \param *triangle to add
+ */
+void BoundaryLineSet::AddTriangle(BoundaryTriangleSet * const triangle)
+{
+  Info FunctionInfo(__func__);
+  DoLog(0) && (Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl);
+  triangles.insert(TrianglePair(triangle->Nr, triangle));
+}
+;
+
+/** Checks whether we have a common endpoint with given \a *line.
+ * \param *line other line to test
+ * \return true - common endpoint present, false - not connected
+ */
+bool BoundaryLineSet::IsConnectedTo(const BoundaryLineSet * const line) const
+{
+  Info FunctionInfo(__func__);
+  if ((endpoints[0] == line->endpoints[0]) || (endpoints[1] == line->endpoints[0]) || (endpoints[0] == line->endpoints[1]) || (endpoints[1] == line->endpoints[1]))
+    return true;
+  else
+    return false;
+}
+;
+
+/** Checks whether the adjacent triangles of a baseline are convex or not.
+ * We sum the two angles of each height vector with respect to the center of the baseline.
+ * If greater/equal M_PI than we are convex.
+ * \param *out output stream for debugging
+ * \return true - triangles are convex, false - concave or less than two triangles connected
+ */
+bool BoundaryLineSet::CheckConvexityCriterion() const
+{
+  Info FunctionInfo(__func__);
+  double angle = CalculateConvexity();
+  if (angle > -MYEPSILON) {
+    DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl);
+    return true;
+  } else {
+    DoLog(0) && (Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl);
+    return false;
+  }
+}
+
+
+/** Calculates the angle between two triangles with respect to their normal vector.
+ * We sum the two angles of each height vector with respect to the center of the baseline.
+ * \return angle > 0 then convex, if < 0 then concave
+ */
+double BoundaryLineSet::CalculateConvexity() const
+{
+  Info FunctionInfo(__func__);
+  Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck;
+  // get the two triangles
+  if (triangles.size() != 2) {
+    DoeLog(0) && (eLog() << Verbose(0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl);
+    return true;
+  }
+  // check normal vectors
+  // have a normal vector on the base line pointing outwards
+  //Log() << Verbose(0) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;
+  BaseLineCenter = (1./2.)*((endpoints[0]->node->getPosition()) + (endpoints[1]->node->getPosition()));
+  BaseLine = (endpoints[0]->node->getPosition()) - (endpoints[1]->node->getPosition());
+
+  //Log() << Verbose(0) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;
+
+  BaseLineNormal.Zero();
+  NormalCheck.Zero();
+  double sign = -1.;
+  int i = 0;
+  class BoundaryPointSet *node = NULL;
+  for (TriangleMap::const_iterator runner = triangles.begin(); runner != triangles.end(); runner++) {
+    //Log() << Verbose(0) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;
+    NormalCheck += runner->second->NormalVector;
+    NormalCheck *= sign;
+    sign = -sign;
+    if (runner->second->NormalVector.NormSquared() > MYEPSILON)
+      BaseLineNormal = runner->second->NormalVector;   // yes, copy second on top of first
+    else {
+      DoeLog(0) && (eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl);
+    }
+    node = runner->second->GetThirdEndpoint(this);
+    if (node != NULL) {
+      //Log() << Verbose(0) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
+      helper[i] = (node->node->getPosition()) - BaseLineCenter;
+      helper[i].MakeNormalTo(BaseLine);  // we want to compare the triangle's heights' angles!
+      //Log() << Verbose(0) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
+      i++;
+    } else {
+      DoeLog(1) && (eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl);
+      return true;
+    }
+  }
+  //Log() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
+  if (NormalCheck.NormSquared() < MYEPSILON) {
+    DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl);
+    return true;
+  }
+  BaseLineNormal.Scale(-1.);
+  double angle = GetAngle(helper[0], helper[1], BaseLineNormal);
+  return (angle - M_PI);
+}
+
+/** Checks whether point is any of the two endpoints this line contains.
+ * \param *point point to test
+ * \return true - point is of the line, false - is not
+ */
+bool BoundaryLineSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
+{
+  Info FunctionInfo(__func__);
+  for (int i = 0; i < 2; i++)
+    if (point == endpoints[i])
+      return true;
+  return false;
+}
+;
+
+/** Returns other endpoint of the line.
+ * \param *point other endpoint
+ * \return NULL - if endpoint not contained in BoundaryLineSet::lines, or pointer to BoundaryPointSet otherwise
+ */
+class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(const BoundaryPointSet * const point) const
+{
+  Info FunctionInfo(__func__);
+  if (endpoints[0] == point)
+    return endpoints[1];
+  else if (endpoints[1] == point)
+    return endpoints[0];
+  else
+    return NULL;
+}
+;
+
+/** Returns other triangle of the line.
+ * \param *point other endpoint
+ * \return NULL - if triangle not contained in BoundaryLineSet::triangles, or pointer to BoundaryTriangleSet otherwise
+ */
+class BoundaryTriangleSet *BoundaryLineSet::GetOtherTriangle(const BoundaryTriangleSet * const triangle) const
+{
+  Info FunctionInfo(__func__);
+  if (triangles.size() == 2) {
+    for (TriangleMap::const_iterator TriangleRunner = triangles.begin(); TriangleRunner != triangles.end(); ++TriangleRunner)
+      if (TriangleRunner->second != triangle)
+        return TriangleRunner->second;
+  }
+  return NULL;
+}
+;
+
+/** output operator for BoundaryLineSet.
+ * \param &ost output stream
+ * \param &a boundary line
+ */
+ostream & operator <<(ostream &ost, const BoundaryLineSet &a)
+{
+  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->getName() << " at " << a.endpoints[0]->node->getPosition() << "," << a.endpoints[1]->node->getName() << " at " << a.endpoints[1]->node->getPosition() << "]";
+  return ost;
+}
+;
Index: src/BoundaryLineSet.hpp
===================================================================
--- src/BoundaryLineSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/BoundaryLineSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,54 @@
+/*
+ * BoundaryLineSet.hpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+#ifndef BOUNDARYLINESET_HPP_
+#define BOUNDARYLINESET_HPP_
+
+#include "BoundaryMaps.hpp"
+
+#include <iostream>
+#include <map>
+
+class BoundaryLineSet;
+class BoundaryPointSet;
+class BoundaryTriangleSet;
+
+class BoundaryLineSet {
+  public:
+    BoundaryLineSet();
+    BoundaryLineSet(BoundaryPointSet * const Point[2], const int number);
+    BoundaryLineSet(BoundaryPointSet * const Point1, BoundaryPointSet * const Point2, const int number);
+    ~BoundaryLineSet();
+
+    void AddTriangle(BoundaryTriangleSet * const triangle);
+    bool IsConnectedTo(const BoundaryLineSet * const line) const;
+    bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
+    bool CheckConvexityCriterion() const;
+    double CalculateConvexity() const;
+    class BoundaryPointSet *GetOtherEndpoint(const BoundaryPointSet * const point) const;
+    class BoundaryTriangleSet *GetOtherTriangle(const BoundaryTriangleSet * const triangle) const;
+
+    class BoundaryPointSet *endpoints[2];
+    TriangleMap triangles;
+    int Nr;
+    bool skipped;
+};
+
+std::ostream & operator << (std::ostream &ost, const BoundaryLineSet &a);
+
+template <typename T> void SetEndpointsOrdered(T endpoints[2], T endpoint1, T endpoint2)
+{
+  if (endpoint1->Nr < endpoint2->Nr) {
+    endpoints[0] = endpoint1;
+    endpoints[1] = endpoint2;
+  } else {
+    endpoints[0] = endpoint2;
+    endpoints[1] = endpoint1;
+  }
+};
+
+#endif /* BOUNDARYLINESET_HPP_ */
Index: src/BoundaryMaps.hpp
===================================================================
--- src/BoundaryMaps.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/BoundaryMaps.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,80 @@
+/*
+ * BoundaryMaps.hpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+#ifndef BOUNDARYMAPS_HPP_
+#define BOUNDARYMAPS_HPP_
+
+class BoundaryPointSet;
+class BoundaryLineSet;
+class BoundaryTriangleSet;
+class BoundaryPolygonSet;
+class CandidateForTesselation;
+class TesselPoint;
+
+#include <list>
+#include <map>
+#include <set>
+
+typedef std::map <int, int> IndexToIndex;
+
+// ============= TesselPoint maps ======================== //
+typedef std::pair < double, class TesselPoint * > TesselPointDistancePair;
+typedef std::multimap < double, class TesselPoint * > TesselPointDistanceMap;
+typedef std::pair < TesselPointDistanceMap::iterator, bool > TesselPointDistanceTestPair;
+
+typedef std::list <TesselPoint *> TesselPointList;
+typedef std::set <TesselPoint *> TesselPointSet;
+
+typedef std::list<std::list <TesselPoint *> *> ListOfTesselPointList;
+
+// ============= BoundaryPointSet maps ======================== //
+typedef std::map < int, class BoundaryPointSet * > PointMap;
+typedef std::set < class BoundaryPointSet * > PointSet;
+typedef std::list < class BoundaryPointSet * > PointList;
+typedef std::pair < int, class BoundaryPointSet * > PointPair;
+typedef std::pair < PointMap::iterator, bool > PointTestPair;
+
+typedef std::multimap <double, class BoundaryPointSet * > DistanceToPointMap;
+typedef std::pair <double, class BoundaryPointSet * > DistanceToPointPair;
+
+// ============= BoundaryLineSet maps ======================== //
+typedef std::multimap < int, class BoundaryLineSet * > LineMap;
+typedef std::set < class BoundaryLineSet * > LineSet;
+typedef std::list < class BoundaryLineSet * > LineList;
+typedef std::pair < int, class BoundaryLineSet * > LinePair;
+typedef std::pair < LineMap::iterator, bool > LineTestPair;
+
+// ============= BoundaryTriangleSet maps ======================== //
+typedef std::map < int, class BoundaryTriangleSet * > TriangleMap;
+typedef std::set < class BoundaryTriangleSet * > TriangleSet;
+typedef std::list < class BoundaryTriangleSet * > TriangleList;
+typedef std::pair < int, class BoundaryTriangleSet * > TrianglePair;
+typedef std::pair < TriangleMap::iterator, bool > TriangleTestPair;
+
+// ============= BoundaryPolygonSet maps ======================== //
+typedef std::map < int, class BoundaryPolygonSet * > PolygonMap;
+typedef std::set < class BoundaryPolygonSet * > PolygonSet;
+typedef std::list < class BoundaryPolygonSet * > PolygonList;
+
+// ============= CandidateForTesselation maps ======================== //
+typedef std::list <class CandidateForTesselation *> CandidateList;
+typedef std::map <class BoundaryLineSet *, class CandidateForTesselation *> CandidateMap;
+
+// ============= Various maps ======================== //
+typedef std::map <double, TesselPointDistancePair > Boundaries;
+typedef std::pair<double, TesselPointDistancePair > BoundariesPair;
+typedef std::pair< Boundaries::iterator, bool> BoundariesTestPair;
+
+typedef std::multimap <double, std::pair < PointMap::iterator, PointMap::iterator> > DistanceMultiMap;
+typedef std::pair <double, std::pair < PointMap::iterator, PointMap::iterator> > DistanceMultiMapPair;
+
+enum centers {Opt, OtherOpt};
+
+
+
+
+#endif /* BOUNDARYMAPS_HPP_ */
Index: src/BoundaryPointSet.cpp
===================================================================
--- src/BoundaryPointSet.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/BoundaryPointSet.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,105 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * BoundaryPointSet.cpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "BoundaryPointSet.hpp"
+
+#include <iostream>
+
+#include "BoundaryLineSet.hpp"
+#include "BoundaryTriangleSet.hpp"
+#include "TesselPoint.hpp"
+
+#include "Helpers/Assert.hpp"
+#include "Helpers/Info.hpp"
+#include "Helpers/Log.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Verbose.hpp"
+
+using namespace std;
+
+// ======================================== Points on Boundary =================================
+
+/** Constructor of BoundaryPointSet.
+ */
+BoundaryPointSet::BoundaryPointSet() :
+  LinesCount(0),
+  value(0.),
+  Nr(-1)
+{
+  Info FunctionInfo(__func__);
+  DoLog(1) && (Log() << Verbose(1) << "Adding noname." << endl);
+}
+;
+
+/** Constructor of BoundaryPointSet with Tesselpoint.
+ * \param *Walker TesselPoint this boundary point represents
+ */
+BoundaryPointSet::BoundaryPointSet(TesselPoint * const Walker) :
+  LinesCount(0),
+  node(Walker),
+  value(0.),
+  Nr(Walker->nr)
+{
+  Info FunctionInfo(__func__);
+  DoLog(1) && (Log() << Verbose(1) << "Adding Node " << *Walker << endl);
+}
+;
+
+/** Destructor of BoundaryPointSet.
+ * Sets node to NULL to avoid removing the original, represented TesselPoint.
+ * \note When removing point from a class Tesselation, use RemoveTesselationPoint()
+ */
+BoundaryPointSet::~BoundaryPointSet()
+{
+  Info FunctionInfo(__func__);
+  //Log() << Verbose(0) << "Erasing point nr. " << Nr << "." << endl;
+  if (!lines.empty())
+    DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl);
+  node = NULL;
+}
+;
+
+/** Add a line to the LineMap of this point.
+ * \param *line line to add
+ */
+void BoundaryPointSet::AddLine(BoundaryLineSet * const line)
+{
+  Info FunctionInfo(__func__);
+  DoLog(1) && (Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." << endl);
+  if (line->endpoints[0] == this) {
+    lines.insert(LinePair(line->endpoints[1]->Nr, line));
+  } else {
+    lines.insert(LinePair(line->endpoints[0]->Nr, line));
+  }
+  LinesCount++;
+}
+;
+
+/** output operator for BoundaryPointSet.
+ * \param &ost output stream
+ * \param &a boundary point
+ */
+ostream & operator <<(ostream &ost, const BoundaryPointSet &a)
+{
+  ost << "[" << a.Nr << "|" << a.node->getName() << " at " << a.node->getPosition() << "]";
+  return ost;
+}
+;
Index: src/BoundaryPointSet.hpp
===================================================================
--- src/BoundaryPointSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/BoundaryPointSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,36 @@
+/*
+ * BoundaryPointSet.hpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+#ifndef BOUNDARYPOINTSET_HPP_
+#define BOUNDARYPOINTSET_HPP_
+
+#include "BoundaryMaps.hpp"
+
+#include <iostream>
+#include <map>
+
+class BoundaryLineSet;
+class TesselPoint;
+
+class BoundaryPointSet {
+  public:
+    BoundaryPointSet();
+    BoundaryPointSet(TesselPoint * const Walker);
+    ~BoundaryPointSet();
+
+    void AddLine(BoundaryLineSet * const line);
+
+    LineMap lines;
+    int LinesCount;
+    TesselPoint *node;
+    double value;
+    int Nr;
+};
+
+std::ostream & operator << (std::ostream &ost, const BoundaryPointSet &a);
+
+#endif /* BOUNDARYPOINTSET_HPP_ */
Index: src/BoundaryPolygonSet.cpp
===================================================================
--- src/BoundaryPolygonSet.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/BoundaryPolygonSet.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,301 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * BoundaryPolygonSet.cpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "BoundaryPolygonSet.hpp"
+
+#include <iostream>
+
+#include "BoundaryLineSet.hpp"
+#include "BoundaryPointSet.hpp"
+#include "BoundaryTriangleSet.hpp"
+#include "TesselPoint.hpp"
+
+#include "Helpers/Assert.hpp"
+#include "Helpers/helpers.hpp"
+#include "Helpers/Info.hpp"
+#include "Helpers/Log.hpp"
+#include "LinearAlgebra/Plane.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Verbose.hpp"
+
+using namespace std;
+
+/** Constructor for BoundaryPolygonSet.
+ */
+BoundaryPolygonSet::BoundaryPolygonSet() :
+  Nr(-1)
+{
+  Info FunctionInfo(__func__);
+}
+;
+
+/** Destructor of BoundaryPolygonSet.
+ * Just clears endpoints.
+ * \note When removing triangles from a class Tesselation, use RemoveTesselationTriangle()
+ */
+BoundaryPolygonSet::~BoundaryPolygonSet()
+{
+  Info FunctionInfo(__func__);
+  endpoints.clear();
+  DoLog(1) && (Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl);
+}
+;
+
+/** Calculates the normal vector for this triangle.
+ * Is made unique by comparison with \a OtherVector to point in the other direction.
+ * \param &OtherVector direction vector to make normal vector unique.
+ * \return allocated vector in normal direction
+ */
+Vector * BoundaryPolygonSet::GetNormalVector(const Vector &OtherVector) const
+{
+  Info FunctionInfo(__func__);
+  // get normal vector
+  Vector TemporaryNormal;
+  Vector *TotalNormal = new Vector;
+  PointSet::const_iterator Runner[3];
+  for (int i = 0; i < 3; i++) {
+    Runner[i] = endpoints.begin();
+    for (int j = 0; j < i; j++) { // go as much further
+      Runner[i]++;
+      if (Runner[i] == endpoints.end()) {
+        DoeLog(0) && (eLog() << Verbose(0) << "There are less than three endpoints in the polygon!" << endl);
+        performCriticalExit();
+      }
+    }
+  }
+  TotalNormal->Zero();
+  int counter = 0;
+  for (; Runner[2] != endpoints.end();) {
+    TemporaryNormal = Plane(((*Runner[0])->node->getPosition()),
+                            ((*Runner[1])->node->getPosition()),
+                            ((*Runner[2])->node->getPosition())).getNormal();
+    for (int i = 0; i < 3; i++) // increase each of them
+      Runner[i]++;
+    (*TotalNormal) += TemporaryNormal;
+  }
+  TotalNormal->Scale(1. / (double) counter);
+
+  // make it always point inward (any offset vector onto plane projected onto normal vector suffices)
+  if (TotalNormal->ScalarProduct(OtherVector) > 0.)
+    TotalNormal->Scale(-1.);
+  DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl);
+
+  return TotalNormal;
+}
+;
+
+/** Calculates the center point of the triangle.
+ * Is third of the sum of all endpoints.
+ * \param *center central point on return.
+ */
+void BoundaryPolygonSet::GetCenter(Vector * const center) const
+{
+  Info FunctionInfo(__func__);
+  center->Zero();
+  int counter = 0;
+  for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
+    (*center) += ((*Runner)->node->getPosition());
+    counter++;
+  }
+  center->Scale(1. / (double) counter);
+  DoLog(1) && (Log() << Verbose(1) << "Center is at " << *center << "." << endl);
+}
+
+/** Checks whether the polygons contains all three endpoints of the triangle.
+ * \param *triangle triangle to test
+ * \return true - triangle is contained polygon, false - is not
+ */
+bool BoundaryPolygonSet::ContainsBoundaryTriangle(const BoundaryTriangleSet * const triangle) const
+{
+  Info FunctionInfo(__func__);
+  return ContainsPresentTupel(triangle->endpoints, 3);
+}
+;
+
+/** Checks whether the polygons contains both endpoints of the line.
+ * \param *line line to test
+ * \return true - line is of the triangle, false - is not
+ */
+bool BoundaryPolygonSet::ContainsBoundaryLine(const BoundaryLineSet * const line) const
+{
+  Info FunctionInfo(__func__);
+  return ContainsPresentTupel(line->endpoints, 2);
+}
+;
+
+/** Checks whether point is any of the three endpoints this triangle contains.
+ * \param *point point to test
+ * \return true - point is of the triangle, false - is not
+ */
+bool BoundaryPolygonSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
+{
+  Info FunctionInfo(__func__);
+  for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
+    DoLog(0) && (Log() << Verbose(0) << "Checking against " << **Runner << endl);
+    if (point == (*Runner)) {
+      DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);
+      return true;
+    }
+  }
+  DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);
+  return false;
+}
+;
+
+/** Checks whether point is any of the three endpoints this triangle contains.
+ * \param *point TesselPoint to test
+ * \return true - point is of the triangle, false - is not
+ */
+bool BoundaryPolygonSet::ContainsBoundaryPoint(const TesselPoint * const point) const
+{
+  Info FunctionInfo(__func__);
+  for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)
+    if (point == (*Runner)->node) {
+      DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);
+      return true;
+    }
+  DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);
+  return false;
+}
+;
+
+/** Checks whether given array of \a *Points coincide with polygons's endpoints.
+ * \param **Points pointer to an array of BoundaryPointSet
+ * \param dim dimension of array
+ * \return true - set of points is contained in polygon, false - is not
+ */
+bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const
+{
+  Info FunctionInfo(__func__);
+  int counter = 0;
+  DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);
+  for (int i = 0; i < dim; i++) {
+    DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl);
+    if (ContainsBoundaryPoint(Points[i])) {
+      counter++;
+    }
+  }
+
+  if (counter == dim)
+    return true;
+  else
+    return false;
+}
+;
+
+/** Checks whether given PointList coincide with polygons's endpoints.
+ * \param &endpoints PointList
+ * \return true - set of points is contained in polygon, false - is not
+ */
+bool BoundaryPolygonSet::ContainsPresentTupel(const PointSet &endpoints) const
+{
+  Info FunctionInfo(__func__);
+  size_t counter = 0;
+  DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);
+  for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
+    DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << **Runner << endl);
+    if (ContainsBoundaryPoint(*Runner))
+      counter++;
+  }
+
+  if (counter == endpoints.size())
+    return true;
+  else
+    return false;
+}
+;
+
+/** Checks whether given set of \a *Points coincide with polygons's endpoints.
+ * \param *P pointer to BoundaryPolygonSet
+ * \return true - is the very triangle, false - is not
+ */
+bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPolygonSet * const P) const
+{
+  return ContainsPresentTupel((const PointSet) P->endpoints);
+}
+;
+
+/** Gathers all the endpoints' triangles in a unique set.
+ * \return set of all triangles
+ */
+TriangleSet * BoundaryPolygonSet::GetAllContainedTrianglesFromEndpoints() const
+{
+  Info FunctionInfo(__func__);
+  pair<TriangleSet::iterator, bool> Tester;
+  TriangleSet *triangles = new TriangleSet;
+
+  for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)
+    for (LineMap::const_iterator Walker = (*Runner)->lines.begin(); Walker != (*Runner)->lines.end(); Walker++)
+      for (TriangleMap::const_iterator Sprinter = (Walker->second)->triangles.begin(); Sprinter != (Walker->second)->triangles.end(); Sprinter++) {
+        //Log() << Verbose(0) << " Testing triangle " << *(Sprinter->second) << endl;
+        if (ContainsBoundaryTriangle(Sprinter->second)) {
+          Tester = triangles->insert(Sprinter->second);
+          if (Tester.second)
+            DoLog(0) && (Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl);
+        }
+      }
+
+  DoLog(1) && (Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl);
+  return triangles;
+}
+;
+
+/** Fills the endpoints of this polygon from the triangles attached to \a *line.
+ * \param *line lines with triangles attached
+ * \return true - polygon contains endpoints, false - line was NULL
+ */
+bool BoundaryPolygonSet::FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line)
+{
+  Info FunctionInfo(__func__);
+  pair<PointSet::iterator, bool> Tester;
+  if (line == NULL)
+    return false;
+  DoLog(1) && (Log() << Verbose(1) << "Filling polygon from line " << *line << endl);
+  for (TriangleMap::const_iterator Runner = line->triangles.begin(); Runner != line->triangles.end(); Runner++) {
+    for (int i = 0; i < 3; i++) {
+      Tester = endpoints.insert((Runner->second)->endpoints[i]);
+      if (Tester.second)
+        DoLog(1) && (Log() << Verbose(1) << "  Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl);
+    }
+  }
+
+  return true;
+}
+;
+
+/** output operator for BoundaryPolygonSet.
+ * \param &ost output stream
+ * \param &a boundary polygon
+ */
+ostream &operator <<(ostream &ost, const BoundaryPolygonSet &a)
+{
+  ost << "[" << a.Nr << "|";
+  for (PointSet::const_iterator Runner = a.endpoints.begin(); Runner != a.endpoints.end();) {
+    ost << (*Runner)->node->getName();
+    Runner++;
+    if (Runner != a.endpoints.end())
+      ost << ",";
+  }
+  ost << "]";
+  return ost;
+}
+;
+
Index: src/BoundaryPolygonSet.hpp
===================================================================
--- src/BoundaryPolygonSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/BoundaryPolygonSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,51 @@
+/*
+ * BoundaryPolygonSet.hpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+#ifndef BOUNDARYPOLYGONSET_HPP_
+#define BOUNDARYPOLYGONSET_HPP_
+
+#include "BoundaryMaps.hpp"
+
+#include <iostream>
+#include <set>
+
+class BoundaryPointSet;
+class BoundaryLineSet;
+class BoundaryTriangleSet;
+class TesselPoint;
+class Vector;
+
+/** Set of BoundaryPointSet.
+ * This is just meant as a container for a group of endpoints, extending the node, line, triangle concept. However, this has
+ * only marginally something to do with the tesselation. Hence, there is no incorporation into the bookkeeping of the Tesselation
+ * class (i.e. no allocation, no deletion).
+ * \note we assume that the set of endpoints reside (more or less) on a plane.
+ */
+class BoundaryPolygonSet {
+  public:
+    BoundaryPolygonSet();
+    ~BoundaryPolygonSet();
+
+    Vector * GetNormalVector(const Vector &NormalVector) const;
+    void GetCenter(Vector *center) const;
+    bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
+    bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
+    bool ContainsBoundaryPoint(const TesselPoint * const point) const;
+    bool ContainsBoundaryTriangle(const BoundaryTriangleSet * const point) const;
+    bool ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const;
+    bool ContainsPresentTupel(const BoundaryPolygonSet * const P) const;
+    bool ContainsPresentTupel(const PointSet &endpoints) const;
+    TriangleSet * GetAllContainedTrianglesFromEndpoints() const;
+    bool FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line);
+
+    PointSet endpoints;
+    int Nr;
+};
+
+std::ostream & operator << (std::ostream &ost, const BoundaryPolygonSet &a);
+
+#endif /* BOUNDARYPOLYGONSET_HPP_ */
Index: src/BoundaryTriangleSet.cpp
===================================================================
--- src/BoundaryTriangleSet.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/BoundaryTriangleSet.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,437 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * BoundaryTriangleSet.cpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "BoundaryTriangleSet.hpp"
+
+#include <iostream>
+
+#include "BoundaryLineSet.hpp"
+#include "BoundaryPointSet.hpp"
+#include "TesselPoint.hpp"
+
+#include "Helpers/Assert.hpp"
+#include "Helpers/Info.hpp"
+#include "LinearAlgebra/Line.hpp"
+#include "Helpers/Log.hpp"
+#include "LinearAlgebra/Plane.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Verbose.hpp"
+
+using namespace std;
+
+/** Constructor for BoundaryTriangleSet.
+ */
+BoundaryTriangleSet::BoundaryTriangleSet() :
+  Nr(-1)
+{
+  Info FunctionInfo(__func__);
+  for (int i = 0; i < 3; i++) {
+    endpoints[i] = NULL;
+    lines[i] = NULL;
+  }
+}
+;
+
+/** Constructor for BoundaryTriangleSet with three lines.
+ * \param *line[3] lines that make up the triangle
+ * \param number number of triangle
+ */
+BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet * const line[3], const int number) :
+  Nr(number)
+{
+  Info FunctionInfo(__func__);
+  // set number
+  // set lines
+  for (int i = 0; i < 3; i++) {
+    lines[i] = line[i];
+    lines[i]->AddTriangle(this);
+  }
+  // get ascending order of endpoints
+  PointMap OrderMap;
+  for (int i = 0; i < 3; i++) {
+    // for all three lines
+    for (int j = 0; j < 2; j++) { // for both endpoints
+      OrderMap.insert(pair<int, class BoundaryPointSet *> (line[i]->endpoints[j]->Nr, line[i]->endpoints[j]));
+      // and we don't care whether insertion fails
+    }
+  }
+  // set endpoints
+  int Counter = 0;
+  DoLog(0) && (Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl);
+  for (PointMap::iterator runner = OrderMap.begin(); runner != OrderMap.end(); runner++) {
+    endpoints[Counter] = runner->second;
+    DoLog(0) && (Log() << Verbose(0) << " " << *endpoints[Counter] << endl);
+    Counter++;
+  }
+  ASSERT(Counter >= 3,"We have a triangle with only two distinct endpoints!");
+};
+
+
+/** Destructor of BoundaryTriangleSet.
+ * Removes itself from each of its lines' LineMap and removes them if necessary.
+ * \note When removing triangles from a class Tesselation, use RemoveTesselationTriangle()
+ */
+BoundaryTriangleSet::~BoundaryTriangleSet()
+{
+  Info FunctionInfo(__func__);
+  for (int i = 0; i < 3; i++) {
+    if (lines[i] != NULL) {
+      if (lines[i]->triangles.erase(Nr)) {
+        //Log() << Verbose(0) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;
+      }
+      if (lines[i]->triangles.empty()) {
+        //Log() << Verbose(0) << *lines[i] << " is no more attached to any triangle, erasing." << endl;
+        delete (lines[i]);
+        lines[i] = NULL;
+      }
+    }
+  }
+  //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl;
+}
+;
+
+/** Calculates the normal vector for this triangle.
+ * Is made unique by comparison with \a OtherVector to point in the other direction.
+ * \param &OtherVector direction vector to make normal vector unique.
+ */
+void BoundaryTriangleSet::GetNormalVector(const Vector &OtherVector)
+{
+  Info FunctionInfo(__func__);
+  // get normal vector
+  NormalVector = Plane((endpoints[0]->node->getPosition()),
+                       (endpoints[1]->node->getPosition()),
+                       (endpoints[2]->node->getPosition())).getNormal();
+
+  // make it always point inward (any offset vector onto plane projected onto normal vector suffices)
+  if (NormalVector.ScalarProduct(OtherVector) > 0.)
+    NormalVector.Scale(-1.);
+  DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl);
+}
+;
+
+/** Finds the point on the triangle \a *BTS through which the line defined by \a *MolCenter and \a *x crosses.
+ * We call Vector::GetIntersectionWithPlane() to receive the intersection point with the plane
+ * Thus we test if it's really on the plane and whether it's inside the triangle on the plane or not.
+ * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line
+ * given by the intersection and the third basepoint. Then, we check whether it's on the baseline (i.e. between
+ * the first two basepoints) or not.
+ * \param *out output stream for debugging
+ * \param &MolCenter offset vector of line
+ * \param &x second endpoint of line, minus \a *MolCenter is directional vector of line
+ * \param &Intersection intersection on plane on return
+ * \return true - \a *Intersection contains intersection on plane defined by triangle, false - zero vector if outside of triangle.
+ */
+
+bool BoundaryTriangleSet::GetIntersectionInsideTriangle(const Vector & MolCenter, const Vector & x, Vector &Intersection) const
+{
+  Info FunctionInfo(__func__);
+  Vector CrossPoint;
+  Vector helper;
+
+  try {
+    Line centerLine = makeLineThrough(MolCenter, x);
+    Intersection = Plane(NormalVector, (endpoints[0]->node->getPosition())).GetIntersection(centerLine);
+
+    DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << MolCenter << " to " << x << "." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << Intersection << "." << endl);
+
+    if (Intersection.DistanceSquared(endpoints[0]->node->getPosition()) < MYEPSILON) {
+      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);
+      return true;
+    }   else if (Intersection.DistanceSquared(endpoints[1]->node->getPosition()) < MYEPSILON) {
+      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);
+      return true;
+    }   else if (Intersection.DistanceSquared(endpoints[2]->node->getPosition()) < MYEPSILON) {
+      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);
+      return true;
+    }
+    // Calculate cross point between one baseline and the line from the third endpoint to intersection
+    int i = 0;
+    do {
+      Line line1 = makeLineThrough((endpoints[i%3]->node->getPosition()),(endpoints[(i+1)%3]->node->getPosition()));
+      Line line2 = makeLineThrough((endpoints[(i+2)%3]->node->getPosition()),Intersection);
+      CrossPoint = line1.getIntersection(line2);
+      helper = (endpoints[(i+1)%3]->node->getPosition()) - (endpoints[i%3]->node->getPosition());
+      CrossPoint -= (endpoints[i%3]->node->getPosition());  // cross point was returned as absolute vector
+      const double s = CrossPoint.ScalarProduct(helper)/helper.NormSquared();
+      DoLog(1) && (Log() << Verbose(1) << "INFO: Factor s is " << s << "." << endl);
+      if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) {
+        DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl);
+        return false;
+      }
+      i++;
+    } while (i < 3);
+    DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl);
+    return true;
+  }
+  catch (MathException &excp) {
+    Log() << Verbose(1) << excp;
+    DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);
+    return false;
+  }
+}
+;
+
+/** Finds the point on the triangle to the point \a *x.
+ * We call Vector::GetIntersectionWithPlane() with \a * and the center of the triangle to receive an intersection point.
+ * Then we check the in-plane part (the part projected down onto plane). We check whether it crosses one of the
+ * boundary lines. If it does, we return this intersection as closest point, otherwise the projected point down.
+ * Thus we test if it's really on the plane and whether it's inside the triangle on the plane or not.
+ * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line
+ * given by the intersection and the third basepoint. Then, we check whether it's on the baseline (i.e. between
+ * the first two basepoints) or not.
+ * \param *x point
+ * \param *ClosestPoint desired closest point inside triangle to \a *x, is absolute vector
+ * \return Distance squared between \a *x and closest point inside triangle
+ */
+double BoundaryTriangleSet::GetClosestPointInsideTriangle(const Vector &x, Vector &ClosestPoint) const
+{
+  Info FunctionInfo(__func__);
+  Vector Direction;
+
+  // 1. get intersection with plane
+  DoLog(1) && (Log() << Verbose(1) << "INFO: Looking for closest point of triangle " << *this << " to " << x << "." << endl);
+  GetCenter(Direction);
+  try {
+    Line l = makeLineThrough(x, Direction);
+    ClosestPoint = Plane(NormalVector, (endpoints[0]->node->getPosition())).GetIntersection(l);
+  }
+  catch (MathException &excp) {
+    (ClosestPoint) = (x);
+  }
+
+  // 2. Calculate in plane part of line (x, intersection)
+  Vector InPlane = (x) - (ClosestPoint); // points from plane intersection to straight-down point
+  InPlane.ProjectOntoPlane(NormalVector);
+  InPlane += ClosestPoint;
+
+  DoLog(2) && (Log() << Verbose(2) << "INFO: Triangle is " << *this << "." << endl);
+  DoLog(2) && (Log() << Verbose(2) << "INFO: Line is from " << Direction << " to " << x << "." << endl);
+  DoLog(2) && (Log() << Verbose(2) << "INFO: In-plane part is " << InPlane << "." << endl);
+
+  // Calculate cross point between one baseline and the desired point such that distance is shortest
+  double ShortestDistance = -1.;
+  bool InsideFlag = false;
+  Vector CrossDirection[3];
+  Vector CrossPoint[3];
+  Vector helper;
+  for (int i = 0; i < 3; i++) {
+    // treat direction of line as normal of a (cut)plane and the desired point x as the plane offset, the intersect line with point
+    Direction = (endpoints[(i+1)%3]->node->getPosition()) - (endpoints[i%3]->node->getPosition());
+    // calculate intersection, line can never be parallel to Direction (is the same vector as PlaneNormal);
+    Line l = makeLineThrough((endpoints[i%3]->node->getPosition()), (endpoints[(i+1)%3]->node->getPosition()));
+    CrossPoint[i] = Plane(Direction, InPlane).GetIntersection(l);
+    CrossDirection[i] = CrossPoint[i] - InPlane;
+    CrossPoint[i] -= (endpoints[i%3]->node->getPosition());  // cross point was returned as absolute vector
+    const double s = CrossPoint[i].ScalarProduct(Direction)/Direction.NormSquared();
+    DoLog(2) && (Log() << Verbose(2) << "INFO: Factor s is " << s << "." << endl);
+    if ((s >= -MYEPSILON) && ((s-1.) <= MYEPSILON)) {
+          CrossPoint[i] += (endpoints[i%3]->node->getPosition());  // make cross point absolute again
+      DoLog(2) && (Log() << Verbose(2) << "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between " << endpoints[i % 3]->node->getPosition() << " and " << endpoints[(i + 1) % 3]->node->getPosition() << "." << endl);
+      const double distance = CrossPoint[i].DistanceSquared(x);
+      if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
+        ShortestDistance = distance;
+        (ClosestPoint) = CrossPoint[i];
+      }
+    } else
+      CrossPoint[i].Zero();
+  }
+  InsideFlag = true;
+  for (int i = 0; i < 3; i++) {
+    const double sign = CrossDirection[i].ScalarProduct(CrossDirection[(i + 1) % 3]);
+    const double othersign = CrossDirection[i].ScalarProduct(CrossDirection[(i + 2) % 3]);
+
+    if ((sign > -MYEPSILON) && (othersign > -MYEPSILON)) // have different sign
+      InsideFlag = false;
+  }
+  if (InsideFlag) {
+    (ClosestPoint) = InPlane;
+    ShortestDistance = InPlane.DistanceSquared(x);
+  } else { // also check endnodes
+    for (int i = 0; i < 3; i++) {
+      const double distance = x.DistanceSquared(endpoints[i]->node->getPosition());
+      if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
+        ShortestDistance = distance;
+        (ClosestPoint) = (endpoints[i]->node->getPosition());
+      }
+    }
+  }
+  DoLog(1) && (Log() << Verbose(1) << "INFO: Closest Point is " << ClosestPoint << " with shortest squared distance is " << ShortestDistance << "." << endl);
+  return ShortestDistance;
+}
+;
+
+/** Checks whether lines is any of the three boundary lines this triangle contains.
+ * \param *line line to test
+ * \return true - line is of the triangle, false - is not
+ */
+bool BoundaryTriangleSet::ContainsBoundaryLine(const BoundaryLineSet * const line) const
+{
+  Info FunctionInfo(__func__);
+  for (int i = 0; i < 3; i++)
+    if (line == lines[i])
+      return true;
+  return false;
+}
+;
+
+/** Checks whether point is any of the three endpoints this triangle contains.
+ * \param *point point to test
+ * \return true - point is of the triangle, false - is not
+ */
+bool BoundaryTriangleSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
+{
+  Info FunctionInfo(__func__);
+  for (int i = 0; i < 3; i++)
+    if (point == endpoints[i])
+      return true;
+  return false;
+}
+;
+
+/** Checks whether point is any of the three endpoints this triangle contains.
+ * \param *point TesselPoint to test
+ * \return true - point is of the triangle, false - is not
+ */
+bool BoundaryTriangleSet::ContainsBoundaryPoint(const TesselPoint * const point) const
+{
+  Info FunctionInfo(__func__);
+  for (int i = 0; i < 3; i++)
+    if (point == endpoints[i]->node)
+      return true;
+  return false;
+}
+;
+
+/** Checks whether three given \a *Points coincide with triangle's endpoints.
+ * \param *Points[3] pointer to BoundaryPointSet
+ * \return true - is the very triangle, false - is not
+ */
+bool BoundaryTriangleSet::IsPresentTupel(const BoundaryPointSet * const Points[3]) const
+{
+  Info FunctionInfo(__func__);
+  DoLog(1) && (Log() << Verbose(1) << "INFO: Checking " << Points[0] << "," << Points[1] << "," << Points[2] << " against " << endpoints[0] << "," << endpoints[1] << "," << endpoints[2] << "." << endl);
+  return (((endpoints[0] == Points[0]) || (endpoints[0] == Points[1]) || (endpoints[0] == Points[2])) && ((endpoints[1] == Points[0]) || (endpoints[1] == Points[1]) || (endpoints[1] == Points[2])) && ((endpoints[2] == Points[0]) || (endpoints[2] == Points[1]) || (endpoints[2] == Points[2])
+
+  ));
+}
+;
+
+/** Checks whether three given \a *Points coincide with triangle's endpoints.
+ * \param *Points[3] pointer to BoundaryPointSet
+ * \return true - is the very triangle, false - is not
+ */
+bool BoundaryTriangleSet::IsPresentTupel(const BoundaryTriangleSet * const T) const
+{
+  Info FunctionInfo(__func__);
+  return (((endpoints[0] == T->endpoints[0]) || (endpoints[0] == T->endpoints[1]) || (endpoints[0] == T->endpoints[2])) && ((endpoints[1] == T->endpoints[0]) || (endpoints[1] == T->endpoints[1]) || (endpoints[1] == T->endpoints[2])) && ((endpoints[2] == T->endpoints[0]) || (endpoints[2] == T->endpoints[1]) || (endpoints[2] == T->endpoints[2])
+
+  ));
+}
+;
+
+/** Returns the endpoint which is not contained in the given \a *line.
+ * \param *line baseline defining two endpoints
+ * \return pointer third endpoint or NULL if line does not belong to triangle.
+ */
+class BoundaryPointSet *BoundaryTriangleSet::GetThirdEndpoint(const BoundaryLineSet * const line) const
+{
+  Info FunctionInfo(__func__);
+  // sanity check
+  if (!ContainsBoundaryLine(line))
+    return NULL;
+  for (int i = 0; i < 3; i++)
+    if (!line->ContainsBoundaryPoint(endpoints[i]))
+      return endpoints[i];
+  // actually, that' impossible :)
+  return NULL;
+}
+;
+
+/** Returns the baseline which does not contain the given boundary point \a *point.
+ * \param *point endpoint which is neither endpoint of the desired line
+ * \return pointer to desired third baseline
+ */
+class BoundaryLineSet *BoundaryTriangleSet::GetThirdLine(const BoundaryPointSet * const point) const
+{
+  Info FunctionInfo(__func__);
+  // sanity check
+  if (!ContainsBoundaryPoint(point))
+    return NULL;
+  for (int i = 0; i < 3; i++)
+    if (!lines[i]->ContainsBoundaryPoint(point))
+      return lines[i];
+  // actually, that' impossible :)
+  return NULL;
+}
+;
+
+/** Calculates the center point of the triangle.
+ * Is third of the sum of all endpoints.
+ * \param *center central point on return.
+ */
+void BoundaryTriangleSet::GetCenter(Vector & center) const
+{
+  Info FunctionInfo(__func__);
+  center.Zero();
+  for (int i = 0; i < 3; i++)
+    (center) += (endpoints[i]->node->getPosition());
+  center.Scale(1. / 3.);
+  DoLog(1) && (Log() << Verbose(1) << "INFO: Center is at " << center << "." << endl);
+}
+
+/**
+ * gets the Plane defined by the three triangle Basepoints
+ */
+Plane BoundaryTriangleSet::getPlane() const{
+  ASSERT(endpoints[0] && endpoints[1] && endpoints[2], "Triangle not fully defined");
+
+  return Plane(endpoints[0]->node->getPosition(),
+               endpoints[1]->node->getPosition(),
+               endpoints[2]->node->getPosition());
+}
+
+Vector BoundaryTriangleSet::getEndpoint(int i) const{
+  ASSERT(i>=0 && i<3,"Index of Endpoint out of Range");
+
+  return endpoints[i]->node->getPosition();
+}
+
+string BoundaryTriangleSet::getEndpointName(int i) const{
+  ASSERT(i>=0 && i<3,"Index of Endpoint out of Range");
+
+  return endpoints[i]->node->getName();
+}
+
+/** output operator for BoundaryTriangleSet.
+ * \param &ost output stream
+ * \param &a boundary triangle
+ */
+ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a)
+{
+  ost << "[" << a.Nr << "|" << a.getEndpointName(0) << "," << a.getEndpointName(1) << "," << a.getEndpointName(2) << "]";
+  //  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << ","
+  //      << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]";
+  return ost;
+}
+;
+
Index: src/BoundaryTriangleSet.hpp
===================================================================
--- src/BoundaryTriangleSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/BoundaryTriangleSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,55 @@
+/*
+ * BoundaryTriangleSet.hpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+#ifndef BOUNDARYTRIANGLESET_HPP_
+#define BOUNDARYTRIANGLESET_HPP_
+
+#include "BoundaryMaps.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
+class BoundaryLineSet;
+class BoundaryPointSet;
+class BoundaryTriangleSet;
+class Plane;
+class TesselPoint;
+
+class BoundaryTriangleSet {
+  public:
+    BoundaryTriangleSet();
+    BoundaryTriangleSet(class BoundaryLineSet * const line[3], const int number);
+    ~BoundaryTriangleSet();
+
+    void GetNormalVector(const Vector &NormalVector);
+    void GetCenter(Vector &center) const;
+    bool GetIntersectionInsideTriangle(const Vector & MolCenter, const Vector &x, Vector &Intersection) const;
+    double GetClosestPointInsideTriangle(const Vector &x, Vector &ClosestPoint) const;
+    bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
+    bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
+    bool ContainsBoundaryPoint(const TesselPoint * const point) const;
+    class BoundaryPointSet *GetThirdEndpoint(const BoundaryLineSet * const line) const;
+    class BoundaryLineSet *GetThirdLine(const BoundaryPointSet * const point) const;
+    bool IsPresentTupel(const BoundaryPointSet * const Points[3]) const;
+    bool IsPresentTupel(const BoundaryTriangleSet * const T) const;
+
+    Plane getPlane() const;
+    Vector getEndpoint(int) const;
+    std::string getEndpointName(int) const;
+
+    class BoundaryPointSet *endpoints[3];
+    class BoundaryLineSet *lines[3];
+    Vector NormalVector;
+    Vector SphereCenter;
+    int Nr;
+
+  private:
+
+};
+
+std::ostream & operator << (std::ostream &ost, const BoundaryTriangleSet &a);
+
+
+#endif /* BOUNDARYTRIANGLESET_HPP_ */
Index: src/Box.cpp
===================================================================
--- src/Box.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Box.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * Box.cpp
@@ -6,5 +13,10 @@
  */
 
-//#include "Helpers/MemDebug.hpp"
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
 
 #include "Box.hpp"
@@ -14,7 +26,9 @@
 #include <cstdlib>
 
-#include "Matrix.hpp"
-#include "vector.hpp"
-#include "Plane.hpp"
+#include "LinearAlgebra/Matrix.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Plane.hpp"
+#include "Shapes/BaseShapes.hpp"
+#include "Shapes/ShapeOps.hpp"
 
 #include "Helpers/Assert.hpp"
@@ -206,4 +220,8 @@
 }
 
+Shape Box::getShape() const{
+  return transform(Cuboid(Vector(0,0,0),Vector(1,1,1)),(*M));
+}
+
 const Box::Conditions_t Box::getConditions(){
   return conditions;
Index: src/Box.hpp
===================================================================
--- src/Box.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Box.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,9 +11,10 @@
 class Matrix;
 class Vector;
+class Shape;
 class Plane;
 
 #include <list>
 #include <vector>
-#include "VectorSet.hpp"
+#include "LinearAlgebra/VectorSet.hpp"
 
 /**
@@ -99,4 +100,5 @@
   double periodicDistance(const Vector &point1,const Vector &point2) const;
 
+  Shape getShape() const;
   const Conditions_t getConditions();
   void setCondition(int,BoundaryCondition_t);
Index: src/CandidateForTesselation.cpp
===================================================================
--- src/CandidateForTesselation.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/CandidateForTesselation.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,189 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * CandidateForTesselation.cpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "CandidateForTesselation.hpp"
+
+#include <iostream>
+#include <iomanip>
+
+#include "BoundaryLineSet.hpp"
+#include "BoundaryPointSet.hpp"
+#include "TesselPoint.hpp"
+
+#include "Helpers/Assert.hpp"
+#include "Helpers/Info.hpp"
+//#include "Line.hpp"
+#include "linkedcell.hpp"
+#include "Helpers/Log.hpp"
+//#include "Plane.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Verbose.hpp"
+
+using namespace std;
+
+
+const double CandidateForTesselation::HULLEPSILON = 1e-9;
+
+
+/** Constructor of class CandidateForTesselation.
+ */
+CandidateForTesselation::CandidateForTesselation(BoundaryLineSet* line) :
+  BaseLine(line),
+  ThirdPoint(NULL),
+  T(NULL),
+  ShortestAngle(2. * M_PI),
+  OtherShortestAngle(2. * M_PI)
+{
+  Info FunctionInfo(__func__);
+}
+;
+
+/** Constructor of class CandidateForTesselation.
+ */
+CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, BoundaryPointSet* point, const Vector &OptCandidateCenter, const Vector &OtherOptCandidateCenter) :
+  BaseLine(line),
+  ThirdPoint(point),
+  T(NULL),
+  OptCenter(OptCandidateCenter),
+  OtherOptCenter(OtherOptCandidateCenter),
+  ShortestAngle(2. * M_PI),
+  OtherShortestAngle(2. * M_PI)
+{
+  Info FunctionInfo(__func__);
+};
+
+
+/** Destructor for class CandidateForTesselation.
+ */
+CandidateForTesselation::~CandidateForTesselation()
+{
+}
+;
+
+/** Checks validity of a given sphere of a candidate line.
+ * Sphere must touch all candidates and the baseline endpoints and there must be no other atoms inside.
+ * \param RADIUS radius of sphere
+ * \param *LC LinkedCell structure with other atoms
+ * \return true - sphere is valid, false - sphere contains other points
+ */
+bool CandidateForTesselation::CheckValidity(const double RADIUS, const LinkedCell *LC) const
+{
+  Info FunctionInfo(__func__);
+
+  const double radiusSquared = RADIUS * RADIUS;
+  list<const Vector *> VectorList;
+  VectorList.push_back(&OptCenter);
+  //VectorList.push_back(&OtherOptCenter);  // don't check the other (wrong) center
+
+  if (!pointlist.empty())
+    DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains candidate list and baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl);
+  else
+    DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere with no candidates contains baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl);
+  // check baseline for OptCenter and OtherOptCenter being on sphere's surface
+  for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
+    for (int i = 0; i < 2; i++) {
+      const double distance = fabs((*VRunner)->DistanceSquared(BaseLine->endpoints[i]->node->getPosition()) - radiusSquared);
+      if (distance > HULLEPSILON) {
+        DoeLog(1) && (eLog() << Verbose(1) << "Endpoint " << *BaseLine->endpoints[i] << " is out of sphere at " << *(*VRunner) << " by " << distance << "." << endl);
+        return false;
+      }
+    }
+  }
+
+  // check Candidates for OptCenter and OtherOptCenter being on sphere's surface
+  for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) {
+    const TesselPoint *Walker = *Runner;
+    for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
+      const double distance = fabs((*VRunner)->DistanceSquared(Walker->getPosition()) - radiusSquared);
+      if (distance > HULLEPSILON) {
+        DoeLog(1) && (eLog() << Verbose(1) << "Candidate " << *Walker << " is out of sphere at " << *(*VRunner) << " by " << distance << "." << endl);
+        return false;
+      } else {
+        DoLog(1) && (Log() << Verbose(1) << "Candidate " << *Walker << " is inside by " << distance << "." << endl);
+      }
+    }
+  }
+
+  DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains no others points ..." << endl);
+  bool flag = true;
+  for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
+    // get all points inside the sphere
+    TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, (*VRunner));
+
+    DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << (*VRunner) << ":" << endl);
+    for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
+      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->distance(*(*VRunner)) << "." << endl);
+
+    // remove baseline's endpoints and candidates
+    for (int i = 0; i < 2; i++) {
+      DoLog(1) && (Log() << Verbose(1) << "INFO: removing baseline tesselpoint " << *BaseLine->endpoints[i]->node << "." << endl);
+      ListofPoints->remove(BaseLine->endpoints[i]->node);
+    }
+    for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) {
+      DoLog(1) && (Log() << Verbose(1) << "INFO: removing candidate tesselpoint " << *(*Runner) << "." << endl);
+      ListofPoints->remove(*Runner);
+    }
+    if (!ListofPoints->empty()) {
+      DoeLog(1) && (eLog() << Verbose(1) << "CheckValidity: There are still " << ListofPoints->size() << " points inside the sphere." << endl);
+      flag = false;
+      DoeLog(1) && (eLog() << Verbose(1) << "External atoms inside of sphere at " << *(*VRunner) << ":" << endl);
+      for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
+        DoeLog(1) && (eLog() << Verbose(1) << "  " << *(*Runner) << " at distance " << setprecision(13) << (*Runner)->distance(*(*VRunner)) << setprecision(6) << "." << endl);
+
+      // check with animate_sphere.tcl VMD script
+      if (ThirdPoint != NULL) {
+        DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);
+      } else {
+        DoeLog(1) && (eLog() << Verbose(1) << "Check by: ... missing third point ..." << endl);
+        DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);
+      }
+    }
+    delete (ListofPoints);
+
+  }
+  return flag;
+}
+;
+
+/** output operator for CandidateForTesselation.
+ * \param &ost output stream
+ * \param &a boundary line
+ */
+ostream & operator <<(ostream &ost, const CandidateForTesselation &a)
+{
+  ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->getName() << "," << a.BaseLine->endpoints[1]->node->getName() << "] with ";
+  if (a.pointlist.empty())
+    ost << "no candidate.";
+  else {
+    ost << "candidate";
+    if (a.pointlist.size() != 1)
+      ost << "s ";
+    else
+      ost << " ";
+    for (TesselPointList::const_iterator Runner = a.pointlist.begin(); Runner != a.pointlist.end(); Runner++)
+      ost << *(*Runner) << " ";
+    ost << " at angle " << (a.ShortestAngle) << ".";
+  }
+
+  return ost;
+}
+;
+
Index: src/CandidateForTesselation.hpp
===================================================================
--- src/CandidateForTesselation.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/CandidateForTesselation.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,48 @@
+/*
+ * CandidateForTesselation.hpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+#ifndef CANDIDATEFORTESSELATION_HPP_
+#define CANDIDATEFORTESSELATION_HPP_
+
+#include "BoundaryMaps.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
+#include <list>
+#include <set>
+
+class BoundaryLineSet;
+class BoundaryPointSet;
+class BoundaryTriangleSet;
+class LinkedCell;
+class TesselPoint;
+
+class CandidateForTesselation {
+  public :
+  CandidateForTesselation(BoundaryLineSet* currentBaseLine);
+  CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, BoundaryPointSet *point, const Vector &OptCandidateCenter, const Vector &OtherOptCandidateCenter);
+  ~CandidateForTesselation();
+
+  bool CheckValidity(const double RADIUS, const class LinkedCell *LC) const;
+
+  TesselPointList pointlist;
+  const BoundaryLineSet * BaseLine;
+  const BoundaryPointSet * ThirdPoint;
+  const BoundaryTriangleSet *T;
+  Vector OldCenter;
+  Vector OptCenter;
+  Vector OtherOptCenter;
+  double ShortestAngle;
+  double OtherShortestAngle;
+
+  private:
+  static const double HULLEPSILON; //!< TODO: Get rid of HULLEPSILON, points to numerical instabilities
+};
+
+std::ostream & operator <<(std::ostream &ost, const  CandidateForTesselation &a);
+
+
+#endif /* CANDIDATEFORTESSELATION_HPP_ */
Index: src/CommandLineParser.cpp
===================================================================
--- src/CommandLineParser.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/CommandLineParser.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * CommandLineParser.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -15,6 +27,6 @@
 #include "Patterns/Singleton_impl.hpp"
 #include "CommandLineParser.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 
 using namespace std;
Index: src/CommandLineParser.hpp
===================================================================
--- src/CommandLineParser.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/CommandLineParser.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -60,5 +60,5 @@
  *     #include "Actions/Cmd/VersionAction.hpp"
  *   - Add an instance of your class to the specific populater-function in
- *     UIElements/CommandLineWindow.cpp, e.g. for the above Cmd action, add to populateCmdActions()
+ *     UIElements/CommandLineWindow.cpp, e.g. for the above Cmd action, add to populateCommandActions()
  *     add new CommandLineVersionAction().
  *     This will automatically register in the ActionRegistry.
Index: src/ConfigFileBuffer.cpp
===================================================================
--- src/ConfigFileBuffer.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/ConfigFileBuffer.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ConfigFileBuffer.cpp
@@ -6,9 +13,16 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
 #include "ConfigFileBuffer.hpp"
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 #include "lists.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "World.hpp"
 
@@ -51,5 +65,9 @@
 /** Constructor for ConfigFileBuffer class.
  */
-ConfigFileBuffer::ConfigFileBuffer() : buffer(NULL), LineMapping(NULL), CurrentLine(0), NoLines(0)
+ConfigFileBuffer::ConfigFileBuffer() :
+    buffer(NULL),
+    LineMapping(NULL),
+    CurrentLine(0),
+    NoLines(0)
 {
 };
@@ -58,5 +76,9 @@
  * \param *filename file name
  */
-ConfigFileBuffer::ConfigFileBuffer(const char * const filename) : buffer(NULL), LineMapping(NULL), CurrentLine(0), NoLines(0)
+ConfigFileBuffer::ConfigFileBuffer(const char * const filename) :
+    buffer(NULL),
+    LineMapping(NULL),
+    CurrentLine(0),
+    NoLines(0)
 {
   InitFileBuffer(filename);
Index: src/Descriptors/AtomDescriptor.cpp
===================================================================
--- src/Descriptors/AtomDescriptor.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Descriptors/AtomDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AtomDescriptor.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Descriptors/AtomIdDescriptor.cpp
===================================================================
--- src/Descriptors/AtomIdDescriptor.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Descriptors/AtomIdDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AtomIdDescriptor.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Descriptors/AtomSelectionDescriptor.cpp
===================================================================
--- src/Descriptors/AtomSelectionDescriptor.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Descriptors/AtomSelectionDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AtomSelectionDescriptor.cpp
@@ -6,8 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
 #include "Descriptors/AtomSelectionDescriptor.hpp"
 #include "Descriptors/AtomSelectionDescriptor_impl.hpp"
 
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 
 AtomSelectionDescriptor_impl::AtomSelectionDescriptor_impl(){}
Index: src/Descriptors/AtomShapeDescriptor.cpp
===================================================================
--- src/Descriptors/AtomShapeDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Descriptors/AtomShapeDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,40 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * AtomShapeDescriptor.cpp
+ *
+ *  Created on: Jul 22, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "AtomShapeDescriptor.hpp"
+#include "AtomShapeDescriptor_impl.hpp"
+
+#include "atom.hpp"
+
+AtomShapeDescriptor_impl::AtomShapeDescriptor_impl(const Shape &_shape) :
+  shape(_shape)
+{}
+
+AtomShapeDescriptor_impl::~AtomShapeDescriptor_impl(){}
+
+bool AtomShapeDescriptor_impl::predicate(std::pair<atomId_t,atom*> atom){
+  return shape.isInside(atom.second->getPosition());
+}
+
+
+AtomDescriptor AtomByShape(const Shape &shape){
+  return AtomDescriptor(AtomDescriptor::impl_ptr(new AtomShapeDescriptor_impl(shape)));
+}
Index: src/Descriptors/AtomShapeDescriptor.hpp
===================================================================
--- src/Descriptors/AtomShapeDescriptor.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Descriptors/AtomShapeDescriptor.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,18 @@
+/*
+ * AtomShapeDescriptor.hpp
+ *
+ *  Created on: Jul 22, 2010
+ *      Author: crueger
+ */
+
+#ifndef ATOMSHAPEDESCRIPTOR_HPP_
+#define ATOMSHAPEDESCRIPTOR_HPP_
+
+#include "defs.hpp"
+#include "Descriptors/AtomDescriptor.hpp"
+
+class Shape;
+
+AtomDescriptor AtomByShape(const Shape &shape);
+
+#endif /* ATOMSHAPEDESCRIPTOR_HPP_ */
Index: src/Descriptors/AtomShapeDescriptor_impl.hpp
===================================================================
--- src/Descriptors/AtomShapeDescriptor_impl.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Descriptors/AtomShapeDescriptor_impl.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,26 @@
+/*
+ * AtomShapeDescriptor_impl.hpp
+ *
+ *  Created on: Jul 22, 2010
+ *      Author: crueger
+ */
+
+#ifndef ATOMSHAPEDESCRIPTOR_IMPL_HPP_
+#define ATOMSHAPEDESCRIPTOR_IMPL_HPP_
+
+#include "Descriptors/AtomDescriptor_impl.hpp"
+
+#include "Shapes/Shape.hpp"
+
+class AtomShapeDescriptor_impl : public AtomDescriptor_impl
+{
+public:
+  AtomShapeDescriptor_impl(const Shape&);
+  virtual  ~AtomShapeDescriptor_impl();
+
+  bool predicate(std::pair<atomId_t,atom*> atom);
+private:
+  Shape shape;
+};
+
+#endif /* ATOMSHAPEDESCRIPTOR_IMPL_HPP_ */
Index: src/Descriptors/AtomTypeDescriptor.cpp
===================================================================
--- src/Descriptors/AtomTypeDescriptor.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Descriptors/AtomTypeDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AtomTypeDescriptor_impl.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Descriptors/MoleculeDescriptor.cpp
===================================================================
--- src/Descriptors/MoleculeDescriptor.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Descriptors/MoleculeDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MoleculeDescriptor.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Descriptors/MoleculeFormulaDescriptor.cpp
===================================================================
--- src/Descriptors/MoleculeFormulaDescriptor.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Descriptors/MoleculeFormulaDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MoleculeFormulaDescriptor.cpp
@@ -5,4 +12,11 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
 
 #include "MoleculeFormulaDescriptor.hpp"
Index: src/Descriptors/MoleculeIdDescriptor.cpp
===================================================================
--- src/Descriptors/MoleculeIdDescriptor.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Descriptors/MoleculeIdDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MoleculeIdDescriptor.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Descriptors/MoleculeNameDescriptor.cpp
===================================================================
--- src/Descriptors/MoleculeNameDescriptor.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Descriptors/MoleculeNameDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MoleculeNameDescriptor.cpp
@@ -5,4 +12,11 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
 
 #include "MoleculeNameDescriptor.hpp"
Index: src/Descriptors/MoleculePtrDescriptor.cpp
===================================================================
--- src/Descriptors/MoleculePtrDescriptor.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Descriptors/MoleculePtrDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MoleculePtrDescriptor.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Descriptors/MoleculeSelectionDescriptor.cpp
===================================================================
--- src/Descriptors/MoleculeSelectionDescriptor.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Descriptors/MoleculeSelectionDescriptor.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MoleculeSelectionDescriptor.cpp
@@ -6,8 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
 #include "Descriptors/MoleculeSelectionDescriptor.hpp"
 #include "Descriptors/MoleculeSelectionDescriptor_impl.hpp"
 
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 
 MoleculeSelectionDescriptor_impl::MoleculeSelectionDescriptor_impl(){}
Index: src/Descriptors/SelectiveIterator_impl.hpp
===================================================================
--- src/Descriptors/SelectiveIterator_impl.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Descriptors/SelectiveIterator_impl.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -9,5 +9,5 @@
 #define SELECTIVEITERATOR_IMPL_HPP_
 
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 
 template<class _Target,
Index: src/Exceptions/CustomException.cpp
===================================================================
--- src/Exceptions/CustomException.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Exceptions/CustomException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * CustomException.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Exceptions/IllegalTypeException.cpp
===================================================================
--- src/Exceptions/IllegalTypeException.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Exceptions/IllegalTypeException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * IllegalTypeException.cpp
@@ -5,4 +12,11 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
 
 #include "IllegalTypeException.hpp"
Index: src/Exceptions/LinearDependenceException.cpp
===================================================================
--- src/Exceptions/LinearDependenceException.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Exceptions/LinearDependenceException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * LinearDependenceException.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Exceptions/Makefile.am
===================================================================
--- src/Exceptions/Makefile.am	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Exceptions/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -15,7 +15,10 @@
   MissingValueException.cpp \
   NotInvertibleException.cpp \
+  NotOnSurfaceException.cpp \
+  ShapeException.cpp \
   ParseError.cpp \
   SkewException.cpp \
   ZeroVectorException.cpp
+	
 				  
 EXCEPTIONHEADER = \
@@ -26,4 +29,6 @@
   MissingValueException.hpp \
   NotInvertibleException.hpp \
+  NotInvertibleException.hpp \
+  NotOnSurfaceException.hpp \
   ParseError.hpp \
   SkewException.hpp \
@@ -72,2 +77,9 @@
 pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc
 
+unity.cpp:
+	echo "" >  unity.cpp; \
+	list='$(EXCEPTIONSOURCE)'; for file in $$list; do \
+	  echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
+	done;
+	
+MOSTLYCLEANFILES = unity.cpp
Index: src/Exceptions/MathException.cpp
===================================================================
--- src/Exceptions/MathException.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Exceptions/MathException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MathException.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Exceptions/MissingValueException.cpp
===================================================================
--- src/Exceptions/MissingValueException.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Exceptions/MissingValueException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MissingValueException.cpp
@@ -5,4 +12,11 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
 
 #include "MissingValueException.hpp"
Index: src/Exceptions/NotInvertibleException.cpp
===================================================================
--- src/Exceptions/NotInvertibleException.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Exceptions/NotInvertibleException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * NotInvertibleException.cpp
@@ -5,4 +12,11 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
 
 #include "NotInvertibleException.hpp"
Index: src/Exceptions/NotOnSurfaceException.cpp
===================================================================
--- src/Exceptions/NotOnSurfaceException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Exceptions/NotOnSurfaceException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,21 @@
+/*
+ * NotOnSurfaceException.cpp
+ *
+ *  Created on: Jul 14, 2010
+ *      Author: crueger
+ */
+
+#include "NotOnSurfaceException.hpp"
+
+using namespace std;
+
+NotOnSurfaceException::NotOnSurfaceException(string _file, int _line) :
+  ShapeException(_file,_line)
+{}
+
+NotOnSurfaceException::~NotOnSurfaceException() throw ()
+{}
+
+const char* NotOnSurfaceException::what() const throw(){
+  return "Given point did not lie on surface of Shape";
+}
Index: src/Exceptions/NotOnSurfaceException.hpp
===================================================================
--- src/Exceptions/NotOnSurfaceException.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Exceptions/NotOnSurfaceException.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,22 @@
+/*
+ * NotOnSurfaceException.hpp
+ *
+ *  Created on: Jul 14, 2010
+ *      Author: crueger
+ */
+
+#ifndef NOTONSURFACEEXCEPTION_HPP_
+#define NOTONSURFACEEXCEPTION_HPP_
+
+#include "Exceptions/ShapeException.hpp"
+
+class NotOnSurfaceException : public ShapeException
+{
+public:
+  NotOnSurfaceException(std::string _file, int _line);
+  virtual ~NotOnSurfaceException() throw();
+
+  virtual const char* what() const throw();
+};
+
+#endif /* NOTONSURFACEEXCEPTION_HPP_ */
Index: src/Exceptions/ParseError.cpp
===================================================================
--- src/Exceptions/ParseError.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Exceptions/ParseError.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ParseError.cpp
@@ -5,4 +12,11 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
 
 #include "ParseError.hpp"
Index: src/Exceptions/ShapeException.cpp
===================================================================
--- src/Exceptions/ShapeException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Exceptions/ShapeException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,15 @@
+/*
+ * ShapeException.cpp
+ *
+ *  Created on: Jul 14, 2010
+ *      Author: crueger
+ */
+
+#include "ShapeException.hpp"
+
+ShapeException::ShapeException(std::string file, int line) :
+  CustomException(file,line)
+{}
+
+ShapeException::~ShapeException() throw ()
+{}
Index: src/Exceptions/ShapeException.hpp
===================================================================
--- src/Exceptions/ShapeException.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Exceptions/ShapeException.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,20 @@
+/*
+ * ShapeException.hpp
+ *
+ *  Created on: Jul 14, 2010
+ *      Author: crueger
+ */
+
+#ifndef SHAPEEXCEPTION_HPP_
+#define SHAPEEXCEPTION_HPP_
+
+#include "Exceptions/CustomException.hpp"
+
+class ShapeException : public CustomException
+{
+public:
+  ShapeException(std::string file, int line);
+  virtual ~ShapeException() throw();
+};
+
+#endif /* SHAPEEXCEPTION_HPP_ */
Index: src/Exceptions/SkewException.cpp
===================================================================
--- src/Exceptions/SkewException.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Exceptions/SkewException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SkewException.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Exceptions/ZeroVectorException.cpp
===================================================================
--- src/Exceptions/ZeroVectorException.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Exceptions/ZeroVectorException.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ZeroVectorException.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/Formula.cpp
===================================================================
--- src/Formula.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Formula.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * Formula.cpp
@@ -6,4 +13,11 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
 #include "Formula.hpp"
 
@@ -47,5 +61,5 @@
   for(const_iterator iter=end();iter!=begin();){
     --iter;
-    sstr << (*iter).first->symbol;
+    sstr << (*iter).first->getSymbol();
     if((*iter).second>1)
       sstr << (*iter).second;
@@ -55,12 +69,44 @@
 
 void Formula::fromString(const std::string &formula) throw(ParseError){
+  // make this transactional, in case an error is thrown
+  Formula res;
+  string::const_iterator begin = formula.begin();
+  string::const_iterator end = formula.end();
+  res.parseFromString(begin,end,static_cast<char>(0));
+  (*this)=res;
+}
+
+int Formula::parseMaybeNumber(string::const_iterator &it,string::const_iterator &end) throw(ParseError){
+  static const range<char> Numbers = makeRange('0',static_cast<char>('9'+1));
+  int count = 0;
+  while(it!=end && Numbers.isInRange(*it))
+    count = (count*10) + ((*it++)-Numbers.first);
+  // one is implicit
+  count = (count!=0)?count:1;
+  return count;
+}
+
+void Formula::parseFromString(string::const_iterator &it,string::const_iterator &end,char delimiter) throw(ParseError){
   // some constants needed for parsing... Assumes ASCII, change if other encodings are used
   static const range<char> CapitalLetters = makeRange('A',static_cast<char>('Z'+1));
   static const range<char> SmallLetters = makeRange('a',static_cast<char>('z'+1));
-  static const range<char> Numbers = makeRange('0',static_cast<char>('9'+1));
+  map<char,char> delimiters;
+  delimiters['('] = ')';
+  delimiters['['] = ']';
   // clean the formula
   clear();
-  string::const_iterator end = formula.end(); // will be used frequently
-  for(string::const_iterator it=formula.begin();it!=end;){
+  for(/*send from above*/;it!=end && *it!=delimiter;/*updated in loop*/){
+    // we might have a sub formula
+    if(delimiters.count(*it)){
+      Formula sub;
+      char nextdelim=delimiters[*it];
+      sub.parseFromString(++it,end,nextdelim);
+      if(!sub.getElementCount()){
+        throw(ParseError(__FILE__,__LINE__));
+      }
+      int count = parseMaybeNumber(++it,end);
+      addFormula(sub,count);
+      continue;
+    }
     string shorthand;
     // Atom names start with a capital letter
@@ -71,10 +117,5 @@
     while(it!=end && SmallLetters.isInRange(*it))
       shorthand+=(*it++);
-    // now we can count the occurences
-    int count = 0;
-    while(it!=end && Numbers.isInRange(*it))
-      count = (count*10) + ((*it++)-Numbers.first);
-    // one is implicit
-    count = (count!=0)?count:1;
+    int count = parseMaybeNumber(it,end);
     // test if the shorthand exists
     if(!World::getInstance().getPeriode()->FindElement(shorthand))
@@ -83,4 +124,7 @@
     addElements(shorthand,count);
   }
+  if(it==end && delimiter!=0){
+    throw(ParseError(__FILE__,__LINE__));
+  }
 }
 
@@ -93,5 +137,4 @@
     *output << "#Ion_TypeNr.\tAmount\tZ\tRGauss\tL_Max(PP)L_Loc(PP)IonMass\t# chemical name, symbol" << endl;
     for(const_iterator iter=begin(); iter!=end();++iter){
-      (*iter).first->No = No;
       result = result && (*iter).first->Checkout(output, No++, (*iter).second);
     }
@@ -117,5 +160,5 @@
 
 bool Formula::hasElement(const string &shorthand) const{
-  element * element = World::getInstance().getPeriode()->FindElement(shorthand);
+  const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
   return hasElement(element);
 }
@@ -138,5 +181,5 @@
 
 void Formula::operator+=(const string &shorthand){
-  element * element = World::getInstance().getPeriode()->FindElement(shorthand);
+  const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
   operator+=(element);
 }
@@ -169,5 +212,5 @@
 
 void Formula::operator-=(const string &shorthand){
-  element * element = World::getInstance().getPeriode()->FindElement(shorthand);
+  const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
   operator-=(element);
 }
@@ -191,6 +234,20 @@
 
 void Formula::addElements(const string &shorthand,unsigned int count){
-  element * element = World::getInstance().getPeriode()->FindElement(shorthand);
+  const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
   addElements(element,count);
+}
+
+void Formula::addFormula(const Formula &formula,unsigned int n){
+  for(Formula::const_iterator iter=formula.begin();iter!=formula.end();++iter){
+    this->addElements(iter->first,iter->second*n);
+  }
+}
+
+enumeration<Formula::key_type> Formula::enumerateElements() const{
+  enumeration<key_type> res(1);
+  for(Formula::const_iterator iter=begin();iter!=end();++iter){
+    res.add(iter->first);
+  }
+  return res;
 }
 
@@ -209,5 +266,5 @@
 
 const unsigned int Formula::operator[](string shorthand) const{
-  element * element = World::getInstance().getPeriode()->FindElement(shorthand);
+  const element * element = World::getInstance().getPeriode()->FindElement(shorthand);
   return operator[](element);
 }
@@ -337,5 +394,5 @@
 result_type
 Formula::_iterator<result_type>::operator*(){
-  element *element = World::getInstance().getPeriode()->FindElement(pos+1);
+  const element *element = World::getInstance().getPeriode()->FindElement(pos+1);
   ASSERT(element,"Element with position of iterator not found");
   return make_pair(element,(*set)[pos]);
@@ -347,5 +404,5 @@
   // no one can keep this value around, so a static is ok to avoid temporaries
   static value_type value=make_pair(reinterpret_cast<element*>(0),0); // no default constructor for std::pair
-  element *element = World::getInstance().getPeriode()->FindElement(pos+1);
+  const element *element = World::getInstance().getPeriode()->FindElement(pos+1);
   ASSERT(element,"Element with position of iterator not found");
   value = make_pair(element,(*set)[pos]);
Index: src/Formula.hpp
===================================================================
--- src/Formula.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Formula.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -16,4 +16,5 @@
 
 #include "types.hpp"
+#include "Helpers/helpers.hpp"
 
 class element;
@@ -22,5 +23,5 @@
 {
 public:
-  typedef element*                                      key_type;
+  typedef const element*                                key_type;
   typedef unsigned int                                  mapped_type;
   typedef std::pair<key_type, mapped_type>              value_type;
@@ -65,23 +66,27 @@
 
   unsigned int getElementCount() const;
-  bool hasElement(const element*)       const;
+  bool hasElement(key_type)             const;
   bool hasElement(atomicNumber_t)       const;
   bool hasElement(const std::string&)   const;
 
-  void operator+=(const element*);
+  void operator+=(key_type);
   void operator+=(atomicNumber_t);
   void operator+=(const std::string&);
 
-  void operator-=(const element*);
+  void operator-=(key_type);
   void operator-=(atomicNumber_t);
   void operator-=(const std::string&);
 
-  void addElements(const element*,unsigned int);
+  void addElements(key_type,unsigned int);
   void addElements(atomicNumber_t,unsigned int);
   void addElements(const std::string&,unsigned int);
 
+  void addFormula(const Formula&,unsigned int);
+
+  enumeration<key_type> enumerateElements() const;
+
   // only const versions, because someone might try to increment a previously
   // not set element
-  const unsigned int operator[](const element*) const;
+  const unsigned int operator[](key_type) const;
   const unsigned int operator[](atomicNumber_t) const;
   const unsigned int operator[](std::string)    const;
@@ -98,4 +103,6 @@
 
 private:
+  void parseFromString(std::string::const_iterator&,std::string::const_iterator&,char) throw(ParseError);
+  int parseMaybeNumber(std::string::const_iterator &it,std::string::const_iterator &end) throw(ParseError);
   // this contains all counts of elements in the formula
   // the size of the actual structure might be used in comparisons
Index: src/Helpers/Assert.cpp
===================================================================
--- src/Helpers/Assert.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Helpers/Assert.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * Assert.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -46,55 +58,125 @@
 }
 
-using namespace Assert;
-
 #ifndef NDEBUG
 
-Action _my_assert::defaultAction = Ask;
-std::vector<Assert::hook_t> _my_assert::hooks;
-
-std::map<std::string,bool> _wrapper::ignores;
-const char* _wrapper::message_ptr = "source pointer did not point to object of desired type";
-const char* _wrapper::message_ref = "source reference did not contain object of desired type";
-
-
-bool _my_assert::check(const bool res,
-                       const char* condition,
-                       const char* message,
-                       const char* filename,
-                       const int line,
-                       bool& ignore)
+#ifdef __GNUC__
+#include <cstdlib>
+#include <execinfo.h>
+#include <cxxabi.h>
+#endif
+
+Assert::Action Assert::_my_assert::defaultAction = Ask;
+std::vector<Assert::hook_t> Assert::_my_assert::hooks;
+
+std::map<std::string,bool> Assert::_wrapper::ignores;
+const char* Assert::_wrapper::message_ptr = "source pointer did not point to object of desired type";
+const char* Assert::_wrapper::message_ref = "source reference did not contain object of desired type";
+
+bool Assert::_my_assert::check(const char* condition,
+                               const char* message,
+                               const char* filename,
+                               const int line,
+                               bool& ignore)
 {
-  if(!res){
-    cout << "Assertion \"" << condition << "\" failed in file " << filename << " at line " << line << endl;
-    cout << "Assertion Message: " << message << std::endl;
-    while(true){
-      char choice;
-      if(defaultAction==Ask) {
-        cout << "Please choose: (a)bort, (t)hrow execption, (i)gnore, al(w)ays ignore" << endl;
-        cin >> choice;
+  cout << "Assertion \"" << condition << "\" failed in file " << filename << " at line " << line << endl;
+  cout << "Assertion Message: " << message << std::endl;
+  while(true){
+    char choice;
+    if(defaultAction==Assert::Ask) {
+#ifdef __GNUC__
+      cout << "Please choose: (a)bort, (t)hrow execption, show (b)actrace, (i)gnore, al(w)ays ignore" << endl;
+#else
+      cout << "Please choose: (a)bort, (t)hrow execption, (i)gnore, al(w)ays ignore" << endl;
+#endif /* __GNUC__ */
+      cin >> choice;
+    }
+    else{
+      choice = ActionKeys[defaultAction];
+    }
+    switch(choice){
+      case 'a':
+        return true;
+        break;
+      case 't':
+        throw AssertionFailure(condition,filename,line,message);
+        break;
+#ifdef __GNUC__
+      case 'b':
+        Assert::_my_assert::backtrace(filename,line);
+       break;
+#endif /* __GNUC__ */
+      case 'w':
+        ignore = true;
+        // fallthrough
+      case 'i':
+        return false;
+        break;
+    }
+  }
+  return false;
+}
+
+#ifdef __GNUC__
+void Assert::_my_assert::backtrace(const char *file, int line){
+  const size_t max_depth = 100;
+  void* stack_addrs[max_depth];
+  size_t stack_depth;
+  char **stack_strings=0;
+  const char *func_name=0;
+  size_t sz = 64;
+
+  // get the backtrace
+  stack_depth   = ::backtrace(stack_addrs,max_depth);
+  stack_strings = backtrace_symbols(stack_addrs, stack_depth);
+  // used later for demangling
+  // reserved here, so we can free it unconditionally
+  char *dm_function = static_cast<char*>(malloc(sz));
+  if(!dm_function){
+    // malloc failed... we are out of luck
+    cout << "cannot provide stack trace due to exhausted memory" << endl;
+    return;
+  }
+
+  cout << "Backtrace from  " << file << "@" << line << ":" << endl;
+
+  // i=2 because we don't want this function, nor the assertion handler
+  for(unsigned int i=2;i<stack_depth-2;++i){
+    // find the mangled function name
+    char *begin = stack_strings[i];
+    // function name starts with a (
+    while(*begin && *begin!='(') ++begin;
+    char *end=begin;
+    while(*end && *end!='+') ++end;
+
+    // see if we found our function name
+    if(*begin && *end){
+      *begin++ = 0;
+      *end = 0;
+      // use the C++ demangler
+
+      int status;
+      char *func_ret = abi::__cxa_demangle(begin, dm_function, &sz, &status);
+      if(func_ret){
+        // abi might have realloced...
+        dm_function = func_ret;
+        func_name = dm_function;
       }
       else{
-        choice = ActionKeys[defaultAction];
+        // demangling failed... get the function name without demangling
+        func_name = begin;
       }
-      switch(choice){
-        case 'a':
-          return true;
-          break;
-        case 't':
-          throw AssertionFailure(condition,filename,line,message);
-          break;
-        case 'w':
-          ignore = true;
-          // fallthrough
-        case 'i':
-          return false;
-          break;
-      }
-    }
-  }
-  return false;
-}
-
-void _my_assert::doHooks(){
+    }
+    else{
+      // function name not found... get the whole line
+      func_name = stack_strings[i];
+    }
+    cout << func_name << endl;
+  }
+  free(dm_function);
+  free(stack_strings); // malloc()ed by backtrace_symbols
+}
+#endif /* __GNUC__ */
+
+void Assert::_my_assert::doHooks(){
   for(vector<hook_t>::reverse_iterator iter = hooks.rbegin(); iter!=hooks.rend(); ++iter ){
     (*iter)();
@@ -102,9 +184,9 @@
 }
 
-void _my_assert::addHook(hook_t hook){
+void Assert::_my_assert::addHook(hook_t hook){
   hooks.push_back(hook);
 }
 
-void _my_assert::removeHook(Assert::hook_t hook){
+void Assert::_my_assert::removeHook(Assert::hook_t hook){
   for(vector<hook_t>::iterator iter = hooks.begin(); iter!=hooks.end();){
     if((*iter)==hook){
@@ -117,11 +199,11 @@
 }
 
-void _my_assert::setDefault(Assert::Action action){
+void Assert::_my_assert::setDefault(Assert::Action action){
   defaultAction = action;
 }
-Assert::Action _my_assert::getDefault(){
+Assert::Action Assert::_my_assert::getDefault(){
   return defaultAction;
 }
-std::string _my_assert::printDefault(){
+std::string Assert::_my_assert::printDefault(){
   return ActionNames[defaultAction];
 }
Index: src/Helpers/Assert.hpp
===================================================================
--- src/Helpers/Assert.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Helpers/Assert.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -234,6 +234,6 @@
       static bool ignore = false;\
       if(!ignore){\
-        if(Assert::_my_assert::check((condition),STRINGIFY(condition),(message),\
-                                     __FILE__,__LINE__,ignore)){\
+        if(!(condition) && Assert::_my_assert::check(STRINGIFY(condition),(message),\
+                                                     __FILE__,__LINE__,ignore)){\
           Assert::_my_assert::doHooks();\
           DEBUG_BREAK;\
@@ -247,7 +247,7 @@
 		  static bool ignore = false; \
 		  if(!ignore){\
-			  if(Assert::_my_assert::check(false,"Exception caught",(message),__FILE__,__LINE__,ignore)){\
+			  if(Assert::_my_assert::check("Exception caught",(message),__FILE__,__LINE__,ignore)){\
 			    Assert::_my_assert::doHooks();\
-          DEBUG_BREAK;\
+                            DEBUG_BREAK;\
 			  }\
 		  }\
@@ -299,10 +299,12 @@
     class _my_assert{
     public:
-      static bool check(const bool res,
-                        const char* condition,
+      static bool check(const char* condition,
                         const char* message,
                         const char* filename,
                         const int line,
                         bool& ignore);
+#ifdef __GNUC__
+      static void backtrace(const char *file, int line);
+#endif /* __GNUC__ */
       static void addHook(Assert::hook_t hook);
       static void removeHook(Assert::hook_t hook);
@@ -332,6 +334,6 @@
 
       if(!ignore){
-        if(_my_assert::check(dynamic_cast<target>(src)==static_cast<target>(src),"type-safe typecast",
-                                       message_ptr,file,line,ignore)){
+        bool res = dynamic_cast<target>(src)==static_cast<target>(src);
+        if(!res && _my_assert::check("type-safe typecast",message_ptr,file,line,ignore)){
           _my_assert::doHooks();
           DEBUG_BREAK;
@@ -354,5 +356,5 @@
       catch(...){
         if(!ignore){
-          if(_my_assert::check(0,"type-safe typecast",message_ref,file,line,ignore)){
+          if(_my_assert::check("type-safe typecast",message_ref,file,line,ignore)){
             _my_assert::doHooks();
             DEBUG_BREAK;
Index: src/Helpers/Info.cpp
===================================================================
--- src/Helpers/Info.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/Info.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,55 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * Info.cpp
+ *
+ *  Created on: Nov 25, 2009
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Helpers/Info.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+
+int Info::verbosity = 0;
+
+/**
+ * Constructor. Do not use this function. Use getInstance() instead.
+ *
+ * \return Info instance
+ */
+Info::Info(const char *msg) :
+  FunctionName(msg)
+{
+  verbosity++;
+  DoLog(0) && (Log() << Verbose(0) << "Begin of " << FunctionName << endl);
+};
+
+/**
+ * Destructor. Better use purgeInstance().
+ */
+Info::~Info() {
+  DoLog(0) && (Log() << Verbose(0) << "End of " << FunctionName << endl);
+  verbosity--;
+}
+
+/**
+ * Sets the verbosity.
+ *
+ * \param verbosityLevel verbosity
+ */
+void Info::setVerbosity(int verbosityLevel) {
+  verbosity = verbosityLevel;
+}
Index: src/Helpers/Info.hpp
===================================================================
--- src/Helpers/Info.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/Info.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,30 @@
+/*
+ * Info.hpp
+ *
+ *  Created on: Nov 25, 2009
+ *      Author: heber
+ */
+
+#ifndef INFO_HPP_
+#define INFO_HPP_
+
+using namespace std;
+
+/*********************************************** includes ***********************************/
+
+/****************************************** forward declarations *****************************/
+
+/********************************************** definitions *********************************/
+
+class Info {
+public :
+  static int verbosity;
+  const char *FunctionName;
+
+  Info(const char *msg);
+  ~Info();
+  static void setVerbosity(int verbosityLevel);
+
+};
+
+#endif /* INFO_HPP_ */
Index: src/Helpers/Log.cpp
===================================================================
--- src/Helpers/Log.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/Log.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,81 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * log.cpp
+ *
+ *  Created on: Oct 19, 2009
+ *      Author: metzler
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Helpers/logger.hpp"
+#include "Helpers/errorlogger.hpp"
+
+/**
+ * Sets verbosity for the error logger and the standard logger.
+ *
+ * \param int verbosity level
+ */
+void setVerbosity(int verbosityLevel) {
+  logger::getInstance().setVerbosity(verbosityLevel);
+}
+
+/**
+ * Gets verbosity for the error logger and the standard logger.
+ *
+ * \param int verbosity level
+ */
+int getVerbosity() {
+  return logger::getInstance().getVerbosity();
+}
+
+/**
+ * Prints a log entry.
+ *
+ * \param indentation level of the message to log
+ */
+class logger& Log() {
+  return logger::getInstance();
+}
+
+/** Checks verbosity for logger.
+ * Is supposed to be used in construct as this:
+ * DoLog(2) && (Log() << Verbose(2) << "message." << endl);
+ * If DoLog does not return true, the right-hand side is not evaluated and we save some time.
+ * \param verbose verbosity level of this message
+ * \return true - print, false - don't
+ */
+bool DoLog(int verbose) {
+  return (verbose <= logger::getInstance().verbosity);
+}
+
+/** Checks verbosity for errorlogger.
+ * Is supposed to be used in construct as this:
+ * DoLog(2) && (Log() << Verbose(2) << "message." << endl);
+ * If DoLog does not return true, the right-hand side is not evaluated and we save some time.
+ * \param verbose verbosity level of this message
+ * \return true - print, false - don't
+ */
+bool DoeLog(int verbose) {
+  return (verbose <= errorLogger::getInstance().verbosity);
+}
+
+/**
+ * Prints an error log entry.
+ *
+ * \param indentation level of the message to log
+ */
+class errorLogger & eLog() {
+  return errorLogger::getInstance();
+}
Index: src/Helpers/Log.hpp
===================================================================
--- src/Helpers/Log.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/Log.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,21 @@
+/*
+ * log.hpp
+ *
+ *  Created on: Oct 19, 2009
+ *      Author: metzler
+ */
+
+#ifndef LOG_HPP_
+#define LOG_HPP_
+
+#include "Helpers/errorlogger.hpp"
+#include "Helpers/logger.hpp"
+
+class logger & Log();
+class errorLogger & eLog();
+void setVerbosity(int verbosityLevel);
+int getVerbosity();
+bool DoLog(int verbose);
+bool DoeLog(int verbose);
+
+#endif /* LOG_HPP_ */
Index: src/Helpers/Makefile.am
===================================================================
--- src/Helpers/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,79 @@
+# PLEASE adhere to the alphabetical ordering in this Makefile!
+# Also indentation by a single tab
+
+INCLUDES = -I$(top_srcdir)/src
+
+AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
+# Position-Independent Code necessary for shared library
+AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
+
+# this includes source files that need to be present at multiple points
+HELPERSSOURCE =  \
+  Assert.cpp \
+  errorlogger.cpp \
+  helpers.cpp \
+  Info.cpp \
+  Log.cpp \
+  logger.cpp \
+  MemDebug.cpp \
+  Verbose.cpp
+
+HELPERSHEADER =  \
+  Assert.hpp \
+  errorlogger.hpp \
+  helpers.hpp \
+  Info.hpp \
+  Log.hpp \
+  logger.hpp \
+  MemDebug.hpp \
+  Verbose.hpp
+
+lib_LTLIBRARIES = libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la
+libMolecuilderHelpers_includedir = $(includedir)/molecuilder-$(MOLECUILDER_API_VERSION)/Actions/
+nobase_libMolecuilderHelpers_include_HEADERS = ${HELPERSHEADER}
+
+## Define the source file list for the "libexample-@MOLECUILDER_API_VERSION@.la"
+## target.  Note that @MOLECUILDER_API_VERSION@ is not interpreted by Automake and
+## will therefore be treated as if it were literally part of the target name,
+## and the variable name derived from that.
+## The file extension .cc is recognized by Automake, and makes it produce
+## rules which invoke the C++ compiler to produce a libtool object file (.lo)
+## from each source file.  Note that it is not necessary to list header files
+## which are already listed elsewhere in a _HEADERS variable assignment.
+libMolecuilderHelpers_@MOLECUILDER_API_VERSION@_la_SOURCES = ${HELPERSSOURCE}
+
+## Instruct libtool to include ABI version information in the generated shared
+## library file (.so).  The library ABI version is defined in configure.ac, so
+## that all version information is kept in one place.
+libMolecuilderHelpers_@MOLECUILDER_API_VERSION@_la_LDFLAGS = -version-info $(MOLECUILDER_SO_VERSION)
+
+## The generated configuration header is installed in its own subdirectory of
+## $(libdir).  The reason for this is that the configuration information put
+## into this header file describes the target platform the installed library
+## has been built for.  Thus the file must not be installed into a location
+## intended for architecture-independent files, as defined by the Filesystem
+## Hierarchy Standard (FHS).
+## The nodist_ prefix instructs Automake to not generate rules for including
+## the listed files in the distribution on 'make dist'.  Files that are listed
+## in _HEADERS variables are normally included in the distribution, but the
+## configuration header file is generated at configure time and should not be
+## shipped with the source tarball.
+libMolecuilderHelpers_libincludedir = $(libdir)/molecuilder-$(MOLECUILDER_API_VERSION)/include
+nodist_libMolecuilderHelpers_libinclude_HEADERS = $(top_builddir)/libmolecuilder_config.h
+
+## Install the generated pkg-config file (.pc) into the expected location for
+## architecture-dependent package configuration information.  Occasionally,
+## pkg-config files are also used for architecture-independent data packages,
+## in which case the correct install location would be $(datadir)/pkgconfig.
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc
+
+unity.cpp:
+	echo "" >  unity.cpp; \
+	list='$(HELPERSSOURCE)'; for file in $$list; do \
+	  if [ "$$file" != "MemDebug.cpp" ]; then \
+		  echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
+	 	fi; \
+	done;
+	
+MOSTLYCLEANFILES = unity.cpp
Index: src/Helpers/MemDebug.cpp
===================================================================
--- src/Helpers/MemDebug.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Helpers/MemDebug.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MemDebug.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 // NDEBUG implies NO_MEMDEBUG
@@ -72,4 +84,5 @@
   // all allocated memory blocks
   struct entry_t {
+    typedef unsigned int checksum_t;
     // we seperate the tracking info from the rest
     // A checksum will be calculated for this part of
@@ -90,5 +103,5 @@
     } info;
     bool isIgnored;
-    char checksum;
+    checksum_t checksum;
     entry_t *prev;
     entry_t *next;
@@ -117,7 +130,7 @@
   // calculates a simple checksum for the info block
   // the checksum is used to find memory corruptions
-  inline char calcChecksum(entry_t::info_t *info){
+  inline entry_t::checksum_t calcChecksum(entry_t::info_t *info){
     char *buffer = (char*)info;
-    char checksum =0;
+    entry_t::checksum_t checksum =0;
     for(size_t i=0;i<sizeof(entry_t::info_t);i++){
       checksum+=buffer[i];
@@ -154,4 +167,32 @@
       cout << "Chunk reserved at: " << pos->info.file << ":" << pos->info.line << endl;
 #endif
+    }
+  }
+
+  void dumpMemory(std::ostream &ost){
+    ost << "Maximum allocated Memory: " << max << " bytes" << endl;
+    ost << "Maximum allocated Memory: " << max << " bytes" << endl;
+    ost << "Currently allocated Memory: " << state <<" bytes" << endl;
+    ost << allocs << " allocated chunks total" << endl;
+    bool corrupted=false;
+    for(entry_t *pos=begin;pos;pos=pos->next){
+      ost << "\nChunk of " << pos->info.nbytes << " bytes" << " still available" << endl;
+#     ifdef __GNUC__
+        ost << "Chunk reserved at: " << pos->info.function
+             << " (" << pos->info.file << ":" << pos->info.line  << ")" << endl;
+#     else
+        ost << "Chunk reserved at: " << pos->info.file << ":" << pos->info.line << endl;
+#     endif
+        ost << "Chunk address: " << pos->info.location << endl;
+        entry_t::checksum_t checksum = calcChecksum(&pos->info);
+        ost << "Checksum of chunk: " << checksum << endl;
+        ost << "Checksum at allocation time: " << pos->checksum << endl;
+        if(checksum!=pos->checksum){
+          ost << "!!!Chunk was corrupted!!!" << endl;
+          corrupted=true;
+        }
+    }
+    if(corrupted){
+      ost << "\n!!!Memory corruption detected!!!" << endl;
     }
   }
Index: src/Helpers/MemDebug.hpp
===================================================================
--- src/Helpers/MemDebug.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Helpers/MemDebug.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -61,4 +61,5 @@
    */
   void getState();
+  void dumpMemory(std::ostream&);
 
   void _ignore(void*);
@@ -100,8 +101,13 @@
 
 #else
+
+#include <iosfwd>
+
 // memory debugging was disabled
 
 namespace Memory {
-  inline void getState(){}
+  inline void getState(){};
+
+  inline void dumpMemory(std::ostream&){};
 
   template <typename T>
Index: src/Helpers/Verbose.cpp
===================================================================
--- src/Helpers/Verbose.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/Verbose.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,102 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/** \file Verbose.cpp
+ *
+ * Function implementations for the class Verbose.
+ *
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Helpers/Info.hpp"
+#include "Helpers/Verbose.hpp"
+#include <iostream>
+
+using namespace std;
+
+/** Prints the tabs according to verbosity stored in the temporary constructed class.
+ * \param &ost stream to extend with tabs
+ * \return &ost stream with tabs
+ */
+ostream& Verbose::print (ostream &ost) const
+{
+  for (int i=Verbosity+Info::verbosity;i--;)
+    ost.put('\t');
+  //Log() << Verbose(0) << "Verbose(.) called." << endl;
+  return ost;
+};
+
+/** States whether current output message should be print or not.
+ * Compares Verbose::Verbosity plus Info::verbosity against \a verbosityLevel.
+ * \param verbosityLevel given global level of verbosity
+ * \return true - do output, false - don't
+ */
+bool Verbose::DoOutput(int verbosityLevel) const
+{
+  return (verbosityLevel >= Verbosity+Info::verbosity);
+};
+
+/** States whether current error output message should be print or not.
+ * Compares Verbose::Verbosity against \a verbosityLevel.
+ * \param verbosityLevel given global level of verbosity
+ * \return true - do output, false - don't
+ */
+bool Verbose::DoErrorOutput(int verbosityLevel) const
+{
+  return (verbosityLevel >= Verbosity);
+};
+
+/** Operator for the Verbose(arg) call.
+ * Constructs temporary a Verbose class object, wherein the verbosity is stored.
+ * Then << is called, which calls Verbose's print which adds the tabs and returns the stream.
+ * \param &ost stream to extend
+ * \param &m pointer to created Verbose object
+ * \return &ost
+ */ 
+ostream& operator<<(ostream& ost,const Verbose& m)
+{
+  return m.print(ost);
+};
+
+/** Prints the tabs according to verbosity stored in the temporary constructed class.
+ * Note that highest bit is set artificially to give number of bits to print
+ * \param &ost stream to extend with tabs
+ * \return &ost stream with tabs
+ */
+ostream& Binary::print (ostream &ost) const
+{
+  int bits = 1, counter = 1;
+  while ((bits = 1 << counter) < BinaryNumber)
+    counter++;
+  for (int i=0;i<counter-1;i++) {
+    if ((BinaryNumber & (1 << i)) == 0)
+      ost.put('0');
+     else
+      ost.put('1');
+  }
+  ost.put('b');
+  //Log() << Verbose(0) << "Binary(.) called." << endl;
+  return ost;
+};
+
+/** Operator for the Binary(arg) call.
+ * Constructs temporary a Verbose class object, wherein the Binary is stored.
+ * Then << is called, which calls Binary's print which adds the tabs and returns the stream.
+ * \param &ost stream to extend
+ * \param &m pointer to created Binary object
+ * \return &ost
+ */ 
+ostream& operator<<(ostream& ost,const Binary& m)
+{
+  return m.print(ost);
+};
Index: src/Helpers/Verbose.hpp
===================================================================
--- src/Helpers/Verbose.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/Verbose.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,62 @@
+/*
+ * verbose.hpp
+ *
+ *  Created on: Aug 3, 2009
+ *      Author: heber
+ */
+
+#ifndef VERBOSE_HPP_
+#define VERBOSE_HPP_
+
+using namespace std;
+
+/*********************************************** includes ***********************************/
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iosfwd>
+
+/************************************* Class Verbose & Binary *******************************/
+
+/** Verbose is an IO manipulator, that writes tabs according to \a Verbosity level.
+ */
+class Verbose
+{
+  public:
+    Verbose(int value) : Verbosity(value) { }
+
+    // allow access to private variable Verbose::Verbosity
+    friend ostream& operator<<(class errorLogger& l, const Verbose& v);
+    friend ostream& operator<<(class errorLogger* l, const Verbose& v);
+    friend ostream& operator<<(class logger& l, const Verbose& v);
+    friend ostream& operator<<(class logger* l, const Verbose& v);
+
+    ostream& print (ostream &ost) const;
+    bool DoOutput(int verbosityLevel) const;
+    bool DoErrorOutput(int verbosityLevel) const;
+  private:
+    int Verbosity;
+};
+
+ostream& operator<<(ostream& ost,const Verbose& m);
+
+/** Binary is an IO manipulator, that writes 0 and 1 according to number \a Binary.
+ */
+class Binary
+{
+  public:
+    Binary(int value) : BinaryNumber(value) { }
+
+    ostream& print (ostream &ost) const;
+  private:
+    int BinaryNumber;
+};
+
+ostream& operator<<(ostream& ost,const Binary& m);
+
+
+
+#endif /* VERBOSE_HPP_ */
Index: src/Helpers/errorlogger.cpp
===================================================================
--- src/Helpers/errorlogger.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/errorlogger.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,122 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * errorLogger.cpp
+ *
+ *  Created on: Oct 19, 2009
+ *      Author: metzler
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include <fstream>
+#include <iostream>
+#include "Helpers/errorlogger.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Patterns/Singleton_impl.hpp"
+
+ofstream null("/dev/null");
+int errorLogger::verbosity = 2;
+ostream* errorLogger::nix = &null;
+
+/**
+ * Constructor. Do not use this function. Use getInstance() instead.
+ *
+ * \return errorLogger instance
+ */
+errorLogger::errorLogger()
+{};
+
+/**
+ * Destructor. Better use purgeInstance().
+ */
+errorLogger::~errorLogger()
+{}
+
+CONSTRUCT_SINGLETON(errorLogger)
+
+/**
+ * Sets the verbosity.
+ *
+ * \param verbosityLevel verbosity
+ */
+void errorLogger::setVerbosity(int verbosityLevel) {
+  verbosity = verbosityLevel;
+}
+
+/**
+ * Gets the verbosity.
+ *
+ * \return verbosity level
+ */
+int errorLogger::getVerbosity()
+{
+  return verbosity;
+}
+
+/**
+ * Operator for the Binary(arg) call.
+ * Constructs temporary a Verbose class object, wherein the Binary is stored.
+ * Then << is called, which calls Binary's print which adds the tabs and logs
+ * the stream.
+ * \param &ost stream to extend
+ * \param &m pointer to created Binary object
+ * \return &ost
+ */
+ostream& operator<<(class errorLogger& l, const Verbose& v)
+{
+  int verbosityLevel = l.verbosity;
+  l.nix->clear();
+  if (v.DoErrorOutput(verbosityLevel)) {
+    switch(v.Verbosity) {
+      case 0:
+        cerr << "CRITICAL: ";
+        break;
+      case 1:
+        cerr << "ERROR: ";
+        break;
+      case 2:
+        cerr << "WARNING: ";
+        break;
+      default:
+        break;
+    }
+    v.print(cerr);
+    return cerr;
+  } else
+    return *l.nix;
+};
+ostream& operator<<(class errorLogger* l, const Verbose& v)
+{
+  int verbosityLevel = l->verbosity;
+  l->nix->clear();
+  if (v.DoErrorOutput(verbosityLevel)) {
+    switch(v.Verbosity) {
+      case 0:
+        cerr << "CRITICAL: ";
+        break;
+      case 1:
+        cerr << "ERROR: ";
+        break;
+      case 2:
+      default:
+        cerr << "WARNING: ";
+        break;
+    }
+    v.print(cerr);
+    return cerr;
+  } else
+    return *l->nix;
+};
+
+
Index: src/Helpers/errorlogger.hpp
===================================================================
--- src/Helpers/errorlogger.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/errorlogger.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,40 @@
+/*
+ * errorLogger.hpp
+ *
+ *  Created on: Oct 19, 2009
+ *      Author: metzler
+ */
+
+#ifndef ERRORLOGGER_HPP_
+#define ERRORLOGGER_HPP_
+
+#include <iosfwd>
+
+#include "Patterns/Singleton.hpp"
+
+using namespace std;
+
+class Verbose;
+
+class errorLogger : public Singleton<errorLogger>{
+  friend class Singleton<errorLogger>;
+public :
+  static ostream *nix;
+  static int verbosity;
+
+  static bool DoOutput();
+  static void setVerbosity(int verbosityLevel);
+  static int getVerbosity();
+
+protected:
+  /** Do not call this constructor directly, use getInstance() instead. */
+  errorLogger();
+  /** Do not call this destructor directly, use purgeInstance() instead. */
+  ~errorLogger();
+
+};
+
+ostream& operator<<(class errorLogger&l, const Verbose& ost);
+ostream& operator<<(class errorLogger*l, const Verbose& ost);
+
+#endif /* ERRORLOGGER_HPP_ */
Index: src/Helpers/helpers.cpp
===================================================================
--- src/Helpers/helpers.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/helpers.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,164 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/** \file helpers.cpp
+ *
+ * Implementation of some auxiliary functions for memory dis-/allocation and so on
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Helpers/helpers.hpp"
+#include "Helpers/fast_functions.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
+
+#include <iostream>
+
+/********************************************** helpful functions *********************************/
+
+
+/** Asks for a double value and checks input
+ * \param *text question
+ */
+double ask_value(const char *text)
+{
+  double test = 0.1439851348959832147598734598273456723948652983045928346598365;
+  do {
+    DoLog(0) && (Log() << Verbose(0) << text);
+    cin >> test;
+  } while (test == 0.1439851348959832147598734598273456723948652983045928346598365);
+  return test;
+};
+
+/** Output of a debug message to stderr.
+ * \param *P Problem at hand, points to ParallelSimulationData#me
+ * \param output output string
+ */
+#ifdef HAVE_DEBUG
+void debug_in(const char *output, const char *file, const int line) {
+  if (output) fprintf(stderr,"DEBUG: in %s at line %i: %s\n", file, line, output);
+}
+#else
+void debug_in(const char *output, const char *file, const int line) {}  // print nothing
+#endif
+
+/** modulo operator for doubles.
+ * \param *b pointer to double
+ * \param lower_bound lower bound
+ * \param upper_bound upper bound
+ */
+void bound(double *b, double lower_bound, double upper_bound)
+{
+  double step = (upper_bound - lower_bound);
+  while (*b >= upper_bound)
+    *b -= step;
+  while (*b < lower_bound)
+    *b += step;
+};
+
+/** Counts lines in file.
+ * Note we are scanning lines from current position, not from beginning.
+ * \param InputFile file to be scanned.
+ */
+int CountLinesinFile(ifstream &InputFile)
+{
+  char *buffer = new char[MAXSTRINGSIZE];
+  int lines=0;
+
+  int PositionMarker = InputFile.tellg();  // not needed as Inputfile is copied, given by value, not by ref
+  // count the number of lines, i.e. the number of fragments
+  InputFile.getline(buffer, MAXSTRINGSIZE); // skip comment lines
+  InputFile.getline(buffer, MAXSTRINGSIZE);
+  while(!InputFile.eof()) {
+    InputFile.getline(buffer, MAXSTRINGSIZE);
+    lines++;
+  }
+  InputFile.seekg(PositionMarker, ios::beg);
+  delete[](buffer);
+  return lines;
+};
+
+/** Returns a string with \a i prefixed with 0s to match order of total number of molecules in digits.
+ * \param FragmentNumber total number of fragments to determine necessary number of digits
+ * \param digits number to create with 0 prefixed
+ * \return allocated(!) char array with number in digits, ten base.
+ */
+char *FixedDigitNumber(const int FragmentNumber, const int digits)
+{
+  char *returnstring;
+  int number = FragmentNumber;
+  int order = 0;
+  while (number != 0) { // determine number of digits needed
+    number = (int)floor(((double)number / 10.));
+    order++;
+    //Log() << Verbose(0) << "Number is " << number << ", order is " << order << "." << endl;
+  }
+  // allocate string
+  returnstring = new char[order + 2];
+  // terminate  and fill string array from end backward
+  returnstring[order] = '\0';
+  number = digits;
+  for (int i=order;i--;) {
+    returnstring[i] = '0' + (char)(number % 10);
+    number = (int)floor(((double)number / 10.));
+  }
+  //Log() << Verbose(0) << returnstring << endl;
+  return returnstring;
+};
+
+/** Tests whether a given string contains a valid number or not.
+ * \param *string
+ * \return true - is a number, false - is not a valid number
+ */
+bool IsValidNumber( const char *string)
+{
+  int ptr = 0;
+  if ((string[ptr] == '.') || (string[ptr] == '-')) // number may be negative or start with dot
+    ptr++;
+  if ((string[ptr] >= '0') && (string[ptr] <= '9'))
+    return true;
+  return false;
+};
+
+/** Comparison function for GSL heapsort on distances in two molecules.
+ * \param *a
+ * \param *b
+ * \return <0, \a *a less than \a *b, ==0 if equal, >0 \a *a greater than \a *b
+ */
+int CompareDoubles (const void * a, const void * b)
+{
+  if (*(double *)a > *(double *)b)
+    return -1;
+  else if (*(double *)a < *(double *)b)
+    return 1;
+  else
+    return 0;
+};
+
+
+/**
+ * Calls exit(255).
+ */
+void performCriticalExit() {
+  exit(255);
+}
+
+sign_t sign(double value){
+  if(fabs(value)<MYEPSILON){
+    return Zero;
+  }
+  if(value<0)
+    return Minus;
+  else
+    return Plus;
+}
Index: src/Helpers/helpers.hpp
===================================================================
--- src/Helpers/helpers.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/helpers.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,254 @@
+/** \file helpers.hpp
+ *
+ * Declaration of some auxiliary functions for memory dis-/allocation and so on
+ */
+
+#ifndef HELPERS_HPP_
+#define HELPERS_HPP_
+
+using namespace std;
+
+/*********************************************** includes ***********************************/
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <fstream>
+
+#include "defs.hpp"
+#include "Helpers/Log.hpp"
+
+/********************************************** definitions *********************************/
+
+/********************************************** helpful functions *********************************/
+
+// taken out of TREMOLO
+/*@-namechecks@*/
+#ifndef __GNUC__
+# undef __attribute__
+# define __attribute__(x)
+#endif
+/*@=namechecks@*/
+
+/* Behandelt aufgetretene Fehler. error ist der Fehlertyp(enum Errors)
+   void *SpecialData ist ein untypisierter Zeiger auf Spezielle Daten zur Fehlerbehandlung.
+   Man koennte auch noch einen Zeiger auf eine Funktion uebergeben */
+extern void /*@exits@*/ debug(const char *output);
+  //__attribute__ ((__return__));
+#define debug(data) debug_in((data), __FILE__, __LINE__)
+
+extern void /*@exits@*/ debug_in(const char *output,
+    const char *file, const int line);
+  //__attribute__ ((__return__));
+
+typedef enum {
+  Minus = -1,
+  Zero = 0,
+  Plus = +1
+} sign_t;
+
+double ask_value(const char *text);
+bool check_bounds(double *x, double *cell_size);
+void bound(double *b, double lower_bound, double upper_bound);
+int CountLinesinFile(ifstream &InputFile);
+char *FixedDigitNumber(const int FragmentNumber, const int digits);
+bool IsValidNumber( const char *string);
+int CompareDoubles (const void * a, const void * b);
+void performCriticalExit();
+sign_t sign(double value);
+
+/********************************************** helpful template functions *********************************/
+
+
+/** returns greater of the two values.
+ * \param x first value
+ * \param y second value
+ * \return greater of the two (by operator>())
+ */
+template <typename T> T Max(T x, T y)
+{
+  if (x > y)
+    return x;
+  else return y;
+};
+
+/** returns smaller of the two values.
+ * \param x first value
+ * \param y second value
+ * \return smaller of the two (by operator<())
+ */
+template <typename T> T Min(T x, T y)
+{
+  if (x < y)
+    return x;
+  else return y;
+};
+
+/** Creates a lookup table for true father's Atom::Nr -> atom ptr.
+ * \param *start begin of chain list
+ * \paran *end end of chain list
+ * \param **Lookuptable pointer to return allocated lookup table (should be NULL on start)
+ * \param count optional predetermined size for table (otherwise we set the count to highest true father id)
+ * \return true - success, false - failure
+ */
+template <typename T> bool CreateFatherLookupTable(T *start, T *end, T **&LookupTable, int count = 0)
+{
+  bool status = true;
+  T *Walker = NULL;
+  int AtomNo;
+
+  if (LookupTable != NULL) {
+    DoeLog(0) && (eLog() << Verbose(0) << "Pointer for Lookup table is not NULL! Aborting ..." <<endl);
+    return false;
+  }
+
+  // count them
+  if (count == 0) {
+    Walker = start;
+    while (Walker->next != end) { // create a lookup table (Atom::nr -> atom) used as a marker table lateron
+      Walker = Walker->next;
+      count = (count < Walker->GetTrueFather()->nr) ? Walker->GetTrueFather()->nr : count;
+    }
+  }
+  if (count <= 0) {
+    DoeLog(1) && (eLog() << Verbose(1) << "Count of lookup list is 0 or less." << endl);
+    return false;
+  }
+
+  // allocate and fill
+  LookupTable = new T*[count];
+  if (LookupTable == NULL) {
+    DoeLog(0) && (eLog()<< Verbose(0) << "LookupTable memory allocation failed!" << endl);
+    performCriticalExit();
+    status = false;
+  } else {
+    Walker = start;
+    while (Walker->next != end) { // create a lookup table (Atom::nr -> atom) used as a marker table lateron
+      Walker = Walker->next;
+      AtomNo = Walker->GetTrueFather()->nr;
+      if ((AtomNo >= 0) && (AtomNo < count)) {
+        //*out << "Setting LookupTable[" << AtomNo << "] to " << *Walker << endl;
+        LookupTable[AtomNo] = Walker;
+      } else {
+        DoeLog(2) && (eLog() << Verbose(2) << "Walker " << *Walker << " exceeded range of nuclear ids [0, " << count << ")." << endl);
+        status = false;
+        break;
+      }
+    }
+  }
+
+  return status;
+};
+
+
+/** Frees a two-dimensional array.
+ * \param *ptr pointer to array
+ * \param dim first dim of array
+ */
+template <typename X> void Free2DArray(X **ptr, int dim)
+{
+  int i;
+  if (ptr != NULL) {
+    for(i=dim;i--;)
+      if (ptr[i] != NULL)
+        free(ptr[i]);
+    free(ptr);
+  }
+};
+
+template <typename T> void Increment(T *value, T *inc)
+{
+  *value += *inc;
+};
+
+template <typename T> void AbsoluteValue(T *value, T *abs)
+{
+  *value = *abs;
+};
+
+template <typename T> void IncrementalAbsoluteValue(T *value, T *abs)
+{
+  *value = *abs;
+  (*abs) += 1;
+};
+
+#define PLURAL_S(v) (((v)==1)?"":"s")
+
+// this is to allow different modes of access for
+// maps and sets
+template<typename Res,typename T>
+struct _take{
+  Res get(T value) const;
+};
+
+// if we have a set,vector etc we can directly access the result
+template<typename Res>
+struct _take<Res,Res>{
+  static inline Res get(Res value){
+    return value;
+  }
+};
+
+// if we have a map we have to access the second part of
+// the pair
+template<typename Res,typename T1>
+struct _take<Res,std::pair<T1,Res> >{
+  static inline Res get(std::pair<T1,Res> value){
+    return value.second;
+  }
+};
+
+/************ struct to contain simple enumerations ***************/
+template <class C>
+struct enumeration{
+  enumeration() : max(0) {}
+  enumeration(unsigned int i) : max(i) {}
+  enumeration(const enumeration &src) :
+    there(src.there),
+    back(src.back),
+    max(src.max)
+  {}
+  enumeration &operator=(const enumeration &src){
+    /* no self-assignment check needed */
+    there = src.there;
+    back = src.back;
+    max = src.max;
+    return *this;
+  }
+  void add(const C &value){
+    if(!there.count(value)){
+      there[value]=max;
+      back[max++]=value;
+    }
+  }
+  unsigned int getMax() const{
+    return max;
+  }
+
+  map<C,unsigned int> there;
+  map<unsigned int,C> back;
+private:
+  unsigned int max;
+};
+
+/***** A counter to generate sequential numbers *******************/
+struct counter{
+  inline counter() : count(0){};
+  inline counter(int i) : count(i){};
+  inline unsigned int operator()(){
+    return count++;
+  }
+private:
+  unsigned int count;
+};
+
+template <class C,class ForwardIterator>
+enumeration<C> enumerate(ForwardIterator first,ForwardIterator last){
+  enumeration<C> res;
+  for_each(first,last,bind1st(mem_fun(&enumeration<C>::add),&res));
+  return res;
+}
+
+#endif /*HELPERS_HPP_*/
Index: src/Helpers/logger.cpp
===================================================================
--- src/Helpers/logger.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/logger.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,96 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * logger.cpp
+ *
+ *  Created on: Oct 19, 2009
+ *      Author: metzler
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include <fstream>
+#include <iostream>
+#include "Helpers/logger.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Patterns/Singleton_impl.hpp"
+
+ofstream nullStream("/dev/null");
+
+int logger::verbosity = 2;
+ostream* logger::nix = &nullStream;
+
+/**
+ * Constructor. Do not use this function. Use getInstance() instead.
+ *
+ * \return logger instance
+ */
+logger::logger()
+{};
+
+/**
+ * Destructor. Better use purgeInstance().
+ */
+logger::~logger() {}
+
+CONSTRUCT_SINGLETON(logger)
+
+/**
+ * Sets the verbosity.
+ *
+ * \param verbosityLevel verbosity
+ */
+void logger::setVerbosity(int verbosityLevel) {
+  verbosity = verbosityLevel;
+}
+
+/**
+ * Gets the verbosity.
+ *
+ * \return verbosity level
+ */
+int logger::getVerbosity()
+{
+  return verbosity;
+}
+
+/**
+ * Operator for the Binary(arg) call.
+ * Constructs temporary a Verbose class object, wherein the Binary is stored.
+ * Then << is called, which calls Binary's print which adds the tabs and logs
+ * the stream.
+ * \param &ost stream to extend
+ * \param &m pointer to created Binary object
+ * \return &ost
+ */
+ostream& operator<<(class logger& l, const Verbose& v)
+{
+  int verbosityLevel = l.verbosity;
+  l.nix->clear();
+  if (v.DoOutput(verbosityLevel)) {
+    v.print(cout);
+    return cout;
+  } else
+    return *l.nix;
+};
+ostream& operator<<(class logger* l, const Verbose& v)
+{
+  int verbosityLevel = l->verbosity;
+  l->nix->clear();
+  if (v.DoOutput(verbosityLevel)) {
+    v.print(cout);
+    return cout;
+  } else
+    return *l->nix;
+};
+
Index: src/Helpers/logger.hpp
===================================================================
--- src/Helpers/logger.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Helpers/logger.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,39 @@
+/*
+ * logger.hpp
+ *
+ *  Created on: Oct 19, 2009
+ *      Author: metzler
+ */
+
+#ifndef LOGGER_HPP_
+#define LOGGER_HPP_
+
+#include <iosfwd>
+
+#include "Patterns/Singleton.hpp"
+
+using namespace std;
+
+class Verbose;
+
+class logger : public Singleton<logger> {
+  friend class Singleton<logger>;
+public :
+  static ostream *nix;
+  static int verbosity;
+
+  static bool DoOutput();
+  static void setVerbosity(int verbosityLevel);
+  static int getVerbosity();
+
+protected:
+  /** Do not call this constructor directly, use getInstance() instead. */
+  logger();
+  /** Do not call this destructor directly, use purgeInstance() instead. */
+  ~logger();
+};
+
+ostream& operator<<(class logger&l, const Verbose& ost);
+ostream& operator<<(class logger*l, const Verbose& ost);
+
+#endif /* LOGGER_HPP_ */
Index: c/Legacy/oldmenu.cpp
===================================================================
--- src/Legacy/oldmenu.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,1119 +1,0 @@
-/** \file menu.cpp
- * The class in this file is responsible for displaying the menu and enabling choices.
- *
- * This class is currently being refactored. Functions were copied from builder.cpp and are
- * to be imported into the menu class.
- *
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Legacy/oldmenu.hpp"
-#include "analysis_bonds.hpp"
-#include "analysis_correlation.hpp"
-#include "World.hpp"
-#include "atom.hpp"
-#include "bond.hpp"
-#include "bondgraph.hpp"
-#include "boundary.hpp"
-#include "config.hpp"
-#include "element.hpp"
-#include "ellipsoid.hpp"
-#include "helpers.hpp"
-#include "leastsquaremin.hpp"
-#include "linkedcell.hpp"
-#include "log.hpp"
-#include "memoryusageobserverunittest.hpp"
-#include "molecule.hpp"
-#include "periodentafel.hpp"
-#include "vector_ops.hpp"
-#include "Plane.hpp"
-#include "Line.hpp"
-
-#include "UIElements/UIFactory.hpp"
-#include "UIElements/Dialog.hpp"
-#include "Menu/Menu.hpp"
-#include "Menu/TextMenu.hpp"
-#include "Menu/ActionMenuItem.hpp"
-#include "Menu/SeperatorItem.hpp"
-#include "Menu/DisplayMenuItem.hpp"
-#include "Menu/SubMenuItem.hpp"
-#include "Actions/MapOfActions.hpp"
-#include "Actions/MethodAction.hpp"
-#include "Actions/ErrorAction.hpp"
-#include "Views/StreamStringView.hpp"
-#include "Views/MethodStringView.hpp"
-
-
-#include <boost/bind.hpp>
-
-/* copied methods for refactoring */
-/*TODO: Move these methods inside menu class
- * and restructure menu class*/
-
-/********************************************* Subsubmenu routine ************************************/
-
-/** Submenu for adding atoms to the molecule.
- * \param *periode periodentafel
- * \param *molecule molecules with atoms
- */
-void oldmenu::AddAtoms(periodentafel *periode, molecule *mol)
-{
-  atom *first, *second, *third, *fourth;
-  Vector **atoms;
-  Vector x,y,z,n;  // coordinates for absolute point in cell volume
-  double a,b,c;
-  char choice;  // menu choice char
-  bool valid;
-  bool aborted;
-
-  Log() << Verbose(0) << "===========ADD ATOM============================" << endl;
-  Log() << Verbose(0) << " a - state absolute coordinates of atom" << endl;
-  Log() << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;
-  Log() << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;
-  Log() << Verbose(0) << " d - state two atoms, two angles and a distance" << endl;
-  Log() << Verbose(0) << " e - least square distance position to a set of atoms" << endl;
-  Log() << Verbose(0) << "all else - go back" << endl;
-  Log() << Verbose(0) << "===============================================" << endl;
-  Log() << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;
-  Log() << Verbose(0) << "INPUT: ";
-  cin >> choice;
-
-  switch (choice) {
-    default:
-      eLog() << Verbose(2) << "Not a valid choice." << endl;
-      break;
-      case 'a': // absolute coordinates of atom
-      {
-        Dialog *dialog = UIFactory::getInstance().makeDialog();
-        first = World::getInstance().createAtom();
-        std::vector<element *> elements;
-        dialog->queryVector("Please enter coordinates: ",&first->x,World::getInstance().getDomain(), false);
-        dialog->queryElement("Please choose element: ",&elements);
-        if(dialog->display()){
-          if (elements.size() == 1) {
-            first->type = elements.at(0);
-            mol->AddAtom(first);  // add to molecule
-          } else {
-            DoeLog(1) && (eLog() << Verbose(1) << "Unequal to one element given for element of new atom." << endl);
-          }
-        }
-        else{
-          World::getInstance().destroyAtom(first);
-        }
-      }
-      break;
-
-      case 'b': // relative coordinates of atom wrt to reference point
-        first = World::getInstance().createAtom();
-        valid = true;
-        aborted = false;
-        do {
-          if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
-          auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog());
-          dialog->queryVector("Enter reference coordinates.",&x,World::getInstance().getDomain(), true);
-          dialog->queryVector("Enter relative coordinates.",&first->x,World::getInstance().getDomain(), false);
-          if((aborted = !dialog->display())){
-            continue;
-          }
-          first->x += x;
-        } while (!aborted && !(valid = mol->CheckBounds((const Vector *)&first->x)));
-        if(!aborted){
-          first->type = periode->AskElement();  // give type
-          mol->AddAtom(first);  // add to molecule
-        }
-        else{
-          World::getInstance().destroyAtom(first);
-        }
-        break;
-
-      case 'c': // relative coordinates of atom wrt to already placed atom
-      {
-        first = World::getInstance().createAtom();
-        valid = true;
-        do {
-          if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
-          auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog());
-          second = mol->AskAtom("Enter atom number: ");
-          dialog->queryVector("Enter relative coordinates.",&first->x,World::getInstance().getDomain(), false);
-          dialog->display();
-          for (int i=NDIM;i--;) {
-            first->x[i] += second->x[i];
-          }
-        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
-        first->type = periode->AskElement();  // give type
-        mol->AddAtom(first);  // add to molecule
-      }
-      break;
-
-    case 'd': // two atoms, two angles and a distance
-        first = World::getInstance().createAtom();
-        valid = true;
-        do {
-          if (!valid) {
-            eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;
-          }
-          Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
-          second = mol->AskAtom("Enter central atom: ");
-          third = mol->AskAtom("Enter second atom (specifying the axis for first angle): ");
-          fourth = mol->AskAtom("Enter third atom (specifying a plane for second angle): ");
-          a = ask_value("Enter distance between central (first) and new atom: ");
-          b = ask_value("Enter angle between new, first and second atom (degrees): ");
-          b *= M_PI/180.;
-          bound(&b, 0., 2.*M_PI);
-          c = ask_value("Enter second angle between new and normal vector of plane defined by first, second and third atom (degrees): ");
-          c *= M_PI/180.;
-          bound(&c, -M_PI, M_PI);
-          Log() << Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl;
-/*
-          second->Output(1,1,(ofstream *)&cout);
-          third->Output(1,2,(ofstream *)&cout);
-          fourth->Output(1,3,(ofstream *)&cout);
-          n.MakeNormalvector((const vector *)&second->x, (const vector *)&third->x, (const vector *)&fourth->x);
-          x.Copyvector(&second->x);
-          x.SubtractVector(&third->x);
-          x.Copyvector(&fourth->x);
-          x.SubtractVector(&third->x);
-
-          if (!z.SolveSystem(&x,&y,&n, b, c, a)) {
-            Log() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
-            continue;
-          }
-          Log() << Verbose(0) << "resulting relative coordinates: ";
-          z.Output();
-          Log() << Verbose(0) << endl;
-          */
-          // calc axis vector
-          x= second->x - third->x;
-          x.Normalize();
-          Log() << Verbose(0) << "x: " << x << endl;
-          z = Plane(second->x,third->x,fourth->x).getNormal();
-          Log() << Verbose(0) << "z: " << z << endl;
-          y = Plane(x,z,0).getNormal();
-          Log() << Verbose(0) << "y: " << y << endl;
-
-          // rotate vector around first angle
-          first->x = x;
-          first->x = Line(zeroVec,z).rotateVector(first->x,b - M_PI);
-          Log() << Verbose(0) << "Rotated vector: " << first->x << endl,
-          // remove the projection onto the rotation plane of the second angle
-          n = y;
-          n.Scale(first->x.ScalarProduct(y));
-          Log() << Verbose(0) << "N1: " << n << endl;
-          first->x -= n;
-          Log() << Verbose(0) << "Subtracted vector: " << first->x << endl;
-          n = z;
-          n.Scale(first->x.ScalarProduct(z));
-          Log() << Verbose(0) << "N2: " << n << endl;
-          first->x -= n;
-          Log() << Verbose(0) << "2nd subtracted vector: " << first->x << endl;
-
-          // rotate another vector around second angle
-          n = y;
-          n = Line(zeroVec,x).rotateVector(n,c - M_PI);
-          Log() << Verbose(0) << "2nd Rotated vector: " << n << endl;
-
-          // add the two linear independent vectors
-          first->x += n;
-          first->x.Normalize();
-          first->x.Scale(a);
-          first->x += second->x;
-
-          Log() << Verbose(0) << "resulting coordinates: " << first->x << endl;
-        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
-        first->type = periode->AskElement();  // give type
-        mol->AddAtom(first);  // add to molecule
-        break;
-
-      case 'e': // least square distance position to a set of atoms
-        first = World::getInstance().createAtom();
-        atoms = new (Vector*[128]);
-        valid = true;
-        for(int i=128;i--;)
-          atoms[i] = NULL;
-        int i=0, j=0;
-        Log() << Verbose(0) << "Now we need at least three molecules.\n";
-        do {
-          Log() << Verbose(0) << "Enter " << i+1 << "th atom: ";
-          cin >> j;
-          if (j != -1) {
-            second = mol->FindAtom(j);
-            atoms[i++] = &(second->x);
-          }
-        } while ((j != -1) && (i<128));
-        if (i >= 2) {
-          LSQdistance(first->x,(const Vector **)atoms, i);
-
-          Log() << Verbose(0) << first->x;
-          first->type = periode->AskElement();  // give type
-          mol->AddAtom(first);  // add to molecule
-        } else {
-          World::getInstance().destroyAtom(first);
-          Log() << Verbose(0) << "Please enter at least two vectors!\n";
-        }
-        break;
-  };
-};
-
-/** Submenu for centering the atoms in the molecule.
- * \param *mol molecule with all the atoms
- */
-void oldmenu::CenterAtoms(molecule *mol)
-{
-  Vector x, y, helper;
-  char choice;  // menu choice char
-
-  Log() << Verbose(0) << "===========CENTER ATOMS=========================" << endl;
-  Log() << Verbose(0) << " a - on origin" << endl;
-  Log() << Verbose(0) << " b - on center of gravity" << endl;
-  Log() << Verbose(0) << " c - within box with additional boundary" << endl;
-  Log() << Verbose(0) << " d - within given simulation box" << endl;
-  Log() << Verbose(0) << "all else - go back" << endl;
-  Log() << Verbose(0) << "===============================================" << endl;
-  Log() << Verbose(0) << "INPUT: ";
-  cin >> choice;
-
-  switch (choice) {
-    default:
-      Log() << Verbose(0) << "Not a valid choice." << endl;
-      break;
-    case 'a':
-      Log() << Verbose(0) << "Centering atoms in config file on origin." << endl;
-      mol->CenterOrigin();
-      break;
-    case 'b':
-      Log() << Verbose(0) << "Centering atoms in config file on center of gravity." << endl;
-      mol->CenterPeriodic();
-      break;
-    case 'c':
-      Log() << Verbose(0) << "Centering atoms in config file within given additional boundary." << endl;
-      for (int i=0;i<NDIM;i++) {
-        Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
-        cin >> y[i];
-      }
-      mol->CenterEdge(&x);  // make every coordinate positive
-      mol->Center += y; // translate by boundary
-      helper = (2*y)+x;
-      mol->SetBoxDimension(&helper);  // update Box of atoms by boundary
-      break;
-    case 'd':
-      Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
-      for (int i=0;i<NDIM;i++) {
-        Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
-        cin >> x[i];
-      }
-      // update Box of atoms by boundary
-      mol->SetBoxDimension(&x);
-      // center
-      mol->CenterInBox();
-      break;
-  }
-};
-
-/** Submenu for aligning the atoms in the molecule.
- * \param *periode periodentafel
- * \param *mol molecule with all the atoms
- */
-void oldmenu::AlignAtoms(periodentafel *periode, molecule *mol)
-{
-  atom *first, *second, *third;
-  Vector x,n;
-  char choice;  // menu choice char
-
-  Log() << Verbose(0) << "===========ALIGN ATOMS=========================" << endl;
-  Log() << Verbose(0) << " a - state three atoms defining align plane" << endl;
-  Log() << Verbose(0) << " b - state alignment vector" << endl;
-  Log() << Verbose(0) << " c - state two atoms in alignment direction" << endl;
-  Log() << Verbose(0) << " d - align automatically by least square fit" << endl;
-  Log() << Verbose(0) << "all else - go back" << endl;
-  Log() << Verbose(0) << "===============================================" << endl;
-  Log() << Verbose(0) << "INPUT: ";
-  cin >> choice;
-
-  switch (choice) {
-    default:
-    case 'a': // three atoms defining mirror plane
-      first = mol->AskAtom("Enter first atom: ");
-      second = mol->AskAtom("Enter second atom: ");
-      third = mol->AskAtom("Enter third atom: ");
-
-      n = Plane(first->x,second->x,third->x).getNormal();
-      break;
-    case 'b': // normal vector of mirror plane
-    {
-      Dialog *dialog = UIFactory::getInstance().makeDialog();
-      dialog->queryVector("Enter normal vector of mirror plane.",&n,World::getInstance().getDomain(),false);
-      dialog->display();
-      delete dialog;
-      n.Normalize();
-    }
-    break;
-
-    case 'c': // three atoms defining mirror plane
-      first = mol->AskAtom("Enter first atom: ");
-      second = mol->AskAtom("Enter second atom: ");
-
-      n = first->x - second->x;
-      n.Normalize();
-      break;
-    case 'd':
-      char shorthand[4];
-      Vector a;
-      struct lsq_params param;
-      do {
-        fprintf(stdout, "Enter the element of atoms to be chosen: ");
-        fscanf(stdin, "%3s", shorthand);
-      } while ((param.type = periode->FindElement(shorthand)) == NULL);
-      Log() << Verbose(0) << "Element is " << param.type->name << endl;
-      mol->GetAlignvector(&param);
-      for (int i=NDIM;i--;) {
-        x[i] = gsl_vector_get(param.x,i);
-        n[i] = gsl_vector_get(param.x,i+NDIM);
-      }
-      gsl_vector_free(param.x);
-      Log() << Verbose(0) << "Offset vector: " << x << endl;
-      n.Normalize();
-      break;
-  };
-  Log() << Verbose(0) << "Alignment vector: " << n << endl;
-  mol->Align(&n);
-};
-
-/** Submenu for mirroring the atoms in the molecule.
- * \param *mol molecule with all the atoms
- */
-void oldmenu::MirrorAtoms(molecule *mol)
-{
-  atom *first, *second, *third;
-  Vector n;
-  char choice;  // menu choice char
-
-  Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl;
-  Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl;
-  Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl;
-  Log() << Verbose(0) << " c - state two atoms in normal direction" << endl;
-  Log() << Verbose(0) << "all else - go back" << endl;
-  Log() << Verbose(0) << "===============================================" << endl;
-  Log() << Verbose(0) << "INPUT: ";
-  cin >> choice;
-
-  switch (choice) {
-    default:
-    case 'a': // three atoms defining mirror plane
-      first = mol->AskAtom("Enter first atom: ");
-      second = mol->AskAtom("Enter second atom: ");
-      third = mol->AskAtom("Enter third atom: ");
-
-      n = Plane(first->x,second->x,third->x).getNormal();
-      break;
-    case 'b': // normal vector of mirror plane
-    {
-      Dialog *dialog = UIFactory::getInstance().makeDialog();
-      dialog->queryVector("Enter normal vector of mirror plane.",&n,World::getInstance().getDomain(),false);
-      dialog->display();
-      delete dialog;
-      n.Normalize();
-    }
-    break;
-
-    case 'c': // three atoms defining mirror plane
-      first = mol->AskAtom("Enter first atom: ");
-      second = mol->AskAtom("Enter second atom: ");
-
-      n = first->x - second->x;
-      n.Normalize();
-      break;
-  };
-  Log() << Verbose(0) << "Normal vector: " << n << endl;
-  mol->Mirror((const Vector *)&n);
-};
-
-/** Submenu for removing the atoms from the molecule.
- * \param *mol molecule with all the atoms
- */
-void oldmenu::RemoveAtoms(molecule *mol)
-{
-  atom *second;
-  int axis;
-  double tmp1, tmp2;
-  char choice;  // menu choice char
-
-  Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl;
-  Log() << Verbose(0) << " a - state atom for removal by number" << endl;
-  Log() << Verbose(0) << " b - keep only in radius around atom" << endl;
-  Log() << Verbose(0) << " c - remove this with one axis greater value" << endl;
-  Log() << Verbose(0) << "all else - go back" << endl;
-  Log() << Verbose(0) << "===============================================" << endl;
-  Log() << Verbose(0) << "INPUT: ";
-  cin >> choice;
-
-  switch (choice) {
-    default:
-    case 'a':
-      if (mol->RemoveAtom(mol->AskAtom("Enter number of atom within molecule: ")))
-        Log() << Verbose(1) << "Atom removed." << endl;
-      else
-        Log() << Verbose(1) << "Atom not found." << endl;
-      break;
-    case 'b':
-      {
-        second = mol->AskAtom("Enter number of atom as reference point: ");
-        Log() << Verbose(0) << "Enter radius: ";
-        cin >> tmp1;
-        molecule::iterator runner;
-        for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
-          runner = iter++;
-          if ((*runner)->x.DistanceSquared((*runner)->x) > tmp1*tmp1) // distance to first above radius ...
-            mol->RemoveAtom((*runner));
-        }
-      }
-      break;
-    case 'c':
-      Log() << Verbose(0) << "Which axis is it: ";
-      cin >> axis;
-      Log() << Verbose(0) << "Lower boundary: ";
-      cin >> tmp1;
-      Log() << Verbose(0) << "Upper boundary: ";
-      cin >> tmp2;
-      molecule::iterator runner;
-      for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
-        runner = iter++;
-        if (((*runner)->x[axis] < tmp1) || ((*runner)->x[axis] > tmp2)) {// out of boundary ...
-          //Log() << Verbose(0) << "Atom " << *(*runner) << " with " << (*runner)->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
-          mol->RemoveAtom((*runner));
-        }
-      }
-      break;
-  };
-  //mol->Output();
-  choice = 'r';
-};
-
-/** Submenu for measuring out the atoms in the molecule.
- * \param *periode periodentafel
- * \param *mol molecule with all the atoms
- */
-void oldmenu::MeasureAtoms(periodentafel *periode, molecule *mol, config *configuration)
-{
-  atom *first, *second, *third;
-  Vector x,y;
-  double min[256], tmp1, tmp2, tmp3;
-  int Z;
-  char choice;  // menu choice char
-
-  Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl;
-  Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl;
-  Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl;
-  Log() << Verbose(0) << " c - calculate bond angle" << endl;
-  Log() << Verbose(0) << " d - calculate principal axis of the system" << endl;
-  Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl;
-  Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl;
-  Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl;
-  Log() << Verbose(0) << " h - count the number of hydrogen bonds" << endl;
-  Log() << Verbose(0) << "all else - go back" << endl;
-  Log() << Verbose(0) << "===============================================" << endl;
-  Log() << Verbose(0) << "INPUT: ";
-  cin >> choice;
-
-  switch(choice) {
-    default:
-      Log() << Verbose(1) << "Not a valid choice." << endl;
-      break;
-    case 'a':
-      first = mol->AskAtom("Enter first atom: ");
-      for (int i=MAX_ELEMENTS;i--;)
-        min[i] = 0.;
-
-      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
-        Z = (*iter)->type->Z;
-        tmp1 = 0.;
-        if (first != (*iter)) {
-          x = first->x - (*iter)->x;
-          tmp1 = x.Norm();
-        }
-        if ((tmp1 != 0.) && ((min[Z] == 0.) || (tmp1 < min[Z]))) min[Z] = tmp1;
-        //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << ((*iter)->nr << ": " << tmp1 << " a.u." << endl;
-      }
-      for (int i=MAX_ELEMENTS;i--;)
-        if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first->type->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl;
-      break;
-
-    case 'b':
-      first = mol->AskAtom("Enter first atom: ");
-      second = mol->AskAtom("Enter second atom: ");
-      for (int i=NDIM;i--;)
-        min[i] = 0.;
-      x = first->x - second->x;
-      tmp1 = x.Norm();
-      Log() << Verbose(1) << "Distance vector is " << x << "." << "/n"
-            << "Norm of distance is " << tmp1 << "." << endl;
-      break;
-
-    case 'c':
-      Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl;
-      first = mol->AskAtom("Enter first atom: ");
-      second = mol->AskAtom("Enter central atom: ");
-      third  = mol->AskAtom("Enter last atom: ");
-      tmp1 = tmp2 = tmp3 = 0.;
-      x = first->x - second->x;
-      y = third->x - second->x;
-      Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
-      Log() << Verbose(0) << (acos(x.ScalarProduct(y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;
-      break;
-    case 'd':
-      Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;
-      Log() << Verbose(0) << "Shall we rotate? [0/1]: ";
-      cin >> Z;
-      if ((Z >=0) && (Z <=1))
-        mol->PrincipalAxisSystem((bool)Z);
-      else
-        mol->PrincipalAxisSystem(false);
-      break;
-    case 'e':
-      {
-        Log() << Verbose(0) << "Evaluating volume of the convex envelope.";
-        class Tesselation *TesselStruct = NULL;
-        const LinkedCell *LCList = NULL;
-        LCList = new LinkedCell(mol, 10.);
-        Boundaries *BoundaryPoints = NULL;
-        FindConvexBorder(mol, BoundaryPoints TesselStruct, LCList, NULL);
-        double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration);
-        Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;\
-        delete(LCList);
-        delete(TesselStruct);
-      }
-      break;
-    case 'f':
-      mol->OutputTemperatureFromTrajectories((ofstream *)&cout, mol->MDSteps-1, mol->MDSteps);
-      break;
-    case 'g':
-      {
-        char filename[255];
-        Log() << Verbose(0) << "Please enter filename: " << endl;
-        cin >> filename;
-        Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl;
-        ofstream *output = new ofstream(filename, ios::trunc);
-        if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps))
-          Log() << Verbose(2) << "File could not be written." << endl;
-        else
-          Log() << Verbose(2) << "File stored." << endl;
-        output->close();
-        delete(output);
-      }
-      break;
-    case 'h':
-      {
-        int Z1;
-        cout << "Please enter first interface element: ";
-        cin >> Z1;
-        const element * InterfaceElement = World::getInstance().getPeriode()->FindElement(Z1);
-        int Z2;
-        cout << "Please enter second interface element: ";
-        cin >> Z2;
-        const element * InterfaceElement2 = World::getInstance().getPeriode()->FindElement(Z2);
-        cout << endl << "There are " << CountHydrogenBridgeBonds(World::getInstance().getMolecules(), InterfaceElement, InterfaceElement2) << " hydrogen bridges with connections to " << (InterfaceElement != 0 ? InterfaceElement->name : "None") << " and " << (InterfaceElement2 != 0 ? InterfaceElement2->name : "None") << "." << endl;
-      }
-      break;
-  }
-};
-
-/** Submenu for measuring out the atoms in the molecule.
- * \param *mol molecule with all the atoms
- * \param *configuration configuration structure for the to be written config files of all fragments
- */
-void oldmenu::FragmentAtoms(molecule *mol, config *configuration)
-{
-  int Order1;
-  std::string path;
-  clock_t start, end;
-
-  Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
-  Log() << Verbose(0) << "What's the desired bond order: ";
-  cin >> Order1;
-  DoLog(0) && (Log() << Verbose(0) << "What's the output path and prefix [e.g. /home/foo/BondFragment]: ");
-  cin >> path;
-  if (mol->hasBondStructure()) {
-    start = clock();
-    mol->FragmentMolecule(Order1, path);
-    end = clock();
-    Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
-  } else
-    Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl;
-};
-
-/********************************************** Submenu routine **************************************/
-
-/** Submenu for manipulating atoms.
- * \param *periode periodentafel
- * \param *molecules list of molecules whose atoms are to be manipulated
- */
-void oldmenu::ManipulateAtoms(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
-{
-  atom *first, *second;
-  molecule *mol = NULL;
-  Vector x,y,z,n; // coordinates for absolute point in cell volume
-  double *factor; // unit factor if desired
-  double bond, minBond;
-  char choice;  // menu choice char
-  bool valid;
-
-  Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl;
-  Log() << Verbose(0) << "a - add an atom" << endl;
-  Log() << Verbose(0) << "r - remove an atom" << endl;
-  Log() << Verbose(0) << "b - scale a bond between atoms" << endl;
-  Log() << Verbose(0) << "u - change an atoms element" << endl;
-  Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl;
-  Log() << Verbose(0) << "all else - go back" << endl;
-  Log() << Verbose(0) << "===============================================" << endl;
-  if (molecules->NumberOfActiveMolecules() > 1)
-    eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
-  Log() << Verbose(0) << "INPUT: ";
-  cin >> choice;
-
-  switch (choice) {
-    default:
-      Log() << Verbose(0) << "Not a valid choice." << endl;
-      break;
-
-    case 'a': // add atom
-      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-        if ((*ListRunner)->ActiveFlag) {
-        mol = *ListRunner;
-        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
-        AddAtoms(periode, mol);
-      }
-      break;
-
-    case 'b': // scale a bond
-      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-        if ((*ListRunner)->ActiveFlag) {
-        mol = *ListRunner;
-        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
-        Log() << Verbose(0) << "Scaling bond length between two atoms." << endl;
-        first = mol->AskAtom("Enter first (fixed) atom: ");
-        second = mol->AskAtom("Enter second (shifting) atom: ");
-        minBond = 0.;
-        for (int i=NDIM;i--;)
-          minBond += (first->x[i]-second->x[i])*(first->x[i] - second->x[i]);
-        minBond = sqrt(minBond);
-        Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
-        Log() << Verbose(0) << "Enter new bond length [a.u.]: ";
-        cin >> bond;
-        for (int i=NDIM;i--;) {
-          second->x[i] -= (second->x[i]-first->x[i])/minBond*(minBond-bond);
-        }
-        //Log() << Verbose(0) << "New coordinates of Atom " << second->nr << " are: ";
-        //second->Output(second->type->No, 1);
-      }
-      break;
-
-    case 'c': // unit scaling of the metric
-      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-        if ((*ListRunner)->ActiveFlag) {
-        mol = *ListRunner;
-        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
-       Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl;
-       Log() << Verbose(0) << "Enter three factors: ";
-       factor = new double[NDIM];
-       cin >> factor[0];
-       cin >> factor[1];
-       cin >> factor[2];
-       valid = true;
-       mol->Scale((const double ** const)&factor);
-       delete[](factor);
-      }
-     break;
-
-    case 'l': // measure distances or angles
-      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-        if ((*ListRunner)->ActiveFlag) {
-        mol = *ListRunner;
-        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
-        MeasureAtoms(periode, mol, configuration);
-      }
-      break;
-
-    case 'r': // remove atom
-      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-        if ((*ListRunner)->ActiveFlag) {
-        mol = *ListRunner;
-        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
-        RemoveAtoms(mol);
-      }
-      break;
-
-    case 'u': // change an atom's element
-      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-        if ((*ListRunner)->ActiveFlag) {
-        int Z;
-        mol = *ListRunner;
-        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
-        first = NULL;
-        do {
-          Log() << Verbose(0) << "Change the element of which atom: ";
-          cin >> Z;
-        } while ((first = mol->FindAtom(Z)) == NULL);
-        Log() << Verbose(0) << "New element by atomic number Z: ";
-        cin >> Z;
-        first->setType(Z);
-        Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl;
-      }
-      break;
-  }
-};
-
-void oldmenu::duplicateCell(MoleculeListClass *molecules, config *configuration) {
-  molecule *mol = NULL;
-  int axis,faktor,count,j;
-  atom *first = NULL;
-  const element **Elements;
-  Vector x,y;
-  Vector **vectors;
-
-  for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-    if ((*ListRunner)->ActiveFlag) {
-    mol = *ListRunner;
-    Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
-    Log() << Verbose(0) << "State the axis [(+-)123]: ";
-    cin >> axis;
-    Log() << Verbose(0) << "State the factor: ";
-    cin >> faktor;
-    if (mol->getAtomCount() != 0) {  // if there is more than none
-      count = mol->getAtomCount();  // is changed becausing of adding, thus has to be stored away beforehand
-      Elements = new const element *[count];
-      vectors = new Vector *[count];
-      j = 0;
-      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
-        Elements[j] = (*iter)->type;
-        vectors[j] = &(*iter)->x;
-        j++;
-      }
-      if (count != j)
-        eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
-      x.Zero();
-      y.Zero();
-      y[abs(axis)-1] = World::getInstance().getDomain()[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
-      for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
-        x += y; // per factor one cell width further
-        for (int k=count;k--;) { // go through every atom of the original cell
-          first = World::getInstance().createAtom(); // create a new body
-          first->x = (*vectors[k]) + x;  // use coordinate of original atom
-          first->type = Elements[k];  // insert original element
-          mol->AddAtom(first);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
-        }
-      }
-      if (mol->hasBondStructure())
-        mol->CreateAdjacencyList(mol->BondDistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
-      // free memory
-      delete[](Elements);
-      delete[](vectors);
-      // correct cell size
-      if (axis < 0) { // if sign was negative, we have to translate everything
-        x = y;
-        x.Scale(-(faktor-1));
-        mol->Translate(&x);
-      }
-      World::getInstance().getDomain()[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
-    }
-  }
-}
-
-/** Submenu for manipulating molecules.
- * \param *periode periodentafel
- * \param *molecules list of molecule to manipulate
- */
-void oldmenu::ManipulateMolecules(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
-{
-  Vector x,y,z,n; // coordinates for absolute point in cell volume
-  char choice;  // menu choice char
-  molecule *mol = NULL;
-  MoleculeLeafClass *Subgraphs = NULL;
-
-  Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl;
-  Log() << Verbose(0) << "c - scale by unit transformation" << endl;
-  Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl;
-  Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl;
-  Log() << Verbose(0) << "g - center atoms in box" << endl;
-  Log() << Verbose(0) << "i - realign molecule" << endl;
-  Log() << Verbose(0) << "m - mirror all molecules" << endl;
-  Log() << Verbose(0) << "o - create connection matrix" << endl;
-  Log() << Verbose(0) << "t - translate molecule by vector" << endl;
-  Log() << Verbose(0) << "all else - go back" << endl;
-  Log() << Verbose(0) << "===============================================" << endl;
-  if (molecules->NumberOfActiveMolecules() > 1)
-    eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
-  Log() << Verbose(0) << "INPUT: ";
-  cin >> choice;
-
-  switch (choice) {
-    default:
-      Log() << Verbose(0) << "Not a valid choice." << endl;
-      break;
-
-    case 'd': // duplicate the periodic cell along a given axis, given times
-      duplicateCell(molecules, configuration);
-      break;
-
-    case 'f':
-      FragmentAtoms(mol, configuration);
-      break;
-
-    case 'g': // center the atoms
-      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-        if ((*ListRunner)->ActiveFlag) {
-        mol = *ListRunner;
-        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
-        CenterAtoms(mol);
-      }
-      break;
-
-    case 'i': // align all atoms
-      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-        if ((*ListRunner)->ActiveFlag) {
-        mol = *ListRunner;
-        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
-        AlignAtoms(periode, mol);
-      }
-      break;
-
-    case 'm': // mirror atoms along a given axis
-      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-        if ((*ListRunner)->ActiveFlag) {
-        mol = *ListRunner;
-        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
-        MirrorAtoms(mol);
-      }
-      break;
-
-    case 'o': // create the connection matrix
-      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-        if ((*ListRunner)->ActiveFlag) {
-          mol = *ListRunner;
-          double bonddistance;
-          clock_t start,end;
-          Log() << Verbose(0) << "What's the maximum bond distance: ";
-          cin >> bonddistance;
-          start = clock();
-          mol->CreateAdjacencyList(bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
-          end = clock();
-          Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
-        }
-      break;
-
-    case 't': // translate all atoms
-      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-        if ((*ListRunner)->ActiveFlag) {
-        mol = *ListRunner;
-        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
-        Dialog *dialog = UIFactory::getInstance().makeDialog();
-        dialog->queryVector("Enter translation vector.",&x,World::getInstance().getDomain(),false);
-        if(dialog->display()){
-          mol->Center += x;
-        }
-        delete dialog;
-     }
-     break;
-  }
-  // Free all
-  if (Subgraphs != NULL) {  // free disconnected subgraph list of DFS analysis was performed
-    while (Subgraphs->next != NULL) {
-      Subgraphs = Subgraphs->next;
-      delete(Subgraphs->previous);
-    }
-    delete(Subgraphs);
-  }
-};
-
-
-void oldmenu::SimpleAddMolecules(MoleculeListClass *molecules) {
-  molecule *srcmol = NULL, *destmol = NULL;
-  Dialog *dialog = UIFactory::getInstance().makeDialog();
-  dialog->queryMolecule("molecule-by-id",&destmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
-  dialog->queryMolecule("molecule-by-id",&srcmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
-  if(dialog->display()) {
-    molecules->SimpleAdd(srcmol, destmol);
-  }
-  else {
-    Log() << Verbose(0) << "Adding of molecules canceled" << endl;
-  }
-  delete dialog;
-}
-
-void oldmenu::embeddMolecules(MoleculeListClass *molecules) {
-  molecule *srcmol = NULL, *destmol = NULL;
-  Dialog *dialog = UIFactory::getInstance().makeDialog();
-  dialog->queryMolecule("molecule-by-id",&destmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
-  dialog->queryMolecule("molecule-by-id",&srcmol, MapOfActions::getInstance().getDescription("molecule-by-id"));
-  if(dialog->display()) {
-    molecules->EmbedMerge(destmol, srcmol);
-  }
-  else {
-    Log() << Verbose(0) << "embedding of molecules canceled" << endl;
-  }
-
-
-}
-
-void oldmenu::multiMergeMolecules(MoleculeListClass *molecules) {
-  int nr;
-  molecule *mol = NULL;
-  do {
-    Log() << Verbose(0) << "Enter index of molecule to merge into: ";
-    cin >> nr;
-    mol = molecules->ReturnIndex(nr);
-  } while ((mol == NULL) && (nr != -1));
-  if (nr != -1) {
-    int N = molecules->ListOfMolecules.size()-1;
-    int *src = new int(N);
-    for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
-      if ((*ListRunner)->IndexNr != nr)
-        src[N++] = (*ListRunner)->IndexNr;
-    molecules->SimpleMultiMerge(mol, src, N);
-    delete[](src);
-  }
-}
-
-void oldmenu::simpleMergeMolecules(MoleculeListClass *molecules) {
-  int src, dest;
-  molecule *srcmol = NULL, *destmol = NULL;
-  {
-    do {
-      Log() << Verbose(0) << "Enter index of destination molecule: ";
-      cin >> dest;
-      destmol = molecules->ReturnIndex(dest);
-    } while ((destmol == NULL) && (dest != -1));
-    do {
-      Log() << Verbose(0) << "Enter index of source molecule to merge into: ";
-      cin >> src;
-      srcmol = molecules->ReturnIndex(src);
-    } while ((srcmol == NULL) && (src != -1));
-    if ((src != -1) && (dest != -1))
-      molecules->SimpleMerge(srcmol, destmol);
-  }
-}
-
-/** Submenu for merging molecules.
- * \param *periode periodentafel
- * \param *molecules list of molecules to add to
- */
-void oldmenu::MergeMolecules(periodentafel *periode, MoleculeListClass *molecules)
-{
-  TextMenu *MergeMoleculesMenu = new TextMenu(Log() << Verbose(0), "Merge Molecules");
-
-  Action *simpleAddAction = new MethodAction("simpleAddAction",boost::bind(&oldmenu::SimpleAddMolecules,this,molecules),false);
-  new ActionMenuItem('a',"simple add of one molecule to another",MergeMoleculesMenu,simpleAddAction);
-
-  Action *embeddAction = new MethodAction("embeddAction",boost::bind(&oldmenu::embeddMolecules,this,molecules),false);
-  new ActionMenuItem('e',"embedding merge of two molecules",MergeMoleculesMenu,embeddAction);
-
-  Action *multiMergeAction = new MethodAction("multiMergeAction",boost::bind(&oldmenu::multiMergeMolecules,this,molecules),false);
-  new ActionMenuItem('m',"multi-merge of all molecules",MergeMoleculesMenu,multiMergeAction);
-
-  Action *scatterMergeAction = new ErrorAction("scatterMergeAction","Not Implemented yet",false);
-  new ActionMenuItem('s',"scatter merge of two molecules",MergeMoleculesMenu,scatterMergeAction);
-
-  Action *simpleMergeAction = new MethodAction("simpleMergeAction",boost::bind(&oldmenu::simpleMergeMolecules,this,molecules),false);
-  new ActionMenuItem('t',"simple merge of two molecules",MergeMoleculesMenu,simpleMergeAction);
-
-  Action *returnAction = new MethodAction("returnAction",boost::bind(&TextMenu::doQuit,MergeMoleculesMenu),false);
-  MenuItem *returnItem = new ActionMenuItem('q',"return to Main menu",MergeMoleculesMenu,returnAction);
-
-  MergeMoleculesMenu->addDefault(returnItem);
-
-  MergeMoleculesMenu->display();
-};
-
-
-/********************************************** Test routine **************************************/
-
-/** Is called always as option 'T' in the menu.
- * \param *molecules list of molecules
- */
-void oldmenu::testroutine(MoleculeListClass *molecules)
-{
-  // the current test routine checks the functionality of the KeySet&Graph concept:
-  // We want to have a multiindex (the KeySet) describing a unique subgraph
-  int i, comp, counter=0;
-
-  // create a clone
-  molecule *mol = NULL;
-  if (molecules->ListOfMolecules.size() != 0) // clone
-    mol = (molecules->ListOfMolecules.front())->CopyMolecule();
-  else {
-    eLog() << Verbose(0) << "I don't have anything to test on ... ";
-    performCriticalExit();
-    return;
-  }
-
-  // generate some KeySets
-  Log() << Verbose(0) << "Generating KeySets." << endl;
-  KeySet TestSets[mol->getAtomCount()+1];
-  i=1;
-  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
-    for (int j=0;j<i;j++) {
-      TestSets[j].insert((*iter)->nr);
-    }
-    i++;
-  }
-  Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl;
-  KeySetTestPair test;
-  molecule::const_iterator iter = mol->begin();
-  if (iter != mol->end()) {
-    test = TestSets[mol->getAtomCount()-1].insert((*iter)->nr);
-    if (test.second) {
-      Log() << Verbose(1) << "Insertion worked?!" << endl;
-    } else {
-      Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;
-    }
-  } else {
-    eLog() << Verbose(1) << "No atoms to test double insertion." << endl;
-  }
-
-  // constructing Graph structure
-  Log() << Verbose(0) << "Generating Subgraph class." << endl;
-  Graph Subgraphs;
-
-  // insert KeySets into Subgraphs
-  Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl;
-  for (int j=0;j<mol->getAtomCount();j++) {
-    Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.)));
-  }
-  Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl;
-  GraphTestPair test2;
-  test2 = Subgraphs.insert(GraphPair (TestSets[mol->getAtomCount()],pair<int, double>(counter++, 1.)));
-  if (test2.second) {
-    Log() << Verbose(1) << "Insertion worked?!" << endl;
-  } else {
-    Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl;
-  }
-
-  // show graphs
-  Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl;
-  Graph::iterator A = Subgraphs.begin();
-  while (A !=  Subgraphs.end()) {
-    Log() << Verbose(0) << (*A).second.first << ": ";
-    KeySet::iterator key = (*A).first.begin();
-    comp = -1;
-    while (key != (*A).first.end()) {
-      if ((*key) > comp)
-        Log() << Verbose(0) << (*key) << " ";
-      else
-        Log() << Verbose(0) << (*key) << "! ";
-      comp = (*key);
-      key++;
-    }
-    Log() << Verbose(0) << endl;
-    A++;
-  }
-  World::getInstance().destroyMolecule(mol);
-};
-
-oldmenu::oldmenu()
-{
-  // TODO Auto-generated constructor stub
-}
-
-oldmenu::~oldmenu()
-{
-  // TODO Auto-generated destructor stub
-}
Index: c/Legacy/oldmenu.hpp
===================================================================
--- src/Legacy/oldmenu.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/** \file menu.hpp
- * The class in this file is responsible for displaying the menu and enabling choices.
- *
- * This class is currently being refactored. Functions were copied from builder.cpp and are
- * to be imported into the menu class.
- *
- */
-
-#ifndef MENU_H_
-#define MENU_H_
-
-
-class MoleculeListClass;
-class periodentafel;
-class config;
-class molecule;
-
-class oldmenu
-{
-public:
-  oldmenu();
-  virtual ~oldmenu();
-
-  // methods taken from ManipulateMoleculse submenu
-  void duplicateCell(MoleculeListClass *molecules, config *configuration);
-
-  // methods taken from MergeMolecules submenu
-  void SimpleAddMolecules(MoleculeListClass *molecules);
-  void embeddMolecules(MoleculeListClass *molecules);
-  void multiMergeMolecules(MoleculeListClass *molecules);
-  void simpleMergeMolecules(MoleculeListClass *molecules);
-
-  void AddAtoms(periodentafel *, molecule *);
-  void AlignAtoms(periodentafel *, molecule *);
-  void CenterAtoms(molecule *);
-  void FragmentAtoms(molecule *, config *);
-  void ManipulateAtoms(periodentafel *, MoleculeListClass *, config *);
-  void MeasureAtoms(periodentafel *, molecule *, config *);
-  void MergeMolecules(periodentafel *, MoleculeListClass *);
-  void ManipulateMolecules(periodentafel *, MoleculeListClass *, config *);
-  void MirrorAtoms(molecule *);
-  void RemoveAtoms(molecule *);
-  void testroutine(MoleculeListClass *);
-};
-
-#endif /* MENU_H_ */
Index: c/Line.cpp
===================================================================
--- src/Line.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,241 +1,0 @@
-/*
- * Line.cpp
- *
- *  Created on: Apr 30, 2010
- *      Author: crueger
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Line.hpp"
-
-#include <cmath>
-
-#include "vector.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
-#include "gslmatrix.hpp"
-#include "info.hpp"
-#include "Exceptions/LinearDependenceException.hpp"
-#include "Exceptions/SkewException.hpp"
-#include "Plane.hpp"
-
-using namespace std;
-
-Line::Line(const Vector &_origin, const Vector &_direction) :
-  direction(new Vector(_direction))
-{
-  direction->Normalize();
-  origin.reset(new Vector(_origin.partition(*direction).second));
-}
-
-Line::Line(const Line &src) :
-  origin(new Vector(*src.origin)),
-  direction(new Vector(*src.direction))
-{}
-
-Line::~Line()
-{}
-
-
-double Line::distance(const Vector &point) const{
-  // get any vector from line to point
-  Vector helper = point - *origin;
-  // partition this vector along direction
-  // the residue points from the line to the point
-  return helper.partition(*direction).second.Norm();
-}
-
-Vector Line::getClosestPoint(const Vector &point) const{
-  // get any vector from line to point
-  Vector helper = point - *origin;
-  // partition this vector along direction
-  // add only the part along the direction
-  return *origin + helper.partition(*direction).first;
-}
-
-Vector Line::getDirection() const{
-  return *direction;
-}
-
-Vector Line::getOrigin() const{
-  return *origin;
-}
-
-vector<Vector> Line::getPointsOnLine() const{
-  vector<Vector> res;
-  res.reserve(2);
-  res.push_back(*origin);
-  res.push_back(*origin+*direction);
-  return res;
-}
-
-/** Calculates the intersection of the two lines that are both on the same plane.
- * This is taken from Weisstein, Eric W. "Line-Line Intersection." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/Line-LineIntersection.html
- * \param *out output stream for debugging
- * \param *Line1a first vector of first line
- * \param *Line1b second vector of first line
- * \param *Line2a first vector of second line
- * \param *Line2b second vector of second line
- * \return true - \a this will contain the intersection on return, false - lines are parallel
- */
-Vector Line::getIntersection(const Line& otherLine) const{
-  Info FunctionInfo(__func__);
-
-  pointset line1Points = getPointsOnLine();
-
-  Vector Line1a = line1Points[0];
-  Vector Line1b = line1Points[1];
-
-  pointset line2Points = otherLine.getPointsOnLine();
-
-  Vector Line2a = line2Points[0];
-  Vector Line2b = line2Points[1];
-
-  Vector res;
-
-  auto_ptr<GSLMatrix> M = auto_ptr<GSLMatrix>(new GSLMatrix(4,4));
-
-  M->SetAll(1.);
-  for (int i=0;i<3;i++) {
-    M->Set(0, i, Line1a[i]);
-    M->Set(1, i, Line1b[i]);
-    M->Set(2, i, Line2a[i]);
-    M->Set(3, i, Line2b[i]);
-  }
-
-  //Log() << Verbose(1) << "Coefficent matrix is:" << endl;
-  //for (int i=0;i<4;i++) {
-  //  for (int j=0;j<4;j++)
-  //    cout << "\t" << M->Get(i,j);
-  //  cout << endl;
-  //}
-  if (fabs(M->Determinant()) > MYEPSILON) {
-    Log() << Verbose(1) << "Determinant of coefficient matrix is NOT zero." << endl;
-    throw SkewException(__FILE__,__LINE__);
-  }
-
-  Log() << Verbose(1) << "INFO: Line1a = " << Line1a << ", Line1b = " << Line1b << ", Line2a = " << Line2a << ", Line2b = " << Line2b << "." << endl;
-
-
-  // constuct a,b,c
-  Vector a = Line1b - Line1a;
-  Vector b = Line2b - Line2a;
-  Vector c = Line2a - Line1a;
-  Vector d = Line2b - Line1b;
-  Log() << Verbose(1) << "INFO: a = " << a << ", b = " << b << ", c = " << c << "." << endl;
-  if ((a.NormSquared() < MYEPSILON) || (b.NormSquared() < MYEPSILON)) {
-   res.Zero();
-   Log() << Verbose(1) << "At least one of the lines is ill-defined, i.e. offset equals second vector." << endl;
-   throw LinearDependenceException(__FILE__,__LINE__);
-  }
-
-  // check for parallelity
-  Vector parallel;
-  double factor = 0.;
-  if (fabs(a.ScalarProduct(b)*a.ScalarProduct(b)/a.NormSquared()/b.NormSquared() - 1.) < MYEPSILON) {
-    parallel = Line1a - Line2a;
-    factor = parallel.ScalarProduct(a)/a.Norm();
-    if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) {
-      res = Line2a;
-      Log() << Verbose(1) << "Lines conincide." << endl;
-      return res;
-    } else {
-      parallel = Line1a - Line2b;
-      factor = parallel.ScalarProduct(a)/a.Norm();
-      if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) {
-        res = Line2b;
-        Log() << Verbose(1) << "Lines conincide." << endl;
-        return res;
-      }
-    }
-    Log() << Verbose(1) << "Lines are parallel." << endl;
-    res.Zero();
-    throw LinearDependenceException(__FILE__,__LINE__);
-  }
-
-  // obtain s
-  double s;
-  Vector temp1, temp2;
-  temp1 = c;
-  temp1.VectorProduct(b);
-  temp2 = a;
-  temp2.VectorProduct(b);
-  Log() << Verbose(1) << "INFO: temp1 = " << temp1 << ", temp2 = " << temp2 << "." << endl;
-  if (fabs(temp2.NormSquared()) > MYEPSILON)
-    s = temp1.ScalarProduct(temp2)/temp2.NormSquared();
-  else
-    s = 0.;
-  Log() << Verbose(1) << "Factor s is " << temp1.ScalarProduct(temp2) << "/" << temp2.NormSquared() << " = " << s << "." << endl;
-
-  // construct intersection
-  res = a;
-  res.Scale(s);
-  res += Line1a;
-  Log() << Verbose(1) << "Intersection is at " << res << "." << endl;
-
-  return res;
-}
-
-/** Rotates the vector by an angle of \a alpha around this line.
- * \param rhs Vector to rotate
- * \param alpha rotation angle in radian
- */
-Vector Line::rotateVector(const Vector &rhs, double alpha) const{
-  Vector helper = rhs;
-
-  // translate the coordinate system so that the line goes through (0,0,0)
-  helper -= *origin;
-
-  // partition the vector into a part that gets rotated and a part that lies along the line
-  pair<Vector,Vector> parts = helper.partition(*direction);
-
-  // we just keep anything that is along the axis
-  Vector res = parts.first;
-
-  // the rest has to be rotated
-  Vector a = parts.second;
-  // we only have to do the rest, if we actually could partition the vector
-  if(!a.IsZero()){
-    // construct a vector that is orthogonal to a and direction and has length |a|
-    Vector y = a;
-    // direction is normalized, so the result has length |a|
-    y.VectorProduct(*direction);
-
-    res += cos(alpha) * a + sin(alpha) * y;
-  }
-
-  // translate the coordinate system back
-  res += *origin;
-  return res;
-}
-
-Plane Line::getOrthogonalPlane(const Vector &origin) const{
-  return Plane(getDirection(),origin);
-}
-
-std::vector<Vector> Line::getSphereIntersections() const{
-  std::vector<Vector> res;
-
-  // line is kept in normalized form, so we can skip a lot of calculations
-  double discriminant = 1-origin->NormSquared();
-  // we might have 2, 1 or 0 solutions, depending on discriminant
-  if(discriminant>=0){
-    if(discriminant==0){
-      res.push_back(*origin);
-    }
-    else{
-      Vector helper = sqrt(discriminant)*(*direction);
-      res.push_back(*origin+helper);
-      res.push_back(*origin-helper);
-    }
-  }
-  return res;
-}
-
-Line makeLineThrough(const Vector &x1, const Vector &x2){
-  if(x1==x2){
-    throw LinearDependenceException(__FILE__,__LINE__);
-  }
-  return Line(x1,x1-x2);
-}
Index: c/Line.hpp
===================================================================
--- src/Line.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Line.hpp
- *
- *  Created on: Apr 30, 2010
- *      Author: crueger
- */
-
-#ifndef LINE_HPP_
-#define LINE_HPP_
-
-#include "Space.hpp"
-
-#include <memory>
-#include <vector>
-
-class Vector;
-class Plane;
-
-class Line : public Space
-{
-public:
-  Line(const Vector &_origin, const Vector &_direction);
-  Line(const Line& _src);
-  virtual ~Line();
-
-  virtual double distance(const Vector &point) const;
-  virtual Vector getClosestPoint(const Vector &point) const;
-
-  Vector getDirection() const;
-  Vector getOrigin() const;
-
-  std::vector<Vector> getPointsOnLine() const;
-
-  Vector getIntersection(const Line& otherLine) const;
-
-  Vector rotateVector(const Vector &rhs, double alpha) const;
-
-  Plane getOrthogonalPlane(const Vector &origin) const;
-
-  std::vector<Vector> getSphereIntersections() const;
-
-private:
-  std::auto_ptr<Vector> origin;
-  std::auto_ptr<Vector> direction;
-};
-
-/**
- * Named constructor to make a line through two points
- */
-Line makeLineThrough(const Vector &x1, const Vector &x2);
-
-#endif /* LINE_HPP_ */
Index: src/LinearAlgebra/BoxVector.cpp
===================================================================
--- src/LinearAlgebra/BoxVector.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/BoxVector.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,53 @@
+/*
+ * BoxVector.cpp
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+#include <iostream>
+
+#include "LinearAlgebra/BoxVector.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
+BoxVector::BoxVector()
+{}
+
+BoxVector::~BoxVector()
+{}
+
+/** Factors given vector \a a times \a m.
+ * \param a vector
+ * \param m factor
+ * \return m * a
+ */
+BoxVector const operator*(const BoxVector& a, const double m)
+{
+  BoxVector x(a);
+  x.Scale(m);
+  return x;
+};
+
+/** Factors given vector \a a times \a m.
+ * \param m factor
+ * \param a vector
+ * \return m * a
+ */
+BoxVector const operator*(const double m, const BoxVector& a )
+{
+  BoxVector x(a);
+  x.Scale(m);
+  return x;
+};
+
+ostream& operator<<(ostream& ost, const BoxVector& m)
+{
+  ost << "(";
+  for (int i=0;i<NDIM;i++) {
+    ost << m[i];
+    if (i != 2)
+      ost << ",";
+  }
+  ost << ")";
+  return ost;
+};
Index: src/LinearAlgebra/BoxVector.hpp
===================================================================
--- src/LinearAlgebra/BoxVector.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/BoxVector.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,31 @@
+/*
+ * BoxVector.hpp
+ *
+ *  Created on: Aug 26, 2010
+ *      Author: heber
+ */
+
+#ifndef BOXVECTOR_HPP_
+#define BOXVECTOR_HPP_
+
+#include <iosfwd>
+
+#include "LinearAlgebra/Vector.hpp"
+
+/** A BoxVector is simply a Vector that adheres to the boundary conditions of
+ * the box. Is currently only needed in Dialog::query<> to distinguish between
+ * BoxVector and Vector.
+ */
+class BoxVector : public Vector
+{
+public:
+  BoxVector();
+  ~BoxVector();
+};
+
+ostream & operator << (ostream& ost, const BoxVector &m);
+const BoxVector& operator*=(BoxVector& a, const double m);
+BoxVector const operator*(const BoxVector& a, const double m);
+BoxVector const operator*(const double m, const BoxVector& a);
+
+#endif /* BOXVECTOR_HPP_ */
Index: src/LinearAlgebra/Line.cpp
===================================================================
--- src/LinearAlgebra/Line.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/Line.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,373 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * Line.cpp
+ *
+ *  Created on: Apr 30, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "LinearAlgebra/Line.hpp"
+
+#include <cmath>
+#include <iostream>
+
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/gslmatrix.hpp"
+#include "Helpers/Info.hpp"
+#include "Exceptions/LinearDependenceException.hpp"
+#include "Exceptions/SkewException.hpp"
+#include "LinearAlgebra/Plane.hpp"
+
+using namespace std;
+
+Line::Line(const Vector &_origin, const Vector &_direction) :
+  direction(new Vector(_direction))
+{
+  direction->Normalize();
+  origin.reset(new Vector(_origin.partition(*direction).second));
+}
+
+Line::Line(const Line &src) :
+  origin(new Vector(*src.origin)),
+  direction(new Vector(*src.direction))
+{}
+
+Line::~Line()
+{}
+
+Line &Line::operator=(const Line& rhs){
+  if(this!=&rhs){
+    origin.reset(new Vector(*rhs.origin));
+    direction.reset(new Vector(*rhs.direction));
+  }
+  return *this;
+}
+
+
+double Line::distance(const Vector &point) const{
+  // get any vector from line to point
+  Vector helper = point - *origin;
+  // partition this vector along direction
+  // the residue points from the line to the point
+  return helper.partition(*direction).second.Norm();
+}
+
+Vector Line::getClosestPoint(const Vector &point) const{
+  // get any vector from line to point
+  Vector helper = point - *origin;
+  // partition this vector along direction
+  // add only the part along the direction
+  return *origin + helper.partition(*direction).first;
+}
+
+Vector Line::getDirection() const{
+  return *direction;
+}
+
+Vector Line::getOrigin() const{
+  return *origin;
+}
+
+vector<Vector> Line::getPointsOnLine() const{
+  vector<Vector> res;
+  res.reserve(2);
+  res.push_back(*origin);
+  res.push_back(*origin+*direction);
+  return res;
+}
+
+/** Calculates the intersection of the two lines that are both on the same plane.
+ * This is taken from Weisstein, Eric W. "Line-Line Intersection." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/Line-LineIntersection.html
+ * \param *out output stream for debugging
+ * \param *Line1a first vector of first line
+ * \param *Line1b second vector of first line
+ * \param *Line2a first vector of second line
+ * \param *Line2b second vector of second line
+ * \return true - \a this will contain the intersection on return, false - lines are parallel
+ */
+Vector Line::getIntersection(const Line& otherLine) const{
+  Info FunctionInfo(__func__);
+
+  pointset line1Points = getPointsOnLine();
+
+  Vector Line1a = line1Points[0];
+  Vector Line1b = line1Points[1];
+
+  pointset line2Points = otherLine.getPointsOnLine();
+
+  Vector Line2a = line2Points[0];
+  Vector Line2b = line2Points[1];
+
+  Vector res;
+
+  auto_ptr<GSLMatrix> M = auto_ptr<GSLMatrix>(new GSLMatrix(4,4));
+
+  M->SetAll(1.);
+  for (int i=0;i<3;i++) {
+    M->Set(0, i, Line1a[i]);
+    M->Set(1, i, Line1b[i]);
+    M->Set(2, i, Line2a[i]);
+    M->Set(3, i, Line2b[i]);
+  }
+
+  //Log() << Verbose(1) << "Coefficent matrix is:" << endl;
+  //for (int i=0;i<4;i++) {
+  //  for (int j=0;j<4;j++)
+  //    cout << "\t" << M->Get(i,j);
+  //  cout << endl;
+  //}
+  if (fabs(M->Determinant()) > MYEPSILON) {
+    Log() << Verbose(1) << "Determinant of coefficient matrix is NOT zero." << endl;
+    throw SkewException(__FILE__,__LINE__);
+  }
+
+  Log() << Verbose(1) << "INFO: Line1a = " << Line1a << ", Line1b = " << Line1b << ", Line2a = " << Line2a << ", Line2b = " << Line2b << "." << endl;
+
+
+  // constuct a,b,c
+  Vector a = Line1b - Line1a;
+  Vector b = Line2b - Line2a;
+  Vector c = Line2a - Line1a;
+  Vector d = Line2b - Line1b;
+  Log() << Verbose(1) << "INFO: a = " << a << ", b = " << b << ", c = " << c << "." << endl;
+  if ((a.NormSquared() < MYEPSILON) || (b.NormSquared() < MYEPSILON)) {
+   res.Zero();
+   Log() << Verbose(1) << "At least one of the lines is ill-defined, i.e. offset equals second vector." << endl;
+   throw LinearDependenceException(__FILE__,__LINE__);
+  }
+
+  // check for parallelity
+  Vector parallel;
+  double factor = 0.;
+  if (fabs(a.ScalarProduct(b)*a.ScalarProduct(b)/a.NormSquared()/b.NormSquared() - 1.) < MYEPSILON) {
+    parallel = Line1a - Line2a;
+    factor = parallel.ScalarProduct(a)/a.Norm();
+    if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) {
+      res = Line2a;
+      Log() << Verbose(1) << "Lines conincide." << endl;
+      return res;
+    } else {
+      parallel = Line1a - Line2b;
+      factor = parallel.ScalarProduct(a)/a.Norm();
+      if ((factor >= -MYEPSILON) && (factor - 1. < MYEPSILON)) {
+        res = Line2b;
+        Log() << Verbose(1) << "Lines conincide." << endl;
+        return res;
+      }
+    }
+    Log() << Verbose(1) << "Lines are parallel." << endl;
+    res.Zero();
+    throw LinearDependenceException(__FILE__,__LINE__);
+  }
+
+  // obtain s
+  double s;
+  Vector temp1, temp2;
+  temp1 = c;
+  temp1.VectorProduct(b);
+  temp2 = a;
+  temp2.VectorProduct(b);
+  Log() << Verbose(1) << "INFO: temp1 = " << temp1 << ", temp2 = " << temp2 << "." << endl;
+  if (fabs(temp2.NormSquared()) > MYEPSILON)
+    s = temp1.ScalarProduct(temp2)/temp2.NormSquared();
+  else
+    s = 0.;
+  Log() << Verbose(1) << "Factor s is " << temp1.ScalarProduct(temp2) << "/" << temp2.NormSquared() << " = " << s << "." << endl;
+
+  // construct intersection
+  res = a;
+  res.Scale(s);
+  res += Line1a;
+  Log() << Verbose(1) << "Intersection is at " << res << "." << endl;
+
+  return res;
+}
+
+/** Rotates the vector by an angle of \a alpha around this line.
+ * \param rhs Vector to rotate
+ * \param alpha rotation angle in radian
+ */
+Vector Line::rotateVector(const Vector &rhs, double alpha) const{
+  Vector helper = rhs;
+
+  // translate the coordinate system so that the line goes through (0,0,0)
+  helper -= *origin;
+
+  // partition the vector into a part that gets rotated and a part that lies along the line
+  pair<Vector,Vector> parts = helper.partition(*direction);
+
+  // we just keep anything that is along the axis
+  Vector res = parts.first;
+
+  // the rest has to be rotated
+  Vector a = parts.second;
+  // we only have to do the rest, if we actually could partition the vector
+  if(!a.IsZero()){
+    // construct a vector that is orthogonal to a and direction and has length |a|
+    Vector y = a;
+    // direction is normalized, so the result has length |a|
+    y.VectorProduct(*direction);
+
+    res += cos(alpha) * a + sin(alpha) * y;
+  }
+
+  // translate the coordinate system back
+  res += *origin;
+  return res;
+}
+
+Line Line::rotateLine(const Line &rhs, double alpha) const{
+  Vector lineOrigin = rotateVector(rhs.getOrigin(),alpha);
+  Vector helper = rhs.getDirection();
+  // rotate the direction without considering the ofset
+  pair<Vector,Vector> parts = helper.partition(*direction);
+  Vector lineDirection = parts.first;
+  Vector a = parts.second;
+  if(!a.IsZero()){
+    // construct a vector that is orthogonal to a and direction and has length |a|
+    Vector y = a;
+    // direction is normalized, so the result has length |a|
+    y.VectorProduct(*direction);
+
+    lineDirection += cos(alpha) * a + sin(alpha) * y;
+  }
+  return Line(lineOrigin,lineDirection);
+}
+
+Plane Line::rotatePlane(const Plane &rhs, double alpha) const{
+  vector<Vector> points = rhs.getPointsOnPlane();
+  transform(points.begin(),
+            points.end(),
+            points.begin(),
+            boost::bind(&Line::rotateVector,this,_1,alpha));
+  return Plane(points[0],points[1],points[2]);
+}
+
+Plane Line::getOrthogonalPlane(const Vector &origin) const{
+  return Plane(getDirection(),origin);
+}
+
+std::vector<Vector> Line::getSphereIntersections() const{
+  std::vector<Vector> res;
+
+  // line is kept in normalized form, so we can skip a lot of calculations
+  double discriminant = 1-origin->NormSquared();
+  // we might have 2, 1 or 0 solutions, depending on discriminant
+  if(discriminant>=0){
+    if(discriminant==0){
+      res.push_back(*origin);
+    }
+    else{
+      Vector helper = sqrt(discriminant)*(*direction);
+      res.push_back(*origin+helper);
+      res.push_back(*origin-helper);
+    }
+  }
+  return res;
+}
+
+LinePoint Line::getLinePoint(const Vector &point) const{
+  ASSERT(isContained(point),"Line point queried for point not on line");
+  Vector helper = point - (*origin);
+  double param = helper.ScalarProduct(*direction);
+  return LinePoint(*this,param);
+}
+
+LinePoint Line::posEndpoint() const{
+  return LinePoint(*this, numeric_limits<double>::infinity());
+}
+LinePoint Line::negEndpoint() const{
+  return LinePoint(*this,-numeric_limits<double>::infinity());
+}
+
+bool operator==(const Line &x,const Line &y){
+  return *x.origin == *y.origin && *x.direction == *y.direction;
+}
+
+Line makeLineThrough(const Vector &x1, const Vector &x2){
+  if(x1==x2){
+    throw LinearDependenceException(__FILE__,__LINE__);
+  }
+  return Line(x1,x1-x2);
+}
+
+/******************************** Points on the line ********************/
+
+LinePoint::LinePoint(const LinePoint &src) :
+  line(src.line),param(src.param)
+{}
+
+LinePoint::LinePoint(const Line &_line, double _param) :
+  line(_line),param(_param)
+{}
+
+LinePoint& LinePoint::operator=(const LinePoint &src){
+  line=src.line;
+  param=src.param;
+  return *this;
+}
+
+Vector LinePoint::getPoint() const{
+  ASSERT(!isInfinite(),"getPoint() on infinite LinePoint called");
+  return (*line.origin)+param*(*line.direction);
+}
+
+Line LinePoint::getLine() const{
+  return line;
+}
+
+bool LinePoint::isInfinite() const{
+  return isPosInfinity() || isNegInfinity();
+}
+bool LinePoint::isPosInfinity() const{
+  return param == numeric_limits<double>::infinity();
+}
+bool LinePoint::isNegInfinity() const{
+  return param ==-numeric_limits<double>::infinity();
+}
+
+bool operator==(const LinePoint &x, const LinePoint &y){
+  ASSERT(x.line==y.line,"Operation on two points of different lines");
+  return x.param == y.param;
+
+}
+bool operator<(const LinePoint &x, const LinePoint &y){
+  ASSERT(x.line==y.line,"Operation on two points of different lines");
+  return x.param<y.param;
+}
+
+ostream& operator<<(ostream& ost, const Line& m)
+{
+  const Vector origin = m.getOrigin();
+  const Vector direction = m.getDirection();
+  ost << "(";
+  for (int i=0;i<NDIM;i++) {
+    ost << origin[i];
+    if (i != 2)
+      ost << ",";
+  }
+  ost << ") -> (";
+  for (int i=0;i<NDIM;i++) {
+    ost << direction[i];
+    if (i != 2)
+      ost << ",";
+  }
+  ost << ")";
+  return ost;
+};
+
Index: src/LinearAlgebra/Line.hpp
===================================================================
--- src/LinearAlgebra/Line.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/Line.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,103 @@
+/*
+ * Line.hpp
+ *
+ *  Created on: Apr 30, 2010
+ *      Author: crueger
+ */
+
+#ifndef LINE_HPP_
+#define LINE_HPP_
+
+#include "LinearAlgebra/Space.hpp"
+
+#include <iosfwd>
+#include <memory>
+#include <vector>
+
+class Vector;
+class Plane;
+class LinePoint;
+
+class Line : public Space
+{
+  friend bool operator==(const Line&,const Line&);
+  friend class LinePoint;
+public:
+  Line(const Vector &_origin, const Vector &_direction);
+  Line(const Line& _src);
+  virtual ~Line();
+
+  Line &operator=(const Line& rhs);
+
+  virtual double distance(const Vector &point) const;
+  virtual Vector getClosestPoint(const Vector &point) const;
+
+  Vector getDirection() const;
+  Vector getOrigin() const;
+
+  std::vector<Vector> getPointsOnLine() const;
+
+  Vector getIntersection(const Line& otherLine) const;
+
+  Vector rotateVector(const Vector &rhs, double alpha) const;
+  Line rotateLine(const Line &rhs, double alpha) const;
+  Plane rotatePlane(const Plane &rhs, double alpha) const;
+
+  Plane getOrthogonalPlane(const Vector &origin) const;
+
+  std::vector<Vector> getSphereIntersections() const;
+
+  LinePoint getLinePoint(const Vector&) const;
+  LinePoint posEndpoint() const;
+  LinePoint negEndpoint() const;
+
+
+
+private:
+  std::auto_ptr<Vector> origin;
+  std::auto_ptr<Vector> direction;
+};
+
+bool operator==(const Line&,const Line&);
+
+std::ostream & operator << (std::ostream& ost, const Line &m);
+
+/**
+ * Named constructor to make a line through two points
+ */
+Line makeLineThrough(const Vector &x1, const Vector &x2);
+
+/**
+ * Class for representing points on a line
+ * These objects allow comparison of points on the same line as well as specifying the
+ * infinite "endpoints" of a line.
+ */
+class LinePoint{
+  friend class Line;
+  friend bool operator==(const LinePoint&, const LinePoint&);
+  friend bool operator<(const LinePoint&, const LinePoint&);
+public:
+  LinePoint(const LinePoint&);
+  LinePoint& operator=(const LinePoint&);
+  Vector getPoint() const;
+  Line getLine() const;
+  bool isInfinite() const;
+  bool isPosInfinity() const;
+  bool isNegInfinity() const;
+
+private:
+  LinePoint(const Line&,double);
+  Line line;
+  double param;
+};
+
+bool operator==(const LinePoint&, const LinePoint&);
+bool operator<(const LinePoint&, const LinePoint&);
+
+inline bool operator!= (const LinePoint& x, const LinePoint& y) { return !(x==y); }
+inline bool operator>  (const LinePoint& x, const LinePoint& y) { return y<x; }
+inline bool operator<= (const LinePoint& x, const LinePoint& y) { return !(y<x); }
+inline bool operator>= (const LinePoint& x, const LinePoint& y) { return !(x<y); }
+
+
+#endif /* LINE_HPP_ */
Index: src/LinearAlgebra/LineSegment.cpp
===================================================================
--- src/LinearAlgebra/LineSegment.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/LineSegment.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,90 @@
+/*
+ * LineSegment.cpp
+ *
+ *  Created on: Jul 22, 2010
+ *      Author: crueger
+ */
+
+#include "LinearAlgebra/LineSegment.hpp"
+#include "Helpers/Assert.hpp"
+
+#include "Line.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
+using namespace std;
+
+LineSegment::LineSegment(const Vector &point1,const Vector &point2){
+  line.reset(new Line(point1,point1-point2));
+  begin.reset(new LinePoint(line->getLinePoint(point1)));
+  end.reset(new LinePoint(line->getLinePoint(point2)));
+}
+
+LineSegment::LineSegment(const LinePoint &lp1,const LinePoint &lp2){
+  ASSERT(lp1.getLine()==lp2.getLine(),"Cannot make a lineSegment with two different lines");
+  line.reset(new Line(lp1.getLine()));
+  begin.reset(new LinePoint(lp1));
+  end.reset(new LinePoint(lp2));
+}
+LineSegment::LineSegment(const LineSegment &src)
+{
+  line.reset(new Line(*src.line));
+  begin.reset(new LinePoint(*src.begin));
+  end.reset(new LinePoint(*src.end));
+}
+LineSegment::~LineSegment(){
+}
+LineSegment &LineSegment::operator=(const LineSegment &src){
+  if(this!=&src){
+    lineptr _line(new Line(*src.line));
+    pointptr _begin(new LinePoint(*src.begin));
+    pointptr _end(new LinePoint(*src.end));
+    line = _line;
+    begin = _begin;
+    end = _end;
+  }
+  return *this;
+}
+
+bool LineSegment::isContained(const Vector &point) const{
+  if(!line->isContained(point)){
+    return false;
+  }
+  LinePoint lp = line->getLinePoint(point);
+  return *begin <= lp && lp <= *end;
+}
+
+bool LineSegment::isContained(const LinePoint &lp) const{
+  ASSERT(lp.getLine()==*line,"Cannot compare Linepoints from different Lines");
+  return *begin <= lp && lp <= *end;
+}
+
+bool LineSegment::overlaps(const LineSegment &lineSeg) const{
+  ASSERT(*lineSeg.line == *line,"Cannot compare Linesegments from different Lines");
+  // mutual comparison of endpoints
+  return lineSeg.isContained(*end) || isContained(*lineSeg.end);
+}
+
+bool LineSegment::hasZeroLength() const{
+  return *begin==*end;
+}
+
+LinePoint LineSegment::getBegin() const{
+  return *begin;
+}
+
+LinePoint LineSegment::getEnd() const{
+  return *end;
+}
+
+Line LineSegment::getLine() const{
+  return *line;
+}
+
+bool operator==(const LineSegment &x,const LineSegment &y){
+  ASSERT(*x.line==*y.line,"Comparison of Linesegments from different lines");
+  return *x.begin == *y.begin && *x.end == *y.end;
+}
+bool operator<(const LineSegment &x,const LineSegment &y){
+  ASSERT(*x.line==*y.line,"Comparison of Linesegments from different lines");
+  return (*x.begin != *y.begin) ? *x.begin<*y.begin:*x.end<*y.end;
+}
Index: src/LinearAlgebra/LineSegment.hpp
===================================================================
--- src/LinearAlgebra/LineSegment.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/LineSegment.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,48 @@
+/*
+ * LineSegment.hpp
+ *
+ *  Created on: Jul 22, 2010
+ *      Author: crueger
+ */
+
+#ifndef LINESEGMENT_HPP_
+#define LINESEGMENT_HPP_
+
+#include <memory>
+
+class Vector;
+class Line;
+class LinePoint;
+
+class LineSegment
+{
+  friend bool operator==(const LineSegment&,const LineSegment&);
+  friend bool operator<(const LineSegment&,const LineSegment&);
+
+  typedef std::auto_ptr<LinePoint> pointptr;
+  typedef std::auto_ptr<Line> lineptr;
+public:
+  LineSegment(const Vector&,const Vector&);
+  LineSegment(const LinePoint&,const LinePoint&);
+  LineSegment(const LineSegment&);
+  virtual ~LineSegment();
+  LineSegment &operator=(const LineSegment&);
+
+  bool isContained(const Vector &) const;
+  bool isContained(const LinePoint &) const;
+  bool overlaps(const LineSegment&) const;
+  bool hasZeroLength() const;
+  LinePoint getBegin() const;
+  LinePoint getEnd() const;
+  Line getLine() const;
+
+private:
+  pointptr begin;
+  pointptr end;
+  lineptr line;
+};
+
+bool operator==(const LineSegment&,const LineSegment&);
+bool operator<(const LineSegment&,const LineSegment&);
+
+#endif /* LINESEGMENT_HPP_ */
Index: src/LinearAlgebra/LineSegmentSet.cpp
===================================================================
--- src/LinearAlgebra/LineSegmentSet.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/LineSegmentSet.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,223 @@
+/*
+ * LineSegmentSet.cpp
+ *
+ *  Created on: Jul 22, 2010
+ *      Author: crueger
+ */
+
+#include "LinearAlgebra/LineSegmentSet.hpp"
+
+#include "Helpers/Assert.hpp"
+#include "LinearAlgebra/Line.hpp"
+#include "LinearAlgebra/LineSegment.hpp"
+
+#include "Helpers/Range.hpp"
+
+#include <algorithm>
+#include <boost/bind.hpp>
+
+using namespace std;
+
+LineSegmentSet::LineSegmentSet(const Line &_line) :
+  line(new Line(_line))
+{}
+
+LineSegmentSet::LineSegmentSet(const LineSegmentSet &src)
+{
+  line.reset(new Line(*src.line));
+  segments=src.segments;
+}
+
+LineSegmentSet& LineSegmentSet::operator=(const LineSegmentSet &src){
+  if(this!=&src){
+    lineptr _line(new Line(*src.line));
+    segments=src.segments;
+    line = _line;
+  }
+  return *this;
+}
+
+void LineSegmentSet::insert(const LineSegment &lineSeg){
+  ASSERT(*line==lineSeg.getLine(),"Inserted LineSegment was not from the line of the set");
+  // we might get messed up sets
+  if(lineSeg.hasZeroLength()){
+    // nothing to do here... there is practically nothing that is being inserted
+    return;
+  }
+  if(lineSeg.getBegin()>lineSeg.getEnd()){
+    // just insert the reversed set
+    insert(LineSegment(lineSeg.getEnd(),lineSeg.getBegin()));
+    return;
+  }
+  // get the first overlapping segment
+  set_t::iterator begin = find_if(segments.begin(),
+                                  segments.end(),
+                                  boost::bind(&LineSegment::overlaps,lineSeg,_1));
+  // see if we have overlapping segments
+  if(begin==segments.end()){
+    // no overlapping segments... we can just insert and get going
+    segments.insert(lineSeg);
+    return;
+  }
+  // get the last overlapping segment
+  set_t::iterator last = begin;
+  while(last!=segments.end() && lineSeg.overlaps(*last))++last;
+  last--;
+  // all segments between last and end now overlap and both are valid iterators
+  ASSERT(begin!=segments.end() && last!=segments.end(),"ERROR: last or begin are behind end of set");
+  // get the endpoints of the section
+  LinePoint beginPoint = min(begin->getBegin(),lineSeg.getBegin());
+  LinePoint endPoint = max(last->getEnd(),lineSeg.getEnd());
+  LineSegment insertSeg(beginPoint,endPoint);
+  // delete all overlapping segments
+  last++;
+  segments.erase(begin,last);
+  // insert the new combined segments
+  segments.insert(insertSeg);
+}
+
+void LineSegmentSet::erase(const LineSegment &lineSeg){
+  ASSERT(*line==lineSeg.getLine(),"Erased LineSegment was not from the line of the set");
+  // we might get messed up sets
+  if(lineSeg.hasZeroLength()){
+    // nothing to do here... there is practically nothing that is being erase
+    return;
+  }
+  if(lineSeg.getBegin()>lineSeg.getEnd()){
+    // just erase the reversed set
+    erase(LineSegment(lineSeg.getEnd(),lineSeg.getBegin()));
+    return;
+  }
+  // get the first overlapping segment
+  set_t::iterator begin = find_if(segments.begin(),
+                                  segments.end(),
+                                  boost::bind(&LineSegment::overlaps,lineSeg,_1));
+  if(begin==segments.end()){
+    // nothing to erase
+    return;
+  }
+  // get the last overlapping segment
+  set_t::iterator last = begin;
+  while(last!=segments.end() && lineSeg.overlaps(*last))++last;
+  last--;
+  // at the ends there might be two overlapping lineSegments of which parts remain
+  LineSegment beginSegment(begin->getBegin(),lineSeg.getBegin());
+  LineSegment endSegment(lineSeg.getEnd(),last->getEnd());
+  // erase all elements that have been overlapped
+  last++;
+  segments.erase(begin,last);
+  // insert the two segments if they still have space left
+  if(beginSegment.getBegin()<beginSegment.getEnd())
+    segments.insert(beginSegment);
+  if(endSegment.getBegin()<endSegment.getEnd())
+      segments.insert(endSegment);
+}
+
+LineSegmentSet::iterator LineSegmentSet::begin(){
+  return segments.begin();
+}
+LineSegmentSet::const_iterator LineSegmentSet::begin() const{
+  return segments.begin();
+}
+LineSegmentSet::iterator LineSegmentSet::end(){
+  return segments.end();
+}
+LineSegmentSet::const_iterator LineSegmentSet::end() const{
+  return segments.end();
+}
+
+bool LineSegmentSet::isContained(const Vector &point) const{
+  if(!line->isContained(point)){
+    return false;
+  }
+  LinePoint lp = line->getLinePoint(point);
+  for(set_t::iterator iter=segments.begin();iter!=segments.end();++iter){
+    if(iter->isContained(point)){
+      return true;
+    }
+    if(iter->getBegin()>lp){
+      break;
+    }
+  }
+  return false;
+}
+
+Line LineSegmentSet::getLine(){
+  return *line;
+}
+
+LineSegmentSet merge(const LineSegmentSet &x,const LineSegmentSet &y){
+  typedef range<LineSegmentSet::set_t::iterator> itRange;
+  ASSERT(*x.line==*y.line,"Lines of merges LineSegmentSets don't match");
+  LineSegmentSet res(*x.line);
+  // standard merge algorithm with a few modifications to deal with overlapping lines
+  itRange small(x.segments.begin(),x.segments.end());
+  itRange large(y.segments.begin(),y.segments.end());
+  while(small.first!=small.last && large.first != large.last){
+    if(large.first->getBegin()<small.first->getBegin()){
+      itRange tmp = small;
+      small = large;
+      large = tmp;
+    }
+
+    if(small.first->overlaps(*large.first)){
+      // get all overlapping segments from larger part
+      LineSegmentSet::set_t::iterator last = large.first;
+      while(last!=large.last && small.first->overlaps(*last))++last;
+      last--;
+      // get the endpoint of the new segment to be inserted
+      LinePoint lpEnd = max(small.first->getEnd(),last->getEnd());
+      res.segments.insert(LineSegment(small.first->getBegin(),lpEnd));
+      large.first=last; ++large.first; // all overlapping segments of the larger part have been dealt with
+    }
+    else{
+      // no overlap, we can just insert
+      res.segments.insert(*small.first);
+    }
+    ++small.first;
+  }
+  // deal with the rest of the iterator
+  // we don't know which one is done, so we just do both
+  res.segments.insert(small.first,small.last);
+  res.segments.insert(large.first,large.last);
+  return res;
+}
+
+LineSegmentSet intersect(const LineSegmentSet &x, const LineSegmentSet &y){
+  typedef range<LineSegmentSet::set_t::iterator> itRange;
+  ASSERT(*x.line==*y.line,"Lines of merges LineSegmentSets don't match");
+  LineSegmentSet res(*x.line);
+  itRange small(x.segments.begin(),x.segments.end());
+  itRange large(y.segments.begin(),y.segments.end());
+
+  while(small.first!=small.last && large.first != large.last){
+    if(large.first->getBegin()<small.first->getBegin()){
+      itRange tmp = small;
+      small = large;
+      large = tmp;
+    }
+    // add overlapping parts of segments from large
+    while(large.first!=large.last && small.first->overlaps(*large.first)){
+      LinePoint lpEnd = min(small.first->getEnd(),large.first->getEnd());
+      res.segments.insert(LineSegment(large.first->getBegin(),lpEnd));
+      ++large.first;
+    }
+    ++small.first;
+  }
+  return res;
+}
+
+LineSegmentSet invert(const LineSegmentSet &x){
+  LineSegmentSet res(*x.line);
+  LinePoint lpBegin = x.line->negEndpoint();
+  for(LineSegmentSet::set_t::iterator iter = x.segments.begin();iter!=x.segments.end();++iter){
+    if(lpBegin!=iter->getBegin())
+      res.segments.insert(LineSegment(lpBegin,iter->getBegin()));
+    // the end of the current scanned segment is the beginning of the next one to insert
+    lpBegin = iter->getEnd();
+  }
+  // we might need to extend to infinity
+  if(!lpBegin.isPosInfinity())
+    res.segments.insert(LineSegment(lpBegin,x.line->posEndpoint()));
+  return res;
+}
Index: src/LinearAlgebra/LineSegmentSet.hpp
===================================================================
--- src/LinearAlgebra/LineSegmentSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/LineSegmentSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,52 @@
+/*
+ * LineSegmentSet.hpp
+ *
+ *  Created on: Jul 22, 2010
+ *      Author: crueger
+ */
+
+#ifndef LINESEGMENTSET_HPP_
+#define LINESEGMENTSET_HPP_
+
+#include <memory>
+#include <set>
+
+class Vector;
+class Line;
+class LineSegment;
+
+class LineSegmentSet {
+  friend LineSegmentSet merge(const LineSegmentSet&,const LineSegmentSet&);
+  friend LineSegmentSet intersect(const LineSegmentSet&, const LineSegmentSet&);
+  friend LineSegmentSet invert(const LineSegmentSet &);
+
+  typedef std::set<LineSegment> set_t;
+  typedef std::auto_ptr<Line> lineptr;
+public:
+  typedef set_t::iterator iterator;
+  typedef set_t::const_iterator const_iterator;
+
+  LineSegmentSet(const Line&);
+  LineSegmentSet(const LineSegmentSet&);
+  LineSegmentSet& operator=(const LineSegmentSet&);
+
+  void insert(const LineSegment&);
+  void erase(const LineSegment&);
+
+  iterator       begin();
+  const_iterator begin() const;
+  iterator       end();
+  const_iterator end()   const;
+
+  bool isContained(const Vector &) const;
+  Line getLine();
+private:
+  lineptr line;
+  set_t segments;
+};
+
+LineSegmentSet merge(const LineSegmentSet&,const LineSegmentSet&);
+LineSegmentSet intersect(const LineSegmentSet&, const LineSegmentSet&);
+LineSegmentSet invert(const LineSegmentSet &);
+
+#endif /* LINESEGMENTSET_HPP_ */
Index: src/LinearAlgebra/Makefile.am
===================================================================
--- src/LinearAlgebra/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,89 @@
+# PLEASE adhere to the alphabetical ordering in this Makefile!
+# Also indentation by a single tab
+
+INCLUDES = -I$(top_srcdir)/src
+
+AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
+# Position-Independent Code necessary for shared library
+AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
+
+LINALGSOURCE = \
+  ${HELPERSOURCE} \
+  BoxVector.cpp \
+  gslmatrix.cpp \
+  gslvector.cpp \
+  Line.cpp \
+  LineSegment.cpp \
+  LineSegmentSet.cpp \
+  linearsystemofequations.cpp \
+  Matrix.cpp \
+  Plane.cpp \
+  Space.cpp \
+  vector_ops.cpp \
+  Vector.cpp \
+  VectorInterface.cpp
+			   
+LINALGHEADER = \
+  BoxVector.hpp \
+  gslmatrix.hpp \
+  gslvector.hpp \
+  Line.hpp \
+  LineSegment.hpp \
+  LineSegmentSet.hpp \
+  linearsystemofequations.hpp \
+  Matrix.hpp \
+  Plane.hpp \
+  Space.hpp \
+  vector_ops.hpp \
+  Vector.hpp \
+  VectorInterface.hpp
+
+
+lib_LTLIBRARIES = libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la
+libMolecuilderLinearAlgebra_includedir = $(includedir)/molecuilder-$(MOLECUILDER_API_VERSION)/Actions/
+libMolecuilderLinearAlgebra_libs = ../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la $(GSL_LIBS)
+nobase_libMolecuilderLinearAlgebra_include_HEADERS = ${LINALGHEADER}
+
+## Define the source file list for the "libexample-@MOLECUILDER_API_VERSION@.la"
+## target.  Note that @MOLECUILDER_API_VERSION@ is not interpreted by Automake and
+## will therefore be treated as if it were literally part of the target name,
+## and the variable name derived from that.
+## The file extension .cc is recognized by Automake, and makes it produce
+## rules which invoke the C++ compiler to produce a libtool object file (.lo)
+## from each source file.  Note that it is not necessary to list header files
+## which are already listed elsewhere in a _HEADERS variable assignment.
+libMolecuilderLinearAlgebra_@MOLECUILDER_API_VERSION@_la_SOURCES = ${LINALGSOURCE}
+
+## Instruct libtool to include ABI version information in the generated shared
+## library file (.so).  The library ABI version is defined in configure.ac, so
+## that all version information is kept in one place.
+libMolecuilderLinearAlgebra_@MOLECUILDER_API_VERSION@_la_LDFLAGS = -version-info $(MOLECUILDER_SO_VERSION)
+
+## The generated configuration header is installed in its own subdirectory of
+## $(libdir).  The reason for this is that the configuration information put
+## into this header file describes the target platform the installed library
+## has been built for.  Thus the file must not be installed into a location
+## intended for architecture-independent files, as defined by the Filesystem
+## Hierarchy Standard (FHS).
+## The nodist_ prefix instructs Automake to not generate rules for including
+## the listed files in the distribution on 'make dist'.  Files that are listed
+## in _HEADERS variables are normally included in the distribution, but the
+## configuration header file is generated at configure time and should not be
+## shipped with the source tarball.
+libMolecuilderLinearAlgebra_libincludedir = $(libdir)/molecuilder-$(MOLECUILDER_API_VERSION)/include
+nodist_libMolecuilderLinearAlgebra_libinclude_HEADERS = $(top_builddir)/libmolecuilder_config.h
+
+## Install the generated pkg-config file (.pc) into the expected location for
+## architecture-dependent package configuration information.  Occasionally,
+## pkg-config files are also used for architecture-independent data packages,
+## in which case the correct install location would be $(datadir)/pkgconfig.
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc
+
+unity.cpp:
+	echo "" >  unity.cpp; \
+	list='$(LINALGSOURCE)'; for file in $$list; do \
+	  echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
+	done;
+	
+MOSTLYCLEANFILES = unity.cpp
Index: src/LinearAlgebra/Matrix.cpp
===================================================================
--- src/LinearAlgebra/Matrix.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/Matrix.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,357 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * Matrix.cpp
+ *
+ *  Created on: Jun 25, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "LinearAlgebra/Matrix.hpp"
+#include "Helpers/Assert.hpp"
+#include "Exceptions/NotInvertibleException.hpp"
+#include "Helpers/fast_functions.hpp"
+#include "Helpers/Assert.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "VectorContent.hpp"
+#include "MatrixContent.hpp"
+
+#include <gsl/gsl_blas.h>
+#include <gsl/gsl_eigen.h>
+#include <gsl/gsl_matrix.h>
+#include <gsl/gsl_multimin.h>
+#include <gsl/gsl_vector.h>
+#include <cmath>
+#include <iostream>
+
+using namespace std;
+
+Matrix::Matrix()
+{
+  content = new MatrixContent();
+  content->content = gsl_matrix_calloc(NDIM, NDIM);
+  createViews();
+}
+
+Matrix::Matrix(const double* src){
+  content = new MatrixContent();
+  content->content = gsl_matrix_alloc(NDIM, NDIM);
+  set(0,0, src[0]);
+  set(1,0, src[1]);
+  set(2,0, src[2]);
+
+  set(0,1, src[3]);
+  set(1,1, src[4]);
+  set(2,1, src[5]);
+
+  set(0,2, src[6]);
+  set(1,2, src[7]);
+  set(2,2, src[8]);
+  createViews();
+}
+
+Matrix::Matrix(const Matrix &src){
+  content = new MatrixContent();
+  content->content = gsl_matrix_alloc(NDIM, NDIM);
+  gsl_matrix_memcpy(content->content,src.content->content);
+  createViews();
+}
+
+Matrix::Matrix(MatrixContent* _content) :
+  content(_content)
+{
+  createViews();
+}
+
+Matrix::~Matrix()
+{
+  // delete all views
+  for(int i=NDIM;i--;){
+    delete rows_ptr[i];
+  }
+  for(int i=NDIM;i--;){
+    delete columns_ptr[i];
+  }
+  delete diagonal_ptr;
+  gsl_matrix_free(content->content);
+  delete content;
+}
+
+void Matrix::createViews(){
+  // create row views
+  for(int i=NDIM;i--;){
+    VectorContent *rowContent = new VectorViewContent(gsl_matrix_row(content->content,i));
+    rows_ptr[i] = new Vector(rowContent);
+  }
+  // create column views
+  for(int i=NDIM;i--;){
+    VectorContent *columnContent = new VectorViewContent(gsl_matrix_column(content->content,i));
+    columns_ptr[i] = new Vector(columnContent);
+  }
+  // create diagonal view
+  VectorContent *diagonalContent = new VectorViewContent(gsl_matrix_diagonal(content->content));
+  diagonal_ptr = new Vector(diagonalContent);
+}
+
+void Matrix::one(){
+  for(int i=NDIM;i--;){
+    for(int j=NDIM;j--;){
+      set(i,j,i==j);
+    }
+  }
+}
+
+void Matrix::zero(){
+  for(int i=NDIM;i--;){
+    for(int j=NDIM;j--;){
+      set(i,j,0.);
+    }
+  }
+}
+
+void Matrix::rotation(const double x, const double y, const double z)
+{
+  set(0,0, cos(y)*cos(z));
+  set(0,1, cos(z)*sin(x)*sin(y) - cos(x)*sin(z));
+  set(0,2, cos(x)*cos(z)*sin(y) + sin(x) * sin(z));
+  set(1,0, cos(y)*sin(z));
+  set(1,1, cos(x)*cos(z) + sin(x)*sin(y)*sin(z));
+  set(1,2, -cos(z)*sin(x) + cos(x)*sin(y)*sin(z));
+  set(2,0, -sin(y));
+  set(2,1, cos(y)*sin(x));
+  set(2,2, cos(x)*cos(y));
+}
+
+Matrix &Matrix::operator=(const Matrix &src){
+  if(&src!=this){
+    gsl_matrix_memcpy(content->content,src.content->content);
+  }
+  return *this;
+}
+
+const Matrix &Matrix::operator+=(const Matrix &rhs){
+  gsl_matrix_add(content->content, rhs.content->content);
+  return *this;
+}
+
+const Matrix &Matrix::operator-=(const Matrix &rhs){
+  gsl_matrix_sub(content->content, rhs.content->content);
+  return *this;
+}
+
+const Matrix &Matrix::operator*=(const Matrix &rhs){
+  (*this) = (*this)*rhs;
+  return *this;
+}
+
+const Matrix Matrix::operator+(const Matrix &rhs) const{
+  Matrix tmp = *this;
+  tmp+=rhs;
+  return tmp;
+}
+
+const Matrix Matrix::operator-(const Matrix &rhs) const{
+  Matrix tmp = *this;
+  tmp-=rhs;
+  return tmp;
+}
+
+const Matrix Matrix::operator*(const Matrix &rhs) const{
+  gsl_matrix *res = gsl_matrix_alloc(NDIM, NDIM);
+  gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, content->content, rhs.content->content, 0.0, res);
+  MatrixContent *content= new MatrixContent();
+  content->content = res;
+  return Matrix(content);
+}
+
+double &Matrix::at(size_t i, size_t j){
+  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
+  ASSERT(j>=0&&j<NDIM,"Index j for Matrix access out of range");
+  return *gsl_matrix_ptr (content->content, i, j);
+}
+
+const double Matrix::at(size_t i, size_t j) const{
+  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
+  ASSERT(j>=0&&j<NDIM,"Index j for Matrix access out of range");
+  return gsl_matrix_get(content->content, i, j);
+}
+
+Vector &Matrix::row(size_t i){
+  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
+  return *rows_ptr[i];
+}
+
+const Vector &Matrix::row(size_t i) const{
+  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
+  return *rows_ptr[i];
+}
+
+Vector &Matrix::column(size_t i){
+  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
+  return *columns_ptr[i];
+}
+
+const Vector &Matrix::column(size_t i) const{
+  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
+  return *columns_ptr[i];
+}
+
+Vector &Matrix::diagonal(){
+  return *diagonal_ptr;
+}
+
+const Vector &Matrix::diagonal() const{
+  return *diagonal_ptr;
+}
+
+void Matrix::set(size_t i, size_t j, const double value){
+  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
+  ASSERT(j>=0&&j<NDIM,"Index j for Matrix access out of range");
+  gsl_matrix_set(content->content,i,j,value);
+}
+
+double Matrix::determinant() const{
+  return at(0,0)*at(1,1)*at(2,2)
+       + at(0,1)*at(1,2)*at(2,0)
+       + at(0,2)*at(1,0)*at(2,1)
+       - at(2,0)*at(1,1)*at(0,2)
+       - at(2,1)*at(1,2)*at(0,0)
+       - at(2,2)*at(1,0)*at(0,1);
+}
+
+
+Matrix Matrix::invert() const{
+  double det = determinant();
+  if(fabs(det)<MYEPSILON){
+    throw NotInvertibleException(__FILE__,__LINE__);
+  }
+
+  double detReci = 1./det;
+  Matrix res;
+  res.set(0,0,  detReci*RDET2(at(1,1),at(2,1),at(1,2),at(2,2)));    // A_11
+  res.set(1,0, -detReci*RDET2(at(1,0),at(2,0),at(1,2),at(2,2)));    // A_21
+  res.set(2,0,  detReci*RDET2(at(1,0),at(2,0),at(1,1),at(2,1)));    // A_31
+  res.set(0,1, -detReci*RDET2(at(0,1),at(2,1),at(0,2),at(2,2)));    // A_12
+  res.set(1,1,  detReci*RDET2(at(0,0),at(2,0),at(0,2),at(2,2)));    // A_22
+  res.set(2,1, -detReci*RDET2(at(0,0),at(2,0),at(0,1),at(2,1)));    // A_32
+  res.set(0,2,  detReci*RDET2(at(0,1),at(1,1),at(0,2),at(1,2)));    // A_13
+  res.set(1,2, -detReci*RDET2(at(0,0),at(1,0),at(0,2),at(1,2)));    // A_23
+  res.set(2,2,  detReci*RDET2(at(0,0),at(1,0),at(0,1),at(1,1)));    // A_33
+  return res;
+}
+
+Matrix Matrix::transpose() const{
+  MatrixContent *newContent = new MatrixContent();
+  newContent->content = gsl_matrix_alloc(NDIM, NDIM);
+  gsl_matrix_transpose_memcpy(newContent->content, content->content);
+  Matrix res = Matrix(newContent);
+  return res;
+}
+
+Matrix &Matrix::transpose()
+{
+  double tmp;
+  for (int i=0;i<NDIM;i++)
+    for (int j=i+1;j<NDIM;j++) {
+      tmp = at(j,i);
+      at(j,i) = at(i,j);
+      at(i,j) = tmp;
+    }
+  return *this;
+}
+
+
+Vector Matrix::transformToEigenbasis()
+{
+  gsl_eigen_symmv_workspace *T = gsl_eigen_symmv_alloc(NDIM);
+  gsl_vector *eval = gsl_vector_alloc(NDIM);
+  gsl_matrix *evec = gsl_matrix_alloc(NDIM, NDIM);
+  gsl_eigen_symmv(content->content, eval, evec, T);
+  gsl_eigen_symmv_free(T);
+  gsl_matrix_memcpy(content->content, evec);
+  gsl_matrix_free(evec);
+  Vector evalues(gsl_vector_get(eval,0), gsl_vector_get(eval,1), gsl_vector_get(eval,2));
+  gsl_vector_free(eval);
+  return evalues;
+}
+
+const Matrix &Matrix::operator*=(const double factor){
+  gsl_matrix_scale(content->content, factor);
+  return *this;
+}
+
+const Matrix operator*(const double factor,const Matrix& mat){
+  Matrix tmp = mat;
+  tmp*=factor;
+  return tmp;
+}
+
+const Matrix operator*(const Matrix &mat,const double factor){
+  return factor*mat;
+}
+
+bool Matrix::operator==(const Matrix &rhs) const{
+  for(int i=NDIM;i--;){
+    for(int j=NDIM;j--;){
+      if(fabs(at(i,j)-rhs.at(i,j))>MYEPSILON){
+        return false;
+      }
+    }
+  }
+  return true;
+}
+
+/** Blows the 6-dimensional \a cell_size array up to a full NDIM by NDIM matrix.
+ * \param *symm 6-dim array of unique symmetric matrix components
+ * \return allocated NDIM*NDIM array with the symmetric matrix
+ */
+Matrix ReturnFullMatrixforSymmetric(const double * const symm)
+{
+  Matrix matrix;
+  matrix.set(0,0, symm[0]);
+  matrix.set(1,0, symm[1]);
+  matrix.set(2,0, symm[3]);
+  matrix.set(0,1, symm[1]);
+  matrix.set(1,1, symm[2]);
+  matrix.set(2,1, symm[4]);
+  matrix.set(0,2, symm[3]);
+  matrix.set(1,2, symm[4]);
+  matrix.set(2,2, symm[5]);
+  return matrix;
+};
+
+ostream &operator<<(ostream &ost,const Matrix &mat){
+  for(int i = 0;i<NDIM;++i){
+    ost << "\n";
+    for(int j = 0; j<NDIM;++j){
+      ost << mat.at(i,j);
+      if(j!=NDIM-1)
+        ost << "; ";
+    }
+  }
+  return ost;
+}
+
+Vector operator*(const Matrix &mat,const Vector &vec){
+  Vector res;
+  gsl_blas_dgemv( CblasNoTrans, 1.0, mat.content->content, vec.content->content, 0.0, res.content->content);
+  return res;
+}
+
+Vector &operator*=(Vector& lhs,const Matrix &mat){
+  lhs = mat*lhs;
+  return lhs;
+}
+
Index: src/LinearAlgebra/Matrix.hpp
===================================================================
--- src/LinearAlgebra/Matrix.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/Matrix.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,172 @@
+/*
+ * Matrix.hpp
+ *
+ *  Created on: Jun 25, 2010
+ *      Author: crueger
+ */
+
+#ifndef MATRIX_HPP_
+#define MATRIX_HPP_
+
+#include <iosfwd>
+#include "defs.hpp"
+
+/**
+ * Simple class to store matrices with a few extra functions
+ */
+
+class Vector;
+class MatrixContent;
+
+class Matrix
+{
+  friend Vector operator*(const Matrix&,const Vector&);
+public:
+  Matrix();
+
+  /**
+   * construct a matrix from a 3x3 double array that contains all Elements.
+   *
+   * The elements are laid out in the following way:
+   * array -> matrix
+   * 0 -> (0,0)
+   * 1 -> (1,0)
+   * 2 -> (2,0)
+   * 3 -> (0,1)
+   * 4 -> (1,1)
+   * 5 -> (2,1)
+   * 6 -> (0,2)
+   * 7 -> (1,2)
+   * 8 -> (2,2)
+   *
+   */
+  Matrix(const double*);
+  Matrix(const Matrix&);
+  virtual ~Matrix();
+
+  /**
+   * Set the matrix to a unit matrix.
+   */
+  void one();
+
+  /**
+   * Set all matrix entries to zero.
+   */
+  void zero();
+
+  /**
+   * Sets all matrix corresponding to a rotation matrix,
+   * first around the x-, then the y-, finally the z-axis
+   * with given angles.
+   */
+  void rotation(const double x, const double y, const double z);
+
+  /**
+   * Access the matrix at index (i,j)
+   */
+  double &at(size_t i, size_t j);
+  /**
+   * Access the matrix at index (i,j)
+   */
+  const double at(size_t i, size_t j) const;
+
+  /**
+   * Set the matrix at index (i,j).
+   *
+   * Slightly faster than at(i,j)=x
+   */
+  void set(size_t i, size_t j, const double value);
+
+  /**
+   * get the ith row of the matrix as a vector
+   */
+  Vector &row(size_t);
+  const Vector &row(size_t) const;
+
+  /**
+   * get the ith column of the matrix as a vector
+   */
+  Vector &column(size_t);
+  const Vector &column(size_t) const;
+
+  /**
+   * get the diagonal of the matrix as a vector
+   */
+  Vector &diagonal();
+  const Vector &diagonal() const;
+
+  /**
+   * Calculate the determinant of the matrix
+   */
+  double determinant() const;
+
+  /**
+   * Calculate the inverse of the matrix.
+   *
+   * Rather costly, so use precomputation as often as possible.
+   */
+  Matrix invert() const;
+
+  /**
+   * Diagonalizes a matrix and sets its rows to the resulting eigenvalues.
+   * The eigenvalues are returned as a vector.
+   *
+   * Rather costly, so use precomputation as often as possible.
+   */
+  Vector transformToEigenbasis();
+
+  /**
+   * Calculate the transpose of the matrix.
+   */
+  Matrix transpose() const;
+  Matrix &transpose();
+
+  // operators
+  Matrix &operator=(const Matrix&);
+
+  const Matrix &operator+=(const Matrix&);
+  const Matrix &operator-=(const Matrix&);
+  const Matrix &operator*=(const Matrix&);
+
+  const Matrix &operator*=(const double);
+
+  const Matrix operator+(const Matrix&) const;
+  const Matrix operator-(const Matrix&) const;
+  const Matrix operator*(const Matrix&) const;
+
+  bool operator==(const Matrix&) const;
+
+private:
+  Matrix(MatrixContent*);
+  void createViews();
+  MatrixContent *content;
+  // we keep around some Vector views of the matrix, to return references
+  Vector* rows_ptr[NDIM];
+  Vector* columns_ptr[NDIM];
+  Vector* diagonal_ptr;
+};
+
+const Matrix operator*(const double,const Matrix&);
+const Matrix operator*(const Matrix&,const double);
+
+/**
+ * Takes a symmetric matrix that stores the lower diagonal and produces a
+ * full matrix.
+ *
+ * The array is laid out as follows:
+ *
+ * array -> matrix
+ * 0 -> (0,0)
+ * 1 -> (1,0);(0,1)
+ * 2 -> (1,1)
+ * 3 -> (2,0);(0,2)
+ * 4 -> (2,1);(1,2)
+ * 5 -> (2,2)
+ */
+Matrix ReturnFullMatrixforSymmetric(const double * const cell_size);
+
+std::ostream &operator<<(std::ostream&,const Matrix&);
+Vector operator*(const Matrix&,const Vector&);
+Vector& operator*=(Vector&,const Matrix&);
+
+#endif /* MATRIX_HPP_ */
Index: src/LinearAlgebra/MatrixContent.hpp
===================================================================
--- src/LinearAlgebra/MatrixContent.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/MatrixContent.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,25 @@
+/*
+ * MatrixContent.hpp
+ *
+ *  Created on: Jul 2, 2010
+ *      Author: crueger
+ */
+
+#ifndef MATRIXCONTENT_HPP_
+#define MATRIXCONTENT_HPP_
+
+/**
+ * !file
+ * The way GSL works does not allow for forward definitions of the structures.
+ * Because of this the pointer to the gsl_matrix struct is wrapped inside another
+ * (dumb) object that allows for forward definitions. All methods of this class
+ * are empty, to allow for a maximum of flexibility.
+ */
+
+#include <gsl/gsl_matrix.h>
+
+struct MatrixContent{
+  gsl_matrix * content;
+};
+
+#endif /* MATRIXCONTENT_HPP_ */
Index: src/LinearAlgebra/Plane.cpp
===================================================================
--- src/LinearAlgebra/Plane.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/Plane.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,242 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * Plane.cpp
+ *
+ *  Created on: Apr 7, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "LinearAlgebra/Plane.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "defs.hpp"
+#include "Helpers/Info.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Assert.hpp"
+#include "Helpers/helpers.hpp"
+#include <cmath>
+#include "LinearAlgebra/Line.hpp"
+#include "Exceptions/MultipleSolutionsException.hpp"
+
+/**
+ * generates a plane from three given vectors defining three points in space
+ */
+Plane::Plane(const Vector &y1, const Vector &y2, const Vector &y3) throw(LinearDependenceException) :
+  normalVector(new Vector())
+{
+  Vector x1 = y1 -y2;
+  Vector x2 = y3 -y2;
+  if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON) || (fabs(x1.Angle(x2)) < MYEPSILON)) {
+    throw LinearDependenceException(__FILE__,__LINE__);
+  }
+//  Log() << Verbose(4) << "relative, first plane coordinates:";
+//  x1.Output((ofstream *)&cout);
+//  Log() << Verbose(0) << endl;
+//  Log() << Verbose(4) << "second plane coordinates:";
+//  x2.Output((ofstream *)&cout);
+//  Log() << Verbose(0) << endl;
+
+  normalVector->at(0) = (x1[1]*x2[2] - x1[2]*x2[1]);
+  normalVector->at(1) = (x1[2]*x2[0] - x1[0]*x2[2]);
+  normalVector->at(2) = (x1[0]*x2[1] - x1[1]*x2[0]);
+  normalVector->Normalize();
+
+  offset=normalVector->ScalarProduct(y1);
+}
+/**
+ * Constructs a plane from two direction vectors and a offset.
+ */
+Plane::Plane(const Vector &y1, const Vector &y2, double _offset) throw(ZeroVectorException,LinearDependenceException) :
+    normalVector(new Vector()),
+    offset(_offset)
+{
+  Vector x1 = y1;
+  Vector x2 = y2;
+  if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON)) {
+    throw ZeroVectorException(__FILE__,__LINE__);
+  }
+
+  if((fabs(x1.Angle(x2)) < MYEPSILON)) {
+    throw LinearDependenceException(__FILE__,__LINE__);
+  }
+//  Log() << Verbose(4) << "relative, first plane coordinates:";
+//  x1.Output((ofstream *)&cout);
+//  Log() << Verbose(0) << endl;
+//  Log() << Verbose(4) << "second plane coordinates:";
+//  x2.Output((ofstream *)&cout);
+//  Log() << Verbose(0) << endl;
+
+  normalVector->at(0) = (x1[1]*x2[2] - x1[2]*x2[1]);
+  normalVector->at(1) = (x1[2]*x2[0] - x1[0]*x2[2]);
+  normalVector->at(2) = (x1[0]*x2[1] - x1[1]*x2[0]);
+  normalVector->Normalize();
+}
+
+Plane::Plane(const Vector &_normalVector, double _offset) throw(ZeroVectorException):
+  normalVector(new Vector(_normalVector)),
+  offset(_offset)
+{
+  if(normalVector->IsZero())
+    throw ZeroVectorException(__FILE__,__LINE__);
+  double factor = 1/normalVector->Norm();
+  // normalize the plane parameters
+  (*normalVector)*=factor;
+  offset*=factor;
+}
+
+Plane::Plane(const Vector &_normalVector, const Vector &_offsetVector) throw(ZeroVectorException):
+    normalVector(new Vector(_normalVector))
+{
+  if(normalVector->IsZero()){
+    throw ZeroVectorException(__FILE__,__LINE__);
+  }
+  normalVector->Normalize();
+  offset = normalVector->ScalarProduct(_offsetVector);
+}
+
+/**
+ * copy constructor
+ */
+Plane::Plane(const Plane& plane) :
+  normalVector(new Vector(*plane.normalVector)),
+  offset(plane.offset)
+{}
+
+
+Plane::~Plane()
+{}
+
+Plane &Plane::operator=(const Plane &rhs){
+  if(&rhs!=this){
+    normalVector.reset(new Vector(*rhs.normalVector));
+    offset = rhs.offset;
+  }
+  return *this;
+}
+
+
+Vector Plane::getNormal() const{
+  return *normalVector;
+}
+
+double Plane::getOffset() const{
+  return offset;
+}
+
+Vector Plane::getOffsetVector() const {
+  return getOffset()*getNormal();
+}
+
+vector<Vector> Plane::getPointsOnPlane() const{
+  std::vector<Vector> res;
+  res.reserve(3);
+  // first point on the plane
+  res.push_back(getOffsetVector());
+  // get a vector that has direction of plane
+  Vector direction;
+  direction.GetOneNormalVector(getNormal());
+  res.push_back(res[0]+direction);
+  // get an orthogonal vector to direction and normal (has direction of plane)
+  direction.VectorProduct(getNormal());
+  direction.Normalize();
+  res.push_back(res[0] +direction);
+  return res;
+}
+
+
+/** Calculates the intersection point between a line defined by \a *LineVector and \a *LineVector2 and a plane defined by \a *Normal and \a *PlaneOffset.
+ * According to [Bronstein] the vectorial plane equation is:
+ *   -# \f$\stackrel{r}{\rightarrow} \cdot \stackrel{N}{\rightarrow} + D = 0\f$,
+ * where \f$\stackrel{r}{\rightarrow}\f$ is the vector to be testet, \f$\stackrel{N}{\rightarrow}\f$ is the plane's normal vector and
+ * \f$D = - \stackrel{a}{\rightarrow} \stackrel{N}{\rightarrow}\f$, the offset with respect to origin, if \f$\stackrel{a}{\rightarrow}\f$,
+ * is an offset vector onto the plane. The line is parametrized by \f$\stackrel{x}{\rightarrow} + k \stackrel{t}{\rightarrow}\f$, where
+ * \f$\stackrel{x}{\rightarrow}\f$ is the offset and \f$\stackrel{t}{\rightarrow}\f$ the directional vector (NOTE: No need to normalize
+ * the latter). Inserting the parametrized form into the plane equation and solving for \f$k\f$, which we insert then into the parametrization
+ * of the line yields the intersection point on the plane.
+ * \param *Origin first vector of line
+ * \param *LineVector second vector of line
+ * \return true -  \a this contains intersection point on return, false - line is parallel to plane (even if in-plane)
+ */
+Vector Plane::GetIntersection(const Line& line) const
+{
+  Info FunctionInfo(__func__);
+  Vector res;
+
+  double factor1 = getNormal().ScalarProduct(line.getDirection());
+  if(fabs(factor1)<MYEPSILON){
+    // the plane is parallel... under all circumstances this is bad luck
+    // we no have either no or infinite solutions
+    if(isContained(line.getOrigin())){
+      throw MultipleSolutionsException<Vector>(__FILE__,__LINE__,line.getOrigin());
+    }
+    else{
+      throw LinearDependenceException(__FILE__,__LINE__);
+    }
+  }
+
+  double factor2 = getNormal().ScalarProduct(line.getOrigin());
+  double scaleFactor = (offset-factor2)/factor1;
+
+  res = line.getOrigin() + scaleFactor * line.getDirection();
+
+  // tests to make sure the resulting vector really is on plane and line
+  ASSERT(isContained(res),"Calculated line-Plane intersection does not lie on plane.");
+  ASSERT(line.isContained(res),"Calculated line-Plane intersection does not lie on line.");
+  return res;
+};
+
+Vector Plane::mirrorVector(const Vector &rhs) const {
+  Vector helper = getVectorToPoint(rhs);
+  // substract twice the Vector to the plane
+  return rhs+2*helper;
+}
+
+Line Plane::getOrthogonalLine(const Vector &origin) const{
+  return Line(origin,getNormal());
+}
+
+bool Plane::onSameSide(const Vector &point1,const Vector &point2) const{
+  return sign(point1.ScalarProduct(*normalVector)-offset) ==
+         sign(point2.ScalarProduct(*normalVector)-offset);
+}
+
+/************ Methods inherited from Space ****************/
+
+double Plane::distance(const Vector &point) const{
+  double res = point.ScalarProduct(*normalVector)-offset;
+  return fabs(res);
+}
+
+Vector Plane::getClosestPoint(const Vector &point) const{
+  double factor = point.ScalarProduct(*normalVector)-offset;
+  if(fabs(factor) < MYEPSILON){
+    // the point itself lies on the plane
+    return point;
+  }
+  Vector difference = factor * (*normalVector);
+  return (point - difference);
+}
+
+// Operators
+
+bool operator==(const Plane &x,const Plane &y){
+  return *x.normalVector == *y.normalVector && x.offset == y.offset;
+}
+
+ostream &operator << (ostream &ost,const Plane &p){
+  ost << "<" << p.getNormal() << ";x> - " << p.getOffset() << "=0";
+  return ost;
+}
Index: src/LinearAlgebra/Plane.hpp
===================================================================
--- src/LinearAlgebra/Plane.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/Plane.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,87 @@
+/*
+ * Plane.hpp
+ *
+ *  Created on: Apr 7, 2010
+ *      Author: crueger
+ */
+
+#ifndef PLANE_HPP_
+#define PLANE_HPP_
+
+#include <memory>
+#include <vector>
+#include <iosfwd>
+#include "LinearAlgebra/Space.hpp"
+#include "Exceptions/LinearDependenceException.hpp"
+#include "Exceptions/ZeroVectorException.hpp"
+
+class Vector;
+class Line;
+
+class Plane : public Space
+{
+  friend bool operator==(const Plane&,const Plane&);
+  typedef std::auto_ptr<Vector> vec_ptr;
+public:
+  Plane(const Vector &y1, const Vector &y2, const Vector &y3) throw(LinearDependenceException);
+  Plane(const Vector &y1, const Vector &y2, double _offset) throw(ZeroVectorException,LinearDependenceException);
+  Plane(const Vector &_normalVector, double _offset)  throw(ZeroVectorException);
+  Plane(const Vector &_normalVector, const Vector &_offsetVector) throw(ZeroVectorException);
+  Plane(const Plane& plane);
+  virtual ~Plane();
+
+  Plane &operator=(const Plane&);
+
+  // Accessor Functions
+  /**
+   * returns normal Vector for a plane
+   */
+  Vector getNormal() const;
+  /**
+   * returns the distance of the plane from the origin
+   */
+  double getOffset() const;
+  /**
+   * returns a vector that points on the plane.
+   * Same as getOffset()*getNormal();
+   */
+  Vector getOffsetVector() const;
+
+  /**
+   * returns three seperate points on this plane
+   */
+  std::vector<Vector> getPointsOnPlane() const;
+
+  // some calculations
+  Vector GetIntersection(const Line &Line) const;
+
+  Vector mirrorVector(const Vector &rhs) const;
+
+  /**
+   * get a Line that is orthogonal to this plane, going through a chosen
+   * point.
+   *
+   * The point does not have to lie on the plane itself.
+   */
+  Line getOrthogonalLine(const Vector &origin) const;
+
+  /**
+   * Test if two points are on the same side of the plane
+   */
+  bool onSameSide(const Vector&,const Vector&) const;
+
+  /****** Methods inherited from Space ***********/
+
+  virtual double distance(const Vector &point) const;
+  virtual Vector getClosestPoint(const Vector &point) const;
+
+private:
+  vec_ptr normalVector;
+  double offset;
+};
+
+bool operator==(const Plane&,const Plane&);
+
+std::ostream &operator<< (std::ostream &ost,const Plane& p);
+
+#endif /* PLANE_HPP_ */
Index: src/LinearAlgebra/Space.cpp
===================================================================
--- src/LinearAlgebra/Space.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/Space.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,42 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * Space.cpp
+ *
+ *  Created on: Apr 30, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "LinearAlgebra/Space.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
+Space::Space()
+{}
+
+Space::~Space()
+{}
+
+bool Space::hasZero() const{
+  return isContained(zeroVec);
+}
+
+Vector Space::getVectorToPoint(const Vector &origin) const{
+  Vector support = getClosestPoint(origin);
+  return support-origin;
+}
+
+bool Space::isContained(const Vector &point) const{
+  return (distance(point)) < MYEPSILON;
+}
Index: src/LinearAlgebra/Space.hpp
===================================================================
--- src/LinearAlgebra/Space.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/Space.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,52 @@
+/*
+ * Space.hpp
+ *
+ *  Created on: Apr 30, 2010
+ *      Author: crueger
+ */
+
+#ifndef SPACE_HPP_
+#define SPACE_HPP_
+
+class Vector;
+
+class Space
+{
+public:
+  Space();
+  virtual ~Space();
+
+  /**
+   * Calculates the distance between a Space and a Vector.
+   */
+  virtual double distance(const Vector &point) const=0;
+
+  /**
+   * get the closest point inside the space to another point
+   */
+  virtual Vector getClosestPoint(const Vector &point) const=0;
+
+  /**
+   * get the shortest Vector from a point to a Space.
+   *
+   * The Vector always points from the given Vector to the point in space
+   * returned by Plane::getClosestPoint().
+   */
+  virtual Vector getVectorToPoint(const Vector &point) const;
+
+  /**
+   * Test wether a point is contained in the space.
+   *
+   * returns true, when the point lies inside and false
+   * otherwise.
+   */
+  virtual bool isContained(const Vector &point) const;
+
+  /**
+   * Tests if this space contains the center of the coordinate system.
+   */
+  virtual bool hasZero() const;
+
+};
+
+#endif /* SPACE_HPP_ */
Index: src/LinearAlgebra/Vector.cpp
===================================================================
--- src/LinearAlgebra/Vector.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/Vector.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,586 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/** \file vector.cpp
+ *
+ * Function implementations for the class vector.
+ *
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "LinearAlgebra/Vector.hpp"
+#include "VectorContent.hpp"
+#include "Helpers/Verbose.hpp"
+#include "World.hpp"
+#include "Helpers/Assert.hpp"
+#include "Helpers/fast_functions.hpp"
+#include "Exceptions/MathException.hpp"
+
+#include <iostream>
+#include <gsl/gsl_blas.h>
+#include <gsl/gsl_vector.h>
+
+
+using namespace std;
+
+
+/************************************ Functions for class vector ************************************/
+
+/** Constructor of class vector.
+ */
+Vector::Vector()
+{
+  content = new VectorContent();
+};
+
+/**
+ * Copy constructor
+ */
+
+Vector::Vector(const Vector& src)
+{
+  content = new VectorContent();
+  gsl_vector_memcpy(content->content, src.content->content);
+}
+
+/** Constructor of class vector.
+ */
+Vector::Vector(const double x1, const double x2, const double x3)
+{
+  content = new VectorContent();
+  gsl_vector_set(content->content,0,x1);
+  gsl_vector_set(content->content,1,x2);
+  gsl_vector_set(content->content,2,x3);
+};
+
+/** Constructor of class vector.
+ */
+Vector::Vector(const double x[3])
+{
+  content = new VectorContent();
+  gsl_vector_set(content->content,0,x[0]);
+  gsl_vector_set(content->content,1,x[1]);
+  gsl_vector_set(content->content,2,x[2]);
+};
+
+Vector::Vector(VectorContent *_content) :
+  content(_content)
+{}
+
+/**
+ * Assignment operator
+ */
+Vector& Vector::operator=(const Vector& src){
+  // check for self assignment
+  if(&src!=this){
+    gsl_vector_memcpy(content->content, src.content->content);
+  }
+  return *this;
+}
+
+/** Desctructor of class vector.
+ */
+Vector::~Vector() {
+  delete content;
+};
+
+/** Calculates square of distance between this and another vector.
+ * \param *y array to second vector
+ * \return \f$| x - y |^2\f$
+ */
+double Vector::DistanceSquared(const Vector &y) const
+{
+  double res = 0.;
+  for (int i=NDIM;i--;)
+    res += (at(i)-y[i])*(at(i)-y[i]);
+  return (res);
+};
+
+/** Calculates distance between this and another vector.
+ * \param *y array to second vector
+ * \return \f$| x - y |\f$
+ */
+double Vector::distance(const Vector &y) const
+{
+  return (sqrt(DistanceSquared(y)));
+};
+
+size_t Vector::GreatestComponent() const
+{
+  int greatest = 0;
+  for (int i=1;i<NDIM;i++) {
+    if (at(i) > at(greatest))
+      greatest = i;
+  }
+  return greatest;
+}
+
+size_t Vector::SmallestComponent() const
+{
+  int smallest = 0;
+  for (int i=1;i<NDIM;i++) {
+    if (at(i) < at(smallest))
+      smallest = i;
+  }
+  return smallest;
+}
+
+
+Vector Vector::getClosestPoint(const Vector &point) const{
+  // the closest point to a single point space is always the single point itself
+  return *this;
+}
+
+/** Calculates scalar product between this and another vector.
+ * \param *y array to second vector
+ * \return \f$\langle x, y \rangle\f$
+ */
+double Vector::ScalarProduct(const Vector &y) const
+{
+  double res = 0.;
+  gsl_blas_ddot(content->content, y.content->content, &res);
+  return (res);
+};
+
+
+/** Calculates VectorProduct between this and another vector.
+ *  -# returns the Product in place of vector from which it was initiated
+ *  -# ATTENTION: Only three dim.
+ *  \param *y array to vector with which to calculate crossproduct
+ *  \return \f$ x \times y \f&
+ */
+void Vector::VectorProduct(const Vector &y)
+{
+  Vector tmp;
+  for(int i=NDIM;i--;)
+    tmp[i] = at((i+1)%NDIM)*y[(i+2)%NDIM] - at((i+2)%NDIM)*y[(i+1)%NDIM];
+  (*this) = tmp;
+};
+
+
+/** projects this vector onto plane defined by \a *y.
+ * \param *y normal vector of plane
+ * \return \f$\langle x, y \rangle\f$
+ */
+void Vector::ProjectOntoPlane(const Vector &y)
+{
+  Vector tmp;
+  tmp = y;
+  tmp.Normalize();
+  tmp.Scale(ScalarProduct(tmp));
+  *this -= tmp;
+};
+
+/** Calculates the minimum distance of this vector to the plane.
+ * \sa Vector::GetDistanceVectorToPlane()
+ * \param *out output stream for debugging
+ * \param *PlaneNormal normal of plane
+ * \param *PlaneOffset offset of plane
+ * \return distance to plane
+ */
+double Vector::DistanceToSpace(const Space &space) const
+{
+  return space.distance(*this);
+};
+
+/** Calculates the projection of a vector onto another \a *y.
+ * \param *y array to second vector
+ */
+void Vector::ProjectIt(const Vector &y)
+{
+  (*this) += (-ScalarProduct(y))*y;
+};
+
+/** Calculates the projection of a vector onto another \a *y.
+ * \param *y array to second vector
+ * \return Vector
+ */
+Vector Vector::Projection(const Vector &y) const
+{
+  Vector helper = y;
+  helper.Scale((ScalarProduct(y)/y.NormSquared()));
+
+  return helper;
+};
+
+/** Calculates norm of this vector.
+ * \return \f$|x|\f$
+ */
+double Vector::Norm() const
+{
+  return (sqrt(NormSquared()));
+};
+
+/** Calculates squared norm of this vector.
+ * \return \f$|x|^2\f$
+ */
+double Vector::NormSquared() const
+{
+  return (ScalarProduct(*this));
+};
+
+/** Normalizes this vector.
+ */
+void Vector::Normalize()
+{
+  double factor = Norm();
+  (*this) *= 1/factor;
+};
+
+Vector Vector::getNormalized() const{
+  Vector res= *this;
+  res.Normalize();
+  return res;
+}
+
+/** Zeros all components of this vector.
+ */
+void Vector::Zero()
+{
+  at(0)=at(1)=at(2)=0;
+};
+
+/** Zeros all components of this vector.
+ */
+void Vector::One(const double one)
+{
+  at(0)=at(1)=at(2)=one;
+};
+
+/** Checks whether vector has all components zero.
+ * @return true - vector is zero, false - vector is not
+ */
+bool Vector::IsZero() const
+{
+  return (fabs(at(0))+fabs(at(1))+fabs(at(2)) < MYEPSILON);
+};
+
+/** Checks whether vector has length of 1.
+ * @return true - vector is normalized, false - vector is not
+ */
+bool Vector::IsOne() const
+{
+  return (fabs(Norm() - 1.) < MYEPSILON);
+};
+
+/** Checks whether vector is normal to \a *normal.
+ * @return true - vector is normalized, false - vector is not
+ */
+bool Vector::IsNormalTo(const Vector &normal) const
+{
+  if (ScalarProduct(normal) < MYEPSILON)
+    return true;
+  else
+    return false;
+};
+
+/** Checks whether vector is normal to \a *normal.
+ * @return true - vector is normalized, false - vector is not
+ */
+bool Vector::IsEqualTo(const Vector &a) const
+{
+  bool status = true;
+  for (int i=0;i<NDIM;i++) {
+    if (fabs(at(i) - a[i]) > MYEPSILON)
+      status = false;
+  }
+  return status;
+};
+
+/** Calculates the angle between this and another vector.
+ * \param *y array to second vector
+ * \return \f$\acos\bigl(frac{\langle x, y \rangle}{|x||y|}\bigr)\f$
+ */
+double Vector::Angle(const Vector &y) const
+{
+  double norm1 = Norm(), norm2 = y.Norm();
+  double angle = -1;
+  if ((fabs(norm1) > MYEPSILON) && (fabs(norm2) > MYEPSILON))
+    angle = this->ScalarProduct(y)/norm1/norm2;
+  // -1-MYEPSILON occured due to numerical imprecision, catch ...
+  //Log() << Verbose(2) << "INFO: acos(-1) = " << acos(-1) << ", acos(-1+MYEPSILON) = " << acos(-1+MYEPSILON) << ", acos(-1-MYEPSILON) = " << acos(-1-MYEPSILON) << "." << endl;
+  if (angle < -1)
+    angle = -1;
+  if (angle > 1)
+    angle = 1;
+  return acos(angle);
+};
+
+
+double& Vector::operator[](size_t i){
+  ASSERT(i<=NDIM && i>=0,"Vector Index out of Range");
+  return *gsl_vector_ptr (content->content, i);
+}
+
+const double& Vector::operator[](size_t i) const{
+  ASSERT(i<=NDIM && i>=0,"Vector Index out of Range");
+  return *gsl_vector_ptr (content->content, i);
+}
+
+double& Vector::at(size_t i){
+  return (*this)[i];
+}
+
+const double& Vector::at(size_t i) const{
+  return (*this)[i];
+}
+
+VectorContent* Vector::get(){
+  return content;
+}
+
+/** Compares vector \a to vector \a b component-wise.
+ * \param a base vector
+ * \param b vector components to add
+ * \return a == b
+ */
+bool Vector::operator==(const Vector& b) const
+{
+  return IsEqualTo(b);
+};
+
+bool Vector::operator!=(const Vector& b) const
+{
+  return !IsEqualTo(b);
+}
+
+/** Sums vector \a to this lhs component-wise.
+ * \param a base vector
+ * \param b vector components to add
+ * \return lhs + a
+ */
+const Vector& Vector::operator+=(const Vector& b)
+{
+  this->AddVector(b);
+  return *this;
+};
+
+/** Subtracts vector \a from this lhs component-wise.
+ * \param a base vector
+ * \param b vector components to add
+ * \return lhs - a
+ */
+const Vector& Vector::operator-=(const Vector& b)
+{
+  this->SubtractVector(b);
+  return *this;
+};
+
+/** factor each component of \a a times a double \a m.
+ * \param a base vector
+ * \param m factor
+ * \return lhs.x[i] * m
+ */
+const Vector& operator*=(Vector& a, const double m)
+{
+  a.Scale(m);
+  return a;
+};
+
+/** Sums two vectors \a  and \b component-wise.
+ * \param a first vector
+ * \param b second vector
+ * \return a + b
+ */
+Vector const Vector::operator+(const Vector& b) const
+{
+  Vector x = *this;
+  x.AddVector(b);
+  return x;
+};
+
+/** Subtracts vector \a from \b component-wise.
+ * \param a first vector
+ * \param b second vector
+ * \return a - b
+ */
+Vector const Vector::operator-(const Vector& b) const
+{
+  Vector x = *this;
+  x.SubtractVector(b);
+  return x;
+};
+
+/** Factors given vector \a a times \a m.
+ * \param a vector
+ * \param m factor
+ * \return m * a
+ */
+Vector const operator*(const Vector& a, const double m)
+{
+  Vector x(a);
+  x.Scale(m);
+  return x;
+};
+
+/** Factors given vector \a a times \a m.
+ * \param m factor
+ * \param a vector
+ * \return m * a
+ */
+Vector const operator*(const double m, const Vector& a )
+{
+  Vector x(a);
+  x.Scale(m);
+  return x;
+};
+
+ostream& operator<<(ostream& ost, const Vector& m)
+{
+  ost << "(";
+  for (int i=0;i<NDIM;i++) {
+    ost << m[i];
+    if (i != 2)
+      ost << ",";
+  }
+  ost << ")";
+  return ost;
+};
+
+
+void Vector::ScaleAll(const double *factor)
+{
+  for (int i=NDIM;i--;)
+    at(i) *= factor[i];
+};
+
+void Vector::ScaleAll(const Vector &factor){
+  gsl_vector_mul(content->content, factor.content->content);
+}
+
+
+void Vector::Scale(const double factor)
+{
+  gsl_vector_scale(content->content,factor);
+};
+
+std::pair<Vector,Vector> Vector::partition(const Vector &rhs) const{
+  double factor = ScalarProduct(rhs)/rhs.NormSquared();
+  Vector res= factor * rhs;
+  return make_pair(res,(*this)-res);
+}
+
+std::pair<pointset,Vector> Vector::partition(const pointset &points) const{
+  Vector helper = *this;
+  pointset res;
+  for(pointset::const_iterator iter=points.begin();iter!=points.end();++iter){
+    pair<Vector,Vector> currPart = helper.partition(*iter);
+    res.push_back(currPart.first);
+    helper = currPart.second;
+  }
+  return make_pair(res,helper);
+}
+
+/** Creates this vector as the b y *factors' components scaled linear combination of the given three.
+ * this vector = x1*factors[0] + x2* factors[1] + x3*factors[2]
+ * \param *x1 first vector
+ * \param *x2 second vector
+ * \param *x3 third vector
+ * \param *factors three-component vector with the factor for each given vector
+ */
+void Vector::LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors)
+{
+  (*this) = (factors[0]*x1) +
+            (factors[1]*x2) +
+            (factors[2]*x3);
+};
+
+/** Calculates orthonormal vector to one given vectors.
+ * Just subtracts the projection onto the given vector from this vector.
+ * The removed part of the vector is Vector::Projection()
+ * \param *x1 vector
+ * \return true - success, false - vector is zero
+ */
+bool Vector::MakeNormalTo(const Vector &y1)
+{
+  bool result = false;
+  double factor = y1.ScalarProduct(*this)/y1.NormSquared();
+  Vector x1 = factor * y1;
+  SubtractVector(x1);
+  for (int i=NDIM;i--;)
+    result = result || (fabs(at(i)) > MYEPSILON);
+
+  return result;
+};
+
+/** Creates this vector as one of the possible orthonormal ones to the given one.
+ * Just scan how many components of given *vector are unequal to zero and
+ * try to get the skp of both to be zero accordingly.
+ * \param *vector given vector
+ * \return true - success, false - failure (null vector given)
+ */
+bool Vector::GetOneNormalVector(const Vector &GivenVector)
+{
+  int Components[NDIM]; // contains indices of non-zero components
+  int Last = 0;   // count the number of non-zero entries in vector
+  int j;  // loop variables
+  double norm;
+
+  for (j=NDIM;j--;)
+    Components[j] = -1;
+
+  // in two component-systems we need to find the one position that is zero
+  int zeroPos = -1;
+  // find two components != 0
+  for (j=0;j<NDIM;j++){
+    if (fabs(GivenVector[j]) > MYEPSILON)
+      Components[Last++] = j;
+    else
+      // this our zero Position
+      zeroPos = j;
+  }
+
+  switch(Last) {
+    case 3:  // threecomponent system
+      // the position of the zero is arbitrary in three component systems
+      zeroPos = Components[2];
+    case 2:  // two component system
+      norm = sqrt(1./(GivenVector[Components[1]]*GivenVector[Components[1]]) + 1./(GivenVector[Components[0]]*GivenVector[Components[0]]));
+      at(zeroPos) = 0.;
+      // in skp both remaining parts shall become zero but with opposite sign and third is zero
+      at(Components[1]) = -1./GivenVector[Components[1]] / norm;
+      at(Components[0]) = 1./GivenVector[Components[0]] / norm;
+      return true;
+      break;
+    case 1: // one component system
+      // set sole non-zero component to 0, and one of the other zero component pendants to 1
+      at((Components[0]+2)%NDIM) = 0.;
+      at((Components[0]+1)%NDIM) = 1.;
+      at(Components[0]) = 0.;
+      return true;
+      break;
+    default:
+      return false;
+  }
+};
+
+/** Adds vector \a *y componentwise.
+ * \param *y vector
+ */
+void Vector::AddVector(const Vector &y)
+{
+  gsl_vector_add(content->content, y.content->content);
+}
+
+/** Adds vector \a *y componentwise.
+ * \param *y vector
+ */
+void Vector::SubtractVector(const Vector &y)
+{
+  gsl_vector_sub(content->content, y.content->content);
+}
+
+
+// some comonly used vectors
+const Vector zeroVec(0,0,0);
+const Vector unitVec[NDIM]={Vector(1,0,0),Vector(0,1,0),Vector(0,0,1)};
Index: src/LinearAlgebra/Vector.hpp
===================================================================
--- src/LinearAlgebra/Vector.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/Vector.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,119 @@
+#ifndef VECTOR_HPP_
+#define VECTOR_HPP_
+
+using namespace std;
+
+/*********************************************** includes ***********************************/
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iosfwd>
+
+#include <memory>
+#include <vector>
+
+#include "defs.hpp"
+#include "LinearAlgebra/Space.hpp"
+
+/********************************************** declarations *******************************/
+
+class Vector;
+class Matrix;
+struct VectorContent;
+
+typedef std::vector<Vector> pointset;
+
+/** Single vector.
+ * basically, just a x[3] but with helpful functions
+ */
+class Vector : public Space{
+  friend Vector operator*(const Matrix&,const Vector&);
+  friend class Matrix;
+public:
+  Vector();
+  Vector(const double x1, const double x2, const double x3);
+  Vector(const double x[3]);
+  Vector(const Vector& src);
+  virtual ~Vector();
+
+  // Method implemented by forwarding to the Representation
+
+  double DistanceSquared(const Vector &y) const;
+  double DistanceToSpace(const Space& space) const;
+  double ScalarProduct(const Vector &y) const;
+  double Angle(const Vector &y) const;
+  bool IsZero() const;
+  bool IsOne() const;
+  bool IsNormalTo(const Vector &normal) const;
+  bool IsEqualTo(const Vector &a) const;
+
+  void AddVector(const Vector &y);
+  void SubtractVector(const Vector &y);
+  void VectorProduct(const Vector &y);
+  void ProjectOntoPlane(const Vector &y);
+  void ProjectIt(const Vector &y);
+  Vector Projection(const Vector &y) const;
+  void ScaleAll(const double *factor);
+  void ScaleAll(const Vector &factor);
+  void Scale(const double factor);
+  bool GetOneNormalVector(const Vector &x1);
+  bool MakeNormalTo(const Vector &y1);
+  std::pair<Vector,Vector> partition(const Vector&) const;
+  std::pair<pointset,Vector> partition(const pointset&) const;
+  size_t GreatestComponent() const;
+  size_t SmallestComponent() const;
+
+  // Accessors ussually come in pairs... and sometimes even more than that
+  double& operator[](size_t i);
+  const double& operator[](size_t i) const;
+  double& at(size_t i);
+  const double& at(size_t i) const;
+
+  // Assignment operator
+  Vector &operator=(const Vector& src);
+
+  // Access to internal structure
+  VectorContent* get();
+
+  // Methods that are derived directly from other methods
+  double Norm() const;
+  double NormSquared() const;
+  void Normalize();
+  Vector getNormalized() const;
+  void Zero();
+  void One(const double one);
+  void LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors);
+
+  // operators for mathematical operations
+  bool operator==(const Vector& b) const;
+  bool operator!=(const Vector& b) const;
+  const Vector& operator+=(const Vector& b);
+  const Vector& operator-=(const Vector& b);
+  Vector const operator+(const Vector& b) const;
+  Vector const operator-(const Vector& b) const;
+
+  // Methods inherited from Space
+  virtual double distance(const Vector &point) const;
+  virtual Vector getClosestPoint(const Vector &point) const;
+
+protected:
+
+private:
+  Vector(VectorContent *);
+  VectorContent *content;
+
+};
+
+// some commonly used and fixed vectors
+const extern Vector zeroVec;
+const extern Vector unitVec[NDIM];
+
+ostream & operator << (ostream& ost, const Vector &m);
+const Vector& operator*=(Vector& a, const double m);
+Vector const operator*(const Vector& a, const double m);
+Vector const operator*(const double m, const Vector& a);
+
+#endif /*VECTOR_HPP_*/
Index: src/LinearAlgebra/VectorContent.hpp
===================================================================
--- src/LinearAlgebra/VectorContent.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/VectorContent.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,53 @@
+/*
+ * VectorContent.hpp
+ *
+ *  Created on: Jul 2, 2010
+ *      Author: crueger
+ */
+
+#ifndef VECTORCONTENT_HPP_
+#define VECTORCONTENT_HPP_
+
+/**
+ * !file
+ * The way GSL works does not allow for forward definitions of the structures.
+ * Because of this the pointer to the gsl_vector struct is wrapped inside another
+ * (dumb) object that allows for forward definitions.
+ *
+ * DO NOT USE OUTSIDE OF VECTOR UNLESS YOU ABSOLUTELY HAVE TO AND KNOW WHAT YOU ARE DOING.
+ */
+
+#include <gsl/gsl_vector.h>
+
+struct BaseCase{};
+
+struct VectorContent{
+  VectorContent(){
+    content =  gsl_vector_calloc (NDIM);
+  }
+  VectorContent(BaseCase){
+
+  }
+  virtual ~VectorContent(){
+    if(content){
+      gsl_vector_free(content);
+      content = 0;
+    }
+  }
+  gsl_vector *content;
+};
+
+struct VectorViewContent : public VectorContent{
+  VectorViewContent(gsl_vector_view _view) :
+    VectorContent(BaseCase()),
+    view(_view)
+  {
+    content=&view.vector;
+  }
+  virtual ~VectorViewContent(){
+    content=0;
+  }
+  gsl_vector_view view;
+};
+
+#endif /* VECTORCONTENT_HPP_ */
Index: src/LinearAlgebra/VectorInterface.cpp
===================================================================
--- src/LinearAlgebra/VectorInterface.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/VectorInterface.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,37 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * VectorInterface.cpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "VectorInterface.hpp"
+
+#include <iostream>
+#include "LinearAlgebra/Vector.hpp"
+
+
+/** Constructor of class VectorInterface.
+ */
+VectorInterface::VectorInterface()
+{};
+
+/** Destructor for class VectorInterface.
+ */
+VectorInterface::~VectorInterface()
+{};
+
Index: src/LinearAlgebra/VectorInterface.hpp
===================================================================
--- src/LinearAlgebra/VectorInterface.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/VectorInterface.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,61 @@
+/*
+ * VectorInterface.hpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+#ifndef VECTORINTERFACE_HPP_
+#define VECTORINTERFACE_HPP_
+
+#include <cstring>
+#include <iostream>
+
+class Vector;
+
+/** Contains all functions of the class Vector as virtual definitions, to give any
+ * class derived from it the interface of a Vector, i.e. Vector-like abilities
+ * (i.e. the scaffold design pattern).
+ */
+class VectorInterface  {
+public:
+
+  // Accessors ussually come in pairs... and sometimes even more than that
+  virtual const double& operator[](size_t i) const = 0;
+  virtual const double& at(size_t i) const = 0;
+  virtual void set(size_t i, const double value) = 0;
+  virtual const Vector& getPosition() const = 0;
+
+  // Assignment operator
+  virtual void setPosition(const Vector& _vector) = 0;
+
+  // operators for mathematical operations
+  virtual const VectorInterface& operator+=(const Vector& b) = 0;
+  virtual const VectorInterface& operator-=(const Vector& b) = 0;
+  virtual Vector const operator+(const Vector& b) const = 0;
+  virtual Vector const operator-(const Vector& b) const = 0;
+
+  virtual void Zero() = 0;
+  virtual void One(const double one) = 0;
+  virtual void LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors) = 0;
+
+  virtual double distance(const Vector &point) const = 0;
+  virtual double DistanceSquared(const Vector &y) const = 0;
+  virtual double distance(const VectorInterface &_atom) const = 0;
+  virtual double DistanceSquared(const VectorInterface &_atom) const = 0;
+
+  virtual void ScaleAll(const double *factor) = 0;
+  virtual void ScaleAll(const Vector &factor) = 0;
+  virtual void Scale(const double factor) = 0;
+
+  virtual std::ostream & operator << (std::ostream &ost) const = 0;
+
+protected:
+  /** Constructor and destructor are protected as VectorInterface should never
+   * be instantiated by itself but only as a derived class.
+   */
+  VectorInterface();
+  ~VectorInterface();
+};
+
+#endif /* VECTORINTERFACE_HPP_ */
Index: src/LinearAlgebra/VectorSet.hpp
===================================================================
--- src/LinearAlgebra/VectorSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/VectorSet.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,70 @@
+/*
+ * VectorSet.hpp
+ *
+ *  Created on: Jun 2, 2010
+ *      Author: crueger
+ */
+
+#ifndef VECTORSET_HPP_
+#define VECTORSET_HPP_
+
+
+#include <functional>
+#include <algorithm>
+#include <limits>
+
+/**
+ * A simple mixin to give any STL conforming structure fast Vector abilities
+ *
+ * TODO: make this work for maps
+ */
+
+#include "LinearAlgebra/Vector.hpp"
+#include <list>
+
+// this tests, whether we actually have a Vector
+template <class V>
+struct is_vector{};
+
+template <>
+struct is_vector<Vector>{
+  typedef void wrong_type;
+};
+
+template <class Set>
+class VectorSet : public Set
+{
+  // when our set carries something besides a vector this will produce an error
+  typedef typename is_vector<typename Set::value_type>::wrong_type check_for_vector;
+public:
+  // typedefs for STL conforming structure
+  typedef typename Set::iterator iterator;
+  typedef typename Set::const_iterator const_iterator;
+
+  VectorSet(){}
+  virtual ~VectorSet(){}
+
+  /**
+   * translate all Vectors within this set by a specified amount
+   */
+  void translate(const Vector &translater){
+    // this is needed to allow template lookup
+    transform(this->begin(),this->end(),this->begin(),std::bind1st(std::plus<Vector>(),translater));
+  }
+
+  double minDistSquared(const Vector &point){
+    if(!this->size())
+      return std::numeric_limits<double>::infinity();
+    std::list<double> helper;
+    helper.resize(this->size());
+    transform(this->begin(),this->end(),
+              helper.begin(),
+              std::bind2nd(std::mem_fun_ref(&Vector::DistanceSquared),point));
+    return *min_element(helper.begin(),helper.end());
+  }
+};
+
+// allows simpler definition of VectorSets
+#define VECTORSET(container_type) VectorSet<container_type<Vector> >
+
+#endif /* VECTORSET_HPP_ */
Index: src/LinearAlgebra/gslmatrix.cpp
===================================================================
--- src/LinearAlgebra/gslmatrix.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/gslmatrix.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,260 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * gslmatrix.cpp
+ *
+ *  Created on: Jan 8, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+using namespace std;
+
+#include "LinearAlgebra/gslmatrix.hpp"
+#include "Helpers/helpers.hpp"
+#include "Helpers/fast_functions.hpp"
+
+#include <cassert>
+#include <gsl/gsl_linalg.h>
+
+/** Constructor of class GSLMatrix.
+ * Allocates GSL structures
+ * \param m dimension of matrix
+ */
+GSLMatrix::GSLMatrix(size_t m, size_t n) : rows(m), columns(n)
+{
+  matrix = gsl_matrix_calloc(rows, columns);
+};
+
+/** Copy constructor of class GSLMatrix.
+ * Allocates GSL structures and copies components from \a *src.
+ * \param *src source matrix
+ */
+GSLMatrix::GSLMatrix(const GSLMatrix * const src) : rows(src->rows), columns(src->columns)
+{
+  matrix = gsl_matrix_alloc(rows, columns);
+  gsl_matrix_memcpy (matrix, src->matrix);
+};
+
+/** Destructor of class GSLMatrix.
+ * Frees GSL structures
+ */
+GSLMatrix::~GSLMatrix()
+{
+  gsl_matrix_free(matrix);
+  rows = 0;
+  columns = 0;
+};
+
+/** Assignment operator.
+ * \param &rhs right hand side
+ * \return object itself
+ */
+GSLMatrix& GSLMatrix::operator=(const GSLMatrix& rhs)
+{
+  if (this == &rhs)   // not necessary here, but identity assignment check is generally a good idea
+    return *this;
+  assert(rows == rhs.rows && columns == rhs.columns && "Number of rows and columns do not match!");
+
+  gsl_matrix_memcpy (matrix, rhs.matrix);
+
+  return *this;
+};
+
+/* ============================ Accessing =============================== */
+/** This function sets the matrix from a double array.
+ * Creates a matrix view of the array and performs a memcopy.
+ * \param *x array of values (no dimension check is performed)
+ */
+void GSLMatrix::SetFromDoubleArray(double * x)
+{
+  gsl_matrix_view m = gsl_matrix_view_array (x, rows, columns);
+  gsl_matrix_memcpy (matrix, &m.matrix);
+};
+
+/** This function returns the i-th element of a matrix.
+ * If \a m or \a n lies outside the allowed range of 0 to GSLMatrix::dimension-1 then the error handler is invoked and 0 is returned.
+ * \param m row index
+ * \param n colum index
+ * \return (m,n)-th element of matrix
+ */
+double GSLMatrix::Get(size_t m, size_t n)
+{
+  return gsl_matrix_get (matrix, m, n);
+};
+
+/** This function sets the value of the \a m -th element of a matrix to \a x.
+ *  If \a m or \a n lies outside the allowed range of 0 to GSLMatrix::dimension-1 then the error handler is invoked.
+ * \param m row index
+ * \param m column index
+ * \param x value to set element (m,n) to
+ */
+void GSLMatrix::Set(size_t m, size_t n, double x)
+{
+  gsl_matrix_set (matrix, m, n, x);
+};
+
+/** These functions return a pointer to the \a m-th element of a matrix.
+ *  If \a m or \a n lies outside the allowed range of 0 to GSLMatrix::dimension-1 then the error handler is invoked and a null pointer is returned.
+ * \param m index
+ * \return pointer to \a m-th element
+ */
+double *GSLMatrix::Pointer(size_t m, size_t n)
+{
+  return gsl_matrix_ptr (matrix, m, n);
+};
+
+/** These functions return a constant pointer to the \a m-th element of a matrix.
+ *  If \a m or \a n lies outside the allowed range of 0 to GSLMatrix::dimension-1 then the error handler is invoked and a null pointer is returned.
+ * \param m index
+ * \return const pointer to \a m-th element
+ */
+const double *GSLMatrix::const_Pointer(size_t m, size_t n)
+{
+  return gsl_matrix_const_ptr (matrix, m, n);
+};
+
+/* ========================== Initializing =============================== */
+/** This function sets all the elements of the matrix to the value \a x.
+ * \param *x
+ */
+void GSLMatrix::SetAll(double x)
+{
+  gsl_matrix_set_all (matrix, x);
+};
+
+/** This function sets all the elements of the matrix to zero.
+ */
+void GSLMatrix::SetZero()
+{
+  gsl_matrix_set_zero (matrix);
+};
+
+/** This function sets the elements of the matrix to the corresponding elements of the identity matrix, \f$m(i,j) = \delta(i,j)\f$, i.e. a unit diagonal with all off-diagonal elements zero.
+ * This applies to both square and rectangular matrices.
+ */
+void GSLMatrix::SetIdentity()
+{
+  gsl_matrix_set_identity (matrix);
+};
+
+/* ====================== Exchanging elements ============================ */
+/** This function exchanges the \a i-th and \a j-th row of the matrix in-place.
+ * \param i i-th row to swap with ...
+ * \param j ... j-th row to swap against
+ */
+bool GSLMatrix::SwapRows(size_t i, size_t j)
+{
+  return (gsl_matrix_swap_rows (matrix, i, j) == GSL_SUCCESS);
+};
+
+/** This function exchanges the \a i-th and \a j-th column of the matrix in-place.
+ * \param i i-th column to swap with ...
+ * \param j ... j-th column to swap against
+ */
+bool GSLMatrix::SwapColumns(size_t i, size_t j)
+{
+  return (gsl_matrix_swap_columns (matrix, i, j) == GSL_SUCCESS);
+};
+
+/** This function exchanges the \a i-th row and \a j-th column of the matrix in-place.
+ * The matrix must be square for this operation to be possible.
+ * \param i i-th row to swap with ...
+ * \param j ... j-th column to swap against
+ */
+bool GSLMatrix::SwapRowColumn(size_t i, size_t j)
+{
+  assert (rows == columns && "The matrix must be square for swapping row against column to be possible.");
+  return (gsl_matrix_swap_rowcol (matrix, i, j) == GSL_SUCCESS);
+};
+
+/** This function transposes the matrix.
+ * Note that the function is extended to the non-square case, where the matrix is re-allocated and copied.
+ */
+bool GSLMatrix::Transpose()
+{
+  if (rows == columns)// if square, use GSL
+    return (gsl_matrix_transpose (matrix) == GSL_SUCCESS);
+  else { // otherwise we have to copy a bit
+    gsl_matrix *dest = gsl_matrix_alloc(columns, rows);
+    for (size_t i=0;i<rows; i++)
+      for (size_t j=0;j<columns;j++) {
+        gsl_matrix_set(dest, j,i, gsl_matrix_get(matrix, i,j) );
+      }
+    gsl_matrix_free(matrix);
+    matrix = dest;
+    flip(rows, columns);
+    return true;
+  }
+};
+
+/* ============================ Properties ============================== */
+/** Checks whether matrix' elements are strictly null.
+ * \return true - is null, false - else
+ */
+bool GSLMatrix::IsNull()
+{
+  return gsl_matrix_isnull (matrix);
+};
+
+/** Checks whether matrix' elements are strictly positive.
+ * \return true - is positive, false - else
+ */
+bool GSLMatrix::IsPositive()
+{
+  return gsl_matrix_ispos (matrix);
+};
+
+/** Checks whether matrix' elements are strictly negative.
+ * \return true - is negative, false - else
+ */
+bool GSLMatrix::IsNegative()
+{
+  return gsl_matrix_isneg (matrix);
+};
+
+/** Checks whether matrix' elements are strictly non-negative.
+ * \return true - is non-negative, false - else
+ */
+bool GSLMatrix::IsNonNegative()
+{
+  return gsl_matrix_isnonneg (matrix);
+};
+
+/** This function performs a Cholesky decomposition to determine whether matrix is positive definite.
+ * We check whether GSL returns GSL_EDOM as error, indicating that decomposition failed due to matrix not being positive-definite.
+ * \return true - matrix is positive-definite, false - else
+ */
+bool GSLMatrix::IsPositiveDefinite()
+{
+  if (rows != columns)  // only possible for square matrices.
+    return false;
+  else
+    return (gsl_linalg_cholesky_decomp (matrix) != GSL_EDOM);
+};
+
+
+/** Calculates the determinant of the matrix.
+ * if matrix is square, uses LU decomposition.
+ */
+double GSLMatrix::Determinant()
+{
+  int signum = 0;
+  assert (rows == columns && "Determinant can only be calculated for square matrices.");
+  gsl_permutation *p = gsl_permutation_alloc(rows);
+  gsl_linalg_LU_decomp(matrix, p, &signum);
+  gsl_permutation_free(p);
+  return gsl_linalg_LU_det(matrix, signum); 
+};
+
Index: src/LinearAlgebra/gslmatrix.hpp
===================================================================
--- src/LinearAlgebra/gslmatrix.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/gslmatrix.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,70 @@
+/*
+ * gslmatrix.hpp
+ *
+ *  Created on: Jan 8, 2010
+ *      Author: heber
+ */
+
+#ifndef GSLMATRIX_HPP_
+#define GSLMATRIX_HPP_
+
+using namespace std;
+
+/*********************************************** includes ***********************************/
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gsl/gsl_matrix.h>
+
+/****************************************** forward declarations *****************************/
+
+class GSLMatrix;
+
+/********************************************** declarations *******************************/
+
+class GSLMatrix {
+  friend class LinearSystemOfEquations;
+
+public:
+  GSLMatrix(size_t m, size_t n);
+  GSLMatrix(const GSLMatrix * const src);
+  ~GSLMatrix();
+
+  // Accessing
+  void SetFromDoubleArray(double * x);
+  double Get(size_t m, size_t n);
+  void Set(size_t m, size_t n, double x);
+  double *Pointer(size_t m, size_t n);
+  const double *const_Pointer(size_t m, size_t n);
+
+  // Initializing
+  void SetAll(double x);
+  void SetZero();
+  void SetIdentity();
+
+  // Exchanging elements
+  bool SwapRows(size_t i, size_t j);
+  bool SwapColumns(size_t i, size_t j);
+  bool SwapRowColumn(size_t i, size_t j);
+  bool Transpose();
+  bool IsNull();
+  bool IsPositive();
+  bool IsNegative();
+  bool IsNonNegative();
+  bool IsPositiveDefinite();
+  double Determinant();
+
+  GSLMatrix& operator=(const GSLMatrix& rhs);
+
+private:
+  gsl_matrix *matrix;
+
+  size_t rows;
+  size_t columns;
+};
+
+
+#endif /* GSLMATRIX_HPP_ */
Index: src/LinearAlgebra/gslvector.cpp
===================================================================
--- src/LinearAlgebra/gslvector.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/gslvector.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,319 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * gslvector.cpp
+ *
+ *  Created on: Jan 8, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include <cassert>
+#include <cmath>
+#include <iostream>
+
+#include "LinearAlgebra/gslvector.hpp"
+#include "defs.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "VectorContent.hpp"
+
+/** Constructor of class GSLVector.
+ * Allocates GSL structures
+ * \param m dimension of vector
+ */
+GSLVector::GSLVector(size_t m) : dimension(m)
+{
+  vector = gsl_vector_calloc(dimension);
+};
+
+/** Copy constructor of class GSLVector.
+ * Allocates GSL structures and copies components from \a *src.
+ * \param *src source vector
+ */
+GSLVector::GSLVector(const GSLVector * const src) : dimension(src->dimension)
+{
+  vector = gsl_vector_alloc(dimension);
+  gsl_vector_memcpy (vector, src->vector);
+};
+
+/** Copy constructor of class GSLVector.
+ * Allocates GSL structures and copies components from \a *src.
+ * \param *src source vector
+ */
+GSLVector::GSLVector(const GSLVector & src) : dimension(src.dimension)
+{
+  vector = gsl_vector_alloc(dimension);
+  gsl_vector_memcpy (vector, src.vector);
+};
+
+/** Destructor of class GSLVector.
+ * Frees GSL structures
+ */
+GSLVector::~GSLVector()
+{
+  gsl_vector_free(vector);
+};
+
+/* ============================ Accessing =============================== */
+/** This function sets the vector from a double array.
+ * Creates a vector view of the array and performs a memcopy.
+ * \param *x array of values (no dimension check is performed)
+ */
+void GSLVector::SetFromDoubleArray(double * x)
+{
+  gsl_vector_view m = gsl_vector_view_array (x, dimension);
+  gsl_vector_memcpy (vector, &m.vector);
+};
+
+/**
+ * This function sets the GSLvector from an ordinary vector.
+ *
+ * Takes access to the internal gsl_vector and copies it
+ */
+void GSLVector::SetFromVector(Vector &v){
+  gsl_vector_memcpy (vector, v.get()->content);
+}
+
+/** This function returns the i-th element of a vector.
+ * If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked and 0 is returned.
+ * \param m m-th element
+ * \return  m-th element of vector
+ */
+double GSLVector::Get(size_t m) const
+{
+  return gsl_vector_get (vector, m);
+};
+
+/** This function sets the value of the \a m -th element of a vector to \a x.
+ *  If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked.
+ * \param m-th element to set
+ * \param x value to set to
+ */
+void GSLVector::Set(size_t m, double x)
+{
+  gsl_vector_set (vector, m, x);
+};
+
+/** These functions return a pointer to the \a m-th element of a vector.
+ *  If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked and a null pointer is returned.
+ * \param m m-th element
+ * \return pointer to \a m-th element
+ */
+double *GSLVector::Pointer(size_t m) const
+{
+  return gsl_vector_ptr (vector, m);
+};
+
+/** These functions return a constant pointer to the \a m-th element of a vector.
+ *  If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked and a null pointer is returned.
+ * \param m m-th element
+ * \return const pointer to \a m-th element
+ */
+const double *GSLVector::const_Pointer(size_t m) const
+{
+  return gsl_vector_const_ptr (vector, m);
+};
+
+/** Returns the dimension of the vector.
+ * \return dimension of vector
+ */
+#ifdef HAVE_INLINE
+inline
+#endif
+size_t GSLVector::GetDimension() const
+{
+  return dimension;
+};
+
+/* ========================== Initializing =============================== */
+/** This function sets all the elements of the vector to the value \a x.
+ * \param *x
+ */
+void GSLVector::SetAll(double x)
+{
+  gsl_vector_set_all (vector, x);
+};
+
+/** This function sets all the elements of the vector to zero.
+ */
+void GSLVector::SetZero()
+{
+  gsl_vector_set_zero (vector);
+};
+
+/** This function makes a basis vector by setting all the elements of the vector to zero except for the i-th element which is set to one.
+ * \param i i-th component to set to unity (all other to zero)
+ * \return vector set
+ */
+int GSLVector::SetBasis(size_t i)
+{
+  return gsl_vector_set_basis (vector, i);
+};
+
+/* ====================== Exchanging elements ============================ */
+/** This function exchanges the \a i-th and \a j-th elements of the vector in-place.
+ * \param i i-th element to swap with ...
+ * \param j ... j-th element to swap against
+ */
+int GSLVector::SwapElements(size_t i, size_t j)
+{
+  return gsl_vector_swap_elements (vector, i, j);
+};
+
+/** This function reverses the order of the elements of the vector.
+ */
+int GSLVector::Reverse()
+{
+  return gsl_vector_reverse (vector);
+};
+
+
+/* ========================== Operators =============================== */
+/** Compares GSLVector \a to GSLVector \a b component-wise.
+ * \param a base GSLVector
+ * \param b GSLVector components to add
+ * \return a == b
+ */
+bool operator==(const GSLVector& a, const GSLVector& b)
+{
+  bool status = true;
+  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
+  for (size_t i=0;i<a.GetDimension();i++)
+    status = status && (fabs(a.Get(i) - b.Get(i)) < MYEPSILON);
+  return status;
+};
+
+/** Sums GSLVector \a to this lhs component-wise.
+ * \param a base GSLVector
+ * \param b GSLVector components to add
+ * \return lhs + a
+ */
+const GSLVector& operator+=(GSLVector& a, const GSLVector& b)
+{
+  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
+  for (size_t i=0;i<a.GetDimension();i++)
+    a.Set(i,a.Get(i)+b.Get(i));
+  return a;
+};
+
+/** Subtracts GSLVector \a from this lhs component-wise.
+ * \param a base GSLVector
+ * \param b GSLVector components to add
+ * \return lhs - a
+ */
+const GSLVector& operator-=(GSLVector& a, const GSLVector& b)
+{
+  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
+  for (size_t i=0;i<a.GetDimension();i++)
+    a.Set(i,a.Get(i)-b.Get(i));
+  return a;
+};
+
+/** factor each component of \a a times a double \a m.
+ * \param a base GSLVector
+ * \param m factor
+ * \return lhs.Get(i) * m
+ */
+const GSLVector& operator*=(GSLVector& a, const double m)
+{
+  for (size_t i=0;i<a.GetDimension();i++)
+    a.Set(i,a.Get(i)*m);
+  return a;
+};
+
+/** Sums two GSLVectors \a  and \b component-wise.
+ * \param a first GSLVector
+ * \param b second GSLVector
+ * \return a + b
+ */
+GSLVector const operator+(const GSLVector& a, const GSLVector& b)
+{
+  GSLVector x(a);
+  for (size_t i=0;i<a.GetDimension();i++)
+    x.Set(i,a.Get(i)+b.Get(i));
+  return x;
+};
+
+/** Subtracts GSLVector \a from \b component-wise.
+ * \param a first GSLVector
+ * \param b second GSLVector
+ * \return a - b
+ */
+GSLVector const operator-(const GSLVector& a, const GSLVector& b)
+{
+  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
+  GSLVector x(a);
+  for (size_t i=0;i<a.GetDimension();i++)
+    x.Set(i,a.Get(i)-b.Get(i));
+  return x;
+};
+
+/** Factors given GSLVector \a a times \a m.
+ * \param a GSLVector
+ * \param m factor
+ * \return m * a
+ */
+GSLVector const operator*(const GSLVector& a, const double m)
+{
+  GSLVector x(a);
+  for (size_t i=0;i<a.GetDimension();i++)
+    x.Set(i,a.Get(i)*m);
+  return x;
+};
+
+/** Factors given GSLVector \a a times \a m.
+ * \param m factor
+ * \param a GSLVector
+ * \return m * a
+ */
+GSLVector const operator*(const double m, const GSLVector& a )
+{
+  GSLVector x(a);
+  for (size_t i=0;i<a.GetDimension();i++)
+    x.Set(i,a.Get(i)*m);
+  return x;
+};
+
+ostream& operator<<(ostream& ost, const GSLVector& m)
+{
+  ost << "(";
+  for (size_t i=0;i<m.GetDimension();i++) {
+    ost << m.Get(i);
+    if (i != 2)
+      ost << ",";
+  }
+  ost << ")";
+  return ost;
+};
+
+/* ====================== Checking State ============================ */
+/** Checks whether vector has all components zero.
+ * @return true - vector is zero, false - vector is not
+ */
+bool GSLVector::IsZero() const
+{
+  return (fabs(Get(0))+fabs(Get(1))+fabs(Get(2)) < MYEPSILON);
+};
+
+/** Checks whether vector has length of 1.
+ * @return true - vector is normalized, false - vector is not
+ */
+bool GSLVector::IsOne() const
+{
+  double NormValue = 0.;
+  for (size_t i=dimension;--i;)
+    NormValue += Get(i)*Get(i);
+  return (fabs(NormValue - 1.) < MYEPSILON);
+};
+
Index: src/LinearAlgebra/gslvector.hpp
===================================================================
--- src/LinearAlgebra/gslvector.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/gslvector.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,80 @@
+/*
+ * gslvector.hpp
+ *
+ *  Created on: Jan 8, 2010
+ *      Author: heber
+ */
+
+#ifndef GSLVECTOR_HPP_
+#define GSLVECTOR_HPP_
+
+using namespace std;
+
+/*********************************************** includes ***********************************/
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iosfwd>
+#include <gsl/gsl_vector.h>
+
+/****************************************** forward declarations *****************************/
+
+class GSLVector;
+class Vector;
+
+/********************************************** declarations *******************************/
+
+class GSLVector {
+  friend class LinearSystemOfEquations;
+
+public:
+  GSLVector(size_t m);
+  GSLVector(const GSLVector * const src);
+  GSLVector(const GSLVector & src);
+  ~GSLVector();
+
+  // Accessing
+  void SetFromDoubleArray(double *x);
+  void SetFromVector(Vector &v);
+  double Get(size_t m) const;
+  void Set(size_t m, double x);
+  double *Pointer(size_t m) const;
+  const double *const_Pointer(size_t m) const;
+  size_t GetDimension() const;
+
+  // Initializing
+  void SetAll(double x);
+  void SetZero();
+  int SetBasis(size_t m);
+
+  // Exchanging elements
+  int SwapElements(size_t i, size_t j);
+  int Reverse();
+
+  // checking state
+  bool IsZero() const;
+  bool IsOne() const;
+
+private:
+  gsl_vector *vector;
+
+  const size_t dimension;
+};
+
+ostream & operator << (ostream& ost, const GSLVector &m);
+bool operator==(const GSLVector& a, const GSLVector& b);
+const GSLVector& operator+=(GSLVector& a, const GSLVector& b);
+const GSLVector& operator-=(GSLVector& a, const GSLVector& b);
+const GSLVector& operator*=(GSLVector& a, const double m);
+GSLVector const operator*(const GSLVector& a, const double m);
+GSLVector const operator*(const double m, const GSLVector& a);
+GSLVector const operator+(const GSLVector& a, const GSLVector& b);
+GSLVector const operator-(const GSLVector& a, const GSLVector& b);
+
+
+
+
+#endif /* GSLVECTOR_HPP_ */
Index: src/LinearAlgebra/linearsystemofequations.cpp
===================================================================
--- src/LinearAlgebra/linearsystemofequations.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/linearsystemofequations.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,143 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * linearsystemofequations.cpp
+ *
+ *  Created on: Jan 8, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "defs.hpp"
+#include "LinearAlgebra/gslmatrix.hpp"
+#include "LinearAlgebra/gslvector.hpp"
+#include "LinearAlgebra/linearsystemofequations.hpp"
+#include "Helpers/logger.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
+#include <cassert>
+#include <gsl/gsl_permutation.h>
+
+/** Constructor for class LinearSystemOfEquations.
+ * Allocates Vector and Matrix classes.
+ * \param m column dimension
+ * \param n row dimension
+ */
+LinearSystemOfEquations::LinearSystemOfEquations(int m, int n) : rows(m), columns(n), IsSymmetric(false)
+{
+  A = new GSLMatrix(m, n);
+  b = new GSLVector(m);
+  x = new GSLVector(n);
+};
+
+/** Destructor for class LinearSystemOfEquations.
+ * Destructs Vector and Matrix classes.
+ */
+LinearSystemOfEquations::~LinearSystemOfEquations()
+{
+  delete(A);
+  delete(b);
+  delete(x);
+};
+
+/** Sets whether matrix is to be regarded as symmetric.
+ * Note that we do not check whether it really is, just take upper diagonal.
+ * \param symmetric true or false
+ */
+bool LinearSystemOfEquations::SetSymmetric(bool symmetric)
+{
+  assert (rows == columns && "Rows and columns don't have equal size! Setting symmetric not possible.");
+  return (IsSymmetric = symmetric);
+};
+
+/** Initializes vector b to the components of the given vector.
+ * \param *x Vector with equal dimension (no check!)
+ */
+void LinearSystemOfEquations::Setb(Vector *x)
+{
+  assert ( columns == NDIM && "Vector class is always three-dimensional, unlike this LEqS!");
+  b->SetFromVector(*x);
+};
+
+/** Initializes vector b to the components of the given vector.
+ * \param *x array with equal dimension (no check!)
+ */
+void LinearSystemOfEquations::Setb(double *x)
+{
+  b->SetFromDoubleArray(x);
+};
+
+/** Initializes matrix a to the components of the given array.
+ * note that sort order should be
+ * \param *x array with equal dimension (no check!)
+ */
+void LinearSystemOfEquations::SetA(double *x)
+{
+  A->SetFromDoubleArray(x);
+};
+
+/** Returns the solution vector x \f$A \cdot x = b\f$ as an array of doubles.
+ * \param *array pointer allocated array for solution on return (no bounds check, dimension must match)
+ * \return true - solving possible, false - some error occured.
+ */
+bool LinearSystemOfEquations::GetSolutionAsArray(double *&array)
+{
+  bool status = Solve();
+
+  // copy solution
+  for (size_t i=0;i<x->dimension;i++) {
+    array[i] = x->Get(i);
+  }
+  return status;
+};
+
+/** Returns the solution vector x \f$A \cdot x = b\f$ as an array of doubles.
+ * \param &x solution vector on return (must be 3-dimensional)
+ * \return true - solving possible, false - some error occured.
+ */
+bool LinearSystemOfEquations::GetSolutionAsVector(Vector &v)
+{
+  assert(rows == NDIM && "Solution can only be returned as vector if number of columns is NDIM.");
+  bool status = Solve();
+
+  // copy solution
+  for (size_t i=0;i<x->dimension;i++)
+    v[i] = x->Get(i);
+  return status;
+};
+
+/** Solves the given system of \f$A \cdot x = b\f$.
+ * Use either LU or Householder decomposition.
+ * Solution is stored in LinearSystemOfEquations::x
+ * \return true - solving possible, false - some error occured.
+ */
+bool LinearSystemOfEquations::Solve()
+{
+  // calculate solution
+  int s;
+  if (IsSymmetric) { // use LU
+    gsl_permutation * p = gsl_permutation_alloc (x->dimension);
+    gsl_linalg_LU_decomp (A->matrix, p, &s);
+    gsl_linalg_LU_solve (A->matrix, p, b->vector, x->vector);
+    gsl_permutation_free (p);
+  } else {  // use Householder
+    //GSLMatrix *backup = new GSLMatrix(rows,columns);
+    //*backup = *A;
+    gsl_linalg_HH_solve (A->matrix, b->vector, x->vector);
+    //*A = *backup;
+    //delete(backup);
+  }
+  return true;
+};
+
Index: src/LinearAlgebra/linearsystemofequations.hpp
===================================================================
--- src/LinearAlgebra/linearsystemofequations.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/linearsystemofequations.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,59 @@
+/*
+ * linearsystemofequations.hpp
+ *
+ *  Created on: Jan 8, 2010
+ *      Author: heber
+ */
+
+#ifndef LINEARSYSTEMSOFEQUATIONS_HPP
+#define LINEARSYSTEMSOFEQUATIONS_HPP
+
+/*********************************************** includes ***********************************/
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gsl/gsl_linalg.h>
+
+/****************************************** forward declarations *****************************/
+
+class Vector;
+class GSLMatrix;
+class GSLVector;
+
+/********************************************** declarations *******************************/
+
+/** Solver class for a linear system of equations in the form \f$A \cdot x = b\F$.
+ *
+ */
+class LinearSystemOfEquations {
+public:
+  LinearSystemOfEquations(int n, int m);
+  ~LinearSystemOfEquations();
+
+  // setting
+  void Setb(Vector *x);
+  void Setb(double *x);
+  void SetA(double *x);
+  bool SetSymmetric(bool symmetric);
+
+  // solving
+  bool GetSolutionAsArray(double *&array);
+  bool GetSolutionAsVector(Vector &v);
+
+  GSLVector *b;
+  GSLVector *x;
+  GSLMatrix *A;
+
+private:
+  bool Solve();
+
+  int rows;
+  int columns;
+
+  bool IsSymmetric;
+};
+
+#endif /* LINEARSYSTEMSOFEQUATIONS_HPP */
Index: src/LinearAlgebra/vector_ops.cpp
===================================================================
--- src/LinearAlgebra/vector_ops.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/vector_ops.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,127 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * vector_ops.cpp
+ *
+ *  Created on: Apr 1, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Plane.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/gslmatrix.hpp"
+#include "leastsquaremin.hpp"
+#include "Helpers/Info.hpp"
+#include "Helpers/fast_functions.hpp"
+#include "Exceptions/LinearDependenceException.hpp"
+#include "Exceptions/SkewException.hpp"
+
+#include <gsl/gsl_linalg.h>
+#include <gsl/gsl_matrix.h>
+#include <gsl/gsl_permutation.h>
+#include <gsl/gsl_vector.h>
+#include <gsl/gsl_multimin.h>
+
+/**
+ * !@file
+ * These files defines several common operation on vectors that should not
+ * become part of the main vector class, because they are either to complex
+ * or need methods from other subsystems that should not be moved to
+ * the LinAlg-Subsystem
+ */
+
+/** Creates a new vector as the one with least square distance to a given set of \a vectors.
+ * \param *vectors set of vectors
+ * \param num number of vectors
+ * \return true if success, false if failed due to linear dependency
+ */
+bool LSQdistance(Vector &res,const Vector **vectors, int num)
+{
+  int j;
+
+  for (j=0;j<num;j++) {
+    Log() << Verbose(1) << j << "th atom's vector: " << vectors[j] << endl;
+  }
+
+  int np = 3;
+  struct LSQ_params par;
+
+   const gsl_multimin_fminimizer_type *T =
+     gsl_multimin_fminimizer_nmsimplex;
+   gsl_multimin_fminimizer *s = NULL;
+   gsl_vector *ss, *y;
+   gsl_multimin_function minex_func;
+
+   size_t iter = 0, i;
+   int status;
+   double size;
+
+   /* Initial vertex size vector */
+   ss = gsl_vector_alloc (np);
+   y = gsl_vector_alloc (np);
+
+   /* Set all step sizes to 1 */
+   gsl_vector_set_all (ss, 1.0);
+
+   /* Starting point */
+   par.vectors = vectors;
+   par.num = num;
+
+   for (i=NDIM;i--;)
+    gsl_vector_set(y, i, (vectors[0]->at(i) - vectors[1]->at(i))/2.);
+
+   /* Initialize method and iterate */
+   minex_func.f = &LSQ;
+   minex_func.n = np;
+   minex_func.params = (void *)&par;
+
+   s = gsl_multimin_fminimizer_alloc (T, np);
+   gsl_multimin_fminimizer_set (s, &minex_func, y, ss);
+
+   do
+     {
+       iter++;
+       status = gsl_multimin_fminimizer_iterate(s);
+
+       if (status)
+         break;
+
+       size = gsl_multimin_fminimizer_size (s);
+       status = gsl_multimin_test_size (size, 1e-2);
+
+       if (status == GSL_SUCCESS)
+         {
+           printf ("converged to minimum at\n");
+         }
+
+       printf ("%5d ", (int)iter);
+       for (i = 0; i < (size_t)np; i++)
+         {
+           printf ("%10.3e ", gsl_vector_get (s->x, i));
+         }
+       printf ("f() = %7.3f size = %.3f\n", s->fval, size);
+     }
+   while (status == GSL_CONTINUE && iter < 100);
+
+  for (i=(size_t)np;i--;)
+    res[i] = gsl_vector_get(s->x, i);
+   gsl_vector_free(y);
+   gsl_vector_free(ss);
+   gsl_multimin_fminimizer_free (s);
+
+  return true;
+};
Index: src/LinearAlgebra/vector_ops.hpp
===================================================================
--- src/LinearAlgebra/vector_ops.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/LinearAlgebra/vector_ops.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+/*
+ * vector_ops.hpp
+ *
+ *  Created on: Apr 1, 2010
+ *      Author: crueger
+ */
+
+#ifndef VECTOR_OPS_HPP_
+#define VECTOR_OPS_HPP_
+
+bool LSQdistance(Vector &res,const Vector **vectors, int num);
+
+#endif /* VECTOR_OPS_HPP_ */
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -2,13 +2,9 @@
 # Also indentation by a single tab
 
-SUBDIRS = Actions Exceptions Parser UIElements
-
-# this includes source files that need to be present at multiple points
-HELPERSOURCE =  \
-  Helpers/Assert.cpp \
-  Helpers/MemDebug.cpp
-		        
+SUBDIRS = Actions Exceptions Helpers LinearAlgebra Parser UIElements
+
 ATOMSOURCE = \
   atom.cpp \
+  AtomicInfo.cpp \
   atom_atominfo.cpp \
   atom_bondedparticle.cpp \
@@ -21,4 +17,5 @@
 ATOMHEADER = \
   atom.hpp \
+  AtomicInfo.hpp \
   atom_atominfo.hpp \
   atom_bondedparticle.hpp \
@@ -30,19 +27,4 @@
   atom_trajectoryparticleinfo.hpp
 
-LINALGSOURCE = \
-  ${HELPERSOURCE} \
-  gslmatrix.cpp \
-  gslvector.cpp \
-  linearsystemofequations.cpp \
-  Space.cpp \
-  vector.cpp
-			   
-LINALGHEADER = \
-  gslmatrix.hpp \
-  gslvector.hpp \
-  linearsystemofequations.hpp \
-  Space.hpp \
-  vector.hpp
-			   
 ANALYSISSOURCE = \
   analysis_bonds.cpp \
@@ -76,4 +58,5 @@
   Actions/MethodAction.hpp \
   Actions/Process.hpp
+
 
 PATTERNSOURCE = \
@@ -92,25 +75,10 @@
   Shapes/Shape.hpp \
   Shapes/ShapeOps.hpp
+
   
-
-QTUIMOC_HEADER = UIElements/QT4/QTDialog.hpp \
-	UIElements/QT4/QTMainWindow.hpp \
-	UIElements/Menu/QT4/QTMenu.hpp \
-	UIElements/Views/QT4/QTWorldView.hpp \
-	UIElements/Views/QT4/GLMoleculeView.hpp \
-	UIElements/Views/QT4/QTMoleculeView.hpp \
-	UIElements/Views/QT4/QTStatusBar.hpp
- 
-QTUIMOC_TARGETS = QTMainWindow.moc.cpp \
-	QTMenu.moc.cpp\
-	QTDialog.moc.cpp \
-	QTWorldView.moc.cpp \
-	GLMoleculeView.moc.cpp \
-	QTMoleculeView.moc.cpp \
-	QTStatusBar.moc.cpp
-
 DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp \
   Descriptors/AtomIdDescriptor.cpp \
   Descriptors/AtomSelectionDescriptor.cpp \
+  Descriptors/AtomShapeDescriptor.cpp \
   Descriptors/AtomTypeDescriptor.cpp \
   Descriptors/MoleculeDescriptor.cpp \
@@ -125,4 +93,5 @@
   Descriptors/AtomIdDescriptor.hpp \
   Descriptors/AtomSelectionDescriptor.hpp \
+  Descriptors/AtomShapeDescriptor.hpp \
   Descriptors/AtomTypeDescriptor.hpp \
   Descriptors/MoleculeDescriptor.hpp \
@@ -132,6 +101,32 @@
   Descriptors/MoleculePtrDescriptor.hpp \
   Descriptors/MoleculeSelectionDescriptor.cpp
+  
+THERMOSTATSOURCE = \
+  Thermostats/Berendsen.cpp \
+  Thermostats/GaussianThermostat.cpp \
+  Thermostats/Langevin.cpp \
+  Thermostats/NoseHoover.cpp \
+  Thermostats/NoThermostat.cpp \
+  Thermostats/Thermostat.cpp \
+  Thermostats/Woodcock.cpp
+
+THERMOSTATHEADER = \
+  Thermostats/Berendsen.hpp \
+  Thermostats/GaussianThermostat.hpp \
+  Thermostats/Langevin.hpp \
+  Thermostats/NoseHoover.hpp \
+  Thermostats/NoThermostat.hpp \
+  Thermostats/Thermostat.hpp \
+  Thermostats/Woodcock.hpp
+
+QTUIMOC_HEADER = UIElements/QT4/QTDialog.hpp \
+	UIElements/QT4/QTMainWindow.hpp \
+	UIElements/Menu/QT4/QTMenu.hpp \
+	UIElements/Views/QT4/QTWorldView.hpp \
+	UIElements/Views/QT4/GLMoleculeView.hpp \
+	UIElements/Views/QT4/QTMoleculeView.hpp \
+	UIElements/Views/QT4/QTStatusBar.hpp
 				  
-QTUISOURCE = ${QTUIMOC_TARGETS} \
+QTUISOURCE = allmocs.moc.cpp \
 	UIElements/QT4/QTMainWindow.cpp \
 	UIElements/QT4/QTDialog.cpp \
@@ -147,13 +142,35 @@
 QTUI_DEFS =
 
-SOURCE = \
+TESSELATIONSOURCE = \
+  BoundaryLineSet.cpp \
+  BoundaryPointSet.cpp \
+  BoundaryPolygonSet.cpp \
+  BoundaryTriangleSet.cpp \
+  CandidateForTesselation.cpp \
+  PointCloud.cpp \
+  tesselation.cpp \
+  tesselationhelpers.cpp \
+  TesselPoint.cpp
+  
+TESSELATIONHEADER = \
+  BoundaryLineSet.hpp \
+  BoundaryPointSet.hpp \
+  BoundaryPolygonSet.hpp \
+  BoundaryTriangleSet.hpp \
+  CandidateForTesselation.hpp \
+  PointCloud.hpp \
+  tesselation.hpp \
+  tesselationhelpers.hpp \
+  TesselPoint.hpp
+
+MOLECUILDERSOURCE = \
   ${ANALYSISSOURCE} \
   ${ACTIONSSOURCE} \
   ${ATOMSOURCE} \
   ${PATTERNSOURCE} \
-  ${PARSERSOURCE} \
   ${SHAPESOURCE} \
   ${DESCRIPTORSOURCE} \
-  ${HELPERSOURCE} \
+  ${THERMOSTATSOURCE} \
+  ${TESSELATIONSOURCE} \
   bond.cpp \
   bondgraph.cpp \
@@ -163,18 +180,12 @@
   config.cpp \
   ConfigFileBuffer.cpp \
+  defs.cpp \
   element.cpp \
   elements_db.cpp \
   ellipsoid.cpp \
-  errorlogger.cpp \
   Formula.cpp \
   graph.cpp \
-  helpers.cpp \
-  info.cpp \
   leastsquaremin.cpp \
-  Line.cpp \
   linkedcell.cpp \
-  log.cpp \
-  logger.cpp \
-  Matrix.cpp \
   moleculelist.cpp \
   molecule.cpp \
@@ -186,24 +197,18 @@
   parser.cpp \
   periodentafel.cpp \
-  Plane.cpp \
-  Space.cpp \
-  tesselation.cpp \
-  tesselationhelpers.cpp \
   ThermoStatContainer.cpp \
   triangleintersectionlist.cpp \
   UIElements/UIFactory.cpp \
-  vector.cpp \
-  vector_ops.cpp \
-  verbose.cpp \
   World.cpp
 
-HEADER = \
+MOLECUILDERHEADER = \
   ${ANALYSISHEADER} \
   ${ACTIONSHEADER} \
   ${ATOMHEADER} \
-  ${PARSERHEADER} \
   ${PATTERNHEADER} \
   ${SHAPEHEADER} \
   ${DESCRIPTORHEADER} \
+  ${THERMOSTATHEADER} \
+  ${TESSELATIONHEADER} \
   bond.hpp \
   bondgraph.hpp \
@@ -217,36 +222,70 @@
   elements_db.hpp \
   ellipsoid.hpp \
-  errorlogger.hpp \
   Formula.hpp \
   graph.hpp \
-  helpers.hpp \
-  info.hpp \
   leastsquaremin.hpp \
-  Line.hpp \
   linkedcell.hpp \
   lists.hpp \
-  log.hpp \
-  logger.hpp \
-  Matrix.hpp \
   molecule.hpp \
-  molecule_template.hpp \
   parser.hpp \
   periodentafel.hpp \
-  Plane.hpp \
   stackclass.hpp \
-  tesselation.hpp \
-  tesselationhelpers.hpp \
   ThermoStatContainer.hpp \
   triangleintersectionlist.hpp \
   UIElements/UIFactory.hpp \
-  verbose.hpp \
-  vector_ops.hpp \
   World.hpp 
 
-# the following files are no longer used:
-#  memoryallocator.hpp \
-#  memoryallocator.cpp \
-#  memoryusageobserver.hpp \
-#  memoryusageobserver.cpp
+lib_LTLIBRARIES = libMolecuilder-@MOLECUILDER_API_VERSION@.la
+libMolecuilder_includedir = $(includedir)/molecuilder-$(MOLECUILDER_API_VERSION)/Actions/
+libMolecuilder_LIBS = \
+	LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
+	${BOOST_PROGRAM_OPTIONS_LIB}
+
+#	UIElements/libMolecuilderUI.a \
+	Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la \
+	Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la \
+	Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
+	Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
+	$(BOOST_LIB) \
+	${BOOST_THREAD_LIB}
+
+nobase_libMolecuilder_include_HEADERS = ${MOLECUILDERHEADER}
+
+## Define the source file list for the "libexample-@MOLECUILDER_API_VERSION@.la"
+## target.  Note that @MOLECUILDER_API_VERSION@ is not interpreted by Automake and
+## will therefore be treated as if it were literally part of the target name,
+## and the variable name derived from that.
+## The file extension .cc is recognized by Automake, and makes it produce
+## rules which invoke the C++ compiler to produce a libtool object file (.lo)
+## from each source file.  Note that it is not necessary to list header files
+## which are already listed elsewhere in a _HEADERS variable assignment.
+libMolecuilder_@MOLECUILDER_API_VERSION@_la_SOURCES = ${MOLECUILDERSOURCE} $(srcdir)/version.c
+
+## Instruct libtool to include ABI version information in the generated shared
+## library file (.so).  The library ABI version is defined in configure.ac, so
+## that all version information is kept in one place.
+libMolecuilder_@MOLECUILDER_API_VERSION@_la_LDFLAGS = -version-info $(MOLECUILDER_SO_VERSION)
+
+## The generated configuration header is installed in its own subdirectory of
+## $(libdir).  The reason for this is that the configuration information put
+## into this header file describes the target platform the installed library
+## has been built for.  Thus the file must not be installed into a location
+## intended for architecture-independent files, as defined by the Filesystem
+## Hierarchy Standard (FHS).
+## The nodist_ prefix instructs Automake to not generate rules for including
+## the listed files in the distribution on 'make dist'.  Files that are listed
+## in _HEADERS variables are normally included in the distribution, but the
+## configuration header file is generated at configure time and should not be
+## shipped with the source tarball.
+libMolecuilder_libincludedir = $(libdir)/molecuilder-$(MOLECUILDER_API_VERSION)/include
+nodist_libMolecuilder_libinclude_HEADERS = $(top_builddir)/libmolecuilder_config.h
+
+## Install the generated pkg-config file (.pc) into the expected location for
+## architecture-dependent package configuration information.  Occasionally,
+## pkg-config files are also used for architecture-independent data packages,
+## in which case the correct install location would be $(datadir)/pkgconfig.
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc
+
 
 BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB)
@@ -254,13 +293,11 @@
 INCLUDES = -I$(top_srcdir)/src/unittests -I$(top_srcdir)/src/Actions -I$(top_srcdir)/src/UIElements
 
-noinst_LIBRARIES = libmolecuilder.a libgslwrapper.a libmenu.a
+noinst_LIBRARIES = libmenu.a
 bin_PROGRAMS = molecuilder molecuildergui joiner analyzer
+EXTRA_PROGRAMS = unity
 
 molecuilderdir = ${bindir}
 
-libmolecuilder_a_SOURCES = ${SOURCE} ${HEADER} $(srcdir)/version.c
-
 libmenu_a_SOURCES = ${UISOURCE} ${UIHEADER} 
-libgslwrapper_a_SOURCES = ${LINALGSOURCE} ${LINALGHEADER}
 
 molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db
@@ -270,18 +307,63 @@
 molecuilder_LDFLAGS = $(BOOST_LIB)
 molecuilder_SOURCES = builder.cpp
-molecuilder_LDADD = UIElements/libMolecuilderUI.a Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la libmolecuilder.a Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la libgslwrapper.a Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
+molecuilder_LDADD = \
+	UIElements/libMolecuilderUI-@MOLECUILDER_API_VERSION@.la \
+	Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la \
+	libMolecuilder-@MOLECUILDER_API_VERSION@.la \
+	Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la \
+	LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
+	Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
+	Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
+	$(BOOST_LIB) \
+	${BOOST_THREAD_LIB} \
+	${BOOST_PROGRAM_OPTIONS_LIB}
+
 
 #Stuff for building the GUI using QT
 molecuildergui_SOURCES = ${QTUISOURCE} builder.cpp
-molecuildergui_SOURCES += $(srcdir)/version.c
 molecuildergui_CXXFLAGS = ${QT_CXXFLAGS} ${GLU_CXXFLAGS} -DUSE_GUI_QT
 molecuildergui_LDFLAGS = $(BOOST_LIB) ${QT_LDFLAGS} ${GLU_LDFLAGS}
-molecuildergui_LDADD = UIElements/libMolecuilderUI.a Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la libmolecuilder.a Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la libgslwrapper.a Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}  ${GUI_LIBS}
-
-joiner_SOURCES = joiner.cpp datacreator.cpp parser.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp
-joiner_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
-
-analyzer_SOURCES = analyzer.cpp datacreator.cpp parser.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp 
-analyzer_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
+
+unity_SOURCES = unity.cpp
+unity_LDADD = $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
+
+molecuildergui_LDADD = \
+	UIElements/libMolecuilderUI-@MOLECUILDER_API_VERSION@.la \
+	Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la \
+	libMolecuilder-@MOLECUILDER_API_VERSION@.la \
+	Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la \
+	LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
+	Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
+	Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
+	$(BOOST_LIB) \
+	${BOOST_THREAD_LIB} \
+	${BOOST_PROGRAM_OPTIONS_LIB} \
+	${GUI_LIBS}
+
+joiner_SOURCES = joiner.cpp datacreator.cpp datacreator.hpp periodentafel.hpp
+joiner_LDADD = \
+	UIElements/libMolecuilderUI-@MOLECUILDER_API_VERSION@.la \
+	Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la \
+	libMolecuilder-@MOLECUILDER_API_VERSION@.la \
+	Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la \
+	LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
+	Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
+	Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
+	$(BOOST_LIB) \
+	${BOOST_THREAD_LIB} \
+	${BOOST_PROGRAM_OPTIONS_LIB}
+
+analyzer_SOURCES = analyzer.cpp datacreator.cpp periodentafel.hpp datacreator.hpp 
+analyzer_LDADD = \
+	UIElements/libMolecuilderUI-@MOLECUILDER_API_VERSION@.la \
+	Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la \
+	libMolecuilder-@MOLECUILDER_API_VERSION@.la \
+	Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la \
+	LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
+	Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
+	Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
+	$(BOOST_LIB) \
+	${BOOST_THREAD_LIB} \
+	${BOOST_PROGRAM_OPTIONS_LIB}
 
 #Rules needed for QT4
@@ -289,5 +371,6 @@
 # Therfore `%'-rules do not seem to work
 #Quick fix to get it done otherwise
-${QTUIMOC_TARGETS}: ${QTUIMOC_HEADER}
+allmocs.moc.cpp: ${QTUIMOC_HEADER}
+	echo "" > allmocs.moc.cpp;\
 	list='$(QTUIMOC_HEADER)'; for header in $$list; do \
 	echo "Making mocfile for $$header"; \
@@ -295,8 +378,7 @@
 	$(MOC) $(srcdir)/$$header -o $$target \
 	|| eval $$failcom; \
+	echo "#include \"$$target\"" >> allmocs.moc.cpp; \
 	done;
 
-MOSTLYCLEANFILES = ${QTUIMOC_TARGETS}
-	
 #EXTRA_DIST = ${molecuilder_DATA}
 
@@ -314,5 +396,21 @@
 
 $(srcdir)/version.c: $(srcdir)/.git-version
-	echo "const char *ESPACKVersion = \"$(PACKAGE_NAME) -- git version: "`cat $(srcdir)/.git-version`"\";" > $@
-
-
+	echo "const char *MOLECUILDERVERSION = \"$(PACKAGE_NAME) version "`cat $(srcdir)/.git-version`"\";" > $@
+
+
+unity.cpp: ${MOLECUILDERSOURCE} ${MOLECUILDERHEADER}
+	echo "#include \"$(srcdir)/Helpers/MemDebug.cpp\"" >  unity.cpp; \
+	list='$(MOLECUILDERSOURCE)'; for file in $$list; do \
+  	echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
+	done; \
+	subdirs='$(SUBDIRS)';for directory in $$subdirs; do\
+		olddir=$$PWD;\
+		cd $$directory && make unity.cpp;\
+		cd $$olddir;\
+		echo "#include \"$$directory/unity.cpp\"" >> unity.cpp;\
+	done;\
+	echo "#include \"$(srcdir)/builder.cpp\"" >> unity.cpp;
+	echo "#include \"$(srcdir)/version.c\"" >> unity.cpp;
+
+MOSTLYCLEANFILES = allmocs.moc.cpp unity.cpp 
+	
Index: c/Matrix.cpp
===================================================================
--- src/Matrix.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,284 +1,0 @@
-/*
- * Matrix.cpp
- *
- *  Created on: Jun 25, 2010
- *      Author: crueger
- */
-
-#include "Matrix.hpp"
-#include "Helpers/Assert.hpp"
-#include "Exceptions/NotInvertibleException.hpp"
-#include "Helpers/fast_functions.hpp"
-#include "Helpers/Assert.hpp"
-#include "vector.hpp"
-#include "VectorContent.hpp"
-#include "MatrixContent.hpp"
-
-#include <gsl/gsl_blas.h>
-#include <cmath>
-#include <iostream>
-
-using namespace std;
-
-Matrix::Matrix()
-{
-  content = new MatrixContent();
-  content->content = gsl_matrix_calloc(NDIM, NDIM);
-  createViews();
-}
-
-Matrix::Matrix(const double* src){
-  content = new MatrixContent();
-  content->content = gsl_matrix_alloc(NDIM, NDIM);
-  set(0,0, src[0]);
-  set(1,0, src[1]);
-  set(2,0, src[2]);
-
-  set(0,1, src[3]);
-  set(1,1, src[4]);
-  set(2,1, src[5]);
-
-  set(0,2, src[6]);
-  set(1,2, src[7]);
-  set(2,2, src[8]);
-  createViews();
-}
-
-Matrix::Matrix(const Matrix &src){
-  content = new MatrixContent();
-  content->content = gsl_matrix_alloc(NDIM, NDIM);
-  gsl_matrix_memcpy(content->content,src.content->content);
-  createViews();
-}
-
-Matrix::Matrix(MatrixContent* _content) :
-  content(_content)
-{
-  createViews();
-}
-
-Matrix::~Matrix()
-{
-  // delete all views
-  for(int i=NDIM;i--;){
-    delete rows_ptr[i];
-  }
-  for(int i=NDIM;i--;){
-    delete columns_ptr[i];
-  }
-  delete diagonal_ptr;
-  gsl_matrix_free(content->content);
-  delete content;
-}
-
-void Matrix::createViews(){
-  // create row views
-  for(int i=NDIM;i--;){
-    VectorContent *rowContent = new VectorViewContent(gsl_matrix_row(content->content,i));
-    rows_ptr[i] = new Vector(rowContent);
-  }
-  // create column views
-  for(int i=NDIM;i--;){
-    VectorContent *columnContent = new VectorViewContent(gsl_matrix_column(content->content,i));
-    columns_ptr[i] = new Vector(columnContent);
-  }
-  // create diagonal view
-  VectorContent *diagonalContent = new VectorViewContent(gsl_matrix_diagonal(content->content));
-  diagonal_ptr = new Vector(diagonalContent);
-}
-
-void Matrix::one(){
-  for(int i=NDIM;i--;){
-    for(int j=NDIM;j--;){
-      set(i,j,i==j);
-    }
-  }
-}
-
-Matrix &Matrix::operator=(const Matrix &src){
-  if(&src!=this){
-    gsl_matrix_memcpy(content->content,src.content->content);
-  }
-  return *this;
-}
-
-Matrix &Matrix::operator+=(const Matrix &rhs){
-  gsl_matrix_add(content->content, rhs.content->content);
-  return *this;
-}
-
-Matrix &Matrix::operator-=(const Matrix &rhs){
-  gsl_matrix_sub(content->content, rhs.content->content);
-  return *this;
-}
-
-Matrix &Matrix::operator*=(const Matrix &rhs){
-  (*this) = (*this)*rhs;
-  return *this;
-}
-
-Matrix Matrix::operator+(const Matrix &rhs) const{
-  Matrix tmp = *this;
-  tmp+=rhs;
-  return tmp;
-}
-
-Matrix Matrix::operator-(const Matrix &rhs) const{
-  Matrix tmp = *this;
-  tmp-=rhs;
-  return tmp;
-}
-
-Matrix Matrix::operator*(const Matrix &rhs) const{
-  gsl_matrix *res = gsl_matrix_alloc(NDIM, NDIM);
-  gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, content->content, rhs.content->content, 0.0, res);
-  MatrixContent *content= new MatrixContent();
-  content->content = res;
-  return Matrix(content);
-}
-
-double &Matrix::at(size_t i, size_t j){
-  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
-  ASSERT(j>=0&&j<NDIM,"Index j for Matrix access out of range");
-  return *gsl_matrix_ptr (content->content, i, j);
-}
-
-const double Matrix::at(size_t i, size_t j) const{
-  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
-  ASSERT(j>=0&&j<NDIM,"Index j for Matrix access out of range");
-  return gsl_matrix_get(content->content, i, j);
-}
-
-Vector &Matrix::row(size_t i){
-  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
-  return *rows_ptr[i];
-}
-
-const Vector &Matrix::row(size_t i) const{
-  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
-  return *rows_ptr[i];
-}
-
-Vector &Matrix::column(size_t i){
-  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
-  return *columns_ptr[i];
-}
-
-const Vector &Matrix::column(size_t i) const{
-  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
-  return *columns_ptr[i];
-}
-
-Vector &Matrix::diagonal(){
-  return *diagonal_ptr;
-}
-
-const Vector &Matrix::diagonal() const{
-  return *diagonal_ptr;
-}
-
-void Matrix::set(size_t i, size_t j, const double value){
-  ASSERT(i>=0&&i<NDIM,"Index i for Matrix access out of range");
-  ASSERT(j>=0&&j<NDIM,"Index j for Matrix access out of range");
-  gsl_matrix_set(content->content,i,j,value);
-}
-
-double Matrix::determinant() const{
-  return at(0,0)*at(1,1)*at(2,2)
-       + at(0,1)*at(1,2)*at(2,0)
-       + at(0,2)*at(1,0)*at(2,1)
-       - at(2,0)*at(1,1)*at(0,2)
-       - at(2,1)*at(1,2)*at(0,0)
-       - at(2,2)*at(1,0)*at(0,1);
-}
-
-Matrix Matrix::invert() const{
-  double det = determinant();
-  if(fabs(det)<MYEPSILON){
-    throw NotInvertibleException(__FILE__,__LINE__);
-  }
-
-  double detReci = 1./det;
-  Matrix res;
-  res.set(0,0,  detReci*RDET2(at(1,1),at(2,1),at(1,2),at(2,2)));    // A_11
-  res.set(1,0, -detReci*RDET2(at(1,0),at(2,0),at(1,2),at(2,2)));    // A_21
-  res.set(2,0,  detReci*RDET2(at(1,0),at(2,0),at(1,1),at(2,1)));    // A_31
-  res.set(0,1, -detReci*RDET2(at(0,1),at(2,1),at(0,2),at(2,2)));    // A_12
-  res.set(1,1,  detReci*RDET2(at(0,0),at(2,0),at(0,2),at(2,2)));    // A_22
-  res.set(2,1, -detReci*RDET2(at(0,0),at(2,0),at(0,1),at(2,1)));    // A_32
-  res.set(0,2,  detReci*RDET2(at(0,1),at(1,1),at(0,2),at(1,2)));    // A_13
-  res.set(1,2, -detReci*RDET2(at(0,0),at(1,0),at(0,2),at(1,2)));    // A_23
-  res.set(2,2,  detReci*RDET2(at(0,0),at(1,0),at(0,1),at(1,1)));    // A_33
-  return res;
-}
-
-Matrix &Matrix::operator*=(const double factor){
-  gsl_matrix_scale(content->content, factor);
-  return *this;
-}
-
-Matrix operator*(const double factor,const Matrix& mat){
-  Matrix tmp = mat;
-  tmp*=factor;
-  return tmp;
-}
-
-Matrix operator*(const Matrix &mat,const double factor){
-  return factor*mat;
-}
-
-bool Matrix::operator==(const Matrix &rhs) const{
-  for(int i=NDIM;i--;){
-    for(int j=NDIM;j--;){
-      if(fabs(at(i,j)-rhs.at(i,j))>MYEPSILON){
-        return false;
-      }
-    }
-  }
-  return true;
-}
-
-/** Blows the 6-dimensional \a cell_size array up to a full NDIM by NDIM matrix.
- * \param *symm 6-dim array of unique symmetric matrix components
- * \return allocated NDIM*NDIM array with the symmetric matrix
- */
-Matrix ReturnFullMatrixforSymmetric(const double * const symm)
-{
-  Matrix matrix;
-  matrix.set(0,0, symm[0]);
-  matrix.set(1,0, symm[1]);
-  matrix.set(2,0, symm[3]);
-  matrix.set(0,1, symm[1]);
-  matrix.set(1,1, symm[2]);
-  matrix.set(2,1, symm[4]);
-  matrix.set(0,2, symm[3]);
-  matrix.set(1,2, symm[4]);
-  matrix.set(2,2, symm[5]);
-  return matrix;
-};
-
-ostream &operator<<(ostream &ost,const Matrix &mat){
-  for(int i = 0;i<NDIM;++i){
-    ost << "\n";
-    for(int j = 0; j<NDIM;++j){
-      ost << mat.at(i,j);
-      if(j!=NDIM-1)
-        ost << "; ";
-    }
-  }
-  return ost;
-}
-
-Vector operator*(const Matrix &mat,const Vector &vec){
-  gsl_vector *res = gsl_vector_calloc(NDIM);
-  gsl_blas_dgemv( CblasNoTrans, 1.0, mat.content->content, vec.content->content, 0.0, res);
-  VectorContent *content = new VectorContent();
-  content->content = res;
-  return Vector(content);
-}
-
-Vector &operator*=(Vector& lhs,const Matrix &mat){
-  lhs = mat*lhs;
-  return lhs;
-}
-
Index: c/Matrix.hpp
===================================================================
--- src/Matrix.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Matrix.hpp
- *
- *  Created on: Jun 25, 2010
- *      Author: crueger
- */
-
-#ifndef MATRIX_HPP_
-#define MATRIX_HPP_
-
-#include <iosfwd>
-#include "defs.hpp"
-
-/**
- * Simple class to store matrices with a few extra functions
- */
-
-class Vector;
-class MatrixContent;
-
-class Matrix
-{
-  friend Vector operator*(const Matrix&,const Vector&);
-public:
-  Matrix();
-
-  /**
-   * construct a matrix from a 3x3 double array that contains all Elements.
-   *
-   * The elements are laid out in the following way:
-   * array -> matrix
-   * 0 -> (0,0)
-   * 1 -> (1,0)
-   * 2 -> (2,0)
-   * 3 -> (0,1)
-   * 4 -> (1,1)
-   * 5 -> (2,1)
-   * 6 -> (0,2)
-   * 7 -> (1,2)
-   * 8 -> (2,2)
-   *
-   */
-  Matrix(const double*);
-  Matrix(const Matrix&);
-  virtual ~Matrix();
-
-  /**
-   * Set the matrix to a unit matrix.
-   */
-  void one();
-
-  /**
-   * Access the matrix at index (i,j)
-   */
-  double &at(size_t i, size_t j);
-  /**
-   * Access the matrix at index (i,j)
-   */
-  const double at(size_t i, size_t j) const;
-
-  /**
-   * Set the matrix at index (i,j).
-   *
-   * Slightly faster than at(i,j)=x
-   */
-  void set(size_t i, size_t j, const double value);
-
-  /**
-   * get the ith row of the matrix as a vector
-   */
-  Vector &row(size_t);
-  const Vector &row(size_t) const;
-
-  /**
-   * get the ith column of the matrix as a vector
-   */
-  Vector &column(size_t);
-  const Vector &column(size_t) const;
-
-  /**
-   * get the diagonal of the matrix as a vector
-   */
-  Vector &diagonal();
-  const Vector &diagonal() const;
-
-  /**
-   * Calculate the determinant of the matrix
-   */
-  double determinant() const;
-
-  /**
-   * Calculate the inverse of the matrix.
-   *
-   * Rather costly, so use precomputation as often as possible.
-   */
-  Matrix invert() const;
-
-  // operators
-  Matrix &operator=(const Matrix&);
-
-  Matrix &operator+=(const Matrix&);
-  Matrix &operator-=(const Matrix&);
-  Matrix &operator*=(const Matrix&);
-
-  Matrix &operator*=(const double);
-
-  Matrix operator+(const Matrix&) const;
-  Matrix operator-(const Matrix&) const;
-  Matrix operator*(const Matrix&) const;
-
-  bool operator==(const Matrix&) const;
-
-private:
-  Matrix(MatrixContent*);
-  void createViews();
-  MatrixContent *content;
-  // we keep around some Vector views of the matrix, to return references
-  Vector* rows_ptr[NDIM];
-  Vector* columns_ptr[NDIM];
-  Vector* diagonal_ptr;
-};
-
-Matrix operator*(const double,const Matrix&);
-Matrix operator*(const Matrix&,const double);
-
-/**
- * Takes a symmetric matrix that stores the lower diagonal and produces a
- * full matrix.
- *
- * The array is laid out as follows:
- *
- * array -> matrix
- * 0 -> (0,0)
- * 1 -> (1,0);(0,1)
- * 2 -> (1,1)
- * 3 -> (2,0);(0,2)
- * 4 -> (2,1);(1,2)
- * 5 -> (2,2)
- */
-Matrix ReturnFullMatrixforSymmetric(const double * const cell_size);
-
-std::ostream &operator<<(std::ostream&,const Matrix&);
-Vector operator*(const Matrix&,const Vector&);
-Vector& operator*=(Vector&,const Matrix&);
-
-#endif /* MATRIX_HPP_ */
Index: c/MatrixContent.hpp
===================================================================
--- src/MatrixContent.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,25 +1,0 @@
-/*
- * MatrixContent.hpp
- *
- *  Created on: Jul 2, 2010
- *      Author: crueger
- */
-
-#ifndef MATRIXCONTENT_HPP_
-#define MATRIXCONTENT_HPP_
-
-/**
- * !file
- * The way GSL works does not allow for forward definitions of the structures.
- * Because of this the pointer to the gsl_matrix struct is wrapped inside another
- * (dumb) object that allows for forward definitions. All methods of this class
- * are empty, to allow for a maximum of flexibility.
- */
-
-#include <gsl/gsl_matrix.h>
-
-struct MatrixContent{
-  gsl_matrix * content;
-};
-
-#endif /* MATRIXCONTENT_HPP_ */
Index: src/Parser/ChangeTracker.cpp
===================================================================
--- src/Parser/ChangeTracker.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Parser/ChangeTracker.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ChangeTracker.cpp
@@ -6,8 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
+
 #include "Parser/ChangeTracker.hpp"
 #include "Patterns/Singleton_impl.hpp"
-
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 
 /**
@@ -15,7 +29,7 @@
  */
 ChangeTracker::ChangeTracker() :
-  Observable("ChangeTracker")
+  Observable("ChangeTracker"),
+  isConsistent(true)
 {
-  isConsistent = true;
   World::getInstance().signOn(this);
 }
@@ -49,4 +63,5 @@
  */
 void ChangeTracker::saveStatus() {
+  DoLog(0) && (Log() << Verbose(0) << "Saving changes." << std::endl);
   if (hasChanged()) {
     notifyAll();
Index: src/Parser/FormatParser.cpp
===================================================================
--- src/Parser/FormatParser.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Parser/FormatParser.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * FormatParser.cpp
@@ -5,4 +12,9 @@
  *      Author: metzler
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -17,8 +29,8 @@
  */
 FormatParser::FormatParser() :
-  Observer("FormatParser")
+  Observer("FormatParser"),
+  saveStream(NULL)
 {
   ChangeTracker::getInstance().signOn(this);
-  saveStream = NULL;
 }
 
Index: src/Parser/FormatParserStorage.cpp
===================================================================
--- src/Parser/FormatParserStorage.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Parser/FormatParserStorage.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file FormatParserStorage.cpp
  *
@@ -6,4 +13,11 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
 #include <iostream>
 #include <fstream>
@@ -14,9 +28,10 @@
 #include "Parser/MpqcParser.hpp"
 #include "Parser/PcpParser.hpp"
+#include "Parser/PdbParser.hpp"
 #include "Parser/TremoloParser.hpp"
 #include "Parser/XyzParser.hpp"
 
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 
 #include "Helpers/Assert.hpp"
@@ -42,8 +57,24 @@
   ParserSuffix.resize(ParserTypes_end, "");
 
+  ParserNames[mpqc] = "mpqc";
+  ParserNames[pcp] = "pcp";
+  ParserNames[pdb] = "pdb";
+  ParserNames[tremolo] = "tremolo";
+  ParserNames[xyz] = "xyz";
+
+  for (std::map<ParserTypes, std::string>::const_iterator it = ParserNames.begin(); it != ParserNames.end(); ++it)
+    ParserLookupNames.insert(pair<std::string, ParserTypes>(it->second,it->first) );
+
   ParserSuffix[mpqc] = "in";
   ParserSuffix[pcp] = "conf";
+  ParserSuffix[pdb] = "pdb";
   ParserSuffix[tremolo] = "data";
   ParserSuffix[xyz] = "xyz";
+
+  ParserAddFunction[mpqc] = &FormatParserStorage::addMpqc;
+  ParserAddFunction[pcp] = &FormatParserStorage::addPcp;
+  ParserAddFunction[pdb] = &FormatParserStorage::addPdb;
+  ParserAddFunction[tremolo] = &FormatParserStorage::addTremolo;
+  ParserAddFunction[xyz] = &FormatParserStorage::addXyz;
 }
 
@@ -98,4 +129,5 @@
 }
 
+
 /** Adds an PcpParser to the storage.
  */
@@ -110,4 +142,16 @@
 
 
+/** Adds an PdbParser to the storage.
+ */
+void FormatParserStorage::addPdb()
+{
+  if (!ParserPresent[pdb]) {
+    ParserList[pdb] = new PdbParser();
+    ParserPresent[pdb] = true;
+  } else
+    DoeLog(1) && (eLog() << Verbose(1) << "Parser pdb is already present." << endl);
+}
+
+
 /** Adds an TremoloParser to the storage.
  */
@@ -132,4 +176,35 @@
     DoeLog(1) && (eLog() << Verbose(1) << "Parser xyz is already present." << endl);
 }
+
+ParserTypes FormatParserStorage::getType(std::string type)
+{
+  if (ParserLookupNames.find(type) == ParserLookupNames.end()) {
+    DoeLog(1) && (eLog() << Verbose(1) << "Unknown type " << type << "." << endl);
+    return ParserTypes_end;
+  } else
+    return ParserLookupNames[type];
+}
+
+bool FormatParserStorage::add(ParserTypes ptype)
+{
+  if (ptype != ParserTypes_end) {
+    if (ParserAddFunction.find(ptype) != ParserAddFunction.end()) {
+      DoLog(0) && (Log() << Verbose(0) << "Adding " << ParserNames[ptype] << " type to output." << endl);
+      (getInstance().*(ParserAddFunction[ptype]))(); // we still need an object to work on ...
+      return true;
+    } else {
+      DoeLog(1) && (eLog() << Verbose(1) << "No parser to add for this known type " << ParserNames[ptype] << ", not implemented?" << endl);
+      return false;
+    }
+  } else {
+    return false;
+  }
+}
+
+bool FormatParserStorage::add(std::string type)
+{
+  return add(getType(type));
+}
+
 
 /** Parses an istream depending on its suffix
@@ -144,4 +219,6 @@
   } else if (suffix == ParserSuffix[pcp]) {
     getPcp().load(&input);
+  } else if (suffix == ParserSuffix[pdb]) {
+    getPdb().load(&input);
   } else if (suffix == ParserSuffix[tremolo]) {
     getTremolo().load(&input);
@@ -149,5 +226,5 @@
     getXyz().load(&input);
   } else {
-    DoeLog(1) && (eLog() << Verbose(1) << "Unknown suffix to for FormatParserStorage::get()." << endl);
+    DoeLog(1) && (eLog() << Verbose(1) << "Unknown suffix " << suffix << " to for FormatParserStorage::get()." << endl);
     return false;
   }
@@ -175,4 +252,14 @@
 }
 
+/** Returns reference to the output PdbParser, adds if not present.
+ * \return reference to the output PdbParser
+ */
+PdbParser &FormatParserStorage::getPdb()
+{
+  if (!ParserPresent[pdb])
+    addPdb();
+  return dynamic_cast<PdbParser &>(*ParserList[pdb]);
+}
+
 /** Returns reference to the output TremoloParser, adds if not present.
  * \return reference to the output TremoloParser
Index: src/Parser/FormatParserStorage.hpp
===================================================================
--- src/Parser/FormatParserStorage.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Parser/FormatParserStorage.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -17,8 +17,10 @@
 
 #include <string>
+#include <map>
 #include <vector>
 
 class FormatParser;
 class MpqcParser;
+class PdbParser;
 class PcpParser;
 class TremoloParser;
@@ -26,5 +28,5 @@
 
 // enum has to be outside of class for operator++ to be possible
-enum ParserTypes { mpqc, pcp, tremolo, xyz, ParserTypes_end, ParserTypes_begin = mpqc };
+enum ParserTypes { mpqc, pcp, pdb, tremolo, xyz, ParserTypes_end, ParserTypes_begin = mpqc };
 typedef enum ParserTypes ParserTypes;
 
@@ -35,15 +37,20 @@
 public:
 
-
   void addMpqc();
   void addPcp();
+  void addPdb();
   void addTremolo();
   void addXyz();
+  bool add(std::string type);
+  bool add(ParserTypes type);
 
   bool get(std::istream &input, std::string suffix);
   MpqcParser &getMpqc();
   PcpParser &getPcp();
+  PdbParser &getPdb();
   TremoloParser &getTremolo();
   XyzParser &getXyz();
+
+  ParserTypes getType(std::string type);
 
   void SetOutputPrefixForAll(std::string &_prefix);
@@ -67,4 +74,12 @@
   std::vector<std::string> ParserSuffix;
 
+  // function pointers to each add...()
+  std::map< ParserTypes, void (FormatParserStorage::*)() > ParserAddFunction;
+
+  // type name of each parser type and reverse lookup
+  std::map<ParserTypes, std::string> ParserNames;
+  std::map<std::string, ParserTypes> ParserLookupNames;
+
+
   // prefix of the filenames to use on save
   std::string prefix;
Index: src/Parser/Makefile.am
===================================================================
--- src/Parser/Makefile.am	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Parser/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -13,4 +13,5 @@
   MpqcParser.cpp \
   PcpParser.cpp \
+  PdbParser.cpp \
   TremoloParser.cpp \
   XyzParser.cpp
@@ -22,4 +23,5 @@
   MpqcParser.hpp \
   PcpParser.hpp \
+  PdbParser.hpp \
   TremoloParser.hpp \
   XyzParser.hpp
@@ -66,2 +68,9 @@
 pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc
 
+unity.cpp:
+	echo "" >  unity.cpp; \
+	list='$(PARSERSOURCE)'; for file in $$list; do \
+	  echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
+	done;
+	
+MOSTLYCLEANFILES = unity.cpp
Index: src/Parser/MpqcParser.cpp
===================================================================
--- src/Parser/MpqcParser.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Parser/MpqcParser.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MpqcParser.cpp
@@ -6,4 +13,11 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
 #include "MpqcParser.hpp"
 
@@ -11,8 +25,8 @@
 #include "config.hpp"
 #include "element.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
 #include "periodentafel.hpp"
-#include "vector.hpp"
-#include "verbose.hpp"
 #include "World.hpp"
 
@@ -22,14 +36,11 @@
  */
 MpqcParser::MpqcParser() : HessianPresent(false)
-{
-
-}
+{}
 
 /** Destructor of MpqcParser.
  *
  */
-MpqcParser::~MpqcParser() {
-
-}
+MpqcParser::~MpqcParser()
+{}
 
 /** Load an MPQC config file into the World.
@@ -43,4 +54,6 @@
 void MpqcParser::save(ostream *file)
 {
+  DoLog(0) && (Log() << Verbose(0) << "Saving changes to MPQC ." << std::endl);
+
   if (HessianPresent)
     saveHessian(file);
@@ -54,5 +67,4 @@
 void MpqcParser::saveSimple(ostream *file)
 {
-  int AtomNo = 0;
   Vector center;
   vector<atom *> allatoms = World::getInstance().getAllAtoms();
@@ -60,5 +72,5 @@
   // calculate center
   for (vector<atom *>::iterator runner = allatoms.begin();runner != allatoms.end(); ++runner)
-    center += (*runner)->x;
+    center += (*runner)->getPosition();
   center.Scale(1./allatoms.size());
 
@@ -86,5 +98,5 @@
     // output of atoms
     for (vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {
-      (*AtomRunner)->OutputMPQCLine(file, &center, &AtomNo);
+      (*AtomRunner)->OutputMPQCLine(file, &center);
     }
     *file << "\t}" << endl;
@@ -102,5 +114,4 @@
 void MpqcParser::saveHessian(ostream *file)
 {
-  int AtomNo = 0;
   Vector center;
   vector<atom *> allatoms = World::getInstance().getAllAtoms();
@@ -108,5 +119,5 @@
   // calculate center
   for (vector<atom *>::iterator runner = allatoms.begin();runner != allatoms.end(); ++runner)
-    center += (*runner)->x;
+    center += (*runner)->getPosition();
   center.Scale(1./allatoms.size());
 
@@ -133,5 +144,5 @@
     // output of atoms
     for (vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {
-      (*AtomRunner)->OutputMPQCLine(file, &center, &AtomNo);
+      (*AtomRunner)->OutputMPQCLine(file, &center);
     }
     *file << "\t}" << endl;
Index: src/Parser/PcpParser.cpp
===================================================================
--- src/Parser/PcpParser.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Parser/PcpParser.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * PcpParser.cpp
@@ -6,7 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
 #include <iostream>
 #include <iomanip>
 
+//#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
 #include "atom.hpp"
 #include "config.hpp"
@@ -14,84 +29,112 @@
 #include "element.hpp"
 #include "Helpers/Assert.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "molecule.hpp"
 #include "PcpParser.hpp"
 #include "periodentafel.hpp"
 #include "ThermoStatContainer.hpp"
-#include "verbose.hpp"
 #include "World.hpp"
-#include "Matrix.hpp"
 #include "Box.hpp"
+
+
+PcpParser::StructParallelization::StructParallelization() :
+  ProcPEGamma(8),
+  ProcPEPsi(1)
+{}
+
+PcpParser::StructParallelization::~StructParallelization()
+{}
+
+PcpParser::StructPaths::StructPaths() :
+  databasepath(NULL),
+  configname(NULL),
+  mainname(NULL),
+  defaultpath(NULL),
+  pseudopotpath(NULL)
+{}
+
+PcpParser::StructPaths::~StructPaths()
+{}
+
+PcpParser::StructSwitches::StructSwitches() :
+  DoConstrainedMD(0),
+  DoOutVis(0),
+  DoOutMes(1),
+  DoOutNICS(0),
+  DoOutOrbitals(0),
+  DoOutCurrent(0),
+  DoFullCurrent(0),
+  DoPerturbation(0),
+  DoWannier(0)
+{}
+
+PcpParser::StructSwitches::~StructSwitches()
+{}
+
+PcpParser::StructLocalizedOrbitals::StructLocalizedOrbitals() :
+  CommonWannier(0),
+  SawtoothStart(0.01),
+  VectorPlane(0),
+  VectorCut(0),
+  UseAddGramSch(1),
+  Seed(1),
+  EpsWannier(1e-7)
+{}
+
+PcpParser::StructLocalizedOrbitals::~StructLocalizedOrbitals()
+{}
+
+PcpParser::StructStepCounts::StructStepCounts() :
+  MaxMinStopStep(1),
+  InitMaxMinStopStep(1),
+  OutVisStep(10),
+  OutSrcStep(5),
+  MaxPsiStep(0),
+  MaxOuterStep(0),
+  MaxMinStep(100),
+  RelEpsTotalEnergy(1e-07),
+  RelEpsKineticEnergy(1e-05),
+  MaxMinGapStopStep(0),
+  MaxInitMinStep(100),
+  InitRelEpsTotalEnergy(1e-05),
+  InitRelEpsKineticEnergy(0.0001),
+  InitMaxMinGapStopStep(0)
+{}
+
+PcpParser::StructStepCounts::~StructStepCounts()
+{}
+
+PcpParser::StructPlaneWaveSpecifics::StructPlaneWaveSpecifics() :
+  PsiType(0),
+  MaxPsiDouble(0),
+  PsiMaxNoUp(0),
+  PsiMaxNoDown(0),
+  ECut(128),
+  MaxLevel(5),
+  RiemannTensor(0),
+  LevRFactor(0),
+  RiemannLevel(0),
+  Lev0Factor(2),
+  RTActualUse(0),
+  AddPsis(0),
+  RCut(20)
+{}
+
+PcpParser::StructPlaneWaveSpecifics::~StructPlaneWaveSpecifics()
+{}
 
 /** Constructor of PcpParser.
  *
  */
-PcpParser::PcpParser()
-{
-  Parallelization.ProcPEGamma = 8;
-  Parallelization.ProcPEPsi = 1;
-
-  Paths.databasepath = NULL;
-  Paths.configname = NULL;
-  Paths.mainname = NULL;
-  Paths.defaultpath = NULL;
-  Paths.pseudopotpath = NULL;
-
-  Switches.DoConstrainedMD = 0;
-  Switches.DoOutVis = 0;
-  Switches.DoOutMes = 1;
-  Switches.DoOutNICS = 0;
-  Switches.DoOutOrbitals = 0;
-  Switches.DoOutCurrent = 0;
-  Switches.DoFullCurrent = 0;
-  Switches.DoPerturbation = 0;
-  Switches.DoWannier = 0;
-
-  LocalizedOrbitals.CommonWannier = 0;
-  LocalizedOrbitals.SawtoothStart = 0.01;
-  LocalizedOrbitals.VectorPlane = 0;
-  LocalizedOrbitals.VectorCut = 0;
-  LocalizedOrbitals.UseAddGramSch = 1;
-  LocalizedOrbitals.Seed = 1;
-  LocalizedOrbitals.EpsWannier = 1e-7;
-
-  StepCounts.MaxMinStopStep = 1;
-  StepCounts.InitMaxMinStopStep = 1;
-  StepCounts.OutVisStep = 10;
-  StepCounts.OutSrcStep = 5;
-  StepCounts.MaxPsiStep = 0;
-  StepCounts.MaxOuterStep = 0;
-  StepCounts.MaxMinStep = 100;
-  StepCounts.RelEpsTotalEnergy = 1e-07;
-  StepCounts.RelEpsKineticEnergy = 1e-05;
-  StepCounts.MaxMinGapStopStep = 0;
-  StepCounts.MaxInitMinStep = 100;
-  StepCounts.InitRelEpsTotalEnergy = 1e-05;
-  StepCounts.InitRelEpsKineticEnergy = 0.0001;
-  StepCounts.InitMaxMinGapStopStep = 0;
-
-  PlaneWaveSpecifics.PsiType = 0;
-  PlaneWaveSpecifics.MaxPsiDouble = 0;
-  PlaneWaveSpecifics.PsiMaxNoUp = 0;
-  PlaneWaveSpecifics.PsiMaxNoDown = 0;
-  PlaneWaveSpecifics.ECut = 128;
-  PlaneWaveSpecifics.MaxLevel = 5;
-  PlaneWaveSpecifics.RiemannTensor = 0;
-  PlaneWaveSpecifics.LevRFactor = 0;
-  PlaneWaveSpecifics.RiemannLevel = 0;
-  PlaneWaveSpecifics.Lev0Factor = 2;
-  PlaneWaveSpecifics.RTActualUse = 0;
-  PlaneWaveSpecifics.AddPsis = 0;
-  PlaneWaveSpecifics.RCut = 20;
-  PlaneWaveSpecifics.PsiType = 0;
-
-  FastParsing = false;
-
-  Deltat = 0.01;
-  IsAngstroem = 1;
-  RelativeCoord = 0;
-  StructOpt = 0;
-  MaxTypes = 0;
-}
+PcpParser::PcpParser() :
+  FastParsing(false),
+  Deltat(0.01),
+  IsAngstroem(1),
+  RelativeCoord(0),
+  StructOpt(0),
+  MaxTypes(0)
+{}
 
 /** Destructor of PcpParser.
@@ -321,5 +364,5 @@
   // 4. dissect the molecule into connected subgraphs
   // don't do this here ...
-  //MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this);
+  //FragmentationSubgraphDissection();
   //delete(mol);
 
@@ -332,4 +375,6 @@
 void PcpParser::save(std::ostream* file)
 {
+  DoLog(0) && (Log() << Verbose(0) << "Saving changes to pcp." << std::endl);
+
   const Matrix &domain = World::getInstance().getDomain().getM();
   class ThermoStatContainer *Thermostats = World::getInstance().getThermostats();
@@ -364,26 +409,6 @@
     *file << "DoConstrainedMD\t" << Switches.DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl;
     ASSERT(Thermostats != NULL, "PcpParser::save() - Thermostats not initialized!");
-    ASSERT(Thermostats->ThermostatNames != NULL, "PcpParser::save() - Thermostats not initialized!");
-    *file << "Thermostat\t" << Thermostats->ThermostatNames[Thermostats->Thermostat] << "\t";
-    switch(Thermostats->Thermostat) {
-      default:
-      case None:
-        break;
-      case Woodcock:
-        *file << Thermostats->ScaleTempStep;
-        break;
-      case Gaussian:
-        *file << Thermostats->ScaleTempStep;
-        break;
-      case Langevin:
-        *file << Thermostats->TempFrequency << "\t" << Thermostats->alpha;
-        break;
-      case Berendsen:
-        *file << Thermostats->TempFrequency;
-        break;
-      case NoseHoover:
-        *file << Thermostats->HooverMass;
-        break;
-    };
+    *file << "Thermostat\t" << Thermostats->activeThermostat->name() << "\t";
+    *file << Thermostats->activeThermostat->writeParams();
     *file << "\t# Which Thermostat and its parameters to use in MD case." << endl;
     *file << "CommonWannier\t" << LocalizedOrbitals.CommonWannier << "\t# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center" << endl;
@@ -460,5 +485,5 @@
   PlaneWaveSpecifics.MaxPsiDouble = PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.PsiType = 0;
   for (vector<atom *>::iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) {
-    PlaneWaveSpecifics.MaxPsiDouble += (*runner)->type->NoValenceOrbitals;
+    PlaneWaveSpecifics.MaxPsiDouble += (*runner)->getType()->getNoValenceOrbitals();
   }
   cout << PlaneWaveSpecifics.MaxPsiDouble << endl;
@@ -495,5 +520,5 @@
   // insert all found elements into the map
   for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
-    Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->type->Z, 1));
+    Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1));
     if (!Inserter.second) // increase if present
       Inserter.first->second += 1;
@@ -510,5 +535,5 @@
     const element * const elemental = World::getInstance().getPeriode()->FindElement(iter->first);
     ZtoIndexMap.insert( pair<int,int> (iter->first, counter) );
-    *file << "Ion_Type" << counter++ << "\t" << iter->second << "\t" << elemental->Z << "\t1.0\t3\t3\t" << fixed << setprecision(11) << showpoint << elemental->mass << "\t" << elemental->name << "\t" << elemental->symbol <<endl;
+    *file << "Ion_Type" << counter++ << "\t" << iter->second << "\t" << elemental->getAtomicNumber() << "\t1.0\t3\t3\t" << fixed << setprecision(11) << showpoint << elemental->getMass() << "\t" << elemental->getName() << "\t" << elemental->getSymbol() <<endl;
   }
 }
@@ -526,13 +551,13 @@
   int nr = 0;
   for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
-    Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->type->Z, 1) );
+    Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1) );
     if (!Inserter.second)
       Inserter.first->second += 1;
-    const int Z = (*AtomRunner)->type->Z;
+    const int Z = (*AtomRunner)->getType()->getAtomicNumber();
     *file << "Ion_Type" << ZtoIndexMap[Z] << "_" << ZtoCountMap[Z] << "\t"  << fixed << setprecision(9) << showpoint;
-    *file << (*AtomRunner)->x[0] << "\t" << (*AtomRunner)->x[1] << "\t" << (*AtomRunner)->x[2];
+    *file << (*AtomRunner)->at(0) << "\t" << (*AtomRunner)->at(1) << "\t" << (*AtomRunner)->at(2);
     *file << "\t" << (*AtomRunner)->FixedIon;
-    if ((*AtomRunner)->v.Norm() > MYEPSILON)
-      *file << "\t" << scientific << setprecision(6) << (*AtomRunner)->v[0] << "\t" << (*AtomRunner)->v[1] << "\t" << (*AtomRunner)->v[2] << "\t";
+    if ((*AtomRunner)->AtomicVelocity.Norm() > MYEPSILON)
+      *file << "\t" << scientific << setprecision(6) << (*AtomRunner)->AtomicVelocity[0] << "\t" << (*AtomRunner)->AtomicVelocity[1] << "\t" << (*AtomRunner)->AtomicVelocity[2] << "\t";
     *file << " # molecule nr " << nr++ << endl;
   }
@@ -550,65 +575,9 @@
   // read desired Thermostat from file along with needed additional parameters
   if (ParseForParameter(verbose,fb,"Thermostat", 0, 1, 1, string_type, thermo, 1, optional)) {
-    if (strcmp(thermo, Thermostats->ThermostatNames[0]) == 0) { // None
-      if (Thermostats->ThermostatImplemented[0] == 1) {
-        Thermostats->Thermostat = None;
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else if (strcmp(thermo, Thermostats->ThermostatNames[1]) == 0) { // Woodcock
-      if (Thermostats->ThermostatImplemented[1] == 1) {
-        Thermostats->Thermostat = Woodcock;
-        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &Thermostats->ScaleTempStep, 1, critical); // read scaling frequency
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else if (strcmp(thermo, Thermostats->ThermostatNames[2]) == 0) { // Gaussian
-      if (Thermostats->ThermostatImplemented[2] == 1) {
-        Thermostats->Thermostat = Gaussian;
-        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &Thermostats->ScaleTempStep, 1, critical); // read collision rate
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else if (strcmp(thermo, Thermostats->ThermostatNames[3]) == 0) { // Langevin
-      if (Thermostats->ThermostatImplemented[3] == 1) {
-        Thermostats->Thermostat = Langevin;
-        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->TempFrequency, 1, critical); // read gamma
-        if (ParseForParameter(verbose,fb,"Thermostat", 0, 3, 1, double_type, &Thermostats->alpha, 1, optional)) {
-          DoLog(2) && (Log() << Verbose(2) << "Extended Stochastic Thermostat detected with interpolation coefficient " << Thermostats->alpha << "." << endl);
-        } else {
-          Thermostats->alpha = 1.;
-        }
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else if (strcmp(thermo, Thermostats->ThermostatNames[4]) == 0) { // Berendsen
-      if (Thermostats->ThermostatImplemented[4] == 1) {
-        Thermostats->Thermostat = Berendsen;
-        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->TempFrequency, 1, critical); // read \tau_T
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else if (strcmp(thermo, Thermostats->ThermostatNames[5]) == 0) { // Nose-Hoover
-      if (Thermostats->ThermostatImplemented[5] == 1) {
-        Thermostats->Thermostat = NoseHoover;
-        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->HooverMass, 1, critical); // read Hoovermass
-        Thermostats->alpha = 0.;
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else {
-      DoLog(1) && (Log() << Verbose(1) << " Warning: thermostat name was not understood!" << endl);
-      Thermostats->Thermostat = None;
-    }
+    Thermostats->makeActive(thermo,fb);
   } else {
     if ((Thermostats->TargetTemp != 0))
       DoLog(2) && (Log() << Verbose(2) <<  "No thermostat chosen despite finite temperature MD, falling back to None." << endl);
-    Thermostats->Thermostat = None;
+    Thermostats->chooseNone();
   }
   delete[](thermo);
Index: src/Parser/PcpParser.hpp
===================================================================
--- src/Parser/PcpParser.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Parser/PcpParser.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -31,5 +31,9 @@
   void CalculateOrbitals(vector<atom *> &allatoms);
 
-  struct StructParallelization {
+  class StructParallelization {
+  public:
+    StructParallelization();
+    ~StructParallelization();
+
     int ProcPEGamma;
     int ProcPEPsi;
@@ -39,5 +43,9 @@
    * Contains all the paths and names
    */
-  struct StructPaths {
+  class StructPaths {
+  public:
+    StructPaths();
+    ~StructPaths();
+
     char *databasepath;
     char *configname;
@@ -50,5 +58,9 @@
    * Contains all Do/Don't switches
    */
-  struct StructSwitches {
+  class StructSwitches {
+  public:
+    StructSwitches();
+    ~StructSwitches();
+
     int DoConstrainedMD;
     int DoOutVis;
@@ -65,5 +77,9 @@
    * Contains parameters regarding localization of orbitals or magnetic perturbation
    */
-  struct StructLocalizedOrbitals {
+  class StructLocalizedOrbitals {
+  public:
+    StructLocalizedOrbitals();
+    ~StructLocalizedOrbitals();
+
     int CommonWannier;
     double SawtoothStart;
@@ -78,5 +94,9 @@
    * Contains all step count and other epsilon threshold parameters
    */
-  struct StructStepCounts {
+  class StructStepCounts {
+  public:
+    StructStepCounts();
+    ~StructStepCounts();
+
     int MaxMinStopStep;
     int InitMaxMinStopStep;
@@ -101,5 +121,9 @@
    * Contains all parameters specific to the plane wave basis set
    */
-  struct StructPlaneWaveSpecifics {
+  class StructPlaneWaveSpecifics {
+  public:
+    StructPlaneWaveSpecifics();
+    ~StructPlaneWaveSpecifics();
+
     int PsiType;
     int MaxPsiDouble;
Index: src/Parser/PdbParser.cpp
===================================================================
--- src/Parser/PdbParser.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Parser/PdbParser.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,433 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * PdbParser.cpp
+ *
+ *  Created on: Aug 17, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Helpers/Assert.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "PdbParser.hpp"
+#include "World.hpp"
+#include "atom.hpp"
+#include "bond.hpp"
+#include "element.hpp"
+#include "molecule.hpp"
+#include "periodentafel.hpp"
+#include "Descriptors/AtomIdDescriptor.hpp"
+
+#include <map>
+#include <vector>
+
+#include <iostream>
+#include <iomanip>
+
+using namespace std;
+
+/**
+ * Constructor.
+ */
+PdbParser::PdbParser() {
+  knownKeys[" "] = PdbKey::noKey; // with this we can detect invalid keys
+  knownKeys["x"] = PdbKey::x;
+  knownKeys["Id"] = PdbKey::Id;
+  knownKeys["Type"] = PdbKey::Type;
+  knownKeys["extType"] = PdbKey::extType;
+  knownKeys["name"] = PdbKey::name;
+  knownKeys["resName"] = PdbKey::resName;
+  knownKeys["chainID"] = PdbKey::chainID;
+  knownKeys["resSeq"] = PdbKey::resSeq;
+  knownKeys["occupancy"] = PdbKey::occupancy;
+  knownKeys["tempFactor"] = PdbKey::tempFactor;
+  knownKeys["segID"] = PdbKey::segID;
+  knownKeys["charge"] = PdbKey::charge;
+}
+
+/**
+ * Destructor.
+ */
+PdbParser::~PdbParser() {
+  additionalAtomData.clear();
+  atomIdMap.clear();
+  knownKeys.clear();
+}
+
+/**
+ * Loads atoms from a tremolo-formatted file.
+ *
+ * \param tremolo file
+ */
+void PdbParser::load(istream* file) {
+//  string line;
+//  string::size_type location;
+//
+//  usedFields.clear();
+//  while (file->good()) {
+//    std::getline(*file, line, '\n');
+//    if (usedFields.empty()) {
+//      location = line.find("ATOMDATA", 0);
+//      if (location != string::npos) {
+//       parseAtomDataKeysLine(line, location + 8);
+//      }
+//    }
+//    if (line.length() > 0 && line.at(0) != '#') {
+//      readAtomDataLine(line);
+//    }
+//  }
+//
+//  processNeighborInformation();
+//  adaptImprData();
+//  adaptTorsion();
+}
+
+/**
+ * Saves the World's current state into as a tremolo file.
+ *
+ * \param file where to save the state
+ */
+void PdbParser::save(ostream* file) {
+  DoLog(0) && (Log() << Verbose(0) << "Saving changes to pdb." << std::endl);
+
+  {
+    // add initial remark
+    *file << "REMARK created by molecuilder on ";
+    time_t now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
+    // ctime ends in \n\0, we have to cut away the newline
+    std::string time(ctime(&now));
+    size_t pos = time.find('\n');
+    if (pos != 0)
+      *file << time.substr(0,pos);
+    else
+      *file << time;
+    *file << endl;
+  }
+
+  {
+    vector<atom *> AtomList = World::getInstance().getAllAtoms();
+
+    std::vector<int> elementNo(MAX_ELEMENTS,1);
+    char name[MAXSTRINGSIZE];
+
+    // write ATOMs
+    int AtomNo = 1; // serial number starts at 1 in pdb
+    int MolNo = 1;  // residue number starts at 1 in pdb
+    for (vector<atom *>::iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {
+      const size_t  Z = (*atomIt)->getType()->getAtomicNumber();
+      sprintf(name, "%2s%02d",(*atomIt)->getType()->getSymbol().c_str(), elementNo[Z]);
+      elementNo[Z] = (elementNo[Z]+1) % 100;   // confine to two digits
+      const molecule *mol = (*atomIt)->getMolecule();
+      if (mol == NULL) {  // for homeless atoms, MolNo = 0 is reserved
+        MolNo = 0;
+      } else {
+        MolNo = mol->getId();
+      }
+      saveLine(file, *atomIt, name, AtomNo, MolNo);
+      setAtomId((*atomIt)->getId(), AtomNo);
+      AtomNo++;
+    }
+
+    // write CONECTs
+    for (vector<atom *>::iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {
+      writeNeighbors(file, 4, *atomIt);
+    }
+  }
+
+  // END
+  *file << "END" << endl;
+}
+
+/**
+ * Writes one line of tremolo-formatted data to the provided stream.
+ *
+ * \param stream where to write the line to
+ * \param *currentAtom the atom of which information should be written
+ * \param *name name of atom, i.e. H01
+ * \param AtomNo serial number of atom
+ * \param ResidueNo number of residue
+ */
+void PdbParser::saveLine(ostream* file, const atom* currentAtom, const char *name, const int AtomNo, const int ResidueNo) {
+  *file << "ATOM ";
+  *file << setw(6) << AtomNo; /* atom serial number */
+  *file << setw(1) << " ";
+  *file << setfill(' ') << left << setw(4) << name << right;  /* atom name */
+  *file << setw(1) << " ";
+  *file << setfill(' ') << setw(3) << ((currentAtom->getMolecule() != NULL) ? currentAtom->getMolecule()->getName().substr(0,3) : "-");  /* residue name */
+  *file << setw(1) << " ";
+  *file << setfill(' ') << setw(1) << (char)('a'+(unsigned char)(AtomNo % 26)); /* letter for chain */
+  *file << setw(4) << ResidueNo; /* residue sequence number */
+  *file << setw(4) << "    ";
+  for (int i=0;i<NDIM;i++) {
+    *file << setw(8) << setprecision(3) << showpoint << currentAtom->at(i); /* positional coordinate in Angstroem */
+  }
+  *file << setw(6) << setprecision(2) << showpoint << (double)currentAtom->getType()->getValence(); /* occupancy */
+  *file << setw(6) << setprecision(2) << showpoint << (double)currentAtom->getType()->getNoValenceOrbitals(); /* temperature factor */
+  *file << noshowpoint;
+  *file << setw(6) << "      ";
+  *file << setw(4) << "0";
+  *file << setfill(' ') << setw(2) << currentAtom->getType()->getSymbol();
+  *file << setw(2) << "0";
+
+  *file << endl;
+}
+
+/**
+ * Writes the neighbor information of one atom to the provided stream.
+ *
+ * \param *file  where to write neighbor information to
+ * \param MaxnumberOfNeighbors of neighbors
+ * \param *currentAtom to the atom of which to take the neighbor information
+ */
+void PdbParser::writeNeighbors(ostream* file, int MaxnumberOfNeighbors, atom* currentAtom) {
+  if (!currentAtom->ListOfBonds.empty()) {
+    *file << "CONECT";
+    *file << setw(5) << getAtomId(currentAtom->getId());
+    int MaxNo = 0;
+    for(BondList::iterator currentBond = currentAtom->ListOfBonds.begin(); currentBond != currentAtom->ListOfBonds.end(); ++currentBond) {
+      if (MaxNo < MaxnumberOfNeighbors) {
+        *file << setw(5) << getAtomId((*currentBond)->GetOtherAtom(currentAtom)->getId());
+      }
+      MaxNo++;
+    }
+    *file << endl;
+  }
+}
+
+
+/** Retrieves a value from PdbParser::atomIdMap.
+ * \param atomid key
+ * \return value
+ */
+int PdbParser::getAtomId(int atomid) const
+{
+  ASSERT(atomIdMap.find(atomid) != atomIdMap.end(), "PdbParser::getAtomId: atomid not present in Map.");
+  return (atomIdMap.find(atomid)->second);
+}
+
+/** Sets an entry in PdbParser::atomIdMap.
+ * \param localatomid key
+ * \param atomid value
+ * \return true - key not present, false - value present
+ */
+void PdbParser::setAtomId(int localatomid, int atomid)
+{
+  pair<std::map<int,int>::iterator, bool > inserter;
+  inserter = atomIdMap.insert( pair<int, int>(localatomid, atomid) );
+  ASSERT(inserter.second, "PdbParser::setAtomId: atomId already present in Map.");
+}
+
+/**
+ * Reads one data line of a tremolo file and interprets it according to the keys
+ * obtained from the ATOMDATA line.
+ *
+ * \param line to parse as an atom
+ */
+void PdbParser::readAtomDataLine(string line) {
+//  vector<string>::iterator it;
+//  stringstream lineStream;
+//  atom* newAtom = World::getInstance().createAtom();
+//  PdbAtomInfoContainer *atomInfo = NULL;
+//  additionalAtomData[newAtom->getId()] = *(new PdbAtomInfoContainer);
+//  atomInfo = &additionalAtomData[newAtom->getId()];
+//  PdbKey::atomDataKey currentField;
+//  string word;
+//  int oldId;
+//  double tmp;
+//
+//  lineStream << line;
+//  for (it = usedFields.begin(); it < usedFields.end(); it++) {
+//    currentField = knownKeys[it->substr(0, it->find("="))];
+//    switch (currentField) {
+//      case PdbKey::x :
+//        // for the moment, assume there are always three dimensions
+//        for (int i=0;i<NDIM;i++) {
+//          lineStream >> tmp;
+//          newAtom->set(i, tmp);
+//        }
+//        break;
+//      case PdbKey::u :
+//        // for the moment, assume there are always three dimensions
+//        lineStream >> newAtom->AtomicVelocity[0];
+//        lineStream >> newAtom->AtomicVelocity[1];
+//        lineStream >> newAtom->AtomicVelocity[2];
+//        break;
+//      case PdbKey::Type :
+//        char type[3];
+//        lineStream >> type;
+//        newAtom->setType(World::getInstance().getPeriode()->FindElement(type));
+//        ASSERT(newAtom->getType(), "Type was not set for this atom");
+//        break;
+//      case PdbKey::Id :
+//        lineStream >> oldId;
+//        atomIdMap[oldId] = newAtom->getId();
+//        break;
+//      case PdbKey::neighbors :
+//        readNeighbors(&lineStream,
+//            atoi(it->substr(it->find("=") + 1, 1).c_str()), newAtom->getId());
+//        break;
+//      default :
+//        lineStream >> word;
+//        atomInfo->set(currentField, word);
+//        break;
+//    }
+//  }
+}
+
+/**
+ * Reads neighbor information for one atom from the input.
+ *
+ * \param stream where to read the information from
+ * \param number of neighbors to read
+ * \param world id of the atom the information belongs to
+ */
+void PdbParser::readNeighbors(stringstream* line, int numberOfNeighbors, int atomId) {
+//  int neighborId = 0;
+//  for (int i = 0; i < numberOfNeighbors; i++) {
+//    *line >> neighborId;
+//    // 0 is used to fill empty neighbor positions in the tremolo file.
+//    if (neighborId > 0) {
+//      additionalAtomData[atomId].neighbors.push_back(neighborId);
+//    }
+//  }
+}
+
+/**
+ * Adds the collected neighbor information to the atoms in the world. The atoms
+ * are found by their current ID and mapped to the corresponding atoms with the
+ * Id found in the parsed file.
+ */
+void PdbParser::processNeighborInformation() {
+//  if (!isUsedField("neighbors")) {
+//    return;
+//  }
+//
+//  for(map<int, PdbAtomInfoContainer>::iterator currentInfo = additionalAtomData.begin();
+//    currentInfo != additionalAtomData.end(); currentInfo++
+//  ) {
+//    for(vector<int>::iterator neighbor = currentInfo->second.neighbors.begin();
+//      neighbor != currentInfo->second.neighbors.end(); neighbor++
+//    ) {
+//      World::getInstance().getAtom(AtomById(currentInfo->first))
+//          ->addBond(World::getInstance().getAtom(AtomById(atomIdMap[*neighbor])));
+//    }
+//  }
+}
+
+/**
+ * Replaces atom IDs read from the file by the corresponding world IDs. All IDs
+ * IDs of the input string will be replaced; expected separating characters are
+ * "-" and ",".
+ *
+ * \param string in which atom IDs should be adapted
+ *
+ * \return input string with modified atom IDs
+ */
+string PdbParser::adaptIdDependentDataString(string data) {
+//  // there might be no IDs
+//  if (data == "-") {
+//    return "-";
+//  }
+//
+//  char separator;
+//  int id;
+//  stringstream line, result;
+//  line << data;
+//
+//  line >> id;
+//  result << atomIdMap[id];
+//  while (line.good()) {
+//    line >> separator >> id;
+//    result << separator << atomIdMap[id];
+//  }
+//
+//  return result.str();
+  return "";
+}
+
+
+PdbAtomInfoContainer::PdbAtomInfoContainer() :
+  name("-"),
+  resName("-"),
+  chainID("0"),
+  resSeq("0"),
+  occupancy("0"),
+  tempFactor("0"),
+  segID("0"),
+  charge("0")
+{}
+
+void PdbAtomInfoContainer::set(PdbKey::PdbDataKey key, string value) {
+  switch (key) {
+    case PdbKey::extType :
+      extType = value;
+      break;
+    case PdbKey::name :
+      name = value;
+      break;
+    case PdbKey::resName :
+      resName = value;
+      break;
+    case PdbKey::chainID :
+      chainID = value;
+      break;
+    case PdbKey::resSeq :
+      resSeq = value;
+      break;
+    case PdbKey::occupancy :
+      occupancy = value;
+      break;
+    case PdbKey::tempFactor :
+      tempFactor = value;
+      break;
+    case PdbKey::segID :
+      segID = value;
+      break;
+    case PdbKey::charge :
+      charge = value;
+      break;
+    default :
+      cout << "Unknown key: " << key << ", value: " << value << endl;
+      break;
+  }
+}
+
+string PdbAtomInfoContainer::get(PdbKey::PdbDataKey key) {
+  switch (key) {
+    case PdbKey::extType :
+      return extType;
+    case PdbKey::name :
+      return name;
+    case PdbKey::resName :
+      return resName;
+    case PdbKey::chainID :
+      return chainID;
+    case PdbKey::resSeq :
+      return resSeq;
+    case PdbKey::occupancy :
+      return occupancy;
+    case PdbKey::tempFactor :
+      return tempFactor;
+    case PdbKey::segID :
+      return segID;
+    case PdbKey::charge :
+      return charge;
+    default :
+      cout << "Unknown key: " << key << endl;
+      return "";
+  }
+}
+
Index: src/Parser/PdbParser.hpp
===================================================================
--- src/Parser/PdbParser.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Parser/PdbParser.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,104 @@
+/*
+ * PdbParser.hpp
+ *
+ *  Created on: Aug 17, 2010
+ *      Author: heber
+ */
+
+#ifndef PDBPARSER_HPP_
+#define PDBPARSER_HPP_
+
+#include <string>
+#include "Parser/FormatParser.hpp"
+
+/**
+ * Known keys for the Pdb line.
+ */
+class PdbKey {
+public:
+  enum PdbDataKey {
+    noKey,
+    x,
+    Id,
+    Type,
+    extType,
+    name,
+    resName,
+    chainID,
+    resSeq,
+    occupancy,
+    tempFactor,
+    segID,
+    charge
+  };
+};
+
+/**
+ * Holds tremolo-specific information which is not store in the atom class.
+ */
+class PdbAtomInfoContainer {
+public:
+  PdbAtomInfoContainer();
+  void set(PdbKey::PdbDataKey key, std::string value);
+  std::string get(PdbKey::PdbDataKey key);
+  std::string name;
+  std::string extType;
+  std::string resName;
+  std::string chainID;
+  std::string resSeq;
+  std::string occupancy;
+  std::string tempFactor;
+  std::string segID;
+  std::string charge;
+};
+
+/**
+ * Loads a tremolo file into the World and saves the World as a tremolo file.
+ */
+class PdbParser : public FormatParser
+{
+public:
+  PdbParser();
+  ~PdbParser();
+  void load(std::istream* file);
+  void save(std::ostream* file);
+
+
+private:
+  void readAtomDataLine(string line);
+  void parseAtomDataKeysLine(string line, int offset);
+  void readNeighbors(std::stringstream* line, int numberOfNeighbors, int atomId);
+  void processNeighborInformation();
+  void adaptImprData();
+  void adaptTorsion();
+  std::string adaptIdDependentDataString(std::string data);
+  bool isUsedField(std::string fieldName);
+  void writeNeighbors(std::ostream* file, int numberOfNeighbors, atom* currentAtom);
+  void saveLine(ostream* file, const atom* currentAtom, const char *name, const int AtomNo, const int ResdueNo);
+  int getAtomId(int atomid) const;
+  void setAtomId(int localatomid, int atomid);
+
+  /**
+   * Map to associate the known keys with numbers.
+   */
+  std::map<std::string, PdbKey::PdbDataKey> knownKeys;
+
+  /**
+   * Data which is currently not stored in atoms but was provided by the input
+   * file.
+   */
+  std::map<int, PdbAtomInfoContainer> additionalAtomData;
+
+  /**
+   * Default additional atom data.
+   */
+  PdbAtomInfoContainer defaultAdditionalData;
+
+  /**
+   * Maps original atom IDs received from the parsed file to atom IDs in the
+   * world.
+   */
+  std::map<int, int> atomIdMap;
+};
+
+#endif /* PDBPARSER_HPP_ */
Index: src/Parser/TremoloParser.cpp
===================================================================
--- src/Parser/TremoloParser.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Parser/TremoloParser.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * TremoloParser.cpp
@@ -6,12 +13,20 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
 #include "Helpers/Assert.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "TremoloParser.hpp"
 #include "World.hpp"
 #include "atom.hpp"
+#include "bond.hpp"
 #include "element.hpp"
-#include "bond.hpp"
+#include "molecule.hpp"
 #include "periodentafel.hpp"
 #include "Descriptors/AtomIdDescriptor.hpp"
@@ -19,7 +34,8 @@
 #include <vector>
 
+#include <iostream>
+#include <iomanip>
 
 using namespace std;
-using namespace boost;
 
 /**
@@ -75,4 +91,5 @@
 
   usedFields.clear();
+  molecule *newmol = World::getInstance().createMolecule();
   while (file->good()) {
     std::getline(*file, line, '\n');
@@ -84,5 +101,5 @@
     }
     if (line.length() > 0 && line.at(0) != '#') {
-      readAtomDataLine(line);
+      readAtomDataLine(line, newmol);
     }
   }
@@ -99,4 +116,6 @@
  */
 void TremoloParser::save(ostream* file) {
+  DoLog(0) && (Log() << Verbose(0) << "Saving changes to tremolo." << std::endl);
+
   vector<atom*>::iterator atomIt;
   vector<string>::iterator it;
@@ -140,13 +159,13 @@
       case TremoloKey::x :
         // for the moment, assume there are always three dimensions
-        *file << currentAtom->x[0] << "\t";
-        *file << currentAtom->x[1] << "\t";
-        *file << currentAtom->x[2] << "\t";
+        *file << currentAtom->at(0) << "\t";
+        *file << currentAtom->at(1) << "\t";
+        *file << currentAtom->at(2) << "\t";
         break;
       case TremoloKey::u :
         // for the moment, assume there are always three dimensions
-        *file << currentAtom->v[0] << "\t";
-        *file << currentAtom->v[1] << "\t";
-        *file << currentAtom->v[2] << "\t";
+        *file << currentAtom->AtomicVelocity[0] << "\t";
+        *file << currentAtom->AtomicVelocity[1] << "\t";
+        *file << currentAtom->AtomicVelocity[2] << "\t";
         break;
       case TremoloKey::Type :
@@ -154,13 +173,27 @@
         break;
       case TremoloKey::Id :
-        *file << currentAtom->getId() << "\t";
+        *file << currentAtom->getId()+1 << "\t";
         break;
       case TremoloKey::neighbors :
         writeNeighbors(file, atoi(it->substr(it->find("=") + 1, 1).c_str()), currentAtom);
         break;
+      case TremoloKey::resSeq :
+        if (additionalAtomData.find(currentAtom->getId()) != additionalAtomData.end()) {
+          *file << additionalAtomData[currentAtom->getId()].get(currentField);
+        } else if (currentAtom->getMolecule() != NULL) {
+          *file << setw(4) << currentAtom->getMolecule()->getId()+1;
+        } else {
+          *file << defaultAdditionalData.get(currentField);
+        }
+        *file << "\t";
+      break;
       default :
-        *file << (additionalAtomData.find(currentAtom->getId()) != additionalAtomData.end()
-          ? additionalAtomData[currentAtom->getId()].get(currentField)
-          : defaultAdditionalData.get(currentField));
+        if (additionalAtomData.find(currentAtom->getId()) != additionalAtomData.end()) {
+          *file << additionalAtomData[currentAtom->getId()].get(currentField);
+        } else if (additionalAtomData.find(currentAtom->GetTrueFather()->getId()) != additionalAtomData.end()) {
+          *file << additionalAtomData[currentAtom->GetTrueFather()->getId()].get(currentField);
+        } else {
+          *file << defaultAdditionalData.get(currentField);
+        }
         *file << "\t";
         break;
@@ -182,5 +215,7 @@
   for (int i = 0; i < numberOfNeighbors; i++) {
     *file << (currentBond != currentAtom->ListOfBonds.end()
-        ? (*currentBond)->GetOtherAtom(currentAtom)->getId() : 0) << "\t";
+        ? (*currentBond)->GetOtherAtom(currentAtom)->getId()+1 : 0) << "\t";
+    if (currentBond != currentAtom->ListOfBonds.end())
+      currentBond++;
   }
 }
@@ -214,6 +249,7 @@
  *
  * \param line to parse as an atom
- */
-void TremoloParser::readAtomDataLine(string line) {
+ * \param *newmol molecule to add atom to
+ */
+void TremoloParser::readAtomDataLine(string line, molecule *newmol = NULL) {
   vector<string>::iterator it;
   stringstream lineStream;
@@ -225,4 +261,5 @@
   string word;
   int oldId;
+  double tmp;
 
   lineStream << line;
@@ -232,13 +269,14 @@
       case TremoloKey::x :
         // for the moment, assume there are always three dimensions
-        lineStream >> newAtom->x[0];
-        lineStream >> newAtom->x[1];
-        lineStream >> newAtom->x[2];
+        for (int i=0;i<NDIM;i++) {
+          lineStream >> tmp;
+          newAtom->set(i, tmp);
+        }
         break;
       case TremoloKey::u :
         // for the moment, assume there are always three dimensions
-        lineStream >> newAtom->v[0];
-        lineStream >> newAtom->v[1];
-        lineStream >> newAtom->v[2];
+        lineStream >> newAtom->AtomicVelocity[0];
+        lineStream >> newAtom->AtomicVelocity[1];
+        lineStream >> newAtom->AtomicVelocity[2];
         break;
       case TremoloKey::Type :
@@ -262,4 +300,6 @@
     }
   }
+  if (newmol != NULL)
+    newmol->AddAtom(newAtom);
 }
 
@@ -385,23 +425,23 @@
 
 
-TremoloAtomInfoContainer::TremoloAtomInfoContainer() {
-  F = "0";
-  stress = "0";
-  imprData = "-";
-  GroupMeasureTypeNo = "0";
-  extType = "-";
-  name = "-";
-  resName = "-";
-  chainID = "0";
-  resSeq = "0";
-  occupancy = "0";
-  tempFactor = "0";
-  segID = "0";
-  Charge = "0";
-  charge = "0";
-  GrpTypeNo = "0";
-  torsion = "-";
-  neighbors = vector<int>(0, 5);
-}
+TremoloAtomInfoContainer::TremoloAtomInfoContainer() :
+  F("0"),
+  stress("0"),
+  imprData("-"),
+  GroupMeasureTypeNo("0"),
+  extType("-"),
+  name("-"),
+  resName("-"),
+  chainID("0"),
+  resSeq("0"),
+  occupancy("0"),
+  tempFactor("0"),
+  segID("0"),
+  Charge("0"),
+  charge("0"),
+  GrpTypeNo("0"),
+  torsion("-"),
+  neighbors(vector<int>(0, 5))
+{}
 
 void TremoloAtomInfoContainer::set(TremoloKey::atomDataKey key, string value) {
Index: src/Parser/TremoloParser.hpp
===================================================================
--- src/Parser/TremoloParser.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Parser/TremoloParser.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,4 +11,6 @@
 #include <string>
 #include "Parser/FormatParser.hpp"
+
+class molecule;
 
 /**
@@ -85,4 +87,5 @@
 private:
   void readAtomDataLine(string line);
+  void readAtomDataLine(string line, molecule *newmol);
   void parseAtomDataKeysLine(string line, int offset);
   void readNeighbors(std::stringstream* line, int numberOfNeighbors, int atomId);
Index: src/Parser/XyzParser.cpp
===================================================================
--- src/Parser/XyzParser.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Parser/XyzParser.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * XyzParser.cpp
@@ -6,9 +13,17 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "XyzParser.hpp"
 #include "World.hpp"
 #include "atom.hpp"
+#include "molecule.hpp"
 #include "element.hpp"
 #include "periodentafel.hpp"
@@ -19,7 +34,7 @@
  * Constructor.
  */
-XyzParser::XyzParser() {
-  comment = "";
-}
+XyzParser::XyzParser() :
+  comment("")
+{}
 
 /**
@@ -35,7 +50,9 @@
  */
 void XyzParser::load(istream* file) {
-  atom* newAtom;
+  atom* newAtom = NULL;
+  molecule* newmol = NULL;
   int numberOfAtoms;
   char commentBuffer[512], type[3];
+  double tmp;
 
   // the first line tells number of atoms, the second line is always a comment
@@ -44,8 +61,17 @@
   comment = commentBuffer;
 
+  newmol = World::getInstance().createMolecule();
+  newmol->ActiveFlag = true;
+  // TODO: Remove the insertion into molecule when saving does not depend on them anymore. Also, remove molecule.hpp include
+  World::getInstance().getMolecules()->insert(newmol);
   for (int i = 0; i < numberOfAtoms; i++) {
     newAtom = World::getInstance().createAtom();
-    *file >> type >> ws >> newAtom->x[0] >> ws >> newAtom->x[1] >> ws >> newAtom->x[2];
+    *file >> type;
+    for (int j=0;j<NDIM;j++) {
+      *file >> tmp;
+      newAtom->set(j, tmp);
+    }
     newAtom->setType(World::getInstance().getPeriode()->FindElement(type));
+    newmol->AddAtom(newAtom);
   }
 }
@@ -57,4 +83,5 @@
  */
 void XyzParser::save(ostream* file) {
+  DoLog(0) && (Log() << Verbose(0) << "Saving changes to xyz." << std::endl);
   if (comment == "") {
     time_t now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
@@ -72,5 +99,5 @@
   vector<atom*> atoms = World::getInstance().getAllAtoms();
   for(vector<atom*>::iterator it = atoms.begin(); it != atoms.end(); it++) {
-    *file << noshowpoint << (*it)->getType()->symbol << "\t" << (*it)->x[0] << "\t" << (*it)->x[1] << "\t" << (*it)->x[2] << endl;
+    *file << noshowpoint << (*it)->getType()->getSymbol() << "\t" << (*it)->at(0) << "\t" << (*it)->at(1) << "\t" << (*it)->at(2) << endl;
   }
 }
Index: src/Patterns/ObservedContainer_impl.hpp
===================================================================
--- src/Patterns/ObservedContainer_impl.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Patterns/ObservedContainer_impl.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -186,3 +186,30 @@
 }
 
+/************ Explicit instantiation ***************/
+
+#define CONSTRUCT_OBSERVEDCONTAINER(name) \
+    template ObservedContainer< name >& ObservedContainer< name >::operator=(const ObservedContainer< name >&); \
+    template ObservedContainer< name >::iterator ObservedContainer< name >::begin(); \
+    template ObservedContainer< name >::const_iterator ObservedContainer< name >::begin() const; \
+    template ObservedContainer< name >::iterator ObservedContainer< name >::end(); \
+    template ObservedContainer< name >::const_iterator ObservedContainer< name >::end() const; \
+    template ObservedContainer< name >::reverse_iterator ObservedContainer< name >::rbegin(); \
+    template ObservedContainer< name >::const_reverse_iterator ObservedContainer< name >::rbegin() const; \
+    template ObservedContainer< name >::reverse_iterator ObservedContainer< name >::rend(); \
+    template ObservedContainer< name >::const_reverse_iterator ObservedContainer< name >::rend() const; \
+    template bool ObservedContainer< name >::empty() const; \
+    template size_t ObservedContainer< name >::size() const; \
+    template size_t ObservedContainer< name >::max_size() const; \
+    template ObservedContainer< name >::mapped_type &ObservedContainer< name >::operator[](const key_type&); \
+    template std::pair<ObservedContainer< name >::iterator,bool> ObservedContainer< name >::insert (const value_type&); \
+    template size_t ObservedContainer< name >::erase ( const key_type& x ); \
+    template void ObservedContainer< name >::clear(); \
+    template ObservedContainer< name >::iterator ObservedContainer< name >::find ( const key_type& x ); \
+    template ObservedContainer< name >::const_iterator ObservedContainer< name >::find ( const key_type& x ) const; \
+    template size_t ObservedContainer< name >::count ( const key_type& x ) const; \
+    template ObservedContainer< name >::internal_iterator ObservedContainer< name >::begin_internal(); \
+    template ObservedContainer< name >::reverse_internal_iterator ObservedContainer< name >::rbegin_internal(); \
+    template ObservedContainer< name >::internal_iterator ObservedContainer< name >::end_internal(); \
+    template ObservedContainer< name >::reverse_internal_iterator ObservedContainer< name >::rend_internal(); \
+
 #endif /* OBSERVEDCONTAINER_IMPL_HPP_ */
Index: src/Patterns/Observer.cpp
===================================================================
--- src/Patterns/Observer.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Patterns/Observer.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * Observer.cpp
@@ -6,8 +13,12 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
 #include "Observer.hpp"
-
 
 #include <iostream>
Index: src/Patterns/Registry_impl.hpp
===================================================================
--- src/Patterns/Registry_impl.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Patterns/Registry_impl.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -15,5 +15,5 @@
 
 #include "Helpers/Assert.hpp"
-#include <iostream>
+#include <iosfwd>
 
 /** Constructor for class Registry.
Index: c/Plane.cpp
===================================================================
--- src/Plane.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,212 +1,0 @@
-/*
- * Plane.cpp
- *
- *  Created on: Apr 7, 2010
- *      Author: crueger
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Plane.hpp"
-#include "vector.hpp"
-#include "defs.hpp"
-#include "info.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
-#include "Helpers/Assert.hpp"
-#include <cmath>
-#include "Line.hpp"
-#include "Exceptions/MultipleSolutionsException.hpp"
-
-/**
- * generates a plane from three given vectors defining three points in space
- */
-Plane::Plane(const Vector &y1, const Vector &y2, const Vector &y3) throw(LinearDependenceException) :
-  normalVector(new Vector())
-{
-  Vector x1 = y1 -y2;
-  Vector x2 = y3 -y2;
-  if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON) || (fabs(x1.Angle(x2)) < MYEPSILON)) {
-    throw LinearDependenceException(__FILE__,__LINE__);
-  }
-//  Log() << Verbose(4) << "relative, first plane coordinates:";
-//  x1.Output((ofstream *)&cout);
-//  Log() << Verbose(0) << endl;
-//  Log() << Verbose(4) << "second plane coordinates:";
-//  x2.Output((ofstream *)&cout);
-//  Log() << Verbose(0) << endl;
-
-  normalVector->at(0) = (x1[1]*x2[2] - x1[2]*x2[1]);
-  normalVector->at(1) = (x1[2]*x2[0] - x1[0]*x2[2]);
-  normalVector->at(2) = (x1[0]*x2[1] - x1[1]*x2[0]);
-  normalVector->Normalize();
-
-  offset=normalVector->ScalarProduct(y1);
-}
-/**
- * Constructs a plane from two direction vectors and a offset.
- */
-Plane::Plane(const Vector &y1, const Vector &y2, double _offset) throw(ZeroVectorException,LinearDependenceException) :
-    normalVector(new Vector()),
-    offset(_offset)
-{
-  Vector x1 = y1;
-  Vector x2 = y2;
-  if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON)) {
-    throw ZeroVectorException(__FILE__,__LINE__);
-  }
-
-  if((fabs(x1.Angle(x2)) < MYEPSILON)) {
-    throw LinearDependenceException(__FILE__,__LINE__);
-  }
-//  Log() << Verbose(4) << "relative, first plane coordinates:";
-//  x1.Output((ofstream *)&cout);
-//  Log() << Verbose(0) << endl;
-//  Log() << Verbose(4) << "second plane coordinates:";
-//  x2.Output((ofstream *)&cout);
-//  Log() << Verbose(0) << endl;
-
-  normalVector->at(0) = (x1[1]*x2[2] - x1[2]*x2[1]);
-  normalVector->at(1) = (x1[2]*x2[0] - x1[0]*x2[2]);
-  normalVector->at(2) = (x1[0]*x2[1] - x1[1]*x2[0]);
-  normalVector->Normalize();
-}
-
-Plane::Plane(const Vector &_normalVector, double _offset) throw(ZeroVectorException):
-  normalVector(new Vector(_normalVector)),
-  offset(_offset)
-{
-  if(normalVector->IsZero())
-    throw ZeroVectorException(__FILE__,__LINE__);
-  double factor = 1/normalVector->Norm();
-  // normalize the plane parameters
-  (*normalVector)*=factor;
-  offset*=factor;
-}
-
-Plane::Plane(const Vector &_normalVector, const Vector &_offsetVector) throw(ZeroVectorException):
-    normalVector(new Vector(_normalVector))
-{
-  if(normalVector->IsZero()){
-    throw ZeroVectorException(__FILE__,__LINE__);
-  }
-  normalVector->Normalize();
-  offset = normalVector->ScalarProduct(_offsetVector);
-}
-
-/**
- * copy constructor
- */
-Plane::Plane(const Plane& plane) :
-  normalVector(new Vector(*plane.normalVector)),
-  offset(plane.offset)
-{}
-
-
-Plane::~Plane()
-{}
-
-
-Vector Plane::getNormal() const{
-  return *normalVector;
-}
-
-double Plane::getOffset() const{
-  return offset;
-}
-
-Vector Plane::getOffsetVector() const {
-  return getOffset()*getNormal();
-}
-
-vector<Vector> Plane::getPointsOnPlane() const{
-  std::vector<Vector> res;
-  res.reserve(3);
-  // first point on the plane
-  res.push_back(getOffsetVector());
-  // get a vector that has direction of plane
-  Vector direction;
-  direction.GetOneNormalVector(getNormal());
-  res.push_back(res[0]+direction);
-  // get an orthogonal vector to direction and normal (has direction of plane)
-  direction.VectorProduct(getNormal());
-  direction.Normalize();
-  res.push_back(res[0] +direction);
-  return res;
-}
-
-
-/** Calculates the intersection point between a line defined by \a *LineVector and \a *LineVector2 and a plane defined by \a *Normal and \a *PlaneOffset.
- * According to [Bronstein] the vectorial plane equation is:
- *   -# \f$\stackrel{r}{\rightarrow} \cdot \stackrel{N}{\rightarrow} + D = 0\f$,
- * where \f$\stackrel{r}{\rightarrow}\f$ is the vector to be testet, \f$\stackrel{N}{\rightarrow}\f$ is the plane's normal vector and
- * \f$D = - \stackrel{a}{\rightarrow} \stackrel{N}{\rightarrow}\f$, the offset with respect to origin, if \f$\stackrel{a}{\rightarrow}\f$,
- * is an offset vector onto the plane. The line is parametrized by \f$\stackrel{x}{\rightarrow} + k \stackrel{t}{\rightarrow}\f$, where
- * \f$\stackrel{x}{\rightarrow}\f$ is the offset and \f$\stackrel{t}{\rightarrow}\f$ the directional vector (NOTE: No need to normalize
- * the latter). Inserting the parametrized form into the plane equation and solving for \f$k\f$, which we insert then into the parametrization
- * of the line yields the intersection point on the plane.
- * \param *Origin first vector of line
- * \param *LineVector second vector of line
- * \return true -  \a this contains intersection point on return, false - line is parallel to plane (even if in-plane)
- */
-Vector Plane::GetIntersection(const Line& line) const
-{
-  Info FunctionInfo(__func__);
-  Vector res;
-
-  double factor1 = getNormal().ScalarProduct(line.getDirection());
-  if(fabs(factor1)<MYEPSILON){
-    // the plane is parallel... under all circumstances this is bad luck
-    // we no have either no or infinite solutions
-    if(isContained(line.getOrigin())){
-      throw MultipleSolutionsException<Vector>(__FILE__,__LINE__,line.getOrigin());
-    }
-    else{
-      throw LinearDependenceException(__FILE__,__LINE__);
-    }
-  }
-
-  double factor2 = getNormal().ScalarProduct(line.getOrigin());
-  double scaleFactor = (offset-factor2)/factor1;
-
-  res = line.getOrigin() + scaleFactor * line.getDirection();
-
-  // tests to make sure the resulting vector really is on plane and line
-  ASSERT(isContained(res),"Calculated line-Plane intersection does not lie on plane.");
-  ASSERT(line.isContained(res),"Calculated line-Plane intersection does not lie on line.");
-  return res;
-};
-
-Vector Plane::mirrorVector(const Vector &rhs) const {
-  Vector helper = getVectorToPoint(rhs);
-  // substract twice the Vector to the plane
-  return rhs+2*helper;
-}
-
-Line Plane::getOrthogonalLine(const Vector &origin) const{
-  return Line(origin,getNormal());
-}
-
-/************ Methods inherited from Space ****************/
-
-double Plane::distance(const Vector &point) const{
-  double res = point.ScalarProduct(*normalVector)-offset;
-  return fabs(res);
-}
-
-Vector Plane::getClosestPoint(const Vector &point) const{
-  double factor = point.ScalarProduct(*normalVector)-offset;
-  if(fabs(factor) < MYEPSILON){
-    // the point itself lies on the plane
-    return point;
-  }
-  Vector difference = factor * (*normalVector);
-  return (point - difference);
-}
-
-// Operators
-
-ostream &operator << (ostream &ost,const Plane &p){
-  ost << "<" << p.getNormal() << ";x> - " << p.getOffset() << "=0";
-  return ost;
-}
Index: c/Plane.hpp
===================================================================
--- src/Plane.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Plane.hpp
- *
- *  Created on: Apr 7, 2010
- *      Author: crueger
- */
-
-#ifndef PLANE_HPP_
-#define PLANE_HPP_
-
-#include <memory>
-#include <vector>
-#include <iosfwd>
-#include "Space.hpp"
-#include "Exceptions/LinearDependenceException.hpp"
-#include "Exceptions/ZeroVectorException.hpp"
-
-class Vector;
-class Line;
-
-class Plane : public Space
-{
-  typedef std::auto_ptr<Vector> vec_ptr;
-public:
-  Plane(const Vector &y1, const Vector &y2, const Vector &y3) throw(LinearDependenceException);
-  Plane(const Vector &y1, const Vector &y2, double _offset) throw(ZeroVectorException,LinearDependenceException);
-  Plane(const Vector &_normalVector, double _offset)  throw(ZeroVectorException);
-  Plane(const Vector &_normalVector, const Vector &_offsetVector) throw(ZeroVectorException);
-  Plane(const Plane& plane);
-  virtual ~Plane();
-
-  // Accessor Functions
-  /**
-   * returns normal Vector for a plane
-   */
-  Vector getNormal() const;
-  /**
-   * returns the distance of the plane from the origin
-   */
-  double getOffset() const;
-  /**
-   * returns a vector that points on the plane.
-   * Same as getOffset()*getNormal();
-   */
-  Vector getOffsetVector() const;
-
-  /**
-   * returns three seperate points on this plane
-   */
-  std::vector<Vector> getPointsOnPlane() const;
-
-  // some calculations
-  Vector GetIntersection(const Line &Line) const;
-
-  Vector mirrorVector(const Vector &rhs) const;
-
-  /**
-   * get a Line that is orthogonal to this plane, going through a chosen
-   * point.
-   *
-   * The point does not have to lie on the plane itself.
-   */
-  Line getOrthogonalLine(const Vector &origin) const;
-
-  /****** Methods inherited from Space ***********/
-
-  virtual double distance(const Vector &point) const;
-  virtual Vector getClosestPoint(const Vector &point) const;
-
-private:
-  vec_ptr normalVector;
-  double offset;
-};
-
-std::ostream &operator<< (std::ostream &ost,const Plane& p);
-
-#endif /* PLANE_HPP_ */
Index: src/PointCloud.cpp
===================================================================
--- src/PointCloud.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/PointCloud.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,39 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * PointCloud.cpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "PointCloud.hpp"
+
+/** Constructor of class PointCloud.
+ */
+PointCloud::PointCloud()
+{
+  //Info FunctionInfo(__func__);
+}
+;
+
+/** Destructor for class PointCloud.
+ */
+PointCloud::~PointCloud()
+{
+  //Info FunctionInfo(__func__);
+}
+;
+
Index: src/PointCloud.hpp
===================================================================
--- src/PointCloud.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/PointCloud.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,35 @@
+/*
+ * PointCloud.hpp
+ *
+ *  Created on: Jul 29, 2010
+ *      Author: heber
+ */
+
+#ifndef POINTCLOUD_HPP_
+#define POINTCLOUD_HPP_
+
+#include <cstdio>
+
+class TesselPoint;
+class Vector;
+
+/** Super-class for all point clouds structures, also molecules. They have to inherit this structure and implement the virtual function to access the Vectors.
+ * This basically encapsulates a list structure.
+ */
+class PointCloud {
+public:
+  PointCloud();
+  virtual ~PointCloud();
+
+  virtual const char * const GetName() const { return "unknown"; };
+  virtual Vector *GetCenter() const { return NULL; };
+  virtual TesselPoint *GetPoint() const { return NULL; };
+  virtual int GetMaxId() const { return 0; };
+  virtual void GoToNext() const {};
+  virtual void GoToFirst() const {};
+  virtual bool IsEmpty() const { return true; };
+  virtual bool IsEnd() const { return true; };
+};
+
+
+#endif /* POINTCLOUD_HPP_ */
Index: src/Shapes/BaseShapes.cpp
===================================================================
--- src/Shapes/BaseShapes.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Shapes/BaseShapes.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * BaseShapes_impl.cpp
@@ -6,12 +13,82 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
 #include "Shapes/BaseShapes.hpp"
 #include "Shapes/BaseShapes_impl.hpp"
-
-#include "vector.hpp"
+#include "Shapes/ShapeOps.hpp"
+
+#include "defs.hpp"
+
+#include "Helpers/Assert.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Line.hpp"
+#include "LinearAlgebra/Plane.hpp"
+#include "LinearAlgebra/LineSegment.hpp"
+#include "LinearAlgebra/LineSegmentSet.hpp"
+
+#include <cmath>
+#include <algorithm>
 
 bool Sphere_impl::isInside(const Vector &point){
   return point.NormSquared()<=1;
 }
+
+bool Sphere_impl::isOnSurface(const Vector &point){
+  return fabs(point.NormSquared()-1)<MYEPSILON;
+}
+
+Vector Sphere_impl::getNormal(const Vector &point) throw(NotOnSurfaceException){
+  if(!isOnSurface(point)){
+    throw NotOnSurfaceException(__FILE__,__LINE__);
+  }
+  return point;
+}
+
+LineSegmentSet Sphere_impl::getLineIntersections(const Line &line){
+  LineSegmentSet res(line);
+  std::vector<Vector> intersections = line.getSphereIntersections();
+  if(intersections.size()==2){
+    res.insert(LineSegment(intersections[0],intersections[1]));
+  }
+  return res;
+}
+
+string Sphere_impl::toString(){
+  return "Sphere()";
+}
+
+/**
+ * algorithm taken from http://www.cgafaq.info/wiki/Evenly_distributed_points_on_sphere
+ * \param N number of points on surface
+ */
+std::vector<Vector> Sphere_impl::getHomogeneousPointsOnSurface(const size_t N) const {
+  std::vector<Vector> PointsOnSurface;
+
+  const double dlength = M_PI*(3.-sqrt(5.));
+  double length = 0;
+  const double dz = 2.0/N;
+  double z = 1. - dz/2.;
+  Vector point;
+  for (size_t ka = 0; ka<N; ka++){
+    const double r = sqrt(1.-z*z);
+    point.Zero();
+    point[0] = cos(length)*r;
+    point[1] = sin(length)*r;
+    point[2] = z;
+    PointsOnSurface.push_back(point);
+    z = z - dz;
+    length = length + dlength;
+  }
+
+  ASSERT(PointsOnSurface.size() == N, "Sphere_impl::getHomogeneousPointsOnSurface() did not create enough points.");
+  return PointsOnSurface;
+}
+
 
 Shape Sphere(){
@@ -20,10 +97,105 @@
 }
 
+Shape Sphere(const Vector &center,double radius){
+  return translate(resize(Sphere(),radius),center);
+}
+
+Shape Ellipsoid(const Vector &center, const Vector &radius){
+  return translate(stretch(Sphere(),radius),center);
+}
+
 bool Cuboid_impl::isInside(const Vector &point){
-  return point[0]<=1 && point[1]<=1 && point[2]<=1;
+  return (point[0]>=0 && point[0]<=1) && (point[1]>=0 && point[1]<=1) && (point[2]>=0 && point[2]<=1);
+}
+
+bool Cuboid_impl::isOnSurface(const Vector &point){
+  bool retVal = isInside(point);
+  // test all borders of the cuboid
+  // double fabs
+  retVal = retVal &&
+           (((fabs(point[0]-1.)  < MYEPSILON) || (fabs(point[0])  < MYEPSILON)) ||
+            ((fabs(point[1]-1.)  < MYEPSILON) || (fabs(point[1])  < MYEPSILON)) ||
+            ((fabs(point[2]-1.)  < MYEPSILON) || (fabs(point[2])  < MYEPSILON)));
+  return retVal;
+}
+
+Vector Cuboid_impl::getNormal(const Vector &point) throw(NotOnSurfaceException){
+  if(!isOnSurface(point)){
+    throw NotOnSurfaceException(__FILE__,__LINE__);
+  }
+  Vector res;
+  // figure out on which sides the Vector lies (maximum 3, when it is in a corner)
+  for(int i=NDIM;i--;){
+    if(fabs(fabs(point[i])-1)<MYEPSILON){
+      // add the scaled (-1/+1) Vector to the set of surface vectors
+      res[i] = point[i];
+    }
+  }
+  ASSERT(res.NormSquared()>=1 && res.NormSquared()<=3,"To many or to few sides found for this Vector");
+
+  res.Normalize();
+  return res;
+}
+
+LineSegmentSet Cuboid_impl::getLineIntersections(const Line &line){
+  LineSegmentSet res(line);
+  // get the intersection on each of the six faces
+  vector<Vector> intersections;
+  intersections.resize(2);
+  int c=0;
+  int x[2]={-1,+1};
+  for(int i=NDIM;i--;){
+    for(int p=0;p<2;++p){
+      if(c==2) goto end; // I know this sucks, but breaking two loops is stupid
+      Vector base;
+      base[i]=x[p];
+      // base now points to the surface and is normal to it at the same time
+      Plane p(base,base);
+      Vector intersection = p.GetIntersection(line);
+      if(isInside(intersection)){
+        // if we have a point on the edge it might already be contained
+        if(c==1 && intersections[0]==intersection)
+          continue;
+        intersections[c++]=intersection;
+      }
+    }
+  }
+  end:
+  if(c==2){
+    res.insert(LineSegment(intersections[0],intersections[1]));
+  }
+  return res;
+}
+
+string Cuboid_impl::toString(){
+  return "Cuboid()";
+}
+
+/**
+ * \param N number of points on surface
+ */
+std::vector<Vector> Cuboid_impl::getHomogeneousPointsOnSurface(const size_t N) const {
+  std::vector<Vector> PointsOnSurface;
+  ASSERT(false, "Cuboid_impl::getHomogeneousPointsOnSurface() not implemented yet");
+  return PointsOnSurface;
 }
 
 Shape Cuboid(){
-  Shape::impl_ptr impl = Shape::impl_ptr(new Sphere_impl());
+  Shape::impl_ptr impl = Shape::impl_ptr(new Cuboid_impl());
   return Shape(impl);
 }
+
+Shape Cuboid(const Vector &corner1, const Vector &corner2){
+  // make sure the two edges are upper left front and lower right back
+  Vector sortedC1;
+  Vector sortedC2;
+  for(int i=NDIM;i--;){
+    sortedC1[i] = min(corner1[i],corner2[i]);
+    sortedC2[i] = max(corner1[i],corner2[i]);
+    ASSERT(corner1[i]!=corner2[i],"Given points for cuboid edges did not define a valid space");
+  }
+  // get the middle point
+  Vector middle = (1./2.)*(sortedC1+sortedC2);
+  Vector factors = sortedC2-middle;
+  return translate(stretch(Cuboid(),factors),middle);
+}
Index: src/Shapes/BaseShapes.hpp
===================================================================
--- src/Shapes/BaseShapes.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Shapes/BaseShapes.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -12,5 +12,8 @@
 
 Shape Sphere();
+Shape Sphere(const Vector &center,double radius);
+Shape Ellipsoid(const Vector &center, const Vector &radius);
 Shape Cuboid();
+Shape Cuboid(const Vector &corner1, const Vector &corner2);
 
 #endif /* BASESHAPES_HPP_ */
Index: src/Shapes/BaseShapes_impl.hpp
===================================================================
--- src/Shapes/BaseShapes_impl.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Shapes/BaseShapes_impl.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -9,12 +9,25 @@
 #define BASESHAPES_IMPL_HPP_
 
+class Vector;
+class LineSegmentSet;
+
 #include "Shapes/Shape_impl.hpp"
 
 class Sphere_impl : public Shape_impl {
   virtual bool isInside(const Vector &point);
+  virtual bool isOnSurface(const Vector &point);
+  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
+  virtual std::string toString();
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
 };
 
 class Cuboid_impl : public Shape_impl {
   virtual bool isInside(const Vector &point);
+  virtual bool isOnSurface(const Vector &point);
+  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
+  virtual std::string toString();
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
 };
 
Index: src/Shapes/Shape.cpp
===================================================================
--- src/Shapes/Shape.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Shapes/Shape.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * Shape.cpp
@@ -6,7 +13,20 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Helpers/Assert.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
 #include "Shape.hpp"
 #include "Shape_impl.hpp"
 
+#include <string>
+
+
 Shape::Shape(const Shape& src) :
   impl(src.getImpl())
@@ -17,4 +37,20 @@
 bool Shape::isInside(const Vector &point) const{
   return impl->isInside(point);
+}
+
+bool Shape::isOnSurface(const Vector &point) const{
+  return impl->isOnSurface(point);
+}
+
+Vector Shape::getNormal(const Vector &point) const throw (NotOnSurfaceException){
+  return impl->getNormal(point);
+}
+
+LineSegmentSet Shape::getLineIntersections(const Line &line){
+  return impl->getLineIntersections(line);
+}
+
+std::vector<Vector> Shape::getHomogeneousPointsOnSurface(const size_t N) const {
+  return impl->getHomogeneousPointsOnSurface(N);
 }
 
@@ -30,4 +66,8 @@
 }
 
+std::string Shape::toString() const{
+  return impl->toString();
+}
+
 Shape::impl_ptr Shape::getImpl() const{
   return impl;
@@ -65,4 +105,73 @@
 }
 
+bool AndShape_impl::isOnSurface(const Vector &point){
+  // check the number of surfaces that this point is on
+  int surfaces =0;
+  surfaces += lhs->isOnSurface(point);
+  surfaces += rhs->isOnSurface(point);
+
+  switch(surfaces){
+    case 0:
+      return false;
+      // no break necessary
+    case 1:
+      // if it is inside for the object where it does not lie on
+      // the surface the whole point lies inside
+      return (lhs->isOnSurface(point) && rhs->isInside(point)) ||
+             (rhs->isOnSurface(point) && lhs->isInside(point));
+      // no break necessary
+    case 2:
+      {
+        // it lies on both Shapes... could be an edge or an inner point
+        // test the direction of the normals
+        Vector direction=lhs->getNormal(point)+rhs->getNormal(point);
+        // if the directions are opposite we lie on the inside
+        return !direction.IsZero();
+      }
+      // no break necessary
+    default:
+      // if this happens there is something wrong
+      ASSERT(0,"Default case should have never been used");
+  }
+  return false; // never reached
+}
+
+Vector AndShape_impl::getNormal(const Vector &point) throw (NotOnSurfaceException){
+  Vector res;
+  if(!isOnSurface(point)){
+    throw NotOnSurfaceException(__FILE__,__LINE__);
+  }
+  res += lhs->isOnSurface(point)?lhs->getNormal(point):zeroVec;
+  res += rhs->isOnSurface(point)?rhs->getNormal(point):zeroVec;
+  res.Normalize();
+  return res;
+}
+
+LineSegmentSet AndShape_impl::getLineIntersections(const Line &line){
+  return intersect(lhs->getLineIntersections(line),rhs->getLineIntersections(line));
+}
+
+string AndShape_impl::toString(){
+  return string("(") + lhs->toString() + string("&&") + rhs->toString() + string(")");
+}
+
+std::vector<Vector> AndShape_impl::getHomogeneousPointsOnSurface(const size_t N) const {
+  std::vector<Vector> PointsOnSurface_lhs = lhs->getHomogeneousPointsOnSurface(N);
+  std::vector<Vector> PointsOnSurface_rhs = rhs->getHomogeneousPointsOnSurface(N);
+  std::vector<Vector> PointsOnSurface;
+
+  for (std::vector<Vector>::const_iterator iter = PointsOnSurface_lhs.begin(); iter != PointsOnSurface_lhs.end(); ++iter) {
+    if (rhs->isInside(*iter))
+      PointsOnSurface.push_back(*iter);
+  }
+  for (std::vector<Vector>::const_iterator iter = PointsOnSurface_rhs.begin(); iter != PointsOnSurface_rhs.end(); ++iter) {
+    if (lhs->isInside(*iter))
+      PointsOnSurface.push_back(*iter);
+  }
+
+  return PointsOnSurface;
+}
+
+
 Shape operator&&(const Shape &lhs,const Shape &rhs){
   Shape::impl_ptr newImpl = Shape::impl_ptr(new AndShape_impl(getShapeImpl(lhs),getShapeImpl(rhs)));
@@ -82,4 +191,72 @@
 }
 
+bool OrShape_impl::isOnSurface(const Vector &point){
+  // check the number of surfaces that this point is on
+  int surfaces =0;
+  surfaces += lhs->isOnSurface(point);
+  surfaces += rhs->isOnSurface(point);
+
+  switch(surfaces){
+    case 0:
+      return false;
+      // no break necessary
+    case 1:
+      // if it is inside for the object where it does not lie on
+      // the surface the whole point lies inside
+      return (lhs->isOnSurface(point) && !rhs->isInside(point)) ||
+             (rhs->isOnSurface(point) && !lhs->isInside(point));
+      // no break necessary
+    case 2:
+      {
+        // it lies on both Shapes... could be an edge or an inner point
+        // test the direction of the normals
+        Vector direction=lhs->getNormal(point)+rhs->getNormal(point);
+        // if the directions are opposite we lie on the inside
+        return !direction.IsZero();
+      }
+      // no break necessary
+    default:
+      // if this happens there is something wrong
+      ASSERT(0,"Default case should have never been used");
+  }
+  return false; // never reached
+}
+
+Vector OrShape_impl::getNormal(const Vector &point) throw (NotOnSurfaceException){
+  Vector res;
+  if(!isOnSurface(point)){
+    throw NotOnSurfaceException(__FILE__,__LINE__);
+  }
+  res += lhs->isOnSurface(point)?lhs->getNormal(point):zeroVec;
+  res += rhs->isOnSurface(point)?rhs->getNormal(point):zeroVec;
+  res.Normalize();
+  return res;
+}
+
+LineSegmentSet OrShape_impl::getLineIntersections(const Line &line){
+  return merge(lhs->getLineIntersections(line),rhs->getLineIntersections(line));
+}
+
+string OrShape_impl::toString(){
+  return string("(") + lhs->toString() + string("||") + rhs->toString() + string(")");
+}
+
+std::vector<Vector> OrShape_impl::getHomogeneousPointsOnSurface(const size_t N) const {
+  std::vector<Vector> PointsOnSurface_lhs = lhs->getHomogeneousPointsOnSurface(N);
+  std::vector<Vector> PointsOnSurface_rhs = rhs->getHomogeneousPointsOnSurface(N);
+  std::vector<Vector> PointsOnSurface;
+
+  for (std::vector<Vector>::const_iterator iter = PointsOnSurface_lhs.begin(); iter != PointsOnSurface_lhs.end(); ++iter) {
+    if (!rhs->isInside(*iter))
+      PointsOnSurface.push_back(*iter);
+  }
+  for (std::vector<Vector>::const_iterator iter = PointsOnSurface_rhs.begin(); iter != PointsOnSurface_rhs.end(); ++iter) {
+    if (!lhs->isInside(*iter))
+      PointsOnSurface.push_back(*iter);
+  }
+
+  return PointsOnSurface;
+}
+
 Shape operator||(const Shape &lhs,const Shape &rhs){
   Shape::impl_ptr newImpl = Shape::impl_ptr(new OrShape_impl(getShapeImpl(lhs),getShapeImpl(rhs)));
@@ -99,6 +276,33 @@
 }
 
+bool NotShape_impl::isOnSurface(const Vector &point){
+  return arg->isOnSurface(point);
+}
+
+Vector NotShape_impl::getNormal(const Vector &point) throw(NotOnSurfaceException){
+  return -1*arg->getNormal(point);
+}
+
+LineSegmentSet NotShape_impl::getLineIntersections(const Line &line){
+  return invert(arg->getLineIntersections(line));
+}
+
+string NotShape_impl::toString(){
+  return string("!") + arg->toString();
+}
+
+std::vector<Vector> NotShape_impl::getHomogeneousPointsOnSurface(const size_t N) const {
+  // surfaces are the same, only normal direction is different
+  return arg->getHomogeneousPointsOnSurface(N);
+}
+
 Shape operator!(const Shape &arg){
   Shape::impl_ptr newImpl = Shape::impl_ptr(new NotShape_impl(getShapeImpl(arg)));
   return Shape(newImpl);
 }
+
+/**************** global operations *********************************/
+ostream &operator<<(ostream &ost,const Shape &shape){
+  ost << shape.toString();
+  return ost;
+}
Index: src/Shapes/Shape.hpp
===================================================================
--- src/Shapes/Shape.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Shapes/Shape.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,7 +10,14 @@
 
 #include <boost/shared_ptr.hpp>
+#include <iosfwd>
+
+#include "Exceptions/NotOnSurfaceException.hpp"
+
+#include <vector>
 
 class Vector;
 class Shape_impl;
+class LineSegmentSet;
+class Line;
 
 class Shape
@@ -25,7 +32,13 @@
 
   bool isInside(const Vector &point) const;
+  bool isOnSurface(const Vector &point) const;
+  Vector getNormal(const Vector &point) const throw(NotOnSurfaceException);
+
+  LineSegmentSet getLineIntersections(const Line&);
+  std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
 
   Shape &operator=(const Shape& rhs);
 
+  std::string toString() const;
 protected:
   impl_ptr getImpl() const;
@@ -42,3 +55,5 @@
 Shape operator!(const Shape&);
 
+std::ostream &operator<<(std::ostream&,const Shape&);
+
 #endif /* SHAPE_HPP_ */
Index: src/Shapes/ShapeOps.cpp
===================================================================
--- src/Shapes/ShapeOps.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Shapes/ShapeOps.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ShapeOps.cpp
@@ -6,13 +13,73 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
 #include "Shapes/ShapeOps.hpp"
 #include "Shapes/ShapeOps_impl.hpp"
 
+#include "LinearAlgebra/Vector.hpp"
 #include "Helpers/Assert.hpp"
 
+/*************** Base case ***********************/
+
+ShapeOpsBase_impl::ShapeOpsBase_impl(const Shape::impl_ptr &_arg) :
+  arg(_arg){}
+
+ShapeOpsBase_impl::~ShapeOpsBase_impl(){}
+
+bool ShapeOpsBase_impl::isInside(const Vector &point){
+  return arg->isInside(translateIn(point));
+}
+
+bool ShapeOpsBase_impl::isOnSurface(const Vector &point){
+  return arg->isOnSurface(translateIn(point));
+}
+
+Vector ShapeOpsBase_impl::getNormal(const Vector &point) throw (NotOnSurfaceException){
+  Vector helper = translateIn(point);
+  if(!arg->isOnSurface(helper)){
+    throw NotOnSurfaceException(__FILE__,__LINE__);
+  }
+  Vector res = translateOutNormal(arg->getNormal(helper));
+  res.Normalize();
+  return res;
+}
+
+LineSegmentSet ShapeOpsBase_impl::getLineIntersections(const Line &line){
+  Line newLine(translateIn(line.getOrigin()),translateIn(line.getDirection()));
+  LineSegmentSet res(line);
+  LineSegmentSet helper = getArg()->getLineIntersections(newLine);
+  for(LineSegmentSet::iterator iter = helper.begin();iter!=helper.end();++iter){
+    LinePoint lpBegin = iter->getBegin();
+    LinePoint lpEnd = iter->getBegin();
+    // translate both linepoints
+    lpBegin = lpBegin.isNegInfinity()?
+                line.negEndpoint():
+                line.getLinePoint(translateOutPos(lpBegin.getPoint()));
+    lpEnd = lpEnd.isPosInfinity()?
+              line.posEndpoint():
+              line.getLinePoint(translateOutPos(lpEnd.getPoint()));
+    res.insert(LineSegment(lpBegin,lpEnd));
+  }
+  return res;
+}
+
+std::vector<Vector> ShapeOpsBase_impl::getHomogeneousPointsOnSurface(const size_t N) const {
+  return getArg()->getHomogeneousPointsOnSurface(N);;
+}
+
+Shape::impl_ptr ShapeOpsBase_impl::getArg() const{
+  return arg;
+}
+
 /********************* Resize ********************/
 
 Resize_impl::Resize_impl(const Shape::impl_ptr &_arg,double _size) :
-  arg(_arg), size(_size)
+  ShapeOpsBase_impl(_arg), size(_size)
 {
   ASSERT(size>0,"Cannot resize a Shape to size zero or below");
@@ -22,6 +89,33 @@
 
 bool Resize_impl::isInside(const Vector& point){
-  return arg->isInside((1/size) * point);
-}
+  return getArg()->isInside((1/size) * point);
+}
+
+Vector Resize_impl::translateIn(const Vector& point){
+  return (1/size) * point;
+}
+
+Vector Resize_impl::translateOutPos(const Vector& point){
+  return size * point;
+}
+
+Vector Resize_impl::translateOutNormal(const Vector& point){
+  return point;
+}
+
+string Resize_impl::toString(){
+  stringstream sstr;
+  sstr << "resize(" << getArg()->toString() << "," << size << ")";
+  return sstr.str();
+}
+
+std::vector<Vector> Resize_impl::getHomogeneousPointsOnSurface(const size_t N) const {
+  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
+  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
+    *iter *= size;
+  }
+  return PointsOnSurface;
+}
+
 
 Shape resize(const Shape &arg,double size){
@@ -33,5 +127,5 @@
 
 Translate_impl::Translate_impl(const Shape::impl_ptr &_arg, const Vector &_offset) :
-  arg(_arg),offset(_offset)
+  ShapeOpsBase_impl(_arg),offset(_offset)
 {}
 
@@ -39,5 +133,31 @@
 
 bool Translate_impl::isInside(const Vector& point){
-  return arg->isInside(point-offset);
+  return getArg()->isInside(point-offset);
+}
+
+Vector Translate_impl::translateIn(const Vector& point){
+  return point-offset;
+}
+
+Vector Translate_impl::translateOutPos(const Vector& point){
+  return point+offset;
+}
+
+Vector Translate_impl::translateOutNormal(const Vector& point){
+  return point;
+}
+
+string Translate_impl::toString(){
+  stringstream sstr;
+  sstr << "translate(" << getArg()->toString() << "," << offset << ")";
+  return sstr.str();
+}
+
+std::vector<Vector> Translate_impl::getHomogeneousPointsOnSurface(const size_t N) const {
+  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
+  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
+    *iter += offset;
+  }
+  return PointsOnSurface;
 }
 
@@ -50,5 +170,5 @@
 
 Stretch_impl::Stretch_impl(const Shape::impl_ptr &_arg, const Vector &_factors) :
-  arg(_arg),factors(_factors)
+  ShapeOpsBase_impl(_arg),factors(_factors)
 {
   ASSERT(factors[0]>0,"cannot stretch a shape by a negative amount");
@@ -65,5 +185,43 @@
   Vector helper=point;
   helper.ScaleAll(reciFactors);
-  return arg->isInside(helper);
+  return getArg()->isInside(helper);
+}
+
+Vector Stretch_impl::translateIn(const Vector& point){
+  Vector helper=point;
+  helper.ScaleAll(reciFactors);
+  return helper;
+}
+
+Vector Stretch_impl::translateOutPos(const Vector& point){
+  Vector helper=point;
+  helper.ScaleAll(factors);
+  return helper;
+}
+
+Vector Stretch_impl::translateOutNormal(const Vector& point){
+  Vector helper=point;
+  // the normalFactors are derived from appearances of the factors
+  // with in the vectorproduct
+  Vector normalFactors;
+  normalFactors[0]=factors[1]*factors[2];
+  normalFactors[1]=factors[0]*factors[2];
+  normalFactors[2]=factors[0]*factors[1];
+  helper.ScaleAll(normalFactors);
+  return helper;
+}
+
+string Stretch_impl::toString(){
+  stringstream sstr;
+  sstr << "stretch(" << getArg()->toString() << "," << factors << ")";
+  return sstr.str();
+}
+
+std::vector<Vector> Stretch_impl::getHomogeneousPointsOnSurface(const size_t N) const {
+  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
+  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
+    (*iter).ScaleAll(reciFactors);
+  }
+  return PointsOnSurface;
 }
 
@@ -76,5 +234,5 @@
 
 Transform_impl::Transform_impl(const Shape::impl_ptr &_arg, const Matrix &_transformation) :
-  arg(_arg),transformation(_transformation)
+  ShapeOpsBase_impl(_arg),transformation(_transformation)
 {
   transformationInv = transformation.invert();
@@ -84,5 +242,32 @@
 
 bool Transform_impl::isInside(const Vector& point){
-  return arg->isInside(transformationInv * point);
+  return getArg()->isInside(transformationInv * point);
+}
+
+Vector Transform_impl::translateIn(const Vector& point){
+  return transformationInv * point;
+}
+
+Vector Transform_impl::translateOutPos(const Vector& point){
+  return transformation * point;
+}
+
+Vector Transform_impl::translateOutNormal(const Vector& point){
+  Matrix mat = transformation.invert().transpose();
+  return mat * point;
+}
+
+string Transform_impl::toString(){
+  stringstream sstr;
+  sstr << "transform(" << getArg()->toString() << "," << transformation << ")";
+  return sstr.str();
+}
+
+std::vector<Vector> Transform_impl::getHomogeneousPointsOnSurface(const size_t N) const {
+  std::vector<Vector> PointsOnSurface = getArg()->getHomogeneousPointsOnSurface(N);
+  for(std::vector<Vector>::iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
+    *iter = transformation * (*iter);
+  }
+  return PointsOnSurface;
 }
 
Index: src/Shapes/ShapeOps_impl.hpp
===================================================================
--- src/Shapes/ShapeOps_impl.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Shapes/ShapeOps_impl.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,49 +10,91 @@
 
 #include "Shapes/Shape_impl.hpp"
-#include "vector.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 
-class Resize_impl :  public Shape_impl
+#include <vector>
+
+class LineSegment;
+
+class ShapeOpsBase_impl : public Shape_impl{
+public:
+  ShapeOpsBase_impl(const Shape::impl_ptr&);
+  virtual ~ShapeOpsBase_impl();
+  virtual bool isInside(const Vector &point);
+  virtual bool isOnSurface(const Vector &point);
+  virtual Vector getNormal(const Vector &point) throw (NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
+protected:
+  virtual Vector translateIn(const Vector &point)=0;
+  virtual Vector translateOutPos(const Vector &point)=0;
+  virtual Vector translateOutNormal(const Vector &point)=0;
+  Shape::impl_ptr getArg() const;
+private:
+  Shape::impl_ptr arg;
+};
+
+class Resize_impl :  public ShapeOpsBase_impl
 {
 public:
   Resize_impl(const Shape::impl_ptr&,double);
   virtual ~Resize_impl();
+protected:
+  virtual Vector translateIn(const Vector &point);
+  virtual Vector translateOutPos(const Vector &point);
+  virtual Vector translateOutNormal(const Vector &point);
+  virtual std::string toString();
   virtual bool isInside(const Vector& point);
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
 private:
-  Shape::impl_ptr arg;
   double size;
 };
 
-class Translate_impl :  public Shape_impl
+class Translate_impl :  public ShapeOpsBase_impl
 {
 public:
   Translate_impl(const Shape::impl_ptr&, const Vector&);
   virtual ~Translate_impl();
+protected:
+  virtual Vector translateIn(const Vector &point);
+  virtual Vector translateOutPos(const Vector &point);
+  virtual Vector translateOutNormal(const Vector &point);
+  virtual std::string toString();
   virtual bool isInside(const Vector& point);
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
 private:
-  Shape::impl_ptr arg;
   Vector offset;
 };
 
-class Stretch_impl : public Shape_impl
+class Stretch_impl : public ShapeOpsBase_impl
 {
 public:
   Stretch_impl(const Shape::impl_ptr&, const Vector&);
   virtual ~Stretch_impl();
+protected:
+  virtual Vector translateIn(const Vector &point);
+  virtual Vector translateOutPos(const Vector &point);
+  virtual Vector translateOutNormal(const Vector &point);
+  virtual std::string toString();
   virtual bool isInside(const Vector& point);
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
 private:
-  Shape::impl_ptr arg;
   Vector factors;
   Vector reciFactors;
 };
 
-class Transform_impl : public Shape_impl
+class Transform_impl : public ShapeOpsBase_impl
 {
 public:
   Transform_impl(const Shape::impl_ptr&, const Matrix&);
   virtual ~Transform_impl();
+protected:
+  virtual Vector translateIn(const Vector &point);
+  virtual Vector translateOutPos(const Vector &point);
+  virtual Vector translateOutNormal(const Vector &point);
+  virtual std::string toString();
   virtual bool isInside(const Vector& point);
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
 private:
-  Shape::impl_ptr arg;
   Matrix transformation;
   Matrix transformationInv;
Index: src/Shapes/Shape_impl.hpp
===================================================================
--- src/Shapes/Shape_impl.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/Shapes/Shape_impl.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -9,5 +9,12 @@
 #define SHAPE_IMPL_HPP_
 
+#include <vector>
+
 #include "Shapes/Shape.hpp"
+#include "LinearAlgebra/Line.hpp"
+#include "LinearAlgebra/LineSegment.hpp"
+#include "LinearAlgebra/LineSegmentSet.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
 
 class Shape_impl {
@@ -16,4 +23,9 @@
   virtual ~Shape_impl(){};
   virtual bool isInside(const Vector &point)=0;
+  virtual bool isOnSurface(const Vector &point)=0;
+  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException)=0;
+  virtual LineSegmentSet getLineIntersections(const Line&)=0;
+  virtual std::string toString()=0;
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const=0;
 };
 
@@ -23,4 +35,22 @@
     return true;
   }
+  virtual bool isOnSurface(const Vector &point){
+    return false;
+  }
+  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException){
+    throw NotOnSurfaceException(__FILE__,__LINE__);
+  }
+  virtual LineSegmentSet getLineIntersections(const Line &line){
+    LineSegmentSet res(line);
+    res.insert(LineSegment(line.negEndpoint(),line.posEndpoint()));
+    return res;
+  }
+  virtual std::string toString(){
+    return "Everywhere()";
+  }
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const {
+    std::vector<Vector> PointsOnSurface;
+    return PointsOnSurface;
+  }
 };
 
@@ -28,4 +58,20 @@
   virtual bool isInside(const Vector &point){
     return false;
+  }
+  virtual bool isOnSurface(const Vector &point){
+    return false;
+  }
+  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException){
+    throw NotOnSurfaceException(__FILE__,__LINE__);
+  }
+  virtual LineSegmentSet getLineIntersections(const Line &line){
+    return LineSegmentSet(line);
+  }
+  virtual std::string toString(){
+    return "Nowhere()";
+  }
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const {
+    std::vector<Vector> PointsOnSurface;
+    return PointsOnSurface;
   }
 };
@@ -36,4 +82,9 @@
   virtual ~AndShape_impl();
   virtual bool isInside(const Vector &point);
+  virtual bool isOnSurface(const Vector &point);
+  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
+  virtual std::string toString();
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
 private:
   Shape::impl_ptr lhs;
@@ -46,4 +97,9 @@
   virtual ~OrShape_impl();
   virtual bool isInside(const Vector &point);
+  virtual bool isOnSurface(const Vector &point);
+  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
+  virtual std::string toString();
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
 private:
   Shape::impl_ptr lhs;
@@ -56,4 +112,9 @@
   virtual ~NotShape_impl();
   virtual bool isInside(const Vector &point);
+  virtual bool isOnSurface(const Vector &point);
+  virtual Vector getNormal(const Vector &point) throw(NotOnSurfaceException);
+  virtual LineSegmentSet getLineIntersections(const Line&);
+  virtual std::string toString();
+  virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
 private:
   Shape::impl_ptr arg;
Index: c/Space.cpp
===================================================================
--- src/Space.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,30 +1,0 @@
-/*
- * Space.cpp
- *
- *  Created on: Apr 30, 2010
- *      Author: crueger
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "Space.hpp"
-#include "vector.hpp"
-
-Space::Space()
-{}
-
-Space::~Space()
-{}
-
-bool Space::hasZero() const{
-  return isContained(zeroVec);
-}
-
-Vector Space::getVectorToPoint(const Vector &origin) const{
-  Vector support = getClosestPoint(origin);
-  return support-origin;
-}
-
-bool Space::isContained(const Vector &point) const{
-  return (distance(point)) < MYEPSILON;
-}
Index: c/Space.hpp
===================================================================
--- src/Space.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Space.hpp
- *
- *  Created on: Apr 30, 2010
- *      Author: crueger
- */
-
-#ifndef SPACE_HPP_
-#define SPACE_HPP_
-
-class Vector;
-
-class Space
-{
-public:
-  Space();
-  virtual ~Space();
-
-  /**
-   * Calculates the distance between a Space and a Vector.
-   */
-  virtual double distance(const Vector &point) const=0;
-
-  /**
-   * get the closest point inside the space to another point
-   */
-  virtual Vector getClosestPoint(const Vector &point) const=0;
-
-  /**
-   * get the shortest Vector from a point to a Space.
-   *
-   * The Vector always points from the given Vector to the point in space
-   * returned by Plane::getClosestPoint().
-   */
-  virtual Vector getVectorToPoint(const Vector &point) const;
-
-  /**
-   * Test wether a point is contained in the space.
-   *
-   * returns true, when the point lies inside and false
-   * otherwise.
-   */
-  virtual bool isContained(const Vector &point) const;
-
-  /**
-   * Tests if this space contains the center of the coordinate system.
-   */
-  virtual bool hasZero() const;
-
-};
-
-#endif /* SPACE_HPP_ */
Index: src/TesselPoint.cpp
===================================================================
--- src/TesselPoint.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/TesselPoint.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,50 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * TesselPoint.cpp
+ *
+ *  Created on: Jul 30, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "TesselPoint.hpp"
+
+#include <iostream>
+
+
+/** Constructor of class TesselPoint.
+ */
+TesselPoint::TesselPoint()
+{};
+
+/** Destructor for class TesselPoint.
+ */
+TesselPoint::~TesselPoint()
+{};
+
+std::ostream & TesselPoint::operator << (std::ostream &ost) const
+{
+  ParticleInfo::operator<<(ost);
+  ost << "," << getPosition();
+  return ost;
+}
+
+std::ostream & operator << (std::ostream &ost, const TesselPoint &a)
+{
+  a.ParticleInfo::operator<<(ost);
+  ost << "," << a.getPosition();
+  return ost;
+}
+
Index: src/TesselPoint.hpp
===================================================================
--- src/TesselPoint.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/TesselPoint.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,27 @@
+/*
+ * TesselPoint.hpp
+ *
+ *  Created on: Jul 30, 2010
+ *      Author: heber
+ */
+
+#ifndef TESSELPOINT_HPP_
+#define TESSELPOINT_HPP_
+
+#include "atom_atominfo.hpp"
+#include "atom_particleinfo.hpp"
+
+class TesselPoint;
+
+class TesselPoint : public virtual ParticleInfo, public virtual AtomInfo
+{
+public:
+  TesselPoint();
+  ~TesselPoint();
+
+  std::ostream & operator << (std::ostream &ost) const;
+};
+
+std::ostream & operator << (std::ostream &ost, const TesselPoint &t);
+
+#endif /* TESSELPOINT_HPP_ */
Index: src/ThermoStatContainer.cpp
===================================================================
--- src/ThermoStatContainer.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/ThermoStatContainer.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ThermoStatContainer.cpp
@@ -6,35 +13,85 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
 #include <cstring>
 
 #include "ConfigFileBuffer.hpp"
 #include "config.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "ThermoStatContainer.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
+
+#include <Thermostats/Berendsen.hpp>
+#include <Thermostats/GaussianThermostat.hpp>
+#include <Thermostats/Langevin.hpp>
+#include <Thermostats/NoseHoover.hpp>
+#include <Thermostats/NoThermostat.hpp>
+#include <Thermostats/Woodcock.hpp>
 
 /** Constructor for class ThermoStatContainer.
  *
  */
-ThermoStatContainer::ThermoStatContainer() : Thermostat(4), ThermostatImplemented(NULL),
-ThermostatNames(NULL), TempFrequency(2.5), alpha(0.), HooverMass(0.), TargetTemp(0.00095004455), ScaleTempStep(25)
+ThermoStatContainer::ThermoStatContainer() :
+  activeThermostat(0),
+  TargetTemp(0.00095004455)
 {
-  ThermostatImplemented = new int[MaxThermostats];
-  ThermostatNames = new char *[MaxThermostats];
-  for (int j=0;j<MaxThermostats;j++)
-    ThermostatNames[j] = new char[12];
+  ThermostatTraits<Thermostat> *BerendsenTrait = new ThermostatTraits<Berendsen>();
+  availThermostats[BerendsenTrait->getName()] = BerendsenTrait;
+  ThermostatTraits<Thermostat> *GaussianTrait = new ThermostatTraits<GaussianThermostat>();
+  availThermostats[GaussianTrait->getName()] = GaussianTrait;
+  ThermostatTraits<Thermostat> *LangevinTrait = new ThermostatTraits<Langevin>();
+  availThermostats[LangevinTrait->getName()] = LangevinTrait;
+  ThermostatTraits<Thermostat> *NoseHooverTrait = new ThermostatTraits<NoseHoover>();
+  availThermostats[NoseHooverTrait->getName()] = NoseHooverTrait;
+  ThermostatTraits<Thermostat> *NoThermostatTrait = new ThermostatTraits<NoThermostat>();
+  availThermostats[NoThermostatTrait->getName()] = NoThermostatTrait;
+  ThermostatTraits<Thermostat> *WoodcockTrait = new ThermostatTraits<Woodcock>();
+  availThermostats[WoodcockTrait->getName()] = WoodcockTrait;
+  for(traitsMap::iterator iter = availThermostats.begin();iter!=availThermostats.end();++iter){
+    cout << iter->first << endl;
+  }
+  ASSERT(availThermostats.size()==6,"Not all implemented thermostats referenced!\nDid you check the names in the traits?");
+  activeThermostat=new Berendsen();
+}
 
-  strcpy(ThermostatNames[0],"None");
-  ThermostatImplemented[0] = 1;
-  strcpy(ThermostatNames[1],"Woodcock");
-  ThermostatImplemented[1] = 1;
-  strcpy(ThermostatNames[2],"Gaussian");
-  ThermostatImplemented[2] = 1;
-  strcpy(ThermostatNames[3],"Langevin");
-  ThermostatImplemented[3] = 1;
-  strcpy(ThermostatNames[4],"Berendsen");
-  ThermostatImplemented[4] = 1;
-  strcpy(ThermostatNames[5],"NoseHoover");
-  ThermostatImplemented[5] = 1;
+ThermostatTraits<Thermostat> *ThermoStatContainer::getTraitByName(const std::string name){
+  if(!availThermostats.count(name))
+    return 0;
+  return availThermostats[name];
+}
+
+Thermostat *ThermoStatContainer::makeByName(const std::string name,class ConfigFileBuffer * const fb){
+  ThermostatTraits<Thermostat>* trait = getTraitByName(name);
+  if(trait){
+    Thermostat *res = trait->make(fb);
+    res->addToContainer(this);
+    return res;
+  }
+  else{
+    return 0;
+  }
+}
+
+void ThermoStatContainer::makeActive(const std::string name,class ConfigFileBuffer * const fb){
+  Thermostat* newThermostat = makeByName(name,fb);
+  if(newThermostat){
+    if(activeThermostat){
+      delete activeThermostat;
+    }
+    activeThermostat = newThermostat;
+  }
+}
+
+void ThermoStatContainer::chooseNone(){
+  if(activeThermostat){
+    delete activeThermostat;
+  }
+  activeThermostat = new NoThermostat();
 }
 
@@ -44,8 +101,10 @@
 ThermoStatContainer::~ThermoStatContainer()
 {
-  delete[](ThermostatImplemented);
-  for (int j=0;j<MaxThermostats;j++)
-    delete[](ThermostatNames[j]);
-  delete[](ThermostatNames);
+  if(activeThermostat){
+    delete activeThermostat;
+  }
+  for(traitsMap::iterator iter= availThermostats.begin();iter!=availThermostats.end();++iter){
+    delete (iter->second);
+  }
 }
 
Index: src/ThermoStatContainer.hpp
===================================================================
--- src/ThermoStatContainer.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/ThermoStatContainer.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -14,8 +14,7 @@
 #endif
 
+#include "Thermostats/Thermostat.hpp"
+
 class ConfigFileBuffer;
-
-#define MaxThermostats 6      //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented
-enum thermostats { None, Woodcock, Gaussian, Langevin, Berendsen, NoseHoover };   //!< Thermostat names for output
 
 class ThermoStatContainer {
@@ -23,15 +22,13 @@
   ThermoStatContainer();
   ~ThermoStatContainer();
+  ThermostatTraits<Thermostat> *getTraitByName(const std::string name);
+  Thermostat *makeByName(const std::string name,class ConfigFileBuffer * const fb);
+  void makeActive(const std::string name,class ConfigFileBuffer * const fb);
+  void chooseNone();
 
-  void ParseThermostats(class ConfigFileBuffer * const fb);
-
-  int Thermostat;
-  int *ThermostatImplemented;
-  char **ThermostatNames;
-  double TempFrequency;
-  double alpha;
-  double HooverMass;
+  Thermostat* activeThermostat;
+  typedef std::map<std::string,ThermostatTraits<Thermostat>* > traitsMap;
+  traitsMap availThermostats;
   double TargetTemp;
-  int ScaleTempStep;
 };
 
Index: src/Thermostats/Berendsen.cpp
===================================================================
--- src/Thermostats/Berendsen.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/Berendsen.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,75 @@
+/*
+ * Berendsen.cpp
+ *
+ *  Created on: Aug 20, 2010
+ *      Author: crueger
+ */
+
+#include "Berendsen.hpp"
+#include "element.hpp"
+#include "config.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "ThermoStatContainer.hpp"
+#include "World.hpp"
+
+Berendsen::Berendsen(double _TempFrequency) :
+  TempFrequency(_TempFrequency)
+{}
+
+Berendsen::Berendsen() :
+  TempFrequency(2.5)
+{}
+
+Berendsen::~Berendsen()
+{}
+
+const char *ThermostatTraits<Berendsen>::name = "Berendsen";
+
+std::string ThermostatTraits<Berendsen>::getName(){
+  return ThermostatTraits<Berendsen>::name;
+}
+
+Thermostat *ThermostatTraits<Berendsen>::make(class ConfigFileBuffer * const fb){
+  double TempFrequency;
+  const int verbose = 0;
+  ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read \tau_T
+  return new Berendsen(TempFrequency);
+}
+
+double Berendsen::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+double Berendsen::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+double Berendsen::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+template <class ForwardIterator>
+double Berendsen::doScaleAtoms(unsigned int step,double ActualTemp,ForwardIterator begin, ForwardIterator end){
+  DoLog(2) && (Log() << Verbose(2) <<  "Applying Berendsen-VanGunsteren thermostat..." << endl);
+  double ekin=0;
+  double ScaleTempFactor = getContainer().TargetTemp/ActualTemp;
+  for(ForwardIterator iter=begin;iter!=end;++iter){
+    Vector &U = (*iter)->Trajectory.U.at(step);
+    if ((*iter)->FixedIon == 0) { // even FixedIon moves, only not by other's forces
+      U *= sqrt(1+(World::getInstance().getConfig()->Deltat/TempFrequency)*(ScaleTempFactor-1));
+      ekin += 0.5*(*iter)->getType()->getMass() * U.NormSquared();
+    }
+  }
+  return ekin;
+}
+
+std::string Berendsen::name(){
+  return ThermostatTraits<Berendsen>::name;
+}
+
+std::string Berendsen::writeParams(){
+  stringstream sstr;
+  sstr << TempFrequency;
+  return sstr.str();
+}
Index: src/Thermostats/Berendsen.hpp
===================================================================
--- src/Thermostats/Berendsen.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/Berendsen.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,43 @@
+/*
+ * Berendsen.hpp
+ *
+ *  Created on: Aug 20, 2010
+ *      Author: crueger
+ */
+
+#ifndef BERENDSEN_HPP_
+#define BERENDSEN_HPP_
+
+#include "Thermostats/Thermostat.hpp"
+
+class Berendsen : public Thermostat
+{
+public:
+  Berendsen(double);
+  Berendsen();
+  virtual ~Berendsen();
+
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms);
+
+  virtual std::string name();
+
+  virtual std::string writeParams();
+
+private:
+  template <class ForwardIterator>
+  double doScaleAtoms(unsigned int step,double ActualTemp,ForwardIterator begin, ForwardIterator end);
+
+  double TempFrequency;
+};
+
+template <>
+struct ThermostatTraits<class Berendsen> : public ThermostatTraits<Thermostat>
+{
+  virtual Thermostat *make(class ConfigFileBuffer * const fb);
+  virtual std::string getName();
+  static const char* name;
+};
+
+#endif /* BERENDSEN_HPP_ */
Index: src/Thermostats/GaussianThermostat.cpp
===================================================================
--- src/Thermostats/GaussianThermostat.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/GaussianThermostat.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,104 @@
+/*
+ * GaussianThermostat.cpp
+ *
+ *  Created on: Aug 18, 2010
+ *      Author: crueger
+ */
+
+#include "GaussianThermostat.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "AtomSet.hpp"
+#include "element.hpp"
+#include "config.hpp"
+#include "World.hpp"
+
+#include <set>
+
+GaussianThermostat::GaussianThermostat(int _ScaleTempStep) :
+  E(0),G(0),
+  ScaleTempStep(_ScaleTempStep)
+{}
+
+GaussianThermostat::GaussianThermostat() :
+  E(0),G(0),
+  ScaleTempStep(25)
+{}
+
+GaussianThermostat::~GaussianThermostat()
+{}
+
+const char *ThermostatTraits<GaussianThermostat>::name = "Gaussian";
+
+std::string ThermostatTraits<GaussianThermostat>::getName(){
+  return ThermostatTraits<GaussianThermostat>::name;
+}
+
+Thermostat *ThermostatTraits<GaussianThermostat>::make(class ConfigFileBuffer * const fb){
+  int ScaleTempStep;
+  const int verbose = 0;
+  ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read collision rate
+  return new class GaussianThermostat(ScaleTempStep);
+}
+
+double GaussianThermostat::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+double GaussianThermostat::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+double GaussianThermostat::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+template <class ForwardIterator>
+double GaussianThermostat::doScaleAtoms(unsigned int step,double ActualTemp,ForwardIterator begin, ForwardIterator end){
+  DoLog(2) && (Log() << Verbose(2) <<  "Applying Gaussian thermostat..." << endl);
+  init(step,begin,end);
+  double G_over_E = G/E;
+  DoLog(1) && (Log() << Verbose(1) << "Gaussian Least Constraint constant is " << G_over_E << "." << endl);
+  double ekin =0;
+  for(ForwardIterator iter=begin;iter!=end;++iter){
+    Vector &U = (*iter)->Trajectory.U.at(step);
+    if ((*iter)->FixedIon == 0) {// even FixedIon moves, only not by other's forces
+      U += World::getInstance().getConfig()->Deltat * G_over_E * U;
+      ekin += (*iter)->getType()->getMass() * U.NormSquared();
+    }
+  }
+  return ekin;
+}
+
+template <class ForwardIterator>
+void GaussianThermostat::init(unsigned int step,ForwardIterator begin, ForwardIterator end){
+  E=0;
+  G=0;
+  for(ForwardIterator iter=begin;iter!=end;++iter){
+    Vector &U = (*iter)->Trajectory.U.at(step);
+    Vector &F = (*iter)->Trajectory.F.at(step);
+    if ((*iter)->FixedIon == 0){ // even FixedIon moves, only not by other's forces
+      G += U.ScalarProduct(F);
+      E += U.NormSquared()*(*iter)->getType()->getMass();
+    }
+  }
+}
+
+double GaussianThermostat::getE() const{
+  return E;
+}
+
+double GaussianThermostat::getG() const{
+  return G;
+}
+
+std::string GaussianThermostat::name(){
+  return ThermostatTraits<GaussianThermostat>::name;
+}
+
+std::string GaussianThermostat::writeParams(){
+  std::stringstream sstr;
+  sstr << ScaleTempStep;
+  return sstr.str();
+}
Index: src/Thermostats/GaussianThermostat.hpp
===================================================================
--- src/Thermostats/GaussianThermostat.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/GaussianThermostat.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,48 @@
+/*
+ * GaussianThermostat.hpp
+ *
+ *  Created on: Aug 18, 2010
+ *      Author: crueger
+ */
+
+#ifndef GAUSSIANTHERMOSTAT_HPP_
+#define GAUSSIANTHERMOSTAT_HPP_
+
+#include "Thermostats/Thermostat.hpp"
+
+class config;
+
+class GaussianThermostat : public Thermostat
+{
+public:
+  GaussianThermostat(int ScaleTempStep);
+  GaussianThermostat();
+  virtual ~GaussianThermostat();
+
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms);
+
+  double getE() const;
+  double getG() const;
+
+  virtual std::string name();
+  virtual std::string writeParams();
+private:
+  template <class ForwardIterator>
+  void init(unsigned int step,ForwardIterator begin, ForwardIterator end);
+  template <class ForwardIterator>
+  double doScaleAtoms(unsigned int step,double ActualTemp,ForwardIterator begin, ForwardIterator end);
+  double E,G;
+  int ScaleTempStep;
+};
+
+template <>
+struct ThermostatTraits<GaussianThermostat> : public ThermostatTraits<Thermostat>
+{
+  virtual Thermostat *make(class ConfigFileBuffer * const fb);
+  virtual std::string getName();
+  static const char* name;
+};
+
+#endif /* GAUSSIANTHERMOSTAT_HPP_ */
Index: src/Thermostats/Langevin.cpp
===================================================================
--- src/Thermostats/Langevin.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/Langevin.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,96 @@
+/*
+ * Langevin.cpp
+ *
+ *  Created on: Aug 20, 2010
+ *      Author: crueger
+ */
+
+#include "Langevin.hpp"
+#include "element.hpp"
+#include "config.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "ThermoStatContainer.hpp"
+
+Langevin::Langevin(double _TempFrequency,double _alpha) :
+  TempFrequency(_TempFrequency),
+  alpha(_alpha)
+{
+  gsl_rng_env_setup();
+  T = gsl_rng_default;
+  r = gsl_rng_alloc (T);
+}
+
+Langevin::Langevin() :
+  TempFrequency(2.5),
+  alpha(0.)
+{}
+
+Langevin::~Langevin()
+{
+  gsl_rng_free (r);
+}
+
+const char *ThermostatTraits<Langevin>::name = "Langevin";
+
+std::string ThermostatTraits<Langevin>::getName(){
+  return ThermostatTraits<Langevin>::name;
+}
+
+Thermostat *ThermostatTraits<Langevin>::make(class ConfigFileBuffer * const fb){
+  double TempFrequency;
+  double alpha;
+  const int verbose = 0;
+  ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read gamma
+  if (ParseForParameter(verbose,fb,"Thermostat", 0, 3, 1, double_type, &alpha, 1, optional)) {
+    DoLog(2) && (Log() << Verbose(2) << "Extended Stochastic Thermostat detected with interpolation coefficient " << alpha << "." << endl);
+  } else {
+    alpha = 1.;
+  }
+  return new Langevin(TempFrequency,alpha);
+}
+
+double Langevin::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+double Langevin::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+double Langevin::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+template <class ForwardIterator>
+double Langevin::doScaleAtoms(unsigned int step,double ActualTemp,ForwardIterator begin, ForwardIterator end){
+  DoLog(2) && (Log() << Verbose(2) <<  "Applying Langevin thermostat..." << endl);
+  double ekin=0;
+  for(ForwardIterator iter=begin;iter!=end;++iter){
+    double sigma  = sqrt(getContainer().TargetTemp/(*iter)->getType()->getMass()); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
+    Vector &U = (*iter)->Trajectory.U.at(step);
+    if ((*iter)->FixedIon == 0) { // even FixedIon moves, only not by other's forces
+      // throw a dice to determine whether it gets hit by a heat bath particle
+      if (((((rand()/(double)RAND_MAX))*TempFrequency) < 1.)) {
+        DoLog(3) && (Log() << Verbose(3) << "Particle " << (**iter) << " was hit (sigma " << sigma << "): " << U.Norm() << " -> ");
+        // pick three random numbers from a Boltzmann distribution around the desired temperature T for each momenta axis
+        for (int d=0; d<NDIM; d++) {
+          U[d] = gsl_ran_gaussian (r, sigma);
+        }
+        DoLog(2) && (Log() << Verbose(2) << U.Norm() << endl);
+      }
+      ekin += 0.5*(*iter)->getType()->getMass() * U.NormSquared();
+    }
+  }
+  return ekin;
+}
+
+std::string Langevin::name(){
+  return ThermostatTraits<Langevin>::name;
+}
+
+std::string Langevin::writeParams(){
+  stringstream sstr;
+  sstr << TempFrequency << "\t" << alpha;
+  return sstr.str();
+}
Index: src/Thermostats/Langevin.hpp
===================================================================
--- src/Thermostats/Langevin.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/Langevin.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,46 @@
+/*
+ * Langevin.hpp
+ *
+ *  Created on: Aug 20, 2010
+ *      Author: crueger
+ */
+
+#ifndef LANGEVIN_HPP_
+#define LANGEVIN_HPP_
+
+#include "Thermostats/Thermostat.hpp"
+
+class Langevin : public Thermostat
+{
+public:
+  Langevin(double,double);
+  Langevin();
+  virtual ~Langevin();
+
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms);
+
+  virtual std::string name();
+  virtual std::string writeParams();
+
+private:
+  template <class ForwardIterator>
+  double doScaleAtoms(unsigned int step,double ActualTemp,ForwardIterator begin, ForwardIterator end);
+
+
+  double TempFrequency;
+  double alpha;
+  gsl_rng * r;
+  const gsl_rng_type * T;
+};
+
+template <>
+struct ThermostatTraits<class Langevin> : public ThermostatTraits<Thermostat>
+{
+  virtual Thermostat *make(class ConfigFileBuffer * const fb);
+  virtual std::string getName();
+  static const char* name;
+};
+
+#endif /* LANGEVIN_HPP_ */
Index: src/Thermostats/NoThermostat.cpp
===================================================================
--- src/Thermostats/NoThermostat.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/NoThermostat.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,44 @@
+/*
+ * NoThermostat.cpp
+ *
+ *  Created on: Aug 20, 2010
+ *      Author: crueger
+ */
+
+#include "NoThermostat.hpp"
+
+NoThermostat::NoThermostat()
+{}
+
+NoThermostat::~NoThermostat()
+{}
+
+const char *ThermostatTraits<NoThermostat>::name = "None";
+
+std::string ThermostatTraits<NoThermostat>::getName(){
+  return ThermostatTraits<NoThermostat>::name;
+}
+
+Thermostat *ThermostatTraits<NoThermostat>::make(class ConfigFileBuffer * const fb){
+  return new NoThermostat();
+}
+
+double NoThermostat::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms){
+  return 0;
+}
+
+double NoThermostat::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms){
+  return 0;
+}
+
+double NoThermostat::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms){
+  return 0;
+}
+
+std::string NoThermostat::name(){
+  return ThermostatTraits<NoThermostat>::name;
+}
+
+std::string NoThermostat::writeParams(){
+  return "";
+}
Index: src/Thermostats/NoThermostat.hpp
===================================================================
--- src/Thermostats/NoThermostat.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/NoThermostat.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,35 @@
+/*
+ * NoThermostat.hpp
+ *
+ *  Created on: Aug 20, 2010
+ *      Author: crueger
+ */
+
+#ifndef NOTHERMOSTAT_HPP_
+#define NOTHERMOSTAT_HPP_
+
+#include "Thermostats/Thermostat.hpp"
+
+class NoThermostat : public Thermostat
+{
+public:
+  NoThermostat();
+  virtual ~NoThermostat();
+
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms);
+
+  virtual std::string name();
+  virtual std::string writeParams();
+};
+
+template <>
+struct ThermostatTraits<class NoThermostat>: public ThermostatTraits<Thermostat>
+{
+  virtual Thermostat *make(class ConfigFileBuffer * const fb);
+  virtual std::string getName();
+  static const char* name;
+};
+
+#endif /* NOTHERMOSTAT_HPP_ */
Index: src/Thermostats/NoseHoover.cpp
===================================================================
--- src/Thermostats/NoseHoover.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/NoseHoover.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,93 @@
+/*
+ * NoseHoover.cpp
+ *
+ *  Created on: Aug 20, 2010
+ *      Author: crueger
+ */
+
+#include "NoseHoover.hpp"
+
+#include "element.hpp"
+#include "config.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "ThermoStatContainer.hpp"
+#include "World.hpp"
+
+NoseHoover::NoseHoover(double _HooverMass) :
+  HooverMass(_HooverMass),
+  alpha(0)
+{}
+
+NoseHoover::NoseHoover() :
+  HooverMass(0.)
+{}
+
+NoseHoover::~NoseHoover()
+{}
+
+const char *ThermostatTraits<NoseHoover>::name = "NoseHoover";
+
+std::string ThermostatTraits<NoseHoover>::getName(){
+  return ThermostatTraits<NoseHoover>::name;
+}
+
+Thermostat *ThermostatTraits<NoseHoover>::make(class ConfigFileBuffer * const fb){
+  double HooverMass;
+  const int verbose = 0;
+  ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &HooverMass, 1, critical); // read Hoovermass
+  return new NoseHoover(HooverMass);
+}
+
+double NoseHoover::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+double NoseHoover::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+double NoseHoover::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+template <class ForwardIterator>
+double NoseHoover::doScaleAtoms(unsigned int step,double ActualTemp,ForwardIterator begin, ForwardIterator end){
+  DoLog(2) && (Log() << Verbose(2) <<  "Applying Nose-Hoover thermostat..." << endl);
+  init(step,begin,end);
+  delta_alpha = (delta_alpha - (3.*count+1.) * getContainer().TargetTemp)/(HooverMass*Units2Electronmass);
+  alpha += delta_alpha*World::getInstance().getConfig()->Deltat;
+  DoLog(3) && (Log() << Verbose(3) << "alpha = " << delta_alpha << " * " << World::getInstance().getConfig()->Deltat << " = " << alpha << "." << endl);
+  double ekin =0;
+  for(ForwardIterator iter=begin;iter!=end;++iter){
+    Vector &U = (*iter)->Trajectory.U.at(step);
+    if ((*iter)->FixedIon == 0) { // even FixedIon moves, only not by other's forces
+      U += World::getInstance().getConfig()->Deltat/(*iter)->getType()->getMass() * (alpha * (U * (*iter)->getType()->getMass()));
+      ekin += (0.5*(*iter)->getType()->getMass()) * U.NormSquared();
+    }
+  }
+  return ekin;
+}
+
+template <class ForwardIterator>
+void NoseHoover::init(unsigned int step,ForwardIterator begin, ForwardIterator end){
+  delta_alpha=0;
+  count=0;
+  for(ForwardIterator iter = begin;iter!=end;++iter){
+    Vector &U = (*iter)->Trajectory.U.at(step);
+    if ((*iter)->FixedIon == 0) { // even FixedIon moves, only not by other's forces
+      delta_alpha += U.NormSquared()*(*iter)->getType()->getMass();
+    }
+    ++count;
+  }
+}
+
+std::string NoseHoover::name(){
+  return ThermostatTraits<NoseHoover>::name;
+}
+
+std::string NoseHoover::writeParams(){
+  std::stringstream sstr;
+  sstr << HooverMass;
+  return sstr.str();
+}
Index: src/Thermostats/NoseHoover.hpp
===================================================================
--- src/Thermostats/NoseHoover.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/NoseHoover.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,48 @@
+/*
+ * NoseHoover.hpp
+ *
+ *  Created on: Aug 20, 2010
+ *      Author: crueger
+ */
+
+#ifndef NOSEHOOVER_HPP_
+#define NOSEHOOVER_HPP_
+
+#include "Thermostats/Thermostat.hpp"
+
+class NoseHoover : public Thermostat
+{
+public:
+  NoseHoover(double _HooverMass);
+  NoseHoover();
+  virtual ~NoseHoover();
+
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms);
+
+  virtual std::string name();
+  virtual std::string writeParams();
+
+private:
+  template <class ForwardIterator>
+  void init(unsigned int step,ForwardIterator begin, ForwardIterator end);
+  template <class ForwardIterator>
+  double doScaleAtoms(unsigned int step,double ActualTemp,ForwardIterator begin, ForwardIterator end);
+
+  double HooverMass;
+  double delta_alpha;
+  double alpha;
+  int count;
+};
+
+template <>
+struct ThermostatTraits<class NoseHoover> : public ThermostatTraits<Thermostat>
+{
+  virtual Thermostat *make(class ConfigFileBuffer * const fb);
+  virtual std::string getName();
+  static const char* name;
+};
+
+
+#endif /* NOSEHOOVER_HPP_ */
Index: src/Thermostats/Thermostat.cpp
===================================================================
--- src/Thermostats/Thermostat.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/Thermostat.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,32 @@
+/*
+ * Thermostat.cpp
+ *
+ *  Created on: Aug 18, 2010
+ *      Author: crueger
+ */
+
+#include "Thermostat.hpp"
+
+#include "Helpers/Assert.hpp"
+
+Thermostat::Thermostat() :
+  container(0)
+{}
+
+Thermostat::~Thermostat()
+{}
+
+const char *ThermostatTraits<Thermostat>::name = "Base";
+
+std::string ThermostatTraits<Thermostat>::getName(){
+  return ThermostatTraits<Thermostat>::name;
+}
+
+void Thermostat::addToContainer(ThermoStatContainer *_container){
+  container = _container;
+}
+
+ThermoStatContainer &Thermostat::getContainer(){
+  ASSERT(container,"No container used for this Thermostat");
+  return *container;
+}
Index: src/Thermostats/Thermostat.hpp
===================================================================
--- src/Thermostats/Thermostat.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/Thermostat.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,52 @@
+/*
+ * Thermostat.hpp
+ *
+ *  Created on: Aug 18, 2010
+ *      Author: crueger
+ */
+
+#ifndef THERMOSTAT_HPP_
+#define THERMOSTAT_HPP_
+
+class config;
+
+#include <string>
+#include <set>
+#include <vector>
+#include <list>
+#include "AtomSet.hpp"
+
+class ThermoStatContainer;
+
+class Thermostat
+{
+public:
+  Thermostat();
+  virtual ~Thermostat();
+
+  // cannot template this, because we need virtual functions
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms)=0;
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms)=0;
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms)=0;
+
+  virtual std::string name()=0;
+
+  virtual std::string writeParams()=0;
+  void addToContainer(ThermoStatContainer *);
+protected:
+  ThermoStatContainer &getContainer();
+private:
+  ThermoStatContainer* container;
+};
+
+template <class Thermostat>
+struct ThermostatTraits;
+
+template <>
+struct ThermostatTraits<Thermostat>{
+  virtual Thermostat *make(class ConfigFileBuffer * const fb)=0;
+  virtual std::string getName();
+  static const char* name;
+};
+
+#endif /* THERMOSTAT_HPP_ */
Index: src/Thermostats/Woodcock.cpp
===================================================================
--- src/Thermostats/Woodcock.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/Woodcock.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,80 @@
+/*
+ * Woodcock.cpp
+ *
+ *  Created on: Aug 20, 2010
+ *      Author: crueger
+ */
+
+#include "Woodcock.hpp"
+
+#include "element.hpp"
+#include "config.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "ThermoStatContainer.hpp"
+
+#include <sstream>
+
+Woodcock::Woodcock(int _ScaleTempStep) :
+  ScaleTempStep(_ScaleTempStep)
+{}
+
+Woodcock::Woodcock() :
+  ScaleTempStep(25)
+{}
+
+Woodcock::~Woodcock()
+{}
+
+const char *ThermostatTraits<Woodcock>::name = "Woodcock";
+
+std::string ThermostatTraits<Woodcock>::getName(){
+  return ThermostatTraits<Woodcock>::name;
+}
+
+Thermostat *ThermostatTraits<Woodcock>::make(class ConfigFileBuffer * const fb){
+  int ScaleTempStep;
+  const int verbose = 0;
+  ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read scaling frequency
+  return new Woodcock(ScaleTempStep);
+}
+
+double Woodcock::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+double Woodcock::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+double Woodcock::scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms){
+  return doScaleAtoms(step,ActualTemp,atoms.begin(),atoms.end());
+}
+
+template <class ForwardIterator>
+double Woodcock::doScaleAtoms(unsigned int step,double ActualTemp,ForwardIterator begin,ForwardIterator end){
+  double ekin=0;
+  if ((ScaleTempStep > 0) && ((step-1) % ScaleTempStep == 0)) {
+    double ScaleTempFactor = sqrt(getContainer().TargetTemp/ActualTemp);
+    DoLog(2) && (Log() << Verbose(2) <<  "Applying Woodcock thermostat..." << endl);
+    double ekin;
+    for (ForwardIterator iter = begin; iter!=end;++iter){
+      Vector &U = (*iter)->Trajectory.U.at(step);
+      if ((*iter)->FixedIon == 0){ // even FixedIon moves, only not by other's forces
+        U *= ScaleTempFactor;
+        ekin += 0.5*(*iter)->getType()->getMass() * U.NormSquared();
+      }
+    }
+  }
+  return ekin;
+}
+
+std::string Woodcock::name(){
+  return ThermostatTraits<Woodcock>::name;
+}
+
+std::string Woodcock::writeParams(){
+  std::stringstream sstr;
+  sstr << ScaleTempStep;
+  return sstr.str();
+}
Index: src/Thermostats/Woodcock.hpp
===================================================================
--- src/Thermostats/Woodcock.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/Thermostats/Woodcock.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,43 @@
+/*
+ * Woodcock.hpp
+ *
+ *  Created on: Aug 20, 2010
+ *      Author: crueger
+ */
+
+#ifndef WOODCOCK_HPP_
+#define WOODCOCK_HPP_
+
+#include "Thermostats/Thermostat.hpp"
+
+class Woodcock : public Thermostat
+{
+public:
+  Woodcock(int);
+  Woodcock();
+  virtual ~Woodcock();
+
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::list) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::vector) atoms);
+  virtual double scaleAtoms(unsigned int step,double ActualTemp,ATOMSET(std::set) atoms);
+
+  virtual std::string name();
+
+  virtual std::string writeParams();
+
+private:
+  template <class ForwardIterator>
+  double doScaleAtoms(unsigned int step,double ActualTemp,ForwardIterator begin,ForwardIterator end);
+
+  int ScaleTempStep;
+};
+
+template <>
+struct ThermostatTraits<class Woodcock> : public ThermostatTraits<Thermostat>
+{
+  virtual Thermostat *make(class ConfigFileBuffer * const fb);
+  virtual std::string getName();
+  static const char* name;
+};
+
+#endif /* WOODCOCK_HPP_ */
Index: src/UIElements/CommandLineUI/CommandLineDialog.cpp
===================================================================
--- src/UIElements/CommandLineUI/CommandLineDialog.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/CommandLineUI/CommandLineDialog.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * CommandLineDialog.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -23,8 +35,8 @@
 #include "CommandLineParser.hpp"
 #include "defs.hpp"
-#include "log.hpp"
-#include "Matrix.hpp"
+#include "Helpers/Log.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "periodentafel.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 #include "Box.hpp"
@@ -33,5 +45,5 @@
 #include "element.hpp"
 #include "molecule.hpp"
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 
 using namespace std;
Index: src/UIElements/CommandLineUI/CommandLineStatusIndicator.cpp
===================================================================
--- src/UIElements/CommandLineUI/CommandLineStatusIndicator.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/CommandLineUI/CommandLineStatusIndicator.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * CommandLineStatusIndicator.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/UIElements/CommandLineUI/CommandLineUIFactory.cpp
===================================================================
--- src/UIElements/CommandLineUI/CommandLineUIFactory.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/CommandLineUI/CommandLineUIFactory.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * CommandLineUIFactory.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/UIElements/CommandLineUI/CommandLineWindow.cpp
===================================================================
--- src/UIElements/CommandLineUI/CommandLineWindow.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/CommandLineUI/CommandLineWindow.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * CommandLineWindow.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/UIElements/CommandLineUI/CommandLineWindow.hpp
===================================================================
--- src/UIElements/CommandLineUI/CommandLineWindow.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/CommandLineUI/CommandLineWindow.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -25,5 +25,5 @@
   void populateAnalysisActions();
   void populateAtomActions();
-  void populateCmdActions();
+  void populateCommandActions();
   void populateFragmentationActions();
   void populateMoleculeActions();
Index: src/UIElements/Dialog.cpp
===================================================================
--- src/UIElements/Dialog.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Dialog.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * Dialog.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -11,11 +23,12 @@
 #include "Actions/ValueStorage.hpp"
 
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "atom.hpp"
+#include "Box.hpp"
 #include "element.hpp"
 #include "molecule.hpp"
-#include "vector.hpp"
-#include "Matrix.hpp"
-#include "Box.hpp"
+#include "LinearAlgebra/BoxVector.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 
 using namespace std;
@@ -72,4 +85,99 @@
 }
 
+template <> void Dialog::query<void *>(const char *token, std::string description)
+{
+  queryEmpty(token, description);
+}
+
+template <> void Dialog::query<bool>(const char *token, std::string description)
+{
+  queryBoolean(token, description);
+}
+
+template <> void Dialog::query<int>(const char *token, std::string description)
+{
+  queryInt(token, description);
+}
+
+template <> void Dialog::query< std::vector<int> >(const char *token, std::string description)
+{
+  queryInts(token, description);
+}
+
+template <> void Dialog::query<double>(const char *token, std::string description)
+{
+  queryDouble(token, description);
+}
+
+template <> void Dialog::query< std::vector<double> >(const char *token, std::string description)
+{
+  queryDoubles(token, description);
+}
+
+template <> void Dialog::query<std::string>(const char *token, std::string description)
+{
+  queryString(token, description);
+}
+
+template <> void Dialog::query< std::vector<std::string> >(const char *token, std::string description)
+{
+  queryStrings(token, description);
+}
+
+template <> void Dialog::query<atom *>(const char *token, std::string description)
+{
+  queryAtom(token, description);
+}
+
+template <> void Dialog::query< std::vector<atom *> >(const char *token, std::string description)
+{
+  queryAtoms(token, description);
+}
+
+template <> void Dialog::query<molecule *>(const char *token, std::string description)
+{
+  queryMolecule(token, description);
+}
+
+template <> void Dialog::query< std::vector<molecule *> >(const char *token, std::string description)
+{
+  queryMolecules(token, description);
+}
+
+template <> void Dialog::query<Vector>(const char *token, std::string description)
+{
+  queryVector(token, false, description);
+}
+
+template <> void Dialog::query< std::vector<Vector> >(const char *token, std::string description)
+{
+  queryVectors(token, false, description);
+}
+
+template <> void Dialog::query<BoxVector>(const char *token, std::string description)
+{
+  queryVector(token, true, description);
+}
+
+template <> void Dialog::query< std::vector<BoxVector> >(const char *token, std::string description)
+{
+  queryVectors(token, true, description);
+}
+
+template <> void Dialog::query<Box>(const char *token, std::string description)
+{
+  queryBox(token, description);
+}
+
+template <> void Dialog::query<const element *>(const char *token, std::string description)
+{
+  queryElement(token, description);
+}
+
+template <> void Dialog::query< std::vector<const element *> >(const char *token, std::string description)
+{
+  queryElements(token, description);
+}
+
 /****************** Query types Infrastructure **************************/
 
Index: src/UIElements/Dialog.hpp
===================================================================
--- src/UIElements/Dialog.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Dialog.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -14,5 +14,5 @@
 
 #include "Box.hpp"
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 
 class atom;
@@ -37,4 +37,6 @@
   Dialog();
   virtual ~Dialog();
+
+  template <class T> void query(const char *, std::string = "");
 
   virtual void queryEmpty(const char *, std::string = "")=0;
@@ -255,5 +257,5 @@
     virtual void setResult();
   protected:
-    element * tmp;
+    const element * tmp;
   };
 
@@ -265,6 +267,6 @@
     virtual void setResult();
   protected:
-    element *temp;
-    std::vector<element *> tmp;
+    const element *temp;
+    std::vector<const element *> tmp;
   };
 
Index: src/UIElements/MainWindow.cpp
===================================================================
--- src/UIElements/MainWindow.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/MainWindow.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * Window.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/UIElements/Makefile.am
===================================================================
--- src/UIElements/Makefile.am	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -5,8 +5,4 @@
 AM_LDFLAGS = $(CPPUNIT_LIBS) -ldl
 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
-
-noinst_LIBRARIES = libMolecuilderUI.a
-libMolecuilderUI_a_SOURCES = ${UISOURCE} ${UIHEADER}
-libMolecuilderUI_a_LIBADD = ../Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la
 
 VIEWSOURCE = \
@@ -79,3 +75,52 @@
   CommandLineUI/CommandLineWindow.hpp
 
+lib_LTLIBRARIES = libMolecuilderUI-@MOLECUILDER_API_VERSION@.la
+libMolecuilderUI_includedir = $(includedir)/molecuilder-$(MOLECUILDER_API_VERSION)/Actions/
+libMolecuilderUI_LIBS = \
+	Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la
 
+nobase_libMolecuilderUI_include_HEADERS = ${UIHEADER}
+
+## Define the source file list for the "libexample-@MOLECUILDER_API_VERSION@.la"
+## target.  Note that @MOLECUILDER_API_VERSION@ is not interpreted by Automake and
+## will therefore be treated as if it were literally part of the target name,
+## and the variable name derived from that.
+## The file extension .cc is recognized by Automake, and makes it produce
+## rules which invoke the C++ compiler to produce a libtool object file (.lo)
+## from each source file.  Note that it is not necessary to list header files
+## which are already listed elsewhere in a _HEADERS variable assignment.
+libMolecuilderUI_@MOLECUILDER_API_VERSION@_la_SOURCES = ${UISOURCE}
+
+## Instruct libtool to include ABI version information in the generated shared
+## library file (.so).  The library ABI version is defined in configure.ac, so
+## that all version information is kept in one place.
+libMolecuilderUI_@MOLECUILDER_API_VERSION@_la_LDFLAGS = -version-info $(MOLECUILDER_SO_VERSION)
+
+## The generated configuration header is installed in its own subdirectory of
+## $(libdir).  The reason for this is that the configuration information put
+## into this header file describes the target platform the installed library
+## has been built for.  Thus the file must not be installed into a location
+## intended for architecture-independent files, as defined by the Filesystem
+## Hierarchy Standard (FHS).
+## The nodist_ prefix instructs Automake to not generate rules for including
+## the listed files in the distribution on 'make dist'.  Files that are listed
+## in _HEADERS variables are normally included in the distribution, but the
+## configuration header file is generated at configure time and should not be
+## shipped with the source tarball.
+libMolecuilderUI_libincludedir = $(libdir)/molecuilder-$(MOLECUILDER_API_VERSION)/include
+nodist_libMolecuilderUI_libinclude_HEADERS = $(top_builddir)/libmolecuilder_config.h
+
+## Install the generated pkg-config file (.pc) into the expected location for
+## architecture-dependent package configuration information.  Occasionally,
+## pkg-config files are also used for architecture-independent data packages,
+## in which case the correct install location would be $(datadir)/pkgconfig.
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = $(top_builddir)/molecuilder-$(MOLECUILDER_API_VERSION).pc
+
+unity.cpp:
+	echo "" >  unity.cpp; \
+	list='$(UISOURCE)'; for file in $$list; do \
+	  echo "#include \"$(srcdir)/$$file\"" >> unity.cpp; \
+	done;
+	
+MOSTLYCLEANFILES = unity.cpp
Index: src/UIElements/Menu/ActionMenuItem.cpp
===================================================================
--- src/UIElements/Menu/ActionMenuItem.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Menu/ActionMenuItem.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ActionMenuItem.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/UIElements/Menu/DisplayMenuItem.cpp
===================================================================
--- src/UIElements/Menu/DisplayMenuItem.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Menu/DisplayMenuItem.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * DisplayMenuItem.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -16,7 +28,7 @@
 
 DisplayMenuItem::DisplayMenuItem(Menu* _menu, StringView *_view):
-MenuItem('\0',"",_menu),
-view(_view),
-title("")
+  MenuItem('\0',"",_menu),
+  view(_view),
+  title("")
 {
 }
Index: src/UIElements/Menu/Menu.cpp
===================================================================
--- src/UIElements/Menu/Menu.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Menu/Menu.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * Menu.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/UIElements/Menu/MenuItem.cpp
===================================================================
--- src/UIElements/Menu/MenuItem.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Menu/MenuItem.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MenuItem.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -18,6 +30,6 @@
  */
 MenuItem::MenuItem(char _trigger, const char* _description,Menu* menu) :
-trigger(_trigger),
-added(false)
+  trigger(_trigger),
+  added(false)
 {
   description = new string(_description);
Index: src/UIElements/Menu/QT4/QTMenu.cpp
===================================================================
--- src/UIElements/Menu/QT4/QTMenu.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Menu/QT4/QTMenu.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * QTMenu.cpp
@@ -6,7 +13,15 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Menu/QT4/QTMenu.hpp"
 
 #include <Qt/qaction.h>
+
+#include "Helpers/MemDebug.hpp"
+
 #include "Menu/MenuItem.hpp"
 
Index: src/UIElements/Menu/SeperatorItem.cpp
===================================================================
--- src/UIElements/Menu/SeperatorItem.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Menu/SeperatorItem.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SeperatorItem.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -17,7 +29,7 @@
 
 SeperatorItem::SeperatorItem(Menu* menu):
-MenuItem('\0',"",menu),
-spacer(STD_SEPERATOR_SPACER),
-length(STD_MENU_LENGTH)
+  MenuItem('\0',"",menu),
+  spacer(STD_SEPERATOR_SPACER),
+  length(STD_MENU_LENGTH)
 {
   // TODO Auto-generated constructor stub
@@ -26,7 +38,7 @@
 
 SeperatorItem::SeperatorItem(Menu* menu,char _spacer, int _length):
-MenuItem('\0',"",menu),
-spacer(_spacer),
-length(_length)
+  MenuItem('\0',"",menu),
+  spacer(_spacer),
+  length(_length)
 {
   // TODO Auto-generated constructor stub
Index: src/UIElements/Menu/SubMenuItem.cpp
===================================================================
--- src/UIElements/Menu/SubMenuItem.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Menu/SubMenuItem.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SubMenuItem.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -11,6 +23,6 @@
 
 SubMenuItem::SubMenuItem(char _trigger,const char* _description,Menu* _parent, Menu* _theMenu) :
-MenuItem(_trigger,_description,_parent),
-theMenu(_theMenu)
+  MenuItem(_trigger,_description,_parent),
+  theMenu(_theMenu)
 {
 }
Index: src/UIElements/Menu/TextMenu.cpp
===================================================================
--- src/UIElements/Menu/TextMenu.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Menu/TextMenu.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * TextMenu.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -113,6 +125,6 @@
 
 TextMenu::LeaveAction::LeaveAction(TextMenu* _menu) :
-Action(nameBase+_menu->getTitle()),
-menu(_menu)
+  Action(nameBase+_menu->getTitle()),
+  menu(_menu)
 {}
 
@@ -126,4 +138,7 @@
   return false;
 }
+
+void TextMenu::LeaveAction::getParametersfromValueStorage()
+{}
 
 Dialog* TextMenu::LeaveAction::fillDialog(Dialog *dialog){
Index: src/UIElements/Menu/TextMenu.hpp
===================================================================
--- src/UIElements/Menu/TextMenu.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Menu/TextMenu.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -10,5 +10,5 @@
 
 #include <list>
-#include <ostream>
+#include <iosfwd>
 #include <string>
 
@@ -38,4 +38,5 @@
     virtual Dialog* fillDialog(Dialog *dialog);
   private:
+    virtual void getParametersfromValueStorage();
     virtual Action::state_ptr performCall();
     virtual Action::state_ptr performUndo(Action::state_ptr);
Index: src/UIElements/QT4/QTDialog.cpp
===================================================================
--- src/UIElements/QT4/QTDialog.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/QT4/QTDialog.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * QTDialog.cpp
@@ -6,5 +13,12 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "UIElements/QT4/QTDialog.hpp"
+
+#include <boost/lexical_cast.hpp>
 
 #include <string>
@@ -33,5 +47,5 @@
 #include "Descriptors/AtomIdDescriptor.hpp"
 #include "Descriptors/MoleculeIdDescriptor.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "Box.hpp"
 
@@ -84,25 +98,25 @@
 /************************** Query Infrastructure ************************/
 
-void QTDialog::queryEmpty(char const*, string){
+void QTDialog::queryEmpty(const char*, std::string){
   // TODO
   ASSERT(false, "Not implemented yet");
 }
 
-void QTDialog::queryBoolean(char const*,string){
+void QTDialog::queryBoolean(const char*,string){
   // TODO
   ASSERT(false, "Not implemented yet");
 }
 
-void QTDialog::queryAtom(char const*, string){
+void QTDialog::queryAtom(const char*, std::string){
   // TODO
   ASSERT(false, "Not implemented yet");
 }
 
-void QTDialog::queryAtoms(char const*, string){
+void QTDialog::queryAtoms(const char*, std::string){
   // TODO
   ASSERT(false, "Not implemented yet");
 }
 
-void QTDialog::queryBox(char const*, string){
+void QTDialog::queryBox(const char*, std::string){
   // TODO
   ASSERT(false, "Not implemented yet");
@@ -158,9 +172,9 @@
 }
 
-void QTDialog::queryElement(const char* title, string){
+void QTDialog::queryElement(const char* title, std::string){
   registerQuery(new ElementQTQuery(title,inputLayout,this));
 }
 
-void QTDialog::queryElements(const char* title, string){
+void QTDialog::queryElements(const char* title, std::string){
   // TODO
   ASSERT(false, "Not implemented yet");
@@ -339,5 +353,5 @@
 }
 
-// All values besides the empty string are valid
+// All values besides the empty std::string are valid
 bool QTDialog::StringQTQuery::handle()
 {
@@ -386,9 +400,9 @@
 }
 
-// All values besides the empty string are valid
+// All values besides the empty std::string are valid
 bool QTDialog::StringsQTQuery::handle()
 {
   // dissect by ","
-  string::iterator olditer = temp.begin();
+  std::string::iterator olditer = temp.begin();
   for(string::iterator iter = temp.begin(); iter != temp.end(); ++iter) {
     if (*iter == ' ') {
@@ -415,5 +429,5 @@
       iter != molecules.end();
       ++iter) {
-    stringstream sstr;
+    std::stringstream sstr;
     sstr << (*iter)->IndexNr << "\t" << (*iter)->getName();
     inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter)->IndexNr));
@@ -451,5 +465,5 @@
       iter != molecules.end();
       ++iter) {
-    stringstream sstr;
+    std::stringstream sstr;
     sstr << (*iter)->IndexNr << "\t" << (*iter)->getName();
     inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter)->IndexNr));
@@ -479,6 +493,4 @@
     parent(_parent)
 {
-  const Matrix& M = World::getInstance().getDomain().getM();
-  const char *coords[3] = {"x:","y:","z:"};
   mainLayout= new QHBoxLayout();
   titleLabel = new QLabel(QString(getTitle().c_str()));
@@ -513,6 +525,4 @@
     parent(_parent)
 {
-  const Matrix& M = World::getInstance().getDomain().getM();
-  const char *coords[3] = {"x:","y:","z:"};
   mainLayout= new QHBoxLayout();
   titleLabel = new QLabel(QString(getTitle().c_str()));
@@ -555,6 +565,6 @@
       ++iter)
   {
-    stringstream sstr;
-    sstr << (*iter).first << "\t" << (*iter).second->name;
+    std::stringstream sstr;
+    sstr << (*iter).first << "\t" << (*iter).second->getName();
     inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
   }
@@ -590,6 +600,6 @@
       ++iter)
   {
-    stringstream sstr;
-    sstr << (*iter).first << "\t" << (*iter).second->name;
+    std::stringstream sstr;
+    sstr << (*iter).first << "\t" << (*iter).second->getName();
     inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
   }
@@ -818,5 +828,5 @@
 }
 
-ElementQTQueryPipe::ElementQTQueryPipe(element **_content, QTDialog *_dialog, QComboBox *_theBox) :
+ElementQTQueryPipe::ElementQTQueryPipe(const element **_content, QTDialog *_dialog, QComboBox *_theBox) :
   content(_content),
   dialog(_dialog),
@@ -834,5 +844,5 @@
 }
 
-ElementsQTQueryPipe::ElementsQTQueryPipe(std::vector<element *>*_content, QTDialog *_dialog, QComboBox *_theBox) :
+ElementsQTQueryPipe::ElementsQTQueryPipe(std::vector<const element *>*_content, QTDialog *_dialog, QComboBox *_theBox) :
   content(_content),
   dialog(_dialog),
@@ -846,5 +856,5 @@
   QVariant data = theBox->itemData(newIndex);
   int idx = data.toInt();
-  element *elemental = World::getInstance().getPeriode()->FindElement(idx);
+  const element *elemental = World::getInstance().getPeriode()->FindElement(idx);
   if(elemental)
     (*content).push_back(elemental);
Index: src/UIElements/QT4/QTDialog.hpp
===================================================================
--- src/UIElements/QT4/QTDialog.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/QT4/QTDialog.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -451,5 +451,5 @@
   Q_OBJECT
 public:
-  ElementQTQueryPipe(element **_content, QTDialog *_dialog, QComboBox *_theBox);
+  ElementQTQueryPipe(const element **_content, QTDialog *_dialog, QComboBox *_theBox);
   virtual ~ElementQTQueryPipe();
 
@@ -458,5 +458,5 @@
 
 private:
-  element **content;
+  const element **content;
   QTDialog *dialog;
   QComboBox *theBox;
@@ -466,5 +466,5 @@
   Q_OBJECT
 public:
-  ElementsQTQueryPipe(std::vector<element *>*_content, QTDialog *_dialog, QComboBox *_theBox);
+  ElementsQTQueryPipe(std::vector<const element *>*_content, QTDialog *_dialog, QComboBox *_theBox);
   virtual ~ElementsQTQueryPipe();
 
@@ -473,5 +473,5 @@
 
 private:
-  std::vector<element *>*content;
+  std::vector<const element *>*content;
   QTDialog *dialog;
   QComboBox *theBox;
Index: src/UIElements/QT4/QTMainWindow.cpp
===================================================================
--- src/UIElements/QT4/QTMainWindow.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/QT4/QTMainWindow.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * QTMainWindow.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "QTMainWindow.hpp"
@@ -19,7 +31,9 @@
 #include<boost/bind.hpp>
 
+#include "Helpers/MemDebug.hpp"
+
 #include "atom.hpp"
 #include "molecule.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "Actions/Action.hpp"
 #include "Actions/ActionRegistry.hpp"
@@ -32,6 +46,4 @@
 #include "Views/QT4/QTMoleculeView.hpp"
 #include "Views/QT4/QTStatusBar.hpp"
-#include "Helpers/MemDebug.hpp"
-
 
 using namespace std;
Index: src/UIElements/QT4/QTUIFactory.cpp
===================================================================
--- src/UIElements/QT4/QTUIFactory.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/QT4/QTUIFactory.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * QTUIFactory.cpp
@@ -6,25 +13,33 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <iostream>
 #include <cassert>
 
-using namespace std;
+#include <qapplication.h>
 
-#include <qapplication.h>
 
 #include "UIElements/QT4/QTUIFactory.hpp"
 #include "UIElements/QT4/QTMainWindow.hpp"
 #include "UIElements/QT4/QTDialog.hpp"
+
+#include "Helpers/MemDebug.hpp"
+
 #include "version.h"
 #include "defs.hpp"
-#include "Helpers/MemDebug.hpp"
 
-QTUIFactory::QTUIFactory()
+using namespace std;
+
+QTUIFactory::QTUIFactory() :
+  argc(1)
 {
   // For now we just fake the command line parameters to make QT happy
-  argc=1;
   argv = new char*[1];
   argv[0] = new char[256];
-  strcpy(argv[0],ESPACKVersion);
+  strcpy(argv[0],MOLECUILDERVERSION);
   app = new QApplication(argc,argv);
 }
Index: src/UIElements/TextUI/TextDialog.cpp
===================================================================
--- src/UIElements/TextUI/TextDialog.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/TextUI/TextDialog.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * TextDialog.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -19,13 +31,15 @@
 #include "World.hpp"
 #include "periodentafel.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 
 #include "atom.hpp"
 #include "element.hpp"
 #include "molecule.hpp"
-#include "vector.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "Box.hpp"
+
+#include <boost/lexical_cast.hpp>
 
 using namespace std;
@@ -43,70 +57,69 @@
 }
 
-
-void TextDialog::queryEmpty(const char* title, string description){
+void TextDialog::queryEmpty(const char* title, std::string description){
   registerQuery(new EmptyTextQuery(title,description));
 }
 
-void TextDialog::queryBoolean(const char* title, string description){
+void TextDialog::queryBoolean(const char* title, std::string description){
   registerQuery(new BooleanTextQuery(title,description));
 }
 
-void TextDialog::queryInt(const char* title, string description){
+void TextDialog::queryInt(const char* title, std::string description){
   registerQuery(new IntTextQuery(title,description));
 }
 
-void TextDialog::queryInts(const char* title, string description){
+void TextDialog::queryInts(const char* title, std::string description){
   registerQuery(new IntsTextQuery(title,description));
 }
 
-void TextDialog::queryDouble(const char* title, string description){
+void TextDialog::queryDouble(const char* title, std::string description){
   registerQuery(new DoubleTextQuery(title,description));
 }
 
-void TextDialog::queryDoubles(const char* title, string description){
+void TextDialog::queryDoubles(const char* title, std::string description){
   registerQuery(new DoublesTextQuery(title,description));
 }
 
-void TextDialog::queryString(const char* title, string description){
+void TextDialog::queryString(const char* title, std::string description){
   registerQuery(new StringTextQuery(title,description));
 }
 
-void TextDialog::queryStrings(const char* title, string description){
+void TextDialog::queryStrings(const char* title, std::string description){
   registerQuery(new StringsTextQuery(title,description));
 }
 
-void TextDialog::queryAtom(const char* title, string description) {
+void TextDialog::queryAtom(const char* title, std::string description) {
   registerQuery(new AtomTextQuery(title,description));
 }
 
-void TextDialog::queryAtoms(const char* title, string description) {
+void TextDialog::queryAtoms(const char* title, std::string description) {
   registerQuery(new AtomsTextQuery(title,description));
 }
 
-void TextDialog::queryMolecule(const char* title, string description) {
+void TextDialog::queryMolecule(const char* title, std::string description) {
   registerQuery(new MoleculeTextQuery(title,description));
 }
 
-void TextDialog::queryMolecules(const char* title, string description) {
+void TextDialog::queryMolecules(const char* title, std::string description) {
   registerQuery(new MoleculesTextQuery(title,description));
 }
 
-void TextDialog::queryVector(const char* title, bool check, string description) {
+void TextDialog::queryVector(const char* title, bool check, std::string description) {
   registerQuery(new VectorTextQuery(title,check,description));
 }
 
-void TextDialog::queryVectors(const char* title, bool check, string description) {
+void TextDialog::queryVectors(const char* title, bool check, std::string description) {
   registerQuery(new VectorsTextQuery(title,check,description));
 }
 
-void TextDialog::queryBox(const char* title, string description) {
+void TextDialog::queryBox(const char* title, std::string description) {
   registerQuery(new BoxTextQuery(title,description));
 }
 
-void TextDialog::queryElement(const char* title, string description){
+void TextDialog::queryElement(const char* title, std::string description){
   registerQuery(new ElementTextQuery(title,description));
 }
 
-void TextDialog::queryElements(const char* title, string description){
+void TextDialog::queryElements(const char* title, std::string description){
   registerQuery(new ElementsTextQuery(title,description));
 }
@@ -160,5 +173,5 @@
   getline(cin,line);
   // dissect by " "
-  string::iterator olditer = line.begin();
+  std::string::iterator olditer = line.begin();
   for(string::iterator iter = line.begin(); iter != line.end(); ++iter) {
     if (*iter == ' ') {
@@ -229,5 +242,5 @@
   getline(cin,temp);
   // dissect by " "
-  string::iterator olditer = temp.begin();
+  std::string::iterator olditer = temp.begin();
   for(string::iterator iter = temp.begin(); iter != temp.end(); ++iter) {
     if (*iter == ' ') {
@@ -277,5 +290,5 @@
   getline(cin,line);
   // dissect by " "
-  string::iterator olditer = line.begin();
+  std::string::iterator olditer = line.begin();
   for(string::iterator iter = line.begin(); iter != line.end(); ++iter) {
     if (*iter == ' ') {
@@ -340,5 +353,5 @@
   getline(cin,line);
   // dissect by " "
-  string::iterator olditer = line.begin();
+  std::string::iterator olditer = line.begin();
   for(string::iterator iter = line.begin(); iter != line.end(); ++iter) {
     if (*iter == ' ') {
@@ -412,5 +425,5 @@
   getline(cin,line);
   // dissect by " "
-  string::iterator olditer = line.begin();
+  std::string::iterator olditer = line.begin();
   for(string::iterator iter = line.begin(); iter != line.end(); ++iter) {
     if (*iter == ' ') {
@@ -459,5 +472,5 @@
   double coord = 0.;
   int counter = 0;
-  string::iterator olditer = line.begin();
+  std::string::iterator olditer = line.begin();
   for(string::iterator iter = line.begin(); (iter != line.end()) && (counter != 3); ++iter) {
     if (*iter == ',') {
@@ -497,6 +510,6 @@
   // dissect by ","
   double coord = 0.;
-  string::iterator olditerspace = line.begin();
-  string::iterator olditercomma = line.begin();
+  std::string::iterator olditerspace = line.begin();
+  std::string::iterator olditercomma = line.begin();
   int counter = 0;
   for(string::iterator vectoriter = line.begin(); vectoriter != line.end(); ++vectoriter) {
@@ -523,4 +536,6 @@
     }
   }
+
+  return true;
 }
 
@@ -565,5 +580,5 @@
   bool badInput=false;
   bool aborted = false;
-  element * temp = NULL;
+  const element * temp = NULL;
   do{
     badInput = false;
@@ -592,6 +607,6 @@
     // Try to read as shorthand
     // the last buffer content was not removed, so we read the
-    // same thing again, this time as a string
-    string shorthand;
+    // same thing again, this time as a std::string
+    std::string shorthand;
     cin >> shorthand;
     if(!cin.fail()){
@@ -633,5 +648,5 @@
   getline(cin,line);
   // dissect by " "
-  string::iterator olditer = line.begin();
+  std::string::iterator olditer = line.begin();
   for(string::iterator iter = line.begin(); iter != line.end(); ++iter) {
     if (*iter == ' ') {
Index: src/UIElements/TextUI/TextStatusIndicator.cpp
===================================================================
--- src/UIElements/TextUI/TextStatusIndicator.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/TextUI/TextStatusIndicator.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * TextStatusIndicator.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/UIElements/TextUI/TextUIFactory.cpp
===================================================================
--- src/UIElements/TextUI/TextUIFactory.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/TextUI/TextUIFactory.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * TextUIFactory.cpp
@@ -5,4 +12,11 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
 
 #include "UIElements/TextUI/TextUIFactory.hpp"
Index: src/UIElements/TextUI/TextWindow.cpp
===================================================================
--- src/UIElements/TextUI/TextWindow.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/TextUI/TextWindow.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * TextWindow.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -25,9 +37,8 @@
 #include "Views/StreamStringView.hpp"
 #include "Views/MethodStringView.hpp"
-#include "Helpers/MemDebug.hpp"
 
 #include "defs.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 
 // all needed due to config::SaveAll()
@@ -45,4 +56,8 @@
 {
   map <std::string, TextMenu *> NametoTextMenuMap;
+  std::set <char> ShortcutList;
+  // reserve s for save and q for quite
+  ShortcutList.insert('s');
+  ShortcutList.insert('q');
 
   // populate all actions
@@ -57,19 +72,14 @@
   new SeperatorItem(main_menu);
 
-  Action* undoAction = ActionRegistry::getInstance().getActionByName("Undo");
-  new ActionMenuItem('u',"Undo last operation",main_menu,undoAction);
+  Action* undoAction = ActionRegistry::getInstance().getActionByName("undo");
+  new ActionMenuItem(getSuitableShortForm(ShortcutList,"Undo last operation"),"Undo last operation",main_menu,undoAction);
 
-  Action* redoAction = ActionRegistry::getInstance().getActionByName("Redo");
-  new ActionMenuItem('r',"Redo last operation",main_menu,redoAction);
+  Action* redoAction = ActionRegistry::getInstance().getActionByName("redo");
+  new ActionMenuItem(getSuitableShortForm(ShortcutList,"Redo last operation"),"Redo last operation",main_menu,redoAction);
 
   new SeperatorItem(main_menu);
 
-  Action *setMoleculeAction = new MethodAction("setMoleculeAction",boost::bind(&MoleculeListClass::flipChosen,World::getInstance().getMolecules()));
-  new ActionMenuItem('a',"set molecule (in)active",main_menu,setMoleculeAction);
-
-  TextMenu *Menu = NULL;
-  std::set <char> ShortcutList;
   for(map<std::string, pair<std::string,std::string> >::iterator iter = MapOfActions::getInstance().MenuDescription.begin(); iter != MapOfActions::getInstance().MenuDescription.end(); ++iter) {
-    Menu = new TextMenu(Log() << Verbose(0), iter->second.second);
+    TextMenu *Menu = new TextMenu(Log() << Verbose(0), iter->second.second);
     NametoTextMenuMap.insert( pair <std::string, TextMenu *> (iter->first, Menu) );
     new SubMenuItem(getSuitableShortForm(ShortcutList,iter->first),iter->second.first.c_str(),main_menu,Menu);
@@ -78,4 +88,5 @@
   new SeperatorItem(main_menu);
 
+  // save has reserved key 's'
   Action *saveConfigAction = ActionRegistry::getInstance().getActionByName("output");
   new ActionMenuItem('s',"save current setup to config files",main_menu,saveConfigAction);
@@ -84,9 +95,8 @@
   new ActionMenuItem('q',"quit",main_menu,quitAction);
 
+  // quit has reserved key 'q'
   // go through all menus and create them
-  for (map <std::string, TextMenu *>::iterator MenuRunner = NametoTextMenuMap.begin(); MenuRunner != NametoTextMenuMap.end(); ++MenuRunner) {
-    cout << "Creating Menu " << MenuRunner->first << "." << endl;
+  for (map <std::string, TextMenu *>::iterator MenuRunner = NametoTextMenuMap.begin(); MenuRunner != NametoTextMenuMap.end(); ++MenuRunner)
     populateMenu(MenuRunner->second, MenuRunner->first);
-  }
 
   // Add status indicators etc...
@@ -110,9 +120,22 @@
 {
   for (std::string::const_iterator CharRunner = name.begin(); CharRunner != name.end(); ++CharRunner) {
-    if (ShortcutList.find(*CharRunner) == ShortcutList.end())
+    if (ShortcutList.find(*CharRunner) == ShortcutList.end()) {
+      ShortcutList.insert(*CharRunner);
       return *CharRunner;
+    }
   }
-  DoeLog(1) && (eLog() << Verbose(1) << "Could not find a suitable shortform for TextWindow::getSuitableShortForm()." << endl);
-  return ((char)(ShortcutList.size() % 10) + '0');
+  // if no letter matches, take digits
+  int i=0;
+  for (;i<10;++i) {
+    if (ShortcutList.find((char)i + '0') == ShortcutList.end())
+      break;
+  }
+  if (i != 10) {
+    ShortcutList.insert((char)i + '0');
+    return ((char)i + '0');
+  } else {
+    DoeLog(1) && (eLog() << Verbose(1) << "Could not find a suitable shortform for " << name << "." << endl);
+    return '#';
+  }
 }
 
@@ -121,8 +144,9 @@
   Action *ActionItem = NULL;
   set <char> ShortcutList;
+  // reserve 'q' for quit
+  ShortcutList.insert('q');
   // through all actions for this menu
   pair < multimap <std::string, std::string>::iterator, multimap <std::string, std::string>::iterator > MenuActions = MapOfActions::getInstance().MenuContainsActionMap.equal_range(MenuName);
   for (multimap <std::string, std::string>::const_iterator MenuRunner = MenuActions.first; MenuRunner != MenuActions.second; ++MenuRunner) {
-    cout << " Adding " << MenuRunner->second << " to submenu " << MenuName << endl;
     ActionItem = ActionRegistry::getInstance().getActionByName(MenuRunner->second);
     new ActionMenuItem(getSuitableShortForm(ShortcutList, MenuRunner->second),MapOfActions::getInstance().getDescription(MenuRunner->second).c_str(),Menu,ActionItem);
Index: src/UIElements/UIFactory.cpp
===================================================================
--- src/UIElements/UIFactory.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/UIFactory.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * UIFactory.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/UIElements/Views/MethodStringView.cpp
===================================================================
--- src/UIElements/Views/MethodStringView.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Views/MethodStringView.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MethodStringView.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -13,6 +25,6 @@
 
 MethodStringView::MethodStringView(boost::function<string()> _displayMethod) :
-StringView(),
-displayMethod(_displayMethod)
+  StringView(),
+  displayMethod(_displayMethod)
 {
   // TODO Auto-generated constructor stub
Index: src/UIElements/Views/QT4/GLMoleculeView.cpp
===================================================================
--- src/UIElements/Views/QT4/GLMoleculeView.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Views/QT4/GLMoleculeView.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * GLMoleculeView.cpp
@@ -6,5 +13,12 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "GLMoleculeView.hpp"
+
+#include "Helpers/MemDebug.hpp"
 
 GLMoleculeView::GLMoleculeView(QWidget *parent) :
Index: src/UIElements/Views/QT4/QTMoleculeView.cpp
===================================================================
--- src/UIElements/Views/QT4/QTMoleculeView.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Views/QT4/QTMoleculeView.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * QTMoleculeView.cpp
@@ -6,9 +13,16 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Views/QT4/QTMoleculeView.hpp"
 
 #include <iostream>
+
+#include "Helpers/MemDebug.hpp"
+
 #include "molecule.hpp"
-
 
 using namespace std;
Index: src/UIElements/Views/QT4/QTStatusBar.cpp
===================================================================
--- src/UIElements/Views/QT4/QTStatusBar.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Views/QT4/QTStatusBar.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * QTStatusBar.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <sstream>
@@ -13,6 +25,9 @@
 
 #include "QTStatusBar.hpp"
+
+#include "Helpers/MemDebug.hpp"
+
 #include "World.hpp"
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 #include "Actions/Process.hpp"
 
@@ -21,7 +36,7 @@
   QStatusBar(_parent),
   Observer("QTStatusBar"),
-  parent(_parent),
   atomCount(World::getInstance().numAtoms()),
-  moleculeCount(World::getInstance().numMolecules())
+  moleculeCount(World::getInstance().numMolecules()),
+  parent(_parent)
 {
   World::getInstance().signOn(this);
Index: src/UIElements/Views/QT4/QTWorldView.cpp
===================================================================
--- src/UIElements/Views/QT4/QTWorldView.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Views/QT4/QTWorldView.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * QTWorldView.cpp
@@ -6,9 +13,17 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Views/QT4/QTWorldView.hpp"
 
 #include <iostream>
 
+#include "Helpers/MemDebug.hpp"
+
 #include "atom.hpp"
+#include "Formula.hpp"
 #include "molecule.hpp"
 
@@ -20,5 +35,5 @@
 // these attributes are skiped so far
 const int QTWorldView::COLUMNCOUNT = COLUMNTYPES_MAX;
-const char *QTWorldView::COLUMNNAMES[QTWorldView::COLUMNCOUNT]={"Name","Atoms"/*,"Formula"*/,"Center"/*,"Size"*/};
+const char *QTWorldView::COLUMNNAMES[QTWorldView::COLUMNCOUNT]={"Name","Atoms","Formula"/*,"Size"*/};
 
 QTWorldView::QTWorldView(QWidget * _parent) :
@@ -61,8 +76,5 @@
     const int index = (*iter)->IndexNr;
     QTableWidgetItem *indexWidget = new QTableWidgetItem();
-    // there probably is an easier method to convert ints to QStrings... but i didn't find it
-    stringstream idxsstr;
-    idxsstr << index;
-    indexWidget->setText(QString(idxsstr.str().c_str()));
+    indexWidget->setText(QString::number(index));
     indexWidget->setData(Qt::UserRole,QVariant(index));
     setVerticalHeaderItem(i,indexWidget);
@@ -75,17 +87,13 @@
     const int atomCount = (*iter)->getAtomCount();
     QTableWidgetItem *countWidget= new QTableWidgetItem();
-    stringstream countsstr;
-    countsstr << atomCount;
-    countWidget->setText(QString(countsstr.str().c_str()));
+    countWidget->setText(QString::number(atomCount));
     countWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
     setItem(i,ATOMS,countWidget);
 
-    const Vector center = (*iter)->Center;
-    QTableWidgetItem *centerWidget = new QTableWidgetItem();
-    stringstream centersstr;
-    centersstr << center;
-    centerWidget->setText(QString(centersstr.str().c_str()));
-    setItem(i,CENTER,centerWidget);
-    centerWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+    const Formula formula = (*iter)->getFormula();
+    QTableWidgetItem *formulaWidget= new QTableWidgetItem();
+    formulaWidget->setText(QString(formula.toString().c_str()));
+    formulaWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+    setItem(i,ATOMS,formulaWidget);
 
     molSelection[i]=nameWidget->isSelected();
Index: src/UIElements/Views/QT4/QTWorldView.hpp
===================================================================
--- src/UIElements/Views/QT4/QTWorldView.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Views/QT4/QTWorldView.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -28,5 +28,5 @@
 
   static const int COLUMNCOUNT;
-  enum {NAME,ATOMS,CENTER,COLUMNTYPES_MAX} COLUMNTYPES;
+  enum {NAME,ATOMS,FORMULA,COLUMNTYPES_MAX} COLUMNTYPES;
   static const char *COLUMNNAMES[];
 
Index: src/UIElements/Views/StreamStringView.cpp
===================================================================
--- src/UIElements/Views/StreamStringView.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Views/StreamStringView.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * StreamStringView.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -16,6 +28,6 @@
 
 StreamStringView::StreamStringView(boost::function<void(ostream *)> _displayMethod) :
-StringView(),
-displayMethod(_displayMethod)
+  StringView(),
+  displayMethod(_displayMethod)
 {}
 
Index: src/UIElements/Views/StringView.cpp
===================================================================
--- src/UIElements/Views/StringView.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Views/StringView.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * StringView.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/UIElements/Views/View.cpp
===================================================================
--- src/UIElements/Views/View.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/UIElements/Views/View.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * View.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: c/VectorContent.hpp
===================================================================
--- src/VectorContent.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * VectorContent.hpp
- *
- *  Created on: Jul 2, 2010
- *      Author: crueger
- */
-
-#ifndef VECTORCONTENT_HPP_
-#define VECTORCONTENT_HPP_
-
-/**
- * !file
- * The way GSL works does not allow for forward definitions of the structures.
- * Because of this the pointer to the gsl_vector struct is wrapped inside another
- * (dumb) object that allows for forward definitions.
- */
-
-#include <gsl/gsl_vector.h>
-
-struct BaseCase{};
-
-struct VectorContent{
-  VectorContent(){
-    content =  gsl_vector_calloc (NDIM);
-  }
-  VectorContent(BaseCase){
-
-  }
-  virtual ~VectorContent(){
-    if(content){
-      gsl_vector_free(content);
-      content = 0;
-    }
-  }
-  gsl_vector *content;
-};
-
-struct VectorViewContent : public VectorContent{
-  VectorViewContent(gsl_vector_view _view) :
-    VectorContent(BaseCase()),
-    view(_view)
-  {
-    content=&view.vector;
-  }
-  virtual ~VectorViewContent(){
-    content=0;
-  }
-  gsl_vector_view view;
-};
-
-#endif /* VECTORCONTENT_HPP_ */
Index: c/VectorSet.hpp
===================================================================
--- src/VectorSet.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * VectorSet.hpp
- *
- *  Created on: Jun 2, 2010
- *      Author: crueger
- */
-
-#ifndef VECTORSET_HPP_
-#define VECTORSET_HPP_
-
-
-#include <functional>
-#include <algorithm>
-#include <limits>
-
-/**
- * A simple mixin to give any STL conforming structure fast Vector abilities
- *
- * TODO: make this work for maps
- */
-
-#include "vector.hpp"
-#include <list>
-
-// this tests, whether we actually have a Vector
-template <class V>
-struct is_vector{};
-
-template <>
-struct is_vector<Vector>{
-  typedef void wrong_type;
-};
-
-template <class Set>
-class VectorSet : public Set
-{
-  // when our set carries something besides a vector this will produce an error
-  typedef typename is_vector<typename Set::value_type>::wrong_type check_for_vector;
-public:
-  // typedefs for STL conforming structure
-  typedef typename Set::iterator iterator;
-  typedef typename Set::const_iterator const_iterator;
-
-  VectorSet(){}
-  virtual ~VectorSet(){}
-
-  /**
-   * translate all Vectors within this set by a specified amount
-   */
-  void translate(const Vector &translater){
-    // this is needed to allow template lookup
-    transform(this->begin(),this->end(),this->begin(),std::bind1st(std::plus<Vector>(),translater));
-  }
-
-  double minDistSquared(const Vector &point){
-    if(!this->size())
-      return std::numeric_limits<double>::infinity();
-    std::list<double> helper;
-    helper.resize(this->size());
-    transform(this->begin(),this->end(),
-              helper.begin(),
-              std::bind2nd(std::mem_fun_ref(&Vector::DistanceSquared),point));
-    return *min_element(helper.begin(),helper.end());
-  }
-};
-
-// allows simpler definition of VectorSets
-#define VECTORSET(container_type) VectorSet<container_type<Vector> >
-
-#endif /* VECTORSET_HPP_ */
Index: src/World.cpp
===================================================================
--- src/World.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/World.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * World.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -25,5 +37,5 @@
 #include "Helpers/Assert.hpp"
 #include "Box.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "defs.hpp"
 
@@ -32,4 +44,7 @@
 
 using namespace std;
+
+const unsigned int MAX_POOL_FRAGMENTATION=20;
+const unsigned int MAX_FRAGMENTATION_SKIPS=100;
 
 /******************************* getter and setter ************************/
@@ -138,4 +153,5 @@
 void World::destroyMolecule(molecule* mol){
   OBSERVE;
+  ASSERT(mol,"Molecule that was meant to be destroyed did not exist");
   destroyMolecule(mol->getId());
 }
@@ -199,4 +215,25 @@
       atoms.erase(oldId);
       atoms.insert(pair<atomId_t,atom*>(newId,target));
+      return true;
+    }
+    else{
+      return false;
+    }
+  }
+}
+
+bool World::changeMoleculeId(moleculeId_t oldId, moleculeId_t newId, molecule* target){
+  OBSERVE;
+  // in case this call did not originate from inside the atom, we redirect it,
+  // to also let it know that it has changed
+  if(!target){
+    target = molecules[oldId];
+    ASSERT(target,"Molecule with that ID not found");
+    return target->changeId(newId);
+  }
+  else{
+    if(reserveMoleculeId(newId)){
+      molecules.erase(oldId);
+      molecules.insert(pair<moleculeId_t,molecule*>(newId,target));
       return true;
     }
@@ -701,4 +738,6 @@
     selectedMolecules(this),
     currMoleculeId(0),
+    lastMoleculePoolSize(0),
+    numMoleculeDefragSkips(0),
     molecules_deprecated(new MoleculeListClass(this))
 {
@@ -718,7 +757,4 @@
   delete cell_size;
   delete molecules_deprecated;
-  delete periode;
-  delete configuration;
-  delete Thermostats;
   MoleculeSet::iterator molIter;
   for(molIter=molecules.begin();molIter!=molecules.end();++molIter){
@@ -731,4 +767,7 @@
   }
   atoms.clear();
+  delete periode;
+  delete configuration;
+  delete Thermostats;
 }
 
@@ -736,4 +775,8 @@
 
 CONSTRUCT_SINGLETON(World)
+
+CONSTRUCT_OBSERVEDCONTAINER(World::AtomSTLSet)
+
+CONSTRUCT_OBSERVEDCONTAINER(World::MoleculeSTLSet)
 
 /******************************* deprecated Legacy Stuff ***********************/
Index: src/World.hpp
===================================================================
--- src/World.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/World.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -72,8 +72,11 @@
 template<typename> friend class AtomsCalculation;
 public:
+  // some typedefs for the CONSTRUCT_... macros (no "," allows in a single parameter name)
+  typedef std::map<atomId_t,atom*> AtomSTLSet;
+  typedef std::map<moleculeId_t,molecule*> MoleculeSTLSet;
 
   // Types for Atom and Molecule structures
-  typedef ObservedContainer<std::map<atomId_t,atom*> > AtomSet;
-  typedef ObservedContainer<std::map<moleculeId_t,molecule*> > MoleculeSet;
+  typedef ObservedContainer< AtomSTLSet > AtomSet;
+  typedef ObservedContainer< MoleculeSTLSet > MoleculeSet;
 
   typedef ATOMSET(std::vector) AtomComposite;
@@ -217,4 +220,12 @@
    */
   bool changeAtomId(atomId_t oldId, atomId_t newId, atom* target=0);
+
+  /**
+   * used when changing an molecule Id.
+   * Unless you are calling this method from inside an moleucle don't fiddle with the third parameter.
+   *
+   * Return value indicates wether the change could be done or not.
+   */
+  bool changeMoleculeId(moleculeId_t oldId, moleculeId_t newId, molecule* target=0);
 
   /**
Index: src/analysis_bonds.cpp
===================================================================
--- src/analysis_bonds.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/analysis_bonds.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * analysis_bonds.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -12,7 +24,7 @@
 #include "bond.hpp"
 #include "element.hpp"
-#include "info.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Info.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 
@@ -60,7 +72,7 @@
   int AtomNo = 0;
   for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
-    if ((*iter)->type == type1)
+    if ((*iter)->getType() == type1)
       for (BondList::const_iterator BondRunner = (*iter)->ListOfBonds.begin(); BondRunner != (*iter)->ListOfBonds.end(); BondRunner++)
-        if ((*BondRunner)->GetOtherAtom((*iter))->type == type2) {
+        if ((*BondRunner)->GetOtherAtom((*iter))->getType() == type2) {
           const double distance = (*BondRunner)->GetDistanceSquared();
           if (Min > distance)
@@ -87,11 +99,11 @@
  * \return angle between \a *first and \a *second, both relative to origin at \a *origin.
  */
-double CalculateAngle(Vector *first, Vector *central, Vector *second)
+double CalculateAngle(const Vector &first, const Vector &central, const Vector &second)
 {
   Vector OHBond;
   Vector OOBond;
 
-  OHBond = (*first) - (*central);
-  OOBond = (*second) - (*central);
+  OHBond = first - central;
+  OOBond = second - central;
   const double angle = OHBond.Angle(OOBond);
   return angle;
@@ -110,5 +122,5 @@
 
   // check angle
-  if (CalculateAngle(&Hydrogen->x, &Oxygen->x, &OtherOxygen->x) < M_PI*(30./180.)) {
+  if (CalculateAngle(Hydrogen->getPosition(), Oxygen->getPosition(), OtherOxygen->getPosition()) < M_PI*(30./180.)) {
     return true;
   } else {
@@ -138,7 +150,7 @@
         molecule::iterator Runner = (*MolRunner)->begin();
         for(;Runner!=(*MolRunner)->end();++Runner){
-          if (((*Walker)->type->Z  == 8) && ((*Runner)->type->Z  == 8)) {
+          if (((*Walker)->getType()->getAtomicNumber()  == 8) && ((*Runner)->getType()->getAtomicNumber()  == 8)) {
             // check distance
-            const double distance = (*Runner)->x.DistanceSquared((*Walker)->x);
+            const double distance = (*Runner)->DistanceSquared(*(*Walker));
             if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { // distance >0 means  different atoms
               // on other atom(Runner) we check for bond to interface element and
@@ -152,12 +164,12 @@
                 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner);
                 // if hydrogen, check angle to be greater(!) than 30 degrees
-                if (OtherAtom->type->Z == 1) {
-                  const double angle = CalculateAngle(&OtherAtom->x, &(*Runner)->x, &(*Walker)->x);
+                if (OtherAtom->getType()->getAtomicNumber() == 1) {
+                  const double angle = CalculateAngle(OtherAtom->getPosition(), (*Runner)->getPosition(), (*Walker)->getPosition());
                   OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON);
                   Otherangle += angle;
                   OtherHydrogens++;
                 }
-                InterfaceFlag = InterfaceFlag || (OtherAtom->type == InterfaceElement);
-                Interface2Flag = Interface2Flag || (OtherAtom->type == Interface2Element);
+                InterfaceFlag = InterfaceFlag || (OtherAtom->getType() == InterfaceElement);
+                Interface2Flag = Interface2Flag || (OtherAtom->getType() == Interface2Element);
               }
               DoLog(1) && (Log() << Verbose(1) << "Otherangle is " << Otherangle << " for " << OtherHydrogens << " hydrogens." << endl);
@@ -177,8 +189,8 @@
                 for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) {
                   atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker);
-                  if (OtherAtom->type->Z == 1) {
+                  if (OtherAtom->getType()->getAtomicNumber() == 1) {
                     // check angle
                     if (CheckHydrogenBridgeBondAngle(*Walker, OtherAtom, *Runner)) {
-                      DoLog(1) && (Log() << Verbose(1) << (*Walker)->getName() << ", " << OtherAtom->getName() << " and " << (*Runner)->getName() << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle(&OtherAtom->x, &(*Walker)->x, &(*Runner)->x)*(180./M_PI) << "." << endl);
+                      DoLog(1) && (Log() << Verbose(1) << (*Walker)->getName() << ", " << OtherAtom->getName() << " and " << (*Runner)->getName() << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle(OtherAtom->getPosition(), (*Walker)->getPosition(), (*Runner)->getPosition())*(180./M_PI) << "." << endl);
                       count++;
                       break;
@@ -210,10 +222,10 @@
     for(;Walker!=(*MolWalker)->end();++Walker){
       atom * theAtom = *Walker;
-      if ((theAtom->type == first) || (theAtom->type == second)) {  // first element matches
+      if ((theAtom->getType() == first) || (theAtom->getType() == second)) {  // first element matches
         for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) {
           atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
-          if (((OtherAtom->type == first) || (OtherAtom->type == second)) && (theAtom->nr < OtherAtom->nr)) {
+          if (((OtherAtom->getType() == first) || (OtherAtom->getType() == second)) && (theAtom->nr < OtherAtom->nr)) {
             count++;
-            DoLog(1) && (Log() << Verbose(1) << first->name << "-" << second->name << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl);
+            DoLog(1) && (Log() << Verbose(1) << *first << "-" << *second << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl);
           }
         }
@@ -246,5 +258,5 @@
     for(;Walker!=(*MolWalker)->end();++Walker){
       atom *theAtom = *Walker;
-      if (theAtom->type == second) {  // first element matches
+      if (theAtom->getType() == second) {  // first element matches
         for (int i=0;i<2;i++)
           MatchFlag[i] = false;
@@ -252,5 +264,5 @@
           atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
           for (int i=0;i<2;i++)
-            if ((!MatchFlag[i]) && (OtherAtom->type == ElementArray[i])) {
+            if ((!MatchFlag[i]) && (OtherAtom->getType() == ElementArray[i])) {
               MatchFlag[i] = true;
               break;  // each bonding atom can match at most one element we are looking for
@@ -262,5 +274,5 @@
         if (result) { // check results
           count++;
-          DoLog(1) && (Log() << Verbose(1) << first->name << "-" << second->name << "-" << third->name << " bond found at " << *Walker << "." << endl);
+          DoLog(1) && (Log() << Verbose(1) << *first << "-" << *second << "-" << *third << " bond found at " << *Walker << "." << endl);
         }
       }
Index: src/analysis_bonds.hpp
===================================================================
--- src/analysis_bonds.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/analysis_bonds.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -20,5 +20,5 @@
 /*********************************************** defines ***********************************/
 
-#define HBRIDGEDISTANCE 3.5   //!< HBridge distance from PCCP Vol 10. 4802-4813
+const double HBRIDGEDISTANCE=3.5;   //!< HBridge distance from PCCP Vol 10. 4802-4813
 
 /****************************************** forward declarations *****************************/
Index: src/analysis_correlation.cpp
===================================================================
--- src/analysis_correlation.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/analysis_correlation.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * analysis.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -11,15 +23,16 @@
 #include <iomanip>
 
+#include "BoundaryTriangleSet.hpp"
 #include "analysis_correlation.hpp"
 #include "element.hpp"
-#include "info.hpp"
-#include "log.hpp"
+#include "Helpers/Info.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "tesselation.hpp"
 #include "tesselationhelpers.hpp"
 #include "triangleintersectionlist.hpp"
-#include "vector.hpp"
-#include "Matrix.hpp"
-#include "verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Matrix.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 #include "Box.hpp"
@@ -32,5 +45,5 @@
  * \return Map of doubles with values the pair of the two atoms.
  */
-PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements)
+PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements)
 {
   Info FunctionInfo(__func__);
@@ -47,16 +60,16 @@
 
   // create all possible pairs of elements
-  set <pair<element *, element *> > PairsOfElements;
+  set <pair<const element *,const element *> > PairsOfElements;
   if (elements.size() >= 2) {
-    for (vector<element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)
-      for (vector<element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)
+    for (vector<const element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)
+      for (vector<const element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)
         if (type1 != type2) {
-          PairsOfElements.insert( pair<element *, element*>(*type1,*type2) );
-          DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << (*type1)->symbol << " and " << (*type2)->symbol << "." << endl);
+          PairsOfElements.insert( make_pair(*type1,*type2) );
+          DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << *(*type1) << " and " << *(*type2) << "." << endl);
         }
   } else if (elements.size() == 1) { // one to all are valid
-    element *elemental = *elements.begin();
-    PairsOfElements.insert( pair<element *, element*>(elemental,(element *)NULL) );
-    PairsOfElements.insert( pair<element *, element*>((element *)NULL,elemental) );
+    const element *elemental = *elements.begin();
+    PairsOfElements.insert( pair<const element *,const element*>(elemental,0) );
+    PairsOfElements.insert( pair<const element *,const element*>(0,elemental) );
   } else { // all elements valid
     PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) );
@@ -73,7 +86,7 @@
           DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
           if ((*iter)->getId() < (*runner)->getId()){
-            for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
-              if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
-                distance = domain.periodicDistance(*(*iter)->node,*(*runner)->node);
+            for (set <pair<const element *, const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
+              if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
+                distance = domain.periodicDistance((*iter)->getPosition(),(*runner)->getPosition());
                 //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
                 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
@@ -94,5 +107,5 @@
  * \return Map of doubles with values the pair of the two atoms.
  */
-PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const int ranges[NDIM] )
+PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const int ranges[NDIM] )
 {
   Info FunctionInfo(__func__);
@@ -114,16 +127,16 @@
 
   // create all possible pairs of elements
-  set <pair<element *, element *> > PairsOfElements;
+  set <pair<const element *,const element *> > PairsOfElements;
   if (elements.size() >= 2) {
-    for (vector<element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)
-      for (vector<element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)
+    for (vector<const element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)
+      for (vector<const element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)
         if (type1 != type2) {
-          PairsOfElements.insert( pair<element *, element*>(*type1,*type2) );
-          DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << (*type1)->symbol << " and " << (*type2)->symbol << "." << endl);
+          PairsOfElements.insert( make_pair(*type1,*type2) );
+          DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << *(*type1) << " and " << *(*type2) << "." << endl);
         }
   } else if (elements.size() == 1) { // one to all are valid
-    element *elemental = *elements.begin();
-    PairsOfElements.insert( pair<element *, element*>(elemental,(element *)NULL) );
-    PairsOfElements.insert( pair<element *, element*>((element *)NULL,elemental) );
+    const element *elemental = *elements.begin();
+    PairsOfElements.insert( pair<const element *,const element*>(elemental,0) );
+    PairsOfElements.insert( pair<const element *,const element*>(0,elemental) );
   } else { // all elements valid
     PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) );
@@ -137,5 +150,5 @@
     for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
       DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
-      periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
+      periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
       // go through every range in xyz and get distance
       for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
@@ -148,7 +161,7 @@
                   DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);
                   if ((*iter)->getId() < (*runner)->getId()){
-                    for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
-                      if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
-                        periodicOtherX = FullInverseMatrix * (*(*runner)->node); // x now in [0,1)^3
+                    for (set <pair<const element *,const element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
+                      if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
+                        periodicOtherX = FullInverseMatrix * ((*runner)->getPosition()); // x now in [0,1)^3
                         // go through every range in xyz and get distance
                         for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++)
@@ -177,5 +190,5 @@
  * \return Map of dobules with values as pairs of atom and the vector
  */
-CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point )
+CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point )
 {
   Info FunctionInfo(__func__);
@@ -195,7 +208,7 @@
     for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
       DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
-      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
-        if ((*type == NULL) || ((*iter)->type == *type)) {
-          distance = domain.periodicDistance(*(*iter)->node,*point);
+      for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
+        if ((*type == NULL) || ((*iter)->getType() == *type)) {
+          distance = domain.periodicDistance((*iter)->getPosition(),*point);
           DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
           outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
@@ -214,5 +227,5 @@
  * \return Map of dobules with values as pairs of atom and the vector
  */
-CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] )
+CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point, const int ranges[NDIM] )
 {
   Info FunctionInfo(__func__);
@@ -236,7 +249,7 @@
     for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
       DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
-      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
-        if ((*type == NULL) || ((*iter)->type == *type)) {
-          periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
+      for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
+        if ((*type == NULL) || ((*iter)->getType() == *type)) {
+          periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
           // go through every range in xyz and get distance
           for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
@@ -262,5 +275,5 @@
  * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
  */
-CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC )
+CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC )
 {
   Info FunctionInfo(__func__);
@@ -283,7 +296,7 @@
     for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
       DoLog(3) && (Log() << Verbose(3) << "\tCurrent atom is " << *(*iter) << "." << endl);
-      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
-        if ((*type == NULL) || ((*iter)->type == *type)) {
-          TriangleIntersectionList Intersections((*iter)->node,Surface,LC);
+      for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
+        if ((*type == NULL) || ((*iter)->getType() == *type)) {
+          TriangleIntersectionList Intersections((*iter)->getPosition(),Surface,LC);
           distance = Intersections.GetSmallestDistance();
           triangle = Intersections.GetClosestTriangle();
@@ -308,5 +321,5 @@
  * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest
  */
-CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )
+CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )
 {
   Info FunctionInfo(__func__);
@@ -334,7 +347,7 @@
     for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
       DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
-      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
-        if ((*type == NULL) || ((*iter)->type == *type)) {
-          periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
+      for (vector<const element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
+        if ((*type == NULL) || ((*iter)->getType() == *type)) {
+          periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
           // go through every range in xyz and get distance
           ShortestDistance = -1.;
@@ -343,5 +356,5 @@
               for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
                 checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
-                TriangleIntersectionList Intersections(&checkX,Surface,LC);
+                TriangleIntersectionList Intersections(checkX,Surface,LC);
                 distance = Intersections.GetSmallestDistance();
                 triangle = Intersections.GetClosestTriangle();
@@ -411,5 +424,5 @@
     *file << runner->first;
     for (int i=0;i<NDIM;i++)
-      *file << "\t" << setprecision(8) << (runner->second.first->node->at(i) - runner->second.second->at(i));
+      *file << "\t" << setprecision(8) << (runner->second.first->at(i) - runner->second.second->at(i));
     *file << endl;
   }
@@ -426,6 +439,8 @@
   if (!map->empty())
     for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
-      *file << setprecision(8) << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl;
-    }
-};
-
+      *file << setprecision(8) << runner->first << "\t";
+      *file << *(runner->second.first) << "\t";
+      *file << *(runner->second.second) << endl;
+    }
+};
+
Index: src/analysis_correlation.hpp
===================================================================
--- src/analysis_correlation.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/analysis_correlation.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -18,4 +18,5 @@
 #endif
 
+#include <cmath>
 #include <fstream>
 
@@ -27,5 +28,5 @@
 
 #include "atom.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 
 /****************************************** forward declarations *****************************/
@@ -46,10 +47,10 @@
 /********************************************** declarations *******************************/
 
-PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements);
-CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point );
-CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC );
-PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const int ranges[NDIM] );
-CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] );
-CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] );
+PairCorrelationMap *PairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements);
+CorrelationToPointMap *CorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point );
+CorrelationToSurfaceMap *CorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC );
+PairCorrelationMap *PeriodicPairCorrelation(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const int ranges[NDIM] );
+CorrelationToPointMap *PeriodicCorrelationToPoint(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Vector *point, const int ranges[NDIM] );
+CorrelationToSurfaceMap *PeriodicCorrelationToSurface(std::vector<molecule *> &molecules, const std::vector<const element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] );
 int GetBin ( const double value, const double BinWidth, const double BinStart );
 void OutputCorrelation( ofstream * const file, const BinPairMap * const map );
Index: src/analyzer.cpp
===================================================================
--- src/analyzer.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/analyzer.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file analyzer.cpp
  *
@@ -8,14 +15,4 @@
 //============================ INCLUDES ===========================
 
-#include "Helpers/MemDebug.hpp"
-
-#include <cstring>
-
-#include "datacreator.hpp"
-#include "helpers.hpp"
-#include "parser.hpp"
-#include "periodentafel.hpp"
-#include "verbose.hpp"
-
 // include config.h
 #ifdef HAVE_CONFIG_H
@@ -23,4 +20,13 @@
 #endif
 
+#include "Helpers/MemDebug.hpp"
+
+#include <cstring>
+
+#include "datacreator.hpp"
+#include "Helpers/helpers.hpp"
+#include "parser.hpp"
+#include "periodentafel.hpp"
+#include "Helpers/Verbose.hpp"
 
 //============================== MAIN =============================
Index: src/atom.cpp
===================================================================
--- src/atom.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file atom.cpp
  *
@@ -4,4 +11,9 @@
  *
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -13,5 +25,5 @@
 #include "lists.hpp"
 #include "parser.hpp"
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 #include "World.hpp"
 #include "molecule.hpp"
@@ -19,4 +31,5 @@
 
 #include <iomanip>
+#include <iostream>
 
 /************************************* Functions for class atom *************************************/
@@ -26,19 +39,20 @@
  */
 atom::atom() :
-  father(this), sort(&nr), mol(0)
-{
-  node = &x;  // TesselPoint::x can only be referenced from here
-};
+  father(this),
+  sort(&nr),
+  mol(0)
+{};
 
 /** Constructor of class atom.
  */
 atom::atom(atom *pointer) :
-    ParticleInfo(pointer),father(pointer), sort(&nr)
-{
-  type = pointer->type;  // copy element of atom
-  x = pointer->x; // copy coordination
-  v = pointer->v; // copy velocity
+    ParticleInfo(pointer),
+    father(pointer),
+    sort(&nr)
+{
+  setType(pointer->getType());  // copy element of atom
+  setPosition(pointer->getPosition()); // copy coordination
+  AtomicVelocity = pointer->AtomicVelocity; // copy velocity
   FixedIon = pointer->FixedIon;
-  node = &x;
   mol = 0;
 };
@@ -48,9 +62,8 @@
   res->father = this;
   res->sort = &res->nr;
-  res->type = type;
-  res->x = this->x;
-  res->v = this->v;
+  res->setType(getType());
+  res->setPosition(this->getPosition());
+  res->AtomicVelocity = this->AtomicVelocity;
   res->FixedIon = FixedIon;
-  res->node = &x;
   res->mol = 0;
   World::getInstance().registerAtom(res);
@@ -109,4 +122,8 @@
 };
 
+bool atom::isFather(const atom *ptr){
+  return ptr==father;
+}
+
 /** Checks whether atom is within the given box.
  * \param offset offset to box origin
@@ -116,5 +133,5 @@
 bool atom::IsInShape(const Shape& shape) const
 {
-  return shape.isInside(*node);
+  return shape.isInside(getPosition());
 };
 
@@ -141,8 +158,8 @@
   if (out != NULL) {
     *out << "Ion_Type" << ElementNo << "_" << AtomNo << "\t"  << fixed << setprecision(9) << showpoint;
-    *out << x[0] << "\t" << x[1] << "\t" << x[2];
+    *out << at(0) << "\t" << at(1) << "\t" << at(2);
     *out << "\t" << FixedIon;
-    if (v.Norm() > MYEPSILON)
-      *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";
+    if (AtomicVelocity.Norm() > MYEPSILON)
+      *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t";
     if (comment != NULL)
       *out << " # " << comment << endl;
@@ -161,13 +178,15 @@
   * \return true - \a *out present, false - \a *out is NULL
  */
-bool atom::OutputArrayIndexed(ostream * const out, const int *ElementNo, int *AtomNo, const char *comment) const
-{
-  AtomNo[type->Z]++;  // increment number
+bool atom::OutputArrayIndexed(ostream * const out,const enumeration<const element*> &elementLookup, int *AtomNo, const char *comment) const
+{
+  AtomNo[getType()->getAtomicNumber()]++;  // increment number
   if (out != NULL) {
-    *out << "Ion_Type" << ElementNo[type->Z] << "_" << AtomNo[type->Z] << "\t"  << fixed << setprecision(9) << showpoint;
-    *out << x[0] << "\t" << x[1] << "\t" << x[2];
+    const element *elemental = getType();
+    ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
+    *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental->getAtomicNumber()] << "\t"  << fixed << setprecision(9) << showpoint;
+    *out << at(0) << "\t" << at(1) << "\t" << at(2);
     *out << "\t" << FixedIon;
-    if (v.Norm() > MYEPSILON)
-      *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";
+    if (AtomicVelocity.Norm() > MYEPSILON)
+      *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t";
     if (comment != NULL)
       *out << " # " << comment << endl;
@@ -186,5 +205,5 @@
 {
   if (out != NULL) {
-    *out << type->symbol << "\t" << x[0] << "\t" << x[1] << "\t" << x[2] << "\t" << endl;
+    *out << getType()->getSymbol() << "\t" << at(0) << "\t" << at(1) << "\t" << at(2) << "\t" << endl;
     return true;
   } else
@@ -199,9 +218,11 @@
   * \return true - \a *out present, false - \a *out is NULL
  */
-bool atom::OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const
-{
-  AtomNo[type->Z]++;
+bool atom::OutputTrajectory(ofstream * const out, const enumeration<const element*> &elementLookup, int *AtomNo, const int step) const
+{
+  AtomNo[getType()->getAtomicNumber()]++;
   if (out != NULL) {
-    *out << "Ion_Type" << ElementNo[type->Z] << "_" << AtomNo[type->Z] << "\t"  << fixed << setprecision(9) << showpoint;
+    const element *elemental = getType();
+    ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
+    *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[getType()->getAtomicNumber()] << "\t"  << fixed << setprecision(9) << showpoint;
     *out << Trajectory.R.at(step)[0] << "\t" << Trajectory.R.at(step)[1] << "\t" << Trajectory.R.at(step)[2];
     *out << "\t" << FixedIon;
@@ -224,5 +245,5 @@
 {
   if (out != NULL) {
-    *out << type->symbol << "\t";
+    *out << getType()->getSymbol() << "\t";
     *out << Trajectory.R.at(step)[0] << "\t";
     *out << Trajectory.R.at(step)[1] << "\t";
@@ -238,9 +259,9 @@
  * \param *AtomNo pointer to atom counter that is increased by one
  */
-void atom::OutputMPQCLine(ostream * const out, const Vector *center, int *AtomNo = NULL) const
-{
-  *out << "\t\t" << type->symbol << " [ " << x[0]-center->at(0) << "\t" << x[1]-center->at(1) << "\t" << x[2]-center->at(2) << " ]" << endl;
-  if (AtomNo != NULL)
-    *AtomNo++;
+void atom::OutputMPQCLine(ostream * const out, const Vector *center) const
+{
+  Vector recentered(getPosition());
+  recentered -= *center;
+  *out << "\t\t" << getType()->getSymbol() << " [ " << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " ]" << endl;
 };
 
@@ -263,5 +284,5 @@
 double atom::DistanceSquaredToVector(const Vector &origin) const
 {
-  return origin.DistanceSquared(x);
+  return DistanceSquared(origin);
 };
 
@@ -272,5 +293,5 @@
 double atom::DistanceToVector(const Vector &origin) const
 {
-  return origin.distance(x);
+  return distance(origin);
 };
 
@@ -287,4 +308,21 @@
 };
 
+void atom::resetGraphNr(){
+  GraphNr=-1;
+}
+
+std::ostream & atom::operator << (std::ostream &ost) const
+{
+  ParticleInfo::operator<<(ost);
+  ost << "," << getPosition();
+  return ost;
+}
+
+std::ostream & operator << (std::ostream &ost, const atom &a)
+{
+  a.ParticleInfo::operator<<(ost);
+  ost << "," << a.getPosition();
+  return ost;
+}
 
 bool operator < (atom &a, atom &b)
@@ -321,4 +359,8 @@
 }
 
+/** Makes the atom be contained in the new molecule \a *_mol.
+ * Uses atom::removeFromMolecule() to delist from old molecule.
+ * \param *_mol pointer to new molecule
+ */
 void atom::setMolecule(molecule *_mol){
   // take this atom from the old molecule
@@ -326,12 +368,17 @@
   mol = _mol;
   if(!mol->containsAtom(this)){
-    mol->AddAtom(this);
-  }
-}
-
-molecule* atom::getMolecule(){
+    mol->insert(this);
+  }
+}
+
+/** Returns pointer to the molecule which atom belongs to.
+ * \return containing molecule
+ */
+molecule* atom::getMolecule() const {
   return mol;
 }
 
+/** Erases the atom in atom::mol's list of atoms and sets it to zero.
+ */
 void atom::removeFromMolecule(){
   if(mol){
@@ -343,4 +390,11 @@
 }
 
+double atom::getMass() const{
+  return getType()->getMass();
+}
+
+int atom::getNr() const{
+  return nr;
+}
 
 atom* NewAtom(atomId_t _id){
@@ -353,2 +407,6 @@
   delete atom;
 }
+
+bool compareAtomElements(atom* atom1,atom* atom2){
+  return atom1->getType()->getNumber() < atom2->getType()->getNumber();
+}
Index: src/atom.hpp
===================================================================
--- src/atom.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -22,4 +22,5 @@
 #include <vector>
 
+#include "Helpers/helpers.hpp"
 #include "atom_atominfo.hpp"
 #include "atom_bondedparticle.hpp"
@@ -27,5 +28,5 @@
 #include "atom_particleinfo.hpp"
 #include "atom_trajectoryparticle.hpp"
-#include "tesselation.hpp"
+#include "TesselPoint.hpp"
 #include "types.hpp"
 
@@ -42,5 +43,5 @@
  * Class incorporates position, type
  */
-class atom : public TesselPoint, public TrajectoryParticle, public GraphNode, public BondedParticle, public virtual ParticleInfo, public virtual AtomInfo {
+class atom : public TrajectoryParticle, public GraphNode, public BondedParticle, public TesselPoint {
   friend atom* NewAtom(atomId_t);
   friend void  DeleteAtom(atom*);
@@ -52,13 +53,15 @@
 
   bool OutputIndexed(ofstream * const out, const int ElementNo, const int AtomNo, const char *comment = NULL) const;
-  bool OutputArrayIndexed(ostream * const out, const int *ElementNo, int *AtomNo, const char *comment = NULL) const;
+  bool OutputArrayIndexed(ostream * const out,const enumeration<const element*>&, int *AtomNo, const char *comment = NULL) const;
   bool OutputXYZLine(ofstream *out) const;
-  bool OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const;
+  bool OutputTrajectory(ofstream * const out, const enumeration<const element*>&, int *AtomNo, const int step) const;
   bool OutputTrajectoryXYZ(ofstream * const out, const int step) const;
-  void OutputMPQCLine(ostream * const out, const Vector *center, int *AtomNo) const;
+  void OutputMPQCLine(ostream * const out, const Vector *center) const;
 
   void InitComponentNr();
+  void resetGraphNr();
 
   void EqualsFather ( const atom *ptr, const atom **res ) const;
+  bool isFather(const atom *ptr);
   void CorrectFather();
   atom *GetTrueFather();
@@ -90,6 +93,12 @@
 
    void setMolecule(molecule*);
-   molecule* getMolecule();
+   molecule* getMolecule() const;
    void removeFromMolecule();
+
+   double getMass() const;
+   int getNr() const;
+
+   // Output operator
+   std::ostream & operator << (std::ostream &ost) const;
 
   protected:
@@ -119,4 +128,9 @@
 
 /**
+ * Global output operator for class atom.
+ */
+std::ostream & operator << (std::ostream &ost, const atom &_atom);
+
+/**
  * internal method used by the world. Do not use if you don't know what you are doing.
  * You might get burned...
@@ -132,4 +146,9 @@
 void  DeleteAtom(atom*);
 
+/**
+ * Simple function to compare atoms by their elements to allow sorting of atoms by this criteria
+ */
+bool compareAtomElements(atom* atom1,atom* atom2);
+
 
 #endif /* ATOM_HPP_ */
Index: src/atom_atominfo.cpp
===================================================================
--- src/atom_atominfo.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_atominfo.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * atom_atominfo.cpp
@@ -6,13 +13,33 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
 #include "periodentafel.hpp"
 #include "World.hpp"
+#include "element.hpp"
 #include "atom_atominfo.hpp"
 
 /** Constructor of class AtomInfo.
  */
-AtomInfo::AtomInfo() : type(NULL) {};
+AtomInfo::AtomInfo() :
+  AtomicElement(NULL)
+{};
+
+/** Copy constructor of class AtomInfo.
+ */
+AtomInfo::AtomInfo(const AtomInfo &_atom) :
+    AtomicPosition(_atom.AtomicPosition),
+    AtomicElement(_atom.AtomicElement)
+{};
+
+AtomInfo::AtomInfo(const VectorInterface &_v) :
+    AtomicPosition(_v.getPosition()),
+    AtomicElement(NULL)
+{};
 
 /** Destructor of class AtomInfo.
@@ -22,14 +49,155 @@
 };
 
-const element *AtomInfo::getType(){
-  return type;
+const element *AtomInfo::getType() const
+{
+  return AtomicElement;
+}
+
+const double& AtomInfo::operator[](size_t i) const
+{
+  return AtomicPosition[i];
+}
+
+const double& AtomInfo::at(size_t i) const
+{
+  return AtomicPosition.at(i);
+}
+
+void AtomInfo::set(size_t i, const double value)
+{
+  AtomicPosition.at(i) = value;
+}
+
+const Vector& AtomInfo::getPosition() const
+{
+  return AtomicPosition;
 }
 
 void AtomInfo::setType(const element* _type) {
-  type = _type;
-}
-
-void AtomInfo::setType(int Z) {
+  AtomicElement = _type;
+}
+
+void AtomInfo::setType(const int Z) {
   const element *elem = World::getInstance().getPeriode()->FindElement(Z);
   setType(elem);
 }
+
+void AtomInfo::setPosition(const Vector& _vector)
+{
+  AtomicPosition = _vector;
+  //cout << "AtomInfo::setPosition: " << getType()->symbol << " at " << getPosition() << endl;
+}
+
+const VectorInterface& AtomInfo::operator+=(const Vector& b)
+{
+  AtomicPosition += b;
+  return *this;
+}
+
+const VectorInterface& AtomInfo::operator-=(const Vector& b)
+{
+  AtomicPosition -= b;
+  return *this;
+}
+
+Vector const AtomInfo::operator+(const Vector& b) const
+{
+  Vector a(AtomicPosition);
+  a += b;
+  return a;
+}
+
+Vector const AtomInfo::operator-(const Vector& b) const
+{
+  Vector a(AtomicPosition);
+  a -= b;
+  return a;
+}
+
+double AtomInfo::distance(const Vector &point) const
+{
+  return AtomicPosition.distance(point);
+}
+
+double AtomInfo::DistanceSquared(const Vector &y) const
+{
+  return AtomicPosition.DistanceSquared(y);
+}
+
+double AtomInfo::distance(const VectorInterface &_atom) const
+{
+  return _atom.distance(AtomicPosition);
+}
+
+double AtomInfo::DistanceSquared(const VectorInterface &_atom) const
+{
+  return _atom.DistanceSquared(AtomicPosition);
+}
+
+VectorInterface &AtomInfo::operator=(const Vector& _vector)
+{
+  AtomicPosition = _vector;
+  return *this;
+}
+
+void AtomInfo::ScaleAll(const double *factor)
+{
+  AtomicPosition.ScaleAll(factor);
+}
+
+void AtomInfo::ScaleAll(const Vector &factor)
+{
+  AtomicPosition.ScaleAll(factor);
+}
+
+void AtomInfo::Scale(const double factor)
+{
+  AtomicPosition.Scale(factor);
+}
+
+void AtomInfo::Zero()
+{
+  AtomicPosition.Zero();
+}
+
+void AtomInfo::One(const double one)
+{
+  AtomicPosition.One(one);
+}
+
+void AtomInfo::LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors)
+{
+  AtomicPosition.LinearCombinationOfVectors(x1,x2,x3,factors);
+}
+
+const AtomInfo& operator*=(AtomInfo& a, const double m)
+{
+  a.Scale(m);
+  return a;
+}
+
+AtomInfo const operator*(const AtomInfo& a, const double m)
+{
+  AtomInfo copy(a);
+  copy *= m;
+  return copy;
+}
+
+AtomInfo const operator*(const double m, const AtomInfo& a)
+{
+  AtomInfo copy(a);
+  copy *= m;
+  return copy;
+}
+
+std::ostream & AtomInfo::operator << (std::ostream &ost) const
+{
+  return (ost << getPosition());
+}
+
+std::ostream & operator << (std::ostream &ost, const AtomInfo &a)
+{
+  ost << a;
+  return ost;
+}
+
Index: src/atom_atominfo.hpp
===================================================================
--- src/atom_atominfo.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_atominfo.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -19,28 +19,73 @@
 #endif
 
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/VectorInterface.hpp"
 
 /****************************************** forward declarations *****************************/
 
+class AtomInfo;
 class element;
+class Matrix;
 
 /********************************************** declarations *******************************/
 
-class AtomInfo {
+class AtomInfo : public VectorInterface {
+
 public:
-  Vector x;       //!< coordinate vector of atom, giving last position within cell
-  Vector v;       //!< velocity vector of atom, giving last velocity within cell
-  Vector F;       //!< Force vector of atom, giving last force within cell
-  const element *type;  //!< pointing to element
+  Vector AtomicVelocity;       //!< velocity vector of atom, giving last velocity within cell
+  Vector AtomicForce;       //!< Force vector of atom, giving last force within cell
 
   AtomInfo();
-  ~AtomInfo();
+  AtomInfo(const AtomInfo &_atom);
+  AtomInfo(const VectorInterface &_v);
+  virtual ~AtomInfo();
 
-  const element *getType();
+  const element *getType() const;
   void setType(const element *);
-  void setType(int);
+  void setType(const int);
+
+  ///// manipulation of the atomic position
+
+  // Accessors ussually come in pairs... and sometimes even more than that
+  const double& operator[](size_t i) const;
+  const double& at(size_t i) const;
+  void set(size_t i, const double value);
+  const Vector& getPosition() const;
+
+  // Assignment operator
+  void setPosition(const Vector& _vector);
+  class VectorInterface &operator=(const Vector& _vector);
+
+  // operators for mathematical operations
+  const VectorInterface& operator+=(const Vector& b);
+  const VectorInterface& operator-=(const Vector& b);
+  Vector const operator+(const Vector& b) const;
+  Vector const operator-(const Vector& b) const;
+
+  void Zero();
+  void One(const double one);
+  void LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors);
+
+  double distance(const Vector &point) const;
+  double DistanceSquared(const Vector &y) const;
+  double distance(const VectorInterface &_atom) const;
+  double DistanceSquared(const VectorInterface &_atom) const;
+
+  void ScaleAll(const double *factor);
+  void ScaleAll(const Vector &factor);
+  void Scale(const double factor);
+
+  std::ostream & operator << (std::ostream &ost) const;
 
 private:
+  Vector AtomicPosition;       //!< coordinate vector of atom, giving last position within cell
+  const element *AtomicElement;  //!< pointing to element
 };
 
+std::ostream & operator << (std::ostream &ost, const AtomInfo &a);
+
+const AtomInfo& operator*=(AtomInfo& a, const double m);
+AtomInfo const operator*(const AtomInfo& a, const double m);
+AtomInfo const operator*(const double m, const AtomInfo& a);
+
 #endif /* ATOM_ATOMINFO_HPP_ */
Index: src/atom_bondedparticle.cpp
===================================================================
--- src/atom_bondedparticle.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_bondedparticle.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * atom_bondedparticle.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -13,6 +25,6 @@
 #include "element.hpp"
 #include "lists.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 
 /** Constructor of class BondedParticle.
@@ -152,10 +164,10 @@
   NoBonds = CountBonds();
   //Log() << Verbose(3) << "Walker " << *this << ": " << (int)this->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
-  if ((int)(type->NoValenceOrbitals) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch
+  if ((int)(getType()->getNoValenceOrbitals()) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch
     for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) {
       OtherWalker = (*Runner)->GetOtherAtom(this);
       OtherNoBonds = OtherWalker->CountBonds();
       //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << OtherNoBonds << "?" << endl;
-      if ((int)(OtherWalker->type->NoValenceOrbitals) > OtherNoBonds) { // check if possible candidate
+      if ((int)(OtherWalker->getType()->getNoValenceOrbitals()) > OtherNoBonds) { // check if possible candidate
         if ((CandidateBond == NULL) || (ListOfBonds.size() > OtherWalker->ListOfBonds.size())) { // pick the one with fewer number of bonds first
           CandidateBond = (*Runner);
@@ -189,2 +201,16 @@
 };
 
+std::ostream & BondedParticle::operator << (std::ostream &ost) const
+{
+  ParticleInfo::operator<<(ost);
+  ost << "," << getPosition();
+  return ost;
+}
+
+std::ostream & operator << (std::ostream &ost, const BondedParticle &a)
+{
+  a.ParticleInfo::operator<<(ost);
+  ost << "," << a.getPosition();
+  return ost;
+}
+
Index: src/atom_bondedparticle.hpp
===================================================================
--- src/atom_bondedparticle.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_bondedparticle.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -49,8 +49,11 @@
   void OutputOrder(ofstream *file) const;
 
+  std::ostream & operator << (std::ostream &ost) const;
+
 private:
 
 };
 
+std::ostream & operator << (std::ostream &ost, const BondedParticle &a);
 
 #endif /* ATOM_BONDEDPARTICLE_HPP_ */
Index: src/atom_bondedparticleinfo.cpp
===================================================================
--- src/atom_bondedparticleinfo.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_bondedparticleinfo.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * atom_bondedparticleinfo.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -12,5 +24,8 @@
 /** Constructor of class BondedParticleInfo.
  */
-BondedParticleInfo::BondedParticleInfo() : AdaptiveOrder(0), MaxOrder(false) {};
+BondedParticleInfo::BondedParticleInfo() :
+  AdaptiveOrder(0),
+  MaxOrder(false)
+{};
 
 /** Destructor of class BondedParticleInfo.
Index: src/atom_bondedparticleinfo.hpp
===================================================================
--- src/atom_bondedparticleinfo.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_bondedparticleinfo.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -36,5 +36,5 @@
 
   BondedParticleInfo();
-  ~BondedParticleInfo();
+  virtual ~BondedParticleInfo();
 
 private:
Index: src/atom_graphnode.cpp
===================================================================
--- src/atom_graphnode.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_graphnode.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * atom_graphnode.cpp
@@ -6,9 +13,16 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
+#include <iostream>
+
 #include "atom_graphnode.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 
 /** Constructor of class GraphNode.
@@ -29,6 +43,5 @@
 void GraphNode::OutputGraphInfo() const
 {
-  DoLog(2) && (Log() << Verbose(2) << "Atom " << getName() << " is " << ((SeparationVertex) ? "a" : "not a") << " separation vertex, components are ");
-  OutputComponentNumber();
+  DoLog(2) && (Log() << Verbose(2) << "Atom " << getName() << " is " << ((SeparationVertex) ? "a" : "not a") << " separation vertex, components are " << *this);
   DoLog(3) && (Log() << Verbose(3) << " with Lowpoint " << LowpointNr << " and Graph Nr. " << GraphNr << "." << endl);
 };
@@ -38,10 +51,15 @@
  * \param *out output stream for debugging
  */
-void GraphNode::OutputComponentNumber() const
+void GraphNode::OutputComponentNumber(ostream *out) const
 {
-  if (ComponentNr != NULL) {
-    for (int i=0; ComponentNr[i] != -1; i++)
-      DoLog(2) && (Log() << Verbose(2) << ComponentNr[i] << " ");
-  }
+  *out << *this;
 };
 
+ostream &operator<<(ostream &out, const GraphNode &a)
+{
+  if (a.ComponentNr != NULL) {
+    for (int i=0; a.ComponentNr[i] != -1; i++)
+      out << a.ComponentNr[i];
+  }
+  return out;
+}
Index: src/atom_graphnode.hpp
===================================================================
--- src/atom_graphnode.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_graphnode.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -19,5 +19,5 @@
 #endif
 
-#include <fstream>
+#include <iosfwd>
 
 #include "atom_graphnodeinfo.hpp"
@@ -35,5 +35,5 @@
 
   void OutputGraphInfo() const;
-  void OutputComponentNumber() const;
+  void OutputComponentNumber(ostream *out) const;
 
 private:
@@ -41,3 +41,5 @@
 };
 
+ostream &operator<<(ostream &out, const GraphNode &a);
+
 #endif /* ATOM_GRAPHNODE_HPP_ */
Index: src/atom_graphnodeinfo.cpp
===================================================================
--- src/atom_graphnodeinfo.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_graphnodeinfo.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * atom_graphnodeinfo.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -12,5 +24,12 @@
 /** Constructor of class GraphNodeInfo.
  */
-GraphNodeInfo::GraphNodeInfo() : GraphNr(-1), ComponentNr(0), LowpointNr(-1), SeparationVertex(false), IsCyclic(false), Ancestor(0) {};
+GraphNodeInfo::GraphNodeInfo() :
+  GraphNr(-1),
+  ComponentNr(0),
+  LowpointNr(-1),
+  SeparationVertex(false),
+  IsCyclic(false),
+  Ancestor(0)
+{};
 
 /** Destructor of class GraphNodeInfo.
Index: src/atom_graphnodeinfo.hpp
===================================================================
--- src/atom_graphnodeinfo.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_graphnodeinfo.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -37,5 +37,5 @@
 
   GraphNodeInfo();
-  ~GraphNodeInfo();
+  virtual ~GraphNodeInfo();
 private:
 
Index: src/atom_particleinfo.cpp
===================================================================
--- src/atom_particleinfo.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_particleinfo.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * atom_particleinfo.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -14,11 +26,13 @@
 /** Constructor of ParticleInfo.
  */
-ParticleInfo::ParticleInfo() : nr(-1), name("Unknown") {
-};
+ParticleInfo::ParticleInfo() :
+  nr(-1),
+  name("Unknown")
+{};
 
 ParticleInfo::ParticleInfo(ParticleInfo *pointer) :
-    nr(pointer->nr),
-    name(pointer->name)
-    {}
+  nr(pointer->nr),
+  name(pointer->name)
+{}
 
 
@@ -38,5 +52,5 @@
 ostream & operator << (ostream &ost, const ParticleInfo &a)
 {
-  ost << "[" << a.getName() << "|" << &a << "]";
+  ost << a.getName();
   return ost;
 };
@@ -44,5 +58,5 @@
 ostream & ParticleInfo::operator << (ostream &ost) const
 {
-  ost << "[" << name << "|" << this << "]";
+  ost << getName();
   return ost;
 };
Index: src/atom_particleinfo.hpp
===================================================================
--- src/atom_particleinfo.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_particleinfo.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -32,5 +32,5 @@
   ParticleInfo();
   ParticleInfo(ParticleInfo*);
-  ~ParticleInfo();
+  virtual ~ParticleInfo();
 
   const std::string& getName() const;
Index: src/atom_trajectoryparticle.cpp
===================================================================
--- src/atom_trajectoryparticle.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_trajectoryparticle.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * atom_trajectoryparticle.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -12,9 +24,9 @@
 #include "config.hpp"
 #include "element.hpp"
-#include "info.hpp"
-#include "log.hpp"
+#include "Helpers/Info.hpp"
+#include "Helpers/Log.hpp"
 #include "parser.hpp"
 #include "ThermoStatContainer.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 
 /** Constructor of class TrajectoryParticle.
@@ -30,14 +42,14 @@
 };
 
+/**
+ *  returns the kinetic energy of this atom at a given time step
+ */
+double TrajectoryParticle::getKineticEnergy(unsigned int step) const{
+  return getType()->getMass() * Trajectory.U.at(step).NormSquared();
+}
 
-/** Adds kinetic energy of this atom to given temperature value.
- * \param *temperature add on this value
- * \param step given step of trajectory to add
- */
-void TrajectoryParticle::AddKineticToTemperature(double *temperature, int step) const
-{
-  for (int i=NDIM;i--;)
-    *temperature += type->mass * Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i];
-};
+Vector TrajectoryParticle::getMomentum(unsigned int step) const{
+  return getType()->getMass()*Trajectory.U.at(step);
+}
 
 /** Evaluates some constraint potential if atom moves from \a startstep at once to \endstep in trajectory.
@@ -54,17 +66,4 @@
   for (int i=NDIM;i++;)
     Force->Matrix[0][nr][5+i] += 2.*constant*sqrt(Trajectory.R.at(startstep).distance(Sprinter->Trajectory.R.at(endstep)));
-};
-
-/** Correct velocity against the summed \a CoGVelocity for \a step.
- * \param *ActualTemp sum up actual temperature meanwhile
- * \param Step MD step in atom::Tracjetory
- * \param *CoGVelocity remnant velocity (i.e. vector sum of all atom velocities)
- */
-void TrajectoryParticle::CorrectVelocity(double *ActualTemp, int Step, Vector *CoGVelocity)
-{
-  for(int d=0;d<NDIM;d++) {
-    Trajectory.U.at(Step)[d] -= CoGVelocity->at(d);
-    *ActualTemp += 0.5 * type->mass * Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d];
-  }
 };
 
@@ -113,10 +112,10 @@
     Trajectory.R.at(NextStep)[d] = Trajectory.R.at(NextStep-1)[d];
     Trajectory.R.at(NextStep)[d] += configuration->Deltat*(Trajectory.U.at(NextStep-1)[d]);     // s(t) = s(0) + v * deltat + 1/2 a * deltat^2
-    Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/type->mass);     // F = m * a and s =
+    Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/getType()->getMass());     // F = m * a and s =
   }
   // Update U
   for (int d=0; d<NDIM; d++) {
     Trajectory.U.at(NextStep)[d] = Trajectory.U.at(NextStep-1)[d];
-    Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/type->mass); // v = F/m * t
+    Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/getType()->getMass()); // v = F/m * t
   }
   // Update R (and F)
@@ -130,133 +129,16 @@
 };
 
-/** Sums up mass and kinetics.
- * \param Step step to sum for
- * \param *TotalMass pointer to total mass sum
- * \param *TotalVelocity pointer to tota velocity sum
- */
-void TrajectoryParticle::SumUpKineticEnergy( int Step, double *TotalMass, Vector *TotalVelocity ) const
+std::ostream & TrajectoryParticle::operator << (std::ostream &ost) const
 {
-  *TotalMass += type->mass;  // sum up total mass
-  for(int d=0;d<NDIM;d++) {
-    TotalVelocity->at(d) += Trajectory.U.at(Step)[d]*type->mass;
-  }
-};
+  ParticleInfo::operator<<(ost);
+  ost << "," << getPosition();
+  return ost;
+}
 
-/** Scales velocity of atom according to Woodcock thermostat.
- * \param ScaleTempFactor factor to scale the velocities with (i.e. sqrt of energy scale factor)
- * \param Step MD step to scale
- * \param *ekin sum of kinetic energy
- */
-void TrajectoryParticle::Thermostat_Woodcock(double ScaleTempFactor, int Step, double *ekin)
+std::ostream & operator << (std::ostream &ost, const TrajectoryParticle &a)
 {
-  Vector &U = Trajectory.U.at(Step);
-  if (FixedIon == 0) // even FixedIon moves, only not by other's forces
-    for (int d=0; d<NDIM; d++) {
-      U[d] *= ScaleTempFactor;
-      *ekin += 0.5*type->mass * U[d]*U[d];
-    }
-};
+  a.ParticleInfo::operator<<(ost);
+  ost << "," << a.getPosition();
+  return ost;
+}
 
-/** Scales velocity of atom according to Gaussian thermostat.
- * \param Step MD step to scale
- * \param *G
- * \param *E
- */
-void TrajectoryParticle::Thermostat_Gaussian_init(int Step, double *G, double *E)
-{
-  Vector &U = Trajectory.U.at(Step);
-  Vector &F = Trajectory.F.at(Step);
-  if (FixedIon == 0) // even FixedIon moves, only not by other's forces
-    for (int d=0; d<NDIM; d++) {
-      *G += U[d] * F[d];
-      *E += U[d]*U[d]*type->mass;
-    }
-};
-
-/** Determines scale factors according to Gaussian thermostat.
- * \param Step MD step to scale
- * \param GE G over E ratio
- * \param *ekin sum of kinetic energy
- * \param *configuration configuration class with TempFrequency and TargetTemp
- */
-void TrajectoryParticle::Thermostat_Gaussian_least_constraint(int Step, double G_over_E, double *ekin, config *configuration)
-{
-  Vector &U = Trajectory.U.at(Step);
-  if (FixedIon == 0) // even FixedIon moves, only not by other's forces
-    for (int d=0; d<NDIM; d++) {
-      U[d] += configuration->Deltat/type->mass * ( (G_over_E) * (U[d]*type->mass) );
-      *ekin += type->mass * U[d]*U[d];
-    }
-};
-
-/** Scales velocity of atom according to Langevin thermostat.
- * \param Step MD step to scale
- * \param *r random number generator
- * \param *ekin sum of kinetic energy
- * \param *configuration configuration class with TempFrequency and TargetTemp
- */
-void TrajectoryParticle::Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration)
-{
-  double sigma  = sqrt(configuration->Thermostats->TargetTemp/type->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
-  Vector &U = Trajectory.U.at(Step);
-  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
-    // throw a dice to determine whether it gets hit by a heat bath particle
-    if (((((rand()/(double)RAND_MAX))*configuration->Thermostats->TempFrequency) < 1.)) {
-      DoLog(3) && (Log() << Verbose(3) << "Particle " << *this << " was hit (sigma " << sigma << "): " << sqrt(U[0]*U[0]+U[1]*U[1]+U[2]*U[2]) << " -> ");
-      // pick three random numbers from a Boltzmann distribution around the desired temperature T for each momenta axis
-      for (int d=0; d<NDIM; d++) {
-        U[d] = gsl_ran_gaussian (r, sigma);
-      }
-      DoLog(2) && (Log() << Verbose(2) << sqrt(U[0]*U[0]+U[1]*U[1]+U[2]*U[2]) << endl);
-    }
-    for (int d=0; d<NDIM; d++)
-      *ekin += 0.5*type->mass * U[d]*U[d];
-  }
-};
-
-/** Scales velocity of atom according to Berendsen thermostat.
- * \param Step MD step to scale
- * \param ScaleTempFactor factor to scale energy (not velocity!) with
- * \param *ekin sum of kinetic energy
- * \param *configuration configuration class with TempFrequency and Deltat
- */
-void TrajectoryParticle::Thermostat_Berendsen(int Step, double ScaleTempFactor, double *ekin, config *configuration)
-{
-  Vector &U = Trajectory.U.at(Step);
-  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
-    for (int d=0; d<NDIM; d++) {
-      U[d] *= sqrt(1+(configuration->Deltat/configuration->Thermostats->TempFrequency)*(ScaleTempFactor-1));
-      *ekin += 0.5*type->mass * U[d]*U[d];
-    }
-  }
-};
-
-/** Initializes current run of NoseHoover thermostat.
- * \param Step MD step to scale
- * \param *delta_alpha additional sum of kinetic energy on return
- */
-void TrajectoryParticle::Thermostat_NoseHoover_init(int Step, double *delta_alpha)
-{
-  Vector &U = Trajectory.U.at(Step);
-  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
-    for (int d=0; d<NDIM; d++) {
-      *delta_alpha += U[d]*U[d]*type->mass;
-    }
-  }
-};
-
-/** Initializes current run of NoseHoover thermostat.
- * \param Step MD step to scale
- * \param *ekin sum of kinetic energy
- * \param *configuration configuration class with TempFrequency and Deltat
- */
-void TrajectoryParticle::Thermostat_NoseHoover_scale(int Step, double *ekin, config *configuration)
-{
-  Vector &U = Trajectory.U.at(Step);
-  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
-    for (int d=0; d<NDIM; d++) {
-        U[d] += configuration->Deltat/type->mass * (configuration->Thermostats->alpha * (U[d] * type->mass));
-        *ekin += (0.5*type->mass) * U[d]*U[d];
-      }
-  }
-};
Index: src/atom_trajectoryparticle.hpp
===================================================================
--- src/atom_trajectoryparticle.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_trajectoryparticle.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -20,5 +20,4 @@
 #include <fstream>
 
-#include <gsl/gsl_inline.h>
 #include <gsl/gsl_randist.h>
 
@@ -44,7 +43,5 @@
 
   // constraint potential and dynamics stuff
-  void AddKineticToTemperature(double *temperature, int step) const;
   void EvaluateConstrainedForce(int startstep, int endstep, atom **PermutationMap, ForceMatrix *Force) const;
-  void CorrectVelocity(double *ActualTemp, int Step, Vector *CoGVelocity);
 
   // trajectory stuff
@@ -52,19 +49,13 @@
   void CopyStepOnStep(int dest, int src);
   void VelocityVerletUpdate(int MDSteps, config *configuration, ForceMatrix *Force, const size_t offset);
-  void SumUpKineticEnergy( int Step, double *TotalMass, Vector *TotalVelocity ) const;
+  double getKineticEnergy(unsigned int step) const;
+  Vector getMomentum(unsigned int step) const;
 
-  // thermostats
-  void Thermostat_Woodcock(double ScaleTempFactor, int Step, double *ekin);
-  void Thermostat_Gaussian_init(int Step, double *G, double *E);
-  void Thermostat_Gaussian_least_constraint(int Step, double G_over_E, double *ekin, config *configuration);
-  void Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration);
-  void Thermostat_Berendsen(int Step, double ScaleTempFactor, double *ekin, config *configuration);
-  void Thermostat_NoseHoover_init(int Step, double *delta_alpha);
-  void Thermostat_NoseHoover_scale(int Step, double *ekin, config *configuration);
+  std::ostream & operator << (std::ostream &ost) const;
 
 private:
-
 };
 
+ostream & operator << (ostream &ost, const TrajectoryParticle &a);
 
 #endif /* ATOM_TRAJECTORYPARTICLE_HPP_ */
Index: src/atom_trajectoryparticleinfo.cpp
===================================================================
--- src/atom_trajectoryparticleinfo.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_trajectoryparticleinfo.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * atom_trajectoryparticleinfo.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -12,5 +24,7 @@
 /** Constructor of class TrajectoryParticleInfo.
  */
-TrajectoryParticleInfo::TrajectoryParticleInfo() : FixedIon(0) {};
+TrajectoryParticleInfo::TrajectoryParticleInfo() :
+  FixedIon(0)
+{};
 
 /** Destructor of class TrajectoryParticleInfo.
Index: src/atom_trajectoryparticleinfo.hpp
===================================================================
--- src/atom_trajectoryparticleinfo.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/atom_trajectoryparticleinfo.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -20,6 +20,6 @@
 #include <vector>
 
-#include "vector.hpp"
-#include "VectorSet.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/VectorSet.hpp"
 
 /********************************************** declarations *******************************/
@@ -36,5 +36,5 @@
 
   TrajectoryParticleInfo();
-  ~TrajectoryParticleInfo();
+  virtual ~TrajectoryParticleInfo();
 
 private:
Index: src/bond.cpp
===================================================================
--- src/bond.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/bond.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file bond.cpp
  * 
@@ -5,7 +12,13 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
-#include "verbose.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "atom.hpp"
 #include "bond.hpp"
@@ -18,9 +31,16 @@
 /** Empty Constructor for class bond.
  */
-bond::bond()
-  : leftatom(NULL), rightatom(NULL), previous(NULL), next(NULL), HydrogenBond(0),
-    BondDegree(0), nr(-1), Cyclic(false), Type(Undetermined), Used(white)
-{
-};
+bond::bond() :
+  leftatom(NULL),
+  rightatom(NULL),
+  previous(NULL),
+  next(NULL),
+  HydrogenBond(0),
+  BondDegree(0),
+  nr(-1),
+  Cyclic(false),
+  Type(Undetermined),
+  Used(white)
+{};
 
 /** Constructor for class bond, taking right and left bond partner
@@ -30,12 +50,20 @@
  * \param number increasing index
  */
-bond::bond(atom *left, atom *right, const int degree, const int number)
-  : leftatom(left), rightatom(right), previous(NULL), next(NULL), HydrogenBond(0),
-    BondDegree(degree), nr(number), Cyclic(false), Type(Undetermined), Used(white)
+bond::bond(atom *left, atom *right, const int degree, const int number) :
+  leftatom(left),
+  rightatom(right),
+  previous(NULL),
+  next(NULL),
+  HydrogenBond(0),
+  BondDegree(degree),
+  nr(number),
+  Cyclic(false),
+  Type(Undetermined),
+  Used(white)
 {
   if ((left != NULL) && (right != NULL)) {
-    if ((left->type != NULL) && (left->type->Z == 1))
+    if ((left->getType() != NULL) && (left->getType()->getAtomicNumber() == 1))
       HydrogenBond++;
-    if ((right->type != NULL) && (right->type->Z == 1))
+    if ((right->getType() != NULL) && (right->getType()->getAtomicNumber() == 1))
       HydrogenBond++;
   }
@@ -126,5 +154,5 @@
 double bond::GetDistance() const
 {
-  return (leftatom->node->distance(*rightatom->node));
+  return (leftatom->distance(*rightatom));
 };
 
@@ -134,4 +162,4 @@
 double bond::GetDistanceSquared() const
 {
-  return (leftatom->node->DistanceSquared(*rightatom->node));
+  return (leftatom->DistanceSquared(*rightatom));
 };
Index: src/bondgraph.cpp
===================================================================
--- src/bondgraph.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/bondgraph.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * bondgraph.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -14,18 +26,22 @@
 #include "bondgraph.hpp"
 #include "element.hpp"
-#include "info.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Info.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "parser.hpp"
 #include "periodentafel.hpp"
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
+const double BondGraph::BondThreshold = 0.4;   //!< CSD threshold in bond check which is the width of the interval whose center is the sum of the covalent radii
 
 /** Constructor of class BondGraph.
  * This classes contains typical bond lengths and thus may be used to construct a bond graph for a given molecule.
  */
-BondGraph::BondGraph(bool IsA) : BondLengthMatrix(NULL), max_distance(0), IsAngstroem(IsA)
-{
-};
+BondGraph::BondGraph(bool IsA) :
+    BondLengthMatrix(NULL),
+    max_distance(0),
+    IsAngstroem(IsA)
+{};
 
 /** Destructor of class BondGraph.
@@ -73,4 +89,5 @@
           max_distance = TempContainer->Matrix[0][i][j];
   }
+  max_distance += BondThreshold;
 
   if (status) // set to not NULL only if matrix was parsed
@@ -128,11 +145,21 @@
 
   for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
-    if ((*iter)->type->CovalentRadius > max_distance)
-      max_distance = (*iter)->type->CovalentRadius;
+    if ((*iter)->getType()->getCovalentRadius() > max_distance)
+      max_distance = (*iter)->getType()->getCovalentRadius();
   }
   max_distance *= 2.;
+  max_distance += BondThreshold;
 
   return max_distance;
 };
+
+/** Returns the maximum distance (e.g. necessary for LinkedCell).
+ * \return BondGraph::max_distance
+ */
+double BondGraph::getMaxDistance() const
+{
+  return max_distance;
+}
+
 
 /** Returns bond criterion for given pair based on covalent radius.
@@ -145,8 +172,8 @@
 void BondGraph::CovalentMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem)
 {
-  MinDistance = OtherWalker->type->CovalentRadius + Walker->type->CovalentRadius;
+  MinDistance = OtherWalker->getType()->getCovalentRadius() + Walker->getType()->getCovalentRadius();
   MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem;
-  MaxDistance = MinDistance + BONDTHRESHOLD;
-  MinDistance -= BONDTHRESHOLD;
+  MaxDistance = MinDistance + BondThreshold;
+  MinDistance -= BondThreshold;
 };
 
@@ -166,8 +193,8 @@
     CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
   } else {
-    MinDistance = GetBondLength(Walker->type->Z-1, OtherWalker->type->Z-1);
+    MinDistance = GetBondLength(Walker->getType()->getAtomicNumber()-1, OtherWalker->getType()->getAtomicNumber()-1);
     MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem;
-    MaxDistance = MinDistance + BONDTHRESHOLD;
-    MinDistance -= BONDTHRESHOLD;
-  }
-};
+    MaxDistance = MinDistance + BondThreshold;
+    MinDistance -= BondThreshold;
+  }
+};
Index: src/bondgraph.hpp
===================================================================
--- src/bondgraph.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/bondgraph.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -20,7 +20,4 @@
 #include <iosfwd>
 
-/*********************************************** defines ***********************************/
-
-#define BONDTHRESHOLD 0.4   //!< CSD threshold in bond check which is the width of the interval whose center is the sum of the covalent radii
 
 /****************************************** forward declarations *****************************/
@@ -47,5 +44,9 @@
   void CovalentMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem);
 
+  double getMaxDistance() const;
+
 private:
+  static const double BondThreshold;
+
   MatrixContainer *BondLengthMatrix;
   double max_distance;
Index: src/boundary.cpp
===================================================================
--- src/boundary.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/boundary.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file boundary.cpp
  *
@@ -4,6 +11,17 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
+#include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"
+#include "BoundaryPointSet.hpp"
+#include "BoundaryLineSet.hpp"
+#include "BoundaryTriangleSet.hpp"
+#include "CandidateForTesselation.hpp"
+//#include "TesselPoint.hpp"
 #include "World.hpp"
 #include "atom.hpp"
@@ -12,15 +30,15 @@
 #include "config.hpp"
 #include "element.hpp"
-#include "helpers.hpp"
-#include "info.hpp"
+#include "Helpers/helpers.hpp"
+#include "Helpers/Info.hpp"
 #include "linkedcell.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "tesselation.hpp"
 #include "tesselationhelpers.hpp"
 #include "World.hpp"
-#include "Plane.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Plane.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "Box.hpp"
 
@@ -86,5 +104,5 @@
               if (Neighbour == BoundaryPoints[axis].end()) // make it wrap around
                 Neighbour = BoundaryPoints[axis].begin();
-              DistanceVector = runner->second.second->x - Neighbour->second.second->x;
+              DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition());
               do { // seek for neighbour pair where it flips
                   OldComponent = DistanceVector[Othercomponent];
@@ -92,5 +110,5 @@
                   if (Neighbour == BoundaryPoints[axis].end()) // make it wrap around
                     Neighbour = BoundaryPoints[axis].begin();
-                  DistanceVector = runner->second.second->x - Neighbour->second.second->x;
+                  DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition());
                   //Log() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
                 } while ((runner != Neighbour) && (fabs(OldComponent / fabs(
@@ -104,5 +122,5 @@
                   //Log() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
                   // now we have found the pair: Neighbour and OtherNeighbour
-                  OtherVector = runner->second.second->x - OtherNeighbour->second.second->x;
+                  OtherVector = (runner->second.second->getPosition()) - (OtherNeighbour->second.second->getPosition());
                   //Log() << Verbose(1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;
                   //Log() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;
@@ -172,5 +190,5 @@
     // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours
     for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
-      ProjectedVector = (*iter)->x - (*MolCenter);
+      ProjectedVector = (*iter)->getPosition() - (*MolCenter);
       ProjectedVector.ProjectOntoPlane(AxisVector);
 
@@ -187,5 +205,5 @@
       }
     DoLog(1) && (Log() << Verbose(1) << "Inserting " << **iter << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl);
-      BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, (*iter))));
+      BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, TesselPointDistancePair (radius, (*iter))));
       if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity
         DoLog(2) && (Log() << Verbose(2) << "Encountered two vectors whose projection onto axis " << axis << " is equal: " << endl);
@@ -198,8 +216,7 @@
           DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl);
         } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) {
-          helper = (*iter)->x;
-          helper -= *MolCenter;
+          helper = (*iter)->getPosition() - (*MolCenter);
           const double oldhelperNorm = helper.NormSquared();
-          helper = BoundaryTestPair.first->second.second->x - (*MolCenter);
+          helper = BoundaryTestPair.first->second.second->getPosition() - (*MolCenter);
           if (helper.NormSquared() < oldhelperNorm) {
             BoundaryTestPair.first->second.second = (*iter);
@@ -254,17 +271,17 @@
         {
           Vector SideA, SideB, SideC, SideH;
-          SideA = left->second.second->x - (*MolCenter);
+          SideA = left->second.second->getPosition() - (*MolCenter);
           SideA.ProjectOntoPlane(AxisVector);
           //          Log() << Verbose(1) << "SideA: " << SideA << endl;
 
-          SideB = right->second.second->x -(*MolCenter);
+          SideB = right->second.second->getPosition() -(*MolCenter);
           SideB.ProjectOntoPlane(AxisVector);
           //          Log() << Verbose(1) << "SideB: " << SideB << endl;
 
-          SideC = left->second.second->x - right->second.second->x;
+          SideC = left->second.second->getPosition() - right->second.second->getPosition();
           SideC.ProjectOntoPlane(AxisVector);
           //          Log() << Verbose(1) << "SideC: " << SideC << endl;
 
-          SideH = runner->second.second->x -(*MolCenter);
+          SideH = runner->second.second->getPosition() -(*MolCenter);
           SideH.ProjectOntoPlane(AxisVector);
           //          Log() << Verbose(1) << "SideH: " << SideH << endl;
@@ -674,11 +691,12 @@
   double cellvolume = 0.;
 
-  // transform to PAS
-  mol->PrincipalAxisSystem(true);
+  // transform to PAS by Action
+  Vector MainAxis(0.,0.,1.);
+  MoleculeRotateToPrincipalAxisSystem(MainAxis);
 
   IsAngstroem = configuration->GetIsAngstroem();
   BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
   GreatestDiameter = GetDiametersOfCluster(BoundaryPoints, mol, TesselStruct, IsAngstroem);
-  LinkedCell *LCList = new LinkedCell(mol, 10.);
+  LinkedCell *LCList = new LinkedCell(*mol, 10.);
   FindConvexBorder(mol, BoundaryPoints, TesselStruct, (const LinkedCell *&)LCList, NULL);
   delete (LCList);
@@ -699,5 +717,5 @@
   // sum up the atomic masses
   for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
-      totalmass += (*iter)->type->mass;
+      totalmass += (*iter)->getType()->getMass();
   }
   DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl);
@@ -790,5 +808,5 @@
     if ((*ListRunner)->getAtomCount() > 0) {
       DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl);
-      LCList[(*ListRunner)] = new LinkedCell((*ListRunner), 10.); // get linked cell list
+      LCList[(*ListRunner)] = new LinkedCell(*(*ListRunner), 10.); // get linked cell list
       DoLog(1) && (Log() << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl);
       TesselStruct[(*ListRunner)] = NULL;
@@ -798,5 +816,4 @@
   // Center filler at origin
   filler->CenterEdge(&Inserter);
-  filler->Center.Zero();
   const int FillerCount = filler->getAtomCount();
   DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl);
@@ -855,5 +872,5 @@
 
           // ... and put at new position
-          Inserter = (*iter)->x;
+          Inserter = (*iter)->getPosition();
           if (DoRandomRotation)
             Inserter *= Rotations;
@@ -880,7 +897,7 @@
             // copy atom ...
             CopyAtoms[(*iter)->nr] = (*iter)->clone();
-            CopyAtoms[(*iter)->nr]->x = Inserter;
+            (*CopyAtoms[(*iter)->nr]).setPosition(Inserter);
             Filling->AddAtom(CopyAtoms[(*iter)->nr]);
-            DoLog(4) && (Log() << Verbose(4) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->x) << "." << endl);
+            DoLog(1) && (Log() << Verbose(1) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->getPosition()) << "." << endl);
           } else {
             DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl);
@@ -940,5 +957,5 @@
   // initialise Linked Cell
   if (LCList == NULL) {
-    LCList = new LinkedCell(mol, 2.*RADIUS);
+    LCList = new LinkedCell(*mol, 2.*RADIUS);
     freeLC = true;
   }
Index: src/boundary.hpp
===================================================================
--- src/boundary.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/boundary.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,6 +1,4 @@
 #ifndef BOUNDARY_HPP_
 #define BOUNDARY_HPP_
-
-using namespace std;
 
 /*********************************************** includes ***********************************/
@@ -18,8 +16,8 @@
 
 #include "defs.hpp"
+#include "BoundaryMaps.hpp"
 
 /****************************************** forward declarations *****************************/
 
-class atom;
 class BoundaryPointSet;
 class BoundaryLineSet;
@@ -30,19 +28,12 @@
 class MoleculeListClass;
 class Tesselation;
+class TesselPoint;
 class Vector;
 
 /********************************************** definitions *********************************/
 
-#define DEBUG 1
-#define DoSingleStepOutput 0
-#define SingleStepWidth 10
-
-#define DistancePair pair < double, atom* >
-#define DistanceMap multimap < double, atom* >
-#define DistanceTestPair pair < DistanceMap::iterator, bool>
-
-#define Boundaries map <double, DistancePair >
-#define BoundariesPair pair<double, DistancePair >
-#define BoundariesTestPair pair< Boundaries::iterator, bool>
+enum { DEBUG=1 };
+enum { DoSingleStepOutput=0 };
+enum { SingleStepWidth=10 };
 
 /********************************************** declarations *******************************/
@@ -52,5 +43,4 @@
 void FindConvexBorder(const molecule* const mol, Boundaries *BoundaryPts, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename);
 Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol);
-void FindNextSuitablePoint(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC);
 bool FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LC, const double RADIUS, const char *tempbasename);
 Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct);
Index: src/builder.cpp
===================================================================
--- src/builder.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/builder.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,6 +1,20 @@
-/** \file builder.cpp
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+ /** \file builder.cpp
  *
  *  date: Jan 1, 2007
  *  author: heber
+ *
+ */
+
+/*! \page Copyright notice
+ *
+ *  MoleCuilder - to create and alter molecular systems
+ *  Copyright (C) 2010  University Bonn. All rights reserved.
  *
  */
@@ -54,4 +68,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -59,5 +78,5 @@
 #include "CommandLineParser.hpp"
 #include "config.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "periodentafel.hpp"
@@ -72,5 +91,5 @@
 #include "UIElements/Dialog.hpp"
 #include "Menu/ActionMenuItem.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 #include "World.hpp"
 
@@ -110,8 +129,14 @@
 }
 
+void dumpMemory(){
+  ofstream ost("molecuilder.memdump");
+  Memory::dumpMemory(ost);
+}
+
 int main(int argc, char **argv)
 {
   // while we are non interactive, we want to abort from asserts
-  //ASSERT_DO(Assert::Abort);
+  ASSERT_DO(Assert::Abort);
+  ASSERT_HOOK(dumpMemory);
   string line;
   char **Arguments = NULL;
@@ -121,13 +146,14 @@
   std::string BondGraphFileName("\n");
 
-  // print version check whether arguments are present at all
-  cout << ESPACKVersion << endl;
+  // print version check and copyright notice
+  cout << MOLECUILDERVERSION << endl;
+  cout << "MoleCuilder comes with ABSOLUTELY NO WARRANTY; for details type" << endl;
+  cout << "`molecuilder --help-warranty'." << endl;
+  cout << "`MoleCuilder - to create and alter molecular systems." << endl;
+  cout << "Copyright (C) 2010  University Bonn. All rights reserved." << endl;
 
   setVerbosity(0);
   // need to init the history before any action is created
   ActionHistory::init();
-
-  // In the interactive mode, we can leave the user the choice in case of error
-  ASSERT_DO(Assert::Ask);
 
   // from this moment on, we need to be sure to deeinitialize in the correct order
@@ -155,4 +181,6 @@
       UIFactory::makeUserInterface("CommandLine");
     } else {
+      // In the interactive mode, we can leave the user the choice in case of error
+      ASSERT_DO(Assert::Ask);
       #ifdef USE_GUI_QT
         DoLog(0) && (Log() << Verbose(0) << "Setting UI to QT4." << endl);
@@ -161,5 +189,5 @@
       #else
         DoLog(0) && (Log() << Verbose(0) << "Setting UI to Text." << endl);
-        cout << ESPACKVersion << endl;
+        cout << MOLECUILDERVERSION << endl;
         UIFactory::registerFactory(new TextUIFactory::description());
         UIFactory::makeUserInterface("Text");
Index: src/config.cpp
===================================================================
--- src/config.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/config.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file config.cpp
  *
@@ -5,4 +12,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -10,4 +22,5 @@
 #include <cstring>
 
+//#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
 #include "atom.hpp"
 #include "bond.hpp"
@@ -16,9 +29,9 @@
 #include "ConfigFileBuffer.hpp"
 #include "element.hpp"
-#include "helpers.hpp"
-#include "info.hpp"
+#include "Helpers/helpers.hpp"
+#include "Helpers/Info.hpp"
 #include "lists.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "molecule.hpp"
@@ -26,5 +39,5 @@
 #include "ThermoStatContainer.hpp"
 #include "World.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "Box.hpp"
 
@@ -33,11 +46,65 @@
 /** Constructor for config file class.
  */
-config::config() : BG(NULL), Thermostats(0), PsiType(0), MaxPsiDouble(0), PsiMaxNoUp(0), PsiMaxNoDown(0), MaxMinStopStep(1), InitMaxMinStopStep(1), ProcPEGamma(8), ProcPEPsi(1),
-    configname(NULL), FastParsing(false), Deltat(0.01), basis(""), databasepath(NULL), DoConstrainedMD(0), MaxOuterStep(0), mainname(NULL), defaultpath(NULL), pseudopotpath(NULL),
-    DoOutVis(0), DoOutMes(1), DoOutNICS(0), DoOutOrbitals(0), DoOutCurrent(0), DoFullCurrent(0), DoPerturbation(0), DoWannier(0), CommonWannier(0), SawtoothStart(0.01),
-    VectorPlane(0), VectorCut(0.), UseAddGramSch(1), Seed(1), OutVisStep(10), OutSrcStep(5), MaxPsiStep(0), EpsWannier(1e-7), MaxMinStep(100), RelEpsTotalEnergy(1e-7),
-    RelEpsKineticEnergy(1e-5), MaxMinGapStopStep(0), MaxInitMinStep(100), InitRelEpsTotalEnergy(1e-5), InitRelEpsKineticEnergy(1e-4), InitMaxMinGapStopStep(0), ECut(128.),
-    MaxLevel(5), RiemannTensor(0), LevRFactor(0), RiemannLevel(0), Lev0Factor(2), RTActualUse(0), AddPsis(0), RCut(20.), StructOpt(0), IsAngstroem(1), RelativeCoord(0),
-    MaxTypes(0) {
+config::config() :
+  BG(NULL),
+  Thermostats(0),
+  PsiType(0),
+  MaxPsiDouble(0),
+  PsiMaxNoUp(0),
+  PsiMaxNoDown(0),
+  MaxMinStopStep(1),
+  InitMaxMinStopStep(1),
+  ProcPEGamma(8),
+  ProcPEPsi(1),
+  configname(NULL),
+  FastParsing(false),
+  Deltat(0.01),
+  basis(""),
+  databasepath(NULL),
+  DoConstrainedMD(0),
+  MaxOuterStep(0),
+  mainname(NULL),
+  defaultpath(NULL),
+  pseudopotpath(NULL),
+  DoOutVis(0),
+  DoOutMes(1),
+  DoOutNICS(0),
+  DoOutOrbitals(0),
+  DoOutCurrent(0),
+  DoFullCurrent(0),
+  DoPerturbation(0),
+  DoWannier(0),
+  CommonWannier(0),
+  SawtoothStart(0.01),
+  VectorPlane(0),
+  VectorCut(0.),
+  UseAddGramSch(1),
+  Seed(1),
+  OutVisStep(10),
+  OutSrcStep(5),
+  MaxPsiStep(0),
+  EpsWannier(1e-7),
+  MaxMinStep(100),
+  RelEpsTotalEnergy(1e-7),
+  RelEpsKineticEnergy(1e-5),
+  MaxMinGapStopStep(0),
+  MaxInitMinStep(100),
+  InitRelEpsTotalEnergy(1e-5),
+  InitRelEpsKineticEnergy(1e-4),
+  InitMaxMinGapStopStep(0),
+  ECut(128.),
+  MaxLevel(5),
+  RiemannTensor(0),
+  LevRFactor(0),
+  RiemannLevel(0),
+  Lev0Factor(2),
+  RTActualUse(0),
+  AddPsis(0),
+  RCut(20.),
+  StructOpt(0),
+  IsAngstroem(1),
+  RelativeCoord(0),
+  MaxTypes(0)
+{
   mainname = new char[MAXSTRINGSIZE];
   defaultpath = new char[MAXSTRINGSIZE];
@@ -417,5 +484,5 @@
       ParseForParameter(verbose,FileBuffer, name, 0, 2, 1, int_type, &Z, 1, critical);
       elementhash[i] = periode->FindElement(Z);
-      DoLog(1) && (Log() << Verbose(1) << i << ". Z = " << elementhash[i]->Z << " with " << No[i] << " ions." << endl);
+      DoLog(1) && (Log() << Verbose(1) << i << ". Z = " << elementhash[i]->getAtomicNumber() << " with " << No[i] << " ions." << endl);
       NoAtoms += No[i];
     }
@@ -439,4 +506,5 @@
     map<int, atom *> LinearList;
     atom *neues = NULL;
+    Vector position;
     if (!FastParsing) {
       // parse in trajectories
@@ -452,13 +520,15 @@
               AtomList[i][j] = neues;
               LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues;
-              neues->type = elementhash[i]; // find element type
+              neues->setType(elementhash[i]); // find element type
             } else
               neues = AtomList[i][j];
             status = (status &&
-                    ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &neues->x[0], 1, (repetition == 0) ? critical : optional) &&
-                    ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &neues->x[1], 1, (repetition == 0) ? critical : optional) &&
-                    ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &neues->x[2], 1, (repetition == 0) ? critical : optional) &&
+                    ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &position[0], 1, (repetition == 0) ? critical : optional) &&
+                    ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &position[1], 1, (repetition == 0) ? critical : optional) &&
+                    ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &position[2], 1, (repetition == 0) ? critical : optional) &&
                     ParseForParameter(verbose,FileBuffer, keyword, 0, 4, 1, int_type, &neues->FixedIon, 1, (repetition == 0) ? critical : optional));
-            if (!status) break;
+            if (!status)
+              break;
+            neues ->setPosition(position);
 
             // check size of vectors
@@ -472,15 +542,15 @@
             // put into trajectories list
             for (int d=0;d<NDIM;d++)
-              neues->Trajectory.R.at(repetition)[d] = neues->x[d];
+              neues->Trajectory.R.at(repetition)[d] = neues->at(d);
 
             // parse velocities if present
-            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->v[0], 1,optional))
-              neues->v[0] = 0.;
-            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->v[1], 1,optional))
-              neues->v[1] = 0.;
-            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->v[2], 1,optional))
-              neues->v[2] = 0.;
+            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->AtomicVelocity[0], 1,optional))
+              neues->AtomicVelocity[0] = 0.;
+            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->AtomicVelocity[1], 1,optional))
+              neues->AtomicVelocity[1] = 0.;
+            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->AtomicVelocity[2], 1,optional))
+              neues->AtomicVelocity[2] = 0.;
             for (int d=0;d<NDIM;d++)
-              neues->Trajectory.U.at(repetition)[d] = neues->v[d];
+              neues->Trajectory.U.at(repetition)[d] = neues->AtomicVelocity[d];
 
             // parse forces if present
@@ -531,20 +601,21 @@
             AtomList[i][j] = neues;
             LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues;
-            neues->type = elementhash[i]; // find element type
+            neues->setType(elementhash[i]); // find element type
           } else
             neues = AtomList[i][j];
           // then parse for each atom the coordinates as often as present
-          ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &neues->x[0], repetition,critical);
-          ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &neues->x[1], repetition,critical);
-          ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &neues->x[2], repetition,critical);
+          ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &position[0], repetition,critical);
+          ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &position[1], repetition,critical);
+          ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &position[2], repetition,critical);
+          neues->setPosition(position);
           ParseForParameter(verbose,FileBuffer, keyword, 0, 4, 1, int_type, &neues->FixedIon, repetition,critical);
-          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->v[0], repetition,optional))
-            neues->v[0] = 0.;
-          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->v[1], repetition,optional))
-            neues->v[1] = 0.;
-          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->v[2], repetition,optional))
-            neues->v[2] = 0.;
+          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->AtomicVelocity[0], repetition,optional))
+            neues->AtomicVelocity[0] = 0.;
+          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->AtomicVelocity[1], repetition,optional))
+            neues->AtomicVelocity[1] = 0.;
+          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->AtomicVelocity[2], repetition,optional))
+            neues->AtomicVelocity[2] = 0.;
           // here we don't care if forces are present (last in trajectories is always equal to current position)
-          neues->type = elementhash[i]; // find element type
+          neues->setType(elementhash[i]); // find element type
           mol->AddAtom(neues);
         }
@@ -556,469 +627,4 @@
     }
   }
-};
-
-
-/** Initializes config file structure by loading elements from a give file.
- * \param *file input file stream being the opened config file
- * \param BondGraphFileName file name of the bond length table file, if string is left blank, no table is parsed.
- * \param *periode pointer to a periodentafel class with all elements
- * \param *&MolList pointer to MoleculeListClass, on return containing all parsed molecules in system
- */
-void config::Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList)
-{
-  molecule *mol = World::getInstance().createMolecule();
-  ifstream *file = new ifstream(filename);
-  if (file == NULL) {
-    DoeLog(1) && (eLog()<< Verbose(1) << "config file " << filename << " missing!" << endl);
-    return;
-  }
-  file->close();
-  delete(file);
-
-  // ParseParameterFile
-  class ConfigFileBuffer *FileBuffer = new ConfigFileBuffer(filename);
-
-  /* Oeffne Hauptparameterdatei */
-  int di = 0;
-  double BoxLength[9];
-  string zeile;
-  string dummy;
-  int verbose = 0;
-  
-  //TODO: This is actually sensible?: if (MaxOuterStep > 0)
-  ParseThermostats(FileBuffer);
-  
-  /* Namen einlesen */
-
-  // 1. parse in options
-  ParseForParameter(verbose,FileBuffer, "mainname", 0, 1, 1, string_type, (config::mainname), 1, critical);
-  ParseForParameter(verbose,FileBuffer, "defaultpath", 0, 1, 1, string_type, (config::defaultpath), 1, critical);
-  ParseForParameter(verbose,FileBuffer, "pseudopotpath", 0, 1, 1, string_type, (config::pseudopotpath), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"ProcPEGamma", 0, 1, 1, int_type, &(config::ProcPEGamma), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"ProcPEPsi", 0, 1, 1, int_type, &(config::ProcPEPsi), 1, critical);
-
-  if (!ParseForParameter(verbose,FileBuffer,"Seed", 0, 1, 1, int_type, &(config::Seed), 1, optional))
-    config::Seed = 1;
-
-  if(!ParseForParameter(verbose,FileBuffer,"DoOutOrbitals", 0, 1, 1, int_type, &(config::DoOutOrbitals), 1, optional)) {
-    config::DoOutOrbitals = 0;
-  } else {
-    if (config::DoOutOrbitals < 0) config::DoOutOrbitals = 0;
-    if (config::DoOutOrbitals > 1) config::DoOutOrbitals = 1;
-  }
-  ParseForParameter(verbose,FileBuffer,"DoOutVis", 0, 1, 1, int_type, &(config::DoOutVis), 1, critical);
-  if (config::DoOutVis < 0) config::DoOutVis = 0;
-  if (config::DoOutVis > 1) config::DoOutVis = 1;
-  if (!ParseForParameter(verbose,FileBuffer,"VectorPlane", 0, 1, 1, int_type, &(config::VectorPlane), 1, optional))
-    config::VectorPlane = -1;
-  if (!ParseForParameter(verbose,FileBuffer,"VectorCut", 0, 1, 1, double_type, &(config::VectorCut), 1, optional))
-    config::VectorCut = 0.;
-  ParseForParameter(verbose,FileBuffer,"DoOutMes", 0, 1, 1, int_type, &(config::DoOutMes), 1, critical);
-  if (config::DoOutMes < 0) config::DoOutMes = 0;
-  if (config::DoOutMes > 1) config::DoOutMes = 1;
-  if (!ParseForParameter(verbose,FileBuffer,"DoOutCurr", 0, 1, 1, int_type, &(config::DoOutCurrent), 1, optional))
-    config::DoOutCurrent = 0;
-  if (config::DoOutCurrent < 0) config::DoOutCurrent = 0;
-  if (config::DoOutCurrent > 1) config::DoOutCurrent = 1;
-  ParseForParameter(verbose,FileBuffer,"AddGramSch", 0, 1, 1, int_type, &(config::UseAddGramSch), 1, critical);
-  if (config::UseAddGramSch < 0) config::UseAddGramSch = 0;
-  if (config::UseAddGramSch > 2) config::UseAddGramSch = 2;
-  if(!ParseForParameter(verbose,FileBuffer,"DoWannier", 0, 1, 1, int_type, &(config::DoWannier), 1, optional)) {
-    config::DoWannier = 0;
-  } else {
-    if (config::DoWannier < 0) config::DoWannier = 0;
-    if (config::DoWannier > 1) config::DoWannier = 1;
-  }
-  if(!ParseForParameter(verbose,FileBuffer,"CommonWannier", 0, 1, 1, int_type, &(config::CommonWannier), 1, optional)) {
-    config::CommonWannier = 0;
-  } else {
-    if (config::CommonWannier < 0) config::CommonWannier = 0;
-    if (config::CommonWannier > 4) config::CommonWannier = 4;
-  }
-  if(!ParseForParameter(verbose,FileBuffer,"SawtoothStart", 0, 1, 1, double_type, &(config::SawtoothStart), 1, optional)) {
-    config::SawtoothStart = 0.01;
-  } else {
-    if (config::SawtoothStart < 0.) config::SawtoothStart = 0.;
-    if (config::SawtoothStart > 1.) config::SawtoothStart = 1.;
-  }
-  
-  if (ParseForParameter(verbose,FileBuffer,"DoConstrainedMD", 0, 1, 1, int_type, &(config::DoConstrainedMD), 1, optional))
-    if (config::DoConstrainedMD < 0) 
-      config::DoConstrainedMD = 0;
-  ParseForParameter(verbose,FileBuffer,"MaxOuterStep", 0, 1, 1, int_type, &(config::MaxOuterStep), 1, critical);
-  if (!ParseForParameter(verbose,FileBuffer,"Deltat", 0, 1, 1, double_type, &(config::Deltat), 1, optional))
-    config::Deltat = 1;
-  ParseForParameter(verbose,FileBuffer,"OutVisStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional);
-  ParseForParameter(verbose,FileBuffer,"OutSrcStep", 0, 1, 1, int_type, &(config::OutSrcStep), 1, optional);
-  ParseForParameter(verbose,FileBuffer,"TargetTemp", 0, 1, 1, double_type, &(Thermostats->TargetTemp), 1, optional);
-  //ParseForParameter(verbose,FileBuffer,"Thermostat", 0, 1, 1, int_type, &(config::ScaleTempStep), 1, optional);
-  if (!ParseForParameter(verbose,FileBuffer,"EpsWannier", 0, 1, 1, double_type, &(config::EpsWannier), 1, optional))
-    config::EpsWannier = 1e-8;
-
-  // stop conditions
-  //if (config::MaxOuterStep <= 0) config::MaxOuterStep = 1;
-  ParseForParameter(verbose,FileBuffer,"MaxPsiStep", 0, 1, 1, int_type, &(config::MaxPsiStep), 1, critical);
-  if (config::MaxPsiStep <= 0) config::MaxPsiStep = 3;
-
-  ParseForParameter(verbose,FileBuffer,"MaxMinStep", 0, 1, 1, int_type, &(config::MaxMinStep), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"RelEpsTotalE", 0, 1, 1, double_type, &(config::RelEpsTotalEnergy), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"RelEpsKineticE", 0, 1, 1, double_type, &(config::RelEpsKineticEnergy), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"MaxMinStopStep", 0, 1, 1, int_type, &(config::MaxMinStopStep), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"MaxMinGapStopStep", 0, 1, 1, int_type, &(config::MaxMinGapStopStep), 1, critical);
-  if (config::MaxMinStep <= 0) config::MaxMinStep = config::MaxPsiStep;
-  if (config::MaxMinStopStep < 1) config::MaxMinStopStep = 1;
-  if (config::MaxMinGapStopStep < 1) config::MaxMinGapStopStep = 1;
-
-  ParseForParameter(verbose,FileBuffer,"MaxInitMinStep", 0, 1, 1, int_type, &(config::MaxInitMinStep), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"InitRelEpsTotalE", 0, 1, 1, double_type, &(config::InitRelEpsTotalEnergy), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"InitRelEpsKineticE", 0, 1, 1, double_type, &(config::InitRelEpsKineticEnergy), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"InitMaxMinStopStep", 0, 1, 1, int_type, &(config::InitMaxMinStopStep), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"InitMaxMinGapStopStep", 0, 1, 1, int_type, &(config::InitMaxMinGapStopStep), 1, critical);
-  if (config::MaxInitMinStep <= 0) config::MaxInitMinStep = config::MaxPsiStep;
-  if (config::InitMaxMinStopStep < 1) config::InitMaxMinStopStep = 1;
-  if (config::InitMaxMinGapStopStep < 1) config::InitMaxMinGapStopStep = 1;
-
-  // Unit cell and magnetic field
-  ParseForParameter(verbose,FileBuffer, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */
-  double * cell_size = new double[6];
-  cell_size[0] = BoxLength[0];
-  cell_size[1] = BoxLength[3];
-  cell_size[2] = BoxLength[4];
-  cell_size[3] = BoxLength[6];
-  cell_size[4] = BoxLength[7];
-  cell_size[5] = BoxLength[8];
-  World::getInstance().setDomain(cell_size);
-  delete cell_size;
-  //if (1) fprintf(stderr,"\n");
-
-  ParseForParameter(verbose,FileBuffer,"DoPerturbation", 0, 1, 1, int_type, &(config::DoPerturbation), 1, optional);
-  ParseForParameter(verbose,FileBuffer,"DoOutNICS", 0, 1, 1, int_type, &(config::DoOutNICS), 1, optional);
-  if (!ParseForParameter(verbose,FileBuffer,"DoFullCurrent", 0, 1, 1, int_type, &(config::DoFullCurrent), 1, optional))
-    config::DoFullCurrent = 0;
-  if (config::DoFullCurrent < 0) config::DoFullCurrent = 0;
-  if (config::DoFullCurrent > 2) config::DoFullCurrent = 2;
-  if (config::DoOutNICS < 0) config::DoOutNICS = 0;
-  if (config::DoOutNICS > 2) config::DoOutNICS = 2;
-  if (config::DoPerturbation == 0) {
-    config::DoFullCurrent = 0;
-    config::DoOutNICS = 0;
-  }
-
-  ParseForParameter(verbose,FileBuffer,"ECut", 0, 1, 1, double_type, &(config::ECut), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"MaxLevel", 0, 1, 1, int_type, &(config::MaxLevel), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"Level0Factor", 0, 1, 1, int_type, &(config::Lev0Factor), 1, critical);
-  if (config::Lev0Factor < 2) {
-    config::Lev0Factor = 2;
-  }
-  ParseForParameter(verbose,FileBuffer,"RiemannTensor", 0, 1, 1, int_type, &di, 1, critical);
-  if (di >= 0 && di < 2) {
-    config::RiemannTensor = di;
-  } else {
-    fprintf(stderr, "0 <= RiemanTensor < 2: 0 UseNotRT, 1 UseRT");
-    exit(1);
-  }
-  switch (config::RiemannTensor) {
-    case 0: //UseNoRT
-      if (config::MaxLevel < 2) {
-        config::MaxLevel = 2;
-      }
-      config::LevRFactor = 2;
-      config::RTActualUse = 0;
-      break;
-    case 1: // UseRT
-      if (config::MaxLevel < 3) {
-        config::MaxLevel = 3;
-      }
-      ParseForParameter(verbose,FileBuffer,"RiemannLevel", 0, 1, 1, int_type, &(config::RiemannLevel), 1, critical);
-      if (config::RiemannLevel < 2) {
-        config::RiemannLevel = 2;
-      }
-      if (config::RiemannLevel > config::MaxLevel-1) {
-        config::RiemannLevel = config::MaxLevel-1;
-      }
-      ParseForParameter(verbose,FileBuffer,"LevRFactor", 0, 1, 1, int_type, &(config::LevRFactor), 1, critical);
-      if (config::LevRFactor < 2) {
-        config::LevRFactor = 2;
-      }
-      config::Lev0Factor = 2;
-      config::RTActualUse = 2;
-      break;
-  }
-  ParseForParameter(verbose,FileBuffer,"PsiType", 0, 1, 1, int_type, &di, 1, critical);
-  if (di >= 0 && di < 2) {
-    config::PsiType = di;
-  } else {
-    fprintf(stderr, "0 <= PsiType < 2: 0 UseSpinDouble, 1 UseSpinUpDown");
-    exit(1);
-  }
-  switch (config::PsiType) {
-  case 0: // SpinDouble
-    ParseForParameter(verbose,FileBuffer,"MaxPsiDouble", 0, 1, 1, int_type, &(config::MaxPsiDouble), 1, critical);
-    ParseForParameter(verbose,FileBuffer,"AddPsis", 0, 1, 1, int_type, &(config::AddPsis), 1, optional);
-    break;
-  case 1: // SpinUpDown
-    if (config::ProcPEGamma % 2) config::ProcPEGamma*=2;
-    ParseForParameter(verbose,FileBuffer,"PsiMaxNoUp", 0, 1, 1, int_type, &(config::PsiMaxNoUp), 1, critical);
-    ParseForParameter(verbose,FileBuffer,"PsiMaxNoDown", 0, 1, 1, int_type, &(config::PsiMaxNoDown), 1, critical);
-    ParseForParameter(verbose,FileBuffer,"AddPsis", 0, 1, 1, int_type, &(config::AddPsis), 1, optional);
-    break;
-  }
-
-  // IonsInitRead
-
-  ParseForParameter(verbose,FileBuffer,"RCut", 0, 1, 1, double_type, &(config::RCut), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"IsAngstroem", 0, 1, 1, int_type, &(config::IsAngstroem), 1, critical);
-  ParseForParameter(verbose,FileBuffer,"MaxTypes", 0, 1, 1, int_type, &(MaxTypes), 1, critical);
-  if (!ParseForParameter(verbose,FileBuffer,"RelativeCoord", 0, 1, 1, int_type, &(config::RelativeCoord) , 1, optional))
-    config::RelativeCoord = 0;
-  if (!ParseForParameter(verbose,FileBuffer,"StructOpt", 0, 1, 1, int_type, &(config::StructOpt), 1, optional))
-    config::StructOpt = 0;
-
-  // 2. parse the bond graph file if given
-  if (BG == NULL) {
-    BG = new BondGraph(IsAngstroem);
-    if (BG->LoadBondLengthTable(BondGraphFileName)) {
-      DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
-    } else {
-      DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
-    }
-  }
-
-  // 3. parse the molecule in
-  LoadMolecule(mol, FileBuffer, periode, FastParsing);
-  mol->SetNameFromFilename(filename);
-  mol->ActiveFlag = true;
-  MolList->insert(mol);
-
-  // 4. dissect the molecule into connected subgraphs
-  // don't do this here ...
-  //MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this);
-  //delete(mol);
-
-  delete(FileBuffer);
-};
-
-/** Initializes config file structure by loading elements from a give file with old pcp syntax.
- * \param *file input file stream being the opened config file with old pcp syntax
- * \param BondGraphFileName file name of the bond length table file, if string is left blank, no table is parsed.
- * \param *periode pointer to a periodentafel class with all elements
- * \param *&MolList pointer to MoleculeListClass, on return containing all parsed molecules in system
- */
-void config::LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList)
-{
-  molecule *mol = World::getInstance().createMolecule();
-  ifstream *file = new ifstream(filename);
-  if (file == NULL) {
-    DoeLog(1) && (eLog()<< Verbose(1) << "config file " << filename << " missing!" << endl);
-    return;
-  }
-  // ParseParameters
-
-  /* Oeffne Hauptparameterdatei */
-  int l = 0;
-  int i = 0;
-  int di = 0;
-  double a = 0.;
-  double b = 0.;
-  double BoxLength[9];
-  string zeile;
-  string dummy;
-  const element *elementhash[128];
-  int Z = -1;
-  int No = -1;
-  int AtomNo = -1;
-  int found = 0;
-  int verbose = 0;
-
-  mol->ActiveFlag = true;
-  MolList->insert(mol);
-  /* Namen einlesen */
-
-  ParseForParameter(verbose,file, "mainname", 0, 1, 1, string_type, (config::mainname), 1, critical);
-  ParseForParameter(verbose,file, "defaultpath", 0, 1, 1, string_type, (config::defaultpath), 1, critical);
-  ParseForParameter(verbose,file, "pseudopotpath", 0, 1, 1, string_type, (config::pseudopotpath), 1, critical);
-  ParseForParameter(verbose,file, "ProcsGammaPsi", 0, 1, 1, int_type, &(config::ProcPEGamma), 1, critical);
-  ParseForParameter(verbose,file, "ProcsGammaPsi", 0, 2, 1, int_type, &(config::ProcPEPsi), 1, critical);
-  config::Seed = 1;
-  config::DoOutOrbitals = 0;
-  ParseForParameter(verbose,file,"DoOutVis", 0, 1, 1, int_type, &(config::DoOutVis), 1, critical);
-  if (config::DoOutVis < 0) config::DoOutVis = 0;
-  if (config::DoOutVis > 1) config::DoOutVis = 1;
-  config::VectorPlane = -1;
-  config::VectorCut = 0.;
-  ParseForParameter(verbose,file,"DoOutMes", 0, 1, 1, int_type, &(config::DoOutMes), 1, critical);
-  if (config::DoOutMes < 0) config::DoOutMes = 0;
-  if (config::DoOutMes > 1) config::DoOutMes = 1;
-  config::DoOutCurrent = 0;
-  ParseForParameter(verbose,file,"AddGramSch", 0, 1, 1, int_type, &(config::UseAddGramSch), 1, critical);
-  if (config::UseAddGramSch < 0) config::UseAddGramSch = 0;
-  if (config::UseAddGramSch > 2) config::UseAddGramSch = 2;
-  config::CommonWannier = 0;
-  config::SawtoothStart = 0.01;
-
-  ParseForParameter(verbose,file,"MaxOuterStep", 0, 1, 1, double_type, &(config::MaxOuterStep), 1, critical);
-  ParseForParameter(verbose,file,"Deltat", 0, 1, 1, double_type, &(config::Deltat), 1, optional);
-  ParseForParameter(verbose,file,"VisOuterStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional);
-  ParseForParameter(verbose,file,"VisSrcOuterStep", 0, 1, 1, int_type, &(config::OutSrcStep), 1, optional);
-  ParseForParameter(verbose,file,"TargetTemp", 0, 1, 1, double_type, &(Thermostats->TargetTemp), 1, optional);
-  ParseForParameter(verbose,file,"ScaleTempStep", 0, 1, 1, int_type, &(Thermostats->ScaleTempStep), 1, optional);
-  config::EpsWannier = 1e-8;
-
-  // stop conditions
-  //if (config::MaxOuterStep <= 0) config::MaxOuterStep = 1;
-  ParseForParameter(verbose,file,"MaxPsiStep", 0, 1, 1, int_type, &(config::MaxPsiStep), 1, critical);
-  if (config::MaxPsiStep <= 0) config::MaxPsiStep = 3;
-
-  ParseForParameter(verbose,file,"MaxMinStep", 0, 1, 1, int_type, &(config::MaxMinStep), 1, critical);
-  ParseForParameter(verbose,file,"MaxMinStep", 0, 2, 1, double_type, &(config::RelEpsTotalEnergy), 1, critical);
-  ParseForParameter(verbose,file,"MaxMinStep", 0, 3, 1, double_type, &(config::RelEpsKineticEnergy), 1, critical);
-  ParseForParameter(verbose,file,"MaxMinStep", 0, 4, 1, int_type, &(config::MaxMinStopStep), 1, critical);
-  if (config::MaxMinStep <= 0) config::MaxMinStep = config::MaxPsiStep;
-  if (config::MaxMinStopStep < 1) config::MaxMinStopStep = 1;
-  config::MaxMinGapStopStep = 1;
-
-  ParseForParameter(verbose,file,"MaxInitMinStep", 0, 1, 1, int_type, &(config::MaxInitMinStep), 1, critical);
-  ParseForParameter(verbose,file,"MaxInitMinStep", 0, 2, 1, double_type, &(config::InitRelEpsTotalEnergy), 1, critical);
-  ParseForParameter(verbose,file,"MaxInitMinStep", 0, 3, 1, double_type, &(config::InitRelEpsKineticEnergy), 1, critical);
-  ParseForParameter(verbose,file,"MaxInitMinStep", 0, 4, 1, int_type, &(config::InitMaxMinStopStep), 1, critical);
-  if (config::MaxInitMinStep <= 0) config::MaxInitMinStep = config::MaxPsiStep;
-  if (config::InitMaxMinStopStep < 1) config::InitMaxMinStopStep = 1;
-  config::InitMaxMinGapStopStep = 1;
-
-  ParseForParameter(verbose,file, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */
-  double * cell_size = new double[6];
-  cell_size[0] = BoxLength[0];
-  cell_size[1] = BoxLength[3];
-  cell_size[2] = BoxLength[4];
-  cell_size[3] = BoxLength[6];
-  cell_size[4] = BoxLength[7];
-  cell_size[5] = BoxLength[8];
-  World::getInstance().setDomain(cell_size);
-  delete[] cell_size;
-  if (1) fprintf(stderr,"\n");
-  config::DoPerturbation = 0;
-  config::DoFullCurrent = 0;
-
-  ParseForParameter(verbose,file,"ECut", 0, 1, 1, double_type, &(config::ECut), 1, critical);
-  ParseForParameter(verbose,file,"MaxLevel", 0, 1, 1, int_type, &(config::MaxLevel), 1, critical);
-  ParseForParameter(verbose,file,"Level0Factor", 0, 1, 1, int_type, &(config::Lev0Factor), 1, critical);
-  if (config::Lev0Factor < 2) {
-    config::Lev0Factor = 2;
-  }
-  ParseForParameter(verbose,file,"RiemannTensor", 0, 1, 1, int_type, &di, 1, critical);
-  if (di >= 0 && di < 2) {
-    config::RiemannTensor = di;
-  } else {
-    fprintf(stderr, "0 <= RiemanTensor < 2: 0 UseNotRT, 1 UseRT");
-    exit(1);
-  }
-  switch (config::RiemannTensor) {
-    case 0: //UseNoRT
-      if (config::MaxLevel < 2) {
-        config::MaxLevel = 2;
-      }
-      config::LevRFactor = 2;
-      config::RTActualUse = 0;
-      break;
-    case 1: // UseRT
-      if (config::MaxLevel < 3) {
-        config::MaxLevel = 3;
-      }
-      ParseForParameter(verbose,file,"RiemannLevel", 0, 1, 1, int_type, &(config::RiemannLevel), 1, critical);
-      if (config::RiemannLevel < 2) {
-        config::RiemannLevel = 2;
-      }
-      if (config::RiemannLevel > config::MaxLevel-1) {
-        config::RiemannLevel = config::MaxLevel-1;
-      }
-      ParseForParameter(verbose,file,"LevRFactor", 0, 1, 1, int_type, &(config::LevRFactor), 1, critical);
-      if (config::LevRFactor < 2) {
-        config::LevRFactor = 2;
-      }
-      config::Lev0Factor = 2;
-      config::RTActualUse = 2;
-      break;
-  }
-  ParseForParameter(verbose,file,"PsiType", 0, 1, 1, int_type, &di, 1, critical);
-  if (di >= 0 && di < 2) {
-    config::PsiType = di;
-  } else {
-    fprintf(stderr, "0 <= PsiType < 2: 0 UseSpinDouble, 1 UseSpinUpDown");
-    exit(1);
-  }
-  switch (config::PsiType) {
-  case 0: // SpinDouble
-    ParseForParameter(verbose,file,"MaxPsiDouble", 0, 1, 1, int_type, &(config::MaxPsiDouble), 1, critical);
-    config::AddPsis = 0;
-    break;
-  case 1: // SpinUpDown
-    if (config::ProcPEGamma % 2) config::ProcPEGamma*=2;
-    ParseForParameter(verbose,file,"MaxPsiUp", 0, 1, 1, int_type, &(config::PsiMaxNoUp), 1, critical);
-    ParseForParameter(verbose,file,"MaxPsiDown", 0, 1, 1, int_type, &(config::PsiMaxNoDown), 1, critical);
-    config::AddPsis = 0;
-    break;
-  }
-
-  // IonsInitRead
-
-  ParseForParameter(verbose,file,"RCut", 0, 1, 1, double_type, &(config::RCut), 1, critical);
-  ParseForParameter(verbose,file,"IsAngstroem", 0, 1, 1, int_type, &(config::IsAngstroem), 1, critical);
-  config::RelativeCoord = 0;
-  config::StructOpt = 0;
-
-
-  // 2. parse the bond graph file if given
-  BG = new BondGraph(IsAngstroem);
-  if (BG->LoadBondLengthTable(BondGraphFileName)) {
-    DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
-  } else {
-    DoLog(0) && (Log() << Verbose(0) << "Bond length table loading failed." << endl);
-  }
-
-  // Routine from builder.cpp
-
-  for (i=MAX_ELEMENTS;i--;)
-    elementhash[i] = NULL;
-  DoLog(0) && (Log() << Verbose(0) << "Parsing Ions ..." << endl);
-  No=0;
-  found = 0;
-  while (getline(*file,zeile,'\n')) {
-    if (zeile.find("Ions_Data") == 0) {
-      DoLog(1) && (Log() << Verbose(1) << "found Ions_Data...begin parsing" << endl);
-      found ++;
-    }
-    if (found > 0) {
-      if (zeile.find("Ions_Data") == 0)
-        getline(*file,zeile,'\n'); // read next line and parse this one
-      istringstream input(zeile);
-      input >> AtomNo;  // number of atoms
-      input >> Z;       // atomic number
-      input >> a;
-      input >> l;
-      input >> l;
-      input >> b;     // element mass
-      elementhash[No] = periode->FindElement(Z);
-      DoLog(1) && (Log() << Verbose(1) << "AtomNo: " << AtomNo << "\tZ: " << Z << "\ta:" << a << "\tl:"  << l << "\b:" << b << "\tElement:" << elementhash[No] << "\t:" << endl);
-      for(i=0;i<AtomNo;i++) {
-        if (!getline(*file,zeile,'\n')) {// parse on and on
-          DoLog(2) && (Log() << Verbose(2) << "Error: Too few items in ionic list of element" << elementhash[No] << "." << endl << "Exiting." << endl);
-          // return 1;
-        } else {
-          //Log() << Verbose(2) << "Reading line: " << zeile << endl;
-        }
-        istringstream input2(zeile);
-        atom *neues = World::getInstance().createAtom();
-        input2 >> neues->x[0]; // x
-        input2 >> neues->x[1]; // y
-        input2 >> neues->x[2]; // z
-        input2 >> l;
-        neues->type = elementhash[No]; // find element type
-        mol->AddAtom(neues);
-      }
-      No++;
-    }
-  }
-  file->close();
-  delete(file);
 };
 
@@ -1050,25 +656,6 @@
     *output << "DoFullCurrent\t" << config::DoFullCurrent << "\t# Do full perturbation" << endl;
     *output << "DoConstrainedMD\t" << config::DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl;
-    *output << "Thermostat\t" << Thermostats->ThermostatNames[Thermostats->Thermostat] << "\t";
-    switch(Thermostats->Thermostat) {
-      default:
-      case None:
-        break;
-      case Woodcock:
-        *output << Thermostats->ScaleTempStep;
-        break;
-      case Gaussian:
-        *output << Thermostats->ScaleTempStep;
-        break;
-      case Langevin:
-        *output << Thermostats->TempFrequency << "\t" << Thermostats->alpha;
-        break;
-      case Berendsen:
-        *output << Thermostats->TempFrequency;
-        break;
-      case NoseHoover:
-        *output << Thermostats->HooverMass;
-        break;
-    };
+    *output << "Thermostat\t" << Thermostats->activeThermostat->name() << "\t";
+    *output << Thermostats->activeThermostat->writeParams();
     *output << "\t# Which Thermostat and its parameters to use in MD case." << endl;
     *output << "CommonWannier\t" << config::CommonWannier << "\t# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center" << endl;
@@ -1160,5 +747,4 @@
 bool config::SaveMPQC(const char * const filename, const molecule * const mol) const
 {
-  int AtomNo = -1;
   Vector *center = NULL;
   ofstream *output = NULL;
@@ -1193,6 +779,7 @@
     center = mol->DetermineCenterOfAll();
     // output of atoms
-    AtomNo = 0;
-    mol->ActOnAllAtoms( &atom::OutputMPQCLine, (ostream * const) output, (const Vector *)center, &AtomNo );
+    for(molecule::const_iterator iter = mol->begin(); iter!=mol->end();++iter){
+      (*iter)->OutputMPQCLine(output,center);
+    }
     delete(center);
     *output << "\t}" << endl;
@@ -1235,6 +822,7 @@
     center = mol->DetermineCenterOfAll();
     // output of atoms
-    AtomNo = 0;
-    mol->ActOnAllAtoms( &atom::OutputMPQCLine, (ostream * const) output, (const Vector *)center, &AtomNo );
+    for(molecule::const_iterator iter = mol->begin(); iter!=mol->end();++iter){
+      (*iter)->OutputMPQCLine(output,center);
+    }
     delete(center);
     *output << "\t}" << endl;
@@ -1279,6 +867,6 @@
     AtomNo = 0;
     for (molecule::const_iterator iter = (*MolRunner)->begin(); iter != (*MolRunner)->end(); ++iter) {
-      sprintf(name, "%2s%2d",(*iter)->type->symbol, elementNo[(*iter)->type->Z]);
-      elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
+      sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()->getAtomicNumber()]);
+      elementNo[(*iter)->getType()->getAtomicNumber()] = (elementNo[(*iter)->getType()->getAtomicNumber()]+1) % 100;   // confine to two digits
       fprintf(f,
              "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
@@ -1288,11 +876,11 @@
              'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
              MolNo,         /* residue sequence number */
-             (*iter)->node->at(0),                 /* position X in Angstroem */
-             (*iter)->node->at(1),                 /* position Y in Angstroem */
-             (*iter)->node->at(2),                 /* position Z in Angstroem */
-             (double)(*iter)->type->Valence,         /* occupancy */
-             (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
+             (*iter)->at(0),                 /* position X in Angstroem */
+             (*iter)->at(1),                 /* position Y in Angstroem */
+             (*iter)->at(2),                 /* position Z in Angstroem */
+             (double)(*iter)->getType()->getValence(),         /* occupancy */
+             (double)(*iter)->getType()->getNoValenceOrbitals(),          /* temperature factor */
              "0",            /* segment identifier */
-             (*iter)->type->symbol,    /* element symbol */
+             (*iter)->getType()->getSymbol().c_str(),    /* element symbol */
              "0");           /* charge */
       AtomNo++;
@@ -1332,6 +920,6 @@
   AtomNo = 0;
   for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
-    sprintf(name, "%2s%2d",(*iter)->type->symbol, elementNo[(*iter)->type->Z]);
-    elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
+    sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()->getAtomicNumber()]);
+    elementNo[(*iter)->getType()->getAtomicNumber()] = (elementNo[(*iter)->getType()->getAtomicNumber()]+1) % 100;   // confine to two digits
     fprintf(f,
            "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
@@ -1341,11 +929,11 @@
            'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
            0,         /* residue sequence number */
-           (*iter)->node->at(0),                 /* position X in Angstroem */
-           (*iter)->node->at(1),                 /* position Y in Angstroem */
-           (*iter)->node->at(2),                 /* position Z in Angstroem */
-           (double)(*iter)->type->Valence,         /* occupancy */
-           (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
+           (*iter)->at(0),                 /* position X in Angstroem */
+           (*iter)->at(1),                 /* position Y in Angstroem */
+           (*iter)->at(2),                 /* position Z in Angstroem */
+           (double)(*iter)->getType()->getValence(),         /* occupancy */
+           (double)(*iter)->getType()->getNoValenceOrbitals(),          /* temperature factor */
            "0",            /* segment identifier */
-           (*iter)->type->symbol,    /* element symbol */
+           (*iter)->getType()->getSymbol().c_str(),    /* element symbol */
            "0");           /* charge */
     AtomNo++;
@@ -1390,7 +978,7 @@
     *output << mol->name << "\t";
     *output << 0 << "\t";
-    *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
-    *output << static_cast<double>((*iter)->type->Valence) << "\t";
-    *output << (*iter)->type->symbol << "\t";
+    *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t";
+    *output << static_cast<double>((*iter)->getType()->getValence()) << "\t";
+    *output << (*iter)->getType()->getSymbol() << "\t";
     for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
       *output << (*runner)->GetOtherAtom(*iter)->nr << "\t";
@@ -1462,7 +1050,7 @@
         *output << (*MolWalker)->name << "\t";
         *output << MolCounter+1 << "\t";
-        *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
-        *output << (double)(*iter)->type->Valence << "\t";
-        *output << (*iter)->type->symbol << "\t";
+        *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t";
+        *output << (double)(*iter)->getType()->getValence() << "\t";
+        *output << (*iter)->getType()->getSymbol() << "\t";
         for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
           *output << LocalNotoGlobalNoMap[ (*runner)->GetOtherAtom((*iter))->getId() ] << "\t";
@@ -1526,9 +1114,7 @@
     for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
       src[N++] = (*ListRunner)->IndexNr;
-      (*ListRunner)->Translate(&(*ListRunner)->Center);
     }
     mol = World::getInstance().createMolecule();
     mol->SetNameFromFilename(ConfigFileName);
-    molecules->SimpleMultiMerge(mol, src, N);
     //mol->CalculateOrbitals(*this);
     delete[](src);
@@ -2057,65 +1643,9 @@
   // read desired Thermostat from file along with needed additional parameters
   if (ParseForParameter(verbose,fb,"Thermostat", 0, 1, 1, string_type, thermo, 1, optional)) {
-    if (strcmp(thermo, Thermostats->ThermostatNames[0]) == 0) { // None
-      if (Thermostats->ThermostatImplemented[0] == 1) {
-        Thermostats->Thermostat = None;
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else if (strcmp(thermo, Thermostats->ThermostatNames[1]) == 0) { // Woodcock
-      if (Thermostats->ThermostatImplemented[1] == 1) {
-        Thermostats->Thermostat = Woodcock;
-        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &Thermostats->ScaleTempStep, 1, critical); // read scaling frequency
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else if (strcmp(thermo, Thermostats->ThermostatNames[2]) == 0) { // Gaussian
-      if (Thermostats->ThermostatImplemented[2] == 1) {
-        Thermostats->Thermostat = Gaussian;
-        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &Thermostats->ScaleTempStep, 1, critical); // read collision rate
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else if (strcmp(thermo, Thermostats->ThermostatNames[3]) == 0) { // Langevin
-      if (Thermostats->ThermostatImplemented[3] == 1) {
-        Thermostats->Thermostat = Langevin;
-        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->TempFrequency, 1, critical); // read gamma
-        if (ParseForParameter(verbose,fb,"Thermostat", 0, 3, 1, double_type, &Thermostats->alpha, 1, optional)) {
-          DoLog(2) && (Log() << Verbose(2) << "Extended Stochastic Thermostat detected with interpolation coefficient " << Thermostats->alpha << "." << endl);
-        } else {
-          Thermostats->alpha = 1.;
-        }
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else if (strcmp(thermo, Thermostats->ThermostatNames[4]) == 0) { // Berendsen
-      if (Thermostats->ThermostatImplemented[4] == 1) {
-        Thermostats->Thermostat = Berendsen;
-        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->TempFrequency, 1, critical); // read \tau_T
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else if (strcmp(thermo, Thermostats->ThermostatNames[5]) == 0) { // Nose-Hoover
-      if (Thermostats->ThermostatImplemented[5] == 1) {
-        Thermostats->Thermostat = NoseHoover;
-        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->HooverMass, 1, critical); // read Hoovermass
-        Thermostats->alpha = 0.;
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
-        Thermostats->Thermostat = None;
-      }
-    } else {
-      DoLog(1) && (Log() << Verbose(1) << " Warning: thermostat name was not understood!" << endl);
-      Thermostats->Thermostat = None;
-    }
+    Thermostats->makeActive(thermo,fb);
   } else {
     if ((Thermostats->TargetTemp != 0))
       DoLog(2) && (Log() << Verbose(2) <<  "No thermostat chosen despite finite temperature MD, falling back to None." << endl);
-    Thermostats->Thermostat = None;
+    Thermostats->chooseNone();
   }
   delete[](thermo);
Index: src/config.hpp
===================================================================
--- src/config.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/config.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -114,6 +114,4 @@
 
   int TestSyntax(const char * const filename, const periodentafel * const periode) const;
-  void Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList);
-  void LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList);
   bool Save(const char * const filename, const periodentafel * const periode, molecule * const mol) const;
   bool SaveMPQC(const char * const filename, const molecule * const mol) const;
Index: src/datacreator.cpp
===================================================================
--- src/datacreator.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/datacreator.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file datacreator.cpp
  *
@@ -7,10 +14,15 @@
 //============================ INCLUDES ===========================
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
 #include "datacreator.hpp"
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 #include "parser.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 
 #include <iomanip>
Index: src/defs.cpp
===================================================================
--- src/defs.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ src/defs.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,72 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * defs.cpp
+ *
+ *  Created on: Aug 7, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "defs.hpp"
+
+const double MYEPSILON=1e-13;   //!< machine epsilon precision
+const double AtomicLengthToAngstroem = 0.52917721; //!< conversion factor from atomic length/bohrradius to angstroem
+const double AtomicEnergyToKelvin = 315774.67;  //!< conversion factor from atomic energy to kelvin via boltzmann factor
+const double KelvinToAtomicTemperature = 3.1668152e-06;    //!< conversion factor for Kelvin to atomic temperature (Hartree over k_B)
+const double KelvinToeV = 8.6173422e-05;                   //!< conversion factor for Kelvin to Ht (k_B * T = energy), thus Boltzmann constant in eV/K
+const double AtomicMassUnitsToeV = 931494088.;        //!< conversion factor for atomic weight in units to mass in eV
+const double AtomicMassUnitsToHt = 34480864.;        //!< conversion factor for atomic weight in units to mass in Ht (protonmass/electronmass * electron_mass_in_Ht
+const double ElectronMass_Ht = 18778.865;            //!< electron mass in Ht
+const double ElectronMass_eV = 510998.903;           //!< electron mass in eV
+const double Units2Electronmass = (AtomicMassUnitsToeV/ElectronMass_eV); //!< atomic mass unit in eV/ electron mass in eV = 1 822.88863
+const double Atomictime2Femtoseconds = 0.024188843;     //!< Atomictime in fs
+
+const char* VERSIONSTRING = "v1.0";
+
+const char* LocalPath="./";
+
+// various standard filenames
+const char *DEFAULTCONFIG = "main_pcp_linux";    //!< default filename of config file
+const char *CONVEXENVELOPE = "ConvexEnvelope.dat";    //!< default filename of convex envelope tecplot data file
+const char *KEYSETFILE = "KeySets.dat";    //!< default filename of BOSSANOVA key sets file
+const char *ADJACENCYFILE = "Adjacency.dat";    //!< default filename of BOSSANOVA adjacancy file
+const char *TEFACTORSFILE = "TE-Factors.dat";    //!< default filename of BOSSANOVA total energy factors file
+const char *FORCESFILE = "Forces-Factors.dat";    //!< default filename of BOSSANOVA force factors file
+const char *HCORRECTIONSUFFIX = "Hcorrection.dat";    //!< default filename of BOSSANOVA H correction file (unwanted saturation interaction)
+const char *FITCONSTANTSUFFIX = "FitConstant.dat";   //!< suffix of default filename of BOSSANOVA fit constants file (unwanted saturation interaction)
+const char *SHIELDINGSUFFIX = "sigma_all.csv";                //!< default filename of BOSSANOVA shieldings file
+const char *SHIELDINGPASSUFFIX = "sigma_all_PAS.csv";                 //!< default filename of BOSSANOVA shieldings PAS file
+const char *ORDERATSITEFILE = "OrderAtSite.dat";    //!< default filename of BOSSANOVA Bond Order at each atom file
+const char *ENERGYPERFRAGMENT = "EnergyPerFragment";    //!< default filename of BOSSANOVA Energy contribution Per Fragment file
+const char *FRAGMENTPREFIX = "BondFragment";    //!< default filename prefix of BOSSANOVA fragment config and directories
+const char *STANDARDCONFIG = "unknown.conf";    //!< default filename of standard config file
+const char *STANDARDELEMENTSDB = "elements.db";    //!< default filename of elements data base with masses, Z, VanDerWaals radii, ...
+const char *STANDARDVALENCEDB = "valence.db";    //!< default filename of valence number per element database
+const char *STANDARDORBITALDB = "orbitals.db";    //!< default filename of orbitals per element database
+const char *STANDARDHBONDDISTANCEDB = "Hbonddistance.db";    //!< default filename of typial bond distance to hydrogen database
+const char *STANDARDHBONDANGLEDB = "Hbondangle.db";    //!< default filename of typial bond angle to hydrogen database
+
+// some values
+const double SOLVENTDENSITY_A = 0.6022142;
+const double SOLVENTDENSITY_a0 = 0.089238936;
+
+
+const int UPDATECOUNT = 10;  //!< update ten sites per BOSSANOVA interval
+
+const int STD_MENU_LENGTH = 60;
+const char STD_MENU_TITLE_SPACER = '=';
+const char STD_SEPERATOR_SPACER = '-';
+
+const char *MOLECUILDER_NAME = "Molecuilder";
Index: src/defs.hpp
===================================================================
--- src/defs.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/defs.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -8,21 +8,22 @@
 #define DEFS_HPP_
 
-#define MYEPSILON 1e-13   //!< machine epsilon precision
-#define NDIM  3   //!< number of spatial dimensions
-#define MAX_ELEMENTS 128  //!< maximum number of elements for certain lookup tables 
-#define AtomicLengthToAngstroem  0.52917721 //!< conversion factor from atomic length/bohrradius to angstroem
-#define AtomicEnergyToKelvin 315774.67  //!< conversion factor from atomic energy to kelvin via boltzmann factor
-#define KelvinToAtomicTemperature 3.1668152e-06    //!< conversion factor for Kelvin to atomic temperature (Hartree over k_B)
-#define KelvinToeV 8.6173422e-05                   //!< conversion factor for Kelvin to Ht (k_B * T = energy), thus Boltzmann constant in eV/K
-#define AtomicMassUnitsToeV 931494088.        //!< conversion factor for atomic weight in units to mass in eV
-#define AtomicMassUnitsToHt 34480864.        //!< conversion factor for atomic weight in units to mass in Ht (protonmass/electronmass * electron_mass_in_Ht
-#define ElectronMass_Ht 18778.865            //!< electron mass in Ht
-#define ElectronMass_eV 510998.903           //!< electron mass in eV
-#define Units2Electronmass (AtomicMassUnitsToeV/ElectronMass_eV) //!< atomic mass unit in eV/ electron mass in eV = 1 822.88863
-#define Atomictime2Femtoseconds 0.024188843     //!< Atomictime in fs
+enum { NDIM = 3 };   //!< number of spatial dimensions
+enum { MAX_ELEMENTS = 128}; //!< maximum number of elements for certain lookup tables
 
-#define VERSIONSTRING "v1.0"
+extern "C" const double MYEPSILON;  //!< machine epsilon precision
+extern "C" const double AtomicLengthToAngstroem; //!< conversion factor from atomic length/bohrradius to angstroem
+extern "C" const double AtomicEnergyToKelvin;  //!< conversion factor from atomic energy to kelvin via boltzmann factor
+extern "C" const double KelvinToAtomicTemperature;    //!< conversion factor for Kelvin to atomic temperature (Hartree over k_B)
+extern "C" const double KelvinToeV;                   //!< conversion factor for Kelvin to Ht (k_B * T = energy), thus Boltzmann constant in eV/K
+extern "C" const double AtomicMassUnitsToeV;        //!< conversion factor for atomic weight in units to mass in eV
+extern "C" const double AtomicMassUnitsToHt;        //!< conversion factor for atomic weight in units to mass in Ht (protonmass/electronmass * electron_mass_in_Ht
+extern "C" const double ElectronMass_Ht;            //!< electron mass in Ht
+extern "C" const double ElectronMass_eV;           //!< electron mass in eV
+extern "C" const double Units2Electronmass; //!< atomic mass unit in eV/ electron mass in eV = 1 822.88863
+extern "C" const double Atomictime2Femtoseconds;     //!< Atomictime in fs
 
-#define LocalPath "./"
+extern "C" const char* VERSIONSTRING;
+
+extern "C" const char* LocalPath;
 
 //enum BondOrderScheme { NoScheme, BottomUp, TopDown, ANOVA, Combined }; //!< Fragmentation scheme used in BOSS
@@ -48,42 +49,42 @@
 
 // maximum length of any char array
-#define MAXSTRINGSIZE 255
+enum { MAXSTRINGSIZE = 255 };
 
 // various standard filenames
-#define DEFAULTCONFIG "main_pcp_linux"    //!< default filename of config file
-#define CONVEXENVELOPE "ConvexEnvelope.dat"    //!< default filename of convex envelope tecplot data file
-#define KEYSETFILE "KeySets.dat"    //!< default filename of BOSSANOVA key sets file
-#define ADJACENCYFILE "Adjacency.dat"    //!< default filename of BOSSANOVA adjacancy file
-#define TEFACTORSFILE "TE-Factors.dat"    //!< default filename of BOSSANOVA total energy factors file
-#define FORCESFILE "Forces-Factors.dat"    //!< default filename of BOSSANOVA force factors file
-#define HCORRECTIONSUFFIX "Hcorrection.dat"    //!< default filename of BOSSANOVA H correction file (unwanted saturation interaction)
-#define FITCONSTANTSUFFIX "FitConstant.dat"   //!< suffix of default filename of BOSSANOVA fit constants file (unwanted saturation interaction)
-#define SHIELDINGSUFFIX "sigma_all.csv"                //!< default filename of BOSSANOVA shieldings file
-#define SHIELDINGPASSUFFIX "sigma_all_PAS.csv"                 //!< default filename of BOSSANOVA shieldings PAS file
-#define ORDERATSITEFILE "OrderAtSite.dat"    //!< default filename of BOSSANOVA Bond Order at each atom file
-#define ENERGYPERFRAGMENT "EnergyPerFragment"    //!< default filename of BOSSANOVA Energy contribution Per Fragment file
-#define FRAGMENTPREFIX "BondFragment"    //!< default filename prefix of BOSSANOVA fragment config and directories 
-#define STANDARDCONFIG "unknown.conf"    //!< default filename of standard config file
-#define STANDARDELEMENTSDB "elements.db"    //!< default filename of elements data base with masses, Z, VanDerWaals radii, ...
-#define STANDARDVALENCEDB "valence.db"    //!< default filename of valence number per element database
-#define STANDARDORBITALDB "orbitals.db"    //!< default filename of orbitals per element database
-#define STANDARDHBONDDISTANCEDB "Hbonddistance.db"    //!< default filename of typial bond distance to hydrogen database
-#define STANDARDHBONDANGLEDB "Hbondangle.db"    //!< default filename of typial bond angle to hydrogen database
+extern "C" const char *DEFAULTCONFIG;    //!< default filename of config file
+extern "C" const char *CONVEXENVELOPE;    //!< default filename of convex envelope tecplot data file
+extern "C" const char *KEYSETFILE;    //!< default filename of BOSSANOVA key sets file
+extern "C" const char *ADJACENCYFILE;    //!< default filename of BOSSANOVA adjacancy file
+extern "C" const char *TEFACTORSFILE;    //!< default filename of BOSSANOVA total energy factors file
+extern "C" const char *FORCESFILE;    //!< default filename of BOSSANOVA force factors file
+extern "C" const char *HCORRECTIONSUFFIX;    //!< default filename of BOSSANOVA H correction file (unwanted saturation interaction)
+extern "C" const char *FITCONSTANTSUFFIX;   //!< suffix of default filename of BOSSANOVA fit constants file (unwanted saturation interaction)
+extern "C" const char *SHIELDINGSUFFIX;                //!< default filename of BOSSANOVA shieldings file
+extern "C" const char *SHIELDINGPASSUFFIX;                 //!< default filename of BOSSANOVA shieldings PAS file
+extern "C" const char *ORDERATSITEFILE;    //!< default filename of BOSSANOVA Bond Order at each atom file
+extern "C" const char *ENERGYPERFRAGMENT;    //!< default filename of BOSSANOVA Energy contribution Per Fragment file
+extern "C" const char *FRAGMENTPREFIX;    //!< default filename prefix of BOSSANOVA fragment config and directories
+extern "C" const char *STANDARDCONFIG;    //!< default filename of standard config file
+extern "C" const char *STANDARDELEMENTSDB;    //!< default filename of elements data base with masses, Z, VanDerWaals radii, ...
+extern "C" const char *STANDARDVALENCEDB;    //!< default filename of valence number per element database
+extern "C" const char *STANDARDORBITALDB;    //!< default filename of orbitals per element database
+extern "C" const char *STANDARDHBONDDISTANCEDB;    //!< default filename of typial bond distance to hydrogen database
+extern "C" const char *STANDARDHBONDANGLEDB;    //!< default filename of typial bond angle to hydrogen database
 
 // some values
-#define SOLVENTDENSITY_A 0.6022142
-#define SOLVENTDENSITY_a0 0.089238936
+extern "C" const double SOLVENTDENSITY_A;
+extern "C" const double SOLVENTDENSITY_a0;
 
 
-#define UPDATECOUNT 10  //!< update ten sites per BOSSANOVA interval
+extern "C" const int UPDATECOUNT;  //!< update ten sites per BOSSANOVA interval
 
-#define STD_MENU_LENGTH 60
-#define STD_MENU_TITLE_SPACER '='
-#define STD_SEPERATOR_SPACER '-'
+extern "C" const int STD_MENU_LENGTH;
+extern "C" const char STD_MENU_TITLE_SPACER;
+extern "C" const char STD_SEPERATOR_SPACER;
 
-#define MOLECUILDER_NAME "Molecuilder"
+extern "C" const char *MOLECUILDER_NAME;
 
-const unsigned int MAX_POOL_FRAGMENTATION=20;
-const unsigned int MAX_FRAGMENTATION_SKIPS=100;
+const extern unsigned int MAX_POOL_FRAGMENTATION;
+const extern unsigned int MAX_FRAGMENTATION_SKIPS;
 
 #endif /*DEFS_HPP_*/
Index: src/element.cpp
===================================================================
--- src/element.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/element.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file element.cpp
  * 
@@ -5,4 +12,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -10,4 +22,5 @@
 #include <fstream>
 
+#include "Helpers/Assert.hpp"
 #include "element.hpp"
 
@@ -23,8 +36,4 @@
   VanDerWaalsRadius(0),
 	Z(-1),
-	previous(NULL),
-	next(NULL),
-	sort(NULL),
-	No(-1),
 	Valence(0),
 	NoValenceOrbitals(0)
@@ -32,7 +41,39 @@
 };
 
+element::element(const element &src) :
+  mass(src.mass),
+  CovalentRadius(src.CovalentRadius),
+  VanDerWaalsRadius(src.VanDerWaalsRadius),
+  Z(src.Z),
+  Valence(src.Valence),
+  NoValenceOrbitals(src.NoValenceOrbitals),
+  name(src.name),
+  symbol(src.symbol)
+{
+  period = src.period;
+  group = src.group;
+  block = src.block;
+}
+
 /** Destructor of class element.
  */
 element::~element() {};
+
+element &element::operator=(const element &src){
+  if(this!=&src){
+    mass=src.mass;
+    CovalentRadius=src.CovalentRadius;
+    VanDerWaalsRadius=src.VanDerWaalsRadius;
+    Z=src.Z;
+    Valence=src.Valence;
+    NoValenceOrbitals=src.NoValenceOrbitals;
+    name=src.name;
+    symbol=src.symbol;
+    period = src.period;
+    group = src.group;
+    block = src.block;
+  }
+  return *this;
+}
 
 /** Prints element data to \a *out.
@@ -67,5 +108,74 @@
 }
 
-string element::getSymbol() const{
-  return string(symbol);
+double element::getMass() const
+{
+  return mass;
 }
+
+double element::getCovalentRadius() const
+{
+  return CovalentRadius;
+}
+
+double element::getVanDerWaalsRadius() const
+{
+  return VanDerWaalsRadius;
+}
+
+int element::getAtomicNumber() const
+{
+  return Z;
+}
+
+double element::getValence() const
+{
+  return Valence;
+}
+
+int element::getNoValenceOrbitals() const
+{
+  return NoValenceOrbitals;
+}
+
+double element::getHBondDistance(const int i) const
+{
+  ASSERT((i>=0) && (i<3), "Access to element::HBondDistance out of bounds.");
+  return HBondDistance[i];
+}
+
+double element::getHBondAngle(const int i) const
+{
+  ASSERT((i>=0) && (i<3), "Access to element::HBondAngle out of bounds.");
+  return HBondAngle[i];
+}
+
+string &element::getSymbol(){
+  return symbol;
+}
+
+const string &element::getSymbol() const{
+  return symbol;
+}
+
+void element::setSymbol(const std::string &temp)
+{
+  symbol = temp;
+}
+
+std::string &element::getName(){
+  return name;
+}
+
+const std::string &element::getName() const{
+  return name;
+}
+
+void element::setName(const std::string &temp)
+{
+  name = temp;
+}
+
+std::ostream &operator<<(std::ostream &ost,const element &elem){
+  ost << elem.getName() << "(" << elem.getNumber() << ")";
+  return ost;
+}
Index: src/element.hpp
===================================================================
--- src/element.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/element.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -22,4 +22,6 @@
 #include "types.hpp"
 
+class periodentafel;
+
 /********************************************** declarations *******************************/
 
@@ -28,18 +30,43 @@
  */
 class element {
+  friend class periodentafel;
   public:
+    element();
+    element(const element&);
+    ~element();
+
+    element &operator=(const element&);
+
+    // accessor functions
+    atomicNumber_t getNumber() const;
+    double getMass() const;
+    double getCovalentRadius() const;
+    double getVanDerWaalsRadius() const;
+    int getAtomicNumber() const;
+    double getValence() const;
+    int getNoValenceOrbitals() const;
+    double getHBondDistance(const int i) const;
+    double getHBondAngle(const int i) const;
+
+    std::string &getSymbol();
+    const std::string &getSymbol() const;
+    void setSymbol(const std::string &temp);
+
+    std::string &getName();
+    const std::string &getName() const;
+    void setName(const std::string &temp);
+
+    //> print element entries to screen
+    bool Output(std::ostream * const out) const;
+    bool Checkout(std::ostream * const out, const int No, const int NoOfAtoms) const;
+
+  private:
     double mass;    //!< mass in g/mol
     double CovalentRadius;  //!< covalent radius
     double VanDerWaalsRadius;  //!< can-der-Waals radius
     int Z;          //!< atomic number
-    char name[64];  //!< atom name, i.e. "Hydrogren"
-    char symbol[3]; //!< short form of the atom, i.e. "H"
-    char period[8];    //!< period: n quantum number
-    char group[8];    //!< group: l quantum number
-    char block[8];    //!< block: l quantum number
-    element *previous;  //!< previous item in list
-    element *next;  //!< next element in list
-    int *sort;      //!< sorc criteria
-    int No;         //!< number of element set on periodentafel::Output()
+    std::string period;    //!< period: n quantum number
+    std::string group;    //!< group: l quantum number
+    std::string block;    //!< block: l quantum number
     double Valence;   //!< number of valence electrons for this element
     int NoValenceOrbitals;  //!< number of valence orbitals, used for determining bond degree in molecule::CreateConnectmatrix()
@@ -47,18 +74,9 @@
     double HBondAngle[NDIM];     //!< typical angle for one, two, three bonded hydrogen (in degrees)
 
-  element();
-  ~element();
-
-  // accessor functions
-  atomicNumber_t getNumber() const;
-  std::string getSymbol() const;
-
-  //> print element entries to screen
-  bool Output(std::ostream * const out) const;
-  bool Checkout(std::ostream * const out, const int No, const int NoOfAtoms) const;
-
-  private:
+    std::string name;  //!< atom name, i.e. "Hydrogen"
+    std::string symbol; //!< short form of the atom, i.e. "H"
 };
 
+std::ostream &operator<<(std::ostream&,const element&);
 
 #endif /* ELEMENT_HPP_ */
Index: src/elements_db.cpp
===================================================================
--- src/elements_db.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/elements_db.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * elements_db.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
Index: src/ellipsoid.cpp
===================================================================
--- src/ellipsoid.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/ellipsoid.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ellipsoid.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -15,12 +27,13 @@
 #include <set>
 
+#include "BoundaryPointSet.hpp"
 #include "boundary.hpp"
 #include "ellipsoid.hpp"
 #include "linkedcell.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "tesselation.hpp"
-#include "vector.hpp"
-#include "Matrix.hpp"
-#include "verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Matrix.hpp"
+#include "Helpers/Verbose.hpp"
 
 /** Determines squared distance for a given point \a x to surface of ellipsoid.
@@ -304,6 +317,6 @@
               if ((current != PickedAtomNrs.end()) && (*current == index)) {
                 Candidate = (*Runner);
-                DoLog(2) && (Log() << Verbose(2) << "Current picked node is " << **Runner << " with index " << index << "." << endl);
-                x[PointsPicked++] = *Candidate->node;    // we have one more atom picked
+                DoLog(2) && (Log() << Verbose(2) << "Current picked node is " << (*Runner)->getName() << " with index " << index << "." << endl);
+                x[PointsPicked++] = Candidate->getPosition();    // we have one more atom picked
                 current++;    // next pre-picked atom
               }
@@ -351,5 +364,5 @@
       //Log() << Verbose(3) << "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": ";
       if (value > threshold) {
-        x[PointsPicked] = (*Runner->second->node->node);
+        x[PointsPicked] = (Runner->second->node->getPosition());
         PointsPicked++;
         //Log() << Verbose(0) << "IN." << endl;
@@ -388,5 +401,5 @@
   Center.Zero();
   for (PointMap::iterator Runner = T->PointsOnBoundary.begin(); Runner != T->PointsOnBoundary.end(); Runner++)
-    Center += (*Runner->second->node->node);
+    Center += (Runner->second->node->getPosition());
   Center.Scale(1./T->PointsOnBoundaryCount);
   DoLog(1) && (Log() << Verbose(1) << "Center is at " << Center << "." << endl);
Index: c/errorlogger.cpp
===================================================================
--- src/errorlogger.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * errorLogger.cpp
- *
- *  Created on: Oct 19, 2009
- *      Author: metzler
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include <fstream>
-#include <iostream>
-#include "errorlogger.hpp"
-#include "verbose.hpp"
-#include "Patterns/Singleton_impl.hpp"
-
-ofstream null("/dev/null");
-int errorLogger::verbosity = 2;
-ostream* errorLogger::nix = &null;
-
-/**
- * Constructor. Do not use this function. Use getInstance() instead.
- *
- * \return errorLogger instance
- */
-errorLogger::errorLogger()
-{
-  verbosity = 2;
-};
-
-/**
- * Destructor. Better use purgeInstance().
- */
-errorLogger::~errorLogger() {
-  verbosity = 2;
-}
-
-CONSTRUCT_SINGLETON(errorLogger)
-
-/**
- * Sets the verbosity.
- *
- * \param verbosityLevel verbosity
- */
-void errorLogger::setVerbosity(int verbosityLevel) {
-  verbosity = verbosityLevel;
-}
-
-/**
- * Operator for the Binary(arg) call.
- * Constructs temporary a Verbose class object, wherein the Binary is stored.
- * Then << is called, which calls Binary's print which adds the tabs and logs
- * the stream.
- * \param &ost stream to extend
- * \param &m pointer to created Binary object
- * \return &ost
- */
-ostream& operator<<(class errorLogger& l, const Verbose& v)
-{
-  int verbosityLevel = l.verbosity;
-  l.nix->clear();
-  if (v.DoErrorOutput(verbosityLevel)) {
-    switch(v.Verbosity) {
-      case 0:
-        cerr << "CRITICAL: ";
-        break;
-      case 1:
-        cerr << "ERROR: ";
-        break;
-      case 2:
-        cerr << "WARNING: ";
-        break;
-      default:
-        break;
-    }
-    v.print(cerr);
-    return cerr;
-  } else
-    return *l.nix;
-};
-ostream& operator<<(class errorLogger* l, const Verbose& v)
-{
-  int verbosityLevel = l->verbosity;
-  l->nix->clear();
-  if (v.DoErrorOutput(verbosityLevel)) {
-    switch(v.Verbosity) {
-      case 0:
-        cerr << "CRITICAL: ";
-        break;
-      case 1:
-        cerr << "ERROR: ";
-        break;
-      case 2:
-      default:
-        cerr << "WARNING: ";
-        break;
-    }
-    v.print(cerr);
-    return cerr;
-  } else
-    return *l->nix;
-};
-
-
Index: c/errorlogger.hpp
===================================================================
--- src/errorlogger.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
- * errorLogger.hpp
- *
- *  Created on: Oct 19, 2009
- *      Author: metzler
- */
-
-#ifndef ERRORLOGGER_HPP_
-#define ERRORLOGGER_HPP_
-
-#include <iosfwd>
-
-#include "Patterns/Singleton.hpp"
-
-using namespace std;
-
-class Verbose;
-
-class errorLogger : public Singleton<errorLogger>{
-  friend class Singleton<errorLogger>;
-public :
-  static ostream *nix;
-  static int verbosity;
-
-  static bool DoOutput();
-  static void setVerbosity(int verbosityLevel);
-
-protected:
-  /** Do not call this constructor directly, use getInstance() instead. */
-  errorLogger();
-  /** Do not call this destructor directly, use purgeInstance() instead. */
-  ~errorLogger();
-
-};
-
-ostream& operator<<(class errorLogger&l, const Verbose& ost);
-ostream& operator<<(class errorLogger*l, const Verbose& ost);
-
-#endif /* ERRORLOGGER_HPP_ */
Index: src/graph.cpp
===================================================================
--- src/graph.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/graph.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file graph.cpp
  *
@@ -4,4 +11,9 @@
  *
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "Helpers/MemDebug.hpp"
@@ -13,6 +25,6 @@
 #include "config.hpp"
 #include "graph.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 
Index: c/gslmatrix.cpp
===================================================================
--- src/gslmatrix.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,248 +1,0 @@
-/*
- * gslmatrix.cpp
- *
- *  Created on: Jan 8, 2010
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-using namespace std;
-
-#include "gslmatrix.hpp"
-#include "helpers.hpp"
-#include "Helpers/fast_functions.hpp"
-
-#include <cassert>
-#include <gsl/gsl_linalg.h>
-
-/** Constructor of class GSLMatrix.
- * Allocates GSL structures
- * \param m dimension of matrix
- */
-GSLMatrix::GSLMatrix(size_t m, size_t n) : rows(m), columns(n)
-{
-  matrix = gsl_matrix_calloc(rows, columns);
-};
-
-/** Copy constructor of class GSLMatrix.
- * Allocates GSL structures and copies components from \a *src.
- * \param *src source matrix
- */
-GSLMatrix::GSLMatrix(const GSLMatrix * const src) : rows(src->rows), columns(src->columns)
-{
-  matrix = gsl_matrix_alloc(rows, columns);
-  gsl_matrix_memcpy (matrix, src->matrix);
-};
-
-/** Destructor of class GSLMatrix.
- * Frees GSL structures
- */
-GSLMatrix::~GSLMatrix()
-{
-  gsl_matrix_free(matrix);
-  rows = 0;
-  columns = 0;
-};
-
-/** Assignment operator.
- * \param &rhs right hand side
- * \return object itself
- */
-GSLMatrix& GSLMatrix::operator=(const GSLMatrix& rhs)
-{
-  if (this == &rhs)   // not necessary here, but identity assignment check is generally a good idea
-    return *this;
-  assert(rows == rhs.rows && columns == rhs.columns && "Number of rows and columns do not match!");
-
-  gsl_matrix_memcpy (matrix, rhs.matrix);
-
-  return *this;
-};
-
-/* ============================ Accessing =============================== */
-/** This function sets the matrix from a double array.
- * Creates a matrix view of the array and performs a memcopy.
- * \param *x array of values (no dimension check is performed)
- */
-void GSLMatrix::SetFromDoubleArray(double * x)
-{
-  gsl_matrix_view m = gsl_matrix_view_array (x, rows, columns);
-  gsl_matrix_memcpy (matrix, &m.matrix);
-};
-
-/** This function returns the i-th element of a matrix.
- * If \a m or \a n lies outside the allowed range of 0 to GSLMatrix::dimension-1 then the error handler is invoked and 0 is returned.
- * \param m row index
- * \param n colum index
- * \return (m,n)-th element of matrix
- */
-double GSLMatrix::Get(size_t m, size_t n)
-{
-  return gsl_matrix_get (matrix, m, n);
-};
-
-/** This function sets the value of the \a m -th element of a matrix to \a x.
- *  If \a m or \a n lies outside the allowed range of 0 to GSLMatrix::dimension-1 then the error handler is invoked.
- * \param m row index
- * \param m column index
- * \param x value to set element (m,n) to
- */
-void GSLMatrix::Set(size_t m, size_t n, double x)
-{
-  gsl_matrix_set (matrix, m, n, x);
-};
-
-/** These functions return a pointer to the \a m-th element of a matrix.
- *  If \a m or \a n lies outside the allowed range of 0 to GSLMatrix::dimension-1 then the error handler is invoked and a null pointer is returned.
- * \param m index
- * \return pointer to \a m-th element
- */
-double *GSLMatrix::Pointer(size_t m, size_t n)
-{
-  return gsl_matrix_ptr (matrix, m, n);
-};
-
-/** These functions return a constant pointer to the \a m-th element of a matrix.
- *  If \a m or \a n lies outside the allowed range of 0 to GSLMatrix::dimension-1 then the error handler is invoked and a null pointer is returned.
- * \param m index
- * \return const pointer to \a m-th element
- */
-const double *GSLMatrix::const_Pointer(size_t m, size_t n)
-{
-  return gsl_matrix_const_ptr (matrix, m, n);
-};
-
-/* ========================== Initializing =============================== */
-/** This function sets all the elements of the matrix to the value \a x.
- * \param *x
- */
-void GSLMatrix::SetAll(double x)
-{
-  gsl_matrix_set_all (matrix, x);
-};
-
-/** This function sets all the elements of the matrix to zero.
- */
-void GSLMatrix::SetZero()
-{
-  gsl_matrix_set_zero (matrix);
-};
-
-/** This function sets the elements of the matrix to the corresponding elements of the identity matrix, \f$m(i,j) = \delta(i,j)\f$, i.e. a unit diagonal with all off-diagonal elements zero.
- * This applies to both square and rectangular matrices.
- */
-void GSLMatrix::SetIdentity()
-{
-  gsl_matrix_set_identity (matrix);
-};
-
-/* ====================== Exchanging elements ============================ */
-/** This function exchanges the \a i-th and \a j-th row of the matrix in-place.
- * \param i i-th row to swap with ...
- * \param j ... j-th row to swap against
- */
-bool GSLMatrix::SwapRows(size_t i, size_t j)
-{
-  return (gsl_matrix_swap_rows (matrix, i, j) == GSL_SUCCESS);
-};
-
-/** This function exchanges the \a i-th and \a j-th column of the matrix in-place.
- * \param i i-th column to swap with ...
- * \param j ... j-th column to swap against
- */
-bool GSLMatrix::SwapColumns(size_t i, size_t j)
-{
-  return (gsl_matrix_swap_columns (matrix, i, j) == GSL_SUCCESS);
-};
-
-/** This function exchanges the \a i-th row and \a j-th column of the matrix in-place.
- * The matrix must be square for this operation to be possible.
- * \param i i-th row to swap with ...
- * \param j ... j-th column to swap against
- */
-bool GSLMatrix::SwapRowColumn(size_t i, size_t j)
-{
-  assert (rows == columns && "The matrix must be square for swapping row against column to be possible.");
-  return (gsl_matrix_swap_rowcol (matrix, i, j) == GSL_SUCCESS);
-};
-
-/** This function transposes the matrix.
- * Note that the function is extended to the non-square case, where the matrix is re-allocated and copied.
- */
-bool GSLMatrix::Transpose()
-{
-  if (rows == columns)// if square, use GSL
-    return (gsl_matrix_transpose (matrix) == GSL_SUCCESS);
-  else { // otherwise we have to copy a bit
-    gsl_matrix *dest = gsl_matrix_alloc(columns, rows);
-    for (size_t i=0;i<rows; i++)
-      for (size_t j=0;j<columns;j++) {
-        gsl_matrix_set(dest, j,i, gsl_matrix_get(matrix, i,j) );
-      }
-    gsl_matrix_free(matrix);
-    matrix = dest;
-    flip(rows, columns);
-    return true;
-  }
-};
-
-/* ============================ Properties ============================== */
-/** Checks whether matrix' elements are strictly null.
- * \return true - is null, false - else
- */
-bool GSLMatrix::IsNull()
-{
-  return gsl_matrix_isnull (matrix);
-};
-
-/** Checks whether matrix' elements are strictly positive.
- * \return true - is positive, false - else
- */
-bool GSLMatrix::IsPositive()
-{
-  return gsl_matrix_ispos (matrix);
-};
-
-/** Checks whether matrix' elements are strictly negative.
- * \return true - is negative, false - else
- */
-bool GSLMatrix::IsNegative()
-{
-  return gsl_matrix_isneg (matrix);
-};
-
-/** Checks whether matrix' elements are strictly non-negative.
- * \return true - is non-negative, false - else
- */
-bool GSLMatrix::IsNonNegative()
-{
-  return gsl_matrix_isnonneg (matrix);
-};
-
-/** This function performs a Cholesky decomposition to determine whether matrix is positive definite.
- * We check whether GSL returns GSL_EDOM as error, indicating that decomposition failed due to matrix not being positive-definite.
- * \return true - matrix is positive-definite, false - else
- */
-bool GSLMatrix::IsPositiveDefinite()
-{
-  if (rows != columns)  // only possible for square matrices.
-    return false;
-  else
-    return (gsl_linalg_cholesky_decomp (matrix) != GSL_EDOM);
-};
-
-
-/** Calculates the determinant of the matrix.
- * if matrix is square, uses LU decomposition.
- */
-double GSLMatrix::Determinant()
-{
-  int signum = 0;
-  assert (rows == columns && "Determinant can only be calculated for square matrices.");
-  gsl_permutation *p = gsl_permutation_alloc(rows);
-  gsl_linalg_LU_decomp(matrix, p, &signum);
-  gsl_permutation_free(p);
-  return gsl_linalg_LU_det(matrix, signum); 
-};
-
Index: c/gslmatrix.hpp
===================================================================
--- src/gslmatrix.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * gslmatrix.hpp
- *
- *  Created on: Jan 8, 2010
- *      Author: heber
- */
-
-#ifndef GSLMATRIX_HPP_
-#define GSLMATRIX_HPP_
-
-using namespace std;
-
-/*********************************************** includes ***********************************/
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gsl/gsl_matrix.h>
-
-/****************************************** forward declarations *****************************/
-
-class GSLMatrix;
-
-/********************************************** declarations *******************************/
-
-class GSLMatrix {
-  friend class LinearSystemOfEquations;
-
-public:
-  GSLMatrix(size_t m, size_t n);
-  GSLMatrix(const GSLMatrix * const src);
-  ~GSLMatrix();
-
-  // Accessing
-  void SetFromDoubleArray(double * x);
-  double Get(size_t m, size_t n);
-  void Set(size_t m, size_t n, double x);
-  double *Pointer(size_t m, size_t n);
-  const double *const_Pointer(size_t m, size_t n);
-
-  // Initializing
-  void SetAll(double x);
-  void SetZero();
-  void SetIdentity();
-
-  // Exchanging elements
-  bool SwapRows(size_t i, size_t j);
-  bool SwapColumns(size_t i, size_t j);
-  bool SwapRowColumn(size_t i, size_t j);
-  bool Transpose();
-  bool IsNull();
-  bool IsPositive();
-  bool IsNegative();
-  bool IsNonNegative();
-  bool IsPositiveDefinite();
-  double Determinant();
-
-  GSLMatrix& operator=(const GSLMatrix& rhs);
-
-private:
-  gsl_matrix *matrix;
-
-  size_t rows;
-  size_t columns;
-};
-
-
-#endif /* GSLMATRIX_HPP_ */
Index: c/gslvector.cpp
===================================================================
--- src/gslvector.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,307 +1,0 @@
-/*
- * gslvector.cpp
- *
- *  Created on: Jan 8, 2010
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include <cassert>
-#include <cmath>
-#include <iostream>
-
-#include "gslvector.hpp"
-#include "defs.hpp"
-#include "vector.hpp"
-#include "VectorContent.hpp"
-
-/** Constructor of class GSLVector.
- * Allocates GSL structures
- * \param m dimension of vector
- */
-GSLVector::GSLVector(size_t m) : dimension(m)
-{
-  vector = gsl_vector_calloc(dimension);
-};
-
-/** Copy constructor of class GSLVector.
- * Allocates GSL structures and copies components from \a *src.
- * \param *src source vector
- */
-GSLVector::GSLVector(const GSLVector * const src) : dimension(src->dimension)
-{
-  vector = gsl_vector_alloc(dimension);
-  gsl_vector_memcpy (vector, src->vector);
-};
-
-/** Copy constructor of class GSLVector.
- * Allocates GSL structures and copies components from \a *src.
- * \param *src source vector
- */
-GSLVector::GSLVector(const GSLVector & src) : dimension(src.dimension)
-{
-  vector = gsl_vector_alloc(dimension);
-  gsl_vector_memcpy (vector, src.vector);
-};
-
-/** Destructor of class GSLVector.
- * Frees GSL structures
- */
-GSLVector::~GSLVector()
-{
-  gsl_vector_free(vector);
-};
-
-/* ============================ Accessing =============================== */
-/** This function sets the vector from a double array.
- * Creates a vector view of the array and performs a memcopy.
- * \param *x array of values (no dimension check is performed)
- */
-void GSLVector::SetFromDoubleArray(double * x)
-{
-  gsl_vector_view m = gsl_vector_view_array (x, dimension);
-  gsl_vector_memcpy (vector, &m.vector);
-};
-
-/**
- * This function sets the GSLvector from an ordinary vector.
- *
- * Takes access to the internal gsl_vector and copies it
- */
-void GSLVector::SetFromVector(Vector &v){
-  gsl_vector_memcpy (vector, v.get()->content);
-}
-
-/** This function returns the i-th element of a vector.
- * If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked and 0 is returned.
- * \param m m-th element
- * \return  m-th element of vector
- */
-double GSLVector::Get(size_t m) const
-{
-  return gsl_vector_get (vector, m);
-};
-
-/** This function sets the value of the \a m -th element of a vector to \a x.
- *  If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked.
- * \param m-th element to set
- * \param x value to set to
- */
-void GSLVector::Set(size_t m, double x)
-{
-  gsl_vector_set (vector, m, x);
-};
-
-/** These functions return a pointer to the \a m-th element of a vector.
- *  If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked and a null pointer is returned.
- * \param m m-th element
- * \return pointer to \a m-th element
- */
-double *GSLVector::Pointer(size_t m) const
-{
-  return gsl_vector_ptr (vector, m);
-};
-
-/** These functions return a constant pointer to the \a m-th element of a vector.
- *  If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked and a null pointer is returned.
- * \param m m-th element
- * \return const pointer to \a m-th element
- */
-const double *GSLVector::const_Pointer(size_t m) const
-{
-  return gsl_vector_const_ptr (vector, m);
-};
-
-/** Returns the dimension of the vector.
- * \return dimension of vector
- */
-#ifdef HAVE_INLINE
-inline
-#endif
-size_t GSLVector::GetDimension() const
-{
-  return dimension;
-};
-
-/* ========================== Initializing =============================== */
-/** This function sets all the elements of the vector to the value \a x.
- * \param *x
- */
-void GSLVector::SetAll(double x)
-{
-  gsl_vector_set_all (vector, x);
-};
-
-/** This function sets all the elements of the vector to zero.
- */
-void GSLVector::SetZero()
-{
-  gsl_vector_set_zero (vector);
-};
-
-/** This function makes a basis vector by setting all the elements of the vector to zero except for the i-th element which is set to one.
- * \param i i-th component to set to unity (all other to zero)
- * \return vector set
- */
-int GSLVector::SetBasis(size_t i)
-{
-  return gsl_vector_set_basis (vector, i);
-};
-
-/* ====================== Exchanging elements ============================ */
-/** This function exchanges the \a i-th and \a j-th elements of the vector in-place.
- * \param i i-th element to swap with ...
- * \param j ... j-th element to swap against
- */
-int GSLVector::SwapElements(size_t i, size_t j)
-{
-  return gsl_vector_swap_elements (vector, i, j);
-};
-
-/** This function reverses the order of the elements of the vector.
- */
-int GSLVector::Reverse()
-{
-  return gsl_vector_reverse (vector);
-};
-
-
-/* ========================== Operators =============================== */
-/** Compares GSLVector \a to GSLVector \a b component-wise.
- * \param a base GSLVector
- * \param b GSLVector components to add
- * \return a == b
- */
-bool operator==(const GSLVector& a, const GSLVector& b)
-{
-  bool status = true;
-  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
-  for (size_t i=0;i<a.GetDimension();i++)
-    status = status && (fabs(a.Get(i) - b.Get(i)) < MYEPSILON);
-  return status;
-};
-
-/** Sums GSLVector \a to this lhs component-wise.
- * \param a base GSLVector
- * \param b GSLVector components to add
- * \return lhs + a
- */
-const GSLVector& operator+=(GSLVector& a, const GSLVector& b)
-{
-  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
-  for (size_t i=0;i<a.GetDimension();i++)
-    a.Set(i,a.Get(i)+b.Get(i));
-  return a;
-};
-
-/** Subtracts GSLVector \a from this lhs component-wise.
- * \param a base GSLVector
- * \param b GSLVector components to add
- * \return lhs - a
- */
-const GSLVector& operator-=(GSLVector& a, const GSLVector& b)
-{
-  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
-  for (size_t i=0;i<a.GetDimension();i++)
-    a.Set(i,a.Get(i)-b.Get(i));
-  return a;
-};
-
-/** factor each component of \a a times a double \a m.
- * \param a base GSLVector
- * \param m factor
- * \return lhs.Get(i) * m
- */
-const GSLVector& operator*=(GSLVector& a, const double m)
-{
-  for (size_t i=0;i<a.GetDimension();i++)
-    a.Set(i,a.Get(i)*m);
-  return a;
-};
-
-/** Sums two GSLVectors \a  and \b component-wise.
- * \param a first GSLVector
- * \param b second GSLVector
- * \return a + b
- */
-GSLVector const operator+(const GSLVector& a, const GSLVector& b)
-{
-  GSLVector x(a);
-  for (size_t i=0;i<a.GetDimension();i++)
-    x.Set(i,a.Get(i)+b.Get(i));
-  return x;
-};
-
-/** Subtracts GSLVector \a from \b component-wise.
- * \param a first GSLVector
- * \param b second GSLVector
- * \return a - b
- */
-GSLVector const operator-(const GSLVector& a, const GSLVector& b)
-{
-  assert(a.GetDimension() == b.GetDimension() && "Dimenions of GSLVectors to compare differ");
-  GSLVector x(a);
-  for (size_t i=0;i<a.GetDimension();i++)
-    x.Set(i,a.Get(i)-b.Get(i));
-  return x;
-};
-
-/** Factors given GSLVector \a a times \a m.
- * \param a GSLVector
- * \param m factor
- * \return m * a
- */
-GSLVector const operator*(const GSLVector& a, const double m)
-{
-  GSLVector x(a);
-  for (size_t i=0;i<a.GetDimension();i++)
-    x.Set(i,a.Get(i)*m);
-  return x;
-};
-
-/** Factors given GSLVector \a a times \a m.
- * \param m factor
- * \param a GSLVector
- * \return m * a
- */
-GSLVector const operator*(const double m, const GSLVector& a )
-{
-  GSLVector x(a);
-  for (size_t i=0;i<a.GetDimension();i++)
-    x.Set(i,a.Get(i)*m);
-  return x;
-};
-
-ostream& operator<<(ostream& ost, const GSLVector& m)
-{
-  ost << "(";
-  for (size_t i=0;i<m.GetDimension();i++) {
-    ost << m.Get(i);
-    if (i != 2)
-      ost << ",";
-  }
-  ost << ")";
-  return ost;
-};
-
-/* ====================== Checking State ============================ */
-/** Checks whether vector has all components zero.
- * @return true - vector is zero, false - vector is not
- */
-bool GSLVector::IsZero() const
-{
-  return (fabs(Get(0))+fabs(Get(1))+fabs(Get(2)) < MYEPSILON);
-};
-
-/** Checks whether vector has length of 1.
- * @return true - vector is normalized, false - vector is not
- */
-bool GSLVector::IsOne() const
-{
-  double NormValue = 0.;
-  for (size_t i=dimension;--i;)
-    NormValue += Get(i)*Get(i);
-  return (fabs(NormValue - 1.) < MYEPSILON);
-};
-
Index: c/gslvector.hpp
===================================================================
--- src/gslvector.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * gslvector.hpp
- *
- *  Created on: Jan 8, 2010
- *      Author: heber
- */
-
-#ifndef GSLVECTOR_HPP_
-#define GSLVECTOR_HPP_
-
-using namespace std;
-
-/*********************************************** includes ***********************************/
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iosfwd>
-#include <gsl/gsl_vector.h>
-
-/****************************************** forward declarations *****************************/
-
-class GSLVector;
-class Vector;
-
-/********************************************** declarations *******************************/
-
-class GSLVector {
-  friend class LinearSystemOfEquations;
-
-public:
-  GSLVector(size_t m);
-  GSLVector(const GSLVector * const src);
-  GSLVector(const GSLVector & src);
-  ~GSLVector();
-
-  // Accessing
-  void SetFromDoubleArray(double *x);
-  void SetFromVector(Vector &v);
-  double Get(size_t m) const;
-  void Set(size_t m, double x);
-  double *Pointer(size_t m) const;
-  const double *const_Pointer(size_t m) const;
-  size_t GetDimension() const;
-
-  // Initializing
-  void SetAll(double x);
-  void SetZero();
-  int SetBasis(size_t m);
-
-  // Exchanging elements
-  int SwapElements(size_t i, size_t j);
-  int Reverse();
-
-  // checking state
-  bool IsZero() const;
-  bool IsOne() const;
-
-private:
-  gsl_vector *vector;
-
-  const size_t dimension;
-};
-
-ostream & operator << (ostream& ost, const GSLVector &m);
-bool operator==(const GSLVector& a, const GSLVector& b);
-const GSLVector& operator+=(GSLVector& a, const GSLVector& b);
-const GSLVector& operator-=(GSLVector& a, const GSLVector& b);
-const GSLVector& operator*=(GSLVector& a, const double m);
-GSLVector const operator*(const GSLVector& a, const double m);
-GSLVector const operator*(const double m, const GSLVector& a);
-GSLVector const operator+(const GSLVector& a, const GSLVector& b);
-GSLVector const operator-(const GSLVector& a, const GSLVector& b);
-
-
-
-
-#endif /* GSLVECTOR_HPP_ */
Index: c/helpers.cpp
===================================================================
--- src/helpers.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/** \file helpers.cpp
- *
- * Implementation of some auxiliary functions for memory dis-/allocation and so on
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "helpers.hpp"
-#include "Helpers/fast_functions.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
-
-#include <iostream>
-
-/********************************************** helpful functions *********************************/
-
-
-/** Asks for a double value and checks input
- * \param *text question
- */
-double ask_value(const char *text)
-{
-  double test = 0.1439851348959832147598734598273456723948652983045928346598365;
-  do {
-    DoLog(0) && (Log() << Verbose(0) << text);
-    cin >> test;
-  } while (test == 0.1439851348959832147598734598273456723948652983045928346598365);
-  return test;
-};
-
-/** Output of a debug message to stderr.
- * \param *P Problem at hand, points to ParallelSimulationData#me
- * \param output output string
- */
-#ifdef HAVE_DEBUG
-void debug_in(const char *output, const char *file, const int line) {
-  if (output) fprintf(stderr,"DEBUG: in %s at line %i: %s\n", file, line, output);
-}
-#else
-void debug_in(const char *output, const char *file, const int line) {}  // print nothing
-#endif
-
-/** modulo operator for doubles.
- * \param *b pointer to double
- * \param lower_bound lower bound
- * \param upper_bound upper bound
- */
-void bound(double *b, double lower_bound, double upper_bound)
-{
-  double step = (upper_bound - lower_bound);
-  while (*b >= upper_bound)
-    *b -= step;
-  while (*b < lower_bound)
-    *b += step;
-};
-
-/** Counts lines in file.
- * Note we are scanning lines from current position, not from beginning.
- * \param InputFile file to be scanned.
- */
-int CountLinesinFile(ifstream &InputFile)
-{
-  char *buffer = new char[MAXSTRINGSIZE];
-  int lines=0;
-
-  int PositionMarker = InputFile.tellg();  // not needed as Inputfile is copied, given by value, not by ref
-  // count the number of lines, i.e. the number of fragments
-  InputFile.getline(buffer, MAXSTRINGSIZE); // skip comment lines
-  InputFile.getline(buffer, MAXSTRINGSIZE);
-  while(!InputFile.eof()) {
-    InputFile.getline(buffer, MAXSTRINGSIZE);
-    lines++;
-  }
-  InputFile.seekg(PositionMarker, ios::beg);
-  delete[](buffer);
-  return lines;
-};
-
-/** Returns a string with \a i prefixed with 0s to match order of total number of molecules in digits.
- * \param FragmentNumber total number of fragments to determine necessary number of digits
- * \param digits number to create with 0 prefixed
- * \return allocated(!) char array with number in digits, ten base.
- */
-char *FixedDigitNumber(const int FragmentNumber, const int digits)
-{
-  char *returnstring;
-  int number = FragmentNumber;
-  int order = 0;
-  while (number != 0) { // determine number of digits needed
-    number = (int)floor(((double)number / 10.));
-    order++;
-    //Log() << Verbose(0) << "Number is " << number << ", order is " << order << "." << endl;
-  }
-  // allocate string
-  returnstring = new char[order + 2];
-  // terminate  and fill string array from end backward
-  returnstring[order] = '\0';
-  number = digits;
-  for (int i=order;i--;) {
-    returnstring[i] = '0' + (char)(number % 10);
-    number = (int)floor(((double)number / 10.));
-  }
-  //Log() << Verbose(0) << returnstring << endl;
-  return returnstring;
-};
-
-/** Tests whether a given string contains a valid number or not.
- * \param *string
- * \return true - is a number, false - is not a valid number
- */
-bool IsValidNumber( const char *string)
-{
-  int ptr = 0;
-  if ((string[ptr] == '.') || (string[ptr] == '-')) // number may be negative or start with dot
-    ptr++;
-  if ((string[ptr] >= '0') && (string[ptr] <= '9'))
-    return true;
-  return false;
-};
-
-/** Comparison function for GSL heapsort on distances in two molecules.
- * \param *a
- * \param *b
- * \return <0, \a *a less than \a *b, ==0 if equal, >0 \a *a greater than \a *b
- */
-int CompareDoubles (const void * a, const void * b)
-{
-  if (*(double *)a > *(double *)b)
-    return -1;
-  else if (*(double *)a < *(double *)b)
-    return 1;
-  else
-    return 0;
-};
-
-
-/**
- * Calls exit(255).
- */
-void performCriticalExit() {
-  exit(255);
-}
Index: c/helpers.hpp
===================================================================
--- src/helpers.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,196 +1,0 @@
-/** \file helpers.hpp
- *
- * Declaration of some auxiliary functions for memory dis-/allocation and so on
- */
-
-#ifndef HELPERS_HPP_
-#define HELPERS_HPP_
-
-using namespace std;
-
-/*********************************************** includes ***********************************/
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <fstream>
-
-#include "defs.hpp"
-#include "log.hpp"
-
-/********************************************** definitions *********************************/
-
-/********************************************** helpful functions *********************************/
-
-// taken out of TREMOLO
-/*@-namechecks@*/
-#ifndef __GNUC__
-# undef __attribute__
-# define __attribute__(x)
-#endif
-/*@=namechecks@*/
-
-/* Behandelt aufgetretene Fehler. error ist der Fehlertyp(enum Errors)
-   void *SpecialData ist ein untypisierter Zeiger auf Spezielle Daten zur Fehlerbehandlung.
-   Man koennte auch noch einen Zeiger auf eine Funktion uebergeben */
-extern void /*@exits@*/ debug(const char *output);
-  //__attribute__ ((__return__));
-#define debug(data) debug_in((data), __FILE__, __LINE__)
-
-extern void /*@exits@*/ debug_in(const char *output,
-    const char *file, const int line);
-  //__attribute__ ((__return__));
-
-double ask_value(const char *text);
-bool check_bounds(double *x, double *cell_size);
-void bound(double *b, double lower_bound, double upper_bound);
-int CountLinesinFile(ifstream &InputFile);
-char *FixedDigitNumber(const int FragmentNumber, const int digits);
-bool IsValidNumber( const char *string);
-int CompareDoubles (const void * a, const void * b);
-void performCriticalExit();
-
-/********************************************** helpful template functions *********************************/
-
-
-/** returns greater of the two values.
- * \param x first value
- * \param y second value
- * \return greater of the two (by operator>())
- */
-template <typename T> T Max(T x, T y)
-{
-  if (x > y)
-    return x;
-  else return y;
-};
-
-/** returns smaller of the two values.
- * \param x first value
- * \param y second value
- * \return smaller of the two (by operator<())
- */
-template <typename T> T Min(T x, T y)
-{
-  if (x < y)
-    return x;
-  else return y;
-};
-
-/** Creates a lookup table for true father's Atom::Nr -> atom ptr.
- * \param *start begin of chain list
- * \paran *end end of chain list
- * \param **Lookuptable pointer to return allocated lookup table (should be NULL on start)
- * \param count optional predetermined size for table (otherwise we set the count to highest true father id)
- * \return true - success, false - failure
- */
-template <typename T> bool CreateFatherLookupTable(T *start, T *end, T **&LookupTable, int count = 0)
-{
-  bool status = true;
-  T *Walker = NULL;
-  int AtomNo;
-
-  if (LookupTable != NULL) {
-    DoeLog(0) && (eLog() << Verbose(0) << "Pointer for Lookup table is not NULL! Aborting ..." <<endl);
-    return false;
-  }
-
-  // count them
-  if (count == 0) {
-    Walker = start;
-    while (Walker->next != end) { // create a lookup table (Atom::nr -> atom) used as a marker table lateron
-      Walker = Walker->next;
-      count = (count < Walker->GetTrueFather()->nr) ? Walker->GetTrueFather()->nr : count;
-    }
-  }
-  if (count <= 0) {
-    DoeLog(1) && (eLog() << Verbose(1) << "Count of lookup list is 0 or less." << endl);
-    return false;
-  }
-
-  // allocate and fill
-  LookupTable = new T*[count];
-  if (LookupTable == NULL) {
-    DoeLog(0) && (eLog()<< Verbose(0) << "LookupTable memory allocation failed!" << endl);
-    performCriticalExit();
-    status = false;
-  } else {
-    Walker = start;
-    while (Walker->next != end) { // create a lookup table (Atom::nr -> atom) used as a marker table lateron
-      Walker = Walker->next;
-      AtomNo = Walker->GetTrueFather()->nr;
-      if ((AtomNo >= 0) && (AtomNo < count)) {
-        //*out << "Setting LookupTable[" << AtomNo << "] to " << *Walker << endl;
-        LookupTable[AtomNo] = Walker;
-      } else {
-        DoeLog(2) && (eLog() << Verbose(2) << "Walker " << *Walker << " exceeded range of nuclear ids [0, " << count << ")." << endl);
-        status = false;
-        break;
-      }
-    }
-  }
-
-  return status;
-};
-
-
-/** Frees a two-dimensional array.
- * \param *ptr pointer to array
- * \param dim first dim of array
- */
-template <typename X> void Free2DArray(X **ptr, int dim)
-{
-  int i;
-  if (ptr != NULL) {
-    for(i=dim;i--;)
-      if (ptr[i] != NULL)
-        free(ptr[i]);
-    free(ptr);
-  }
-};
-
-template <typename T> void Increment(T *value, T *inc)
-{
-  *value += *inc;
-};
-
-template <typename T> void AbsoluteValue(T *value, T *abs)
-{
-  *value = *abs;
-};
-
-template <typename T> void IncrementalAbsoluteValue(T *value, T *abs)
-{
-  *value = *abs;
-  (*abs) += 1;
-};
-
-#define PLURAL_S(v) (((v)==1)?"":"s")
-
-// this is to allow different modes of access for
-// maps and sets
-template<typename Res,typename T>
-struct _take{
-  Res get(T value) const;
-};
-
-// if we have a set,vector etc we can directly access the result
-template<typename Res>
-struct _take<Res,Res>{
-  static inline Res get(Res value){
-    return value;
-  }
-};
-
-// if we have a map we have to access the second part of
-// the pair
-template<typename Res,typename T1>
-struct _take<Res,std::pair<T1,Res> >{
-  static inline Res get(std::pair<T1,Res> value){
-    return value.second;
-  }
-};
-
-#endif /*HELPERS_HPP_*/
Index: c/info.cpp
===================================================================
--- src/info.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Info.cpp
- *
- *  Created on: Nov 25, 2009
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "info.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
-
-int Info::verbosity = 0;
-
-/**
- * Constructor. Do not use this function. Use getInstance() instead.
- *
- * \return Info instance
- */
-Info::Info(const char *msg)
-{
-  verbosity++;
-  FunctionName = msg;
-  DoLog(0) && (Log() << Verbose(0) << "Begin of " << FunctionName << endl);
-};
-
-/**
- * Destructor. Better use purgeInstance().
- */
-Info::~Info() {
-  DoLog(0) && (Log() << Verbose(0) << "End of " << FunctionName << endl);
-  verbosity--;
-}
-
-/**
- * Sets the verbosity.
- *
- * \param verbosityLevel verbosity
- */
-void Info::setVerbosity(int verbosityLevel) {
-  verbosity = verbosityLevel;
-}
Index: c/info.hpp
===================================================================
--- src/info.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,30 +1,0 @@
-/*
- * Info.hpp
- *
- *  Created on: Nov 25, 2009
- *      Author: heber
- */
-
-#ifndef INFO_HPP_
-#define INFO_HPP_
-
-using namespace std;
-
-/*********************************************** includes ***********************************/
-
-/****************************************** forward declarations *****************************/
-
-/********************************************** definitions *********************************/
-
-class Info {
-public :
-  static int verbosity;
-  const char *FunctionName;
-
-  Info(const char *msg);
-  ~Info();
-  static void setVerbosity(int verbosityLevel);
-
-};
-
-#endif /* INFO_HPP_ */
Index: src/joiner.cpp
===================================================================
--- src/joiner.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/joiner.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file joiner.cpp
  *
@@ -8,4 +15,9 @@
 //============================ INCLUDES ===========================
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -13,8 +25,8 @@
 
 #include "datacreator.hpp"
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 #include "parser.hpp"
 #include "periodentafel.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 
 //============================== MAIN =============================
@@ -209,5 +221,9 @@
   prefix << dir << ForceFragmentSuffix;
   if (!ForceFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1;
-  if (!CreateDataFragment(EnergyFragments, KeySet, argv[1], FRAGMENTPREFIX ENERGYPERFRAGMENT, "fragment energy versus the Fragment No", "today", CreateEnergy)) return 1;
+  {
+    std::string fileprefix(FRAGMENTPREFIX);
+    fileprefix += ENERGYPERFRAGMENT;
+    if (!CreateDataFragment(EnergyFragments, KeySet, argv[1], fileprefix.c_str(), "fragment energy versus the Fragment No", "today", CreateEnergy)) return 1;
+  }
   if (!NoHessian) {
     prefix.str(" ");
Index: src/leastsquaremin.cpp
===================================================================
--- src/leastsquaremin.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/leastsquaremin.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * leastsquaremin.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -11,5 +23,5 @@
 
 #include "leastsquaremin.hpp"
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 
 /** Determines sum of squared distances of \a X to all \a **vectors.
Index: c/linearsystemofequations.cpp
===================================================================
--- src/linearsystemofequations.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/*
- * linearsystemofequations.cpp
- *
- *  Created on: Jan 8, 2010
- *      Author: heber
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "defs.hpp"
-#include "gslmatrix.hpp"
-#include "gslvector.hpp"
-#include "linearsystemofequations.hpp"
-#include "logger.hpp"
-#include "vector.hpp"
-
-#include <cassert>
-#include <gsl/gsl_permutation.h>
-
-/** Constructor for class LinearSystemOfEquations.
- * Allocates Vector and Matrix classes.
- * \param m column dimension
- * \param n row dimension
- */
-LinearSystemOfEquations::LinearSystemOfEquations(int m, int n) : rows(m), columns(n), IsSymmetric(false)
-{
-  A = new GSLMatrix(m, n);
-  b = new GSLVector(m);
-  x = new GSLVector(n);
-};
-
-/** Destructor for class LinearSystemOfEquations.
- * Destructs Vector and Matrix classes.
- */
-LinearSystemOfEquations::~LinearSystemOfEquations()
-{
-  delete(A);
-  delete(b);
-  delete(x);
-};
-
-/** Sets whether matrix is to be regarded as symmetric.
- * Note that we do not check whether it really is, just take upper diagonal.
- * \param symmetric true or false
- */
-bool LinearSystemOfEquations::SetSymmetric(bool symmetric)
-{
-  assert (rows == columns && "Rows and columns don't have equal size! Setting symmetric not possible.");
-  return (IsSymmetric = symmetric);
-};
-
-/** Initializes vector b to the components of the given vector.
- * \param *x Vector with equal dimension (no check!)
- */
-void LinearSystemOfEquations::Setb(Vector *x)
-{
-  assert ( columns == NDIM && "Vector class is always three-dimensional, unlike this LEqS!");
-  b->SetFromVector(*x);
-};
-
-/** Initializes vector b to the components of the given vector.
- * \param *x array with equal dimension (no check!)
- */
-void LinearSystemOfEquations::Setb(double *x)
-{
-  b->SetFromDoubleArray(x);
-};
-
-/** Initializes matrix a to the components of the given array.
- * note that sort order should be
- * \param *x array with equal dimension (no check!)
- */
-void LinearSystemOfEquations::SetA(double *x)
-{
-  A->SetFromDoubleArray(x);
-};
-
-/** Returns the solution vector x \f$A \cdot x = b\f$ as an array of doubles.
- * \param *array pointer allocated array for solution on return (no bounds check, dimension must match)
- * \return true - solving possible, false - some error occured.
- */
-bool LinearSystemOfEquations::GetSolutionAsArray(double *&array)
-{
-  bool status = Solve();
-
-  // copy solution
-  for (size_t i=0;i<x->dimension;i++) {
-    array[i] = x->Get(i);
-  }
-  return status;
-};
-
-/** Returns the solution vector x \f$A \cdot x = b\f$ as an array of doubles.
- * \param &x solution vector on return (must be 3-dimensional)
- * \return true - solving possible, false - some error occured.
- */
-bool LinearSystemOfEquations::GetSolutionAsVector(Vector &v)
-{
-  assert(rows == NDIM && "Solution can only be returned as vector if number of columns is NDIM.");
-  bool status = Solve();
-
-  // copy solution
-  for (size_t i=0;i<x->dimension;i++)
-    v[i] = x->Get(i);
-  return status;
-};
-
-/** Solves the given system of \f$A \cdot x = b\f$.
- * Use either LU or Householder decomposition.
- * Solution is stored in LinearSystemOfEquations::x
- * \return true - solving possible, false - some error occured.
- */
-bool LinearSystemOfEquations::Solve()
-{
-  // calculate solution
-  int s;
-  if (IsSymmetric) { // use LU
-    gsl_permutation * p = gsl_permutation_alloc (x->dimension);
-    gsl_linalg_LU_decomp (A->matrix, p, &s);
-    gsl_linalg_LU_solve (A->matrix, p, b->vector, x->vector);
-    gsl_permutation_free (p);
-  } else {  // use Householder
-    //GSLMatrix *backup = new GSLMatrix(rows,columns);
-    //*backup = *A;
-    gsl_linalg_HH_solve (A->matrix, b->vector, x->vector);
-    //*A = *backup;
-    //delete(backup);
-  }
-  return true;
-};
-
Index: c/linearsystemofequations.hpp
===================================================================
--- src/linearsystemofequations.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * linearsystemofequations.hpp
- *
- *  Created on: Jan 8, 2010
- *      Author: heber
- */
-
-using namespace std;
-
-/*********************************************** includes ***********************************/
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gsl/gsl_linalg.h>
-
-/****************************************** forward declarations *****************************/
-
-class Vector;
-class GSLMatrix;
-class GSLVector;
-
-/********************************************** declarations *******************************/
-
-/** Solver class for a linear system of equations in the form \f$A \cdot x = b\F$.
- *
- */
-class LinearSystemOfEquations {
-public:
-  LinearSystemOfEquations(int n, int m);
-  ~LinearSystemOfEquations();
-
-  // setting
-  void Setb(Vector *x);
-  void Setb(double *x);
-  void SetA(double *x);
-  bool SetSymmetric(bool symmetric);
-
-  // solving
-  bool GetSolutionAsArray(double *&array);
-  bool GetSolutionAsVector(Vector &v);
-
-  GSLVector *b;
-  GSLVector *x;
-  GSLMatrix *A;
-
-private:
-  bool Solve();
-
-  int rows;
-  int columns;
-
-  bool IsSymmetric;
-};
Index: src/linkedcell.cpp
===================================================================
--- src/linkedcell.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/linkedcell.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file linkedcell.cpp
  *
@@ -5,27 +12,52 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
 #include "atom.hpp"
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 #include "linkedcell.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
+#include "PointCloud.hpp"
 #include "tesselation.hpp"
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 
 // ========================================================= class LinkedCell ===========================================
 
+/** Constructor for class LinkedCell::LinkedNodes.
+ */
+LinkedCell::LinkedNodes::LinkedNodes()
+{}
+
+/** Destructor for class LinkedCell::LinkedNodes.
+ */
+LinkedCell::LinkedNodes::~LinkedNodes()
+{}
+
+TesselPoint * LinkedCell::LinkedNodes::getValue (const_iterator &rhs) const
+{
+  return *rhs;
+}
+
+TesselPoint * LinkedCell::LinkedNodes::getValue (iterator &rhs) const
+{
+  return *rhs;
+}
 
 /** Constructor for class LinkedCell.
  */
-LinkedCell::LinkedCell()
-{
-  LC = NULL;
+LinkedCell::LinkedCell() :
+  LC(NULL),
+  RADIUS(0.),
+  index(-1)
+{
   for(int i=0;i<NDIM;i++)
     N[i] = 0;
-  index = -1;
-  RADIUS = 0.;
   max.Zero();
   min.Zero();
@@ -36,37 +68,37 @@
  * \param RADIUS edge length of cells
  */
-LinkedCell::LinkedCell(const PointCloud * const set, const double radius)
+LinkedCell::LinkedCell(const PointCloud & set, const double radius) :
+  LC(NULL),
+  RADIUS(radius),
+  index(-1)
 {
   TesselPoint *Walker = NULL;
 
-  RADIUS = radius;
-  LC = NULL;
   for(int i=0;i<NDIM;i++)
     N[i] = 0;
-  index = -1;
   max.Zero();
   min.Zero();
   DoLog(1) && (Log() << Verbose(1) << "Begin of LinkedCell" << endl);
-  if ((set == NULL) || (set->IsEmpty())) {
+  if (set.IsEmpty()) {
     DoeLog(1) && (eLog()<< Verbose(1) << "set is NULL or contains no linked cell nodes!" << endl);
     return;
   }
   // 1. find max and min per axis of atoms
-  set->GoToFirst();
-  Walker = set->GetPoint();
-  for (int i=0;i<NDIM;i++) {
-    max[i] = Walker->node->at(i);
-    min[i] = Walker->node->at(i);
-  }
-  set->GoToFirst();
-  while (!set->IsEnd()) {
-    Walker = set->GetPoint();
+  set.GoToFirst();
+  Walker = set.GetPoint();
+  for (int i=0;i<NDIM;i++) {
+    max[i] = Walker->at(i);
+    min[i] = Walker->at(i);
+  }
+  set.GoToFirst();
+  while (!set.IsEnd()) {
+    Walker = set.GetPoint();
     for (int i=0;i<NDIM;i++) {
-      if (max[i] < Walker->node->at(i))
-        max[i] = Walker->node->at(i);
-      if (min[i] > Walker->node->at(i))
-        min[i] = Walker->node->at(i);
+      if (max[i] < Walker->at(i))
+        max[i] = Walker->at(i);
+      if (min[i] > Walker->at(i))
+        min[i] = Walker->at(i);
     }
-    set->GoToNext();
+    set.GoToNext();
   }
   DoLog(2) && (Log() << Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl);
@@ -84,4 +116,5 @@
     return;
   }
+  ASSERT(N[0]*N[1]*N[2] < MAX_LINKEDCELLNODES, "Number linked of linked cell nodes exceded hard-coded limit, use greater edge length!");
   LC = new LinkedNodes[N[0]*N[1]*N[2]];
   for (index=0;index<N[0]*N[1]*N[2];index++) {
@@ -92,14 +125,14 @@
   // 4. put each atom into its respective cell
   DoLog(2) && (Log() << Verbose(2) << "Filling cells ... ");
-  set->GoToFirst();
-  while (!set->IsEnd()) {
-    Walker = set->GetPoint();
+  set.GoToFirst();
+  while (!set.IsEnd()) {
+    Walker = set.GetPoint();
     for (int i=0;i<NDIM;i++) {
-      n[i] = static_cast<int>(floor((Walker->node->at(i) - min[i])/RADIUS));
+      n[i] = static_cast<int>(floor((Walker->at(i) - min[i])/RADIUS));
     }
     index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
     LC[index].push_back(Walker);
     //Log() << Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl;
-    set->GoToNext();
+    set.GoToNext();
   }
   DoLog(0) && (Log() << Verbose(0) << "done."  << endl);
@@ -107,73 +140,4 @@
 };
 
-
-/** Puts all atoms in \a *mol into a linked cell list with cell's lengths of \a RADIUS
- * \param *set LCNodeSet class with all LCNode's
- * \param RADIUS edge length of cells
- */
-LinkedCell::LinkedCell(LinkedNodes *set, const double radius)
-{
-  class TesselPoint *Walker = NULL;
-  RADIUS = radius;
-  LC = NULL;
-  for(int i=0;i<NDIM;i++)
-    N[i] = 0;
-  index = -1;
-  max.Zero();
-  min.Zero();
-  DoLog(1) && (Log() << Verbose(1) << "Begin of LinkedCell" << endl);
-  if (set->empty()) {
-    DoeLog(1) && (eLog()<< Verbose(1) << "set contains no linked cell nodes!" << endl);
-    return;
-  }
-  // 1. find max and min per axis of atoms
-  LinkedNodes::iterator Runner = set->begin();
-  for (int i=0;i<NDIM;i++) {
-    max[i] = (*Runner)->node->at(i);
-    min[i] = (*Runner)->node->at(i);
-  }
-  for (LinkedNodes::iterator Runner = set->begin(); Runner != set->end(); Runner++) {
-    Walker = *Runner;
-    for (int i=0;i<NDIM;i++) {
-      if (max[i] < Walker->node->at(i))
-        max[i] = Walker->node->at(i);
-      if (min[i] > Walker->node->at(i))
-        min[i] = Walker->node->at(i);
-    }
-  }
-  DoLog(2) && (Log() << Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl);
-
-  // 2. find then number of cells per axis
-  for (int i=0;i<NDIM;i++) {
-    N[i] = static_cast<int>(floor((max[i] - min[i])/RADIUS)+1);
-  }
-  DoLog(2) && (Log() << Verbose(2) << "Number of cells per axis are " << N[0] << ", " << N[1] << " and " << N[2] << "." << endl);
-
-  // 3. allocate the lists
-  DoLog(2) && (Log() << Verbose(2) << "Allocating cells ... ");
-  if (LC != NULL) {
-    DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell list is already allocated, I do nothing." << endl);
-    return;
-  }
-  LC = new LinkedNodes[N[0]*N[1]*N[2]];
-  for (index=0;index<N[0]*N[1]*N[2];index++) {
-    LC [index].clear();
-  }
-  DoLog(0) && (Log() << Verbose(0) << "done."  << endl);
-
-  // 4. put each atom into its respective cell
-  DoLog(2) && (Log() << Verbose(2) << "Filling cells ... ");
-  for (LinkedNodes::iterator Runner = set->begin(); Runner != set->end(); Runner++) {
-    Walker = *Runner;
-    for (int i=0;i<NDIM;i++) {
-      n[i] = static_cast<int>(floor((Walker->node->at(i) - min[i])/RADIUS));
-    }
-    index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
-    LC[index].push_back(Walker);
-    //Log() << Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl;
-  }
-  DoLog(0) && (Log() << Verbose(0) << "done."  << endl);
-  DoLog(1) && (Log() << Verbose(1) << "End of LinkedCell" << endl);
-};
 
 /** Destructor for class LinkedCell.
@@ -248,8 +212,8 @@
  * \return Vector is inside bounding box - true, else - false
  */
-bool LinkedCell::SetIndexToVector(const Vector * const x) const
+bool LinkedCell::SetIndexToVector(const Vector & x) const
 {
   for (int i=0;i<NDIM;i++)
-    n[i] = (int)floor((x->at(i) - min[i])/RADIUS);
+    n[i] = (int)floor((x.at(i) - min[i])/RADIUS);
 
   return CheckBounds();
@@ -264,5 +228,5 @@
   bool status = false;
   for (int i=0;i<NDIM;i++) {
-    n[i] = static_cast<int>(floor((Walker->node->at(i) - min[i])/RADIUS));
+    n[i] = static_cast<int>(floor((Walker->at(i) - min[i])/RADIUS));
   }
   index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
@@ -404,5 +368,5 @@
       Walker = *Runner;
       //Log() << Verbose(1) << "Current neighbour is at " << *Walker->node << "." << endl;
-      if ((center->DistanceSquared(*Walker->node) - radiusSquared) < MYEPSILON) {
+      if ((Walker->DistanceSquared(*center) - radiusSquared) < MYEPSILON) {
         TesselList->push_back(Walker);
       }
Index: src/linkedcell.hpp
===================================================================
--- src/linkedcell.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/linkedcell.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -22,7 +22,13 @@
 
 #include <list>
+#include <vector>
+#include <map>
 
+#include "Helpers/Assert.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
 #include "defs.hpp"
-#include "vector.hpp"
+#include "World.hpp"
+#include "LinearAlgebra/Vector.hpp"
 
 /****************************************** forward declarations *****************************/
@@ -33,4 +39,6 @@
 /********************************************** definitions *********************************/
 
+//< Upper bound for number of cell nodes used in sensibility check on allocation.
+enum { MAX_LINKEDCELLNODES = 1000000 };
 
 /********************************************** declarations *******************************/
@@ -42,5 +50,13 @@
 
 public:
-  typedef list<TesselPoint *> LinkedNodes;
+  class LinkedNodes : public std::list<TesselPoint *> {
+  public:
+    LinkedNodes();
+    ~LinkedNodes();
+
+    TesselPoint * getValue (const_iterator &rhs) const;
+    TesselPoint * getValue (iterator &rhs) const;
+  };
+  //typedef list<TesselPoint *> LinkedNodes;
 
 
@@ -54,11 +70,77 @@
 
     LinkedCell();
-    LinkedCell(const  PointCloud * const set, const double RADIUS);
-    LinkedCell(LinkedNodes *set, const double radius);
+    LinkedCell(const PointCloud &set, const double radius);
+    template <class T> LinkedCell(const T &set, const double radius) :
+      LC(NULL),
+      RADIUS(radius),
+      index(-1)
+    {
+      class TesselPoint *Walker = NULL;
+      for(int i=0;i<NDIM;i++)
+        N[i] = 0;
+      max.Zero();
+      min.Zero();
+      DoLog(1) && (Log() << Verbose(1) << "Begin of LinkedCell" << endl);
+      if (set.begin() == set.end()) {
+        DoeLog(1) && (eLog()<< Verbose(1) << "set contains no linked cell nodes!" << endl);
+        return;
+      }
+      // 1. find max and min per axis of atoms
+      typename T::const_iterator Runner = set.begin();
+      for (int i=0;i<NDIM;i++) {
+        max[i] = set.getValue(Runner)->at(i);
+        min[i] = set.getValue(Runner)->at(i);
+      }
+      for (typename T::const_iterator Runner = set.begin(); Runner != set.end(); Runner++) {
+        Walker = set.getValue(Runner);
+        for (int i=0;i<NDIM;i++) {
+          if (max[i] < Walker->at(i))
+            max[i] = Walker->at(i);
+          if (min[i] > Walker->at(i))
+            min[i] = Walker->at(i);
+        }
+      }
+      DoLog(2) && (Log() << Verbose(2) << "Bounding box is " << min << " and " << max << "." << endl);
+
+      // 2. find then number of cells per axis
+      for (int i=0;i<NDIM;i++) {
+        N[i] = static_cast<int>(floor((max[i] - min[i])/RADIUS)+1);
+      }
+      DoLog(2) && (Log() << Verbose(2) << "Number of cells per axis are " << N[0] << ", " << N[1] << " and " << N[2] << "." << endl);
+
+      // 3. allocate the lists
+      DoLog(2) && (Log() << Verbose(2) << "Allocating cells ... ");
+      if (LC != NULL) {
+        DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell list is already allocated, I do nothing." << endl);
+        return;
+      }
+      ASSERT(N[0]*N[1]*N[2] < MAX_LINKEDCELLNODES, "Number linked of linked cell nodes exceded hard-coded limit, use greater edge length!");
+      LC = new LinkedNodes[N[0]*N[1]*N[2]];
+      for (index=0;index<N[0]*N[1]*N[2];index++) {
+        LC [index].clear();
+      }
+      DoLog(0) && (Log() << Verbose(0) << "done."  << endl);
+
+      // 4. put each atom into its respective cell
+      DoLog(2) && (Log() << Verbose(2) << "Filling cells ... ");
+      for (typename T::const_iterator Runner = set.begin(); Runner != set.end(); Runner++) {
+        Walker = set.getValue(Runner);
+        for (int i=0;i<NDIM;i++) {
+          n[i] = static_cast<int>(floor((Walker->at(i) - min[i])/RADIUS));
+        }
+        index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
+        LC[index].push_back(Walker);
+        //Log() << Verbose(2) << *Walker << " goes into cell " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl;
+      }
+      DoLog(0) && (Log() << Verbose(0) << "done."  << endl);
+      DoLog(1) && (Log() << Verbose(1) << "End of LinkedCell" << endl);
+    };
+
+
     ~LinkedCell();
     const LinkedCell::LinkedNodes* GetCurrentCell()const ;
     const LinkedCell::LinkedNodes* GetRelativeToCurrentCell(const int relative[NDIM])const ;
     bool SetIndexToNode(const TesselPoint * const Walker)const ;
-    bool SetIndexToVector(const Vector * const x)const ;
+    bool SetIndexToVector(const Vector &x)const ;
     double SetClosestIndexToOutsideVector(const Vector * const x) const;
     bool CheckBounds()const ;
Index: c/log.cpp
===================================================================
--- src/log.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * log.cpp
- *
- *  Created on: Oct 19, 2009
- *      Author: metzler
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "logger.hpp"
-#include "errorlogger.hpp"
-
-/**
- * Sets verbosity for the error logger and the standard logger.
- *
- * \param int verbosity level
- */
-void setVerbosity(int verbosityLevel) {
-  logger::getInstance().setVerbosity(verbosityLevel);
-}
-
-/**
- * Prints a log entry.
- *
- * \param indentation level of the message to log
- */
-class logger& Log() {
-  return logger::getInstance();
-}
-
-/** Checks verbosity for logger.
- * Is supposed to be used in construct as this:
- * DoLog(2) && (Log() << Verbose(2) << "message." << endl);
- * If DoLog does not return true, the right-hand side is not evaluated and we save some time.
- * \param verbose verbosity level of this message
- * \return true - print, false - don't
- */
-bool DoLog(int verbose) {
-  return (verbose <= logger::getInstance().verbosity);
-}
-
-/** Checks verbosity for errorlogger.
- * Is supposed to be used in construct as this:
- * DoLog(2) && (Log() << Verbose(2) << "message." << endl);
- * If DoLog does not return true, the right-hand side is not evaluated and we save some time.
- * \param verbose verbosity level of this message
- * \return true - print, false - don't
- */
-bool DoeLog(int verbose) {
-  return (verbose <= errorLogger::getInstance().verbosity);
-}
-
-/**
- * Prints an error log entry.
- *
- * \param indentation level of the message to log
- */
-class errorLogger & eLog() {
-  return errorLogger::getInstance();
-}
Index: c/log.hpp
===================================================================
--- src/log.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,20 +1,0 @@
-/*
- * log.hpp
- *
- *  Created on: Oct 19, 2009
- *      Author: metzler
- */
-
-#ifndef LOG_HPP_
-#define LOG_HPP_
-
-#include "errorlogger.hpp"
-#include "logger.hpp"
-
-class logger * Log();
-class errorLogger * eLog();
-void setVerbosity(int verbosityLevel);
-bool DoLog(int verbose);
-bool DoeLog(int verbose);
-
-#endif /* LOG_HPP_ */
Index: c/logger.cpp
===================================================================
--- src/logger.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * logger.cpp
- *
- *  Created on: Oct 19, 2009
- *      Author: metzler
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include <fstream>
-#include <iostream>
-#include "logger.hpp"
-#include "verbose.hpp"
-#include "Patterns/Singleton_impl.hpp"
-
-ofstream nullStream("/dev/null");
-
-int logger::verbosity = 2;
-ostream* logger::nix = &nullStream;
-
-/**
- * Constructor. Do not use this function. Use getInstance() instead.
- *
- * \return logger instance
- */
-logger::logger()
-{
-  verbosity = 2;
-};
-
-/**
- * Destructor. Better use purgeInstance().
- */
-logger::~logger() {
-  verbosity = 2;
-}
-
-CONSTRUCT_SINGLETON(logger)
-
-/**
- * Sets the verbosity.
- *
- * \param verbosityLevel verbosity
- */
-void logger::setVerbosity(int verbosityLevel) {
-  verbosity = verbosityLevel;
-}
-
-/**
- * Operator for the Binary(arg) call.
- * Constructs temporary a Verbose class object, wherein the Binary is stored.
- * Then << is called, which calls Binary's print which adds the tabs and logs
- * the stream.
- * \param &ost stream to extend
- * \param &m pointer to created Binary object
- * \return &ost
- */
-ostream& operator<<(class logger& l, const Verbose& v)
-{
-  int verbosityLevel = l.verbosity;
-  l.nix->clear();
-  if (v.DoOutput(verbosityLevel)) {
-    v.print(cout);
-    return cout;
-  } else
-    return *l.nix;
-};
-ostream& operator<<(class logger* l, const Verbose& v)
-{
-  int verbosityLevel = l->verbosity;
-  l->nix->clear();
-  if (v.DoOutput(verbosityLevel)) {
-    v.print(cout);
-    return cout;
-  } else
-    return *l->nix;
-};
-
Index: c/logger.hpp
===================================================================
--- src/logger.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * logger.hpp
- *
- *  Created on: Oct 19, 2009
- *      Author: metzler
- */
-
-#ifndef LOGGER_HPP_
-#define LOGGER_HPP_
-
-#include <iosfwd>
-
-#include "Patterns/Singleton.hpp"
-
-using namespace std;
-
-class Verbose;
-
-class logger : public Singleton<logger> {
-  friend class Singleton<logger>;
-public :
-  static ostream *nix;
-  static int verbosity;
-
-  static bool DoOutput();
-  static void setVerbosity(int verbosityLevel);
-
-protected:
-  /** Do not call this constructor directly, use getInstance() instead. */
-  logger();
-  /** Do not call this destructor directly, use purgeInstance() instead. */
-  ~logger();
-};
-
-ostream& operator<<(class logger&l, const Verbose& ost);
-ostream& operator<<(class logger*l, const Verbose& ost);
-
-#endif /* LOGGER_HPP_ */
Index: src/molecule.cpp
===================================================================
--- src/molecule.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/molecule.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file molecules.cpp
  *
@@ -5,4 +12,5 @@
  */
 
+// include config.h
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -24,9 +32,9 @@
 #include "element.hpp"
 #include "graph.hpp"
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 #include "leastsquaremin.hpp"
 #include "linkedcell.hpp"
 #include "lists.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 
@@ -34,9 +42,9 @@
 #include "stackclass.hpp"
 #include "tesselation.hpp"
-#include "vector.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "World.hpp"
 #include "Box.hpp"
-#include "Plane.hpp"
+#include "LinearAlgebra/Plane.hpp"
 #include "Exceptions/LinearDependenceException.hpp"
 
@@ -75,5 +83,5 @@
 
 // getter and setter
-const std::string molecule::getName(){
+const std::string molecule::getName() const{
   return std::string(name);
 }
@@ -89,5 +97,18 @@
 }
 
-moleculeId_t molecule::getId(){
+bool molecule::changeId(moleculeId_t newId){
+  // first we move ourselves in the world
+  // the world lets us know if that succeeded
+  if(World::getInstance().changeMoleculeId(id,newId,this)){
+    id = newId;
+    return true;
+  }
+  else{
+    return false;
+  }
+}
+
+
+moleculeId_t molecule::getId() const {
   return id;
 }
@@ -97,9 +118,9 @@
 }
 
-const Formula &molecule::getFormula(){
+const Formula &molecule::getFormula() const {
   return formula;
 }
 
-unsigned int molecule::getElementCount(){
+unsigned int molecule::getElementCount() const{
   return formula.getElementCount();
 }
@@ -151,4 +172,5 @@
 molecule::const_iterator molecule::erase( const_iterator loc )
 {
+  OBSERVE;
   molecule::const_iterator iter = loc;
   iter--;
@@ -156,4 +178,5 @@
   atomIds.erase( atom->getId() );
   atoms.remove( atom );
+  formula-=atom->getType();
   atom->removeFromMolecule();
   return iter;
@@ -162,8 +185,10 @@
 molecule::const_iterator molecule::erase( atom * key )
 {
+  OBSERVE;
   molecule::const_iterator iter = find(key);
   if (iter != end()){
     atomIds.erase( key->getId() );
     atoms.remove( key );
+    formula-=key->getType();
     key->removeFromMolecule();
   }
@@ -183,7 +208,9 @@
 pair<molecule::iterator,bool> molecule::insert ( atom * const key )
 {
+  OBSERVE;
   pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId());
   if (res.second) { // push atom if went well
     atoms.push_back(key);
+    formula+=key->getType();
     return pair<iterator,bool>(molecule::iterator(--end()),res.second);
   } else {
@@ -206,11 +233,10 @@
   if (pointer != NULL) {
     pointer->sort = &pointer->nr;
-    if (pointer->type != NULL) {
-      formula += pointer->type;
-      if (pointer->type->Z != 1)
+    if (pointer->getType() != NULL) {
+      if (pointer->getType()->getAtomicNumber() != 1)
         NoNonHydrogen++;
       if(pointer->getName() == "Unknown"){
         stringstream sstr;
-        sstr << pointer->type->symbol << pointer->nr+1;
+        sstr << pointer->getType()->getSymbol() << pointer->nr+1;
         pointer->setName(sstr.str());
       }
@@ -236,6 +262,7 @@
     walker->nr = last_atom++;  // increase number within molecule
     insert(walker);
-    if ((pointer->type != NULL) && (pointer->type->Z != 1))
+    if ((pointer->getType() != NULL) && (pointer->getType()->getAtomicNumber() != 1))
       NoNonHydrogen++;
+    walker->setMolecule(this);
     retval=walker;
   }
@@ -294,5 +321,5 @@
 //  Log() << Verbose(3) << "Begin of AddHydrogenReplacementAtom." << endl;
   // create vector in direction of bond
-  InBondvector = TopReplacement->x - TopOrigin->x;
+  InBondvector = TopReplacement->getPosition() - TopOrigin->getPosition();
   bondlength = InBondvector.Norm();
 
@@ -306,5 +333,5 @@
     Orthovector1.Zero();
     for (int i=NDIM;i--;) {
-      l = TopReplacement->x[i] - TopOrigin->x[i];
+      l = TopReplacement->at(i) - TopOrigin->at(i);
       if (fabs(l) > BondDistance) { // is component greater than bond distance
         Orthovector1[i] = (l < 0) ? -1. : +1.;
@@ -321,6 +348,6 @@
   InBondvector.Normalize();
   // get typical bond length and store as scale factor for later
-  ASSERT(TopOrigin->type != NULL, "AddHydrogenReplacementAtom: element of TopOrigin is not given.");
-  BondRescale = TopOrigin->type->HBondDistance[TopBond->BondDegree-1];
+  ASSERT(TopOrigin->getType() != NULL, "AddHydrogenReplacementAtom: element of TopOrigin is not given.");
+  BondRescale = TopOrigin->getType()->getHBondDistance(TopBond->BondDegree-1);
   if (BondRescale == -1) {
     DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
@@ -336,8 +363,8 @@
     case 1:
       FirstOtherAtom = World::getInstance().createAtom();    // new atom
-      FirstOtherAtom->type = elemente->FindElement(1);  // element is Hydrogen
-      FirstOtherAtom->v = TopReplacement->v; // copy velocity
+      FirstOtherAtom->setType(1);  // element is Hydrogen
+      FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
       FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
-      if (TopReplacement->type->Z == 1) { // neither rescale nor replace if it's already hydrogen
+      if (TopReplacement->getType()->getAtomicNumber() == 1) { // neither rescale nor replace if it's already hydrogen
         FirstOtherAtom->father = TopReplacement;
         BondRescale = bondlength;
@@ -346,6 +373,5 @@
       }
       InBondvector *= BondRescale;   // rescale the distance vector to Hydrogen bond length
-      FirstOtherAtom->x = TopOrigin->x; // set coordination to origin ...
-      FirstOtherAtom->x += InBondvector;  // ... and add distance vector to replacement atom
+      FirstOtherAtom->setPosition(TopOrigin->getPosition() + InBondvector); // set coordination to origin and add distance vector to replacement atom
       AllWentWell = AllWentWell && AddAtom(FirstOtherAtom);
 //      Log() << Verbose(4) << "Added " << *FirstOtherAtom << " at: ";
@@ -380,5 +406,5 @@
         // determine the plane of these two with the *origin
         try {
-          Orthovector1 =Plane(TopOrigin->x, FirstOtherAtom->x, SecondOtherAtom->x).getNormal();
+          Orthovector1 =Plane(TopOrigin->getPosition(), FirstOtherAtom->getPosition(), SecondOtherAtom->getPosition()).getNormal();
         }
         catch(LinearDependenceException &excp){
@@ -401,13 +427,13 @@
       FirstOtherAtom = World::getInstance().createAtom();
       SecondOtherAtom = World::getInstance().createAtom();
-      FirstOtherAtom->type = elemente->FindElement(1);
-      SecondOtherAtom->type = elemente->FindElement(1);
-      FirstOtherAtom->v = TopReplacement->v; // copy velocity
+      FirstOtherAtom->setType(1);
+      SecondOtherAtom->setType(1);
+      FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
       FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
-      SecondOtherAtom->v = TopReplacement->v; // copy velocity
+      SecondOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
       SecondOtherAtom->FixedIon = TopReplacement->FixedIon;
       FirstOtherAtom->father = NULL;  // we are just an added hydrogen with no father
       SecondOtherAtom->father = NULL;  //  we are just an added hydrogen with no father
-      bondangle = TopOrigin->type->HBondAngle[1];
+      bondangle = TopOrigin->getType()->getHBondAngle(1);
       if (bondangle == -1) {
         DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
@@ -423,17 +449,15 @@
 //      Log() << Verbose(0) << endl;
 //      Log() << Verbose(3) << "Half the bond angle is " << bondangle << ", sin and cos of it: " << sin(bondangle) << ", " << cos(bondangle) << endl;
-      FirstOtherAtom->x.Zero();
-      SecondOtherAtom->x.Zero();
+      FirstOtherAtom->Zero();
+      SecondOtherAtom->Zero();
       for(int i=NDIM;i--;) { // rotate by half the bond angle in both directions (InBondvector is bondangle = 0 direction)
-        FirstOtherAtom->x[i] = InBondvector[i] * cos(bondangle) + Orthovector1[i] * (sin(bondangle));
-        SecondOtherAtom->x[i] = InBondvector[i] * cos(bondangle) + Orthovector1[i] * (-sin(bondangle));
-      }
-      FirstOtherAtom->x *= BondRescale;  // rescale by correct BondDistance
-      SecondOtherAtom->x *= BondRescale;
+        FirstOtherAtom->set(i, InBondvector[i] * cos(bondangle) + Orthovector1[i] * (sin(bondangle)));
+        SecondOtherAtom->set(i, InBondvector[i] * cos(bondangle) + Orthovector1[i] * (-sin(bondangle)));
+      }
+      FirstOtherAtom->Scale(BondRescale);  // rescale by correct BondDistance
+      SecondOtherAtom->Scale(BondRescale);
       //Log() << Verbose(3) << "ReScaleCheck: " << FirstOtherAtom->x.Norm() << " and " << SecondOtherAtom->x.Norm() << "." << endl;
-      for(int i=NDIM;i--;) { // and make relative to origin atom
-        FirstOtherAtom->x[i] += TopOrigin->x[i];
-        SecondOtherAtom->x[i] += TopOrigin->x[i];
-      }
+      *FirstOtherAtom += TopOrigin->getPosition();
+      *SecondOtherAtom += TopOrigin->getPosition();
       // ... and add to molecule
       AllWentWell = AllWentWell && AddAtom(FirstOtherAtom);
@@ -457,12 +481,12 @@
       SecondOtherAtom = World::getInstance().createAtom();
       ThirdOtherAtom = World::getInstance().createAtom();
-      FirstOtherAtom->type = elemente->FindElement(1);
-      SecondOtherAtom->type = elemente->FindElement(1);
-      ThirdOtherAtom->type = elemente->FindElement(1);
-      FirstOtherAtom->v = TopReplacement->v; // copy velocity
+      FirstOtherAtom->setType(1);
+      SecondOtherAtom->setType(1);
+      ThirdOtherAtom->setType(1);
+      FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
       FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
-      SecondOtherAtom->v = TopReplacement->v; // copy velocity
+      SecondOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
       SecondOtherAtom->FixedIon = TopReplacement->FixedIon;
-      ThirdOtherAtom->v = TopReplacement->v; // copy velocity
+      ThirdOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
       ThirdOtherAtom->FixedIon = TopReplacement->FixedIon;
       FirstOtherAtom->father = NULL;  //  we are just an added hydrogen with no father
@@ -487,5 +511,5 @@
 
       // create correct coordination for the three atoms
-      alpha = (TopOrigin->type->HBondAngle[2])/180.*M_PI/2.;  // retrieve triple bond angle from database
+      alpha = (TopOrigin->getType()->getHBondAngle(2))/180.*M_PI/2.;  // retrieve triple bond angle from database
       l = BondRescale;        // desired bond length
       b = 2.*l*sin(alpha);    // base length of isosceles triangle
@@ -498,10 +522,10 @@
       factors[1] = f;
       factors[2] = 0.;
-      FirstOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
+      FirstOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
       factors[1] = -0.5*f;
       factors[2] = g;
-      SecondOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
+      SecondOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
       factors[2] = -g;
-      ThirdOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
+      ThirdOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
 
       // rescale each to correct BondDistance
@@ -511,7 +535,7 @@
 
       // and relative to *origin atom
-      FirstOtherAtom->x += TopOrigin->x;
-      SecondOtherAtom->x += TopOrigin->x;
-      ThirdOtherAtom->x += TopOrigin->x;
+      *FirstOtherAtom += TopOrigin->getPosition();
+      *SecondOtherAtom += TopOrigin->getPosition();
+      *ThirdOtherAtom += TopOrigin->getPosition();
 
       // ... and add to molecule
@@ -589,8 +613,8 @@
     *item >> x[1];
     *item >> x[2];
-    Walker->type = elemente->FindElement(shorthand);
-    if (Walker->type == NULL) {
+    Walker->setType(elemente->FindElement(shorthand));
+    if (Walker->getType() == NULL) {
       DoeLog(1) && (eLog()<< Verbose(1) << "Could not parse the element at line: '" << line << "', setting to H.");
-      Walker->type = elemente->FindElement(1);
+      Walker->setType(1);
     }
     if (Walker->Trajectory.R.size() <= (unsigned int)MDSteps) {
@@ -599,6 +623,6 @@
       Walker->Trajectory.F.resize(MDSteps+10);
     }
+    Walker->setPosition(Vector(x));
     for(j=NDIM;j--;) {
-      Walker->x[j] = x[j];
       Walker->Trajectory.R.at(MDSteps-1)[j] = x[j];
       Walker->Trajectory.U.at(MDSteps-1)[j] = 0;
@@ -619,22 +643,22 @@
 {
   molecule *copy = World::getInstance().createMolecule();
-  atom *LeftAtom = NULL, *RightAtom = NULL;
 
   // copy all atoms
-  ActOnCopyWithEachAtom ( &molecule::AddCopyAtom, copy );
+  for_each(atoms.begin(),atoms.end(),bind1st(mem_fun(&molecule::AddCopyAtom),copy));
 
   // copy all bonds
-  bond *Binder = NULL;
-  bond *NewBond = NULL;
   for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
-    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
+    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
       if ((*BondRunner)->leftatom == *AtomRunner) {
-        Binder = (*BondRunner);
-
+        bond *Binder = (*BondRunner);
         // get the pendant atoms of current bond in the copy molecule
-        copy->ActOnAllAtoms( &atom::EqualsFather, (const atom *)Binder->leftatom, (const atom **)&LeftAtom );
-        copy->ActOnAllAtoms( &atom::EqualsFather, (const atom *)Binder->rightatom, (const atom **)&RightAtom );
-
-        NewBond = copy->AddBond(LeftAtom, RightAtom, Binder->BondDegree);
+        atomSet::iterator leftiter=find_if(copy->atoms.begin(),copy->atoms.end(),bind2nd(mem_fun(&atom::isFather),Binder->leftatom));
+        atomSet::iterator rightiter=find_if(copy->atoms.begin(),copy->atoms.end(),bind2nd(mem_fun(&atom::isFather),Binder->rightatom));
+        ASSERT(leftiter!=copy->atoms.end(),"No copy of original left atom for bond copy found");
+        ASSERT(leftiter!=copy->atoms.end(),"No copy of original right atom for bond copy found");
+        atom *LeftAtom = *leftiter;
+        atom *RightAtom = *rightiter;
+
+        bond *NewBond = copy->AddBond(LeftAtom, RightAtom, Binder->BondDegree);
         NewBond->Cyclic = Binder->Cyclic;
         if (Binder->Cyclic)
@@ -643,5 +667,5 @@
       }
   // correct fathers
-  ActOnAllAtoms( &atom::CorrectFather );
+  for_each(atoms.begin(),atoms.end(),mem_fun(&atom::CorrectFather));
 
   // copy values
@@ -689,10 +713,10 @@
   ASSERT(atom2, "Second atom in bond-creation was an invalid pointer");
   ASSERT(FindAtom(atom1->nr),"First atom in bond-creation was not part of molecule");
-  ASSERT(FindAtom(atom2->nr),"Second atom in bond-creation was not parto of molecule");
+  ASSERT(FindAtom(atom2->nr),"Second atom in bond-creation was not part of molecule");
 
   Binder = new bond(atom1, atom2, degree, BondCount++);
   atom1->RegisterBond(Binder);
   atom2->RegisterBond(Binder);
-  if ((atom1->type != NULL) && (atom1->type->Z != 1) && (atom2->type != NULL) && (atom2->type->Z != 1))
+  if ((atom1->getType() != NULL) && (atom1->getType()->getAtomicNumber() != 1) && (atom2->getType() != NULL) && (atom2->getType()->getAtomicNumber() != 1))
     NoNonBonds++;
 
@@ -760,5 +784,5 @@
 };
 
-/** Removes atom from molecule list and deletes it.
+/** Removes atom from molecule list and removes all of its bonds.
  * \param *pointer atom to be removed
  * \return true - succeeded, false - atom not found in list
@@ -768,5 +792,4 @@
   ASSERT(pointer, "Null pointer passed to molecule::RemoveAtom().");
   OBSERVE;
-  formula-=pointer->type;
   RemoveBonds(pointer);
   erase(pointer);
@@ -782,5 +805,4 @@
   if (pointer == NULL)
     return false;
-  formula-=pointer->type;
   erase(pointer);
   return true;
@@ -793,5 +815,5 @@
 {
   for (molecule::iterator iter = begin(); !empty(); iter = begin())
-      erase(iter);
+    erase(*iter);
   return empty();
 };
@@ -852,23 +874,14 @@
  * \param *out output stream
  */
-bool molecule::Output(ofstream * const output)
-{
-  int ElementNo[MAX_ELEMENTS], AtomNo[MAX_ELEMENTS];
-
-  for (int i=0;i<MAX_ELEMENTS;++i) {
-    AtomNo[i] = 0;
-    ElementNo[i] = 0;
-  }
+bool molecule::Output(ostream * const output)
+{
   if (output == NULL) {
     return false;
   } else {
+    int AtomNo[MAX_ELEMENTS];
+    memset(AtomNo,0,(MAX_ELEMENTS-1)*sizeof(*AtomNo));
+    enumeration<const element*> elementLookup = formula.enumerateElements();
     *output << "#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)" << endl;
-    SetIndexedArrayForEachAtomTo ( ElementNo, &element::Z, &AbsoluteValue, 1);
-    int current=1;
-    for (int i=0;i<MAX_ELEMENTS;++i) {
-      if (ElementNo[i] == 1)
-        ElementNo[i] = current++;
-    }
-    ActOnAllAtoms( &atom::OutputArrayIndexed, (ostream * const) output, (const int *)ElementNo, (int *)AtomNo, (const char *) NULL );
+    for_each(atoms.begin(),atoms.end(),boost::bind(&atom::OutputArrayIndexed,_1,output,elementLookup,AtomNo,(const char*)0));
     return true;
   }
@@ -880,6 +893,4 @@
 bool molecule::OutputTrajectories(ofstream * const output)
 {
-  int ElementNo[MAX_ELEMENTS], AtomNo[MAX_ELEMENTS];
-
   if (output == NULL) {
     return false;
@@ -891,15 +902,8 @@
         *output << "# ====== MD step " << step << " =========" << endl;
       }
-      for (int i=0;i<MAX_ELEMENTS;++i) {
-        AtomNo[i] = 0;
-        ElementNo[i] = 0;
-      }
-      SetIndexedArrayForEachAtomTo ( ElementNo, &element::Z, &AbsoluteValue, 1);
-      int current=1;
-      for (int i=0;i<MAX_ELEMENTS;++i) {
-        if (ElementNo[i] == 1)
-          ElementNo[i] = current++;
-      }
-      ActOnAllAtoms( &atom::OutputTrajectory, output, (const int *)ElementNo, AtomNo, (const int)step );
+      int AtomNo[MAX_ELEMENTS];
+      memset(AtomNo,0,(MAX_ELEMENTS-1)*sizeof(*AtomNo));
+      enumeration<const element*> elementLookup = formula.enumerateElements();
+      for_each(atoms.begin(),atoms.end(),boost::bind(&atom::OutputTrajectory,_1,output,elementLookup, AtomNo, (const int)step));
     }
     return true;
@@ -913,5 +917,5 @@
 {
   DoLog(2) && (Log() << Verbose(2) << endl << "From Contents of ListOfBonds, all non-hydrogen atoms:" << endl);
-  ActOnAllAtoms (&atom::OutputBondOfAtom );
+  for_each(atoms.begin(),atoms.end(),mem_fun(&atom::OutputBondOfAtom));
   DoLog(0) && (Log() << Verbose(0) << endl);
 };
@@ -936,5 +940,5 @@
     for (int step=0;step<MDSteps;step++) {
       *output << getAtomCount() << "\n\tCreated by molecuilder, step " << step << ", on " << ctime(&now);
-      ActOnAllAtoms( &atom::OutputTrajectoryXYZ, output, step );
+      for_each(atoms.begin(),atoms.end(),boost::bind(&atom::OutputTrajectoryXYZ,_1,output,step));
     }
     return true;
@@ -953,5 +957,5 @@
     now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
     *output << getAtomCount() << "\n\tCreated by molecuilder on " << ctime(&now);
-    ActOnAllAtoms( &atom::OutputXYZLine, output );
+    for_each(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::OutputXYZLine),output));
     return true;
   } else
@@ -969,8 +973,8 @@
   for (molecule::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {
     (*iter)->nr = i;   // update number in molecule (for easier referencing in FragmentMolecule lateron)
-    if ((*iter)->type->Z != 1) // count non-hydrogen atoms whilst at it
+    if ((*iter)->getType()->getAtomicNumber() != 1) // count non-hydrogen atoms whilst at it
       NoNonHydrogen++;
     stringstream sstr;
-    sstr << (*iter)->type->symbol << (*iter)->nr+1;
+    sstr << (*iter)->getType()->getSymbol() << (*iter)->nr+1;
     (*iter)->setName(sstr.str());
     DoLog(3) && (Log() << Verbose(3) << "Naming atom nr. " << (*iter)->nr << " " << (*iter)->getName() << "." << endl);
@@ -978,110 +982,4 @@
   }
   return res;
-};
-
-/** Determines whether two molecules actually contain the same atoms and coordination.
- * \param *out output stream for debugging
- * \param *OtherMolecule the molecule to compare this one to
- * \param threshold upper limit of difference when comparing the coordination.
- * \return NULL - not equal, otherwise an allocated (molecule::AtomCount) permutation map of the atom numbers (which corresponds to which)
- */
-int * molecule::IsEqualToWithinThreshold(molecule *OtherMolecule, double threshold)
-{
-  int flag;
-  double *Distances = NULL, *OtherDistances = NULL;
-  Vector CenterOfGravity, OtherCenterOfGravity;
-  size_t *PermMap = NULL, *OtherPermMap = NULL;
-  int *PermutationMap = NULL;
-  bool result = true; // status of comparison
-
-  DoLog(3) && (Log() << Verbose(3) << "Begin of IsEqualToWithinThreshold." << endl);
-  /// first count both their atoms and elements and update lists thereby ...
-  //Log() << Verbose(0) << "Counting atoms, updating list" << endl;
-
-  /// ... and compare:
-  /// -# AtomCount
-  if (result) {
-    if (getAtomCount() != OtherMolecule->getAtomCount()) {
-      DoLog(4) && (Log() << Verbose(4) << "AtomCounts don't match: " << getAtomCount() << " == " << OtherMolecule->getAtomCount() << endl);
-      result = false;
-    } else Log() << Verbose(4) << "AtomCounts match: " << getAtomCount() << " == " << OtherMolecule->getAtomCount() << endl;
-  }
-  /// -# Formula
-  if (result) {
-    if (formula != OtherMolecule->formula) {
-      DoLog(4) && (Log() << Verbose(4) << "Formulas don't match: " << formula << " == " << OtherMolecule->formula << endl);
-      result = false;
-    } else Log() << Verbose(4) << "Formulas match: " << formula << " == " << OtherMolecule->formula << endl;
-  }
-  /// then determine and compare center of gravity for each molecule ...
-  if (result) {
-    DoLog(5) && (Log() << Verbose(5) << "Calculating Centers of Gravity" << endl);
-    DeterminePeriodicCenter(CenterOfGravity);
-    OtherMolecule->DeterminePeriodicCenter(OtherCenterOfGravity);
-    DoLog(5) && (Log() << Verbose(5) << "Center of Gravity: " << CenterOfGravity << endl);
-    DoLog(5) && (Log() << Verbose(5) << "Other Center of Gravity: " << OtherCenterOfGravity << endl);
-    if (CenterOfGravity.DistanceSquared(OtherCenterOfGravity) > threshold*threshold) {
-      DoLog(4) && (Log() << Verbose(4) << "Centers of gravity don't match." << endl);
-      result = false;
-    }
-  }
-
-  /// ... then make a list with the euclidian distance to this center for each atom of both molecules
-  if (result) {
-    DoLog(5) && (Log() << Verbose(5) << "Calculating distances" << endl);
-    Distances = new double[getAtomCount()];
-    OtherDistances = new double[getAtomCount()];
-    SetIndexedArrayForEachAtomTo ( Distances, &atom::nr, &atom::DistanceSquaredToVector, (const Vector &)CenterOfGravity);
-    SetIndexedArrayForEachAtomTo ( OtherDistances, &atom::nr, &atom::DistanceSquaredToVector, (const Vector &)CenterOfGravity);
-    for(int i=0;i<getAtomCount();i++) {
-      Distances[i] = 0.;
-      OtherDistances[i] = 0.;
-    }
-
-    /// ... sort each list (using heapsort (o(N log N)) from GSL)
-    DoLog(5) && (Log() << Verbose(5) << "Sorting distances" << endl);
-    PermMap = new size_t[getAtomCount()];
-    OtherPermMap = new size_t[getAtomCount()];
-    for(int i=0;i<getAtomCount();i++) {
-      PermMap[i] = 0;
-      OtherPermMap[i] = 0;
-    }
-    gsl_heapsort_index (PermMap, Distances, getAtomCount(), sizeof(double), CompareDoubles);
-    gsl_heapsort_index (OtherPermMap, OtherDistances, getAtomCount(), sizeof(double), CompareDoubles);
-    PermutationMap = new int[getAtomCount()];
-    for(int i=0;i<getAtomCount();i++)
-      PermutationMap[i] = 0;
-    DoLog(5) && (Log() << Verbose(5) << "Combining Permutation Maps" << endl);
-    for(int i=getAtomCount();i--;)
-      PermutationMap[PermMap[i]] = (int) OtherPermMap[i];
-
-    /// ... and compare them step by step, whether the difference is individually(!) below \a threshold for all
-    DoLog(4) && (Log() << Verbose(4) << "Comparing distances" << endl);
-    flag = 0;
-    for (int i=0;i<getAtomCount();i++) {
-      DoLog(5) && (Log() << Verbose(5) << "Distances squared: |" << Distances[PermMap[i]] << " - " << OtherDistances[OtherPermMap[i]] << "| = " << fabs(Distances[PermMap[i]] - OtherDistances[OtherPermMap[i]]) << " ?<? " <<  threshold << endl);
-      if (fabs(Distances[PermMap[i]] - OtherDistances[OtherPermMap[i]]) > threshold*threshold)
-        flag = 1;
-    }
-
-    // free memory
-    delete[](PermMap);
-    delete[](OtherPermMap);
-    delete[](Distances);
-    delete[](OtherDistances);
-    if (flag) { // if not equal
-      delete[](PermutationMap);
-      result = false;
-    }
-  }
-  /// return pointer to map if all distances were below \a threshold
-  DoLog(3) && (Log() << Verbose(3) << "End of IsEqualToWithinThreshold." << endl);
-  if (result) {
-    DoLog(3) && (Log() << Verbose(3) << "Result: Equal." << endl);
-    return PermutationMap;
-  } else {
-    DoLog(3) && (Log() << Verbose(3) << "Result: Not equal." << endl);
-    return NULL;
-  }
 };
 
@@ -1142,16 +1040,8 @@
     *output << "# Step Temperature [K] Temperature [a.u.]" << endl;
   for (int step=startstep;step < endstep; step++) { // loop over all time steps
-    temperature = 0.;
-    ActOnAllAtoms( &TrajectoryParticle::AddKineticToTemperature, &temperature, step);
+    temperature = atoms.totalTemperatureAtStep(step);
     *output << step << "\t" << temperature*AtomicEnergyToKelvin << "\t" << temperature << endl;
   }
   return true;
-};
-
-void molecule::SetIndexedArrayForEachAtomTo ( atom **array, int ParticleInfo::*index) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    array[((*iter)->*index)] = (*iter);
-  }
 };
 
Index: src/molecule.hpp
===================================================================
--- src/molecule.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/molecule.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -24,5 +24,5 @@
 #include "types.hpp"
 #include "graph.hpp"
-#include "tesselation.hpp"
+#include "PointCloud.hpp"
 #include "Patterns/Observer.hpp"
 #include "Patterns/ObservedIterator.hpp"
@@ -104,5 +104,5 @@
     double BondDistance;  //!< typical bond distance used in CreateAdjacencyList() and furtheron
     bool ActiveFlag;    //!< in a MoleculeListClass used to discern active from inactive molecules
-    Vector Center;      //!< Center of molecule in a global box
+    //Vector Center;      //!< Center of molecule in a global box
     int IndexNr;        //!< index of molecule in a MoleculeListClass
     char name[MAXSTRINGSIZE];         //!< arbitrary name
@@ -129,17 +129,20 @@
 public:
   //getter and setter
-  const std::string getName();
+  const std::string getName() const;
   int getAtomCount() const;
   int doCountAtoms();
-  moleculeId_t getId();
+  moleculeId_t getId() const;
   void setId(moleculeId_t);
   void setName(const std::string);
-  const Formula &getFormula();
-  unsigned int getElementCount();
+  const Formula &getFormula() const;
+  unsigned int getElementCount() const;
   bool hasElement(const element*) const;
   bool hasElement(atomicNumber_t) const;
   bool hasElement(const std::string&) const;
 
-
+  virtual bool changeId(atomId_t newId);
+
+  TesselPoint * getValue(const_iterator &rhs) const;
+  TesselPoint * getValue(iterator &rhs) const;
   iterator begin();
   const_iterator begin() const;
@@ -164,76 +167,4 @@
   bool IsEmpty() const ;
   bool IsEnd() const ;
-
-  // templates for allowing global manipulation of all vectors
-  template <typename res> void ActOnAllVectors( res (Vector::*f)() ) const;
-  template <typename res> void ActOnAllVectors( res (Vector::*f)() const) const;
-  template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T), T t ) const;
-  template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T) const, T t ) const;
-  template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T&), T &t ) const;
-  template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T&) const, T &t ) const;
-  template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const;
-  template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const;
-  template <typename res, typename T, typename U, typename V> void ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v) const;
-  template <typename res, typename T, typename U, typename V> void ActOnAllVectors( res (Vector::*f)(T, U, V) const, T t, U u, V v) const;
-
-  // templates for allowing global manipulation of molecule with each atom as single argument
-  template <typename res> void ActWithEachAtom( res (molecule::*f)(atom *) ) const;
-  template <typename res> void ActWithEachAtom( res (molecule::*f)(atom *) const) const;
-
-  // templates for allowing global copying of molecule with each atom as single argument
-  template <typename res> void ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const;
-  template <typename res> void ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const;
-
-  // templates for allowing global manipulation of all atoms
-  template <typename res, typename typ> void ActOnAllAtoms( res (typ::*f)() ) const;
-  template <typename res, typename typ> void ActOnAllAtoms( res (typ::*f)() const) const;
-  template <typename res, typename typ, typename T> void ActOnAllAtoms( res (typ::*f)(T), T t ) const;
-  template <typename res, typename typ, typename T> void ActOnAllAtoms( res (typ::*f)(T) const, T t ) const;
-  template <typename res, typename typ, typename T, typename U> void ActOnAllAtoms( res (typ::*f)(T, U), T t, U u ) const;
-  template <typename res, typename typ, typename T, typename U> void ActOnAllAtoms( res (typ::*f)(T, U) const, T t, U u ) const;
-  template <typename res, typename typ, typename T, typename U, typename V> void ActOnAllAtoms( res (typ::*f)(T, U, V), T t, U u, V v) const;
-  template <typename res, typename typ, typename T, typename U, typename V> void ActOnAllAtoms( res (typ::*f)(T, U, V) const, T t, U u, V v) const;
-  template <typename res, typename typ, typename T, typename U, typename V, typename W> void ActOnAllAtoms( res (typ::*f)(T, U, V, W), T t, U u, V v, W w) const;
-  template <typename res, typename typ, typename T, typename U, typename V, typename W> void ActOnAllAtoms( res (typ::*f)(T, U, V, W) const, T t, U u, V v, W w) const;
-
-  // templates for allowing conditional global copying of molecule with each atom as single argument
-  template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) const;
-  template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () const ) const;
-  template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) () ) const;
-  template <typename res> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) () const ) const;
-  template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) const;
-  template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T) const, T t ) const;
-  template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T), T t ) const;
-  template <typename res, typename T> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T) const, T t ) const;
-  template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const;
-  template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const;
-  template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const;
-  template <typename res, typename T, typename U> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const;
-  template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const;
-  template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const;
-  template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const;
-  template <typename res, typename T, typename U, typename V> void ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const;
-
-  // templates for allowing global manipulation of an array with one entry per atom
-  void SetIndexedArrayForEachAtomTo ( atom **array, int ParticleInfo::* index) const;
-  template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::* index, void (*Setor)(T *, T *)) const;
-  template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::* index, void (*Setor)(T *, T *), T t) const;
-  template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::* index, void (*Setor)(T *, T *), T *t) const;
-  template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int element::* index, void (*Setor)(T *, T *)) const;
-  template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int element::* index, void (*Setor)(T *, T *), T t) const;
-  template <typename T> void SetIndexedArrayForEachAtomTo ( T *array, int element::* index, void (*Setor)(T *, T *), T *t) const;
-  template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ atom::*value) const;
-  template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ atom::*value) const;
-  template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ &vect ) const;
-  template <typename T, typename typ> void SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ &vect ) const;
-
-  // templates for allowing global manipulation of each atom by entries in an array
-  template <typename T, typename typ, typename typ2> void SetAtomValueToIndexedArray ( T *array, int typ::*index, T typ2::*value ) const;
-  template <typename T, typename typ> void SetAtomValueToValue ( T value, T typ::*ptr ) const;
-
-  template <typename res, typename typ> res SumPerAtom(res (typ::*f)() ) const;
-  template <typename res, typename typ> res SumPerAtom(res (typ::*f)() const ) const;
-  template <typename res, typename typ, typename T> res SumPerAtom(res (typ::*f)(T) , T t ) const;
-  template <typename res, typename typ, typename T> res SumPerAtom(res (typ::*f)(T) const, T t ) const;
 
   /// remove atoms from molecule.
@@ -270,5 +201,5 @@
   void Scale(const double ** const factor);
   void DeterminePeriodicCenter(Vector &center);
-  Vector * DetermineCenterOfGravity();
+  Vector * DetermineCenterOfGravity() const;
   Vector * DetermineCenterOfAll() const;
   Vector * DetermineCenterOfBox() const;
@@ -277,6 +208,4 @@
   void ScanForPeriodicCorrection();
   bool VerletForceIntegration(char *file, config &configuration, const size_t offset);
-  void Thermostats(config &configuration, double ActualTemp, int Thermostat);
-  void PrincipalAxisSystem(bool DoRotate);
   double VolumeOfConvexEnvelope(bool IsAngstroem);
 
@@ -337,9 +266,8 @@
 
   // Recognize doubly appearing molecules in a list of them
-  int * IsEqualToWithinThreshold(molecule *OtherMolecule, double threshold);
   int * GetFatherSonAtomicMap(molecule *OtherMolecule);
 
   // Output routines.
-  bool Output(ofstream * const output);
+  bool Output(std::ostream * const output);
   bool OutputTrajectories(ofstream * const output);
   void OutputListOfBonds() const;
@@ -353,4 +281,5 @@
 
   private:
+  void init_DFS(struct DFSAccounting&) const;
   int last_atom;      //!< number given to last atom
   mutable internal_iterator InternalPointer;  //!< internal pointer for PointCloud
@@ -359,6 +288,4 @@
 molecule *NewMolecule();
 void DeleteMolecule(molecule* mol);
-
-#include "molecule_template.hpp"
 
 /** A list of \a molecule classes.
@@ -381,10 +308,8 @@
   void Enumerate(ostream *out);
   void Output(ofstream *out);
-  void DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration);
   int CountAllAtoms() const;
 
   // Methods moved here from the menus
   // TODO: more refactoring needed on these methods
-  void flipChosen();
   void createNewMolecule(periodentafel *periode);
   void loadFromXYZ(periodentafel *periode);
@@ -392,13 +317,4 @@
   void parseXYZIntoMolecule();
   void eraseMolecule();
-
-
-  // merging of molecules
-  bool SimpleMerge(molecule *mol, molecule *srcmol);
-  bool SimpleAdd(molecule *mol, molecule *srcmol);
-  bool SimpleMultiMerge(molecule *mol, int *src, int N);
-  bool SimpleMultiAdd(molecule *mol, int *src, int N);
-  bool ScatterMerge(molecule *mol, int *src, int N);
-  bool EmbedMerge(molecule *mol, molecule *srcmol);
 
   private:
Index: src/molecule_dynamics.cpp
===================================================================
--- src/molecule_dynamics.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/molecule_dynamics.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * molecule_dynamics.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -12,11 +24,12 @@
 #include "config.hpp"
 #include "element.hpp"
-#include "info.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Info.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "parser.hpp"
-#include "Plane.hpp"
+#include "LinearAlgebra/Plane.hpp"
 #include "ThermoStatContainer.hpp"
+#include "Thermostats/Berendsen.hpp"
 
 #include <gsl/gsl_matrix.h>
@@ -468,5 +481,8 @@
   /// evaluate forces (only the distance to target dependent part) with the final PermutationMap
   DoLog(1) && (Log() << Verbose(1) << "Calculating forces and adding onto ForceMatrix ... " << endl);
-  ActOnAllAtoms( &atom::EvaluateConstrainedForce, startstep, endstep, PermutationMap, Force );
+  for_each(atoms.begin(),
+           atoms.end(),
+           boost::bind(&atom::EvaluateConstrainedForce,_1,startstep,endstep,PermutationMap,Force));
+  //ActOnAllAtoms( &atom::EvaluateConstrainedForce, startstep, endstep, PermutationMap, Force );
   DoLog(1) && (Log() << Verbose(1) << "done." << endl);
 };
@@ -484,4 +500,5 @@
 bool molecule::LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string &prefix, config &configuration, bool MapByIdentity)
 {
+  // TODO: rewrite permutationMaps using enumeration objects
   molecule *mol = NULL;
   bool status = true;
@@ -494,12 +511,15 @@
     MinimiseConstrainedPotential(PermutationMap, startstep, endstep, configuration.GetIsAngstroem());
   else {
+    // TODO: construction of enumeration goes here
     PermutationMap = new atom *[getAtomCount()];
-    SetIndexedArrayForEachAtomTo( PermutationMap, &atom::nr );
+    for(internal_iterator iter = atoms.begin(); iter != atoms.end();++iter){
+      PermutationMap[(*iter)->nr] = (*iter);
+    }
   }
 
   // check whether we have sufficient space in Trajectories for each atom
-  ActOnAllAtoms( &atom::ResizeTrajectory, MaxSteps );
+  for_each(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::ResizeTrajectory),MaxSteps));
   // push endstep to last one
-  ActOnAllAtoms( &atom::CopyStepOnStep, MaxSteps, endstep );
+  for_each(atoms.begin(),atoms.end(),boost::bind(&atom::CopyStepOnStep,_1,MaxSteps,endstep));
   endstep = MaxSteps;
 
@@ -513,5 +533,5 @@
       Sprinter = mol->AddCopyAtom((*iter));
       for (int n=NDIM;n--;) {
-        Sprinter->x[n] = (*iter)->Trajectory.R.at(startstep)[n] + (PermutationMap[(*iter)->nr]->Trajectory.R.at(endstep)[n] - (*iter)->Trajectory.R.at(startstep)[n])*((double)step/(double)MaxSteps);
+        Sprinter->set(n, (*iter)->Trajectory.R.at(startstep)[n] + (PermutationMap[(*iter)->nr]->Trajectory.R.at(endstep)[n] - (*iter)->Trajectory.R.at(startstep)[n])*((double)step/(double)MaxSteps));
         // add to Trajectories
         //Log() << Verbose(3) << step << ">=" << MDSteps-1 << endl;
@@ -598,17 +618,21 @@
     // check size of vectors
     //ActOnAllAtoms( &atom::ResizeTrajectory, MDSteps+10 );
-
-    ActOnAllAtoms( &atom::VelocityVerletUpdate, MDSteps+1, &configuration, &Force, (const size_t) 0);
+    for_each(atoms.begin(),
+             atoms.end(),
+             boost::bind(&atom::VelocityVerletUpdate,_1,MDSteps+1, &configuration, &Force, (const size_t) 0));
   }
   // correct velocities (rather momenta) so that center of mass remains motionless
-  Velocity.Zero();
-  IonMass = 0.;
-  ActOnAllAtoms ( &atom::SumUpKineticEnergy, MDSteps+1, &IonMass, &Velocity );
+  Velocity = atoms.totalMomentumAtStep(MDSteps+1);
+  IonMass = atoms.totalMass();
 
   // correct velocities (rather momenta) so that center of mass remains motionless
-  Velocity.Scale(1./IonMass);
-  ActualTemp = 0.;
-  ActOnAllAtoms ( &atom::CorrectVelocity, &ActualTemp, MDSteps+1, &Velocity );
-  Thermostats(configuration, ActualTemp, Berendsen);
+  Velocity *= 1./IonMass;
+
+  atoms.addVelocityAtStep(-1*Velocity,MDSteps+1);
+  ActualTemp = atoms.totalTemperatureAtStep(MDSteps+1);
+  Berendsen berendsen = Berendsen();
+  berendsen.addToContainer(configuration.Thermostats);
+  double ekin = berendsen.scaleAtoms(MDSteps,ActualTemp,atoms);
+  DoLog(1) && (Log() << Verbose(1) << "Kinetic energy is " << ekin << "." << endl);
   MDSteps++;
 
@@ -616,82 +640,2 @@
   return true;
 };
-
-/** Implementation of various thermostats.
- * All these thermostats apply an additional force which has the following forms:
- * -# Woodcock
- *  \f$p_i \rightarrow \sqrt{\frac{T_0}{T}} \cdot p_i\f$
- * -# Gaussian
- *  \f$ \frac{ \sum_i \frac{p_i}{m_i} \frac{\partial V}{\partial q_i}} {\sum_i \frac{p^2_i}{m_i}} \cdot p_i\f$
- * -# Langevin
- *  \f$p_{i,n} \rightarrow \sqrt{1-\alpha^2} p_{i,0} + \alpha p_r\f$
- * -# Berendsen
- *  \f$p_i \rightarrow \left [ 1+ \frac{\delta t}{\tau_T} \left ( \frac{T_0}{T} \right ) \right ]^{\frac{1}{2}} \cdot p_i\f$
- * -# Nose-Hoover
- *  \f$\zeta p_i \f$ with \f$\frac{\partial \zeta}{\partial t} = \frac{1}{M_s} \left ( \sum^N_{i=1} \frac{p_i^2}{m_i} - g k_B T \right )\f$
- * These Thermostats either simply rescale the velocities, thus this function should be called after ion velocities have been updated, and/or
- * have a constraint force acting additionally on the ions. In the latter case, the ion speeds have to be modified
- * belatedly and the constraint force set.
- * \param *P Problem at hand
- * \param i which of the thermostats to take: 0 - none, 1 - Woodcock, 2 - Gaussian, 3 - Langevin, 4 - Berendsen, 5 - Nose-Hoover
- * \sa InitThermostat()
- */
-void molecule::Thermostats(config &configuration, double ActualTemp, int Thermostat)
-{
-  double ekin = 0.;
-  double E = 0., G = 0.;
-  double delta_alpha = 0.;
-  double ScaleTempFactor;
-  gsl_rng * r;
-  const gsl_rng_type * T;
-
-  // calculate scale configuration
-  ScaleTempFactor = configuration.Thermostats->TargetTemp/ActualTemp;
-
-  // differentating between the various thermostats
-  switch(Thermostat) {
-     case None:
-      DoLog(2) && (Log() << Verbose(2) <<  "Applying no thermostat..." << endl);
-      break;
-     case Woodcock:
-      if ((configuration.Thermostats->ScaleTempStep > 0) && ((MDSteps-1) % configuration.Thermostats->ScaleTempStep == 0)) {
-        DoLog(2) && (Log() << Verbose(2) <<  "Applying Woodcock thermostat..." << endl);
-        ActOnAllAtoms( &atom::Thermostat_Woodcock, sqrt(ScaleTempFactor), MDSteps, &ekin );
-      }
-      break;
-     case Gaussian:
-      DoLog(2) && (Log() << Verbose(2) <<  "Applying Gaussian thermostat..." << endl);
-      ActOnAllAtoms( &atom::Thermostat_Gaussian_init, MDSteps, &G, &E );
-
-      DoLog(1) && (Log() << Verbose(1) << "Gaussian Least Constraint constant is " << G/E << "." << endl);
-      ActOnAllAtoms( &atom::Thermostat_Gaussian_least_constraint, MDSteps, G/E, &ekin, &configuration);
-
-      break;
-     case Langevin:
-      DoLog(2) && (Log() << Verbose(2) <<  "Applying Langevin thermostat..." << endl);
-      // init random number generator
-      gsl_rng_env_setup();
-      T = gsl_rng_default;
-      r = gsl_rng_alloc (T);
-      // Go through each ion
-      ActOnAllAtoms( &atom::Thermostat_Langevin, MDSteps, r, &ekin, &configuration );
-      break;
-
-     case Berendsen:
-      DoLog(2) && (Log() << Verbose(2) <<  "Applying Berendsen-VanGunsteren thermostat..." << endl);
-      ActOnAllAtoms( &atom::Thermostat_Berendsen, MDSteps, ScaleTempFactor, &ekin, &configuration );
-      break;
-
-     case NoseHoover:
-      DoLog(2) && (Log() << Verbose(2) <<  "Applying Nose-Hoover thermostat..." << endl);
-      // dynamically evolve alpha (the additional degree of freedom)
-      delta_alpha = 0.;
-      ActOnAllAtoms( &atom::Thermostat_NoseHoover_init, MDSteps, &delta_alpha );
-      delta_alpha = (delta_alpha - (3.*getAtomCount()+1.) * configuration.Thermostats->TargetTemp)/(configuration.Thermostats->HooverMass*Units2Electronmass);
-      configuration.Thermostats->alpha += delta_alpha*configuration.Deltat;
-      DoLog(3) && (Log() << Verbose(3) << "alpha = " << delta_alpha << " * " << configuration.Deltat << " = " << configuration.Thermostats->alpha << "." << endl);
-      // apply updated alpha as additional force
-      ActOnAllAtoms( &atom::Thermostat_NoseHoover_scale, MDSteps, &ekin, &configuration );
-      break;
-  }
-  DoLog(1) && (Log() << Verbose(1) << "Kinetic energy is " << ekin << "." << endl);
-};
Index: src/molecule_fragmentation.cpp
===================================================================
--- src/molecule_fragmentation.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/molecule_fragmentation.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * molecule_fragmentation.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -15,12 +27,12 @@
 #include "config.hpp"
 #include "element.hpp"
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 #include "lists.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "periodentafel.hpp"
 #include "World.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "Box.hpp"
 #include "stackclass.hpp"
@@ -451,5 +463,5 @@
       for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
     #ifdef ADDHYDROGEN
-        if ((*iter)->type->Z != 1) // skip hydrogen
+        if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen
     #endif
         {
@@ -471,5 +483,5 @@
     for(molecule::const_iterator iter = begin(); iter != end(); ++iter) {
   #ifdef ADDHYDROGEN
-      if ((*iter)->type->Z != 1) // skip hydrogen
+      if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen
   #endif
       {
@@ -511,5 +523,9 @@
 
   int AtomNo = 0;
-  SetIndexedArrayForEachAtomTo( SortIndex, &atom::nr, &IncrementalAbsoluteValue, AtomNo );
+  for(internal_iterator iter=atoms.begin();iter!=atoms.end();++iter){
+    ASSERT(SortIndex[(*iter)->nr]==-1,"Same SortIndex set twice");
+    SortIndex[(*iter)->nr] = AtomNo++;
+  }
+  //SetIndexedArrayForEachAtomTo( SortIndex, &atom::nr, &IncrementalAbsoluteValue, AtomNo );
 
   return true;
@@ -798,5 +814,5 @@
   DoLog(1) && (Log() << Verbose(1) << "Writing OrderAtSite " << ORDERATSITEFILE << " ... " << endl);
   if (file.good()) {
-    ActOnAllAtoms( &atom::OutputOrder, &file );
+    for_each(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::OutputOrder), &file));
     file.close();
     DoLog(1) && (Log() << Verbose(1) << "done." << endl);
@@ -846,6 +862,10 @@
 
     // set atom values
-    SetAtomValueToIndexedArray( OrderArray, &atom::nr, &atom::AdaptiveOrder );
-    SetAtomValueToIndexedArray( MaxArray, &atom::nr, &atom::MaxOrder );
+    for(internal_iterator iter=atoms.begin();iter!=atoms.end();++iter){
+      (*iter)->AdaptiveOrder = OrderArray[(*iter)->nr];
+      (*iter)->MaxOrder = MaxArray[(*iter)->nr];
+    }
+    //SetAtomValueToIndexedArray( OrderArray, &atom::nr, &atom::AdaptiveOrder );
+    //SetAtomValueToIndexedArray( MaxArray, &atom::nr, &atom::MaxOrder );
 
     DoLog(1) && (Log() << Verbose(1) << "\t ... done." << endl);
@@ -880,5 +900,5 @@
   for (KeySet::iterator runner = Leaf->begin(); runner != Leaf->end(); runner++) {
     Runner = FindAtom((*runner));
-    if (Runner->type->Z != 1) { // skip all those added hydrogens when re-filling snake stack
+    if (Runner->getType()->getAtomicNumber() != 1) { // skip all those added hydrogens when re-filling snake stack
       if (ShortestPathList[(*runner)] > SP) {  // remove the oldest one with longest shortest path
         SP = ShortestPathList[(*runner)];
@@ -969,5 +989,5 @@
     ++iter;
 #ifdef ADDHYDROGEN
-    while ((iter != Leaf->end()) && ((*iter)->type->Z == 1)){ // skip added hydrogen
+    while ((iter != Leaf->end()) && ((*iter)->getType()->getAtomicNumber() == 1)){ // skip added hydrogen
       iter++;
     }
@@ -1347,5 +1367,5 @@
         if ((RestrictedKeySet.find(OtherWalker->nr) != RestrictedKeySet.end())
   #ifdef ADDHYDROGEN
-         && (OtherWalker->type->Z != 1)
+         && (OtherWalker->getType()->getAtomicNumber() != 1)
   #endif
                                                               ) {  // skip hydrogens and restrict to fragment
@@ -1741,5 +1761,5 @@
         Binder = (*BondRunner);
         for (int i=NDIM;i--;) {
-          tmp = fabs(Binder->leftatom->x[i] - Binder->rightatom->x[i]);
+          tmp = fabs(Binder->leftatom->at(i) - Binder->rightatom->at(i));
           //Log() << Verbose(3) << "Checking " << i << "th distance of " << *Binder->leftatom << " to " << *Binder->rightatom << ": " << tmp << "." << endl;
           if (tmp > BondDistance) {
@@ -1755,5 +1775,5 @@
       // create translation vector from their periodically modified distance
       for (int i=NDIM;i--;) {
-        tmp = Binder->leftatom->x[i] - Binder->rightatom->x[i];
+        tmp = Binder->leftatom->at(i) - Binder->rightatom->at(i);
         if (fabs(tmp) > BondDistance)
           Translationvector[i] = (tmp < 0) ? +1. : -1.;
@@ -1770,5 +1790,5 @@
         //Log() << Verbose (3) << "Current Walker is: " << *Walker << "." << endl;
         ColorList[Walker->nr] = black;    // mark as explored
-        Walker->x += Translationvector; // translate
+        *Walker += Translationvector; // translate
         for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
           if ((*Runner) != Binder) {
Index: src/molecule_geometry.cpp
===================================================================
--- src/molecule_geometry.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/molecule_geometry.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * molecule_geometry.cpp
@@ -6,4 +13,5 @@
  */
 
+// include config.h
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -11,4 +19,11 @@
 
 #include "Helpers/MemDebug.hpp"
+
+#include "Helpers/helpers.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Line.hpp"
+#include "LinearAlgebra/Matrix.hpp"
+#include "LinearAlgebra/Plane.hpp"
 
 #include "atom.hpp"
@@ -16,13 +31,10 @@
 #include "config.hpp"
 #include "element.hpp"
-#include "helpers.hpp"
 #include "leastsquaremin.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
 #include "molecule.hpp"
 #include "World.hpp"
-#include "Plane.hpp"
-#include "Matrix.hpp"
+
 #include "Box.hpp"
+
 #include <boost/foreach.hpp>
 
@@ -45,6 +57,8 @@
 
   // go through all atoms
-  ActOnAllVectors( &Vector::SubtractVector, *Center);
-  ActOnAllVectors( &Vector::SubtractVector, *CenterBox);
+  BOOST_FOREACH(atom* iter, atoms){
+    *iter -= *Center;
+    *iter -= *CenterBox;
+  }
   atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));
 
@@ -63,4 +77,5 @@
   Box &domain = World::getInstance().getDomain();
 
+  // go through all atoms
   atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));
 
@@ -80,12 +95,12 @@
   if (iter != end()) { //list not empty?
     for (int i=NDIM;i--;) {
-      max->at(i) = (*iter)->x[i];
-      min->at(i) = (*iter)->x[i];
+      max->at(i) = (*iter)->at(i);
+      min->at(i) = (*iter)->at(i);
     }
     for (; iter != end(); ++iter) {// continue with second if present
       //(*iter)->Output(1,1,out);
       for (int i=NDIM;i--;) {
-        max->at(i) = (max->at(i) < (*iter)->x[i]) ? (*iter)->x[i] : max->at(i);
-        min->at(i) = (min->at(i) > (*iter)->x[i]) ? (*iter)->x[i] : min->at(i);
+        max->at(i) = (max->at(i) < (*iter)->at(i)) ? (*iter)->at(i) : max->at(i);
+        min->at(i) = (min->at(i) > (*iter)->at(i)) ? (*iter)->at(i) : min->at(i);
       }
     }
@@ -98,5 +113,4 @@
     (*max) += (*min);
     Translate(min);
-    Center.Zero();
   }
   delete(min);
@@ -112,15 +126,14 @@
   int Num = 0;
   molecule::const_iterator iter = begin();  // start at first in list
+  Vector Center;
 
   Center.Zero();
-
   if (iter != end()) {   //list not empty?
     for (; iter != end(); ++iter) {  // continue with second if present
       Num++;
-      Center += (*iter)->x;
+      Center += (*iter)->getPosition();
     }
     Center.Scale(-1./(double)Num); // divide through total number (and sign for direction)
     Translate(&Center);
-    Center.Zero();
   }
 };
@@ -140,5 +153,5 @@
     for (; iter != end(); ++iter) {  // continue with second if present
       Num++;
-      (*a) += (*iter)->x;
+      (*a) += (*iter)->getPosition();
     }
     a->Scale(1./(double)Num); // divide through total mass (and sign for direction)
@@ -162,5 +175,5 @@
  * \return pointer to center of gravity vector
  */
-Vector * molecule::DetermineCenterOfGravity()
+Vector * molecule::DetermineCenterOfGravity() const
 {
   molecule::const_iterator iter = begin();  // start at first in list
@@ -173,6 +186,6 @@
   if (iter != end()) {   //list not empty?
     for (; iter != end(); ++iter) {  // continue with second if present
-      Num += (*iter)->type->mass;
-      tmp = (*iter)->type->mass * (*iter)->x;
+      Num += (*iter)->getType()->getMass();
+      tmp = (*iter)->getType()->getMass() * (*iter)->getPosition();
       (*a) += tmp;
     }
@@ -191,5 +204,10 @@
 void molecule::CenterPeriodic()
 {
-  DeterminePeriodicCenter(Center);
+  Vector NewCenter;
+  DeterminePeriodicCenter(NewCenter);
+  // go through all atoms
+  BOOST_FOREACH(atom* iter, atoms){
+    *iter -= NewCenter;
+  }
 };
 
@@ -201,5 +219,8 @@
 void molecule::CenterAtVector(Vector *newcenter)
 {
-  Center = *newcenter;
+  // go through all atoms
+  BOOST_FOREACH(atom* iter, atoms){
+    *iter -= *newcenter;
+  }
 };
 
@@ -218,5 +239,5 @@
     for (int j=0;j<MDSteps;j++)
       (*iter)->Trajectory.R.at(j).ScaleAll(*factor);
-    (*iter)->x.ScaleAll(*factor);
+    (*iter)->ScaleAll(*factor);
   }
 };
@@ -230,5 +251,5 @@
     for (int j=0;j<MDSteps;j++)
       (*iter)->Trajectory.R.at(j) += (*trans);
-    (*iter)->x += (*trans);
+    *(*iter) += (*trans);
   }
 };
@@ -243,5 +264,7 @@
 
   // go through all atoms
-  ActOnAllVectors( &Vector::AddVector, *trans);
+  BOOST_FOREACH(atom* iter, atoms){
+    *iter += *trans;
+  }
   atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));
 
@@ -269,4 +292,5 @@
   bool flag;
   Vector Testvector, Translationvector;
+  Vector Center;
 
   do {
@@ -275,12 +299,12 @@
     for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
 #ifdef ADDHYDROGEN
-      if ((*iter)->type->Z != 1) {
+      if ((*iter)->getType()->getAtomicNumber() != 1) {
 #endif
-        Testvector = inversematrix * (*iter)->x;
+        Testvector = inversematrix * (*iter)->getPosition();
         Translationvector.Zero();
         for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
          if ((*iter)->nr < (*Runner)->GetOtherAtom((*iter))->nr) // otherwise we shift one to, the other fro and gain nothing
             for (int j=0;j<NDIM;j++) {
-              tmp = (*iter)->x[j] - (*Runner)->GetOtherAtom(*iter)->x[j];
+              tmp = (*iter)->at(j) - (*Runner)->GetOtherAtom(*iter)->at(j);
               if ((fabs(tmp)) > BondDistance) {
                 flag = false;
@@ -300,6 +324,6 @@
         // now also change all hydrogens
         for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
-          if ((*Runner)->GetOtherAtom((*iter))->type->Z == 1) {
-            Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->x;
+          if ((*Runner)->GetOtherAtom((*iter))->getType()->getAtomicNumber() == 1) {
+            Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->getPosition();
             Testvector += Translationvector;
             Testvector *= matrix;
@@ -314,104 +338,6 @@
 
   Center.Scale(1./static_cast<double>(getAtomCount()));
-};
-
-/** Transforms/Rotates the given molecule into its principal axis system.
- * \param *out output stream for debugging
- * \param DoRotate whether to rotate (true) or only to determine the PAS.
- * TODO treatment of trajetories missing
- */
-void molecule::PrincipalAxisSystem(bool DoRotate)
-{
-  double InertiaTensor[NDIM*NDIM];
-  Vector *CenterOfGravity = DetermineCenterOfGravity();
-
-  CenterPeriodic();
-
-  // reset inertia tensor
-  for(int i=0;i<NDIM*NDIM;i++)
-    InertiaTensor[i] = 0.;
-
-  // sum up inertia tensor
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    Vector x = (*iter)->x;
-    //x.SubtractVector(CenterOfGravity);
-    InertiaTensor[0] += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
-    InertiaTensor[1] += (*iter)->type->mass*(-x[0]*x[1]);
-    InertiaTensor[2] += (*iter)->type->mass*(-x[0]*x[2]);
-    InertiaTensor[3] += (*iter)->type->mass*(-x[1]*x[0]);
-    InertiaTensor[4] += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
-    InertiaTensor[5] += (*iter)->type->mass*(-x[1]*x[2]);
-    InertiaTensor[6] += (*iter)->type->mass*(-x[2]*x[0]);
-    InertiaTensor[7] += (*iter)->type->mass*(-x[2]*x[1]);
-    InertiaTensor[8] += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
-  }
-  // print InertiaTensor for debugging
-  DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << endl);
-  for(int i=0;i<NDIM;i++) {
-    for(int j=0;j<NDIM;j++)
-      DoLog(0) && (Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " ");
-    DoLog(0) && (Log() << Verbose(0) << endl);
-  }
-  DoLog(0) && (Log() << Verbose(0) << endl);
-
-  // diagonalize to determine principal axis system
-  gsl_eigen_symmv_workspace *T = gsl_eigen_symmv_alloc(NDIM);
-  gsl_matrix_view m = gsl_matrix_view_array(InertiaTensor, NDIM, NDIM);
-  gsl_vector *eval = gsl_vector_alloc(NDIM);
-  gsl_matrix *evec = gsl_matrix_alloc(NDIM, NDIM);
-  gsl_eigen_symmv(&m.matrix, eval, evec, T);
-  gsl_eigen_symmv_free(T);
-  gsl_eigen_symmv_sort(eval, evec, GSL_EIGEN_SORT_ABS_DESC);
-
-  for(int i=0;i<NDIM;i++) {
-    DoLog(1) && (Log() << Verbose(1) << "eigenvalue = " << gsl_vector_get(eval, i));
-    DoLog(0) && (Log() << Verbose(0) << ", eigenvector = (" << evec->data[i * evec->tda + 0] << "," << evec->data[i * evec->tda + 1] << "," << evec->data[i * evec->tda + 2] << ")" << endl);
-  }
-
-  // check whether we rotate or not
-  if (DoRotate) {
-    DoLog(1) && (Log() << Verbose(1) << "Transforming molecule into PAS ... ");
-    // the eigenvectors specify the transformation matrix
-    Matrix M = Matrix(evec->data);
-
-    BOOST_FOREACH(atom* iter, atoms){
-      (*iter->node) *= M;
-    }
-    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
-
-    // summing anew for debugging (resulting matrix has to be diagonal!)
-    // reset inertia tensor
-    for(int i=0;i<NDIM*NDIM;i++)
-      InertiaTensor[i] = 0.;
-
-    // sum up inertia tensor
-    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-      Vector x = (*iter)->x;
-      InertiaTensor[0] += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
-      InertiaTensor[1] += (*iter)->type->mass*(-x[0]*x[1]);
-      InertiaTensor[2] += (*iter)->type->mass*(-x[0]*x[2]);
-      InertiaTensor[3] += (*iter)->type->mass*(-x[1]*x[0]);
-      InertiaTensor[4] += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
-      InertiaTensor[5] += (*iter)->type->mass*(-x[1]*x[2]);
-      InertiaTensor[6] += (*iter)->type->mass*(-x[2]*x[0]);
-      InertiaTensor[7] += (*iter)->type->mass*(-x[2]*x[1]);
-      InertiaTensor[8] += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
-    }
-    // print InertiaTensor for debugging
-    DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << endl);
-    for(int i=0;i<NDIM;i++) {
-      for(int j=0;j<NDIM;j++)
-        DoLog(0) && (Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " ");
-      DoLog(0) && (Log() << Verbose(0) << endl);
-    }
-    DoLog(0) && (Log() << Verbose(0) << endl);
-  }
-
-  // free everything
-  delete(CenterOfGravity);
-  gsl_vector_free(eval);
-  gsl_matrix_free(evec);
-};
-
+  CenterAtVector(&Center);
+};
 
 /** Align all atoms in such a manner that given vector \a *n is along z axis.
@@ -431,7 +357,7 @@
   DoLog(1) && (Log() << Verbose(1) << "Z-X-angle: " << alpha << " ... ");
   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    tmp = (*iter)->x[0];
-    (*iter)->x[0] =  cos(alpha) * tmp + sin(alpha) * (*iter)->x[2];
-    (*iter)->x[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->x[2];
+    tmp = (*iter)->at(0);
+    (*iter)->set(0,  cos(alpha) * tmp + sin(alpha) * (*iter)->at(2));
+    (*iter)->set(2, -sin(alpha) * tmp + cos(alpha) * (*iter)->at(2));
     for (int j=0;j<MDSteps;j++) {
       tmp = (*iter)->Trajectory.R.at(j)[0];
@@ -450,7 +376,7 @@
   DoLog(1) && (Log() << Verbose(1) << "Z-Y-angle: " << alpha << " ... ");
   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    tmp = (*iter)->x[1];
-    (*iter)->x[1] =  cos(alpha) * tmp + sin(alpha) * (*iter)->x[2];
-    (*iter)->x[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->x[2];
+    tmp = (*iter)->at(1);
+    (*iter)->set(1,  cos(alpha) * tmp + sin(alpha) * (*iter)->at(2));
+    (*iter)->set(2, -sin(alpha) * tmp + cos(alpha) * (*iter)->at(2));
     for (int j=0;j<MDSteps;j++) {
       tmp = (*iter)->Trajectory.R.at(j)[1];
@@ -490,6 +416,6 @@
   // go through all atoms
   for (molecule::const_iterator iter = par->mol->begin(); iter != par->mol->end(); ++iter) {
-    if ((*iter)->type == ((struct lsq_params *)params)->type) { // for specific type
-      c = (*iter)->x - a;
+    if ((*iter)->getType() == ((struct lsq_params *)params)->type) { // for specific type
+      c = (*iter)->getPosition() - a;
       t = c.ScalarProduct(b);           // get direction parameter
       d = t*b;       // and create vector
Index: src/molecule_graph.cpp
===================================================================
--- src/molecule_graph.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/molecule_graph.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * molecule_graph.cpp
@@ -6,4 +13,5 @@
  */
 
+// include config.h
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -18,15 +26,15 @@
 #include "defs.hpp"
 #include "element.hpp"
-#include "helpers.hpp"
-#include "info.hpp"
+#include "Helpers/helpers.hpp"
+#include "Helpers/Info.hpp"
 #include "linkedcell.hpp"
 #include "lists.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "World.hpp"
 #include "Helpers/fast_functions.hpp"
 #include "Helpers/Assert.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "Box.hpp"
 #include "stackclass.hpp"
@@ -146,7 +154,7 @@
   DoLog(1) && (Log() << Verbose(1) << "AtomCount " << getAtomCount() << " and bonddistance is " << bonddistance << "." << endl);
 
-  if ((getAtomCount() > 1) && (bonddistance > 1.)) {
+  if ((getAtomCount() > 1) && (bonddistance > 0.1)) {
     DoLog(2) && (Log() << Verbose(2) << "Creating Linked Cell structure ... " << endl);
-    LC = new LinkedCell(this, bonddistance);
+    LC = new LinkedCell(*this, bonddistance);
 
     // create a list to map Tesselpoint::nr to atom *
@@ -184,5 +192,5 @@
                           //Log() << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
                           (BG->*minmaxdistance)(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
-                          const double distance = domain.periodicDistanceSquared(OtherWalker->x,Walker->x);
+                          const double distance = domain.periodicDistanceSquared(OtherWalker->getPosition(),Walker->getPosition());
                           const bool status = (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance);
 //                          Log() << Verbose(1) << "MinDistance is " << MinDistance << " and MaxDistance is " << MaxDistance << "." << endl;
@@ -212,5 +220,5 @@
 
     // output bonds for debugging (if bond chain list was correctly installed)
-    ActOnAllAtoms( &atom::OutputBondOfAtom );
+    for_each(atoms.begin(),atoms.end(),mem_fun(&atom::OutputBondOfAtom));
   } else
     DoLog(1) && (Log() << Verbose(1) << "AtomCount is " << getAtomCount() << ", thus no bonds, no connections!." << endl);
@@ -277,5 +285,8 @@
     do {
       OldNo = No;
-      No = SumPerAtom( &atom::CorrectBondDegree );
+      No=0;
+      BOOST_FOREACH(atom *atom,atoms){
+        No+=atom->CorrectBondDegree();
+      }
     } while (OldNo != No);
     DoLog(0) && (Log() << Verbose(0) << " done." << endl);
@@ -507,6 +518,4 @@
   DFS.BackStepping = false;
   mol->ResetAllBondsToUnused();
-  mol->SetAtomValueToValue(-1, &atom::GraphNr);
-  mol->ActOnAllAtoms(&atom::InitComponentNr);
   DFS.BackEdgeStack->ClearStack();
 }
@@ -523,4 +532,10 @@
 }
 ;
+
+void molecule::init_DFS(struct DFSAccounting &DFS) const{
+  DepthFirstSearchAnalysis_Init(DFS, this);
+  for_each(atoms.begin(),atoms.end(),mem_fun(&atom::resetGraphNr));
+  for_each(atoms.begin(),atoms.end(),mem_fun(&atom::InitComponentNr));
+}
 
 /** Performs a Depth-First search on this molecule.
@@ -546,5 +561,5 @@
     return SubGraphs;
   DoLog(0) && (Log() << Verbose(0) << "Begin of DepthFirstSearchAnalysis" << endl);
-  DepthFirstSearchAnalysis_Init(DFS, this);
+  init_DFS(DFS);
 
   for (molecule::const_iterator iter = begin(); iter != end();) {
@@ -630,5 +645,5 @@
 {
   DoLog(1) && (Log() << Verbose(1) << "Final graph info for each atom is:" << endl);
-  ActOnAllAtoms( &atom::OutputGraphInfo );
+  for_each(atoms.begin(),atoms.end(),mem_fun(&atom::OutputGraphInfo));
 }
 ;
@@ -645,11 +660,14 @@
       if ((*BondRunner)->leftatom == *AtomRunner) {
         Binder = *BondRunner;
-        DoLog(2) && (Log() << Verbose(2) << ((Binder->Type == TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <");
-        DoLog(0) && (Log() << Verbose(0) << ((Binder->leftatom->SeparationVertex) ? "SP," : "") << "L" << Binder->leftatom->LowpointNr << " G" << Binder->leftatom->GraphNr << " Comp.");
-        Binder->leftatom->OutputComponentNumber();
-        DoLog(0) && (Log() << Verbose(0) << " ===  ");
-        DoLog(0) && (Log() << Verbose(0) << ((Binder->rightatom->SeparationVertex) ? "SP," : "") << "L" << Binder->rightatom->LowpointNr << " G" << Binder->rightatom->GraphNr << " Comp.");
-        Binder->rightatom->OutputComponentNumber();
-        DoLog(0) && (Log() << Verbose(0) << ">." << endl);
+        if (DoLog(2)) {
+          ostream &out = (Log() << Verbose(2));
+          out << ((Binder->Type == TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <";
+          out << ((Binder->leftatom->SeparationVertex) ? "SP," : "") << "L" << Binder->leftatom->LowpointNr << " G" << Binder->leftatom->GraphNr << " Comp.";
+          Binder->leftatom->OutputComponentNumber(&out);
+          out << " ===  ";
+          out << ((Binder->rightatom->SeparationVertex) ? "SP," : "") << "L" << Binder->rightatom->LowpointNr << " G" << Binder->rightatom->GraphNr << " Comp.";
+          Binder->rightatom->OutputComponentNumber(&out);
+          out << ">." << endl;
+        }
         if (Binder->Cyclic) // cyclic ??
           DoLog(3) && (Log() << Verbose(3) << "Lowpoint at each side are equal: CYCLIC!" << endl);
@@ -737,5 +755,5 @@
         OtherAtom = (*Runner)->GetOtherAtom(Walker);
 #ifdef ADDHYDROGEN
-        if (OtherAtom->type->Z != 1) {
+        if (OtherAtom->getType()->getAtomicNumber() != 1) {
 #endif
         DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);
@@ -1052,5 +1070,5 @@
   if (AdjacencyFile.good()) {
     AdjacencyFile << "m\tn" << endl;
-    ActOnAllAtoms(&atom::OutputAdjacency, &AdjacencyFile);
+    for_each(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::OutputAdjacency),&AdjacencyFile));
     AdjacencyFile.close();
     DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl);
@@ -1084,5 +1102,5 @@
   if (BondFile.good()) {
     BondFile << "m\tn" << endl;
-    ActOnAllAtoms(&atom::OutputBonds, &BondFile);
+    for_each(atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::OutputBonds),&BondFile));
     BondFile.close();
     DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl);
Index: src/molecule_pointcloud.cpp
===================================================================
--- src/molecule_pointcloud.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/molecule_pointcloud.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * molecule_pointcloud.cpp
@@ -6,12 +13,27 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
 #include "atom.hpp"
 #include "config.hpp"
-#include "info.hpp"
+#include "Helpers/Info.hpp"
 #include "molecule.hpp"
 
 /************************************* Functions for class molecule *********************************/
+
+TesselPoint * molecule::getValue(const_iterator &rhs) const
+{
+  return *rhs;
+}
+
+TesselPoint * molecule::getValue(iterator &rhs) const
+{
+  return *rhs;
+}
 
 /** Returns a name for this point cloud, here the molecule's name.
Index: c/molecule_template.hpp
===================================================================
--- src/molecule_template.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,429 +1,0 @@
-/*
- * molecule_template.hpp
- *
- *  Created on: Oct 6, 2009
- *      Author: heber
- */
-
-#ifndef MOLECULE_TEMPLATE_HPP_
-#define MOLECULE_TEMPLATE_HPP_
-
-/*********************************************** includes ***********************************/
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "atom.hpp"
-/********************************************** declarations *******************************/
-
-// ================== Acting on all Vectors ========================== //
-
-// zero arguments
-template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() ) const
-    {
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (((*iter)->node)->*f)();
-  }
-};
-template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() const ) const
-    {
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (((*iter)->node)->*f)();
-  }
-};
-// one argument
-template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (((*iter)->node)->*f)(t);
-  }
-};
-template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T) const, T t ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (((*iter)->node)->*f)(t);
-  }
-};
-template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T&), T &t ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (((*iter)->node)->*f)(t);
-  }
-};
-template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T&) const, T &t ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (((*iter)->node)->*f)(t);
-  }
-};
-// two arguments
-template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (((*iter)->node)->*f)(t, u);
-  }
-};
-template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (((*iter)->node)->*f)(t, u);
-  }
-};
-// three arguments
-template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (((*iter)->node)->*f)(t, u, v);
-  }
-};
-template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V) const, T t, U u, V v) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (((*iter)->node)->*f)(t, u, v);
-  }
-};
-
-// ========================= Summing over each Atoms =================================== //
-
-// zero arguments
-template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() ) const
-{
-  res result = 0;
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    result += ((*iter)->*f)();
-  }
-  return result;
-};
-template <typename res, typename typ> res molecule::SumPerAtom(res (typ::*f)() const ) const
-{
-  res result = 0;
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    result += ((*iter)->*f)();
-  }
-  return result;
-};
-// one argument
-template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T), T t ) const
-{
-  res result = 0;
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    result += ((*iter)->*f)(t);
-  }
-  return result;
-};
-template <typename res, typename typ, typename T> res molecule::SumPerAtom(res (typ::*f)(T) const, T t ) const
-{
-  res result = 0;
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    result += ((*iter)->*f)(t);
-  }
-  return result;
-};
-
-
-// ================== Acting with each Atoms on same molecule ========================== //
-
-// zero arguments
-template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *)) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (*f)((*iter));
-  }
-};
-template <typename res> void molecule::ActWithEachAtom( res (molecule::*f)(atom *) const) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (*f)((*iter));
-  }
-};
-
-// ================== Acting with each Atoms on copy molecule ========================== //
-
-// zero arguments
-template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) , molecule *copy) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (copy->*f)((*iter));
-  }
-};
-template <typename res> void molecule::ActOnCopyWithEachAtom( res (molecule::*f)(atom *) const, molecule *copy) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (copy->*f)((*iter));
-  }
-};
-
-// ================== Acting with each Atoms on copy molecule if true ========================== //
-
-// zero arguments
-template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)())
-      (copy->*f)((*iter));
-  }
-};
-template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) () const ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)())
-      (copy->*f)((*iter));
-  }
-};
-template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const , molecule *copy, bool (atom::*condition) () ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)())
-      (copy->*f)((*iter));
-  }
-};
-template <typename res> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) () const ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)())
-      (copy->*f)((*iter));
-  }
-};
-// one argument
-template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T), T t ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t))
-      (copy->*f)((*iter));
-  }
-};
-template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T) const, T t ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t))
-      (copy->*f)((*iter));
-  }
-};
-template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T), T t ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t))
-      (copy->*f)((*iter));
-  }
-};
-template <typename res, typename T> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T) const, T t ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t))
-      (copy->*f)((*iter));
-  }
-};
-// two arguments
-template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t,u))
-      (copy->*f)((*iter));
-  }
-};
-template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t,u))
-      (copy->*f)((*iter));
-  }
-};
-template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U), T t, U u ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t,u))
-      (copy->*f)((*iter));
-  }
-};
-template <typename res, typename T, typename U> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U) const, T t, U u ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t,u))
-      (copy->*f)((*iter));
-  }
-};
-// three arguments
-template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t,u,v))
-      (copy->*f)((*iter));
-  }
-};
-template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) , molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t,u,v))
-      (copy->*f)((*iter));
-  }
-};
-template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U, V), T t, U u, V v ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t,u,v))
-      (copy->*f)((*iter));
-  }
-};
-template <typename res, typename T, typename U, typename V> void molecule::ActOnCopyWithEachAtomIfTrue( res (molecule::*f)(atom *) const, molecule *copy, bool (atom::*condition) (T, U, V) const, T t, U u, V v ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    if (((*iter)->*condition)(t,u,v))
-      (copy->*f)((*iter));
-  }
-};
-
-// ================== Acting on all Atoms ========================== //
-
-// zero arguments
-template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)()) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    ((*iter)->*f)();
-  }
-};
-template <typename res, typename typ> void molecule::ActOnAllAtoms( res (typ::*f)() const) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    ((*iter)->*f)();
-  }
-};
-// one argument
-template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T), T t ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    ((*iter)->*f)(t);
-  }
-};
-template <typename res, typename typ, typename T> void molecule::ActOnAllAtoms( res (typ::*f)(T) const, T t ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    ((*iter)->*f)(t);
-  }
-};
-// two argument
-template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U), T t, U u ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    ((*iter)->*f)(t, u);
-  }
-};
-template <typename res, typename typ, typename T, typename U> void molecule::ActOnAllAtoms( res (typ::*f)(T, U) const, T t, U u ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    ((*iter)->*f)(t, u);
-  }
-};
-// three argument
-template <typename res, typename typ, typename T, typename U, typename V> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V), T t, U u, V v) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    ((*iter)->*f)(t, u, v);
-  }
-};
-template <typename res, typename typ, typename T, typename U, typename V> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V) const, T t, U u, V v) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    ((*iter)->*f)(t, u, v);
-  }
-};
-// four arguments
-template <typename res, typename typ, typename T, typename U, typename V, typename W> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V, W), T t, U u, V v, W w) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    ((*iter)->*f)(t, u, v, w);
-  }
-};
-template <typename res, typename typ, typename T, typename U, typename V, typename W> void molecule::ActOnAllAtoms( res (typ::*f)(T, U, V, W) const, T t, U u, V v, W w) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    ((*iter)->*f)(t, u, v, w);
-  }
-};
-
-// ===================== Accessing arrays indexed by some integer for each atom ======================
-
-// for atom ints
-template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *) ) const
-{
-  int inc = 1;
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (*Setor) (&array[((*iter)->*index)], &inc);
-  }
-};
-template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T value ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (*Setor) (&array[((*iter)->*index)], &value);
-  }
-};
-template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, void (*Setor)(T *, T *), T *value ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (*Setor) (&array[((*iter)->*index)], value);
-  }
-};
-// for element ints
-template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *) ) const
-{
-  int inc = 1;
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (*Setor) (&array[((*iter)->type->*index)], &inc);
-  }
-};
-template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T value ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (*Setor) (&array[((*iter)->type->*index)], &value);
-  }
-};
-template <typename T> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int element::*index, void (*Setor)(T *, T *), T *value ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (*Setor) (&array[((*iter)->type->*index)], value);
-  }
-};
-
-template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ atom::*value ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    array[((*iter)->*index)] = ((*iter)->*Setor) ((*iter)->*value);
-  }
-};
-template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ atom::*value ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    array[((*iter)->*index)] = ((*iter)->*Setor) ((*iter)->*value);
-  }
-};
-template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &), typ &vect ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    array[((*iter)->*index)] = ((*iter)->*Setor) (vect);
-  }
-};
-template <typename T, typename typ> void molecule::SetIndexedArrayForEachAtomTo ( T *array, int ParticleInfo::*index, T (atom::*Setor)(typ &) const, typ &vect ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    array[((*iter)->*index)] = ((*iter)->*Setor) (vect);
-  }
-};
-template <typename T, typename typ, typename typ2> void molecule::SetAtomValueToIndexedArray ( T *array, int typ::*index, T typ2::*value ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (*iter)->*value = array[((*iter)->*index)];
-    //Log() << Verbose(2) << *(*iter) << " gets " << ((*iter)->*value); << endl;
-  }
-};
-
-template <typename T, typename typ> void molecule::SetAtomValueToValue ( T value, T typ::*ptr ) const
-{
-  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
-    (*iter)->*ptr = value;
-    //Log() << Verbose(2) << *(*iter) << " gets " << ((*iter)->*ptr) << endl;
-  }
-};
-
-
-#endif /* MOLECULE_TEMPLATE_HPP_ */
Index: src/moleculelist.cpp
===================================================================
--- src/moleculelist.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/moleculelist.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file MoleculeListClass.cpp
  *
@@ -5,4 +12,5 @@
  */
 
+// include config.h
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -23,13 +31,14 @@
 #include "config.hpp"
 #include "element.hpp"
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 #include "linkedcell.hpp"
 #include "lists.hpp"
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "periodentafel.hpp"
+#include "tesselation.hpp"
 #include "Helpers/Assert.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "Box.hpp"
 #include "stackclass.hpp"
@@ -43,10 +52,7 @@
 MoleculeListClass::MoleculeListClass(World *_world) :
   Observable("MoleculeListClass"),
+  MaxIndex(1),
   world(_world)
-{
-  // empty lists
-  ListOfMolecules.clear();
-  MaxIndex = 1;
-};
+{};
 
 /** Destructor for MoleculeListClass.
@@ -182,7 +188,7 @@
       size=0.;
       for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
-        counts[(*iter)->type->getNumber()]++;
-        if ((*iter)->x.DistanceSquared(Origin) > size)
-          size = (*iter)->x.DistanceSquared(Origin);
+        counts[(*iter)->getType()->getNumber()]++;
+        if ((*iter)->DistanceSquared(Origin) > size)
+          size = (*iter)->DistanceSquared(Origin);
       }
       // output Index, Name, number of atoms, chemical formula
@@ -195,5 +201,7 @@
       }
       // Center and size
-      (*out) << "\t" << (*ListRunner)->Center << "\t" << sqrt(size) << endl;
+      Vector *Center = (*ListRunner)->DetermineCenterOfAll();
+      (*out) << "\t" << *Center << "\t" << sqrt(size) << endl;
+      delete(Center);
     }
   }
@@ -212,166 +220,4 @@
 };
 
-/** Simple merge of two molecules into one.
- * \param *mol destination molecule
- * \param *srcmol source molecule
- * \return true - merge successful, false - merge failed (probably due to non-existant indices
- */
-bool MoleculeListClass::SimpleMerge(molecule *mol, molecule *srcmol)
-{
-  if (srcmol == NULL)
-    return false;
-
-  // put all molecules of src into mol
-  for (molecule::iterator iter = srcmol->begin(); !srcmol->empty(); iter=srcmol->begin()) {
-    atom * const Walker = *iter;
-    srcmol->UnlinkAtom(Walker);
-    mol->AddAtom(Walker);
-  }
-
-  // remove src
-  ListOfMolecules.remove(srcmol);
-  World::getInstance().destroyMolecule(srcmol);
-  return true;
-};
-
-/** Simple add of one molecules into another.
- * \param *mol destination molecule
- * \param *srcmol source molecule
- * \return true - merge successful, false - merge failed (probably due to non-existant indices
- */
-bool MoleculeListClass::SimpleAdd(molecule *mol, molecule *srcmol)
-{
-  if (srcmol == NULL)
-    return false;
-
-  // put all molecules of src into mol
-  atom *Walker = NULL;
-  for (molecule::iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
-    Walker = mol->AddCopyAtom((*iter));
-    Walker->father = Walker;
-  }
-
-  return true;
-};
-
-/** Simple merge of a given set of molecules into one.
- * \param *mol destination molecule
- * \param *src index of set of source molecule
- * \param N number of source molecules
- * \return true - merge successful, false - some merges failed (probably due to non-existant indices)
- */
-bool MoleculeListClass::SimpleMultiMerge(molecule *mol, int *src, int N)
-{
-  bool status = true;
-  // check presence of all source molecules
-  for (int i=0;i<N;i++) {
-    molecule *srcmol = ReturnIndex(src[i]);
-    status = status && SimpleMerge(mol, srcmol);
-  }
-  insert(mol);
-  return status;
-};
-
-/** Simple add of a given set of molecules into one.
- * \param *mol destination molecule
- * \param *src index of set of source molecule
- * \param N number of source molecules
- * \return true - merge successful, false - some merges failed (probably due to non-existant indices)
- */
-bool MoleculeListClass::SimpleMultiAdd(molecule *mol, int *src, int N)
-{
-  bool status = true;
-  // check presence of all source molecules
-  for (int i=0;i<N;i++) {
-    molecule *srcmol = ReturnIndex(src[i]);
-    status = status && SimpleAdd(mol, srcmol);
-  }
-  return status;
-};
-
-/** Scatter merge of a given set of molecules into one.
- * Scatter merge distributes the molecules in such a manner that they don't overlap.
- * \param *mol destination molecule
- * \param *src index of set of source molecule
- * \param N number of source molecules
- * \return true - merge successful, false - merge failed (probably due to non-existant indices
- * \TODO find scatter center for each src molecule
- */
-bool MoleculeListClass::ScatterMerge(molecule *mol, int *src, int N)
-{
-  // check presence of all source molecules
-  for (int i=0;i<N;i++) {
-    // get pointer to src molecule
-    molecule *srcmol = ReturnIndex(src[i]);
-    if (srcmol == NULL)
-      return false;
-  }
-  // adapt each Center
-  for (int i=0;i<N;i++) {
-    // get pointer to src molecule
-    molecule *srcmol = ReturnIndex(src[i]);
-    //srcmol->Center.Zero();
-    srcmol->Translate(&srcmol->Center);
-  }
-  // perform a simple multi merge
-  SimpleMultiMerge(mol, src, N);
-  return true;
-};
-
-/** Embedding merge of a given set of molecules into one.
- * Embedding merge inserts one molecule into the other.
- * \param *mol destination molecule (fixed one)
- * \param *srcmol source molecule (variable one, where atoms are taken from)
- * \return true - merge successful, false - merge failed (probably due to non-existant indices)
- * \TODO linked cell dimensions for boundary points has to be as big as inner diameter!
- */
-bool MoleculeListClass::EmbedMerge(molecule *mol, molecule *srcmol)
-{
-  LinkedCell *LCList = NULL;
-  Tesselation *TesselStruct = NULL;
-  if ((srcmol == NULL) || (mol == NULL)) {
-    DoeLog(1) && (eLog()<< Verbose(1) << "Either fixed or variable molecule is given as NULL." << endl);
-    return false;
-  }
-
-  // calculate envelope for *mol
-  LCList = new LinkedCell(mol, 8.);
-  FindNonConvexBorder(mol, TesselStruct, (const LinkedCell *&)LCList, 4., NULL);
-  if (TesselStruct == NULL) {
-    DoeLog(1) && (eLog()<< Verbose(1) << "Could not tesselate the fixed molecule." << endl);
-    return false;
-  }
-  delete(LCList);
-  LCList = new LinkedCell(TesselStruct, 8.);  // re-create with boundary points only!
-
-  // prepare index list for bonds
-  atom ** CopyAtoms = new atom*[srcmol->getAtomCount()];
-  for(int i=0;i<srcmol->getAtomCount();i++)
-    CopyAtoms[i] = NULL;
-
-  // for each of the source atoms check whether we are in- or outside and add copy atom
-  int nr=0;
-  for (molecule::const_iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
-    DoLog(2) && (Log() << Verbose(2) << "INFO: Current Walker is " << **iter << "." << endl);
-    if (!TesselStruct->IsInnerPoint((*iter)->x, LCList)) {
-      CopyAtoms[(*iter)->nr] = (*iter)->clone();
-      mol->AddAtom(CopyAtoms[(*iter)->nr]);
-      nr++;
-    } else {
-      // do nothing
-    }
-  }
-  DoLog(1) && (Log() << Verbose(1) << nr << " of " << srcmol->getAtomCount() << " atoms have been merged.");
-
-  // go through all bonds and add as well
-  for(molecule::iterator AtomRunner = srcmol->begin(); AtomRunner != srcmol->end(); ++AtomRunner)
-    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
-      if ((*BondRunner)->leftatom == *AtomRunner) {
-        DoLog(3) && (Log() << Verbose(3) << "Adding Bond between " << *CopyAtoms[(*BondRunner)->leftatom->nr] << " and " << *CopyAtoms[(*BondRunner)->rightatom->nr]<< "." << endl);
-        mol->AddBond(CopyAtoms[(*BondRunner)->leftatom->nr], CopyAtoms[(*BondRunner)->rightatom->nr], (*BondRunner)->BondDegree);
-      }
-  delete(LCList);
-  return true;
-};
 
 /** Simple output of the pointers in ListOfMolecules.
@@ -501,13 +347,13 @@
     for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
       //Log() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
-      if (((*iter)->type->Z == 1) && (((*iter)->father == NULL)
-          || ((*iter)->father->type->Z != 1))) { // if it's a hydrogen
+      if (((*iter)->getType()->getAtomicNumber() == 1) && (((*iter)->father == NULL)
+          || ((*iter)->father->getType()->getAtomicNumber() != 1))) { // if it's a hydrogen
         for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) {
           //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
           // 3. take every other hydrogen that is the not the first and not bound to same bonding partner
           Binder = *((*runner)->ListOfBonds.begin());
-          if (((*runner)->type->Z == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!)
+          if (((*runner)->getType()->getAtomicNumber() == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!)
             // 4. evaluate the morse potential for each matrix component and add up
-            distance = (*runner)->x.distance((*iter)->x);
+            distance = (*runner)->distance(*(*iter));
             //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":" << endl;
             for (int k = 0; k < a; k++) {
@@ -599,5 +445,5 @@
         if ((*ListRunner)->hasElement((*elemIter).first)) { // if this element got atoms
           for(molecule::iterator atomIter = (*ListRunner)->begin(); atomIter !=(*ListRunner)->end();++atomIter){
-            if ((*atomIter)->type->getNumber() == (*elemIter).first) {
+            if ((*atomIter)->getType()->getNumber() == (*elemIter).first) {
               if (((*atomIter)->GetTrueFather() != NULL) && ((*atomIter)->GetTrueFather() != (*atomIter))) {// if there is a rea
                 //Log() << Verbose(0) << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it
@@ -746,103 +592,4 @@
 };
 
-/** Dissects given \a *mol into connected subgraphs and inserts them as new molecules but with old atoms into \a this.
- * \param *out output stream for debugging
- * \param *periode periodentafel
- * \param *configuration config with BondGraph
- */
-void MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration)
-{
-  // 0a. remove all present molecules
-  vector<molecule *> allmolecules = World::getInstance().getAllMolecules();
-  for (vector<molecule *>::iterator MolRunner = allmolecules.begin(); MolRunner != allmolecules.end(); ++MolRunner) {
-    erase(*MolRunner);
-    World::getInstance().destroyMolecule(*MolRunner);
-  }
-  // 0b. remove all bonds and construct a molecule with all atoms
-  molecule *mol = World::getInstance().createMolecule();
-  vector <atom *> allatoms = World::getInstance().getAllAtoms();
-  for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {
-    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
-      delete(*BondRunner);
-    mol->AddAtom(*AtomRunner);
-  }
-
-  // 1. dissect the molecule into connected subgraphs
-  if (configuration->BG != NULL) {
-    if (!configuration->BG->ConstructBondGraph(mol)) {
-      World::getInstance().destroyMolecule(mol);
-      DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);
-      return;
-    }
-  } else {
-    DoeLog(1) && (eLog()<< Verbose(1) << "There is no BondGraph class present to create bonds." << endl);
-    return;
-  }
-
-  // 2. scan for connected subgraphs
-  MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
-  class StackClass<bond *> *BackEdgeStack = NULL;
-  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
-  delete(BackEdgeStack);
-  if ((Subgraphs == NULL) || (Subgraphs->next == NULL)) {
-    World::getInstance().destroyMolecule(mol);
-    DoeLog(1) && (eLog()<< Verbose(1) << "There are no atoms." << endl);
-    return;
-  }
-
-  // 3. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in
-  // the original one as parsed in)
-  // TODO: Optimize this, when molecules just contain pointer list of global atoms!
-
-  // 4a. create array of molecules to fill
-  const int MolCount = Subgraphs->next->Count();
-  char number[MAXSTRINGSIZE];
-  molecule **molecules = new molecule *[MolCount];
-  MoleculeLeafClass *MolecularWalker = Subgraphs;
-  for (int i=0;i<MolCount;i++) {
-    MolecularWalker = MolecularWalker->next;
-    molecules[i] = World::getInstance().createMolecule();
-    molecules[i]->ActiveFlag = true;
-    strncpy(molecules[i]->name, mol->name, MAXSTRINGSIZE);
-    if (MolCount > 1) {
-      sprintf(number, "-%d", i+1);
-      strncat(molecules[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1);
-    }
-    DoLog(1) && (Log() << Verbose(1) << "MolName is " << molecules[i]->name << ", id is " << molecules[i]->getId() << endl);
-    for (molecule::iterator iter = MolecularWalker->Leaf->begin(); iter != MolecularWalker->Leaf->end(); ++iter) {
-      DoLog(1) && (Log() << Verbose(1) << **iter << endl);
-    }
-    insert(molecules[i]);
-  }
-
-  // 4b. create and fill map of which atom is associated to which connected molecule (note, counting starts at 1)
-  int FragmentCounter = 0;
-  map<int, atom *> AtomToFragmentMap;
-  MolecularWalker = Subgraphs;
-  while (MolecularWalker->next != NULL) {
-    MolecularWalker = MolecularWalker->next;
-    for (molecule::iterator iter = MolecularWalker->Leaf->begin(); !MolecularWalker->Leaf->empty(); iter = MolecularWalker->Leaf->begin()) {
-      atom * Walker = *iter;
-      DoLog(1) && (Log() << Verbose(1) << "Re-linking " << Walker << "..." << endl);
-      MolecularWalker->Leaf->erase(iter);
-      molecules[FragmentCounter]->AddAtom(Walker);    // counting starts at 1
-    }
-    FragmentCounter++;
-  }
-  World::getInstance().destroyMolecule(mol);
-
-  // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list
-  // TODO: check whether this is really not needed anymore
-  // 4e. free Leafs
-  MolecularWalker = Subgraphs;
-  while (MolecularWalker->next != NULL) {
-    MolecularWalker = MolecularWalker->next;
-    delete(MolecularWalker->previous);
-  }
-  delete(MolecularWalker);
-  delete[](molecules);
-  DoLog(1) && (Log() << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl);
-};
-
 /** Count all atoms in each molecule.
  * \return number of atoms in the MoleculeListClass.
@@ -861,13 +608,4 @@
  * Methods Moved here from the menus
  */
-
-void MoleculeListClass::flipChosen() {
-  int j;
-  Log() << Verbose(0) << "Enter index of molecule: ";
-  cin >> j;
-  for(MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++)
-    if ((*ListRunner)->IndexNr == j)
-      (*ListRunner)->ActiveFlag = !(*ListRunner)->ActiveFlag;
-}
 
 void MoleculeListClass::createNewMolecule(periodentafel *periode) {
@@ -952,5 +690,7 @@
  */
 //MoleculeLeafClass::MoleculeLeafClass(MoleculeLeafClass *Up = NULL, MoleculeLeafClass *Previous = NULL)
-MoleculeLeafClass::MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf = NULL)
+MoleculeLeafClass::MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf = NULL) :
+  Leaf(NULL),
+  previous(PreviousLeaf)
 {
   //  if (Up != NULL)
@@ -959,6 +699,4 @@
   //  UpLeaf = Up;
   //  DownLeaf = NULL;
-  Leaf = NULL;
-  previous = PreviousLeaf;
   if (previous != NULL) {
     MoleculeLeafClass *Walker = previous->next;
@@ -1089,5 +827,5 @@
         if (AtomMask[Father->nr]) // apply mask
 #ifdef ADDHYDROGEN
-          if ((*iter)->type->Z != 1) // skip hydrogen
+          if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen
 #endif
           RootStack[FragmentCounter].push_front((*iter)->nr);
Index: src/parser.cpp
===================================================================
--- src/parser.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/parser.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file parsing.cpp
  *
@@ -7,16 +14,16 @@
 // ======================================= INCLUDES ==========================================
 
-#include "Helpers/MemDebug.hpp"
-
-#include <cstring>
-
-#include "helpers.hpp"
-#include "parser.hpp"
-#include "verbose.hpp"
-
 // include config.h
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include <cstring>
+
+#include "Helpers/helpers.hpp"
+#include "parser.hpp"
+#include "Helpers/Verbose.hpp"
 
 // ======================================= FUNCTIONS ==========================================
@@ -59,6 +66,7 @@
 /** Constructor of MatrixContainer class.
  */
-MatrixContainer::MatrixContainer() {
-  Indices = NULL;
+MatrixContainer::MatrixContainer() :
+  Indices(NULL)
+{
   Header = new char*[1];
   Matrix = new double**[1]; // one more each for the total molecule
@@ -850,8 +858,8 @@
 /** Constructor for class HessianMatrix.
  */
-HessianMatrix::HessianMatrix() : MatrixContainer() 
-{
-   IsSymmetric = true;
-}
+HessianMatrix::HessianMatrix() :
+  MatrixContainer(),
+  IsSymmetric(true)
+{}
 
 /** Sums the hessian entries with each factor and put into last element of \a ***Matrix.
@@ -995,12 +1003,12 @@
 /** Constructor of KeySetsContainer class.
  */
-KeySetsContainer::KeySetsContainer() {
-  KeySets = NULL;
-  AtomCounter = NULL;
-  FragmentCounter = 0;
-  Order = 0;
-  FragmentsPerOrder = 0;
-  OrderSet = NULL;
-};
+KeySetsContainer::KeySetsContainer() :
+  KeySets(NULL),
+  AtomCounter(NULL),
+  FragmentCounter(0),
+  Order(0),
+  FragmentsPerOrder(0),
+  OrderSet(NULL)
+{};
 
 /** Destructor of KeySetsContainer class.
Index: src/periodentafel.cpp
===================================================================
--- src/periodentafel.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/periodentafel.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /** \file periodentafel.cpp
  *
@@ -5,7 +12,10 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
-
-using namespace std;
 
 #include <iomanip>
@@ -17,9 +27,9 @@
 #include "element.hpp"
 #include "elements_db.hpp"
-#include "helpers.hpp"
+#include "Helpers/helpers.hpp"
 #include "lists.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "periodentafel.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 
 using namespace std;
@@ -34,5 +44,5 @@
   {
     stringstream input(elementsDB,ios_base::in);
-    bool status = LoadElementsDatabase(&input);
+    bool status = LoadElementsDatabase(input);
     ASSERT(status,  "General element initialization failed");
   }
@@ -72,9 +82,8 @@
  * \return iterator to added element
  */
-periodentafel::iterator periodentafel::AddElement(element * const pointer)
+periodentafel::iterator periodentafel::AddElement(element * pointer)
 {
   atomicNumber_t Z = pointer->getNumber();
   ASSERT(!elements.count(Z), "Element is already present.");
-  pointer->sort = &pointer->Z;
   if (pointer->getNumber() < 1 && pointer->getNumber() >= MAX_ELEMENTS)
     DoeLog(0) && (eLog() << Verbose(0) << "Invalid Z number!\n");
@@ -86,5 +95,5 @@
  * \param *pointer element to be removed
  */
-size_t periodentafel::RemoveElement(element * const pointer)
+size_t periodentafel::RemoveElement(const element * pointer)
 {
   return RemoveElement(pointer->getNumber());
@@ -114,5 +123,5 @@
  * \return pointer to element or NULL if not found
  */
-element * const periodentafel::FindElement(atomicNumber_t Z) const
+const element * periodentafel::FindElement(atomicNumber_t Z) const
 {
   const_iterator res = elements.find(Z);
@@ -125,5 +134,5 @@
  * \return pointer to element
  */
-element * const periodentafel::FindElement(const string &shorthand) const
+const element * periodentafel::FindElement(const string &shorthand) const
 {
   element *res = 0;
@@ -140,7 +149,7 @@
  * \return desired element or NULL
  */
-element * const periodentafel::AskElement() const
-{
-  element * walker = NULL;
+const element * periodentafel::AskElement() const
+{
+  const element * walker = NULL;
   int Z;
   do {
@@ -155,10 +164,10 @@
  * \return pointer to either present or newly created element
  */
-element * const periodentafel::EnterElement()
+const element * periodentafel::EnterElement()
 {
   atomicNumber_t Z = 0;
   DoLog(0) && (Log() << Verbose(0) << "Atomic number: " << Z << endl);
   cin >> Z;
-  element * const res = FindElement(Z);
+  const element *res = FindElement(Z);
   if (!res) {
     // TODO: make this using the constructor
@@ -169,7 +178,7 @@
     cin >> tmp->mass;
     DoLog(0) && (Log() << Verbose(0) << "Name [max 64 chars]: " << endl);
-    cin >> tmp->name;
+    cin >> tmp->getName();
     DoLog(0) && (Log() << Verbose(0) << "Short form [max 3 chars]: " << endl);
-    cin >> tmp->symbol;
+    cin >> tmp->getSymbol();
     AddElement(tmp);
     return tmp;
@@ -180,17 +189,17 @@
 
 /******************** Access to iterators ****************************/
-periodentafel::const_iterator periodentafel::begin(){
+periodentafel::const_iterator periodentafel::begin() const{
   return elements.begin();
 }
 
-periodentafel::const_iterator periodentafel::end(){
+periodentafel::const_iterator periodentafel::end() const{
   return elements.end();
 }
 
-periodentafel::reverse_iterator periodentafel::rbegin(){
+periodentafel::reverse_iterator periodentafel::rbegin() const{
   return reverse_iterator(elements.end());
 }
 
-periodentafel::reverse_iterator periodentafel::rend(){
+periodentafel::reverse_iterator periodentafel::rend() const{
   return reverse_iterator(elements.begin());
 }
@@ -228,5 +237,5 @@
   if (!input.fail())
     DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as elements database." << endl);
-  status = status && LoadElementsDatabase(&input);
+  status = status && LoadElementsDatabase(input);
   input.close();
   input.clear();
@@ -287,49 +296,41 @@
  * \return true - parsing successful, false - something went wrong
  */
-bool periodentafel::LoadElementsDatabase(istream *input)
+bool periodentafel::LoadElementsDatabase(istream &input)
 {
   bool status = true;
-  int counter = 0;
-  pair< std::map<atomicNumber_t,element*>::iterator, bool > InserterTest;
-  if (!(*input).fail()) {
-    (*input).getline(header1, MAXSTRINGSIZE);
-    (*input).getline(header2, MAXSTRINGSIZE); // skip first two header lines
+  string header1tmp,header2tmp;
+  // first parse into a map, so we can revert to old status in case something goes wront
+  map<atomicNumber_t,element*> parsedElements;
+  if (!input.fail()) {
+    getline(input,header1tmp);
+    getline(input,header2tmp); // skip first two header lines
+    //cout << "First header: " << header1tmp << endl;
+    //cout << "Second header: " << header2tmp << endl;
     DoLog(0) && (Log() << Verbose(0) <<  "Parsed elements:");
-    while (!(*input).eof()) {
+    while (!input.eof()) {
       element *neues = new element;
-      (*input) >> neues->name;
-      //(*input) >> ws;
-      (*input) >> neues->symbol;
-      //(*input) >> ws;
-      (*input) >> neues->period;
-      //(*input) >> ws;
-      (*input) >> neues->group;
-      //(*input) >> ws;
-      (*input) >> neues->block;
-      //(*input) >> ws;
-      (*input) >> neues->Z;
-      //(*input) >> ws;
-      (*input) >> neues->mass;
-      //(*input) >> ws;
-      (*input) >> neues->CovalentRadius;
-      //(*input) >> ws;
-      (*input) >> neues->VanDerWaalsRadius;
-      //(*input) >> ws;
-      (*input) >> ws;
+      input >> neues->name;
+      //(*input) >> ws;
+      input >> neues->symbol;
+      //(*input) >> ws;
+      input >> neues->period;
+      //(*input) >> ws;
+      input >> neues->group;
+      //(*input) >> ws;
+      input >> neues->block;
+      //(*input) >> ws;
+      input >> neues->Z;
+      //(*input) >> ws;
+      input >> neues->mass;
+      //(*input) >> ws;
+      input >> neues->CovalentRadius;
+      //(*input) >> ws;
+      input >> neues->VanDerWaalsRadius;
+      //(*input) >> ws;
+      input >> ws;
       //neues->Output((ofstream *)&cout);
       if ((neues->getNumber() > 0) && (neues->getNumber() < MAX_ELEMENTS)) {
-        if (elements.count(neues->getNumber())) {// if element already present, remove and delete old one (i.e. replace it)
-          //cout << neues->symbol << " is present already." << endl;
-          element * const Elemental = FindElement(neues->getNumber());
-          ASSERT(Elemental != NULL, "element should be present but is not??");
-          *Elemental = *neues;
-          delete(neues);
-          neues = Elemental;
-        } else {
-          InserterTest = elements.insert(pair <atomicNumber_t,element*> (neues->getNumber(), neues));
-          ASSERT(InserterTest.second, "Could not insert new element into periodentafel on LoadElementsDatabase().");
-        }
-        DoLog(0) && (Log() << Verbose(0) << " " << elements[neues->getNumber()]->symbol);
-        counter++;
+        parsedElements[neues->Z] = neues;
+        DoLog(0) && (Log() << Verbose(0) << " " << *neues);
       } else {
         DoeLog(2) && (eLog() << Verbose(2) << "Detected empty line or invalid element in elements db, discarding." << endl);
@@ -337,4 +338,10 @@
         delete(neues);
       }
+      // when the input is in failed state, we most likely just read garbage
+      if(input.fail()) {
+        DoeLog(2) && (eLog() << Verbose(2) << "Error parsing elements db." << endl);
+        status = false;
+        break;
+      }
     }
     DoLog(0) && (Log() << Verbose(0) << endl);
@@ -344,6 +351,28 @@
   }
 
-  if (counter == 0)
+  if (!parsedElements.size())
     status = false;
+
+  if(status){
+    for(map<atomicNumber_t,element*>::iterator iter=parsedElements.begin();
+                                               iter!=parsedElements.end();
+                                               ++iter){
+      if (elements.count(iter->first)) {
+        // if element already present, replace the old one
+        // pointer to old element might still be in use, so we have to replace into the old element
+        *(elements[iter->first])=*iter->second;
+        delete(iter->second);
+      }
+      else {
+        // no such element in periodentafel... we can just insert
+        elements[iter->first] = iter->second;
+      }
+    }
+    // all went well.. we now copy the header
+    strncpy(header1,header1tmp.c_str(),MAXSTRINGSIZE);
+    header1[MAXSTRINGSIZE-1]=0;
+    strncpy(header2,header2tmp.c_str(),MAXSTRINGSIZE);
+    header2[MAXSTRINGSIZE-1]=0;
+  }
 
   return status;
Index: src/periodentafel.hpp
===================================================================
--- src/periodentafel.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/periodentafel.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -43,17 +43,17 @@
   ~periodentafel();
 
-  iterator AddElement(element * const pointer);
-  size_t RemoveElement(element * const pointer);
+  iterator AddElement(element * pointer);
+  size_t RemoveElement(const element * pointer);
   size_t RemoveElement(atomicNumber_t);
   void CleanupPeriodtable();
-  element * const FindElement(atomicNumber_t) const;
-  element * const FindElement(const std::string &shorthand) const;
-  element * const AskElement() const;
-  element * const EnterElement();
+  const element * FindElement(atomicNumber_t) const;
+  const element * FindElement(const std::string &shorthand) const;
+  const element * AskElement() const;
+  const element * EnterElement();
 
-  const_iterator begin();
-  const_iterator end();
-  reverse_iterator rbegin();
-  reverse_iterator rend();
+  const_iterator begin() const;
+  const_iterator end() const;
+  reverse_iterator rbegin() const;
+  reverse_iterator rend() const;
   bool Output(std::ostream * const output) const;
   bool LoadPeriodentafel(const char * const path);
@@ -62,5 +62,5 @@
   private:
 
-  bool LoadElementsDatabase(std::istream *input);
+  bool LoadElementsDatabase(std::istream &input);
   bool LoadValenceDatabase(std::istream *input);
   bool LoadOrbitalsDatabase(std::istream *input);
Index: src/stackclass.hpp
===================================================================
--- src/stackclass.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/stackclass.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,6 +11,6 @@
 #endif
 
-#include "verbose.hpp"
-#include "log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "Helpers/Log.hpp"
 
 /****************************************** forward declarations *****************************/
Index: src/tesselation.cpp
===================================================================
--- src/tesselation.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/tesselation.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * tesselation.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -11,16 +23,23 @@
 #include <iomanip>
 
-#include "helpers.hpp"
-#include "info.hpp"
+#include "Helpers/helpers.hpp"
+#include "Helpers/Info.hpp"
+#include "BoundaryPointSet.hpp"
+#include "BoundaryLineSet.hpp"
+#include "BoundaryTriangleSet.hpp"
+#include "BoundaryPolygonSet.hpp"
+#include "TesselPoint.hpp"
+#include "CandidateForTesselation.hpp"
+#include "PointCloud.hpp"
 #include "linkedcell.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "tesselation.hpp"
 #include "tesselationhelpers.hpp"
 #include "triangleintersectionlist.hpp"
-#include "vector.hpp"
-#include "Line.hpp"
-#include "vector_ops.hpp"
-#include "verbose.hpp"
-#include "Plane.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Line.hpp"
+#include "LinearAlgebra/vector_ops.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Plane.hpp"
 #include "Exceptions/LinearDependenceException.hpp"
 #include "Helpers/Assert.hpp"
@@ -28,1198 +47,20 @@
 class molecule;
 
-// ======================================== Points on Boundary =================================
-
-/** Constructor of BoundaryPointSet.
- */
-BoundaryPointSet::BoundaryPointSet() :
-  LinesCount(0), value(0.), Nr(-1)
-{
-  Info FunctionInfo(__func__);
-  DoLog(1) && (Log() << Verbose(1) << "Adding noname." << endl);
-}
-;
-
-/** Constructor of BoundaryPointSet with Tesselpoint.
- * \param *Walker TesselPoint this boundary point represents
- */
-BoundaryPointSet::BoundaryPointSet(TesselPoint * const Walker) :
-  LinesCount(0), node(Walker), value(0.), Nr(Walker->nr)
-{
-  Info FunctionInfo(__func__);
-  DoLog(1) && (Log() << Verbose(1) << "Adding Node " << *Walker << endl);
-}
-;
-
-/** Destructor of BoundaryPointSet.
- * Sets node to NULL to avoid removing the original, represented TesselPoint.
- * \note When removing point from a class Tesselation, use RemoveTesselationPoint()
- */
-BoundaryPointSet::~BoundaryPointSet()
-{
-  Info FunctionInfo(__func__);
-  //Log() << Verbose(0) << "Erasing point nr. " << Nr << "." << endl;
-  if (!lines.empty())
-    DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl);
-  node = NULL;
-}
-;
-
-/** Add a line to the LineMap of this point.
- * \param *line line to add
- */
-void BoundaryPointSet::AddLine(BoundaryLineSet * const line)
-{
-  Info FunctionInfo(__func__);
-  DoLog(1) && (Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." << endl);
-  if (line->endpoints[0] == this) {
-    lines.insert(LinePair(line->endpoints[1]->Nr, line));
-  } else {
-    lines.insert(LinePair(line->endpoints[0]->Nr, line));
-  }
-  LinesCount++;
-}
-;
-
-/** output operator for BoundaryPointSet.
- * \param &ost output stream
- * \param &a boundary point
- */
-ostream & operator <<(ostream &ost, const BoundaryPointSet &a)
-{
-  ost << "[" << a.Nr << "|" << a.node->getName() << " at " << *a.node->node << "]";
-  return ost;
-}
-;
-
-// ======================================== Lines on Boundary =================================
-
-/** Constructor of BoundaryLineSet.
- */
-BoundaryLineSet::BoundaryLineSet() :
-  Nr(-1)
-{
-  Info FunctionInfo(__func__);
-  for (int i = 0; i < 2; i++)
-    endpoints[i] = NULL;
-}
-;
-
-/** Constructor of BoundaryLineSet with two endpoints.
- * Adds line automatically to each endpoints' LineMap
- * \param *Point[2] array of two boundary points
- * \param number number of the list
- */
-BoundaryLineSet::BoundaryLineSet(BoundaryPointSet * const Point[2], const int number)
-{
-  Info FunctionInfo(__func__);
-  // set number
-  Nr = number;
-  // set endpoints in ascending order
-  SetEndpointsOrdered(endpoints, Point[0], Point[1]);
-  // add this line to the hash maps of both endpoints
-  Point[0]->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding.
-  Point[1]->AddLine(this); //
-  // set skipped to false
-  skipped = false;
-  // clear triangles list
-  DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);
-}
-;
-
-/** Constructor of BoundaryLineSet with two endpoints.
- * Adds line automatically to each endpoints' LineMap
- * \param *Point1 first boundary point
- * \param *Point2 second boundary point
- * \param number number of the list
- */
-BoundaryLineSet::BoundaryLineSet(BoundaryPointSet * const Point1, BoundaryPointSet * const Point2, const int number)
-{
-  Info FunctionInfo(__func__);
-  // set number
-  Nr = number;
-  // set endpoints in ascending order
-  SetEndpointsOrdered(endpoints, Point1, Point2);
-  // add this line to the hash maps of both endpoints
-  Point1->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding.
-  Point2->AddLine(this); //
-  // set skipped to false
-  skipped = false;
-  // clear triangles list
-  DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);
-}
-;
-
-/** Destructor for BoundaryLineSet.
- * Removes itself from each endpoints' LineMap, calling RemoveTrianglePoint() when point not connected anymore.
- * \note When removing lines from a class Tesselation, use RemoveTesselationLine()
- */
-BoundaryLineSet::~BoundaryLineSet()
-{
-  Info FunctionInfo(__func__);
-  int Numbers[2];
-
-  // get other endpoint number of finding copies of same line
-  if (endpoints[1] != NULL)
-    Numbers[0] = endpoints[1]->Nr;
-  else
-    Numbers[0] = -1;
-  if (endpoints[0] != NULL)
-    Numbers[1] = endpoints[0]->Nr;
-  else
-    Numbers[1] = -1;
-
-  for (int i = 0; i < 2; i++) {
-    if (endpoints[i] != NULL) {
-      if (Numbers[i] != -1) { // as there may be multiple lines with same endpoints, we have to go through each and find in the endpoint's line list this line set
-        pair<LineMap::iterator, LineMap::iterator> erasor = endpoints[i]->lines.equal_range(Numbers[i]);
-        for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
-          if ((*Runner).second == this) {
-            //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
-            endpoints[i]->lines.erase(Runner);
-            break;
-          }
-      } else { // there's just a single line left
-        if (endpoints[i]->lines.erase(Nr)) {
-          //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
-        }
-      }
-      if (endpoints[i]->lines.empty()) {
-        //Log() << Verbose(0) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;
-        if (endpoints[i] != NULL) {
-          delete (endpoints[i]);
-          endpoints[i] = NULL;
-        }
-      }
-    }
-  }
-  if (!triangles.empty())
-    DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some triangles." << endl);
-}
-;
-
-/** Add triangle to TriangleMap of this boundary line.
- * \param *triangle to add
- */
-void BoundaryLineSet::AddTriangle(BoundaryTriangleSet * const triangle)
-{
-  Info FunctionInfo(__func__);
-  DoLog(0) && (Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl);
-  triangles.insert(TrianglePair(triangle->Nr, triangle));
-}
-;
-
-/** Checks whether we have a common endpoint with given \a *line.
- * \param *line other line to test
- * \return true - common endpoint present, false - not connected
- */
-bool BoundaryLineSet::IsConnectedTo(const BoundaryLineSet * const line) const
-{
-  Info FunctionInfo(__func__);
-  if ((endpoints[0] == line->endpoints[0]) || (endpoints[1] == line->endpoints[0]) || (endpoints[0] == line->endpoints[1]) || (endpoints[1] == line->endpoints[1]))
-    return true;
-  else
-    return false;
-}
-;
-
-/** Checks whether the adjacent triangles of a baseline are convex or not.
- * We sum the two angles of each height vector with respect to the center of the baseline.
- * If greater/equal M_PI than we are convex.
- * \param *out output stream for debugging
- * \return true - triangles are convex, false - concave or less than two triangles connected
- */
-bool BoundaryLineSet::CheckConvexityCriterion() const
-{
-  Info FunctionInfo(__func__);
-  double angle = CalculateConvexity();
-  if (angle > -MYEPSILON) {
-    DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl);
-    return true;
-  } else {
-    DoLog(0) && (Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl);
-    return false;
-  }
-}
-
-
-/** Calculates the angle between two triangles with respect to their normal vector.
- * We sum the two angles of each height vector with respect to the center of the baseline.
- * \return angle > 0 then convex, if < 0 then concave
- */
-double BoundaryLineSet::CalculateConvexity() const
-{
-  Info FunctionInfo(__func__);
-  Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck;
-  // get the two triangles
-  if (triangles.size() != 2) {
-    DoeLog(0) && (eLog() << Verbose(0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl);
-    return true;
-  }
-  // check normal vectors
-  // have a normal vector on the base line pointing outwards
-  //Log() << Verbose(0) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;
-  BaseLineCenter = (1./2.)*((*endpoints[0]->node->node) + (*endpoints[1]->node->node));
-  BaseLine = (*endpoints[0]->node->node) - (*endpoints[1]->node->node);
-
-  //Log() << Verbose(0) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;
-
-  BaseLineNormal.Zero();
-  NormalCheck.Zero();
-  double sign = -1.;
-  int i = 0;
-  class BoundaryPointSet *node = NULL;
-  for (TriangleMap::const_iterator runner = triangles.begin(); runner != triangles.end(); runner++) {
-    //Log() << Verbose(0) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;
-    NormalCheck += runner->second->NormalVector;
-    NormalCheck *= sign;
-    sign = -sign;
-    if (runner->second->NormalVector.NormSquared() > MYEPSILON)
-      BaseLineNormal = runner->second->NormalVector;   // yes, copy second on top of first
-    else {
-      DoeLog(0) && (eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl);
-    }
-    node = runner->second->GetThirdEndpoint(this);
-    if (node != NULL) {
-      //Log() << Verbose(0) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
-      helper[i] = (*node->node->node) - BaseLineCenter;
-      helper[i].MakeNormalTo(BaseLine);  // we want to compare the triangle's heights' angles!
-      //Log() << Verbose(0) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
-      i++;
-    } else {
-      DoeLog(1) && (eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl);
-      return true;
-    }
-  }
-  //Log() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
-  if (NormalCheck.NormSquared() < MYEPSILON) {
-    DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl);
-    return true;
-  }
-  BaseLineNormal.Scale(-1.);
-  double angle = GetAngle(helper[0], helper[1], BaseLineNormal);
-  return (angle - M_PI);
-}
-
-/** Checks whether point is any of the two endpoints this line contains.
- * \param *point point to test
- * \return true - point is of the line, false - is not
- */
-bool BoundaryLineSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
-{
-  Info FunctionInfo(__func__);
-  for (int i = 0; i < 2; i++)
-    if (point == endpoints[i])
-      return true;
-  return false;
-}
-;
-
-/** Returns other endpoint of the line.
- * \param *point other endpoint
- * \return NULL - if endpoint not contained in BoundaryLineSet::lines, or pointer to BoundaryPointSet otherwise
- */
-class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(const BoundaryPointSet * const point) const
-{
-  Info FunctionInfo(__func__);
-  if (endpoints[0] == point)
-    return endpoints[1];
-  else if (endpoints[1] == point)
-    return endpoints[0];
-  else
-    return NULL;
-}
-;
-
-/** Returns other triangle of the line.
- * \param *point other endpoint
- * \return NULL - if triangle not contained in BoundaryLineSet::triangles, or pointer to BoundaryTriangleSet otherwise
- */
-class BoundaryTriangleSet *BoundaryLineSet::GetOtherTriangle(const BoundaryTriangleSet * const triangle) const
-{
-  Info FunctionInfo(__func__);
-  if (triangles.size() == 2) {
-    for (TriangleMap::const_iterator TriangleRunner = triangles.begin(); TriangleRunner != triangles.end(); ++TriangleRunner)
-      if (TriangleRunner->second != triangle)
-        return TriangleRunner->second;
-  }
-  return NULL;
-}
-;
-
-/** output operator for BoundaryLineSet.
- * \param &ost output stream
- * \param &a boundary line
- */
-ostream & operator <<(ostream &ost, const BoundaryLineSet &a)
-{
-  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->getName() << " at " << *a.endpoints[0]->node->node << "," << a.endpoints[1]->node->getName() << " at " << *a.endpoints[1]->node->node << "]";
-  return ost;
-}
-;
-
-// ======================================== Triangles on Boundary =================================
-
-/** Constructor for BoundaryTriangleSet.
- */
-BoundaryTriangleSet::BoundaryTriangleSet() :
-  Nr(-1)
-{
-  Info FunctionInfo(__func__);
-  for (int i = 0; i < 3; i++) {
-    endpoints[i] = NULL;
-    lines[i] = NULL;
-  }
-}
-;
-
-/** Constructor for BoundaryTriangleSet with three lines.
- * \param *line[3] lines that make up the triangle
- * \param number number of triangle
- */
-BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet * const line[3], const int number) :
-  Nr(number)
-{
-  Info FunctionInfo(__func__);
-  // set number
-  // set lines
-  for (int i = 0; i < 3; i++) {
-    lines[i] = line[i];
-    lines[i]->AddTriangle(this);
-  }
-  // get ascending order of endpoints
-  PointMap OrderMap;
-  for (int i = 0; i < 3; i++) {
-    // for all three lines
-    for (int j = 0; j < 2; j++) { // for both endpoints
-      OrderMap.insert(pair<int, class BoundaryPointSet *> (line[i]->endpoints[j]->Nr, line[i]->endpoints[j]));
-      // and we don't care whether insertion fails
-    }
-  }
-  // set endpoints
-  int Counter = 0;
-  DoLog(0) && (Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl);
-  for (PointMap::iterator runner = OrderMap.begin(); runner != OrderMap.end(); runner++) {
-    endpoints[Counter] = runner->second;
-    DoLog(0) && (Log() << Verbose(0) << " " << *endpoints[Counter] << endl);
-    Counter++;
-  }
-  ASSERT(Counter >= 3,"We have a triangle with only two distinct endpoints!");
-};
-
-
-/** Destructor of BoundaryTriangleSet.
- * Removes itself from each of its lines' LineMap and removes them if necessary.
- * \note When removing triangles from a class Tesselation, use RemoveTesselationTriangle()
- */
-BoundaryTriangleSet::~BoundaryTriangleSet()
-{
-  Info FunctionInfo(__func__);
-  for (int i = 0; i < 3; i++) {
-    if (lines[i] != NULL) {
-      if (lines[i]->triangles.erase(Nr)) {
-        //Log() << Verbose(0) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;
-      }
-      if (lines[i]->triangles.empty()) {
-        //Log() << Verbose(0) << *lines[i] << " is no more attached to any triangle, erasing." << endl;
-        delete (lines[i]);
-        lines[i] = NULL;
-      }
-    }
-  }
-  //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl;
-}
-;
-
-/** Calculates the normal vector for this triangle.
- * Is made unique by comparison with \a OtherVector to point in the other direction.
- * \param &OtherVector direction vector to make normal vector unique.
- */
-void BoundaryTriangleSet::GetNormalVector(const Vector &OtherVector)
-{
-  Info FunctionInfo(__func__);
-  // get normal vector
-  NormalVector = Plane(*(endpoints[0]->node->node),
-                       *(endpoints[1]->node->node),
-                       *(endpoints[2]->node->node)).getNormal();
-
-  // make it always point inward (any offset vector onto plane projected onto normal vector suffices)
-  if (NormalVector.ScalarProduct(OtherVector) > 0.)
-    NormalVector.Scale(-1.);
-  DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl);
-}
-;
-
-/** Finds the point on the triangle \a *BTS through which the line defined by \a *MolCenter and \a *x crosses.
- * We call Vector::GetIntersectionWithPlane() to receive the intersection point with the plane
- * Thus we test if it's really on the plane and whether it's inside the triangle on the plane or not.
- * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line
- * given by the intersection and the third basepoint. Then, we check whether it's on the baseline (i.e. between
- * the first two basepoints) or not.
- * \param *out output stream for debugging
- * \param *MolCenter offset vector of line
- * \param *x second endpoint of line, minus \a *MolCenter is directional vector of line
- * \param *Intersection intersection on plane on return
- * \return true - \a *Intersection contains intersection on plane defined by triangle, false - zero vector if outside of triangle.
- */
-
-bool BoundaryTriangleSet::GetIntersectionInsideTriangle(const Vector * const MolCenter, const Vector * const x, Vector * const Intersection) const
-{
-  Info FunctionInfo(__func__);
-  Vector CrossPoint;
-  Vector helper;
-
-  try {
-    Line centerLine = makeLineThrough(*MolCenter, *x);
-    *Intersection = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(centerLine);
-
-    DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);
-    DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl);
-    DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl);
-
-    if (Intersection->DistanceSquared(*endpoints[0]->node->node) < MYEPSILON) {
-      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);
-      return true;
-    }   else if (Intersection->DistanceSquared(*endpoints[1]->node->node) < MYEPSILON) {
-      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);
-      return true;
-    }   else if (Intersection->DistanceSquared(*endpoints[2]->node->node) < MYEPSILON) {
-      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);
-      return true;
-    }
-    // Calculate cross point between one baseline and the line from the third endpoint to intersection
-    int i = 0;
-    do {
-      Line line1 = makeLineThrough(*(endpoints[i%3]->node->node),*(endpoints[(i+1)%3]->node->node));
-      Line line2 = makeLineThrough(*(endpoints[(i+2)%3]->node->node),*Intersection);
-      CrossPoint = line1.getIntersection(line2);
-      helper = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node);
-      CrossPoint -= (*endpoints[i%3]->node->node);  // cross point was returned as absolute vector
-      const double s = CrossPoint.ScalarProduct(helper)/helper.NormSquared();
-      DoLog(1) && (Log() << Verbose(1) << "INFO: Factor s is " << s << "." << endl);
-      if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) {
-        DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl);
-        return false;
-      }
-      i++;
-    } while (i < 3);
-    DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl);
-    return true;
-  }
-  catch (MathException &excp) {
-    Log() << Verbose(1) << excp;
-    DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);
-    return false;
-  }
-}
-;
-
-/** Finds the point on the triangle to the point \a *x.
- * We call Vector::GetIntersectionWithPlane() with \a * and the center of the triangle to receive an intersection point.
- * Then we check the in-plane part (the part projected down onto plane). We check whether it crosses one of the
- * boundary lines. If it does, we return this intersection as closest point, otherwise the projected point down.
- * Thus we test if it's really on the plane and whether it's inside the triangle on the plane or not.
- * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line
- * given by the intersection and the third basepoint. Then, we check whether it's on the baseline (i.e. between
- * the first two basepoints) or not.
- * \param *x point
- * \param *ClosestPoint desired closest point inside triangle to \a *x, is absolute vector
- * \return Distance squared between \a *x and closest point inside triangle
- */
-double BoundaryTriangleSet::GetClosestPointInsideTriangle(const Vector * const x, Vector * const ClosestPoint) const
-{
-  Info FunctionInfo(__func__);
-  Vector Direction;
-
-  // 1. get intersection with plane
-  DoLog(1) && (Log() << Verbose(1) << "INFO: Looking for closest point of triangle " << *this << " to " << *x << "." << endl);
-  GetCenter(&Direction);
-  try {
-    Line l = makeLineThrough(*x, Direction);
-    *ClosestPoint = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(l);
-  }
-  catch (MathException &excp) {
-    (*ClosestPoint) = (*x);
-  }
-
-  // 2. Calculate in plane part of line (x, intersection)
-  Vector InPlane = (*x) - (*ClosestPoint); // points from plane intersection to straight-down point
-  InPlane.ProjectOntoPlane(NormalVector);
-  InPlane += *ClosestPoint;
-
-  DoLog(2) && (Log() << Verbose(2) << "INFO: Triangle is " << *this << "." << endl);
-  DoLog(2) && (Log() << Verbose(2) << "INFO: Line is from " << Direction << " to " << *x << "." << endl);
-  DoLog(2) && (Log() << Verbose(2) << "INFO: In-plane part is " << InPlane << "." << endl);
-
-  // Calculate cross point between one baseline and the desired point such that distance is shortest
-  double ShortestDistance = -1.;
-  bool InsideFlag = false;
-  Vector CrossDirection[3];
-  Vector CrossPoint[3];
-  Vector helper;
-  for (int i = 0; i < 3; i++) {
-    // treat direction of line as normal of a (cut)plane and the desired point x as the plane offset, the intersect line with point
-    Direction = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node);
-    // calculate intersection, line can never be parallel to Direction (is the same vector as PlaneNormal);
-    Line l = makeLineThrough(*(endpoints[i%3]->node->node), *(endpoints[(i+1)%3]->node->node));
-    CrossPoint[i] = Plane(Direction, InPlane).GetIntersection(l);
-    CrossDirection[i] = CrossPoint[i] - InPlane;
-    CrossPoint[i] -= (*endpoints[i%3]->node->node);  // cross point was returned as absolute vector
-    const double s = CrossPoint[i].ScalarProduct(Direction)/Direction.NormSquared();
-    DoLog(2) && (Log() << Verbose(2) << "INFO: Factor s is " << s << "." << endl);
-    if ((s >= -MYEPSILON) && ((s-1.) <= MYEPSILON)) {
-          CrossPoint[i] += (*endpoints[i%3]->node->node);  // make cross point absolute again
-      DoLog(2) && (Log() << Verbose(2) << "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between " << *endpoints[i % 3]->node->node << " and " << *endpoints[(i + 1) % 3]->node->node << "." << endl);
-      const double distance = CrossPoint[i].DistanceSquared(*x);
-      if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
-        ShortestDistance = distance;
-        (*ClosestPoint) = CrossPoint[i];
-      }
-    } else
-      CrossPoint[i].Zero();
-  }
-  InsideFlag = true;
-  for (int i = 0; i < 3; i++) {
-    const double sign = CrossDirection[i].ScalarProduct(CrossDirection[(i + 1) % 3]);
-    const double othersign = CrossDirection[i].ScalarProduct(CrossDirection[(i + 2) % 3]);
-
-    if ((sign > -MYEPSILON) && (othersign > -MYEPSILON)) // have different sign
-      InsideFlag = false;
-  }
-  if (InsideFlag) {
-    (*ClosestPoint) = InPlane;
-    ShortestDistance = InPlane.DistanceSquared(*x);
-  } else { // also check endnodes
-    for (int i = 0; i < 3; i++) {
-      const double distance = x->DistanceSquared(*endpoints[i]->node->node);
-      if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
-        ShortestDistance = distance;
-        (*ClosestPoint) = (*endpoints[i]->node->node);
-      }
-    }
-  }
-  DoLog(1) && (Log() << Verbose(1) << "INFO: Closest Point is " << *ClosestPoint << " with shortest squared distance is " << ShortestDistance << "." << endl);
-  return ShortestDistance;
-}
-;
-
-/** Checks whether lines is any of the three boundary lines this triangle contains.
- * \param *line line to test
- * \return true - line is of the triangle, false - is not
- */
-bool BoundaryTriangleSet::ContainsBoundaryLine(const BoundaryLineSet * const line) const
-{
-  Info FunctionInfo(__func__);
-  for (int i = 0; i < 3; i++)
-    if (line == lines[i])
-      return true;
-  return false;
-}
-;
-
-/** Checks whether point is any of the three endpoints this triangle contains.
- * \param *point point to test
- * \return true - point is of the triangle, false - is not
- */
-bool BoundaryTriangleSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
-{
-  Info FunctionInfo(__func__);
-  for (int i = 0; i < 3; i++)
-    if (point == endpoints[i])
-      return true;
-  return false;
-}
-;
-
-/** Checks whether point is any of the three endpoints this triangle contains.
- * \param *point TesselPoint to test
- * \return true - point is of the triangle, false - is not
- */
-bool BoundaryTriangleSet::ContainsBoundaryPoint(const TesselPoint * const point) const
-{
-  Info FunctionInfo(__func__);
-  for (int i = 0; i < 3; i++)
-    if (point == endpoints[i]->node)
-      return true;
-  return false;
-}
-;
-
-/** Checks whether three given \a *Points coincide with triangle's endpoints.
- * \param *Points[3] pointer to BoundaryPointSet
- * \return true - is the very triangle, false - is not
- */
-bool BoundaryTriangleSet::IsPresentTupel(const BoundaryPointSet * const Points[3]) const
-{
-  Info FunctionInfo(__func__);
-  DoLog(1) && (Log() << Verbose(1) << "INFO: Checking " << Points[0] << "," << Points[1] << "," << Points[2] << " against " << endpoints[0] << "," << endpoints[1] << "," << endpoints[2] << "." << endl);
-  return (((endpoints[0] == Points[0]) || (endpoints[0] == Points[1]) || (endpoints[0] == Points[2])) && ((endpoints[1] == Points[0]) || (endpoints[1] == Points[1]) || (endpoints[1] == Points[2])) && ((endpoints[2] == Points[0]) || (endpoints[2] == Points[1]) || (endpoints[2] == Points[2])
-
-  ));
-}
-;
-
-/** Checks whether three given \a *Points coincide with triangle's endpoints.
- * \param *Points[3] pointer to BoundaryPointSet
- * \return true - is the very triangle, false - is not
- */
-bool BoundaryTriangleSet::IsPresentTupel(const BoundaryTriangleSet * const T) const
-{
-  Info FunctionInfo(__func__);
-  return (((endpoints[0] == T->endpoints[0]) || (endpoints[0] == T->endpoints[1]) || (endpoints[0] == T->endpoints[2])) && ((endpoints[1] == T->endpoints[0]) || (endpoints[1] == T->endpoints[1]) || (endpoints[1] == T->endpoints[2])) && ((endpoints[2] == T->endpoints[0]) || (endpoints[2] == T->endpoints[1]) || (endpoints[2] == T->endpoints[2])
-
-  ));
-}
-;
-
-/** Returns the endpoint which is not contained in the given \a *line.
- * \param *line baseline defining two endpoints
- * \return pointer third endpoint or NULL if line does not belong to triangle.
- */
-class BoundaryPointSet *BoundaryTriangleSet::GetThirdEndpoint(const BoundaryLineSet * const line) const
-{
-  Info FunctionInfo(__func__);
-  // sanity check
-  if (!ContainsBoundaryLine(line))
-    return NULL;
-  for (int i = 0; i < 3; i++)
-    if (!line->ContainsBoundaryPoint(endpoints[i]))
-      return endpoints[i];
-  // actually, that' impossible :)
-  return NULL;
-}
-;
-
-/** Returns the baseline which does not contain the given boundary point \a *point.
- * \param *point endpoint which is neither endpoint of the desired line
- * \return pointer to desired third baseline
- */
-class BoundaryLineSet *BoundaryTriangleSet::GetThirdLine(const BoundaryPointSet * const point) const
-{
-  Info FunctionInfo(__func__);
-  // sanity check
-  if (!ContainsBoundaryPoint(point))
-    return NULL;
-  for (int i = 0; i < 3; i++)
-    if (!lines[i]->ContainsBoundaryPoint(point))
-      return lines[i];
-  // actually, that' impossible :)
-  return NULL;
-}
-;
-
-/** Calculates the center point of the triangle.
- * Is third of the sum of all endpoints.
- * \param *center central point on return.
- */
-void BoundaryTriangleSet::GetCenter(Vector * const center) const
-{
-  Info FunctionInfo(__func__);
-  center->Zero();
-  for (int i = 0; i < 3; i++)
-    (*center) += (*endpoints[i]->node->node);
-  center->Scale(1. / 3.);
-  DoLog(1) && (Log() << Verbose(1) << "INFO: Center is at " << *center << "." << endl);
-}
-
-/**
- * gets the Plane defined by the three triangle Basepoints
- */
-Plane BoundaryTriangleSet::getPlane() const{
-  ASSERT(endpoints[0] && endpoints[1] && endpoints[2], "Triangle not fully defined");
-
-  return Plane(*endpoints[0]->node->node,
-               *endpoints[1]->node->node,
-               *endpoints[2]->node->node);
-}
-
-Vector BoundaryTriangleSet::getEndpoint(int i) const{
-  ASSERT(i>=0 && i<3,"Index of Endpoint out of Range");
-
-  return *endpoints[i]->node->node;
-}
-
-string BoundaryTriangleSet::getEndpointName(int i) const{
-  ASSERT(i>=0 && i<3,"Index of Endpoint out of Range");
-
-  return endpoints[i]->node->getName();
-}
-
-/** output operator for BoundaryTriangleSet.
- * \param &ost output stream
- * \param &a boundary triangle
- */
-ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a)
-{
-  ost << "[" << a.Nr << "|" << a.getEndpointName(0) << "," << a.getEndpointName(1) << "," << a.getEndpointName(2) << "]";
-  //  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << ","
-  //      << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]";
-  return ost;
-}
-;
-
-// ======================================== Polygons on Boundary =================================
-
-/** Constructor for BoundaryPolygonSet.
- */
-BoundaryPolygonSet::BoundaryPolygonSet() :
-  Nr(-1)
-{
-  Info FunctionInfo(__func__);
-}
-;
-
-/** Destructor of BoundaryPolygonSet.
- * Just clears endpoints.
- * \note When removing triangles from a class Tesselation, use RemoveTesselationTriangle()
- */
-BoundaryPolygonSet::~BoundaryPolygonSet()
-{
-  Info FunctionInfo(__func__);
-  endpoints.clear();
-  DoLog(1) && (Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl);
-}
-;
-
-/** Calculates the normal vector for this triangle.
- * Is made unique by comparison with \a OtherVector to point in the other direction.
- * \param &OtherVector direction vector to make normal vector unique.
- * \return allocated vector in normal direction
- */
-Vector * BoundaryPolygonSet::GetNormalVector(const Vector &OtherVector) const
-{
-  Info FunctionInfo(__func__);
-  // get normal vector
-  Vector TemporaryNormal;
-  Vector *TotalNormal = new Vector;
-  PointSet::const_iterator Runner[3];
-  for (int i = 0; i < 3; i++) {
-    Runner[i] = endpoints.begin();
-    for (int j = 0; j < i; j++) { // go as much further
-      Runner[i]++;
-      if (Runner[i] == endpoints.end()) {
-        DoeLog(0) && (eLog() << Verbose(0) << "There are less than three endpoints in the polygon!" << endl);
-        performCriticalExit();
-      }
-    }
-  }
-  TotalNormal->Zero();
-  int counter = 0;
-  for (; Runner[2] != endpoints.end();) {
-    TemporaryNormal = Plane(*((*Runner[0])->node->node),
-                            *((*Runner[1])->node->node),
-                            *((*Runner[2])->node->node)).getNormal();
-    for (int i = 0; i < 3; i++) // increase each of them
-      Runner[i]++;
-    (*TotalNormal) += TemporaryNormal;
-  }
-  TotalNormal->Scale(1. / (double) counter);
-
-  // make it always point inward (any offset vector onto plane projected onto normal vector suffices)
-  if (TotalNormal->ScalarProduct(OtherVector) > 0.)
-    TotalNormal->Scale(-1.);
-  DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl);
-
-  return TotalNormal;
-}
-;
-
-/** Calculates the center point of the triangle.
- * Is third of the sum of all endpoints.
- * \param *center central point on return.
- */
-void BoundaryPolygonSet::GetCenter(Vector * const center) const
-{
-  Info FunctionInfo(__func__);
-  center->Zero();
-  int counter = 0;
-  for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
-    (*center) += (*(*Runner)->node->node);
-    counter++;
-  }
-  center->Scale(1. / (double) counter);
-  DoLog(1) && (Log() << Verbose(1) << "Center is at " << *center << "." << endl);
-}
-
-/** Checks whether the polygons contains all three endpoints of the triangle.
- * \param *triangle triangle to test
- * \return true - triangle is contained polygon, false - is not
- */
-bool BoundaryPolygonSet::ContainsBoundaryTriangle(const BoundaryTriangleSet * const triangle) const
-{
-  Info FunctionInfo(__func__);
-  return ContainsPresentTupel(triangle->endpoints, 3);
-}
-;
-
-/** Checks whether the polygons contains both endpoints of the line.
- * \param *line line to test
- * \return true - line is of the triangle, false - is not
- */
-bool BoundaryPolygonSet::ContainsBoundaryLine(const BoundaryLineSet * const line) const
-{
-  Info FunctionInfo(__func__);
-  return ContainsPresentTupel(line->endpoints, 2);
-}
-;
-
-/** Checks whether point is any of the three endpoints this triangle contains.
- * \param *point point to test
- * \return true - point is of the triangle, false - is not
- */
-bool BoundaryPolygonSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
-{
-  Info FunctionInfo(__func__);
-  for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
-    DoLog(0) && (Log() << Verbose(0) << "Checking against " << **Runner << endl);
-    if (point == (*Runner)) {
-      DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);
-      return true;
-    }
-  }
-  DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);
-  return false;
-}
-;
-
-/** Checks whether point is any of the three endpoints this triangle contains.
- * \param *point TesselPoint to test
- * \return true - point is of the triangle, false - is not
- */
-bool BoundaryPolygonSet::ContainsBoundaryPoint(const TesselPoint * const point) const
-{
-  Info FunctionInfo(__func__);
-  for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)
-    if (point == (*Runner)->node) {
-      DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);
-      return true;
-    }
-  DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);
-  return false;
-}
-;
-
-/** Checks whether given array of \a *Points coincide with polygons's endpoints.
- * \param **Points pointer to an array of BoundaryPointSet
- * \param dim dimension of array
- * \return true - set of points is contained in polygon, false - is not
- */
-bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const
-{
-  Info FunctionInfo(__func__);
-  int counter = 0;
-  DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);
-  for (int i = 0; i < dim; i++) {
-    DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl);
-    if (ContainsBoundaryPoint(Points[i])) {
-      counter++;
-    }
-  }
-
-  if (counter == dim)
-    return true;
-  else
-    return false;
-}
-;
-
-/** Checks whether given PointList coincide with polygons's endpoints.
- * \param &endpoints PointList
- * \return true - set of points is contained in polygon, false - is not
- */
-bool BoundaryPolygonSet::ContainsPresentTupel(const PointSet &endpoints) const
-{
-  Info FunctionInfo(__func__);
-  size_t counter = 0;
-  DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);
-  for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
-    DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << **Runner << endl);
-    if (ContainsBoundaryPoint(*Runner))
-      counter++;
-  }
-
-  if (counter == endpoints.size())
-    return true;
-  else
-    return false;
-}
-;
-
-/** Checks whether given set of \a *Points coincide with polygons's endpoints.
- * \param *P pointer to BoundaryPolygonSet
- * \return true - is the very triangle, false - is not
- */
-bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPolygonSet * const P) const
-{
-  return ContainsPresentTupel((const PointSet) P->endpoints);
-}
-;
-
-/** Gathers all the endpoints' triangles in a unique set.
- * \return set of all triangles
- */
-TriangleSet * BoundaryPolygonSet::GetAllContainedTrianglesFromEndpoints() const
-{
-  Info FunctionInfo(__func__);
-  pair<TriangleSet::iterator, bool> Tester;
-  TriangleSet *triangles = new TriangleSet;
-
-  for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)
-    for (LineMap::const_iterator Walker = (*Runner)->lines.begin(); Walker != (*Runner)->lines.end(); Walker++)
-      for (TriangleMap::const_iterator Sprinter = (Walker->second)->triangles.begin(); Sprinter != (Walker->second)->triangles.end(); Sprinter++) {
-        //Log() << Verbose(0) << " Testing triangle " << *(Sprinter->second) << endl;
-        if (ContainsBoundaryTriangle(Sprinter->second)) {
-          Tester = triangles->insert(Sprinter->second);
-          if (Tester.second)
-            DoLog(0) && (Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl);
-        }
-      }
-
-  DoLog(1) && (Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl);
-  return triangles;
-}
-;
-
-/** Fills the endpoints of this polygon from the triangles attached to \a *line.
- * \param *line lines with triangles attached
- * \return true - polygon contains endpoints, false - line was NULL
- */
-bool BoundaryPolygonSet::FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line)
-{
-  Info FunctionInfo(__func__);
-  pair<PointSet::iterator, bool> Tester;
-  if (line == NULL)
-    return false;
-  DoLog(1) && (Log() << Verbose(1) << "Filling polygon from line " << *line << endl);
-  for (TriangleMap::const_iterator Runner = line->triangles.begin(); Runner != line->triangles.end(); Runner++) {
-    for (int i = 0; i < 3; i++) {
-      Tester = endpoints.insert((Runner->second)->endpoints[i]);
-      if (Tester.second)
-        DoLog(1) && (Log() << Verbose(1) << "  Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl);
-    }
-  }
-
-  return true;
-}
-;
-
-/** output operator for BoundaryPolygonSet.
- * \param &ost output stream
- * \param &a boundary polygon
- */
-ostream &operator <<(ostream &ost, const BoundaryPolygonSet &a)
-{
-  ost << "[" << a.Nr << "|";
-  for (PointSet::const_iterator Runner = a.endpoints.begin(); Runner != a.endpoints.end();) {
-    ost << (*Runner)->node->getName();
-    Runner++;
-    if (Runner != a.endpoints.end())
-      ost << ",";
-  }
-  ost << "]";
-  return ost;
-}
-;
-
-// =========================================================== class TESSELPOINT ===========================================
-
-/** Constructor of class TesselPoint.
- */
-TesselPoint::TesselPoint()
-{
-  //Info FunctionInfo(__func__);
-  node = NULL;
-  nr = -1;
-}
-;
-
-/** Destructor for class TesselPoint.
- */
-TesselPoint::~TesselPoint()
-{
-  //Info FunctionInfo(__func__);
-}
-;
-
-/** Prints LCNode to screen.
- */
-ostream & operator <<(ostream &ost, const TesselPoint &a)
-{
-  ost << "[" << a.getName() << "|" << *a.node << "]";
-  return ost;
-}
-;
-
-/** Prints LCNode to screen.
- */
-ostream & TesselPoint::operator <<(ostream &ost)
-{
-  Info FunctionInfo(__func__);
-  ost << "[" << (nr) << "|" << this << "]";
-  return ost;
-}
-;
-
-// =========================================================== class POINTCLOUD ============================================
-
-/** Constructor of class PointCloud.
- */
-PointCloud::PointCloud()
-{
-  //Info FunctionInfo(__func__);
-}
-;
-
-/** Destructor for class PointCloud.
- */
-PointCloud::~PointCloud()
-{
-  //Info FunctionInfo(__func__);
-}
-;
-
-// ============================ CandidateForTesselation =============================
-
-/** Constructor of class CandidateForTesselation.
- */
-CandidateForTesselation::CandidateForTesselation(BoundaryLineSet* line) :
-  BaseLine(line), ThirdPoint(NULL), T(NULL), ShortestAngle(2. * M_PI), OtherShortestAngle(2. * M_PI)
-{
-  Info FunctionInfo(__func__);
-}
-;
-
-/** Constructor of class CandidateForTesselation.
- */
-CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, BoundaryPointSet* point, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) :
-  BaseLine(line), ThirdPoint(point), T(NULL), ShortestAngle(2. * M_PI), OtherShortestAngle(2. * M_PI)
-{
-	Info FunctionInfo(__func__);
-  OptCenter = OptCandidateCenter;
-  OtherOptCenter = OtherOptCandidateCenter;
-};
-
-
-/** Destructor for class CandidateForTesselation.
- */
-CandidateForTesselation::~CandidateForTesselation()
-{
-}
-;
-
-/** Checks validity of a given sphere of a candidate line.
- * Sphere must touch all candidates and the baseline endpoints and there must be no other atoms inside.
- * \param RADIUS radius of sphere
- * \param *LC LinkedCell structure with other atoms
- * \return true - sphere is valid, false - sphere contains other points
- */
-bool CandidateForTesselation::CheckValidity(const double RADIUS, const LinkedCell *LC) const
-{
-  Info FunctionInfo(__func__);
-
-  const double radiusSquared = RADIUS * RADIUS;
-  list<const Vector *> VectorList;
-  VectorList.push_back(&OptCenter);
-  //VectorList.push_back(&OtherOptCenter);  // don't check the other (wrong) center
-
-  if (!pointlist.empty())
-    DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains candidate list and baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl);
-  else
-    DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere with no candidates contains baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl);
-  // check baseline for OptCenter and OtherOptCenter being on sphere's surface
-  for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
-    for (int i = 0; i < 2; i++) {
-      const double distance = fabs((*VRunner)->DistanceSquared(*BaseLine->endpoints[i]->node->node) - radiusSquared);
-      if (distance > HULLEPSILON) {
-        DoeLog(1) && (eLog() << Verbose(1) << "Endpoint " << *BaseLine->endpoints[i] << " is out of sphere at " << *(*VRunner) << " by " << distance << "." << endl);
-        return false;
-      }
-    }
-  }
-
-  // check Candidates for OptCenter and OtherOptCenter being on sphere's surface
-  for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) {
-    const TesselPoint *Walker = *Runner;
-    for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
-      const double distance = fabs((*VRunner)->DistanceSquared(*Walker->node) - radiusSquared);
-      if (distance > HULLEPSILON) {
-        DoeLog(1) && (eLog() << Verbose(1) << "Candidate " << *Walker << " is out of sphere at " << *(*VRunner) << " by " << distance << "." << endl);
-        return false;
-      } else {
-        DoLog(1) && (Log() << Verbose(1) << "Candidate " << *Walker << " is inside by " << distance << "." << endl);
-      }
-    }
-  }
-
-  DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains no others points ..." << endl);
-  bool flag = true;
-  for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
-    // get all points inside the sphere
-    TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, (*VRunner));
-
-    DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << (*VRunner) << ":" << endl);
-    for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
-      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(*(*VRunner)) << "." << endl);
-
-    // remove baseline's endpoints and candidates
-    for (int i = 0; i < 2; i++) {
-      DoLog(1) && (Log() << Verbose(1) << "INFO: removing baseline tesselpoint " << *BaseLine->endpoints[i]->node << "." << endl);
-      ListofPoints->remove(BaseLine->endpoints[i]->node);
-    }
-    for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) {
-      DoLog(1) && (Log() << Verbose(1) << "INFO: removing candidate tesselpoint " << *(*Runner) << "." << endl);
-      ListofPoints->remove(*Runner);
-    }
-    if (!ListofPoints->empty()) {
-      DoeLog(1) && (eLog() << Verbose(1) << "CheckValidity: There are still " << ListofPoints->size() << " points inside the sphere." << endl);
-      flag = false;
-      DoeLog(1) && (eLog() << Verbose(1) << "External atoms inside of sphere at " << *(*VRunner) << ":" << endl);
-      for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
-        DoeLog(1) && (eLog() << Verbose(1) << "  " << *(*Runner) << " at distance " << setprecision(13) << (*Runner)->node->distance(*(*VRunner)) << setprecision(6) << "." << endl);
-
-      // check with animate_sphere.tcl VMD script
-      if (ThirdPoint != NULL) {
-        DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);
-      } else {
-        DoeLog(1) && (eLog() << Verbose(1) << "Check by: ... missing third point ..." << endl);
-        DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);
-      }
-    }
-    delete (ListofPoints);
-
-  }
-  return flag;
-}
-;
-
-/** output operator for CandidateForTesselation.
- * \param &ost output stream
- * \param &a boundary line
- */
-ostream & operator <<(ostream &ost, const CandidateForTesselation &a)
-{
-  ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->getName() << "," << a.BaseLine->endpoints[1]->node->getName() << "] with ";
-  if (a.pointlist.empty())
-    ost << "no candidate.";
-  else {
-    ost << "candidate";
-    if (a.pointlist.size() != 1)
-      ost << "s ";
-    else
-      ost << " ";
-    for (TesselPointList::const_iterator Runner = a.pointlist.begin(); Runner != a.pointlist.end(); Runner++)
-      ost << *(*Runner) << " ";
-    ost << " at angle " << (a.ShortestAngle) << ".";
-  }
-
-  return ost;
-}
-;
-
-// =========================================================== class TESSELATION ===========================================
+const char *TecplotSuffix=".dat";
+const char *Raster3DSuffix=".r3d";
+const char *VRMLSUffix=".wrl";
+
+const double ParallelEpsilon=1e-3;
+const double Tesselation::HULLEPSILON = 1e-9;
 
 /** Constructor of class Tesselation.
  */
 Tesselation::Tesselation() :
-  PointsOnBoundaryCount(0), LinesOnBoundaryCount(0), TrianglesOnBoundaryCount(0), LastTriangle(NULL), TriangleFilesWritten(0), InternalPointer(PointsOnBoundary.begin())
+  PointsOnBoundaryCount(0),
+  LinesOnBoundaryCount(0),
+  TrianglesOnBoundaryCount(0),
+  LastTriangle(NULL),
+  TriangleFilesWritten(0),
+  InternalPointer(PointsOnBoundary.begin())
 {
   Info FunctionInfo(__func__);
@@ -1245,4 +86,14 @@
 ;
 
+TesselPoint * Tesselation::getValue(const_iterator &rhs) const
+{
+  return (*rhs).second->node;
+}
+
+TesselPoint * Tesselation::getValue(iterator &rhs) const
+{
+  return (*rhs).second->node;
+}
+
 /** PointCloud implementation of GetCenter
  * Uses PointsOnBoundary and STL stuff.
@@ -1254,5 +105,5 @@
   int num = 0;
   for (GoToFirst(); (!IsEnd()); GoToNext()) {
-    (*Center) += (*GetPoint()->node);
+    (*Center) += (GetPoint()->getPosition());
     num++;
   }
@@ -1337,9 +188,9 @@
       C++;
       for (; C != PointsOnBoundary.end(); C++) {
-        tmp = A->second->node->node->DistanceSquared(*B->second->node->node);
+        tmp = A->second->node->DistanceSquared(B->second->node->getPosition());
         distance = tmp * tmp;
-        tmp = A->second->node->node->DistanceSquared(*C->second->node->node);
+        tmp = A->second->node->DistanceSquared(C->second->node->getPosition());
         distance += tmp * tmp;
-        tmp = B->second->node->node->DistanceSquared(*C->second->node->node);
+        tmp = B->second->node->DistanceSquared(C->second->node->getPosition());
         distance += tmp * tmp;
         DistanceMMap.insert(DistanceMultiMapPair(distance, pair<PointMap::iterator, PointMap::iterator> (B, C)));
@@ -1360,7 +211,7 @@
     // 2. next, we have to check whether all points reside on only one side of the triangle
     // 3. construct plane vector
-    PlaneVector = Plane(*A->second->node->node,
-                        *baseline->second.first->second->node->node,
-                        *baseline->second.second->second->node->node).getNormal();
+    PlaneVector = Plane(A->second->node->getPosition(),
+                        baseline->second.first->second->node->getPosition(),
+                        baseline->second.second->second->node->getPosition()).getNormal();
     DoLog(2) && (Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl);
     // 4. loop over all points
@@ -1372,6 +223,5 @@
         continue;
       // 4a. project onto plane vector
-      TrialVector = (*checker->second->node->node);
-      TrialVector.SubtractVector(*A->second->node->node);
+      TrialVector = (checker->second->node->getPosition() - A->second->node->getPosition());
       distance = TrialVector.ScalarProduct(PlaneVector);
       if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok
@@ -1389,13 +239,13 @@
       }
       // 4d. Check whether the point is inside the triangle (check distance to each node
-      tmp = checker->second->node->node->DistanceSquared(*A->second->node->node);
+      tmp = checker->second->node->DistanceSquared(A->second->node->getPosition());
       int innerpoint = 0;
-      if ((tmp < A->second->node->node->DistanceSquared(*baseline->second.first->second->node->node)) && (tmp < A->second->node->node->DistanceSquared(*baseline->second.second->second->node->node)))
+      if ((tmp < A->second->node->DistanceSquared(baseline->second.first->second->node->getPosition())) && (tmp < A->second->node->DistanceSquared(baseline->second.second->second->node->getPosition())))
         innerpoint++;
-      tmp = checker->second->node->node->DistanceSquared(*baseline->second.first->second->node->node);
-      if ((tmp < baseline->second.first->second->node->node->DistanceSquared(*A->second->node->node)) && (tmp < baseline->second.first->second->node->node->DistanceSquared(*baseline->second.second->second->node->node)))
+      tmp = checker->second->node->DistanceSquared(baseline->second.first->second->node->getPosition());
+      if ((tmp < baseline->second.first->second->node->DistanceSquared(A->second->node->getPosition())) && (tmp < baseline->second.first->second->node->DistanceSquared(baseline->second.second->second->node->getPosition())))
         innerpoint++;
-      tmp = checker->second->node->node->DistanceSquared(*baseline->second.second->second->node->node);
-      if ((tmp < baseline->second.second->second->node->node->DistanceSquared(*baseline->second.first->second->node->node)) && (tmp < baseline->second.second->second->node->node->DistanceSquared(*A->second->node->node)))
+      tmp = checker->second->node->DistanceSquared(baseline->second.second->second->node->getPosition());
+      if ((tmp < baseline->second.second->second->node->DistanceSquared(baseline->second.first->second->node->getPosition())) && (tmp < baseline->second.second->second->node->DistanceSquared(A->second->node->getPosition())))
         innerpoint++;
       // 4e. If so, break 4. loop and continue with next candidate in 1. loop
@@ -1478,7 +328,7 @@
         // prepare some auxiliary vectors
         Vector BaseLineCenter, BaseLine;
-        BaseLineCenter = 0.5 * ((*baseline->second->endpoints[0]->node->node) +
-                                (*baseline->second->endpoints[1]->node->node));
-        BaseLine = (*baseline->second->endpoints[0]->node->node) - (*baseline->second->endpoints[1]->node->node);
+        BaseLineCenter = 0.5 * ((baseline->second->endpoints[0]->node->getPosition()) +
+                                (baseline->second->endpoints[1]->node->getPosition()));
+        BaseLine = (baseline->second->endpoints[0]->node->getPosition()) - (baseline->second->endpoints[1]->node->getPosition());
 
         // offset to center of triangle
@@ -1498,5 +348,5 @@
         // project center vector onto triangle plane (points from intersection plane-NormalVector to plane-CenterVector intersection)
         PropagationVector = Plane(BaseLine, NormalVector,0).getNormal();
-        TempVector = CenterVector - (*baseline->second->endpoints[0]->node->node); // TempVector is vector on triangle plane pointing from one baseline egde towards center!
+        TempVector = CenterVector - (baseline->second->endpoints[0]->node->getPosition()); // TempVector is vector on triangle plane pointing from one baseline egde towards center!
         //Log() << Verbose(0) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;
         if (PropagationVector.ScalarProduct(TempVector) > 0) // make sure normal propagation vector points outward from baseline
@@ -1511,5 +361,5 @@
 
             // first check direction, so that triangles don't intersect
-            VirtualNormalVector = (*target->second->node->node) - BaseLineCenter;
+            VirtualNormalVector = (target->second->node->getPosition()) - BaseLineCenter;
             VirtualNormalVector.ProjectOntoPlane(NormalVector);
             TempAngle = VirtualNormalVector.Angle(PropagationVector);
@@ -1540,6 +390,6 @@
 
             // check for linear dependence
-            TempVector = (*baseline->second->endpoints[0]->node->node) - (*target->second->node->node);
-            helper = (*baseline->second->endpoints[1]->node->node) - (*target->second->node->node);
+            TempVector = (baseline->second->endpoints[0]->node->getPosition()) - (target->second->node->getPosition());
+            helper = (baseline->second->endpoints[1]->node->getPosition()) - (target->second->node->getPosition());
             helper.ProjectOntoPlane(TempVector);
             if (fabs(helper.NormSquared()) < MYEPSILON) {
@@ -1550,10 +400,10 @@
             // in case NOT both were found, create virtually this triangle, get its normal vector, calculate angle
             flag = true;
-            VirtualNormalVector = Plane(*(baseline->second->endpoints[0]->node->node),
-                                        *(baseline->second->endpoints[1]->node->node),
-                                        *(target->second->node->node)).getNormal();
-            TempVector = (1./3.) * ((*baseline->second->endpoints[0]->node->node) +
-                                    (*baseline->second->endpoints[1]->node->node) +
-                                    (*target->second->node->node));
+            VirtualNormalVector = Plane((baseline->second->endpoints[0]->node->getPosition()),
+                                        (baseline->second->endpoints[1]->node->getPosition()),
+                                        (target->second->node->getPosition())).getNormal();
+            TempVector = (1./3.) * ((baseline->second->endpoints[0]->node->getPosition()) +
+                                    (baseline->second->endpoints[1]->node->getPosition()) +
+                                    (target->second->node->getPosition()));
             TempVector -= (*Center);
             // make it always point outward
@@ -1569,11 +419,11 @@
             } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle)
               // hence, check the angles to some normal direction from our base line but in this common plane of both targets...
-              helper = (*target->second->node->node) - BaseLineCenter;
+              helper = (target->second->node->getPosition()) - BaseLineCenter;
               helper.ProjectOntoPlane(BaseLine);
               // ...the one with the smaller angle is the better candidate
-              TempVector = (*target->second->node->node) - BaseLineCenter;
+              TempVector = (target->second->node->getPosition()) - BaseLineCenter;
               TempVector.ProjectOntoPlane(VirtualNormalVector);
               TempAngle = TempVector.Angle(helper);
-              TempVector = (*winner->second->node->node) - BaseLineCenter;
+              TempVector = (winner->second->node->getPosition()) - BaseLineCenter;
               TempVector.ProjectOntoPlane(VirtualNormalVector);
               if (TempAngle < TempVector.Angle(helper)) {
@@ -1614,5 +464,5 @@
             BLS[2] = LineChecker[1]->second;
           BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
-          BTS->GetCenter(&helper);
+          BTS->GetCenter(helper);
           helper -= (*Center);
           helper *= -1;
@@ -1652,9 +502,9 @@
 
   cloud->GoToFirst();
-  BoundaryPoints = new LinkedCell(this, 5.);
+  BoundaryPoints = new LinkedCell(*this, 5.);
   while (!cloud->IsEnd()) { // we only have to go once through all points, as boundary can become only bigger
     if (AddFlag) {
       delete (BoundaryPoints);
-      BoundaryPoints = new LinkedCell(this, 5.);
+      BoundaryPoints = new LinkedCell(*this, 5.);
       AddFlag = false;
     }
@@ -1662,5 +512,5 @@
     DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Walker << "." << endl);
     // get the next triangle
-    triangles = FindClosestTrianglesToVector(Walker->node, BoundaryPoints);
+    triangles = FindClosestTrianglesToVector(Walker->getPosition(), BoundaryPoints);
     if (triangles != NULL)
       BTS = triangles->front();
@@ -1676,8 +526,8 @@
     DoLog(0) && (Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl);
     // get the intersection point
-    if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) {
+    if (BTS->GetIntersectionInsideTriangle(*Center, Walker->getPosition(), Intersection)) {
       DoLog(0) && (Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl);
       // we have the intersection, check whether in- or outside of boundary
-      if ((Center->DistanceSquared(*Walker->node) - Center->DistanceSquared(Intersection)) < -MYEPSILON) {
+      if ((Center->DistanceSquared(Walker->getPosition()) - Center->DistanceSquared(Intersection)) < -MYEPSILON) {
         // inside, next!
         DoLog(0) && (Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl);
@@ -2086,5 +936,5 @@
   DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
   for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
-    DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(CandidateLine.OtherOptCenter) << "." << endl);
+    DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "." << endl);
 
   // remove triangles's endpoints
@@ -2102,5 +952,5 @@
     DoLog(1) && (Log() << Verbose(1) << "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
     for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
-      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(CandidateLine.OtherOptCenter) << "." << endl);
+      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "." << endl);
   }
   delete (ListofPoints);
@@ -2257,7 +1107,7 @@
         if (List != NULL) {
           for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
-            if ((*Runner)->node->at(map[0]) > maxCoordinate[map[0]]) {
-              DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl);
-              maxCoordinate[map[0]] = (*Runner)->node->at(map[0]);
+            if ((*Runner)->at(map[0]) > maxCoordinate[map[0]]) {
+              DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << (*Runner)->getPosition() << "." << endl);
+              maxCoordinate[map[0]] = (*Runner)->at(map[0]);
               MaxPoint[map[0]] = (*Runner);
             }
@@ -2295,8 +1145,8 @@
 
     // construct center of circle
-    CircleCenter = 0.5 * ((*BaseLine->endpoints[0]->node->node) + (*BaseLine->endpoints[1]->node->node));
+    CircleCenter = 0.5 * ((BaseLine->endpoints[0]->node->getPosition()) + (BaseLine->endpoints[1]->node->getPosition()));
 
     // construct normal vector of circle
-    CirclePlaneNormal = (*BaseLine->endpoints[0]->node->node) - (*BaseLine->endpoints[1]->node->node);
+    CirclePlaneNormal = (BaseLine->endpoints[0]->node->getPosition()) - (BaseLine->endpoints[1]->node->getPosition());
 
     double radius = CirclePlaneNormal.NormSquared();
@@ -2515,10 +1365,10 @@
 
   // construct center of circle
-  CircleCenter = 0.5 * ((*CandidateLine.BaseLine->endpoints[0]->node->node) +
-                        (*CandidateLine.BaseLine->endpoints[1]->node->node));
+  CircleCenter = 0.5 * ((CandidateLine.BaseLine->endpoints[0]->node->getPosition()) +
+                        (CandidateLine.BaseLine->endpoints[1]->node->getPosition()));
 
   // construct normal vector of circle
-  CirclePlaneNormal = (*CandidateLine.BaseLine->endpoints[0]->node->node) -
-                      (*CandidateLine.BaseLine->endpoints[1]->node->node);
+  CirclePlaneNormal = (CandidateLine.BaseLine->endpoints[0]->node->getPosition()) -
+                      (CandidateLine.BaseLine->endpoints[1]->node->getPosition());
 
   // calculate squared radius of circle
@@ -2536,5 +1386,5 @@
     // construct SearchDirection and an "outward pointer"
     SearchDirection = Plane(RelativeSphereCenter, CirclePlaneNormal,0).getNormal();
-    helper = CircleCenter - (*ThirdPoint->node->node);
+    helper = CircleCenter - (ThirdPoint->node->getPosition());
     if (helper.ScalarProduct(SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
       SearchDirection.Scale(-1.);
@@ -2611,5 +1461,5 @@
   for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++)
     SetOfNeighbours.insert(*Runner);
-  TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, CandidateLine.BaseLine->endpoints[1]->node->node);
+  TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, CandidateLine.BaseLine->endpoints[1]->node->getPosition());
 
   DoLog(0) && (Log() << Verbose(0) << "List of Candidates for Turning Point " << *TurningPoint << ":" << endl);
@@ -2712,5 +1562,5 @@
 
   // create normal vector
-  BTS->GetCenter(&Center);
+  BTS->GetCenter(Center);
   Center -= CandidateLine.OptCenter;
   BTS->SphereCenter = CandidateLine.OptCenter;
@@ -2791,5 +1641,5 @@
 
   // create normal vector
-  BTS->GetCenter(&Center);
+  BTS->GetCenter(Center);
   Center.SubtractVector(*OptCenter);
   BTS->SphereCenter = *OptCenter;
@@ -2837,7 +1687,7 @@
   Vector DistanceToIntersection[2], BaseLine;
   double distance[2];
-  BaseLine = (*Base->endpoints[1]->node->node) - (*Base->endpoints[0]->node->node);
+  BaseLine = (Base->endpoints[1]->node->getPosition()) - (Base->endpoints[0]->node->getPosition());
   for (int i = 0; i < 2; i++) {
-    DistanceToIntersection[i] = (*ClosestPoint) - (*Base->endpoints[i]->node->node);
+    DistanceToIntersection[i] = (*ClosestPoint) - (Base->endpoints[i]->node->getPosition());
     distance[i] = BaseLine.ScalarProduct(DistanceToIntersection[i]);
   }
@@ -2919,5 +1769,5 @@
 
   // calculate volume
-  volume = CalculateVolumeofGeneralTetraeder(*Base->endpoints[1]->node->node, *OtherBase->endpoints[0]->node->node, *OtherBase->endpoints[1]->node->node, *Base->endpoints[0]->node->node);
+  volume = CalculateVolumeofGeneralTetraeder(Base->endpoints[1]->node->getPosition(), OtherBase->endpoints[0]->node->getPosition(), OtherBase->endpoints[1]->node->getPosition(), Base->endpoints[0]->node->getPosition());
 
   // delete the temporary other base line and the closest points
@@ -3125,5 +1975,5 @@
 
               OrthogonalizedOben = Oben;
-              aCandidate = (*a->node) - (*Candidate->node);
+              aCandidate = (a->getPosition()) - (Candidate->getPosition());
               OrthogonalizedOben.ProjectOntoPlane(aCandidate);
               OrthogonalizedOben.Normalize();
@@ -3132,8 +1982,8 @@
               OrthogonalizedOben.Scale(scaleFactor);
 
-              Center = 0.5 * ((*Candidate->node) + (*a->node));
+              Center = 0.5 * ((Candidate->getPosition()) + (a->getPosition()));
               Center += OrthogonalizedOben;
 
-              AngleCheck = Center - (*a->node);
+              AngleCheck = Center - (a->getPosition());
               norm = aCandidate.Norm();
               // second point shall have smallest angle with respect to Oben vector
@@ -3220,10 +2070,10 @@
 
   // construct center of circle
-  CircleCenter = 0.5 * ((*CandidateLine.BaseLine->endpoints[0]->node->node) +
-                        (*CandidateLine.BaseLine->endpoints[1]->node->node));
+  CircleCenter = 0.5 * ((CandidateLine.BaseLine->endpoints[0]->node->getPosition()) +
+                        (CandidateLine.BaseLine->endpoints[1]->node->getPosition()));
 
   // construct normal vector of circle
-  CirclePlaneNormal = (*CandidateLine.BaseLine->endpoints[0]->node->node) -
-                      (*CandidateLine.BaseLine->endpoints[1]->node->node);
+  CirclePlaneNormal = (CandidateLine.BaseLine->endpoints[0]->node->getPosition()) -
+                      (CandidateLine.BaseLine->endpoints[1]->node->getPosition());
 
   RelativeOldSphereCenter = OldSphereCenter - CircleCenter;
@@ -3252,5 +2102,5 @@
 
       // get cell for the starting point
-      if (LC->SetIndexToVector(&CircleCenter)) {
+      if (LC->SetIndexToVector(CircleCenter)) {
         for (int i = 0; i < NDIM; i++) // store indices of this cell
           N[i] = LC->n[i];
@@ -3282,18 +2132,18 @@
 
                   // find center on the plane
-                  GetCenterofCircumcircle(&NewPlaneCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node);
+                  GetCenterofCircumcircle(NewPlaneCenter, CandidateLine.BaseLine->endpoints[0]->node->getPosition(), CandidateLine.BaseLine->endpoints[1]->node->getPosition(), Candidate->getPosition());
                   DoLog(1) && (Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl);
 
                   try {
-                    NewNormalVector = Plane(*(CandidateLine.BaseLine->endpoints[0]->node->node),
-                                            *(CandidateLine.BaseLine->endpoints[1]->node->node),
-                                            *(Candidate->node)).getNormal();
+                    NewNormalVector = Plane((CandidateLine.BaseLine->endpoints[0]->node->getPosition()),
+                                            (CandidateLine.BaseLine->endpoints[1]->node->getPosition()),
+                                            (Candidate->getPosition())).getNormal();
                     DoLog(1) && (Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl);
-                    radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(NewPlaneCenter);
+                    radius = CandidateLine.BaseLine->endpoints[0]->node->DistanceSquared(NewPlaneCenter);
                     DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);
                     DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);
                     DoLog(1) && (Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl);
                     if (radius < RADIUS * RADIUS) {
-                      otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(NewPlaneCenter);
+                      otherradius = CandidateLine.BaseLine->endpoints[1]->node->DistanceSquared(NewPlaneCenter);
                       if (fabs(radius - otherradius) < HULLEPSILON) {
                         // construct both new centers
@@ -3309,6 +2159,6 @@
                         OtherNewSphereCenter += helper;
                         DoLog(2) && (Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl);
-                        alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
-                        Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
+                        alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection, HULLEPSILON);
+                        Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection, HULLEPSILON);
                         if ((ThirdPoint != NULL) && (Candidate == ThirdPoint->node)) { // in that case only the other circlecenter is valid
                           if (OldSphereCenter.DistanceSquared(NewSphereCenter) < OldSphereCenter.DistanceSquared(OtherNewSphereCenter))
@@ -3422,5 +2272,5 @@
  * \return map of BoundaryPointSet of closest points sorted by squared distance or NULL.
  */
-DistanceToPointMap * Tesselation::FindClosestBoundaryPointsToVector(const Vector *x, const LinkedCell* LC) const
+DistanceToPointMap * Tesselation::FindClosestBoundaryPointsToVector(const Vector &x, const LinkedCell* LC) const
 {
   Info FunctionInfo(__func__);
@@ -3450,5 +2300,5 @@
             FindPoint = PointsOnBoundary.find((*Runner)->nr);
             if (FindPoint != PointsOnBoundary.end()) {
-              points->insert(DistanceToPointPair(FindPoint->second->node->node->DistanceSquared(*x), FindPoint->second));
+              points->insert(DistanceToPointPair(FindPoint->second->node->DistanceSquared(x), FindPoint->second));
               DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *FindPoint->second << " into the list." << endl);
             }
@@ -3474,5 +2324,5 @@
  * \return closest BoundaryLineSet or NULL in degenerate case.
  */
-BoundaryLineSet * Tesselation::FindClosestBoundaryLineToVector(const Vector *x, const LinkedCell* LC) const
+BoundaryLineSet * Tesselation::FindClosestBoundaryLineToVector(const Vector &x, const LinkedCell* LC) const
 {
   Info FunctionInfo(__func__);
@@ -3485,5 +2335,5 @@
 
   // for each point, check its lines, remember closest
-  DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryLine to " << *x << " ... " << endl);
+  DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryLine to " << x << " ... " << endl);
   BoundaryLineSet *ClosestLine = NULL;
   double MinDistance = -1.;
@@ -3494,16 +2344,16 @@
     for (LineMap::iterator LineRunner = Runner->second->lines.begin(); LineRunner != Runner->second->lines.end(); LineRunner++) {
       // calculate closest point on line to desired point
-      helper = 0.5 * ((*(LineRunner->second)->endpoints[0]->node->node) +
-                      (*(LineRunner->second)->endpoints[1]->node->node));
-      Center = (*x) - helper;
-      BaseLine = (*(LineRunner->second)->endpoints[0]->node->node) -
-                 (*(LineRunner->second)->endpoints[1]->node->node);
+      helper = 0.5 * (((LineRunner->second)->endpoints[0]->node->getPosition()) +
+                      ((LineRunner->second)->endpoints[1]->node->getPosition()));
+      Center = (x) - helper;
+      BaseLine = ((LineRunner->second)->endpoints[0]->node->getPosition()) -
+                 ((LineRunner->second)->endpoints[1]->node->getPosition());
       Center.ProjectOntoPlane(BaseLine);
       const double distance = Center.NormSquared();
       if ((ClosestLine == NULL) || (distance < MinDistance)) {
         // additionally calculate intersection on line (whether it's on the line section or not)
-        helper = (*x) - (*(LineRunner->second)->endpoints[0]->node->node) - Center;
+        helper = (x) - ((LineRunner->second)->endpoints[0]->node->getPosition()) - Center;
         const double lengthA = helper.ScalarProduct(BaseLine);
-        helper = (*x) - (*(LineRunner->second)->endpoints[1]->node->node) - Center;
+        helper = (x) - ((LineRunner->second)->endpoints[1]->node->getPosition()) - Center;
         const double lengthB = helper.ScalarProduct(BaseLine);
         if (lengthB * lengthA < 0) { // if have different sign
@@ -3534,5 +2384,5 @@
  * \return BoundaryTriangleSet of nearest triangle or NULL.
  */
-TriangleList * Tesselation::FindClosestTrianglesToVector(const Vector *x, const LinkedCell* LC) const
+TriangleList * Tesselation::FindClosestTrianglesToVector(const Vector &x, const LinkedCell* LC) const
 {
   Info FunctionInfo(__func__);
@@ -3545,5 +2395,5 @@
 
   // for each point, check its lines, remember closest
-  DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << *x << " ... " << endl);
+  DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << x << " ... " << endl);
   LineSet ClosestLines;
   double MinDistance = 1e+16;
@@ -3555,12 +2405,12 @@
     for (LineMap::iterator LineRunner = Runner->second->lines.begin(); LineRunner != Runner->second->lines.end(); LineRunner++) {
 
-      BaseLine = (*(LineRunner->second)->endpoints[0]->node->node) -
-                 (*(LineRunner->second)->endpoints[1]->node->node);
+      BaseLine = ((LineRunner->second)->endpoints[0]->node->getPosition()) -
+                 ((LineRunner->second)->endpoints[1]->node->getPosition());
       const double lengthBase = BaseLine.NormSquared();
 
-      BaseLineIntersection = (*x) - (*(LineRunner->second)->endpoints[0]->node->node);
+      BaseLineIntersection = (x) - ((LineRunner->second)->endpoints[0]->node->getPosition());
       const double lengthEndA = BaseLineIntersection.NormSquared();
 
-      BaseLineIntersection = (*x) - (*(LineRunner->second)->endpoints[1]->node->node);
+      BaseLineIntersection = (x) - ((LineRunner->second)->endpoints[1]->node->getPosition());
       const double lengthEndB = BaseLineIntersection.NormSquared();
 
@@ -3580,5 +2430,5 @@
       } else { // intersection is closer, calculate
         // calculate closest point on line to desired point
-        BaseLineIntersection = (*x) - (*(LineRunner->second)->endpoints[1]->node->node);
+        BaseLineIntersection = (x) - ((LineRunner->second)->endpoints[1]->node->getPosition());
         Center = BaseLineIntersection;
         Center.ProjectOntoPlane(BaseLine);
@@ -3621,5 +2471,5 @@
  * \return list of BoundaryTriangleSet of nearest triangles or NULL.
  */
-class BoundaryTriangleSet * Tesselation::FindClosestTriangleToVector(const Vector *x, const LinkedCell* LC) const
+class BoundaryTriangleSet * Tesselation::FindClosestTriangleToVector(const Vector &x, const LinkedCell* LC) const
 {
   Info FunctionInfo(__func__);
@@ -3636,6 +2486,6 @@
   double MinAlignment = 2. * M_PI;
   for (TriangleList::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++) {
-    (*Runner)->GetCenter(&Center);
-    helper = (*x) - Center;
+    (*Runner)->GetCenter(Center);
+    helper = (x) - Center;
     const double Alignment = helper.Angle((*Runner)->NormalVector);
     if (Alignment < MinAlignment) {
@@ -3663,5 +2513,5 @@
 {
   Info FunctionInfo(__func__);
-  TriangleIntersectionList Intersections(&Point, this, LC);
+  TriangleIntersectionList Intersections(Point, this, LC);
 
   return Intersections.IsInside();
@@ -3703,5 +2553,5 @@
   }
 
-  triangle->GetCenter(&Center);
+  triangle->GetCenter(Center);
   DoLog(2) && (Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl);
   DistanceToCenter = Center - Point;
@@ -3714,5 +2564,5 @@
     Center = Point - triangle->NormalVector; // points towards MolCenter
     DoLog(1) && (Log() << Verbose(1) << "INFO: Calling Intersection with " << Center << " and " << DistanceToCenter << "." << endl);
-    if (triangle->GetIntersectionInsideTriangle(&Center, &DistanceToCenter, &Intersection)) {
+    if (triangle->GetIntersectionInsideTriangle(Center, DistanceToCenter, Intersection)) {
       DoLog(1) && (Log() << Verbose(1) << Point << " is inner point: sufficiently close to boundary, " << Intersection << "." << endl);
       return 0.;
@@ -3723,5 +2573,5 @@
   } else {
     // calculate smallest distance
-    distance = triangle->GetClosestPointInsideTriangle(&Point, &Intersection);
+    distance = triangle->GetClosestPointInsideTriangle(Point, Intersection);
     DoLog(1) && (Log() << Verbose(1) << "Closest point on triangle is " << Intersection << "." << endl);
 
@@ -3747,5 +2597,5 @@
 {
   Info FunctionInfo(__func__);
-  TriangleIntersectionList Intersections(&Point, this, LC);
+  TriangleIntersectionList Intersections(Point, this, LC);
 
   return Intersections.GetSmallestDistance();
@@ -3762,5 +2612,5 @@
 {
   Info FunctionInfo(__func__);
-  TriangleIntersectionList Intersections(&Point, this, LC);
+  TriangleIntersectionList Intersections(Point, this, LC);
 
   return Intersections.GetClosestTriangle();
@@ -3839,5 +2689,5 @@
  * @return list of the all points linked to the provided one
  */
-TesselPointList * Tesselation::GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const
+TesselPointList * Tesselation::GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const
 {
   Info FunctionInfo(__func__);
@@ -3871,11 +2721,9 @@
 
   // construct one orthogonal vector
-  if (Reference != NULL) {
-    AngleZero = (*Reference) - (*Point->node);
-    AngleZero.ProjectOntoPlane(PlaneNormal);
-  }
-  if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON)) {
-    DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl);
-    AngleZero = (*(*SetOfNeighbours->begin())->node) - (*Point->node);
+  AngleZero = (Reference) - (Point->getPosition());
+  AngleZero.ProjectOntoPlane(PlaneNormal);
+  if ((AngleZero.NormSquared() < MYEPSILON)) {
+    DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer." << endl);
+    AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition());
     AngleZero.ProjectOntoPlane(PlaneNormal);
     if (AngleZero.NormSquared() < MYEPSILON) {
@@ -3893,5 +2741,5 @@
   // go through all connected points and calculate angle
   for (TesselPointSet::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) {
-    helper = (*(*listRunner)->node) - (*Point->node);
+    helper = ((*listRunner)->getPosition()) - (Point->getPosition());
     helper.ProjectOntoPlane(PlaneNormal);
     double angle = GetAngle(helper, AngleZero, OrthogonalVector);
@@ -3915,8 +2763,8 @@
  * @param *SetOfNeighbours all points for which the angle should be calculated
  * @param *Point of which get all connected points
- * @param *Reference Reference vector for zero angle or NULL for no preference
+ * @param *Reference Reference vector for zero angle or (0,0,0) for no preference
  * @return list of the all points linked to the provided one
  */
-TesselPointList * Tesselation::GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const
+TesselPointList * Tesselation::GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const
 {
   Info FunctionInfo(__func__);
@@ -3942,5 +2790,5 @@
   }
 
-  DoLog(1) && (Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << *Reference << "." << endl);
+  DoLog(1) && (Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << Reference << "." << endl);
   // calculate central point
   TesselPointSet::const_iterator TesselA = SetOfNeighbours->begin();
@@ -3952,7 +2800,7 @@
   int counter = 0;
   while (TesselC != SetOfNeighbours->end()) {
-    helper = Plane(*((*TesselA)->node),
-                   *((*TesselB)->node),
-                   *((*TesselC)->node)).getNormal();
+    helper = Plane(((*TesselA)->getPosition()),
+                   ((*TesselB)->getPosition()),
+                   ((*TesselC)->getPosition())).getNormal();
     DoLog(0) && (Log() << Verbose(0) << "Making normal vector out of " << *(*TesselA) << ", " << *(*TesselB) << " and " << *(*TesselC) << ":" << helper << endl);
     counter++;
@@ -3974,11 +2822,11 @@
 
   // construct one orthogonal vector
-  if (Reference != NULL) {
-    AngleZero = (*Reference) - (*Point->node);
+  if (!Reference.IsZero()) {
+    AngleZero = (Reference) - (Point->getPosition());
     AngleZero.ProjectOntoPlane(PlaneNormal);
   }
-  if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) {
-    DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl);
-    AngleZero = (*(*SetOfNeighbours->begin())->node) - (*Point->node);
+  if ((Reference.IsZero()) || (AngleZero.NormSquared() < MYEPSILON )) {
+    DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer." << endl);
+    AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition());
     AngleZero.ProjectOntoPlane(PlaneNormal);
     if (AngleZero.NormSquared() < MYEPSILON) {
@@ -3997,5 +2845,5 @@
   pair<map<double, TesselPoint*>::iterator, bool> InserterTest;
   for (TesselPointSet::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) {
-    helper = (*(*listRunner)->node) - (*Point->node);
+    helper = ((*listRunner)->getPosition()) - (Point->getPosition());
     helper.ProjectOntoPlane(PlaneNormal);
     double angle = GetAngle(helper, AngleZero, OrthogonalVector);
@@ -4242,5 +3090,5 @@
 
   // copy old location for the volume
-  OldPoint = (*point->node->node);
+  OldPoint = (point->node->getPosition());
 
   // get list of connected points
@@ -4305,5 +3153,5 @@
           StartNode--;
           //Log() << Verbose(3) << "INFO: StartNode is " << **StartNode << "." << endl;
-          Point = (*(*StartNode)->node) - (*(*MiddleNode)->node);
+          Point = ((*StartNode)->getPosition()) - ((*MiddleNode)->getPosition());
           StartNode = MiddleNode;
           StartNode++;
@@ -4311,6 +3159,6 @@
             StartNode = connectedPath->begin();
           //Log() << Verbose(3) << "INFO: EndNode is " << **StartNode << "." << endl;
-          Reference = (*(*StartNode)->node) - (*(*MiddleNode)->node);
-          OrthogonalVector = (*(*MiddleNode)->node) - OldPoint;
+          Reference = ((*StartNode)->getPosition()) - ((*MiddleNode)->getPosition());
+          OrthogonalVector = ((*MiddleNode)->getPosition()) - OldPoint;
           OrthogonalVector.MakeNormalTo(Reference);
           angle = GetAngle(Point, Reference, OrthogonalVector);
@@ -4367,5 +3215,5 @@
         AddTesselationTriangle();
         // calculate volume summand as a general tetraeder
-        volume += CalculateVolumeofGeneralTetraeder(*TPS[0]->node->node, *TPS[1]->node->node, *TPS[2]->node->node, OldPoint);
+        volume += CalculateVolumeofGeneralTetraeder(TPS[0]->node->getPosition(), TPS[1]->node->getPosition(), TPS[2]->node->getPosition(), OldPoint);
         // advance number
         count++;
@@ -4752,5 +3600,5 @@
   // find nearest boundary point
   class TesselPoint *BackupPoint = NULL;
-  class TesselPoint *NearestPoint = FindClosestTesselPoint(point->node, BackupPoint, LC);
+  class TesselPoint *NearestPoint = FindClosestTesselPoint(point->getPosition(), BackupPoint, LC);
   class BoundaryPointSet *NearestBoundaryPoint = NULL;
   PointMap::iterator PointRunner;
@@ -4773,9 +3621,9 @@
   class BoundaryLineSet *BestLine = NULL;
   for (LineMap::iterator Runner = NearestBoundaryPoint->lines.begin(); Runner != NearestBoundaryPoint->lines.end(); Runner++) {
-    BaseLine = (*Runner->second->endpoints[0]->node->node) -
-               (*Runner->second->endpoints[1]->node->node);
-    CenterToPoint = 0.5 * ((*Runner->second->endpoints[0]->node->node) +
-                           (*Runner->second->endpoints[1]->node->node));
-    CenterToPoint -= (*point->node);
+    BaseLine = (Runner->second->endpoints[0]->node->getPosition()) -
+               (Runner->second->endpoints[1]->node->getPosition());
+    CenterToPoint = 0.5 * ((Runner->second->endpoints[0]->node->getPosition()) +
+                           (Runner->second->endpoints[1]->node->getPosition()));
+    CenterToPoint -= (point->getPosition());
     angle = CenterToPoint.Angle(BaseLine);
     if (fabs(angle - M_PI/2.) < fabs(BestAngle - M_PI/2.)) {
Index: src/tesselation.hpp
===================================================================
--- src/tesselation.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/tesselation.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -2,5 +2,6 @@
  * tesselation.hpp
  *
- *  The tesselation class is meant to contain the envelope (concave, convex or neither) of a set of Vectors. As we actually mean this stuff for atoms, we have to encapsulate it all a bit.
+ *  The tesselation class is meant to contain the envelope (concave, convex or neither) of a set of Vectors.
+ *  As we actually mean this stuff for atoms, we have to encapsulate it all a bit.
  *
  *  Created on: Aug 3, 2009
@@ -25,7 +26,12 @@
 #include <stack>
 
+#include "BoundaryMaps.hpp"
+#include "BoundaryPointSet.hpp"
+#include "PointCloud.hpp"
+#include "TesselPoint.hpp"
 #include "atom_particleinfo.hpp"
-#include "helpers.hpp"
-#include "vector.hpp"
+#include "Helpers/helpers.hpp"
+#include "LinearAlgebra/Vector.hpp"
+
 
 /****************************************** forward declarations *****************************/
@@ -34,7 +40,6 @@
 class BoundaryLineSet;
 class BoundaryTriangleSet;
+class CandidateForTesselation;
 class LinkedCell;
-class TesselPoint;
-class PointCloud;
 class Tesselation;
 class Plane;
@@ -42,238 +47,17 @@
 /********************************************** definitions *********************************/
 
-#define DoTecplotOutput 1
-#define DoRaster3DOutput 1
-#define DoVRMLOutput 0
-#define TecplotSuffix ".dat"
-#define Raster3DSuffix ".r3d"
-#define VRMLSUffix ".wrl"
+enum { DoTecplotOutput=1 };
+enum { DoRaster3DOutput=1 };
+enum { DoVRMLOutput=0 };
 
-#define ParallelEpsilon 1e-3
+extern "C" const char *TecplotSuffix;
+extern "C" const char *Raster3DSuffix;
+extern "C" const char *VRMLSUffix;
+
+extern "C" const double ParallelEpsilon;
 
 // ======================================================= some template functions =========================================
 
-#define IndexToIndex map <int, int>
-
-#define PointMap map < int, class BoundaryPointSet * >
-#define PointSet set < class BoundaryPointSet * >
-#define PointList list < class BoundaryPointSet * >
-#define PointPair pair < int, class BoundaryPointSet * >
-#define PointTestPair pair < PointMap::iterator, bool >
-
-#define CandidateList list <class CandidateForTesselation *>
-#define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *>
-
-#define LineMap multimap < int, class BoundaryLineSet * >
-#define LineSet set < class BoundaryLineSet * >
-#define LineList list < class BoundaryLineSet * >
-#define LinePair pair < int, class BoundaryLineSet * >
-#define LineTestPair pair < LineMap::iterator, bool >
-
-#define TriangleMap map < int, class BoundaryTriangleSet * >
-#define TriangleSet set < class BoundaryTriangleSet * >
-#define TriangleList list < class BoundaryTriangleSet * >
-#define TrianglePair pair < int, class BoundaryTriangleSet * >
-#define TriangleTestPair pair < TrianglePair::iterator, bool >
-
-#define PolygonMap map < int, class BoundaryPolygonSet * >
-#define PolygonSet set < class BoundaryPolygonSet * >
-#define PolygonList list < class BoundaryPolygonSet * >
-
-#define DistanceToPointMap multimap <double, class BoundaryPointSet * >
-#define DistanceToPointPair pair <double, class BoundaryPointSet * >
-
-#define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> >
-#define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> >
-
-#define TesselPointList list <TesselPoint *>
-#define TesselPointSet set <TesselPoint *>
-
-#define ListOfTesselPointList list<list <TesselPoint *> *>
-
-enum centers {Opt, OtherOpt};
-
 /********************************************** declarations *******************************/
-
-template <typename T> void SetEndpointsOrdered(T endpoints[2], T endpoint1, T endpoint2)
-{
-  if (endpoint1->Nr < endpoint2->Nr) {
-    endpoints[0] = endpoint1;
-    endpoints[1] = endpoint2;
-  } else {
-    endpoints[0] = endpoint2;
-    endpoints[1] = endpoint1;
-  }
-};
-
-// ======================================================== class BoundaryPointSet =========================================
-
-class BoundaryPointSet {
-  public:
-    BoundaryPointSet();
-    BoundaryPointSet(TesselPoint * const Walker);
-    ~BoundaryPointSet();
-
-    void AddLine(BoundaryLineSet * const line);
-
-    LineMap lines;
-    int LinesCount;
-    TesselPoint *node;
-    double value;
-    int Nr;
-};
-
-ostream & operator << (ostream &ost, const BoundaryPointSet &a);
-
-// ======================================================== class BoundaryLineSet ==========================================
-
-class BoundaryLineSet {
-  public:
-    BoundaryLineSet();
-    BoundaryLineSet(BoundaryPointSet * const Point[2], const int number);
-    BoundaryLineSet(BoundaryPointSet * const Point1, BoundaryPointSet * const Point2, const int number);
-    ~BoundaryLineSet();
-
-    void AddTriangle(BoundaryTriangleSet * const triangle);
-    bool IsConnectedTo(const BoundaryLineSet * const line) const;
-    bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
-    bool CheckConvexityCriterion() const;
-    double CalculateConvexity() const;
-    class BoundaryPointSet *GetOtherEndpoint(const BoundaryPointSet * const point) const;
-    class BoundaryTriangleSet *GetOtherTriangle(const BoundaryTriangleSet * const triangle) const;
-
-    class BoundaryPointSet *endpoints[2];
-    TriangleMap triangles;
-    int Nr;
-    bool skipped;
-};
-
-ostream & operator << (ostream &ost, const BoundaryLineSet &a);
-
-// ======================================================== class BoundaryTriangleSet =======================================
-
-class BoundaryTriangleSet {
-  public:
-    BoundaryTriangleSet();
-    BoundaryTriangleSet(class BoundaryLineSet * const line[3], const int number);
-    ~BoundaryTriangleSet();
-
-    void GetNormalVector(const Vector &NormalVector);
-    void GetCenter(Vector * const center) const;
-    bool GetIntersectionInsideTriangle(const Vector * const MolCenter, const Vector * const x, Vector * const Intersection) const;
-    double GetClosestPointInsideTriangle(const Vector * const x, Vector * const ClosestPoint) const;
-    bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
-    bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
-    bool ContainsBoundaryPoint(const TesselPoint * const point) const;
-    class BoundaryPointSet *GetThirdEndpoint(const BoundaryLineSet * const line) const;
-    class BoundaryLineSet *GetThirdLine(const BoundaryPointSet * const point) const;
-    bool IsPresentTupel(const BoundaryPointSet * const Points[3]) const;
-    bool IsPresentTupel(const BoundaryTriangleSet * const T) const;
-
-    Plane getPlane() const;
-    Vector getEndpoint(int) const;
-    std::string getEndpointName(int) const;
-
-    class BoundaryPointSet *endpoints[3];
-    class BoundaryLineSet *lines[3];
-    Vector NormalVector;
-    Vector SphereCenter;
-    int Nr;
-
-  private:
-
-};
-
-ostream & operator << (ostream &ost, const BoundaryTriangleSet &a);
-
-
-// ======================================================== class BoundaryTriangleSet =======================================
-
-/** Set of BoundaryPointSet.
- * This is just meant as a container for a group of endpoints, extending the node, line, triangle concept. However, this has
- * only marginally something to do with the tesselation. Hence, there is no incorporation into the bookkeeping of the Tesselation
- * class (i.e. no allocation, no deletion).
- * \note we assume that the set of endpoints reside (more or less) on a plane.
- */
-class BoundaryPolygonSet {
-  public:
-    BoundaryPolygonSet();
-    ~BoundaryPolygonSet();
-
-    Vector * GetNormalVector(const Vector &NormalVector) const;
-    void GetCenter(Vector *center) const;
-    bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
-    bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
-    bool ContainsBoundaryPoint(const TesselPoint * const point) const;
-    bool ContainsBoundaryTriangle(const BoundaryTriangleSet * const point) const;
-    bool ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const;
-    bool ContainsPresentTupel(const BoundaryPolygonSet * const P) const;
-    bool ContainsPresentTupel(const PointSet &endpoints) const;
-    TriangleSet * GetAllContainedTrianglesFromEndpoints() const;
-    bool FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line);
-
-    PointSet endpoints;
-    int Nr;
-};
-
-ostream & operator << (ostream &ost, const BoundaryPolygonSet &a);
-
-// =========================================================== class TESSELPOINT ===========================================
-
-/** Is a single point of the set of Vectors, also a super-class to be inherited and and its functions to be implemented.
- */
-class TesselPoint : virtual public ParticleInfo {
-public:
-  TesselPoint();
-  virtual ~TesselPoint();
-
-  Vector *node;   // pointer to position of the dot in space
-
-  virtual ostream & operator << (ostream &ost);
-};
-
-ostream & operator << (ostream &ost, const TesselPoint &a);
-
-// =========================================================== class POINTCLOUD ============================================
-
-/** Super-class for all point clouds structures, also molecules. They have to inherit this structure and implement the virtual function to access the Vectors.
- * This basically encapsulates a list structure.
- */
-class PointCloud {
-public:
-  PointCloud();
-  virtual ~PointCloud();
-
-  virtual const char * const GetName() const { return "unknown"; };
-  virtual Vector *GetCenter() const { return NULL; };
-  virtual TesselPoint *GetPoint() const { return NULL; };
-  virtual int GetMaxId() const { return 0; };
-  virtual void GoToNext() const {};
-  virtual void GoToFirst() const {};
-  virtual bool IsEmpty() const { return true; };
-  virtual bool IsEnd() const { return true; };
-};
-
-// ======================================================== class CandidateForTesselation =========================================
-
-class CandidateForTesselation {
-  public :
-  CandidateForTesselation(BoundaryLineSet* currentBaseLine);
-  CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, BoundaryPointSet *point, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);
-  ~CandidateForTesselation();
-
-  bool CheckValidity(const double RADIUS, const LinkedCell *LC) const;
-
-  TesselPointList pointlist;
-  const BoundaryLineSet * BaseLine;
-  const BoundaryPointSet * ThirdPoint;
-  const BoundaryTriangleSet *T;
-  Vector OldCenter;
-  Vector OptCenter;
-  Vector OtherOptCenter;
-  double ShortestAngle;
-  double OtherShortestAngle;
-};
-
-ostream & operator <<(ostream &ost, const  CandidateForTesselation &a);
 
 // =========================================================== class TESSELATION ===========================================
@@ -289,5 +73,5 @@
     void AddTesselationPoint(TesselPoint* Candidate, const int n);
     void SetTesselationPoint(TesselPoint* Candidate, const int n) const;
-    void AddTesselationLine(const Vector * const OptCenter, const BoundaryPointSet * const candidate, class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
+    void AddTesselationLine(const Vector * OptCenter, const BoundaryPointSet * const candidate, class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
     void AddNewTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
     void AddExistingTesselationTriangleLine(class BoundaryLineSet *FindLine, int n);
@@ -330,10 +114,10 @@
     ListOfTesselPointList * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
     ListOfTesselPointList * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
-    TesselPointList * GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference = NULL) const;
-    TesselPointList * GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const;
+    TesselPointList * GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
+    TesselPointList * GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
     class BoundaryPointSet * GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
     TriangleList * FindTriangles(const TesselPoint* const Points[3]) const;
-    TriangleList * FindClosestTrianglesToVector(const Vector *x, const LinkedCell* LC) const;
-    BoundaryTriangleSet * FindClosestTriangleToVector(const Vector *x, const LinkedCell* LC) const;
+    TriangleList * FindClosestTrianglesToVector(const Vector &x, const LinkedCell* LC) const;
+    BoundaryTriangleSet * FindClosestTriangleToVector(const Vector &x, const LinkedCell* LC) const;
     bool IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const;
     double GetDistanceSquaredToTriangle(const Vector &Point, const BoundaryTriangleSet* const triangle) const;
@@ -341,6 +125,6 @@
     BoundaryTriangleSet * GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell* const LC) const;
     bool AddBoundaryPoint(TesselPoint * Walker, const int n);
-    DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector *x, const LinkedCell* LC) const;
-    BoundaryLineSet * FindClosestBoundaryLineToVector(const Vector *x, const LinkedCell* LC) const;
+    DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector &x, const LinkedCell* LC) const;
+    BoundaryLineSet * FindClosestBoundaryLineToVector(const Vector &x, const LinkedCell* LC) const;
 
     // print for debugging
@@ -360,4 +144,12 @@
     int TrianglesOnBoundaryCount;
 
+    typedef PointMap::iterator iterator;
+    typedef PointMap::const_iterator const_iterator;
+    TesselPoint * getValue(const_iterator &rhs) const;
+    TesselPoint * getValue(iterator &rhs) const;
+    iterator begin() { return PointsOnBoundary.begin(); }
+    const_iterator begin() const { return PointsOnBoundary.begin(); }
+    iterator end() { return PointsOnBoundary.end(); }
+    const_iterator end() const { return PointsOnBoundary.end(); }
     // PointCloud implementation for PointsOnBoundary
     virtual Vector *GetCenter(ofstream *out) const;
@@ -375,4 +167,6 @@
 
   private:
+    static const double HULLEPSILON; //!< TODO: Get rid of HULLEPSILON, points to numerical instabilities
+
     mutable class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
 
Index: src/tesselationhelpers.cpp
===================================================================
--- src/tesselationhelpers.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/tesselationhelpers.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * TesselationHelpers.cpp
@@ -6,20 +13,30 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
 #include <fstream>
 
-#include "info.hpp"
+#include "BoundaryLineSet.hpp"
+#include "BoundaryPointSet.hpp"
+#include "BoundaryPolygonSet.hpp"
+#include "BoundaryTriangleSet.hpp"
+#include "CandidateForTesselation.hpp"
+#include "Helpers/Info.hpp"
 #include "linkedcell.hpp"
-#include "linearsystemofequations.hpp"
-#include "log.hpp"
+#include "LinearAlgebra/linearsystemofequations.hpp"
+#include "Helpers/Log.hpp"
 #include "tesselation.hpp"
 #include "tesselationhelpers.hpp"
-#include "vector.hpp"
-#include "Line.hpp"
-#include "vector_ops.hpp"
-#include "verbose.hpp"
-#include "Plane.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Line.hpp"
+#include "LinearAlgebra/vector_ops.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Plane.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 
 void GetSphere(Vector * const center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS)
@@ -144,5 +161,5 @@
  * \param *c third point
  */
-void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c)
+void GetCenterofCircumcircle(Vector &Center, const Vector &a, const Vector &b, const Vector &c)
 {
 	Info FunctionInfo(__func__);
@@ -156,10 +173,11 @@
   helper[2] = SideC.NormSquared()*(SideA.NormSquared()+SideB.NormSquared() - SideC.NormSquared());
 
-  Center->Zero();
-  *Center += helper[0] * a;
-  *Center += helper[1] * b;
-  *Center += helper[2] * c;
-  Center->Scale(1./(helper[0]+helper[1]+helper[2]));
-  Log() << Verbose(1) << "INFO: Center (2nd algo) is at " << *Center << "." << endl;
+  Center.Zero();
+  Center += helper[0] * a;
+  Center += helper[1] * b;
+  Center += helper[2] * c;
+  if (fabs(helper[0]+helper[1]+helper[2]) > MYEPSILON)
+    Center.Scale(1./(helper[0]+helper[1]+helper[2]));
+  Log() << Verbose(1) << "INFO: Center (2nd algo) is at " << Center << "." << endl;
 };
 
@@ -175,7 +193,8 @@
  * \param NormalVector normal vector
  * \param SearchDirection search direction to make angle unique on return.
+ * \param HULLEPSILON machine precision for tesselation points
  * \return Angle between \a NewSphereCenter and \a OldSphereCenter relative to \a CircleCenter, 2.*M_PI if one test fails
  */
-double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection)
+double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection, const double HULLEPSILON)
 {
 	Info FunctionInfo(__func__);
@@ -388,5 +407,5 @@
  * @return point which is second closest to the provided one
  */
-TesselPoint* FindSecondClosestTesselPoint(const Vector* Point, const LinkedCell* const LC)
+TesselPoint* FindSecondClosestTesselPoint(const Vector& Point, const LinkedCell* const LC)
 {
 	Info FunctionInfo(__func__);
@@ -412,5 +431,5 @@
         if (List != NULL) {
           for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
-            helper = (*Point) - (*(*Runner)->node);
+            helper = (Point) - ((*Runner)->getPosition());
             double currentNorm = helper. Norm();
             if (currentNorm < distance) {
@@ -441,5 +460,5 @@
  * @return point which is closest to the provided one, NULL if none found
  */
-TesselPoint* FindClosestTesselPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC)
+TesselPoint* FindClosestTesselPoint(const Vector& Point, TesselPoint *&SecondPoint, const LinkedCell* const LC)
 {
 	Info FunctionInfo(__func__);
@@ -465,5 +484,5 @@
         if (List != NULL) {
           for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
-            helper = (*Point) - (*(*Runner)->node);
+            helper = (Point) - ((*Runner)->getPosition());
             double currentNorm = helper.NormSquared();
             if (currentNorm < distance) {
@@ -503,6 +522,6 @@
 	Info FunctionInfo(__func__);
   // construct the plane of the two baselines (i.e. take both their directional vectors)
-  Vector Baseline = (*Base->endpoints[1]->node->node) - (*Base->endpoints[0]->node->node);
-  Vector OtherBaseline = (*OtherBase->endpoints[1]->node->node) - (*OtherBase->endpoints[0]->node->node);
+  Vector Baseline = (Base->endpoints[1]->node->getPosition()) - (Base->endpoints[0]->node->getPosition());
+  Vector OtherBaseline = (OtherBase->endpoints[1]->node->getPosition()) - (OtherBase->endpoints[0]->node->getPosition());
   Vector Normal = Baseline;
   Normal.VectorProduct(OtherBaseline);
@@ -511,15 +530,15 @@
 
   // project one offset point of OtherBase onto this plane (and add plane offset vector)
-  Vector NewOffset = (*OtherBase->endpoints[0]->node->node) - (*Base->endpoints[0]->node->node);
+  Vector NewOffset = (OtherBase->endpoints[0]->node->getPosition()) - (Base->endpoints[0]->node->getPosition());
   NewOffset.ProjectOntoPlane(Normal);
-  NewOffset += (*Base->endpoints[0]->node->node);
+  NewOffset += (Base->endpoints[0]->node->getPosition());
   Vector NewDirection = NewOffset + OtherBaseline;
 
   // calculate the intersection between this projected baseline and Base
   Vector *Intersection = new Vector;
-  Line line1 = makeLineThrough(*(Base->endpoints[0]->node->node),*(Base->endpoints[1]->node->node));
+  Line line1 = makeLineThrough((Base->endpoints[0]->node->getPosition()),(Base->endpoints[1]->node->getPosition()));
   Line line2 = makeLineThrough(NewOffset, NewDirection);
   *Intersection = line1.getIntersection(line2);
-  Normal = (*Intersection) - (*Base->endpoints[0]->node->node);
+  Normal = (*Intersection) - (Base->endpoints[0]->node->getPosition());
   DoLog(1) && (Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(Baseline)/Baseline.NormSquared()) << "." << endl);
 
@@ -566,5 +585,5 @@
       *vrmlfile << "Sphere {" << endl << "  "; // 2 is sphere type
       for (i=0;i<NDIM;i++)
-        *vrmlfile << Walker->node->at(i)-center->at(i) << " ";
+        *vrmlfile << Walker->at(i)-center->at(i) << " ";
       *vrmlfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour
       cloud->GoToNext();
@@ -576,5 +595,5 @@
       for (i=0;i<3;i++) { // print each node
         for (int j=0;j<NDIM;j++)  // and for each node all NDIM coordinates
-          *vrmlfile << TriangleRunner->second->endpoints[i]->node->node->at(j)-center->at(j) << " ";
+          *vrmlfile << TriangleRunner->second->endpoints[i]->node->at(j)-center->at(j) << " ";
         *vrmlfile << "\t";
       }
@@ -603,7 +622,7 @@
     Vector *center = cloud->GetCenter();
     // make the circumsphere's center absolute again
-    Vector helper = (1./3.) * ((*Tess->LastTriangle->endpoints[0]->node->node) +
-                               (*Tess->LastTriangle->endpoints[1]->node->node) +
-                               (*Tess->LastTriangle->endpoints[2]->node->node));
+    Vector helper = (1./3.) * ((Tess->LastTriangle->endpoints[0]->node->getPosition()) +
+                               (Tess->LastTriangle->endpoints[1]->node->getPosition()) +
+                               (Tess->LastTriangle->endpoints[2]->node->getPosition()));
     helper -= (*center);
     // and add to file plus translucency object
@@ -638,5 +657,5 @@
       *rasterfile << "2" << endl << "  ";  // 2 is sphere type
       for (int j=0;j<NDIM;j++) { // and for each node all NDIM coordinates
-        const double tmp = Walker->node->at(j)-center->at(j);
+        const double tmp = Walker->at(j)-center->at(j);
         *rasterfile << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
       }
@@ -651,5 +670,5 @@
       for (i=0;i<3;i++) {  // print each node
         for (int j=0;j<NDIM;j++) { // and for each node all NDIM coordinates
-          const double tmp = TriangleRunner->second->endpoints[i]->node->node->at(j)-center->at(j);
+          const double tmp = TriangleRunner->second->endpoints[i]->node->at(j)-center->at(j);
           *rasterfile << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
         }
@@ -705,5 +724,5 @@
       LookupList[Walker->nr] = Counter++;
       for (int i=0;i<NDIM;i++) {
-        const double tmp = Walker->node->at(i);
+        const double tmp = Walker->at(i);
         *tecplot << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
       }
@@ -754,5 +773,5 @@
     TriangleSet *triangles = TesselStruct->GetAllTriangles(PointRunner->second);
     for (TriangleSet::iterator TriangleRunner = triangles->begin(); TriangleRunner != triangles->end(); ++TriangleRunner) {
-      totalarea += CalculateAreaofGeneralTriangle(*(*TriangleRunner)->endpoints[0]->node->node, *(*TriangleRunner)->endpoints[1]->node->node, *(*TriangleRunner)->endpoints[2]->node->node);
+      totalarea += CalculateAreaofGeneralTriangle((*TriangleRunner)->endpoints[0]->node->getPosition() , (*TriangleRunner)->endpoints[1]->node->getPosition() , (*TriangleRunner)->endpoints[2]->node->getPosition());
     }
     ConcavityPerLine *= totalarea;
@@ -763,6 +782,6 @@
       line = (*TriangleRunner)->GetThirdLine(PointRunner->second);
       triangle = line->GetOtherTriangle(*TriangleRunner);
-      area = CalculateAreaofGeneralTriangle(*triangle->endpoints[0]->node->node, *triangle->endpoints[1]->node->node, *triangle->endpoints[2]->node->node);
-      area += CalculateAreaofGeneralTriangle(*(*TriangleRunner)->endpoints[0]->node->node, *(*TriangleRunner)->endpoints[1]->node->node, *(*TriangleRunner)->endpoints[2]->node->node);
+      area = CalculateAreaofGeneralTriangle(triangle->endpoints[0]->node->getPosition() , triangle->endpoints[1]->node->getPosition() , triangle->endpoints[2]->node->getPosition());
+      area += CalculateAreaofGeneralTriangle((*TriangleRunner)->endpoints[0]->node->getPosition() , (*TriangleRunner)->endpoints[1]->node->getPosition() , (*TriangleRunner)->endpoints[2]->node->getPosition());
       area *= -line->CalculateConvexity();
       if (area > 0)
@@ -797,5 +816,5 @@
     distance = 0.;
     for (TriangleMap::const_iterator TriangleRunner = Convex->TrianglesOnBoundary.begin(); TriangleRunner != Convex->TrianglesOnBoundary.end(); TriangleRunner++) {
-      const double CurrentDistance = Convex->GetDistanceSquaredToTriangle(*PointRunner->second->node->node, TriangleRunner->second);
+      const double CurrentDistance = Convex->GetDistanceSquaredToTriangle(PointRunner->second->node->getPosition() , TriangleRunner->second);
       if (CurrentDistance < distance)
         distance = CurrentDistance;
Index: src/tesselationhelpers.hpp
===================================================================
--- src/tesselationhelpers.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/tesselationhelpers.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -22,4 +22,5 @@
 #include <iosfwd>
 
+#include "BoundaryMaps.hpp"
 #include "defs.hpp"
 
@@ -29,4 +30,6 @@
 class BoundaryLineSet;
 class BoundaryTriangleSet;
+class BoundaryPolygonSet;
+class CandidateForTesselation;
 class LinkedCell;
 class TesselPoint;
@@ -37,12 +40,10 @@
 /********************************************** definitions *********************************/
 
-#define HULLEPSILON 1e-9 //!< TODO: Get rid of HULLEPSILON, points to numerical instabilities
-
 /********************************************** declarations *******************************/
 
-void GetSphere(Vector * const Center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS);
-void GetCenterOfSphere(Vector* const Center, const Vector &a, const Vector &b, const Vector &c, Vector * const NewUmkreismittelpunkt, const Vector* const Direction, const Vector* const AlternativeDirection, const double HalfplaneIndicator, const double AlternativeIndicator, const double alpha, const double beta, const double gamma, const double RADIUS, const double Umkreisradius);
-void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c);
-double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection);
+void GetSphere(Vector & Center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS);
+void GetCenterOfSphere(Vector& Center, const Vector &a, const Vector &b, const Vector &c, Vector &NewUmkreismittelpunkt, const Vector &Direction, const Vector* const AlternativeDirection, const double HalfplaneIndicator, const double AlternativeIndicator, const double alpha, const double beta, const double gamma, const double RADIUS, const double Umkreisradius);
+void GetCenterofCircumcircle(Vector & Center, const Vector &a, const Vector &b, const Vector &c);
+double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection, const double HULLEPSILON);
 double CalculateVolumeofGeneralTetraeder(const Vector &a, const Vector &b, const Vector &c, const Vector &d);
 double CalculateAreaofGeneralTriangle(const Vector &A, const Vector &B, const Vector &C);
@@ -51,6 +52,6 @@
 bool CheckLineCriteriaForDegeneratedTriangle(const BoundaryPointSet * const nodes[3]);
 bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation *candidate2);
-TesselPoint* FindClosestTesselPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC);
-TesselPoint* FindSecondClosestTesselPoint(const Vector*, const LinkedCell* const LC);
+TesselPoint* FindClosestTesselPoint(const Vector & Point, TesselPoint *&SecondPoint, const LinkedCell* const LC);
+TesselPoint* FindSecondClosestTesselPoint(const Vector &, const LinkedCell* const LC);
 Vector * GetClosestPointBetweenLine(const BoundaryLineSet * const Base, const BoundaryLineSet * const OtherBase);
 
@@ -61,5 +62,5 @@
 void CalculateConcavityPerBoundaryPoint(const Tesselation * const TesselStruct);
 void CalculateConstrictionPerBoundaryPoint(const Tesselation * const TesselStruct, const Tesselation * const Convex);
-double DistanceToTrianglePlane(const Vector *x, const BoundaryTriangleSet * const triangle);
+double DistanceToTrianglePlane(const Vector &x, const BoundaryTriangleSet * const triangle);
 
 bool CheckListOfBaselines(const Tesselation * const TesselStruct);
Index: src/test/ActOnAlltest.hpp
===================================================================
--- src/test/ActOnAlltest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/test/ActOnAlltest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -12,5 +12,5 @@
 
 #include <list>
-#include "../vector.hpp"
+#include "../LinearAlgebra/Vector.hpp"
 
 #define ListOfVectors list<Vector *>
Index: src/triangleintersectionlist.cpp
===================================================================
--- src/triangleintersectionlist.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/triangleintersectionlist.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * triangleintersectionlist.cpp
@@ -9,4 +16,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Helpers/MemDebug.hpp"
 
@@ -15,13 +27,17 @@
 #include "triangleintersectionlist.hpp"
 
-#include "info.hpp"
+#include "Helpers/Info.hpp"
+#include "BoundaryMaps.hpp"
+#include "BoundaryPointSet.hpp"
+#include "BoundaryLineSet.hpp"
+#include "BoundaryTriangleSet.hpp"
 #include "tesselation.hpp"
-#include "vector.hpp"
-#include "verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Helpers/Verbose.hpp"
 
 /** Constructor for class TriangleIntersectionList.
  *
  */
-TriangleIntersectionList::TriangleIntersectionList(const Vector *x, const Tesselation *surface, const LinkedCell* LC) :
+TriangleIntersectionList::TriangleIntersectionList(const Vector &x, const Tesselation *surface, const LinkedCell* LC) :
   Point(x),
   Tess(surface),
@@ -70,5 +86,5 @@
   }
   // return reference, if none can be found
-  return *Point;
+  return Point;
 };
 
@@ -99,5 +115,5 @@
   if (runner != IntersectionList.end()) {
     // if we have found one, check Scalarproduct between the vector
-    Vector TestVector = (*Point) - (*(*runner).second);
+    Vector TestVector = (Point) - (*(*runner).second);
     if (fabs(TestVector.NormSquared()) < MYEPSILON) //
       return true;
@@ -138,6 +154,6 @@
     // get intersection with triangle plane
     Intersection = new Vector;
-    (*TriangleRunner)->GetClosestPointInsideTriangle(Point, Intersection);
-    //Log() << Verbose(1) << "Intersection between " << *Point << " and " << **TriangleRunner << " is at " << *Intersection << "." << endl;
+    (*TriangleRunner)->GetClosestPointInsideTriangle(Point, *Intersection);
+    //Log() << Verbose(1) << "Intersection between " << Point << " and " << **TriangleRunner << " is at " << *Intersection << "." << endl;
     IntersectionList.insert( pair<BoundaryTriangleSet *, Vector * > (*TriangleRunner, Intersection) );
   }
@@ -151,5 +167,5 @@
   if (DistanceList.empty())
     for (TriangleVectorMap::const_iterator runner = IntersectionList.begin(); runner != IntersectionList.end(); runner++)
-      DistanceList.insert( pair<double, BoundaryTriangleSet *> (Point->distance(*(*runner).second), (*runner).first) );
+      DistanceList.insert( pair<double, BoundaryTriangleSet *> (Point.distance(*(*runner).second), (*runner).first) );
 
   //for (DistanceTriangleMap::const_iterator runner = DistanceList.begin(); runner != DistanceList.end(); runner++)
Index: src/triangleintersectionlist.hpp
===================================================================
--- src/triangleintersectionlist.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/triangleintersectionlist.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -39,5 +39,5 @@
 {
 public:
-  TriangleIntersectionList(const Vector *x, const Tesselation *surface, const LinkedCell* LC);
+  TriangleIntersectionList(const Vector &x, const Tesselation *surface, const LinkedCell* LC);
   ~TriangleIntersectionList();
 
@@ -52,5 +52,5 @@
   void FillDistanceList() const;
 
-  const Vector *Point;
+  const Vector &Point;
   const Tesselation *Tess;
   const LinkedCell *Vicinity;
Index: src/unittests/ActOnAllUnitTest.cpp
===================================================================
--- src/unittests/ActOnAllUnitTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/ActOnAllUnitTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ActOnAllUnitTest.cpp
@@ -5,4 +12,9 @@
  *      Author: FrederikHeber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -14,5 +26,5 @@
 #include "../test/ActOnAlltest.hpp"
 #include "ActOnAllUnitTest.hpp"
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 
 #ifdef HAVE_TESTRUNNER
Index: src/unittests/ActionSequenceTest.cpp
===================================================================
--- src/unittests/ActionSequenceTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/ActionSequenceTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ActionSequenzTest.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <cppunit/CompilerOutputter.h>
 #include <cppunit/extensions/TestFactoryRegistry.h>
@@ -35,4 +47,7 @@
   virtual ~canUndoActionStub(){}
 
+  virtual void getParametersfromValueStorage(){
+  }
+
   virtual Dialog* fillDialog(Dialog *dialog){
     ASSERT(dialog,"No Dialog given when filling action dialog");
@@ -62,4 +77,7 @@
   cannotUndoActionStub() : Action("cannotUndoActionStub",false){}
   virtual ~cannotUndoActionStub(){}
+
+  virtual void getParametersfromValueStorage(){
+  }
 
   virtual Dialog* fillDialog(Dialog *dialog){
@@ -93,4 +111,7 @@
   {}
   virtual ~wasCalledActionStub(){}
+
+  virtual void getParametersfromValueStorage(){
+  }
 
   virtual Dialog* fillDialog(Dialog *dialog){
@@ -243,12 +264,12 @@
 
   CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled());
-  CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled());
+  CPPUNIT_ASSERT_EQUAL(true,wasCalled2->wasCalled());
 
   ActionHistory::getInstance().undoLast();
 
   CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled());
-  CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled());
-
-}
-
-
+  CPPUNIT_ASSERT_EQUAL(false,wasCalled2->wasCalled());
+
+}
+
+
Index: src/unittests/AnalysisCorrelationToPointUnitTest.cpp
===================================================================
--- src/unittests/AnalysisCorrelationToPointUnitTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/AnalysisCorrelationToPointUnitTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AnalysisCorrelationToPointUnitTest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -46,5 +58,5 @@
 
   // construct element list
-  std::vector<element *> elements;
+  std::vector<const element *> elements;
   hydrogen = World::getInstance().getPeriode()->FindElement(1);
   CPPUNIT_ASSERT(hydrogen != NULL && "hydrogen element not found");
@@ -53,18 +65,18 @@
   TestMolecule = World::getInstance().createMolecule();
   Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(1., 0., 1. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(1., 0., 1. ));
   TestMolecule->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0., 1., 1. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0., 1., 1. ));
   TestMolecule->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(1., 1., 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(1., 1., 0. ));
   TestMolecule->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0., 0., 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0., 0., 0. ));
   TestMolecule->AddAtom(Walker);
 
Index: src/unittests/AnalysisCorrelationToPointUnitTest.hpp
===================================================================
--- src/unittests/AnalysisCorrelationToPointUnitTest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/AnalysisCorrelationToPointUnitTest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -37,5 +37,5 @@
       std::vector<molecule *> allMolecules;
       molecule *TestMolecule;
-      element *hydrogen;
+      const element *hydrogen;
 
       CorrelationToPointMap *pointmap;
Index: src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
===================================================================
--- src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AnalysisCorrelationToSurfaceUnitTest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -44,4 +56,6 @@
   ASSERT_DO(Assert::Throw);
 
+  setVerbosity(5);
+
   atom *Walker = NULL;
 
@@ -62,21 +76,21 @@
 
   Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(1., 0., 1. );
-  TestSurfaceMolecule->AddAtom(Walker);
-
-  Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0., 1., 1. );
-  TestSurfaceMolecule->AddAtom(Walker);
-
-  Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(1., 1., 0. );
-  TestSurfaceMolecule->AddAtom(Walker);
-
-  Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0., 0., 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(1., 0., 1. ));
+  TestSurfaceMolecule->AddAtom(Walker);
+
+  Walker = World::getInstance().createAtom();
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0., 1., 1. ));
+  TestSurfaceMolecule->AddAtom(Walker);
+
+  Walker = World::getInstance().createAtom();
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(1., 1., 0. ));
+  TestSurfaceMolecule->AddAtom(Walker);
+
+  Walker = World::getInstance().createAtom();
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0., 0., 0. ));
   TestSurfaceMolecule->AddAtom(Walker);
 
@@ -88,5 +102,5 @@
   // init tesselation and linked cell
   Surface = new Tesselation;
-  LC = new LinkedCell(TestSurfaceMolecule, 5.);
+  LC = new LinkedCell(*TestSurfaceMolecule, 5.);
   FindNonConvexBorder(TestSurfaceMolecule, Surface, (const LinkedCell *&)LC, 2.5, NULL);
 
@@ -95,22 +109,22 @@
   TestSurfaceMolecule = World::getInstance().createMolecule();
   Walker = World::getInstance().createAtom();
-  Walker->type = carbon;
-  *Walker->node = Vector(4., 0., 4. );
-  TestSurfaceMolecule->AddAtom(Walker);
-
-  Walker = World::getInstance().createAtom();
-  Walker->type = carbon;
-  *Walker->node = Vector(0., 4., 4. );
-  TestSurfaceMolecule->AddAtom(Walker);
-
-  Walker = World::getInstance().createAtom();
-  Walker->type = carbon;
-  *Walker->node = Vector(4., 4., 0. );
+  Walker->setType(carbon);
+  Walker->setPosition(Vector(4., 0., 4. ));
+  TestSurfaceMolecule->AddAtom(Walker);
+
+  Walker = World::getInstance().createAtom();
+  Walker->setType(carbon);
+  Walker->setPosition(Vector(0., 4., 4. ));
+  TestSurfaceMolecule->AddAtom(Walker);
+
+  Walker = World::getInstance().createAtom();
+  Walker->setType(carbon);
+  Walker->setPosition(Vector(4., 4., 0. ));
   TestSurfaceMolecule->AddAtom(Walker);
 
   // add inner atoms
   Walker = World::getInstance().createAtom();
-  Walker->type = carbon;
-  *Walker->node = Vector(0.5, 0.5, 0.5 );
+  Walker->setType(carbon);
+  Walker->setPosition(Vector(0.5, 0.5, 0.5 ));
   TestSurfaceMolecule->AddAtom(Walker);
 
Index: src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp
===================================================================
--- src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -45,7 +45,7 @@
       std::vector<molecule *> allMolecules;
       molecule *TestSurfaceMolecule;
-      element *hydrogen;
-      element *carbon;
-      std::vector<element *> elements;
+      const element *hydrogen;
+      const element *carbon;
+      std::vector<const element *> elements;
 
       CorrelationToSurfaceMap *surfacemap;
Index: src/unittests/AnalysisPairCorrelationUnitTest.cpp
===================================================================
--- src/unittests/AnalysisPairCorrelationUnitTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/AnalysisPairCorrelationUnitTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * AnalysisPairCorrelationUnitTest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -49,5 +61,5 @@
 
   // construct element list
-  std::vector<element *> elements;
+  std::vector<const element *> elements;
   hydrogen = World::getInstance().getPeriode()->FindElement(1);
   CPPUNIT_ASSERT(hydrogen != NULL && "hydrogen element not found");
@@ -58,18 +70,18 @@
   TestMolecule = World::getInstance().createMolecule();
   Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(1., 0., 1. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(1., 0., 1. ));
   TestMolecule->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0., 1., 1. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0., 1., 1. ));
   TestMolecule->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(1., 1., 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(1., 1., 0. ));
   TestMolecule->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0., 0., 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0., 0., 0. ));
   TestMolecule->AddAtom(Walker);
 
Index: src/unittests/AnalysisPairCorrelationUnitTest.hpp
===================================================================
--- src/unittests/AnalysisPairCorrelationUnitTest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/AnalysisPairCorrelationUnitTest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -37,5 +37,5 @@
       std::vector<molecule *> allMolecules;
       molecule *TestMolecule;
-      element *hydrogen;
+      const element *hydrogen;
 
       PairCorrelationMap *correlationmap;
Index: src/unittests/AtomDescriptorTest.cpp
===================================================================
--- src/unittests/AtomDescriptorTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/AtomDescriptorTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * DescriptorUnittest.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "AtomDescriptorTest.hpp"
Index: src/unittests/AtomDescriptorTest.hpp
===================================================================
--- src/unittests/AtomDescriptorTest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/AtomDescriptorTest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -13,5 +13,6 @@
 #include "types.hpp"
 
-#define ATOM_COUNT (10)
+// we prefer enum over define
+enum { ATOM_COUNT = 10 };
 
 class atom;
Index: src/unittests/BoxUnittest.cpp
===================================================================
--- src/unittests/BoxUnittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/BoxUnittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * BoxUnittest.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "BoxUnittest.hpp"
 
@@ -16,6 +28,6 @@
 #endif /*HAVE_TESTRUNNER*/
 
-#include "vector.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "Box.hpp"
 #include "Helpers/Assert.hpp"
Index: src/unittests/CacheableTest.cpp
===================================================================
--- src/unittests/CacheableTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/CacheableTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * CacheableTest.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "CacheableTest.hpp"
Index: src/unittests/CountBondsUnitTest.cpp
===================================================================
--- src/unittests/CountBondsUnitTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/CountBondsUnitTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * CountBondsUnitTest.cpp
@@ -6,4 +13,8 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -54,16 +65,16 @@
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(-0.2418, 0.9350, 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(-0.2418, 0.9350, 0. ));
   TestMolecule1->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0.9658, 0., 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0.9658, 0., 0. ));
   TestMolecule1->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = oxygen;
-  *Walker->node = Vector(0., 0., 0. );
+  Walker->setType(oxygen);
+  Walker->setPosition(Vector(0., 0., 0. ));
   TestMolecule1->AddAtom(Walker);
 
@@ -72,16 +83,16 @@
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(-0.2418, 0.9350, 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(-0.2418, 0.9350, 0. ));
   TestMolecule2->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0.9658, 0., 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0.9658, 0., 0. ));
   TestMolecule2->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = oxygen;
-  *Walker->node = Vector(0., 0., 0. );
+  Walker->setType(oxygen);
+  Walker->setPosition(Vector(0., 0., 0. ));
   TestMolecule2->AddAtom(Walker);
 
Index: src/unittests/FormulaUnittest.cpp
===================================================================
--- src/unittests/FormulaUnittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/FormulaUnittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * FormulaUnittest.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "FormulaUnittest.hpp"
@@ -185,4 +197,55 @@
   }
   {
+    Formula formula("CH2(COOH)2");
+    CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)4);
+    CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)4);
+    CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)3);
+    CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);
+  }
+  {
+    Formula formula("K4[Fe(CN)6]");
+    CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)6);
+    CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["K"],(unsigned int)4);
+    CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)1);
+    CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)6);
+  }
+  {
+    Formula formula("[CrCl3(H2O)3]");
+    CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)6);
+    CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)3);
+    CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["Cr"],(unsigned int)1);
+    CPPUNIT_ASSERT_EQUAL(formula["Cl"],(unsigned int)3);
+  }
+  {
+    Formula formula("Mg3[Fe(CN)6]2");
+    CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)12);
+    CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["Mg"],(unsigned int)3);
+    CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)2);
+    CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)12);
+  }
+  {
+    Formula formula("Na[Fe((HO2CCH2)2NCH2CH2N(CH2CO2H)2)]");
+    CPPUNIT_ASSERT_EQUAL(formula["H"],(unsigned int)16);
+    CPPUNIT_ASSERT_EQUAL(formula["O"],(unsigned int)8);
+    CPPUNIT_ASSERT_EQUAL(formula["C"],(unsigned int)10);
+    CPPUNIT_ASSERT_EQUAL(formula["Na"],(unsigned int)1);
+    CPPUNIT_ASSERT_EQUAL(formula["He"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["Mg"],(unsigned int)0);
+    CPPUNIT_ASSERT_EQUAL(formula["Fe"],(unsigned int)1);
+    CPPUNIT_ASSERT_EQUAL(formula["N"],(unsigned int)2);
+  }
+  {
     CPPUNIT_ASSERT_THROW(Formula formula("74107"),ParseError);
     CPPUNIT_ASSERT_THROW(Formula formula("  "),ParseError);
@@ -192,4 +255,14 @@
     CPPUNIT_ASSERT_THROW(Formula formula("1NaCl"),ParseError);
     CPPUNIT_ASSERT_THROW(Formula formula("Mag"),ParseError);
+    CPPUNIT_ASSERT_THROW(Formula formula("AgCl)"),ParseError);
+    CPPUNIT_ASSERT_THROW(Formula formula("(Na"),ParseError);
+    CPPUNIT_ASSERT_THROW(Formula formula("(Mag)"),ParseError);
+    CPPUNIT_ASSERT_THROW(Formula formula("MgCl2)"),ParseError);
+    CPPUNIT_ASSERT_THROW(Formula formula("((MgCl2)"),ParseError);
+    CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2))"),ParseError);
+    CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2]"),ParseError);
+    CPPUNIT_ASSERT_THROW(Formula formula("[MgCl2)"),ParseError);
+    CPPUNIT_ASSERT_THROW(Formula formula("N(aCl"),ParseError);
+    CPPUNIT_ASSERT_THROW(Formula formula("Na()Cl"),ParseError);
   }
 
Index: src/unittests/LineUnittest.cpp
===================================================================
--- src/unittests/LineUnittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/LineUnittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * LineUnittest.cpp
@@ -6,7 +13,12 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "LineUnittest.hpp"
 
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 #include "Exceptions/LinearDependenceException.hpp"
 #include "Exceptions/SkewException.hpp"
@@ -29,12 +41,12 @@
 void LineUnittest::setUp(){
   // three lines along the axes
-  la1 = new Line(zeroVec,e1);
-  la2 = new Line(zeroVec,e2);
-  la3 = new Line(zeroVec,e3);
+  la1 = new Line(zeroVec,unitVec[0]);
+  la2 = new Line(zeroVec,unitVec[1]);
+  la3 = new Line(zeroVec,unitVec[2]);
 
   // the lines along the planes defined by two coordinate axes
-  lp1 = new Line(e1,e1-e2);
-  lp2 = new Line(e2,e2-e3);
-  lp3 = new Line(e3,e3-e1);
+  lp1 = new Line(unitVec[0],unitVec[0]-unitVec[1]);
+  lp2 = new Line(unitVec[1],unitVec[1]-unitVec[2]);
+  lp3 = new Line(unitVec[2],unitVec[2]-unitVec[0]);
 }
 void LineUnittest::tearDown(){
@@ -52,21 +64,21 @@
 
   // direction+origin should never fail
-  CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,e1));
-  CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,e2));
-  CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,e3));
+  CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,unitVec[0]));
+  CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,unitVec[1]));
+  CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,unitVec[2]));
 
   // two points fails if both points are the same
-  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e1,e2));
-  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e2,e3));
-  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e3,e1));
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[0],unitVec[1]));
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[1],unitVec[2]));
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[2],unitVec[0]));
   // for zerovectors
-  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e1,zeroVec));
-  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e2,zeroVec));
-  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e3,zeroVec));
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[0],zeroVec));
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[1],zeroVec));
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(unitVec[2],zeroVec));
   // now we pass two times the same point
   CPPUNIT_ASSERT_THROW(makeLineThrough(zeroVec,zeroVec),LinearDependenceException);
-  CPPUNIT_ASSERT_THROW(makeLineThrough(e1,e1),LinearDependenceException);
-  CPPUNIT_ASSERT_THROW(makeLineThrough(e2,e2),LinearDependenceException);
-  CPPUNIT_ASSERT_THROW(makeLineThrough(e3,e3),LinearDependenceException);
+  CPPUNIT_ASSERT_THROW(makeLineThrough(unitVec[0],unitVec[0]),LinearDependenceException);
+  CPPUNIT_ASSERT_THROW(makeLineThrough(unitVec[1],unitVec[1]),LinearDependenceException);
+  CPPUNIT_ASSERT_THROW(makeLineThrough(unitVec[2],unitVec[2]),LinearDependenceException);
 
 }
@@ -78,7 +90,7 @@
 void LineUnittest::constructionResultTest(){
   // test all directions
-  CPPUNIT_ASSERT(testDirection(la1->getDirection(),e1));
-  CPPUNIT_ASSERT(testDirection(la2->getDirection(),e2));
-  CPPUNIT_ASSERT(testDirection(la3->getDirection(),e3));
+  CPPUNIT_ASSERT(testDirection(la1->getDirection(),unitVec[0]));
+  CPPUNIT_ASSERT(testDirection(la2->getDirection(),unitVec[1]));
+  CPPUNIT_ASSERT(testDirection(la3->getDirection(),unitVec[2]));
 
   // test origins
@@ -92,15 +104,15 @@
   CPPUNIT_ASSERT(la3->isContained(zeroVec));
 
-  CPPUNIT_ASSERT(la1->isContained(e1));
-  CPPUNIT_ASSERT(la2->isContained(e2));
-  CPPUNIT_ASSERT(la3->isContained(e3));
-
-  CPPUNIT_ASSERT(lp1->isContained(e1));
-  CPPUNIT_ASSERT(lp2->isContained(e2));
-  CPPUNIT_ASSERT(lp3->isContained(e3));
-
-  CPPUNIT_ASSERT(lp1->isContained(e2));
-  CPPUNIT_ASSERT(lp2->isContained(e3));
-  CPPUNIT_ASSERT(lp3->isContained(e1));
+  CPPUNIT_ASSERT(la1->isContained(unitVec[0]));
+  CPPUNIT_ASSERT(la2->isContained(unitVec[1]));
+  CPPUNIT_ASSERT(la3->isContained(unitVec[2]));
+
+  CPPUNIT_ASSERT(lp1->isContained(unitVec[0]));
+  CPPUNIT_ASSERT(lp2->isContained(unitVec[1]));
+  CPPUNIT_ASSERT(lp3->isContained(unitVec[2]));
+
+  CPPUNIT_ASSERT(lp1->isContained(unitVec[1]));
+  CPPUNIT_ASSERT(lp2->isContained(unitVec[2]));
+  CPPUNIT_ASSERT(lp3->isContained(unitVec[0]));
 }
 
@@ -112,54 +124,54 @@
 
   // multiples of the second support vector
-  CPPUNIT_ASSERT(la1->isContained(e1));
-  CPPUNIT_ASSERT(la2->isContained(e2));
-  CPPUNIT_ASSERT(la3->isContained(e3));
-
-  CPPUNIT_ASSERT(la1->isContained(2*e1));
-  CPPUNIT_ASSERT(la2->isContained(2*e2));
-  CPPUNIT_ASSERT(la3->isContained(2*e3));
-
-  CPPUNIT_ASSERT(la1->isContained(3*e1));
-  CPPUNIT_ASSERT(la2->isContained(3*e2));
-  CPPUNIT_ASSERT(la3->isContained(3*e3));
+  CPPUNIT_ASSERT(la1->isContained(unitVec[0]));
+  CPPUNIT_ASSERT(la2->isContained(unitVec[1]));
+  CPPUNIT_ASSERT(la3->isContained(unitVec[2]));
+
+  CPPUNIT_ASSERT(la1->isContained(2*unitVec[0]));
+  CPPUNIT_ASSERT(la2->isContained(2*unitVec[1]));
+  CPPUNIT_ASSERT(la3->isContained(2*unitVec[2]));
+
+  CPPUNIT_ASSERT(la1->isContained(3*unitVec[0]));
+  CPPUNIT_ASSERT(la2->isContained(3*unitVec[1]));
+  CPPUNIT_ASSERT(la3->isContained(3*unitVec[2]));
 
   // negative multiples
-  CPPUNIT_ASSERT(la1->isContained(-1*e1));
-  CPPUNIT_ASSERT(la2->isContained(-1*e2));
-  CPPUNIT_ASSERT(la3->isContained(-1*e3));
-
-  CPPUNIT_ASSERT(la1->isContained(-2*e1));
-  CPPUNIT_ASSERT(la2->isContained(-2*e2));
-  CPPUNIT_ASSERT(la3->isContained(-2*e3));
+  CPPUNIT_ASSERT(la1->isContained(-1*unitVec[0]));
+  CPPUNIT_ASSERT(la2->isContained(-1*unitVec[1]));
+  CPPUNIT_ASSERT(la3->isContained(-1*unitVec[2]));
+
+  CPPUNIT_ASSERT(la1->isContained(-2*unitVec[0]));
+  CPPUNIT_ASSERT(la2->isContained(-2*unitVec[1]));
+  CPPUNIT_ASSERT(la3->isContained(-2*unitVec[2]));
 
   // points that should not be on the lines
-  CPPUNIT_ASSERT(!la1->isContained(e2));
-  CPPUNIT_ASSERT(!la2->isContained(e3));
-  CPPUNIT_ASSERT(!la3->isContained(e1));
-
-  CPPUNIT_ASSERT(!la1->isContained(2*e2));
-  CPPUNIT_ASSERT(!la2->isContained(2*e3));
-  CPPUNIT_ASSERT(!la3->isContained(2*e1));
-
-  CPPUNIT_ASSERT(!la1->isContained(-1*e2));
-  CPPUNIT_ASSERT(!la2->isContained(-1*e3));
-  CPPUNIT_ASSERT(!la3->isContained(-1*e1));
+  CPPUNIT_ASSERT(!la1->isContained(unitVec[1]));
+  CPPUNIT_ASSERT(!la2->isContained(unitVec[2]));
+  CPPUNIT_ASSERT(!la3->isContained(unitVec[0]));
+
+  CPPUNIT_ASSERT(!la1->isContained(2*unitVec[1]));
+  CPPUNIT_ASSERT(!la2->isContained(2*unitVec[2]));
+  CPPUNIT_ASSERT(!la3->isContained(2*unitVec[0]));
+
+  CPPUNIT_ASSERT(!la1->isContained(-1*unitVec[1]));
+  CPPUNIT_ASSERT(!la2->isContained(-1*unitVec[2]));
+  CPPUNIT_ASSERT(!la3->isContained(-1*unitVec[0]));
 
   // For the plane lines
-  CPPUNIT_ASSERT(lp1->isContained(e1));
-  CPPUNIT_ASSERT(lp2->isContained(e2));
-  CPPUNIT_ASSERT(lp3->isContained(e3));
-
-  CPPUNIT_ASSERT(lp1->isContained(e2));
-  CPPUNIT_ASSERT(lp2->isContained(e3));
-  CPPUNIT_ASSERT(lp3->isContained(e1));
-
-  CPPUNIT_ASSERT(lp1->isContained(e1+2*(e1-e2)));
-  CPPUNIT_ASSERT(lp2->isContained(e2+2*(e2-e3)));
-  CPPUNIT_ASSERT(lp3->isContained(e3+2*(e3-e1)));
-
-  CPPUNIT_ASSERT(lp1->isContained(e1-2*(e1-e2)));
-  CPPUNIT_ASSERT(lp2->isContained(e2-2*(e2-e3)));
-  CPPUNIT_ASSERT(lp3->isContained(e3-2*(e3-e1)));
+  CPPUNIT_ASSERT(lp1->isContained(unitVec[0]));
+  CPPUNIT_ASSERT(lp2->isContained(unitVec[1]));
+  CPPUNIT_ASSERT(lp3->isContained(unitVec[2]));
+
+  CPPUNIT_ASSERT(lp1->isContained(unitVec[1]));
+  CPPUNIT_ASSERT(lp2->isContained(unitVec[2]));
+  CPPUNIT_ASSERT(lp3->isContained(unitVec[0]));
+
+  CPPUNIT_ASSERT(lp1->isContained(unitVec[0]+2*(unitVec[0]-unitVec[1])));
+  CPPUNIT_ASSERT(lp2->isContained(unitVec[1]+2*(unitVec[1]-unitVec[2])));
+  CPPUNIT_ASSERT(lp3->isContained(unitVec[2]+2*(unitVec[2]-unitVec[0])));
+
+  CPPUNIT_ASSERT(lp1->isContained(unitVec[0]-2*(unitVec[0]-unitVec[1])));
+  CPPUNIT_ASSERT(lp2->isContained(unitVec[1]-2*(unitVec[1]-unitVec[2])));
+  CPPUNIT_ASSERT(lp3->isContained(unitVec[2]-2*(unitVec[2]-unitVec[0])));
 }
 
@@ -177,24 +189,24 @@
   // axes and plane lines
   fixture = la1->getIntersection(*lp1);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
   fixture = la2->getIntersection(*lp2);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
   fixture = la3->getIntersection(*lp3);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
 
   fixture = la1->getIntersection(*lp3);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
   fixture = la2->getIntersection(*lp1);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
   fixture = la3->getIntersection(*lp2);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
 
   // two plane lines
   fixture = lp1->getIntersection(*lp2);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
   fixture = lp2->getIntersection(*lp3);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
   fixture = lp3->getIntersection(*lp1);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
 
   // When we have two times the same line, we check if the point is on the line
@@ -242,80 +254,80 @@
 
   // rotate vectors on the axis around their lines
-  fixture = la1->rotateVector(e1,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
-  fixture = la2->rotateVector(e2,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
-  fixture = la3->rotateVector(e3,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
-
-  fixture = la1->rotateVector(e1,2.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
-  fixture = la2->rotateVector(e2,2.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
-  fixture = la3->rotateVector(e3,2.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
+  fixture = la1->rotateVector(unitVec[0],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
+  fixture = la2->rotateVector(unitVec[1],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
+  fixture = la3->rotateVector(unitVec[2],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
+
+  fixture = la1->rotateVector(unitVec[0],2.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
+  fixture = la2->rotateVector(unitVec[1],2.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
+  fixture = la3->rotateVector(unitVec[2],2.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
 
   // more vectors on the axis
-  fixture = la1->rotateVector(2*e1,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,2*e1);
-  fixture = la2->rotateVector(2*e2,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,2*e2);
-  fixture = la3->rotateVector(2*e3,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,2*e3);
-
-  fixture = la1->rotateVector(2*e1,2.);
-  CPPUNIT_ASSERT_EQUAL(fixture,2*e1);
-  fixture = la2->rotateVector(2*e2,2.);
-  CPPUNIT_ASSERT_EQUAL(fixture,2*e2);
-  fixture = la3->rotateVector(2*e3,2.);
-  CPPUNIT_ASSERT_EQUAL(fixture,2*e3);
+  fixture = la1->rotateVector(2*unitVec[0],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[0]);
+  fixture = la2->rotateVector(2*unitVec[1],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[1]);
+  fixture = la3->rotateVector(2*unitVec[2],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[2]);
+
+  fixture = la1->rotateVector(2*unitVec[0],2.);
+  CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[0]);
+  fixture = la2->rotateVector(2*unitVec[1],2.);
+  CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[1]);
+  fixture = la3->rotateVector(2*unitVec[2],2.);
+  CPPUNIT_ASSERT_EQUAL(fixture,2*unitVec[2]);
 
   // negative factors
-  fixture = la1->rotateVector(-1*e1,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e1);
-  fixture = la2->rotateVector(-1*e2,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e2);
-  fixture = la3->rotateVector(-1*e3,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e3);
-
-  fixture = la1->rotateVector(-1*e1,2.);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e1);
-  fixture = la2->rotateVector(-1*e2,2.);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e2);
-  fixture = la3->rotateVector(-1*e3,2.);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e3);
+  fixture = la1->rotateVector(-1*unitVec[0],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[0]);
+  fixture = la2->rotateVector(-1*unitVec[1],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[1]);
+  fixture = la3->rotateVector(-1*unitVec[2],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[2]);
+
+  fixture = la1->rotateVector(-1*unitVec[0],2.);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[0]);
+  fixture = la2->rotateVector(-1*unitVec[1],2.);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[1]);
+  fixture = la3->rotateVector(-1*unitVec[2],2.);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[2]);
 
 
 
   // now the real rotations
-  // e2 around e1
-  fixture = la1->rotateVector(e2,0);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
-  fixture = la1->rotateVector(e2,1./2.*M_PI);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e3);
-  fixture = la1->rotateVector(e2,M_PI);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e2);
-  fixture = la1->rotateVector(e2,2*M_PI);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
-
-  // e3 around e2
-  fixture = la2->rotateVector(e3,0);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
-  fixture = la2->rotateVector(e3,1./2.*M_PI);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e1);
-  fixture = la2->rotateVector(e3,M_PI);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e3);
-  fixture = la2->rotateVector(e3,2*M_PI);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
-
-  // e1 around e3
-  fixture = la3->rotateVector(e1,0);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
-  fixture = la3->rotateVector(e1,1./2.*M_PI);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e2);
-  fixture = la3->rotateVector(e1,M_PI);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e1);
-  fixture = la3->rotateVector(e1,2*M_PI);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
+  // unitVec[1] around unitVec[0]
+  fixture = la1->rotateVector(unitVec[1],0);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
+  fixture = la1->rotateVector(unitVec[1],1./2.*M_PI);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[2]);
+  fixture = la1->rotateVector(unitVec[1],M_PI);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[1]);
+  fixture = la1->rotateVector(unitVec[1],2*M_PI);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
+
+  // unitVec[2] around unitVec[1]
+  fixture = la2->rotateVector(unitVec[2],0);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
+  fixture = la2->rotateVector(unitVec[2],1./2.*M_PI);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[0]);
+  fixture = la2->rotateVector(unitVec[2],M_PI);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[2]);
+  fixture = la2->rotateVector(unitVec[2],2*M_PI);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
+
+  // unitVec[0] around unitVec[2]
+  fixture = la3->rotateVector(unitVec[0],0);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
+  fixture = la3->rotateVector(unitVec[0],1./2.*M_PI);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[1]);
+  fixture = la3->rotateVector(unitVec[0],M_PI);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[0]);
+  fixture = la3->rotateVector(unitVec[0],2*M_PI);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
 
 
@@ -323,18 +335,18 @@
 
   // Vectors on the line
-  fixture = lp1->rotateVector(e1,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
-  fixture = lp1->rotateVector(e2,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
-
-  fixture = lp2->rotateVector(e2,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
-  fixture = lp2->rotateVector(e3,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
-
-  fixture = lp3->rotateVector(e3,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
-  fixture = lp3->rotateVector(e1,1.);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
+  fixture = lp1->rotateVector(unitVec[0],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
+  fixture = lp1->rotateVector(unitVec[1],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
+
+  fixture = lp2->rotateVector(unitVec[1],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
+  fixture = lp2->rotateVector(unitVec[2],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
+
+  fixture = lp3->rotateVector(unitVec[2],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
+  fixture = lp3->rotateVector(unitVec[0],1.);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
 
   // the real stuff
@@ -358,6 +370,6 @@
     std::vector<Vector> res = la1->getSphereIntersections();
     CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
-    CPPUNIT_ASSERT(testDirection(res[0],e1));
-    CPPUNIT_ASSERT(testDirection(res[1],e1));
+    CPPUNIT_ASSERT(testDirection(res[0],unitVec[0]));
+    CPPUNIT_ASSERT(testDirection(res[1],unitVec[0]));
     CPPUNIT_ASSERT(res[0]!=res[1]);
   }
@@ -366,6 +378,6 @@
     std::vector<Vector> res = la2->getSphereIntersections();
     CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
-    CPPUNIT_ASSERT(testDirection(res[0],e2));
-    CPPUNIT_ASSERT(testDirection(res[1],e2));
+    CPPUNIT_ASSERT(testDirection(res[0],unitVec[1]));
+    CPPUNIT_ASSERT(testDirection(res[1],unitVec[1]));
     CPPUNIT_ASSERT(res[0]!=res[1]);
   }
@@ -374,6 +386,6 @@
     std::vector<Vector> res = la3->getSphereIntersections();
     CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
-    CPPUNIT_ASSERT(testDirection(res[0],e3));
-    CPPUNIT_ASSERT(testDirection(res[1],e3));
+    CPPUNIT_ASSERT(testDirection(res[0],unitVec[2]));
+    CPPUNIT_ASSERT(testDirection(res[1],unitVec[2]));
     CPPUNIT_ASSERT(res[0]!=res[1]);
   }
@@ -382,6 +394,6 @@
     std::vector<Vector> res = lp1->getSphereIntersections();
     CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
-    CPPUNIT_ASSERT((res[0]==e1) || (res[0]==e2));
-    CPPUNIT_ASSERT((res[1]==e1) || (res[1]==e2));
+    CPPUNIT_ASSERT((res[0]==unitVec[0]) || (res[0]==unitVec[1]));
+    CPPUNIT_ASSERT((res[1]==unitVec[0]) || (res[1]==unitVec[1]));
     CPPUNIT_ASSERT(res[0]!=res[1]);
   }
@@ -390,6 +402,6 @@
     std::vector<Vector> res = lp2->getSphereIntersections();
     CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
-    CPPUNIT_ASSERT((res[0]==e2) || (res[0]==e3));
-    CPPUNIT_ASSERT((res[1]==e2) || (res[1]==e3));
+    CPPUNIT_ASSERT((res[0]==unitVec[1]) || (res[0]==unitVec[2]));
+    CPPUNIT_ASSERT((res[1]==unitVec[1]) || (res[1]==unitVec[2]));
     CPPUNIT_ASSERT(res[0]!=res[1]);
   }
@@ -398,7 +410,7 @@
     std::vector<Vector> res = lp3->getSphereIntersections();
     CPPUNIT_ASSERT_EQUAL(res.size(),(size_t)2);
-    CPPUNIT_ASSERT((res[0]==e3) || (res[0]==e1));
-    CPPUNIT_ASSERT((res[1]==e3) || (res[1]==e1));
-    CPPUNIT_ASSERT(res[0]!=res[1]);
-  }
-}
+    CPPUNIT_ASSERT((res[0]==unitVec[2]) || (res[0]==unitVec[0]));
+    CPPUNIT_ASSERT((res[1]==unitVec[2]) || (res[1]==unitVec[0]));
+    CPPUNIT_ASSERT(res[0]!=res[1]);
+  }
+}
Index: src/unittests/LineUnittest.hpp
===================================================================
--- src/unittests/LineUnittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/LineUnittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,5 +11,5 @@
 #include <cppunit/extensions/HelperMacros.h>
 
-#include "Line.hpp"
+#include "LinearAlgebra/Line.hpp"
 
 class LineUnittest : public CppUnit::TestFixture
Index: src/unittests/LinkedCellUnitTest.cpp
===================================================================
--- src/unittests/LinkedCellUnitTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/LinkedCellUnitTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * LinkedCellUnitTest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -50,11 +62,11 @@
         Walker = World::getInstance().createAtom();
         CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-        Walker->type = hydrogen;
-        *Walker->node = Vector(x, y, z );
+        Walker->setType(hydrogen);
+        Walker->setPosition(Vector(x, y, z ));
         TestMolecule->AddAtom(Walker);
       }
 
   // construct linked cell
-  LC = new LinkedCell (TestMolecule, 1.);
+  LC = new LinkedCell (*TestMolecule, 1.);
   CPPUNIT_ASSERT(LC != NULL && "could not create LinkedCell");
 
@@ -192,5 +204,5 @@
   atom *newAtom = World::getInstance().createAtom();
   newAtom->setName("test");
-  newAtom->x= Vector(1,1,1);
+  newAtom->setPosition(Vector(1,1,1));
   CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
   World::getInstance().destroyAtom(newAtom);
@@ -199,5 +211,5 @@
   newAtom = World::getInstance().createAtom();
   newAtom->setName("test");
-  newAtom->x = Vector(0,-1,0);
+  newAtom->setPosition(Vector(0,-1,0));
   CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
   World::getInstance().destroyAtom(newAtom);
@@ -216,5 +228,5 @@
       for (double z=0.5;z<3;z+=1.) {
         tester = Vector(x,y,z);
-        CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(&tester) );
+        CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) );
       }
   // check corners of each cell
@@ -224,5 +236,5 @@
         tester= Vector(x,y,z);
         cout << "Tester is at " << tester << "." << endl;
-        CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(&tester) );
+        CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) );
       }
   // check out of bounds
@@ -232,10 +244,10 @@
         tester = Vector(x,y,z);
         cout << "The following test is supposed to fail and produce an ERROR." << endl;
-        CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(&tester) );
+        CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) );
       }
   // check nonsense vectors
   tester= Vector(-423598,3245978,29349);
   cout << "The following test is supposed to fail and produce an ERROR." << endl;
-  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(&tester) );
+  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) );
 };
 
@@ -249,5 +261,5 @@
 
   tester= Vector(0.5,0.5,0.5);
-  LC->SetIndexToVector(&tester);
+  LC->SetIndexToVector(tester);
   LC->GetNeighbourBounds(lower, upper);
   for (int i=0;i<NDIM;i++)
@@ -268,5 +280,5 @@
   // get all atoms
   tester= Vector(1.5,1.5,1.5);
-  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
+  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
   ListOfPoints = LC->GetallNeighbours();
   size = ListOfPoints->size();
@@ -285,10 +297,10 @@
   // get all atoms in one corner
   tester= Vector(0.5, 0.5, 0.5);
-  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
+  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
   ListOfPoints = LC->GetallNeighbours();
   size=ListOfPoints->size();
   CPPUNIT_ASSERT_EQUAL( (size_t)8, size );
   for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){
-    if (((*iter)->x[0] <2) && ((*iter)->x[1] <2) && ((*iter)->x[2] <2)) {
+    if (((*iter)->at(0) <2) && ((*iter)->at(1) <2) && ((*iter)->at(2) <2)) {
       ListOfPoints->remove(*iter);
       size--;
@@ -303,5 +315,5 @@
   // get all atoms from one corner
   tester = Vector(0.5, 0.5, 0.5);
-  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
+  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
   ListOfPoints = LC->GetallNeighbours(3);
   size=ListOfPoints->size();
@@ -329,10 +341,10 @@
   // get all points around central arom with radius 1.
   tester= Vector(1.5,1.5,1.5);
-  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
+  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
   ListOfPoints = LC->GetPointsInsideSphere(1., &tester);
   size = ListOfPoints->size();
   CPPUNIT_ASSERT_EQUAL( (size_t)7, size );
   for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){
-    if (((*iter)->x.DistanceSquared(tester) - 1.) < MYEPSILON ) {
+    if (((*iter)->DistanceSquared(tester) - 1.) < MYEPSILON ) {
       ListOfPoints->remove(*iter);
       size--;
Index: src/unittests/Makefile.am
===================================================================
--- src/unittests/Makefile.am	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -49,14 +49,19 @@
 noinst_PROGRAMS = $(TESTS) TestRunner
 
-GSLLIBS = ../libgslwrapper.a ../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la $(BOOST_LIB) ${BOOST_THREAD_LIB}
+GSLLIBS = \
+	../LinearAlgebra/libMolecuilderLinearAlgebra-@MOLECUILDER_API_VERSION@.la \
+	../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la \
+	../Helpers/libMolecuilderHelpers-@MOLECUILDER_API_VERSION@.la \
+	$(BOOST_LIB) \
+	${BOOST_THREAD_LIB}
 ALLLIBS = \
-	../UIElements/libMolecuilderUI.a \
+	../UIElements/libMolecuilderUI-@MOLECUILDER_API_VERSION@.la \
 	../Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la \
-	../libmolecuilder.a \
-	../Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la \
+	${PARSERLIBS} \
+	../libMolecuilder-@MOLECUILDER_API_VERSION@.la \
 	${GSLLIBS} \
 	${BOOST_PROGRAM_OPTIONS_LIB}
-
-PARSERLIBS = ${ALLLIBS} 
+PARSERLIBS = ../Parser/libMolecuilderParser-@MOLECUILDER_API_VERSION@.la
+UILIBS = ../UIElements/libMolecuilderUI-@MOLECUILDER_API_VERSION@.la  
 
 TESTSOURCES = \
@@ -125,4 +130,5 @@
   MoleculeDescriptorTest.hpp \
   periodentafelTest.hpp \
+  ParserUnitTest.hpp \
   PlaneUnittest.hpp \
   ObserverTest.hpp \
@@ -136,5 +142,5 @@
 
 ActionSequenceTest_SOURCES = UnitTestMain.cpp ActionSequenceTest.cpp ActionSequenceTest.hpp
-ActionSequenceTest_LDADD = ../UIElements/libMolecuilderUI.a ../Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la ../libmolecuilder.a ../libparser.a ../libgslwrapper.a ../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
+ActionSequenceTest_LDADD = ${UILIBS} ${ALLLIBS}
 
 ActOnAllUnitTest_SOURCES = UnitTestMain.cpp ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp
@@ -175,11 +181,11 @@
 
 GSLMatrixSymmetricUnitTest_SOURCES = UnitTestMain.cpp gslmatrixsymmetricunittest.cpp gslmatrixsymmetricunittest.hpp
-GSLMatrixSymmetricUnitTest_LDADD = ${GSLLIBS}
+GSLMatrixSymmetricUnitTest_LDADD = ${ALLLIBS}
 
 GSLMatrixUnitTest_SOURCES = UnitTestMain.cpp gslmatrixunittest.cpp gslmatrixunittest.hpp
-GSLMatrixUnitTest_LDADD = ${GSLLIBS}
+GSLMatrixUnitTest_LDADD = ${ALLLIBS}
 
 GSLVectorUnitTest_SOURCES = UnitTestMain.cpp gslvectorunittest.cpp gslvectorunittest.hpp
-GSLVectorUnitTest_LDADD = ${GSLLIBS}
+GSLVectorUnitTest_LDADD = ${ALLLIBS}
 
 InfoUnitTest_SOURCES = UnitTestMain.cpp infounittest.cpp infounittest.hpp
@@ -202,5 +208,5 @@
 
 manipulateAtomsTest_SOURCES = UnitTestMain.cpp manipulateAtomsTest.cpp manipulateAtomsTest.hpp
-manipulateAtomsTest_LDADD = ../UIElements/libMolecuilderUI.a ../Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la ../libmolecuilder.a ../libparser.a ../libgslwrapper.a ../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
+manipulateAtomsTest_LDADD = ${UILIBS} ${ALLLIBS}
 
 MatrixUnittest_SOURCES = UnitTestMain.cpp MatrixUnittest.cpp MatrixUnittest.hpp
@@ -214,5 +220,5 @@
 
 ParserUnitTest_SOURCES = UnitTestMain.cpp ParserUnitTest.cpp ParserUnitTest.hpp
-ParserUnitTest_LDADD = ${PARSERLIBS}
+ParserUnitTest_LDADD = ${ALLLIBS} 
 
 periodentafelTest_SOURCES = UnitTestMain.cpp periodentafelTest.cpp periodentafelTest.hpp
@@ -241,5 +247,5 @@
 
 TestRunner_SOURCES = TestRunnerMain.cpp $(TESTSOURCES) $(TESTHEADERS)
-TestRunner_LDADD = ../UIElements/libMolecuilderUI.a ../Actions/libMolecuilderActions-@MOLECUILDER_API_VERSION@.la ../libmolecuilder.a ../libparser.a ../libgslwrapper.a ../Exceptions/libMolecuilderExceptions-@MOLECUILDER_API_VERSION@.la $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
+TestRunner_LDADD = ${UILIBS} ${ALLLIBS}
 
 VectorUnitTest_SOURCES = UnitTestMain.cpp vectorunittest.cpp vectorunittest.hpp 
Index: src/unittests/MapofActionsTest.cpp
===================================================================
--- src/unittests/MapofActionsTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/MapofActionsTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * analysisbondsunittest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
Index: src/unittests/MatrixUnittest.cpp
===================================================================
--- src/unittests/MatrixUnittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/MatrixUnittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MatrixUnittest.cpp
@@ -6,11 +13,18 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <cppunit/CompilerOutputter.h>
 #include <cppunit/extensions/TestFactoryRegistry.h>
 #include <cppunit/ui/text/TestRunner.h>
 
+#include <cmath>
+
 #include "MatrixUnittest.hpp"
-#include "Matrix.hpp"
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 #include "Exceptions/NotInvertibleException.hpp"
 
@@ -39,28 +53,28 @@
   }
   perm1 = new Matrix();
-  perm1->column(0) = e1;
-  perm1->column(1) = e3;
-  perm1->column(2) = e2;
+  perm1->column(0) = unitVec[0];
+  perm1->column(1) = unitVec[2];
+  perm1->column(2) = unitVec[1];
 
 
   perm2 = new Matrix();
-  perm2->column(0) = e2;
-  perm2->column(1) = e1;
-  perm2->column(2) = e3;
+  perm2->column(0) = unitVec[1];
+  perm2->column(1) = unitVec[0];
+  perm2->column(2) = unitVec[2];
 
   perm3 = new Matrix();
-  perm3->column(0) = e2;
-  perm3->column(1) = e3;
-  perm3->column(2) = e1;
+  perm3->column(0) = unitVec[1];
+  perm3->column(1) = unitVec[2];
+  perm3->column(2) = unitVec[0];
 
   perm4 = new Matrix();
-  perm4->column(0) = e3;
-  perm4->column(1) = e2;
-  perm4->column(2) = e1;
+  perm4->column(0) = unitVec[2];
+  perm4->column(1) = unitVec[1];
+  perm4->column(2) = unitVec[0];
 
   perm5 = new Matrix();
-  perm5->column(0) = e3;
-  perm5->column(1) = e1;
-  perm5->column(2) = e2;
+  perm5->column(0) = unitVec[2];
+  perm5->column(1) = unitVec[0];
+  perm5->column(2) = unitVec[1];
 
 }
@@ -108,10 +122,10 @@
 
   mat.one();
-  CPPUNIT_ASSERT_EQUAL(mat.row(0),e1);
-  CPPUNIT_ASSERT_EQUAL(mat.row(1),e2);
-  CPPUNIT_ASSERT_EQUAL(mat.row(2),e3);
-  CPPUNIT_ASSERT_EQUAL(mat.column(0),e1);
-  CPPUNIT_ASSERT_EQUAL(mat.column(1),e2);
-  CPPUNIT_ASSERT_EQUAL(mat.column(2),e3);
+  CPPUNIT_ASSERT_EQUAL(mat.row(0),unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL(mat.row(1),unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL(mat.row(2),unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL(mat.column(0),unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL(mat.column(1),unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL(mat.column(2),unitVec[2]);
 
   Vector t1=Vector(1.,1.,1.);
@@ -151,4 +165,18 @@
     }
   }
+}
+
+void MatrixUnittest::TransposeTest(){
+  Matrix res;
+
+  // transpose of unit is unit
+  res.one();
+  (const Matrix)res.transpose();
+  CPPUNIT_ASSERT_EQUAL(res,*one);
+
+  // transpose of transpose is same matrix
+  res.zero();
+  res.set(2,2, 1.);
+  CPPUNIT_ASSERT_EQUAL(res.transpose().transpose(),res);
 }
 
@@ -204,25 +232,46 @@
 
   res = (*diagonal)*(*perm1);
-  CPPUNIT_ASSERT_EQUAL(res.column(0),e1);
-  CPPUNIT_ASSERT_EQUAL(res.column(1),3*e3);
-  CPPUNIT_ASSERT_EQUAL(res.column(2),2*e2);
+  CPPUNIT_ASSERT_EQUAL(res.column(0),unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL(res.column(1),3*unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL(res.column(2),2*unitVec[1]);
   res = (*diagonal)*(*perm2);
-  CPPUNIT_ASSERT_EQUAL(res.column(0),2*e2);
-  CPPUNIT_ASSERT_EQUAL(res.column(1),e1);
-  CPPUNIT_ASSERT_EQUAL(res.column(2),3*e3);
+  CPPUNIT_ASSERT_EQUAL(res.column(0),2*unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL(res.column(1),unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL(res.column(2),3*unitVec[2]);
   res = (*diagonal)*(*perm3);
-  CPPUNIT_ASSERT_EQUAL(res.column(0),2*e2);
-  CPPUNIT_ASSERT_EQUAL(res.column(1),3*e3);
-  CPPUNIT_ASSERT_EQUAL(res.column(2),e1);
+  CPPUNIT_ASSERT_EQUAL(res.column(0),2*unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL(res.column(1),3*unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL(res.column(2),unitVec[0]);
   res = (*diagonal)*(*perm4);
-  CPPUNIT_ASSERT_EQUAL(res.column(0),3*e3);
-  CPPUNIT_ASSERT_EQUAL(res.column(1),2*e2);
-  CPPUNIT_ASSERT_EQUAL(res.column(2),e1);
+  CPPUNIT_ASSERT_EQUAL(res.column(0),3*unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL(res.column(1),2*unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL(res.column(2),unitVec[0]);
   res = (*diagonal)*(*perm5);
-  CPPUNIT_ASSERT_EQUAL(res.column(0),3*e3);
-  CPPUNIT_ASSERT_EQUAL(res.column(1),e1);
-  CPPUNIT_ASSERT_EQUAL(res.column(2),2*e2);
-}
-
+  CPPUNIT_ASSERT_EQUAL(res.column(0),3*unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL(res.column(1),unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL(res.column(2),2*unitVec[1]);
+}
+
+void MatrixUnittest::RotationTest(){
+  Matrix res;
+  Matrix inverse;
+
+  // zero rotation angles yields unity matrix
+  res.rotation(0,0,0);
+  CPPUNIT_ASSERT_EQUAL(*one, res);
+
+  // arbitrary rotation matrix has det = 1
+  res.rotation(M_PI/3.,1.,M_PI/7.);
+  CPPUNIT_ASSERT(fabs(fabs(res.determinant()) -1.) < MYEPSILON);
+
+  // inverse is rotation matrix with negative angles
+  res.rotation(M_PI/3.,0.,0.);
+  inverse.rotation(-M_PI/3.,0.,0.);
+  CPPUNIT_ASSERT_EQUAL(*one, res * inverse);
+
+  // ... or transposed
+  res.rotation(M_PI/3.,0.,0.);
+  CPPUNIT_ASSERT_EQUAL(inverse, ((const Matrix) res).transpose());
+}
 
 void MatrixUnittest::InvertTest(){
@@ -261,42 +310,42 @@
 
 void MatrixUnittest::VecMultTest(){
-  CPPUNIT_ASSERT_EQUAL((*zero)*e1,zeroVec);
-  CPPUNIT_ASSERT_EQUAL((*zero)*e2,zeroVec);
-  CPPUNIT_ASSERT_EQUAL((*zero)*e3,zeroVec);
+  CPPUNIT_ASSERT_EQUAL((*zero)*unitVec[0],zeroVec);
+  CPPUNIT_ASSERT_EQUAL((*zero)*unitVec[1],zeroVec);
+  CPPUNIT_ASSERT_EQUAL((*zero)*unitVec[2],zeroVec);
   CPPUNIT_ASSERT_EQUAL((*zero)*zeroVec,zeroVec);
 
-  CPPUNIT_ASSERT_EQUAL((*one)*e1,e1);
-  CPPUNIT_ASSERT_EQUAL((*one)*e2,e2);
-  CPPUNIT_ASSERT_EQUAL((*one)*e3,e3);
+  CPPUNIT_ASSERT_EQUAL((*one)*unitVec[0],unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL((*one)*unitVec[1],unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL((*one)*unitVec[2],unitVec[2]);
   CPPUNIT_ASSERT_EQUAL((*one)*zeroVec,zeroVec);
 
-  CPPUNIT_ASSERT_EQUAL((*diagonal)*e1,e1);
-  CPPUNIT_ASSERT_EQUAL((*diagonal)*e2,2*e2);
-  CPPUNIT_ASSERT_EQUAL((*diagonal)*e3,3*e3);
+  CPPUNIT_ASSERT_EQUAL((*diagonal)*unitVec[0],unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL((*diagonal)*unitVec[1],2*unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL((*diagonal)*unitVec[2],3*unitVec[2]);
   CPPUNIT_ASSERT_EQUAL((*diagonal)*zeroVec,zeroVec);
 
-  CPPUNIT_ASSERT_EQUAL((*perm1)*e1,e1);
-  CPPUNIT_ASSERT_EQUAL((*perm1)*e2,e3);
-  CPPUNIT_ASSERT_EQUAL((*perm1)*e3,e2);
+  CPPUNIT_ASSERT_EQUAL((*perm1)*unitVec[0],unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL((*perm1)*unitVec[1],unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL((*perm1)*unitVec[2],unitVec[1]);
   CPPUNIT_ASSERT_EQUAL((*perm1)*zeroVec,zeroVec);
 
-  CPPUNIT_ASSERT_EQUAL((*perm2)*e1,e2);
-  CPPUNIT_ASSERT_EQUAL((*perm2)*e2,e1);
-  CPPUNIT_ASSERT_EQUAL((*perm2)*e3,e3);
+  CPPUNIT_ASSERT_EQUAL((*perm2)*unitVec[0],unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL((*perm2)*unitVec[1],unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL((*perm2)*unitVec[2],unitVec[2]);
   CPPUNIT_ASSERT_EQUAL((*perm2)*zeroVec,zeroVec);
 
-  CPPUNIT_ASSERT_EQUAL((*perm3)*e1,e2);
-  CPPUNIT_ASSERT_EQUAL((*perm3)*e2,e3);
-  CPPUNIT_ASSERT_EQUAL((*perm3)*e3,e1);
+  CPPUNIT_ASSERT_EQUAL((*perm3)*unitVec[0],unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL((*perm3)*unitVec[1],unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL((*perm3)*unitVec[2],unitVec[0]);
   CPPUNIT_ASSERT_EQUAL((*perm3)*zeroVec,zeroVec);
 
-  CPPUNIT_ASSERT_EQUAL((*perm4)*e1,e3);
-  CPPUNIT_ASSERT_EQUAL((*perm4)*e2,e2);
-  CPPUNIT_ASSERT_EQUAL((*perm4)*e3,e1);
+  CPPUNIT_ASSERT_EQUAL((*perm4)*unitVec[0],unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL((*perm4)*unitVec[1],unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL((*perm4)*unitVec[2],unitVec[0]);
   CPPUNIT_ASSERT_EQUAL((*perm4)*zeroVec,zeroVec);
 
-  CPPUNIT_ASSERT_EQUAL((*perm5)*e1,e3);
-  CPPUNIT_ASSERT_EQUAL((*perm5)*e2,e1);
-  CPPUNIT_ASSERT_EQUAL((*perm5)*e3,e2);
+  CPPUNIT_ASSERT_EQUAL((*perm5)*unitVec[0],unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL((*perm5)*unitVec[1],unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL((*perm5)*unitVec[2],unitVec[1]);
   CPPUNIT_ASSERT_EQUAL((*perm5)*zeroVec,zeroVec);
 
Index: src/unittests/MatrixUnittest.hpp
===================================================================
--- src/unittests/MatrixUnittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/MatrixUnittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -19,4 +19,6 @@
   CPPUNIT_TEST ( VectorTest );
   CPPUNIT_TEST ( OperationTest );
+  CPPUNIT_TEST ( TransposeTest );
+  CPPUNIT_TEST ( RotationTest );
   CPPUNIT_TEST ( InvertTest );
   CPPUNIT_TEST ( DeterminantTest );
@@ -31,4 +33,6 @@
   void VectorTest();
   void OperationTest();
+  void TransposeTest();
+  void RotationTest();
   void InvertTest();
   void DeterminantTest();
Index: src/unittests/MoleculeDescriptorTest.cpp
===================================================================
--- src/unittests/MoleculeDescriptorTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/MoleculeDescriptorTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * MoleculeDescriptorTest.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "MoleculeDescriptorTest.hpp"
Index: src/unittests/MoleculeDescriptorTest.hpp
===================================================================
--- src/unittests/MoleculeDescriptorTest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/MoleculeDescriptorTest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -13,5 +13,6 @@
 #include "types.hpp"
 
-#define MOLECULE_COUNT (10)
+// we prefer enum over define
+enum { MOLECULE_COUNT = 10 };
 
 class molecule;
Index: src/unittests/ObserverTest.cpp
===================================================================
--- src/unittests/ObserverTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/ObserverTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ObserverTest.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "ObserverTest.hpp"
Index: src/unittests/ParserUnitTest.cpp
===================================================================
--- src/unittests/ParserUnitTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/ParserUnitTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ParserUnitTest.cpp
@@ -5,4 +12,9 @@
  *      Author: metzler
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "ParserUnitTest.hpp"
@@ -139,5 +151,5 @@
 static string Tremolo_improper = "#\n#ATOMDATA Id Type imprData\n8 H 9-10\n9 H 10-8,8-10\n10 O -\n";
 static string Tremolo_torsion = "#\n#ATOMDATA Id Type torsion\n8 H 9-10\n9 H 10-8,8-10\n10 O -\n";
-static string Tremolo_full = "# ATOMDATA\tx=3\tu=3\tF\tstress\tId\tneighbors=5\timprData\tGroupMeasureTypeNo\tType\textType\tname\tresName\tchainID\tresSeq\toccupancy\ttempFactor\tsegID\tCharge\tcharge\tGrpTypeNo\ttorsion\n0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t-\t0\tH\t-\t-\t-\t0\t0\t0\t0\t0\t0\t0\t0\t-\t\n";
+static string Tremolo_full = "# ATOMDATA\tx=3\tu=3\tF\tstress\tId\tneighbors=5\timprData\tGroupMeasureTypeNo\tType\textType\tname\tresName\tchainID\tresSeq\toccupancy\ttempFactor\tsegID\tCharge\tcharge\tGrpTypeNo\ttorsion\n0\t0\t0\t0\t0\t0\t0\t0\t1\t0\t0\t0\t0\t0\t-\t0\tH\t-\t-\t-\t0\t0\t0\t0\t0\t0\t0\t0\t-\t\n";
 
 void ParserUnitTest::setUp() {
@@ -208,5 +220,5 @@
   input << Tremolo_Atomdata2;
   testParser->load(&input);
-  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->x[0] == 3.0);
+  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->at(0) == 3.0);
   input.clear();
 }
@@ -219,5 +231,5 @@
   input << Tremolo_velocity;
   testParser->load(&input);
-  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->v[0] == 3.0);
+  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->AtomicVelocity[0] == 3.0);
   input.clear();
 }
@@ -271,5 +283,5 @@
   // with the maximum number of fields and minimal information, default values are printed
   atom* newAtom = World::getInstance().createAtom();
-  newAtom->type = World::getInstance().getPeriode()->FindElement(1);
+  newAtom->setType(1);
   testParser->setFieldsForSave("x=3 u=3 F stress Id neighbors=5 imprData GroupMeasureTypeNo Type extType name resName chainID resSeq occupancy tempFactor segID Charge charge GrpTypeNo torsion");
   testParser->save(&output);
@@ -304,12 +316,12 @@
   atom *Walker = NULL;
   Walker = World::getInstance().createAtom();
-  Walker->type = World::getInstance().getPeriode()->FindElement(8);
-  Walker->x = Vector(0,0,0);
+  Walker->setType(8);
+  Walker->setPosition(Vector(0,0,0));
   Walker = World::getInstance().createAtom();
-  Walker->type = World::getInstance().getPeriode()->FindElement(1);
-  Walker->x = Vector(0.758602,0,0.504284);
+  Walker->setType(1);
+  Walker->setPosition(Vector(0.758602,0,0.504284));
   Walker = World::getInstance().createAtom();
-  Walker->type = World::getInstance().getPeriode()->FindElement(1);
-  Walker->x = Vector(0.758602,0,-0.504284);
+  Walker->setType(1);
+  Walker->setPosition(Vector(0.758602,0,-0.504284));
   CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
 
Index: src/unittests/PlaneUnittest.cpp
===================================================================
--- src/unittests/PlaneUnittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/PlaneUnittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * PlaneUnittest.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "PlaneUnittest.hpp"
 
@@ -18,14 +30,14 @@
 #endif /*HAVE_TESTRUNNER*/
 
-#include "vector.hpp"
-#include "Line.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/Line.hpp"
 
 CPPUNIT_TEST_SUITE_REGISTRATION( PlaneUnittest );
 
 void PlaneUnittest::setUp(){
-  p1 = new Plane(e1,e2,e3);
-  p2 = new Plane(e1,e2,zeroVec);
-  p3 = new Plane(e1,zeroVec,e3);
-  p4 = new Plane(zeroVec,e2,e3);
+  p1 = new Plane(unitVec[0],unitVec[1],unitVec[2]);
+  p2 = new Plane(unitVec[0],unitVec[1],zeroVec);
+  p3 = new Plane(unitVec[0],zeroVec,unitVec[2]);
+  p4 = new Plane(zeroVec,unitVec[1],unitVec[2]);
 }
 
@@ -42,24 +54,24 @@
 
   // three points
-  CPPUNIT_ASSERT_NO_THROW(Plane(e1,e2,e3));
+  CPPUNIT_ASSERT_NO_THROW(Plane(unitVec[0],unitVec[1],unitVec[2]));
   // when only two points are differnt this gives an error
-  CPPUNIT_ASSERT_THROW(Plane(e1,e2,e2),LinearDependenceException);
+  CPPUNIT_ASSERT_THROW(Plane(unitVec[0],unitVec[1],unitVec[1]),LinearDependenceException);
   // same with only one point
-  CPPUNIT_ASSERT_THROW(Plane(e1,e1,e1),LinearDependenceException);
+  CPPUNIT_ASSERT_THROW(Plane(unitVec[0],unitVec[0],unitVec[0]),LinearDependenceException);
 
   // use two vector giving two directions
-  CPPUNIT_ASSERT_NO_THROW(Plane(e1,e2,0));
+  CPPUNIT_ASSERT_NO_THROW(Plane(unitVec[0],unitVec[1],0));
   // and again this is actually only one vector
-  CPPUNIT_ASSERT_THROW(Plane(e1,e1,0),LinearDependenceException);
+  CPPUNIT_ASSERT_THROW(Plane(unitVec[0],unitVec[0],0),LinearDependenceException);
   // Zero vector does not give a good direction
-  CPPUNIT_ASSERT_THROW(Plane(e1,zeroVec,0),ZeroVectorException);
+  CPPUNIT_ASSERT_THROW(Plane(unitVec[0],zeroVec,0),ZeroVectorException);
 
   // use a normalvector and an scalar offset
-  CPPUNIT_ASSERT_NO_THROW(Plane(e1,0));
+  CPPUNIT_ASSERT_NO_THROW(Plane(unitVec[0],0));
   // The zero vector is no good as a normalvector
   CPPUNIT_ASSERT_THROW(Plane(zeroVec,0),ZeroVectorException);
 
   // use a normalvector and an offset vector
-  CPPUNIT_ASSERT_NO_THROW(Plane(e1,zeroVec));
+  CPPUNIT_ASSERT_NO_THROW(Plane(unitVec[0],zeroVec));
   // and the bad zeroVector again
   CPPUNIT_ASSERT_THROW(Plane(zeroVec,zeroVec),ZeroVectorException);
@@ -75,28 +87,28 @@
   {
     // construct with three points on plane
-    Plane p1(e1,e2,zeroVec);
-    CPPUNIT_ASSERT(testNormal(e3,p1.getNormal()));
+    Plane p1(unitVec[0],unitVec[1],zeroVec);
+    CPPUNIT_ASSERT(testNormal(unitVec[2],p1.getNormal()));
     CPPUNIT_ASSERT_EQUAL(0.,p1.getOffset());
 
-    Plane p2(e1,e3,zeroVec);
-    CPPUNIT_ASSERT(testNormal(e2,p2.getNormal()));
+    Plane p2(unitVec[0],unitVec[2],zeroVec);
+    CPPUNIT_ASSERT(testNormal(unitVec[1],p2.getNormal()));
     CPPUNIT_ASSERT_EQUAL(0.,p2.getOffset());
 
-    Plane p3(e2,e3,zeroVec);
-    CPPUNIT_ASSERT(testNormal(e1,p3.getNormal()));
+    Plane p3(unitVec[1],unitVec[2],zeroVec);
+    CPPUNIT_ASSERT(testNormal(unitVec[0],p3.getNormal()));
     CPPUNIT_ASSERT_EQUAL(0.,p3.getOffset());
   }
   {
     // construct with two directions + offset
-    Plane p1(e1,e2,0);
-    CPPUNIT_ASSERT(testNormal(e3,p1.getNormal()));
+    Plane p1(unitVec[0],unitVec[1],0);
+    CPPUNIT_ASSERT(testNormal(unitVec[2],p1.getNormal()));
     CPPUNIT_ASSERT_EQUAL(0.,p1.getOffset());
 
-    Plane p2(e1,e3,0);
-    CPPUNIT_ASSERT(testNormal(e2,p2.getNormal()));
+    Plane p2(unitVec[0],unitVec[2],0);
+    CPPUNIT_ASSERT(testNormal(unitVec[1],p2.getNormal()));
     CPPUNIT_ASSERT_EQUAL(0.,p2.getOffset());
 
-    Plane p3(e2,e3,0);
-    CPPUNIT_ASSERT(testNormal(e1,p3.getNormal()));
+    Plane p3(unitVec[1],unitVec[2],0);
+    CPPUNIT_ASSERT(testNormal(unitVec[0],p3.getNormal()));
     CPPUNIT_ASSERT_EQUAL(0.,p3.getOffset());
   }
@@ -145,15 +157,15 @@
 void PlaneUnittest::operationsTest(){
   {
-    Vector t = (1./3.)*(e1+e2+e3);
+    Vector t = (1./3.)*(unitVec[0]+unitVec[1]+unitVec[2]);
     CPPUNIT_ASSERT(fabs(p1->distance(zeroVec)-t.Norm()) < MYEPSILON);
     CPPUNIT_ASSERT_EQUAL(t,p1->getClosestPoint(zeroVec));
   }
 
-  CPPUNIT_ASSERT(fabs(p2->distance(e3)-1) < MYEPSILON);
-  CPPUNIT_ASSERT_EQUAL(zeroVec,p2->getClosestPoint(e3));
-  CPPUNIT_ASSERT(fabs(p3->distance(e2)-1) < MYEPSILON);
-  CPPUNIT_ASSERT_EQUAL(zeroVec,p3->getClosestPoint(e2));
-  CPPUNIT_ASSERT(fabs(p4->distance(e1)-1) < MYEPSILON);
-  CPPUNIT_ASSERT_EQUAL(zeroVec,p4->getClosestPoint(e1));
+  CPPUNIT_ASSERT(fabs(p2->distance(unitVec[2])-1) < MYEPSILON);
+  CPPUNIT_ASSERT_EQUAL(zeroVec,p2->getClosestPoint(unitVec[2]));
+  CPPUNIT_ASSERT(fabs(p3->distance(unitVec[1])-1) < MYEPSILON);
+  CPPUNIT_ASSERT_EQUAL(zeroVec,p3->getClosestPoint(unitVec[1]));
+  CPPUNIT_ASSERT(fabs(p4->distance(unitVec[0])-1) < MYEPSILON);
+  CPPUNIT_ASSERT_EQUAL(zeroVec,p4->getClosestPoint(unitVec[0]));
 }
 
@@ -162,45 +174,45 @@
 
   // some Vectors that lie on the planes
-  fixture = p1->mirrorVector(e1);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
-  fixture = p1->mirrorVector(e2);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
-  fixture = p1->mirrorVector(e3);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
+  fixture = p1->mirrorVector(unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
+  fixture = p1->mirrorVector(unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
+  fixture = p1->mirrorVector(unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
 
   fixture = p2->mirrorVector(zeroVec);
   CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
-  fixture = p2->mirrorVector(e1);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
-  fixture = p2->mirrorVector(e2);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
+  fixture = p2->mirrorVector(unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
+  fixture = p2->mirrorVector(unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
 
   fixture = p3->mirrorVector(zeroVec);
   CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
-  fixture = p3->mirrorVector(e1);
-  CPPUNIT_ASSERT_EQUAL(fixture,e1);
-  fixture = p3->mirrorVector(e3);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
+  fixture = p3->mirrorVector(unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[0]);
+  fixture = p3->mirrorVector(unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
 
   fixture = p4->mirrorVector(zeroVec);
   CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
-  fixture = p4->mirrorVector(e2);
-  CPPUNIT_ASSERT_EQUAL(fixture,e2);
-  fixture = p4->mirrorVector(e3);
-  CPPUNIT_ASSERT_EQUAL(fixture,e3);
+  fixture = p4->mirrorVector(unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[1]);
+  fixture = p4->mirrorVector(unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL(fixture,unitVec[2]);
 
   // some Vectors outside of the planes
   {
-    Vector t = (2./3.)*(e1+e2+e3);
+    Vector t = (2./3.)*(unitVec[0]+unitVec[1]+unitVec[2]);
     fixture = p1->mirrorVector(zeroVec);
     CPPUNIT_ASSERT_EQUAL(fixture,t);
   }
 
-  fixture = p2->mirrorVector(e3);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e3);
-  fixture = p3->mirrorVector(e2);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e2);
-  fixture = p4->mirrorVector(e1);
-  CPPUNIT_ASSERT_EQUAL(fixture,-1*e1);
+  fixture = p2->mirrorVector(unitVec[2]);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[2]);
+  fixture = p3->mirrorVector(unitVec[1]);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[1]);
+  fixture = p4->mirrorVector(unitVec[0]);
+  CPPUNIT_ASSERT_EQUAL(fixture,-1*unitVec[0]);
 }
 
@@ -209,10 +221,10 @@
   // plane at (0,0,0) normal to (1,0,0) cuts line from (0,0,0) to (2,1,0) at ???
   Line l1 = makeLineThrough(zeroVec,Vector(2,1,0));
-  CPPUNIT_ASSERT_NO_THROW(fixture = Plane(e1, zeroVec).GetIntersection(l1) );
+  CPPUNIT_ASSERT_NO_THROW(fixture = Plane(unitVec[0], zeroVec).GetIntersection(l1) );
   CPPUNIT_ASSERT_EQUAL( zeroVec, fixture );
 
   // plane at (2,1,0) normal to (0,1,0) cuts line from (1,0,0) to (0,1,1) at ???
-  Line l2 = makeLineThrough(e1,Vector(0,1,1));
-  CPPUNIT_ASSERT_NO_THROW(fixture = Plane(e2, Vector(2,1,0)).GetIntersection(l2) );
+  Line l2 = makeLineThrough(unitVec[0],Vector(0,1,1));
+  CPPUNIT_ASSERT_NO_THROW(fixture = Plane(unitVec[1], Vector(2,1,0)).GetIntersection(l2) );
   CPPUNIT_ASSERT_EQUAL( Vector(0., 1., 1.), fixture );
 }
Index: src/unittests/PlaneUnittest.hpp
===================================================================
--- src/unittests/PlaneUnittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/PlaneUnittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,5 +11,5 @@
 #include <cppunit/extensions/HelperMacros.h>
 
-#include "Plane.hpp"
+#include "LinearAlgebra/Plane.hpp"
 
 class PlaneUnittest : public CppUnit::TestFixture
Index: src/unittests/ShapeUnittest.cpp
===================================================================
--- src/unittests/ShapeUnittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/ShapeUnittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * ShapeUnittest.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "ShapeUnittest.hpp"
 
@@ -12,10 +24,14 @@
 #include <cppunit/ui/text/TestRunner.h>
 
+#include <cmath>
+
 #ifdef HAVE_TESTRUNNER
 #include "UnitTestMain.hpp"
 #endif /*HAVE_TESTRUNNER*/
 
+#include "LinearAlgebra/Vector.hpp"
 #include "Shapes/Shape.hpp"
-#include "vector.cpp"
+
+#include "Shapes/BaseShapes.hpp"
 
 // Registers the fixture into the 'registry'
@@ -24,31 +40,31 @@
 void ShapeUnittest::setUp()
 {
-  v000 =  0*e1+0*e2+0*e3;
-  v100 =  1*e1+0*e2+0*e3;
-  v200 = -1*e1+0*e2+0*e3;
-  v010 =  0*e1+1*e2+0*e3;
-  v110 =  1*e1+1*e2+0*e3;
-  v210 = -1*e1+1*e2+0*e3;
-  v020 =  0*e1-1*e2+0*e3;
-  v120 =  1*e1-1*e2+0*e3;
-  v220 = -1*e1-1*e2+0*e3;
-  v001 =  0*e1+0*e2+1*e3;
-  v101 =  1*e1+0*e2+1*e3;
-  v201 = -1*e1+0*e2+1*e3;
-  v011 =  0*e1+1*e2+1*e3;
-  v111 =  1*e1+1*e2+1*e3;
-  v211 = -1*e1+1*e2+1*e3;
-  v021 =  0*e1-1*e2+1*e3;
-  v121 =  1*e1-1*e2+1*e3;
-  v221 = -1*e1-1*e2+1*e3;
-  v002 =  0*e1+0*e2-1*e3;
-  v102 =  1*e1+0*e2-1*e3;
-  v202 = -1*e1+0*e2-1*e3;
-  v012 =  0*e1+1*e2-1*e3;
-  v112 =  1*e1+1*e2-1*e3;
-  v212 = -1*e1+1*e2-1*e3;
-  v022 =  0*e1-1*e2-1*e3;
-  v122 =  1*e1-1*e2-1*e3;
-  v222 = -1*e1-1*e2-1*e3;
+  v000 =  0*unitVec[0]+0*unitVec[1]+0*unitVec[2];
+  v100 =  1*unitVec[0]+0*unitVec[1]+0*unitVec[2];
+  v200 = -1*unitVec[0]+0*unitVec[1]+0*unitVec[2];
+  v010 =  0*unitVec[0]+1*unitVec[1]+0*unitVec[2];
+  v110 =  1*unitVec[0]+1*unitVec[1]+0*unitVec[2];
+  v210 = -1*unitVec[0]+1*unitVec[1]+0*unitVec[2];
+  v020 =  0*unitVec[0]-1*unitVec[1]+0*unitVec[2];
+  v120 =  1*unitVec[0]-1*unitVec[1]+0*unitVec[2];
+  v220 = -1*unitVec[0]-1*unitVec[1]+0*unitVec[2];
+  v001 =  0*unitVec[0]+0*unitVec[1]+1*unitVec[2];
+  v101 =  1*unitVec[0]+0*unitVec[1]+1*unitVec[2];
+  v201 = -1*unitVec[0]+0*unitVec[1]+1*unitVec[2];
+  v011 =  0*unitVec[0]+1*unitVec[1]+1*unitVec[2];
+  v111 =  1*unitVec[0]+1*unitVec[1]+1*unitVec[2];
+  v211 = -1*unitVec[0]+1*unitVec[1]+1*unitVec[2];
+  v021 =  0*unitVec[0]-1*unitVec[1]+1*unitVec[2];
+  v121 =  1*unitVec[0]-1*unitVec[1]+1*unitVec[2];
+  v221 = -1*unitVec[0]-1*unitVec[1]+1*unitVec[2];
+  v002 =  0*unitVec[0]+0*unitVec[1]-1*unitVec[2];
+  v102 =  1*unitVec[0]+0*unitVec[1]-1*unitVec[2];
+  v202 = -1*unitVec[0]+0*unitVec[1]-1*unitVec[2];
+  v012 =  0*unitVec[0]+1*unitVec[1]-1*unitVec[2];
+  v112 =  1*unitVec[0]+1*unitVec[1]-1*unitVec[2];
+  v212 = -1*unitVec[0]+1*unitVec[1]-1*unitVec[2];
+  v022 =  0*unitVec[0]-1*unitVec[1]-1*unitVec[2];
+  v122 =  1*unitVec[0]-1*unitVec[1]-1*unitVec[2];
+  v222 = -1*unitVec[0]-1*unitVec[1]-1*unitVec[2];
 }
 
@@ -113,4 +129,150 @@
   CPPUNIT_ASSERT(Everywhere().isInside(v122));
   CPPUNIT_ASSERT(Everywhere().isInside(v222));
+
+  Shape s1 = Sphere();
+
+  CPPUNIT_ASSERT(s1.isInside(v000));
+  CPPUNIT_ASSERT(s1.isInside(v100));
+  CPPUNIT_ASSERT(s1.isInside(v200));
+  CPPUNIT_ASSERT(s1.isInside(v010));
+  CPPUNIT_ASSERT(!s1.isInside(v110));
+  CPPUNIT_ASSERT(!s1.isInside(v210));
+  CPPUNIT_ASSERT(s1.isInside(v020));
+  CPPUNIT_ASSERT(!s1.isInside(v120));
+  CPPUNIT_ASSERT(!s1.isInside(v220));
+  CPPUNIT_ASSERT(s1.isInside(v001));
+  CPPUNIT_ASSERT(!s1.isInside(v101));
+  CPPUNIT_ASSERT(!s1.isInside(v201));
+  CPPUNIT_ASSERT(!s1.isInside(v011));
+  CPPUNIT_ASSERT(!s1.isInside(v111));
+  CPPUNIT_ASSERT(!s1.isInside(v211));
+  CPPUNIT_ASSERT(!s1.isInside(v021));
+  CPPUNIT_ASSERT(!s1.isInside(v121));
+  CPPUNIT_ASSERT(!s1.isInside(v221));
+  CPPUNIT_ASSERT(s1.isInside(v002));
+  CPPUNIT_ASSERT(!s1.isInside(v102));
+  CPPUNIT_ASSERT(!s1.isInside(v202));
+  CPPUNIT_ASSERT(!s1.isInside(v012));
+  CPPUNIT_ASSERT(!s1.isInside(v112));
+  CPPUNIT_ASSERT(!s1.isInside(v212));
+  CPPUNIT_ASSERT(!s1.isInside(v022));
+  CPPUNIT_ASSERT(!s1.isInside(v122));
+  CPPUNIT_ASSERT(!s1.isInside(v222));
+
+  Shape s2 = Cuboid();
+
+  CPPUNIT_ASSERT(s2.isInside(v000));
+  CPPUNIT_ASSERT(s2.isInside(v100));
+  CPPUNIT_ASSERT(!s2.isInside(v200));
+  CPPUNIT_ASSERT(s2.isInside(v010));
+  CPPUNIT_ASSERT(s2.isInside(v110));
+  CPPUNIT_ASSERT(!s2.isInside(v210));
+  CPPUNIT_ASSERT(!s2.isInside(v020));
+  CPPUNIT_ASSERT(!s2.isInside(v120));
+  CPPUNIT_ASSERT(!s2.isInside(v220));
+  CPPUNIT_ASSERT(s2.isInside(v001));
+  CPPUNIT_ASSERT(s2.isInside(v101));
+  CPPUNIT_ASSERT(!s2.isInside(v201));
+  CPPUNIT_ASSERT(s2.isInside(v011));
+  CPPUNIT_ASSERT(s2.isInside(v111));
+  CPPUNIT_ASSERT(!s2.isInside(v211));
+  CPPUNIT_ASSERT(!s2.isInside(v021));
+  CPPUNIT_ASSERT(!s2.isInside(v121));
+  CPPUNIT_ASSERT(!s2.isInside(v221));
+  CPPUNIT_ASSERT(!s2.isInside(v002));
+  CPPUNIT_ASSERT(!s2.isInside(v102));
+  CPPUNIT_ASSERT(!s2.isInside(v202));
+  CPPUNIT_ASSERT(!s2.isInside(v012));
+  CPPUNIT_ASSERT(!s2.isInside(v112));
+  CPPUNIT_ASSERT(!s2.isInside(v212));
+  CPPUNIT_ASSERT(!s2.isInside(v022));
+  CPPUNIT_ASSERT(!s2.isInside(v122));
+  CPPUNIT_ASSERT(!s2.isInside(v222));
+}
+
+void ShapeUnittest::surfaceTest(){
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v000));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v100));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v200));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v010));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v110));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v210));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v020));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v120));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v220));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v001));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v101));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v201));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v011));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v111));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v211));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v021));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v121));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v221));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v002));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v102));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v202));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v012));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v112));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v212));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v022));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v122));
+  CPPUNIT_ASSERT(!Nowhere().isOnSurface(v222));
+
+  CPPUNIT_ASSERT(Cuboid().isOnSurface(v000));
+  CPPUNIT_ASSERT(Cuboid().isOnSurface(v100));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v200));
+  CPPUNIT_ASSERT(Cuboid().isOnSurface(v010));
+  CPPUNIT_ASSERT(Cuboid().isOnSurface(v110));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v210));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v020));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v120));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v220));
+  CPPUNIT_ASSERT(Cuboid().isOnSurface(v001));
+  CPPUNIT_ASSERT(Cuboid().isOnSurface(v101));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v201));
+  CPPUNIT_ASSERT(Cuboid().isOnSurface(v011));
+  CPPUNIT_ASSERT(Cuboid().isOnSurface(v111));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v211));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v021));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v121));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v221));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v002));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v102));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v202));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v012));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v112));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v212));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v022));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v122));
+  CPPUNIT_ASSERT(!Cuboid().isOnSurface(v222));
+
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v000));
+  CPPUNIT_ASSERT(Sphere().isOnSurface(v100));
+  CPPUNIT_ASSERT(Sphere().isOnSurface(v200));
+  CPPUNIT_ASSERT(Sphere().isOnSurface(v010));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v110));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v210));
+  CPPUNIT_ASSERT(Sphere().isOnSurface(v020));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v120));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v220));
+  CPPUNIT_ASSERT(Sphere().isOnSurface(v001));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v101));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v201));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v011));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v111));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v211));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v021));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v121));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v221));
+  CPPUNIT_ASSERT(Sphere().isOnSurface(v002));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v102));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v202));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v012));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v112));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v212));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v022));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v122));
+  CPPUNIT_ASSERT(!Sphere().isOnSurface(v222));
 }
 
@@ -179,4 +341,5 @@
 
 }
+
 void ShapeUnittest::operatorTest(){
   {
@@ -360,3 +523,133 @@
   }
 
+  {
+    Shape s1 = Sphere() && Cuboid(); // Sphere in upper place
+
+    CPPUNIT_ASSERT(s1.isInside(v000));
+    CPPUNIT_ASSERT(s1.isInside(v100));
+    CPPUNIT_ASSERT(!s1.isInside(v200));
+    CPPUNIT_ASSERT(s1.isInside(v010));
+    CPPUNIT_ASSERT(!s1.isInside(v110));
+    CPPUNIT_ASSERT(!s1.isInside(v210));
+    CPPUNIT_ASSERT(!s1.isInside(v020));
+    CPPUNIT_ASSERT(!s1.isInside(v120));
+    CPPUNIT_ASSERT(!s1.isInside(v220));
+    CPPUNIT_ASSERT(s1.isInside(v001));
+    CPPUNIT_ASSERT(!s1.isInside(v101));
+    CPPUNIT_ASSERT(!s1.isInside(v201));
+    CPPUNIT_ASSERT(!s1.isInside(v011));
+    CPPUNIT_ASSERT(!s1.isInside(v111));
+    CPPUNIT_ASSERT(!s1.isInside(v211));
+    CPPUNIT_ASSERT(!s1.isInside(v021));
+    CPPUNIT_ASSERT(!s1.isInside(v121));
+    CPPUNIT_ASSERT(!s1.isInside(v221));
+    CPPUNIT_ASSERT(!s1.isInside(v002));
+    CPPUNIT_ASSERT(!s1.isInside(v102));
+    CPPUNIT_ASSERT(!s1.isInside(v202));
+    CPPUNIT_ASSERT(!s1.isInside(v012));
+    CPPUNIT_ASSERT(!s1.isInside(v112));
+    CPPUNIT_ASSERT(!s1.isInside(v212));
+    CPPUNIT_ASSERT(!s1.isInside(v022));
+    CPPUNIT_ASSERT(!s1.isInside(v122));
+    CPPUNIT_ASSERT(!s1.isInside(v222));
+
+    CPPUNIT_ASSERT(s1.isOnSurface(v000));
+    CPPUNIT_ASSERT(s1.isOnSurface(v100));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v200));
+    CPPUNIT_ASSERT(s1.isOnSurface(v010));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v110));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v210));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v020));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v120));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v220));
+    CPPUNIT_ASSERT(s1.isOnSurface(v001));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v101));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v201));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v011));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v111));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v211));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v021));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v121));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v221));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v002));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v102));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v202));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v012));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v112));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v212));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v022));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v122));
+    CPPUNIT_ASSERT(!s1.isOnSurface(v222));
+
+
+    Shape s2 = Sphere() || Cuboid(); // Should be same as Cuboid
+
+    CPPUNIT_ASSERT(s2.isInside(v000));
+    CPPUNIT_ASSERT(s2.isInside(v100));
+    CPPUNIT_ASSERT(s2.isInside(v200));
+    CPPUNIT_ASSERT(s2.isInside(v010));
+    CPPUNIT_ASSERT(s2.isInside(v110));
+    CPPUNIT_ASSERT(!s2.isInside(v210));
+    CPPUNIT_ASSERT(s2.isInside(v020));
+    CPPUNIT_ASSERT(!s2.isInside(v120));
+    CPPUNIT_ASSERT(!s2.isInside(v220));
+    CPPUNIT_ASSERT(s2.isInside(v001));
+    CPPUNIT_ASSERT(s2.isInside(v101));
+    CPPUNIT_ASSERT(!s2.isInside(v201));
+    CPPUNIT_ASSERT(s2.isInside(v011));
+    CPPUNIT_ASSERT(s2.isInside(v111));
+    CPPUNIT_ASSERT(!s2.isInside(v211));
+    CPPUNIT_ASSERT(!s2.isInside(v021));
+    CPPUNIT_ASSERT(!s2.isInside(v121));
+    CPPUNIT_ASSERT(!s2.isInside(v221));
+    CPPUNIT_ASSERT(s2.isInside(v002));
+    CPPUNIT_ASSERT(!s2.isInside(v102));
+    CPPUNIT_ASSERT(!s2.isInside(v202));
+    CPPUNIT_ASSERT(!s2.isInside(v012));
+    CPPUNIT_ASSERT(!s2.isInside(v112));
+    CPPUNIT_ASSERT(!s2.isInside(v212));
+    CPPUNIT_ASSERT(!s2.isInside(v022));
+    CPPUNIT_ASSERT(!s2.isInside(v122));
+    CPPUNIT_ASSERT(!s2.isInside(v222));
+
+    CPPUNIT_ASSERT(!s2.isOnSurface(v000));
+    CPPUNIT_ASSERT(s2.isOnSurface(v100));
+    CPPUNIT_ASSERT(s2.isOnSurface(v200));
+    CPPUNIT_ASSERT(s2.isOnSurface(v010));
+    CPPUNIT_ASSERT(s2.isOnSurface(v110));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v210));
+    CPPUNIT_ASSERT(s2.isOnSurface(v020));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v120));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v220));
+    CPPUNIT_ASSERT(s2.isOnSurface(v001));
+    CPPUNIT_ASSERT(s2.isOnSurface(v101));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v201));
+    CPPUNIT_ASSERT(s2.isOnSurface(v011));
+    CPPUNIT_ASSERT(s2.isOnSurface(v111));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v211));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v021));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v121));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v221));
+    CPPUNIT_ASSERT(s2.isOnSurface(v002));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v102));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v202));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v012));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v112));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v212));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v022));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v122));
+    CPPUNIT_ASSERT(!s2.isOnSurface(v222));
+  }
+
 }
+
+void ShapeUnittest::PointsOnSurfaceTest(){
+  Shape s = Sphere();
+  const size_t N = 200;
+  std::vector<Vector> PointsOnSurface = s.getHomogeneousPointsOnSurface(N);
+  for (std::vector<Vector>::const_iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
+    CPPUNIT_ASSERT(fabs(1. - (*iter).NormSquared()) < MYEPSILON);
+  }
+  CPPUNIT_ASSERT_EQUAL(N, PointsOnSurface.size());
+}
+
Index: src/unittests/ShapeUnittest.hpp
===================================================================
--- src/unittests/ShapeUnittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/ShapeUnittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -14,5 +14,5 @@
 class Vector;
 
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 
 class ShapeUnittest : public CppUnit::TestFixture
@@ -20,6 +20,8 @@
   CPPUNIT_TEST_SUITE( ShapeUnittest) ;
   CPPUNIT_TEST ( baseShapesTest );
+  CPPUNIT_TEST ( surfaceTest );
   CPPUNIT_TEST ( assignmentTest );
   CPPUNIT_TEST ( operatorTest );
+  CPPUNIT_TEST ( PointsOnSurfaceTest );
   CPPUNIT_TEST_SUITE_END();
 
@@ -29,6 +31,8 @@
 
   void baseShapesTest();
+  void surfaceTest();
   void assignmentTest();
   void operatorTest();
+  void PointsOnSurfaceTest();
 
   // a lot of vectors.
Index: src/unittests/SingletonTest.cpp
===================================================================
--- src/unittests/SingletonTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/SingletonTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * SingletonTest.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "SingletonTest.hpp"
Index: src/unittests/TestRunnerMain.cpp
===================================================================
--- src/unittests/TestRunnerMain.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/TestRunnerMain.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * TestRunnerMain.cpp
Index: src/unittests/UnitTestMain.cpp
===================================================================
--- src/unittests/UnitTestMain.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/UnitTestMain.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * UnitTestMain.cpp
Index: src/unittests/analysisbondsunittest.cpp
===================================================================
--- src/unittests/analysisbondsunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/analysisbondsunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * analysisbondsunittest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -16,5 +28,4 @@
 #include <cstring>
 
-#include "World.hpp"
 #include "analysis_bonds.hpp"
 #include "analysisbondsunittest.hpp"
@@ -25,4 +36,5 @@
 #include "molecule.hpp"
 #include "periodentafel.hpp"
+#include "LinearAlgebra/Vector.hpp"
 #include "World.hpp"
 
@@ -52,26 +64,26 @@
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(1.5, 0., 1.5 );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(1.5, 0., 1.5 ));
   TestMolecule->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0., 1.5, 1.5 );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0., 1.5, 1.5 ));
   TestMolecule->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(1.5, 1.5, 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(1.5, 1.5, 0. ));
   TestMolecule->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0., 0., 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0., 0., 0. ));
   TestMolecule->AddAtom(Walker);
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = carbon;
-  *Walker->node = Vector(0.5, 0.5, 0.5 );
+  Walker->setType(carbon);
+  Walker->setPosition(Vector(0.5, 0.5, 0.5 ));
   TestMolecule->AddAtom(Walker);
 
Index: src/unittests/atomsCalculationTest.cpp
===================================================================
--- src/unittests/atomsCalculationTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/atomsCalculationTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * atomsCalculationTest.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "atomsCalculationTest.hpp"
Index: src/unittests/atomsCalculationTest.hpp
===================================================================
--- src/unittests/atomsCalculationTest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/atomsCalculationTest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,5 +11,6 @@
 #include <cppunit/extensions/HelperMacros.h>
 
-#define ATOM_COUNT (10)
+// we prefer enum over define
+enum { ATOM_COUNT = 10 };
 
 #include "types.hpp"
Index: src/unittests/bondgraphunittest.cpp
===================================================================
--- src/unittests/bondgraphunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/bondgraphunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * bondgraphunittest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -23,5 +35,5 @@
 #include "bondgraph.hpp"
 #include "element.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "molecule.hpp"
 #include "periodentafel.hpp"
@@ -54,24 +66,24 @@
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = carbon;
-  *Walker->node = Vector(1., 0., 1. );
+  Walker->setType(carbon);
+  Walker->setPosition(Vector(1., 0., 1. ));
   TestMolecule->AddAtom(Walker);
 
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = carbon;
-  *Walker->node = Vector(0., 1., 1. );
+  Walker->setType(carbon);
+  Walker->setPosition(Vector(0., 1., 1. ));
   TestMolecule->AddAtom(Walker);
 
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = carbon;
-  *Walker->node = Vector(1., 1., 0. );
+  Walker->setType(carbon);
+  Walker->setPosition(Vector(1., 1., 0. ));
   TestMolecule->AddAtom(Walker);
 
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = carbon;
-  *Walker->node = Vector(0., 0., 0. );
+  Walker->setType(carbon);
+  Walker->setPosition(Vector(0., 0., 0. ));
   TestMolecule->AddAtom(Walker);
 
Index: src/unittests/gslmatrixsymmetricunittest.cpp
===================================================================
--- src/unittests/gslmatrixsymmetricunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/gslmatrixsymmetricunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * gslmatrixunittest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
Index: src/unittests/gslmatrixsymmetricunittest.hpp
===================================================================
--- src/unittests/gslmatrixsymmetricunittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/gslmatrixsymmetricunittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,5 +11,5 @@
 #include <cppunit/extensions/HelperMacros.h>
 
-#include "gslmatrix.hpp"
+#include "LinearAlgebra/gslmatrix.hpp"
 
 /********************************************** Test classes **************************************/
Index: src/unittests/gslmatrixunittest.cpp
===================================================================
--- src/unittests/gslmatrixunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/gslmatrixunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * gslmatrixunittest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
Index: src/unittests/gslmatrixunittest.hpp
===================================================================
--- src/unittests/gslmatrixunittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/gslmatrixunittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,5 +11,5 @@
 #include <cppunit/extensions/HelperMacros.h>
 
-#include "gslmatrix.hpp"
+#include "LinearAlgebra/gslmatrix.hpp"
 
 /********************************************** Test classes **************************************/
Index: src/unittests/gslvectorunittest.cpp
===================================================================
--- src/unittests/gslvectorunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/gslvectorunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * gslvectorunittest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
Index: src/unittests/gslvectorunittest.hpp
===================================================================
--- src/unittests/gslvectorunittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/gslvectorunittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,5 +11,5 @@
 #include <cppunit/extensions/HelperMacros.h>
 
-#include "gslvector.hpp"
+#include "LinearAlgebra/gslvector.hpp"
 
 /********************************************** Test classes **************************************/
Index: src/unittests/infounittest.cpp
===================================================================
--- src/unittests/infounittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/infounittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * InfoUnitTest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -15,7 +27,7 @@
 #include <stdio.h>
 
-#include "info.hpp"
+#include "Helpers/Info.hpp"
 #include "infounittest.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 
 #ifdef HAVE_TESTRUNNER
Index: src/unittests/linearsystemofequationsunittest.cpp
===================================================================
--- src/unittests/linearsystemofequationsunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/linearsystemofequationsunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * linearsystemofequationsunittest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -15,5 +27,5 @@
 
 #include "linearsystemofequationsunittest.hpp"
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 
 #ifdef HAVE_TESTRUNNER
Index: src/unittests/linearsystemofequationsunittest.hpp
===================================================================
--- src/unittests/linearsystemofequationsunittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/linearsystemofequationsunittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,5 +11,5 @@
 #include <cppunit/extensions/HelperMacros.h>
 
-#include "linearsystemofequations.hpp"
+#include "LinearAlgebra/linearsystemofequations.hpp"
 
 /********************************************** Test classes **************************************/
Index: src/unittests/listofbondsunittest.cpp
===================================================================
--- src/unittests/listofbondsunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/listofbondsunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * listofbondsunittest.cpp
@@ -5,4 +12,9 @@
  *      Author: user
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -47,21 +59,21 @@
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(1., 0., 1. );
-  TestMolecule->AddAtom(Walker);
-  Walker = World::getInstance().createAtom();
-  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0., 1., 1. );
-  TestMolecule->AddAtom(Walker);
-  Walker = World::getInstance().createAtom();
-  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(1., 1., 0. );
-  TestMolecule->AddAtom(Walker);
-  Walker = World::getInstance().createAtom();
-  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->type = hydrogen;
-  *Walker->node = Vector(0., 0., 0. );
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(1., 0., 1. ));
+  TestMolecule->AddAtom(Walker);
+  Walker = World::getInstance().createAtom();
+  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0., 1., 1. ));
+  TestMolecule->AddAtom(Walker);
+  Walker = World::getInstance().createAtom();
+  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(1., 1., 0. ));
+  TestMolecule->AddAtom(Walker);
+  Walker = World::getInstance().createAtom();
+  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
+  Walker->setType(hydrogen);
+  Walker->setPosition(Vector(0., 0., 0. ));
   TestMolecule->AddAtom(Walker);
 
Index: src/unittests/logunittest.cpp
===================================================================
--- src/unittests/logunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/logunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,6 +1,18 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * logunittest.cpp
  */
 
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -11,7 +23,7 @@
 
 #include "logunittest.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 #include "defs.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 
 #ifdef HAVE_TESTRUNNER
Index: src/unittests/manipulateAtomsTest.cpp
===================================================================
--- src/unittests/manipulateAtomsTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/manipulateAtomsTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * manipulateAtomsTest.cpp
@@ -5,4 +12,9 @@
  *      Author: crueger
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "manipulateAtomsTest.hpp"
Index: src/unittests/manipulateAtomsTest.hpp
===================================================================
--- src/unittests/manipulateAtomsTest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/manipulateAtomsTest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,5 +11,6 @@
 #include <cppunit/extensions/HelperMacros.h>
 
-#define ATOM_COUNT (10)
+// we prefer enum over define
+enum { ATOM_COUNT = 10 };
 
 class atom;
Index: src/unittests/memoryallocatorunittest.cpp
===================================================================
--- src/unittests/memoryallocatorunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/memoryallocatorunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,6 +1,19 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * memoryallocatorunittest.cpp
+ *
  */
 
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -13,6 +26,6 @@
 #include "memoryallocatorunittest.hpp"
 #include "memoryusageobserver.hpp"
-#include "helpers.hpp"
-#include "log.hpp"
+#include "Helpers/helpers.hpp"
+#include "Helpers/Log.hpp"
 #include "defs.hpp"
 
Index: src/unittests/memoryusageobserverunittest.cpp
===================================================================
--- src/unittests/memoryusageobserverunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/memoryusageobserverunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,6 +1,18 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * memoryusageobserverunittest.cpp
  */
 
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
Index: src/unittests/periodentafelTest.cpp
===================================================================
--- src/unittests/periodentafelTest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/periodentafelTest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * periodentafelTest.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 using namespace std;
 
@@ -11,4 +23,7 @@
 #include <cppunit/extensions/TestFactoryRegistry.h>
 #include <cppunit/ui/text/TestRunner.h>
+
+#include <sstream>
+#include <iostream>
 
 #include "Helpers/Assert.hpp"
@@ -67,5 +82,6 @@
 {
   // reload all databases
-  CPPUNIT_ASSERT(tafel->LoadElementsDatabase(new stringstream(elementsDB,ios_base::in)) && "General element initialization failed");
+  stringstream elementsDBstream(elementsDB,ios_base::in);
+  CPPUNIT_ASSERT(tafel->LoadElementsDatabase(elementsDBstream) && "General element initialization failed");
   CPPUNIT_ASSERT(tafel->LoadValenceDatabase(new stringstream(valenceDB,ios_base::in)) && "Valence entry of element initialization failed");
   CPPUNIT_ASSERT(tafel->LoadOrbitalsDatabase(new stringstream(orbitalsDB,ios_base::in)) && "Orbitals entry of element initialization failed");
Index: src/unittests/periodentafelTest.hpp
===================================================================
--- src/unittests/periodentafelTest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/periodentafelTest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -31,6 +31,6 @@
 private:
 
-      element *hydrogen;
-      element *carbon;
+      const element *hydrogen;
+      const element *carbon;
       periodentafel *tafel;
 
Index: src/unittests/stackclassunittest.cpp
===================================================================
--- src/unittests/stackclassunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/stackclassunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * stackclassunittest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -13,5 +25,5 @@
 
 #include "stackclassunittest.hpp"
-#include "log.hpp"
+#include "Helpers/Log.hpp"
 
 #ifdef HAVE_TESTRUNNER
Index: src/unittests/tesselation_boundarytriangleunittest.cpp
===================================================================
--- src/unittests/tesselation_boundarytriangleunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/tesselation_boundarytriangleunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * tesselation_boundarytriangleunittest.cpp
@@ -6,4 +13,9 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 using namespace std;
 
@@ -13,7 +25,12 @@
 
 #include <cstring>
+#include <iostream>
 
 #include "defs.hpp"
-#include "tesselation.hpp"
+#include "TesselPoint.hpp"
+#include "BoundaryPointSet.hpp"
+#include "BoundaryLineSet.hpp"
+#include "BoundaryTriangleSet.hpp"
+#include "CandidateForTesselation.hpp"
 #include "tesselation_boundarytriangleunittest.hpp"
 
@@ -22,5 +39,5 @@
 #endif /*HAVE_TESTRUNNER*/
 
-#define SPHERERADIUS 2.
+const double TesselationBoundaryTriangleTest::SPHERERADIUS=2.;
 
 /********************************************** Test classes **************************************/
@@ -36,15 +53,15 @@
   // create nodes
   tesselpoints[0] = new TesselPoint;
-  tesselpoints[0]->node = new Vector(0., 0., 0.);
+  tesselpoints[0]->setPosition(Vector(0., 0., 0.));
   tesselpoints[0]->setName("1");
   tesselpoints[0]->nr = 1;
   points[0] = new BoundaryPointSet(tesselpoints[0]);
   tesselpoints[1] = new TesselPoint;
-  tesselpoints[1]->node = new Vector(0., 1., 0.);
+  tesselpoints[1]->setPosition(Vector(0., 1., 0.));
   tesselpoints[1]->setName("2");
   tesselpoints[1]->nr = 2;
   points[1] = new BoundaryPointSet(tesselpoints[1]);
   tesselpoints[2] = new TesselPoint;
-  tesselpoints[2]->node = new Vector(1., 0., 0.);
+  tesselpoints[2]->setPosition(Vector(1., 0., 0.));
   tesselpoints[2]->setName("3");
   tesselpoints[2]->nr = 3;
@@ -67,5 +84,4 @@
   for (int i=0;i<3;++i) {
     // TesselPoint does not delete its vector as it only got a reference
-    delete tesselpoints[i]->node;
     delete tesselpoints[i];
   }
@@ -83,9 +99,9 @@
   // simple test on y line
   Point = Vector(-1.,0.5,0.);
-  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.,0.5,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
   Point = Vector(-4.,0.5,0.);
-  CPPUNIT_ASSERT_EQUAL( 16., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 16., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.,0.5,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -93,9 +109,9 @@
   // simple test on x line
   Point = Vector(0.5,-1.,0.);
-  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.5,0.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
   Point = Vector(0.5,-6.,0.);
-  CPPUNIT_ASSERT_EQUAL( 36., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 36., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.5,0.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -103,9 +119,9 @@
   // simple test on slanted line
   Point = Vector(1.,1.,0.);
-  CPPUNIT_ASSERT_EQUAL( 0.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 0.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.5,0.5,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
   Point = Vector(5.,5.,0.);
-  CPPUNIT_ASSERT_EQUAL( 40.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 40.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.5,0.5,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -113,5 +129,5 @@
   // simple test on first node
   Point = Vector(-1.,-1.,0.);
-  CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.,0.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -119,5 +135,5 @@
   // simple test on second node
   Point = Vector(0.,2.,0.);
-  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.,1.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -125,5 +141,5 @@
   // simple test on third node
   Point = Vector(2.,0.,0.);
-  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(1.,0.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -139,9 +155,9 @@
   // straight down/up
   Point = Vector(1./3.,1./3.,+5.);
-  CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(1./3.,1./3.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
   Point = Vector(1./3.,1./3.,-5.);
-  CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(1./3.,1./3.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -149,9 +165,9 @@
   // simple test on y line
   Point = Vector(-1.,0.5,+2.);
-  CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.,0.5,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
   Point = Vector(-1.,0.5,-3.);
-  CPPUNIT_ASSERT_EQUAL( 10., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 10., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.,0.5,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -159,9 +175,9 @@
   // simple test on x line
   Point = Vector(0.5,-1.,+1.);
-  CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.5,0.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
   Point = Vector(0.5,-1.,-2.);
-  CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.5,0.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -169,9 +185,9 @@
   // simple test on slanted line
   Point = Vector(1.,1.,+3.);
-  CPPUNIT_ASSERT_EQUAL( 9.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 9.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.5,0.5,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
   Point = Vector(1.,1.,-4.);
-  CPPUNIT_ASSERT_EQUAL( 16.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 16.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.5,0.5,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -179,5 +195,5 @@
   // simple test on first node
   Point = Vector(-1.,-1.,5.);
-  CPPUNIT_ASSERT_EQUAL( 27., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 27., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.,0.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -185,5 +201,5 @@
   // simple test on second node
   Point = Vector(0.,2.,5.);
-  CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(0.,1.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
@@ -191,5 +207,5 @@
   // simple test on third node
   Point = Vector(2.,0.,5.);
-  CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
+  CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
   Point = Vector(1.,0.,0.);
   CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
Index: src/unittests/tesselation_boundarytriangleunittest.hpp
===================================================================
--- src/unittests/tesselation_boundarytriangleunittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/tesselation_boundarytriangleunittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -16,4 +16,6 @@
 #include "tesselation.hpp"
 
+class TesselPoint;
+
 /********************************************** Test classes **************************************/
 
@@ -32,4 +34,6 @@
 
 private:
+      static const double SPHERERADIUS;
+
       class BoundaryTriangleSet *triangle;
       class BoundaryLineSet *lines[3];
Index: src/unittests/tesselation_insideoutsideunittest.cpp
===================================================================
--- src/unittests/tesselation_insideoutsideunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/tesselation_insideoutsideunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * tesselation_insideoutsideunittest.cpp
@@ -5,4 +12,9 @@
  *      Author: heber
  */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -13,9 +25,13 @@
 
 #include <cstring>
+#include <iostream>
 
 #include "defs.hpp"
-#include "tesselation.hpp"
+#include "TesselPoint.hpp"
+#include "BoundaryLineSet.hpp"
+#include "BoundaryTriangleSet.hpp"
+#include "CandidateForTesselation.hpp"
 #include "tesselation_insideoutsideunittest.hpp"
-#include "verbose.hpp"
+#include "Helpers/Verbose.hpp"
 
 #ifdef HAVE_TESTRUNNER
@@ -23,5 +39,5 @@
 #endif /*HAVE_TESTRUNNER*/
 
-#define SPHERERADIUS 2.
+const double TesselationInOutsideTest::SPHERERADIUS=2.;
 
 /********************************************** Test classes **************************************/
@@ -29,5 +45,4 @@
 // Registers the fixture into the 'registry'
 CPPUNIT_TEST_SUITE_REGISTRATION( TesselationInOutsideTest );
-
 
 void TesselationInOutsideTest::setUp()
@@ -38,40 +53,40 @@
   class TesselPoint *Walker;
   Walker = new TesselPoint;
-  Walker->node = new Vector(0., 0., 0.);
+  Walker->setPosition(Vector(0., 0., 0.));
   Walker->setName("1");
   Walker->nr = 1;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
-  Walker->node = new Vector(0., 1., 0.);
+  Walker->setPosition(Vector(0., 1., 0.));
   Walker->setName("2");
   Walker->nr = 2;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
-  Walker->node = new Vector(1., 0., 0.);
+  Walker->setPosition(Vector(1., 0., 0.));
   Walker->setName("3");
   Walker->nr = 3;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
-  Walker->node = new Vector(1., 1., 0.);
+  Walker->setPosition(Vector(1., 1., 0.));
   Walker->setName("4");
   Walker->nr = 4;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
-  Walker->node = new Vector(0., 0., 1.);
+  Walker->setPosition(Vector(0., 0., 1.));
   Walker->setName("5");
   Walker->nr = 5;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
-  Walker->node = new Vector(0., 1., 1.);
+  Walker->setPosition(Vector(0., 1., 1.));
   Walker->setName("6");
   Walker->nr = 6;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
-  Walker->node = new Vector(1., 0., 1.);
+  Walker->setPosition(Vector(1., 0., 1.));
   Walker->setName("7");
   Walker->nr = 7;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
-  Walker->node = new Vector(1., 1., 1.);
+  Walker->setPosition(Vector(1., 1., 1.));
   Walker->setName("8");
   Walker->nr = 8;
@@ -79,5 +94,5 @@
 
   // create linkedcell
-  LinkedList = new LinkedCell(&Corners, 2.*SPHERERADIUS);
+  LinkedList = new LinkedCell(Corners, 2.*SPHERERADIUS);
 
   // create tesselation
@@ -130,8 +145,6 @@
   delete(LinkedList);
   delete(TesselStruct);
-  for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
-    delete((*Runner)->node);
+  for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++)
     delete(*Runner);
-  }
   Corners.clear();
   logger::purgeInstance();
Index: src/unittests/tesselation_insideoutsideunittest.hpp
===================================================================
--- src/unittests/tesselation_insideoutsideunittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/tesselation_insideoutsideunittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -30,4 +30,6 @@
 
 private:
+      static const double SPHERERADIUS;
+
       class Tesselation *TesselStruct;
       LinkedCell::LinkedNodes Corners;
Index: src/unittests/tesselationunittest.cpp
===================================================================
--- src/unittests/tesselationunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/tesselationunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * tesselationunittest.cpp
@@ -6,4 +13,8 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -16,5 +27,8 @@
 
 #include "defs.hpp"
-#include "tesselation.hpp"
+#include "TesselPoint.hpp"
+#include "BoundaryLineSet.hpp"
+#include "BoundaryTriangleSet.hpp"
+#include "CandidateForTesselation.hpp"
 #include "tesselationunittest.hpp"
 
@@ -23,5 +37,5 @@
 #endif /*HAVE_TESTRUNNER*/
 
-#define SPHERERADIUS 2.
+const double TesselationTest::SPHERERADIUS=2.;
 
 /********************************************** Test classes **************************************/
@@ -36,20 +50,20 @@
   class TesselPoint *Walker;
   Walker = new TesselPoint;
-  Walker->node = new Vector(1., 0., -1.);
+  Walker->setPosition(Vector(1., 0., -1.));
   Walker->setName("1");
   Walker->nr = 1;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
-  Walker->node = new Vector(-1., 1., -1.);
+  Walker->setPosition(Vector(-1., 1., -1.));
   Walker->setName("2");
   Walker->nr = 2;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
-  Walker->node = new Vector(-1., -1., -1.);
+  Walker->setPosition(Vector(-1., -1., -1.));
   Walker->setName("3");
   Walker->nr = 3;
   Corners.push_back(Walker);
   Walker = new TesselPoint;
-  Walker->node = new Vector(-1., 0., 1.);
+  Walker->setPosition(Vector(-1., 0., 1.));
   Walker->setName("4");
   Walker->nr = 4;
@@ -57,5 +71,5 @@
 
   // create linkedcell
-  LinkedList = new LinkedCell(&Corners, 2.*SPHERERADIUS);
+  LinkedList = new LinkedCell(Corners, 2.*SPHERERADIUS);
 
   // create tesselation
@@ -101,8 +115,6 @@
   delete(LinkedList);
   delete(TesselStruct);
-  for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
-    delete((*Runner)->node);
+  for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++)
     delete(*Runner);
-  }
   Corners.clear();
   logger::purgeInstance();
Index: src/unittests/tesselationunittest.hpp
===================================================================
--- src/unittests/tesselationunittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/tesselationunittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -33,4 +33,6 @@
 
 private:
+      static const double SPHERERADIUS;
+
       class Tesselation *TesselStruct;
       LinkedCell::LinkedNodes Corners;
Index: src/unittests/vectorunittest.cpp
===================================================================
--- src/unittests/vectorunittest.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/vectorunittest.cpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,2 +1,9 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
 /*
  * unittest.cpp
@@ -6,4 +13,8 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 using namespace std;
@@ -14,11 +25,11 @@
 
 #include "defs.hpp"
-#include "log.hpp"
-#include "vector.hpp"
-#include "vector_ops.hpp"
+#include "Helpers/Log.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "LinearAlgebra/vector_ops.hpp"
 #include "vectorunittest.hpp"
-#include "Plane.hpp"
+#include "LinearAlgebra/Plane.hpp"
 #include "Exceptions/LinearDependenceException.hpp"
-#include "Matrix.hpp"
+#include "LinearAlgebra/Matrix.hpp"
 
 #ifdef HAVE_TESTRUNNER
@@ -52,4 +63,53 @@
   errorLogger::purgeInstance();
 };
+
+/** UnitTest for Constructors and Vector::IsZero() and Vector::IsOne().
+ */
+void VectorTest::AssignmentTest()
+{
+  // test with zero
+  zero.at(0) = 0;
+  zero.at(1) = 0;
+  zero.at(2) = 0;
+  double zero_array[3] = {0., 0., 0.};
+
+  CPPUNIT_ASSERT_EQUAL( zero, Vector(0,0,0));
+  CPPUNIT_ASSERT_EQUAL( zero, Vector(0.,0.,0.));
+  CPPUNIT_ASSERT_EQUAL( zero, Vector(zero_array[0], zero_array[1], zero_array[2]));
+  CPPUNIT_ASSERT_EQUAL( zero, Vector(zero_array));
+
+  // test with unit
+  unit.at(0) = 1;
+  unit.at(1) = 0;
+  unit.at(2) = 0;
+  double unit_array[3] = {1., 0., 0.};
+
+  CPPUNIT_ASSERT_EQUAL( unit, Vector(1,0,0));
+  CPPUNIT_ASSERT_EQUAL( unit, Vector(1.,0.,0.));
+  CPPUNIT_ASSERT_EQUAL( unit, Vector(unit_array[0], unit_array[1], unit_array[2]));
+  CPPUNIT_ASSERT_EQUAL( unit, Vector(unit_array));
+
+  // test with two
+  two.at(0) = 2;
+  two.at(1) = 1;
+  two.at(2) = 0;
+  double two_array[3] = {2., 1., 0.};
+
+  CPPUNIT_ASSERT_EQUAL( two, Vector(2,1,0));
+  CPPUNIT_ASSERT_EQUAL( two, Vector(2.,1.,0.));
+  CPPUNIT_ASSERT_EQUAL( two, Vector(two_array[0], two_array[1], two_array[2]));
+  CPPUNIT_ASSERT_EQUAL( two, Vector(two_array));
+
+  // test with three
+  three.at(0) = 1;
+  three.at(1) = 2;
+  three.at(2) = 3;
+  double three_array[3] = {1., 2., 3.};
+
+  CPPUNIT_ASSERT_EQUAL( three, Vector(1,2,3));
+  CPPUNIT_ASSERT_EQUAL( three, Vector(1.,2.,3.));
+  CPPUNIT_ASSERT_EQUAL( three, Vector(three_array[0], three_array[1], three_array[2]));
+  CPPUNIT_ASSERT_EQUAL( three, Vector(three_array));
+}
 
 /** UnitTest for Constructors and Vector::IsZero() and Vector::IsOne().
Index: src/unittests/vectorunittest.hpp
===================================================================
--- src/unittests/vectorunittest.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/unittests/vectorunittest.hpp	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -11,5 +11,5 @@
 #include <cppunit/extensions/HelperMacros.h>
 
-#include "vector.hpp"
+#include "LinearAlgebra/Vector.hpp"
 
 /********************************************** Test classes **************************************/
@@ -18,4 +18,5 @@
 {
     CPPUNIT_TEST_SUITE( VectorTest) ;
+    CPPUNIT_TEST ( AssignmentTest );
     CPPUNIT_TEST ( UnityTest );
     CPPUNIT_TEST ( SimpleAlgebraTest );
@@ -33,4 +34,5 @@
     void tearDown();
 
+    void AssignmentTest();
     void UnityTest();
     void OperatorAlgebraTest();
Index: c/vector.cpp
===================================================================
--- src/vector.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,538 +1,0 @@
-/** \file vector.cpp
- *
- * Function implementations for the class vector.
- *
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "vector.hpp"
-#include "VectorContent.hpp"
-#include "verbose.hpp"
-#include "World.hpp"
-#include "Helpers/Assert.hpp"
-#include "Helpers/fast_functions.hpp"
-#include "Exceptions/MathException.hpp"
-
-#include <iostream>
-#include <gsl/gsl_blas.h>
-
-
-using namespace std;
-
-
-/************************************ Functions for class vector ************************************/
-
-/** Constructor of class vector.
- */
-Vector::Vector()
-{
-  content = new VectorContent();
-};
-
-/**
- * Copy constructor
- */
-
-Vector::Vector(const Vector& src)
-{
-  content = new VectorContent();
-  gsl_vector_memcpy(content->content, src.content->content);
-}
-
-/** Constructor of class vector.
- */
-Vector::Vector(const double x1, const double x2, const double x3)
-{
-  content = new VectorContent();
-  gsl_vector_set(content->content,0,x1);
-  gsl_vector_set(content->content,1,x2);
-  gsl_vector_set(content->content,2,x3);
-};
-
-Vector::Vector(VectorContent *_content) :
-  content(_content)
-{}
-
-/**
- * Assignment operator
- */
-Vector& Vector::operator=(const Vector& src){
-  // check for self assignment
-  if(&src!=this){
-    gsl_vector_memcpy(content->content, src.content->content);
-  }
-  return *this;
-}
-
-/** Desctructor of class vector.
- */
-Vector::~Vector() {
-  delete content;
-};
-
-/** Calculates square of distance between this and another vector.
- * \param *y array to second vector
- * \return \f$| x - y |^2\f$
- */
-double Vector::DistanceSquared(const Vector &y) const
-{
-  double res = 0.;
-  for (int i=NDIM;i--;)
-    res += (at(i)-y[i])*(at(i)-y[i]);
-  return (res);
-};
-
-/** Calculates distance between this and another vector.
- * \param *y array to second vector
- * \return \f$| x - y |\f$
- */
-double Vector::distance(const Vector &y) const
-{
-  return (sqrt(DistanceSquared(y)));
-};
-
-Vector Vector::getClosestPoint(const Vector &point) const{
-  // the closest point to a single point space is always the single point itself
-  return *this;
-}
-
-/** Calculates scalar product between this and another vector.
- * \param *y array to second vector
- * \return \f$\langle x, y \rangle\f$
- */
-double Vector::ScalarProduct(const Vector &y) const
-{
-  double res = 0.;
-  gsl_blas_ddot(content->content, y.content->content, &res);
-  return (res);
-};
-
-
-/** Calculates VectorProduct between this and another vector.
- *  -# returns the Product in place of vector from which it was initiated
- *  -# ATTENTION: Only three dim.
- *  \param *y array to vector with which to calculate crossproduct
- *  \return \f$ x \times y \f&
- */
-void Vector::VectorProduct(const Vector &y)
-{
-  Vector tmp;
-  for(int i=NDIM;i--;)
-    tmp[i] = at((i+1)%NDIM)*y[(i+2)%NDIM] - at((i+2)%NDIM)*y[(i+1)%NDIM];
-  (*this) = tmp;
-};
-
-
-/** projects this vector onto plane defined by \a *y.
- * \param *y normal vector of plane
- * \return \f$\langle x, y \rangle\f$
- */
-void Vector::ProjectOntoPlane(const Vector &y)
-{
-  Vector tmp;
-  tmp = y;
-  tmp.Normalize();
-  tmp.Scale(ScalarProduct(tmp));
-  *this -= tmp;
-};
-
-/** Calculates the minimum distance of this vector to the plane.
- * \sa Vector::GetDistanceVectorToPlane()
- * \param *out output stream for debugging
- * \param *PlaneNormal normal of plane
- * \param *PlaneOffset offset of plane
- * \return distance to plane
- */
-double Vector::DistanceToSpace(const Space &space) const
-{
-  return space.distance(*this);
-};
-
-/** Calculates the projection of a vector onto another \a *y.
- * \param *y array to second vector
- */
-void Vector::ProjectIt(const Vector &y)
-{
-  (*this) += (-ScalarProduct(y))*y;
-};
-
-/** Calculates the projection of a vector onto another \a *y.
- * \param *y array to second vector
- * \return Vector
- */
-Vector Vector::Projection(const Vector &y) const
-{
-  Vector helper = y;
-  helper.Scale((ScalarProduct(y)/y.NormSquared()));
-
-  return helper;
-};
-
-/** Calculates norm of this vector.
- * \return \f$|x|\f$
- */
-double Vector::Norm() const
-{
-  return (sqrt(NormSquared()));
-};
-
-/** Calculates squared norm of this vector.
- * \return \f$|x|^2\f$
- */
-double Vector::NormSquared() const
-{
-  return (ScalarProduct(*this));
-};
-
-/** Normalizes this vector.
- */
-void Vector::Normalize()
-{
-  double factor = Norm();
-  (*this) *= 1/factor;
-};
-
-/** Zeros all components of this vector.
- */
-void Vector::Zero()
-{
-  at(0)=at(1)=at(2)=0;
-};
-
-/** Zeros all components of this vector.
- */
-void Vector::One(const double one)
-{
-  at(0)=at(1)=at(2)=one;
-};
-
-/** Checks whether vector has all components zero.
- * @return true - vector is zero, false - vector is not
- */
-bool Vector::IsZero() const
-{
-  return (fabs(at(0))+fabs(at(1))+fabs(at(2)) < MYEPSILON);
-};
-
-/** Checks whether vector has length of 1.
- * @return true - vector is normalized, false - vector is not
- */
-bool Vector::IsOne() const
-{
-  return (fabs(Norm() - 1.) < MYEPSILON);
-};
-
-/** Checks whether vector is normal to \a *normal.
- * @return true - vector is normalized, false - vector is not
- */
-bool Vector::IsNormalTo(const Vector &normal) const
-{
-  if (ScalarProduct(normal) < MYEPSILON)
-    return true;
-  else
-    return false;
-};
-
-/** Checks whether vector is normal to \a *normal.
- * @return true - vector is normalized, false - vector is not
- */
-bool Vector::IsEqualTo(const Vector &a) const
-{
-  bool status = true;
-  for (int i=0;i<NDIM;i++) {
-    if (fabs(at(i) - a[i]) > MYEPSILON)
-      status = false;
-  }
-  return status;
-};
-
-/** Calculates the angle between this and another vector.
- * \param *y array to second vector
- * \return \f$\acos\bigl(frac{\langle x, y \rangle}{|x||y|}\bigr)\f$
- */
-double Vector::Angle(const Vector &y) const
-{
-  double norm1 = Norm(), norm2 = y.Norm();
-  double angle = -1;
-  if ((fabs(norm1) > MYEPSILON) && (fabs(norm2) > MYEPSILON))
-    angle = this->ScalarProduct(y)/norm1/norm2;
-  // -1-MYEPSILON occured due to numerical imprecision, catch ...
-  //Log() << Verbose(2) << "INFO: acos(-1) = " << acos(-1) << ", acos(-1+MYEPSILON) = " << acos(-1+MYEPSILON) << ", acos(-1-MYEPSILON) = " << acos(-1-MYEPSILON) << "." << endl;
-  if (angle < -1)
-    angle = -1;
-  if (angle > 1)
-    angle = 1;
-  return acos(angle);
-};
-
-
-double& Vector::operator[](size_t i){
-  ASSERT(i<=NDIM && i>=0,"Vector Index out of Range");
-  return *gsl_vector_ptr (content->content, i);
-}
-
-const double& Vector::operator[](size_t i) const{
-  ASSERT(i<=NDIM && i>=0,"Vector Index out of Range");
-  return *gsl_vector_ptr (content->content, i);
-}
-
-double& Vector::at(size_t i){
-  return (*this)[i];
-}
-
-const double& Vector::at(size_t i) const{
-  return (*this)[i];
-}
-
-VectorContent* Vector::get(){
-  return content;
-}
-
-/** Compares vector \a to vector \a b component-wise.
- * \param a base vector
- * \param b vector components to add
- * \return a == b
- */
-bool Vector::operator==(const Vector& b) const
-{
-  return IsEqualTo(b);
-};
-
-bool Vector::operator!=(const Vector& b) const
-{
-  return !IsEqualTo(b);
-}
-
-/** Sums vector \a to this lhs component-wise.
- * \param a base vector
- * \param b vector components to add
- * \return lhs + a
- */
-const Vector& Vector::operator+=(const Vector& b)
-{
-  this->AddVector(b);
-  return *this;
-};
-
-/** Subtracts vector \a from this lhs component-wise.
- * \param a base vector
- * \param b vector components to add
- * \return lhs - a
- */
-const Vector& Vector::operator-=(const Vector& b)
-{
-  this->SubtractVector(b);
-  return *this;
-};
-
-/** factor each component of \a a times a double \a m.
- * \param a base vector
- * \param m factor
- * \return lhs.x[i] * m
- */
-const Vector& operator*=(Vector& a, const double m)
-{
-  a.Scale(m);
-  return a;
-};
-
-/** Sums two vectors \a  and \b component-wise.
- * \param a first vector
- * \param b second vector
- * \return a + b
- */
-Vector const Vector::operator+(const Vector& b) const
-{
-  Vector x = *this;
-  x.AddVector(b);
-  return x;
-};
-
-/** Subtracts vector \a from \b component-wise.
- * \param a first vector
- * \param b second vector
- * \return a - b
- */
-Vector const Vector::operator-(const Vector& b) const
-{
-  Vector x = *this;
-  x.SubtractVector(b);
-  return x;
-};
-
-/** Factors given vector \a a times \a m.
- * \param a vector
- * \param m factor
- * \return m * a
- */
-Vector const operator*(const Vector& a, const double m)
-{
-  Vector x(a);
-  x.Scale(m);
-  return x;
-};
-
-/** Factors given vector \a a times \a m.
- * \param m factor
- * \param a vector
- * \return m * a
- */
-Vector const operator*(const double m, const Vector& a )
-{
-  Vector x(a);
-  x.Scale(m);
-  return x;
-};
-
-ostream& operator<<(ostream& ost, const Vector& m)
-{
-  ost << "(";
-  for (int i=0;i<NDIM;i++) {
-    ost << m[i];
-    if (i != 2)
-      ost << ",";
-  }
-  ost << ")";
-  return ost;
-};
-
-
-void Vector::ScaleAll(const double *factor)
-{
-  for (int i=NDIM;i--;)
-    at(i) *= factor[i];
-};
-
-void Vector::ScaleAll(const Vector &factor){
-  gsl_vector_mul(content->content, factor.content->content);
-}
-
-
-void Vector::Scale(const double factor)
-{
-  gsl_vector_scale(content->content,factor);
-};
-
-std::pair<Vector,Vector> Vector::partition(const Vector &rhs) const{
-  double factor = ScalarProduct(rhs)/rhs.NormSquared();
-  Vector res= factor * rhs;
-  return make_pair(res,(*this)-res);
-}
-
-std::pair<pointset,Vector> Vector::partition(const pointset &points) const{
-  Vector helper = *this;
-  pointset res;
-  for(pointset::const_iterator iter=points.begin();iter!=points.end();++iter){
-    pair<Vector,Vector> currPart = helper.partition(*iter);
-    res.push_back(currPart.first);
-    helper = currPart.second;
-  }
-  return make_pair(res,helper);
-}
-
-/** Creates this vector as the b y *factors' components scaled linear combination of the given three.
- * this vector = x1*factors[0] + x2* factors[1] + x3*factors[2]
- * \param *x1 first vector
- * \param *x2 second vector
- * \param *x3 third vector
- * \param *factors three-component vector with the factor for each given vector
- */
-void Vector::LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors)
-{
-  (*this) = (factors[0]*x1) +
-            (factors[1]*x2) +
-            (factors[2]*x3);
-};
-
-/** Calculates orthonormal vector to one given vectors.
- * Just subtracts the projection onto the given vector from this vector.
- * The removed part of the vector is Vector::Projection()
- * \param *x1 vector
- * \return true - success, false - vector is zero
- */
-bool Vector::MakeNormalTo(const Vector &y1)
-{
-  bool result = false;
-  double factor = y1.ScalarProduct(*this)/y1.NormSquared();
-  Vector x1 = factor * y1;
-  SubtractVector(x1);
-  for (int i=NDIM;i--;)
-    result = result || (fabs(at(i)) > MYEPSILON);
-
-  return result;
-};
-
-/** Creates this vector as one of the possible orthonormal ones to the given one.
- * Just scan how many components of given *vector are unequal to zero and
- * try to get the skp of both to be zero accordingly.
- * \param *vector given vector
- * \return true - success, false - failure (null vector given)
- */
-bool Vector::GetOneNormalVector(const Vector &GivenVector)
-{
-  int Components[NDIM]; // contains indices of non-zero components
-  int Last = 0;   // count the number of non-zero entries in vector
-  int j;  // loop variables
-  double norm;
-
-  for (j=NDIM;j--;)
-    Components[j] = -1;
-
-  // in two component-systems we need to find the one position that is zero
-  int zeroPos = -1;
-  // find two components != 0
-  for (j=0;j<NDIM;j++){
-    if (fabs(GivenVector[j]) > MYEPSILON)
-      Components[Last++] = j;
-    else
-      // this our zero Position
-      zeroPos = j;
-  }
-
-  switch(Last) {
-    case 3:  // threecomponent system
-      // the position of the zero is arbitrary in three component systems
-      zeroPos = Components[2];
-    case 2:  // two component system
-      norm = sqrt(1./(GivenVector[Components[1]]*GivenVector[Components[1]]) + 1./(GivenVector[Components[0]]*GivenVector[Components[0]]));
-      at(zeroPos) = 0.;
-      // in skp both remaining parts shall become zero but with opposite sign and third is zero
-      at(Components[1]) = -1./GivenVector[Components[1]] / norm;
-      at(Components[0]) = 1./GivenVector[Components[0]] / norm;
-      return true;
-      break;
-    case 1: // one component system
-      // set sole non-zero component to 0, and one of the other zero component pendants to 1
-      at((Components[0]+2)%NDIM) = 0.;
-      at((Components[0]+1)%NDIM) = 1.;
-      at(Components[0]) = 0.;
-      return true;
-      break;
-    default:
-      return false;
-  }
-};
-
-/** Adds vector \a *y componentwise.
- * \param *y vector
- */
-void Vector::AddVector(const Vector &y)
-{
-  gsl_vector_add(content->content, y.content->content);
-}
-
-/** Adds vector \a *y componentwise.
- * \param *y vector
- */
-void Vector::SubtractVector(const Vector &y)
-{
-  gsl_vector_sub(content->content, y.content->content);
-}
-
-
-// some comonly used vectors
-const Vector zeroVec(0,0,0);
-const Vector e1(1,0,0);
-const Vector e2(0,1,0);
-const Vector e3(0,0,1);
Index: c/vector.hpp
===================================================================
--- src/vector.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,117 +1,0 @@
-#ifndef VECTOR_HPP_
-#define VECTOR_HPP_
-
-using namespace std;
-
-/*********************************************** includes ***********************************/
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iosfwd>
-
-#include <memory>
-#include <vector>
-
-#include "defs.hpp"
-#include "Space.hpp"
-
-/********************************************** declarations *******************************/
-
-class Vector;
-class Matrix;
-struct VectorContent;
-
-typedef std::vector<Vector> pointset;
-
-/** Single vector.
- * basically, just a x[3] but with helpful functions
- */
-class Vector : public Space{
-  friend Vector operator*(const Matrix&,const Vector&);
-  friend class Matrix;
-public:
-  Vector();
-  Vector(const double x1, const double x2, const double x3);
-  Vector(const Vector& src);
-  virtual ~Vector();
-
-  // Method implemented by forwarding to the Representation
-
-  double DistanceSquared(const Vector &y) const;
-  double DistanceToSpace(const Space& space) const;
-  double ScalarProduct(const Vector &y) const;
-  double Angle(const Vector &y) const;
-  bool IsZero() const;
-  bool IsOne() const;
-  bool IsNormalTo(const Vector &normal) const;
-  bool IsEqualTo(const Vector &a) const;
-
-  void AddVector(const Vector &y);
-  void SubtractVector(const Vector &y);
-  void VectorProduct(const Vector &y);
-  void ProjectOntoPlane(const Vector &y);
-  void ProjectIt(const Vector &y);
-  Vector Projection(const Vector &y) const;
-  void ScaleAll(const double *factor);
-  void ScaleAll(const Vector &factor);
-  void Scale(const double factor);
-  bool GetOneNormalVector(const Vector &x1);
-  bool MakeNormalTo(const Vector &y1);
-  std::pair<Vector,Vector> partition(const Vector&) const;
-  std::pair<pointset,Vector> partition(const pointset&) const;
-
-  // Accessors ussually come in pairs... and sometimes even more than that
-  double& operator[](size_t i);
-  const double& operator[](size_t i) const;
-  double& at(size_t i);
-  const double& at(size_t i) const;
-
-  // Assignment operator
-  Vector &operator=(const Vector& src);
-
-  // Access to internal structure
-  VectorContent* get();
-
-  // Methods that are derived directly from other methods
-  double Norm() const;
-  double NormSquared() const;
-  void Normalize();
-  void Zero();
-  void One(const double one);
-  void LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors);
-
-  // operators for mathematical operations
-  bool operator==(const Vector& b) const;
-  bool operator!=(const Vector& b) const;
-  const Vector& operator+=(const Vector& b);
-  const Vector& operator-=(const Vector& b);
-  Vector const operator+(const Vector& b) const;
-  Vector const operator-(const Vector& b) const;
-
-  // Methods inherited from Space
-  virtual double distance(const Vector &point) const;
-  virtual Vector getClosestPoint(const Vector &point) const;
-
-protected:
-
-private:
-  Vector(VectorContent *);
-  VectorContent *content;
-
-};
-
-// some commonly used and fixed vectors
-const extern Vector zeroVec;
-const extern Vector e1;
-const extern Vector e2;
-const extern Vector e3;
-
-ostream & operator << (ostream& ost, const Vector &m);
-const Vector& operator*=(Vector& a, const double m);
-Vector const operator*(const Vector& a, const double m);
-Vector const operator*(const double m, const Vector& a);
-
-#endif /*VECTOR_HPP_*/
Index: c/vector_ops.cpp
===================================================================
--- src/vector_ops.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- * vector_ops.cpp
- *
- *  Created on: Apr 1, 2010
- *      Author: crueger
- */
-
-#include "Helpers/MemDebug.hpp"
-
-#include "vector.hpp"
-#include "Plane.hpp"
-#include "log.hpp"
-#include "verbose.hpp"
-#include "gslmatrix.hpp"
-#include "leastsquaremin.hpp"
-#include "info.hpp"
-#include "Helpers/fast_functions.hpp"
-#include "Exceptions/LinearDependenceException.hpp"
-#include "Exceptions/SkewException.hpp"
-
-#include <gsl/gsl_linalg.h>
-#include <gsl/gsl_matrix.h>
-#include <gsl/gsl_permutation.h>
-#include <gsl/gsl_vector.h>
-#include <gsl/gsl_multimin.h>
-
-/**
- * !@file
- * These files defines several common operation on vectors that should not
- * become part of the main vector class, because they are either to complex
- * or need methods from other subsystems that should not be moved to
- * the LinAlg-Subsystem
- */
-
-/** Creates a new vector as the one with least square distance to a given set of \a vectors.
- * \param *vectors set of vectors
- * \param num number of vectors
- * \return true if success, false if failed due to linear dependency
- */
-bool LSQdistance(Vector &res,const Vector **vectors, int num)
-{
-  int j;
-
-  for (j=0;j<num;j++) {
-    Log() << Verbose(1) << j << "th atom's vector: " << vectors[j] << endl;
-  }
-
-  int np = 3;
-  struct LSQ_params par;
-
-   const gsl_multimin_fminimizer_type *T =
-     gsl_multimin_fminimizer_nmsimplex;
-   gsl_multimin_fminimizer *s = NULL;
-   gsl_vector *ss, *y;
-   gsl_multimin_function minex_func;
-
-   size_t iter = 0, i;
-   int status;
-   double size;
-
-   /* Initial vertex size vector */
-   ss = gsl_vector_alloc (np);
-   y = gsl_vector_alloc (np);
-
-   /* Set all step sizes to 1 */
-   gsl_vector_set_all (ss, 1.0);
-
-   /* Starting point */
-   par.vectors = vectors;
-   par.num = num;
-
-   for (i=NDIM;i--;)
-    gsl_vector_set(y, i, (vectors[0]->at(i) - vectors[1]->at(i))/2.);
-
-   /* Initialize method and iterate */
-   minex_func.f = &LSQ;
-   minex_func.n = np;
-   minex_func.params = (void *)&par;
-
-   s = gsl_multimin_fminimizer_alloc (T, np);
-   gsl_multimin_fminimizer_set (s, &minex_func, y, ss);
-
-   do
-     {
-       iter++;
-       status = gsl_multimin_fminimizer_iterate(s);
-
-       if (status)
-         break;
-
-       size = gsl_multimin_fminimizer_size (s);
-       status = gsl_multimin_test_size (size, 1e-2);
-
-       if (status == GSL_SUCCESS)
-         {
-           printf ("converged to minimum at\n");
-         }
-
-       printf ("%5d ", (int)iter);
-       for (i = 0; i < (size_t)np; i++)
-         {
-           printf ("%10.3e ", gsl_vector_get (s->x, i));
-         }
-       printf ("f() = %7.3f size = %.3f\n", s->fval, size);
-     }
-   while (status == GSL_CONTINUE && iter < 100);
-
-  for (i=(size_t)np;i--;)
-    res[i] = gsl_vector_get(s->x, i);
-   gsl_vector_free(y);
-   gsl_vector_free(ss);
-   gsl_multimin_fminimizer_free (s);
-
-  return true;
-};
Index: c/vector_ops.hpp
===================================================================
--- src/vector_ops.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,13 +1,0 @@
-/*
- * vector_ops.hpp
- *
- *  Created on: Apr 1, 2010
- *      Author: crueger
- */
-
-#ifndef VECTOR_OPS_HPP_
-#define VECTOR_OPS_HPP_
-
-bool LSQdistance(Vector &res,const Vector **vectors, int num);
-
-#endif /* VECTOR_OPS_HPP_ */
Index: c/verbose.cpp
===================================================================
--- src/verbose.cpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,84 +1,0 @@
-using namespace std;
-
-#include "Helpers/MemDebug.hpp"
-
-#include "info.hpp"
-#include "verbose.hpp"
-#include <iostream>
-
-/** Prints the tabs according to verbosity stored in the temporary constructed class.
- * \param &ost stream to extend with tabs
- * \return &ost stream with tabs
- */
-ostream& Verbose::print (ostream &ost) const
-{
-  for (int i=Verbosity+Info::verbosity;i--;)
-    ost.put('\t');
-  //Log() << Verbose(0) << "Verbose(.) called." << endl;
-  return ost;
-};
-
-/** States whether current output message should be print or not.
- * Compares Verbose::Verbosity plus Info::verbosity against \a verbosityLevel.
- * \param verbosityLevel given global level of verbosity
- * \return true - do output, false - don't
- */
-bool Verbose::DoOutput(int verbosityLevel) const
-{
-  return (verbosityLevel >= Verbosity+Info::verbosity);
-};
-
-/** States whether current error output message should be print or not.
- * Compares Verbose::Verbosity against \a verbosityLevel.
- * \param verbosityLevel given global level of verbosity
- * \return true - do output, false - don't
- */
-bool Verbose::DoErrorOutput(int verbosityLevel) const
-{
-  return (verbosityLevel >= Verbosity);
-};
-
-/** Operator for the Verbose(arg) call.
- * Constructs temporary a Verbose class object, wherein the verbosity is stored.
- * Then << is called, which calls Verbose's print which adds the tabs and returns the stream.
- * \param &ost stream to extend
- * \param &m pointer to created Verbose object
- * \return &ost
- */ 
-ostream& operator<<(ostream& ost,const Verbose& m)
-{
-  return m.print(ost);
-};
-
-/** Prints the tabs according to verbosity stored in the temporary constructed class.
- * Note that highest bit is set artificially to give number of bits to print
- * \param &ost stream to extend with tabs
- * \return &ost stream with tabs
- */
-ostream& Binary::print (ostream &ost) const
-{
-  int bits = 1, counter = 1;
-  while ((bits = 1 << counter) < BinaryNumber)
-    counter++;
-  for (int i=0;i<counter-1;i++) {
-    if ((BinaryNumber & (1 << i)) == 0)
-      ost.put('0');
-     else
-      ost.put('1');
-  }
-  ost.put('b');
-  //Log() << Verbose(0) << "Binary(.) called." << endl;
-  return ost;
-};
-
-/** Operator for the Binary(arg) call.
- * Constructs temporary a Verbose class object, wherein the Binary is stored.
- * Then << is called, which calls Binary's print which adds the tabs and returns the stream.
- * \param &ost stream to extend
- * \param &m pointer to created Binary object
- * \return &ost
- */ 
-ostream& operator<<(ostream& ost,const Binary& m)
-{
-  return m.print(ost);
-};
Index: c/verbose.hpp
===================================================================
--- src/verbose.hpp	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * verbose.hpp
- *
- *  Created on: Aug 3, 2009
- *      Author: heber
- */
-
-#ifndef VERBOSE_HPP_
-#define VERBOSE_HPP_
-
-using namespace std;
-
-/*********************************************** includes ***********************************/
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iosfwd>
-
-/************************************* Class Verbose & Binary *******************************/
-
-/** Verbose is an IO manipulator, that writes tabs according to \a Verbosity level.
- */
-class Verbose
-{
-  public:
-    Verbose(int value) : Verbosity(value) { }
-
-    // allow access to private variable Verbose::Verbosity
-    friend ostream& operator<<(class errorLogger& l, const Verbose& v);
-    friend ostream& operator<<(class errorLogger* l, const Verbose& v);
-    friend ostream& operator<<(class logger& l, const Verbose& v);
-    friend ostream& operator<<(class logger* l, const Verbose& v);
-
-    ostream& print (ostream &ost) const;
-    bool DoOutput(int verbosityLevel) const;
-    bool DoErrorOutput(int verbosityLevel) const;
-  private:
-    int Verbosity;
-};
-
-ostream& operator<<(ostream& ost,const Verbose& m);
-
-/** Binary is an IO manipulator, that writes 0 and 1 according to number \a Binary.
- */
-class Binary
-{
-  public:
-    Binary(int value) : BinaryNumber(value) { }
-
-    ostream& print (ostream &ost) const;
-  private:
-    int BinaryNumber;
-};
-
-ostream& operator<<(ostream& ost,const Binary& m);
-
-
-
-#endif /* VERBOSE_HPP_ */
Index: src/version.h
===================================================================
--- src/version.h	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ src/version.h	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -2,5 +2,5 @@
 #define VERSION_H_
 
-extern const char *ESPACKVersion;
+extern const char *MOLECUILDERVERSION;
 
 #endif /* VERSION_H_ */
Index: test_all.sh
===================================================================
--- test_all.sh	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ test_all.sh	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,5 +1,6 @@
 #!/bin/bash
 
-optimizations=("-O0"\
+optimizations=("-g3"\
+               "-O0"\
 	       "-O1"\
                "-O2"\
@@ -49,4 +50,10 @@
 }
 
+function logdate()
+{
+  echo -e "Launched on `date`.\n\n" >> $logfile 2>&1;
+}
+
+
 while getopts âho:f:j:scO:t:p:â OPTION
 do
@@ -105,5 +112,5 @@
 function configure(){
   echo "Configuring";
-  CXXFLAGS="$2" $1/configure --prefix=$PWD >> $logfile 2>&1;
+  $1/configure $3 --prefix=$PWD CXXFLAGS="-Wall $2" >> $logfile 2>&1;
 }
 
@@ -111,7 +118,7 @@
   echo "Making";
   if [ $noprocs -gt 1 ]; then
-    make -j$noprocs all install >>$logfile 2>&1;
-  else
-    make all install >>$logfile 2>&1;
+    make -j$noprocs all >>$logfile 2>&1;
+  else
+    make all >>$logfile 2>&1;
   fi
 }
@@ -134,5 +141,5 @@
     then
       echo -n "    $test: " >> $outfile;
-      valgrind -v --error-exitcode=255 $test >> $logfile 2>&1;
+      valgrind -v --leak-check=full --leak-resolution=high --show-reachable=yes --error-exitcode=255 $test >> $logfile 2>&1;
       if [ $? ]
       then
@@ -149,12 +156,18 @@
 function test(){
 
-  echo "Testing with \"$2\"";
+  echo "Testing with \"$2 $3\"";
   echo "" >> $logfile;
   echo "" >> $logfile;
   echo "" >> $logfile;
-  echo "Testing with \"$2\"" >> $logfile;
-
-  echo -n "  Configuring: " >> $outfile;
-  if configure "$1" "$2"
+  echo "Testing with \"$2 $3\"" >> $logfile;
+
+  if [ x"$2" == x"-g3" ]
+  then
+    valgrind="--with-valgrind"
+  else
+    valgrind="--without-valgrind"
+  fi
+  echo -n "  Configuring $valgrind: " >> $outfile;
+  if configure "$1" "$2 $3" "$valgrind"
   then
     echo "OK" >> $outfile;
@@ -201,9 +214,9 @@
 
 function run(){
-  echo "Testing with \"$1\":" >> $outfile;
+  echo "Testing with \"$1 $2\":" >> $outfile;
   testdir=`mktemp -d --tmpdir=$tmpdir $tmppattern.XXXXXXXXXX`;
   basedir=$PWD;
   cd $testdir;
-  test "$basedir" "$1";
+  test "$basedir" "$1" "$2";
   cd $basedir;
   rm -rf $testdir;
@@ -220,5 +233,5 @@
   for option in "${options[@]}"
   do
-    run "$optimization $option";
+    run "$optimization" "$option";
   done
 done
Index: tests/Tesselations/Makefile.am
===================================================================
--- tests/Tesselations/Makefile.am	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/Tesselations/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,15 +1,17 @@
-TESTS = 1_2-dimethoxyethane.test \
-1_2-dimethylbenzene.test \
-2-methylcyclohexanone.test \
-benzene.test \
-cholesterol.test \
-cycloheptane.test \
-dimethyl_bromomalonate.test \
-glucose.test \
-heptan.test \
-isoleucine.test \
-neohexane.test \
-N_N-dimethylacetamide.test \
-proline.test \
-putrescine.test \
-tartaric_acid.test
+TESTS = \
+	1_2-dimethoxyethane.test \
+	1_2-dimethylbenzene.test \
+	2-methylcyclohexanone.test \
+	benzene.test \
+	cholesterol.test \
+	cycloheptane.test \
+	dimethyl_bromomalonate.test \
+	glucose.test \
+	isoleucine.test \
+	neohexane.test \
+	N_N-dimethylacetamide.test \
+	proline.test \
+	putrescine.test \
+	tartaric_acid.test
+
+#	heptan.test
Index: tests/Tesselations/defs.in
===================================================================
--- tests/Tesselations/defs.in	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/Tesselations/defs.in	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -54,7 +54,7 @@
 	#echo "Current dir is `pwd`, calling $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -N $RADIUS $FILENAME."
 	if [ -e $mol.dbond ]; then
-		$MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -A $mol.dbond --select-molecule-by-id 0 -N $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$?
+		$MOLECUILDER -i ../$mol.xyz -A $mol.dbond --select-molecule-by-id 0 -N $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$?
 	else
-		$MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz --select-molecule-by-id 0 -N $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$?
+		$MOLECUILDER -i ../$mol.xyz --select-molecule-by-id 0 -N $RADIUS --nonconvex-file $FILENAME 2>stderr >stdout || exitcode=$?
 	fi
 	#echo "Molecuilder done with exitcode $exitcode."
Index: tests/regression/Makefile.am
===================================================================
--- tests/regression/Makefile.am	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/Makefile.am	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,30 +1,51 @@
 AUTOM4TE = autom4te
-EXTRA_DIST = testsuite.at $(TESTSUITE) atlocal.in regression
+EXTRA_DIST = \
+	testsuite*.at \
+	$(TESTSUITE) \
+	atlocal.in \
+	molecuider.in \
+	Analysis \
+	Domain \
+	Filling \
+	Fragmentation \
+	Graph \
+	Molecules \
+	Simple_configuration \
+	Tesselation
 TESTSUITE = $(srcdir)/testsuite
 
+max_jobs = 4
+ 
 check-local: atconfig atlocal package.m4 $(TESTSUITE)
-		$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
+	nrjobs=; \
+	for flag in $$MAKEFLAGS; do \
+		case $$flag in \
+		--* | =*=) ;; \
+		*j*) nrjobs="-j$(max_jobs)" ;; \
+		esac; \
+	done; \
+	$(SHELL) '$(TESTSUITE)' $$nrjobs $(TESTSUITEFLAGS)
 
 installcheck-local: atconfig atlocal $(TESTSUITE)
-		$(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
-		$(TESTSUITEFLAGS)
-     
+	$(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
+	$(TESTSUITEFLAGS)
+
 clean-local:
-		test ! -f '$(TESTSUITE)' || \
-		$(SHELL) '$(TESTSUITE)' --clean
+	test ! -f '$(TESTSUITE)' || \
+	$(SHELL) '$(TESTSUITE)' --clean
 
 AUTOTEST = $(AUTOM4TE) --language=autotest
 $(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/testsuite-*.at
-		$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
-		mv $@.tmp $@
+	$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
+	mv $@.tmp $@
 
 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
-			:;{ \
-					echo '# Signature of the current package.' && \
-					echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])' && \
-					echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])' && \
-					echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])' && \
-					echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])' && \
-					echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
-				} >'$(srcdir)/package.m4'
+	:;{ \
+		echo '# Signature of the current package.' && \
+		echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])' && \
+		echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])' && \
+		echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])' && \
+		echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])' && \
+		echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+	} >'$(srcdir)/package.m4'
Index: tests/regression/Molecules/10/post/test-rotated-xYz20.xyz
===================================================================
--- tests/regression/Molecules/10/post/test-rotated-xYz20.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/10/post/test-rotated-xYz20.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	9.8135	2.37271	3.16085
+H	9.33431	2.65703	4.85139
+H	10.6201	3.64185	4.11314
+H	8.96913	4.62097	2.54339
+H	8.48994	4.90529	4.23393
+H	6.55678	4.15323	2.87536
+H	7.44056	2.67134	2.43801
+H	6.96137	2.95567	4.12855
+C	9.67442	3.13152	3.9309
+C	8.62901	4.14648	3.46388
+C	7.30149	3.43016	3.20806
Index: tests/regression/Molecules/10/post/test-rotated-z180.xyz
===================================================================
--- tests/regression/Molecules/10/post/test-rotated-z180.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/10/post/test-rotated-z180.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	7.28356	4.4665	2.64589
+H	7.28356	4.4665	4.42589
+H	6.39365	3.20785	3.53589
+H	8.53286	2.3245	2.64589
+H	8.53286	2.3245	4.42589
+H	10.672	3.20785	3.53589
+H	9.78206	4.4665	2.64589
+H	9.78206	4.4665	4.42589
+C	7.28356	3.8372	3.53589
+C	8.53286	2.9538	3.53589
+C	9.78206	3.8372	3.53589
Index: tests/regression/Molecules/10/post/test-rotated-z360.xyz
===================================================================
--- tests/regression/Molecules/10/post/test-rotated-z360.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/10/post/test-rotated-z360.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	9.78209	2.64589	2.64589
+H	9.78209	2.64589	4.42589
+H	10.672	3.90454	3.53589
+H	8.53279	4.78789	2.64589
+H	8.53279	4.78789	4.42589
+H	6.39363	3.90454	3.53589
+H	7.28359	2.64589	2.64589
+H	7.28359	2.64589	4.42589
+C	9.78209	3.27519	3.53589
+C	8.53279	4.15859	3.53589
+C	7.28359	3.27519	3.53589
Index: tests/regression/Molecules/10/post/test-rotated-z90.xyz
===================================================================
--- tests/regression/Molecules/10/post/test-rotated-z90.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/10/post/test-rotated-z90.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	7.62252	2.30693	2.64589
+H	7.62252	2.30693	4.42589
+H	8.88117	1.41702	3.53589
+H	9.76452	3.55623	2.64589
+H	9.76452	3.55623	4.42589
+H	8.88117	5.69539	3.53589
+H	7.62252	4.80543	2.64589
+H	7.62252	4.80543	4.42589
+C	8.25182	2.30693	3.53589
+C	9.13522	3.55623	3.53589
+C	8.25182	4.80543	3.53589
Index: tests/regression/Molecules/10/pre/test.xyz
===================================================================
--- tests/regression/Molecules/10/pre/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/10/pre/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	9.78209	2.64589	2.64589
+H	9.78209	2.64589	4.42589
+H	10.672	3.90454	3.53589
+H	8.53279	4.78789	2.64589
+H	8.53279	4.78789	4.42589
+H	6.39363	3.90454	3.53589
+H	7.28359	2.64589	2.64589
+H	7.28359	2.64589	4.42589
+C	9.78209	3.27519	3.53589
+C	8.53279	4.15859	3.53589
+C	7.28359	3.27519	3.53589
Index: tests/regression/Molecules/11/post/test-copy.xyz
===================================================================
--- tests/regression/Molecules/11/post/test-copy.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/11/post/test-copy.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,24 @@
+22
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	9.78209	2.64589	2.64589
+H	9.78209	2.64589	4.42589
+H	10.672	3.90454	3.53589
+H	8.53279	4.78789	2.64589
+H	8.53279	4.78789	4.42589
+H	6.39363	3.90454	3.53589
+H	7.28359	2.64589	2.64589
+H	7.28359	2.64589	4.42589
+C	9.78209	3.27519	3.53589
+C	8.53279	4.15859	3.53589
+C	7.28359	3.27519	3.53589
+H	1.24927	-0.870236	9.11
+H	1.24927	-0.870236	10.89
+H	2.13918	0.388414	10
+H	-3.18182e-05	1.27176	9.11
+H	-3.18182e-05	1.27176	10.89
+H	-2.13919	0.388414	10
+H	-1.24923	-0.870236	9.11
+H	-1.24923	-0.870236	10.89
+C	1.24927	-0.240936	10
+C	-3.18182e-05	0.642464	10
+C	-1.24923	-0.240936	10
Index: tests/regression/Molecules/11/pre/test.xyz
===================================================================
--- tests/regression/Molecules/11/pre/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/11/pre/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	9.78209	2.64589	2.64589
+H	9.78209	2.64589	4.42589
+H	10.672	3.90454	3.53589
+H	8.53279	4.78789	2.64589
+H	8.53279	4.78789	4.42589
+H	6.39363	3.90454	3.53589
+H	7.28359	2.64589	2.64589
+H	7.28359	2.64589	4.42589
+C	9.78209	3.27519	3.53589
+C	8.53279	4.15859	3.53589
+C	7.28359	3.27519	3.53589
Index: tests/regression/Molecules/2/post/test.adj
===================================================================
--- tests/regression/Molecules/2/post/test.adj	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/Molecules/2/post/test.adj	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -9,4 +9,4 @@
 7	10	
 8	0	9	1	2	
-9	3	10	4	8	
+9	8	10	3	4	
 10	5	6	7	9	
Index: tests/regression/Molecules/8/post/test-rotated-xYz20.xyz
===================================================================
--- tests/regression/Molecules/8/post/test-rotated-xYz20.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/8/post/test-rotated-xYz20.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	8.35684	1.92717	6.65103
+H	6.63234	2.36823	6.65103
+H	7.80647	3.36711	7.54093
+H	8.88759	4.00235	5.4017
+H	7.1631	4.44342	5.40171
+H	7.80645	3.36705	3.26256
+H	8.35682	1.92714	4.15253
+H	6.63233	2.3682	4.15254
+C	7.65052	2.75737	6.65102
+C	7.86942	3.61321	5.40172
+C	7.65051	2.75734	4.15253
Index: tests/regression/Molecules/8/post/test-rotated-z180.xyz
===================================================================
--- tests/regression/Molecules/8/post/test-rotated-z180.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/8/post/test-rotated-z180.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	-7.64281	-2.64592	2.28661
+H	-9.42281	-2.64589	2.28661
+H	-8.53283	-3.90457	1.39672
+H	-7.64284	-4.7879	3.53594
+H	-9.42284	-4.78788	3.53594
+H	-8.53283	-3.90451	5.67509
+H	-7.64281	-2.64589	4.78511
+H	-9.42281	-2.64586	4.78511
+C	-8.53282	-3.27521	2.28662
+C	-8.53283	-4.15859	3.53593
+C	-8.53282	-3.27517	4.78512
Index: tests/regression/Molecules/8/post/test-rotated-z360.xyz
===================================================================
--- tests/regression/Molecules/8/post/test-rotated-z360.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/8/post/test-rotated-z360.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	9.42281	2.64589	4.78517
+H	7.64281	2.64592	4.78517
+H	8.53283	3.90457	5.67506
+H	9.42284	4.78788	3.53584
+H	7.64284	4.7879	3.53584
+H	8.53283	3.90451	1.39669
+H	9.42281	2.64586	2.28667
+H	7.64281	2.64589	2.28667
+C	8.53282	3.27521	4.78516
+C	8.53283	4.15859	3.53585
+C	8.53282	3.27517	2.28666
Index: tests/regression/Molecules/8/post/test-rotated-z90.xyz
===================================================================
--- tests/regression/Molecules/8/post/test-rotated-z90.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/8/post/test-rotated-z90.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	2.64589	-9.42281	4.78517
+H	2.64592	-7.64281	4.78517
+H	3.90457	-8.53283	5.67506
+H	4.78788	-9.42284	3.53584
+H	4.7879	-7.64284	3.53584
+H	3.90451	-8.53283	1.39669
+H	2.64586	-9.42281	2.28667
+H	2.64589	-7.64281	2.28667
+C	3.27521	-8.53282	4.78516
+C	4.15859	-8.53283	3.53585
+C	3.27517	-8.53282	2.28666
Index: tests/regression/Molecules/8/pre/test-rotated-xYz20.xyz
===================================================================
--- tests/regression/Molecules/8/pre/test-rotated-xYz20.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/8/pre/test-rotated-xYz20.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	9.00082	1.84611	5.02671
+H	8.52163	2.13043	6.71726
+H	9.80746	3.11525	5.979
+H	8.15645	4.09438	4.40925
+H	7.67726	4.3787	6.0998
+H	5.7441	3.62663	4.74123
+H	6.62788	2.14475	4.30388
+H	6.1487	2.42907	5.99442
+C	8.86174	2.60492	5.79677
+C	7.81634	3.61989	5.32974
+C	6.48881	2.90356	5.07393
Index: tests/regression/Molecules/8/pre/test-rotated-z180.xyz
===================================================================
--- tests/regression/Molecules/8/pre/test-rotated-z180.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/8/pre/test-rotated-z180.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	-9.78209	-2.64589	2.64589
+H	-9.78209	-2.64589	4.42589
+H	-10.672	-3.90454	3.53589
+H	-8.53279	-4.78789	2.64589
+H	-8.53279	-4.78789	4.42589
+H	-6.39363	-3.90454	3.53589
+H	-7.28359	-2.64589	2.64589
+H	-7.28359	-2.64589	4.42589
+C	-9.78209	-3.27519	3.53589
+C	-8.53279	-4.15859	3.53589
+C	-7.28359	-3.27519	3.53589
Index: tests/regression/Molecules/8/pre/test-rotated-z360.xyz
===================================================================
--- tests/regression/Molecules/8/pre/test-rotated-z360.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/8/pre/test-rotated-z360.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	9.78209	2.64589	2.64589
+H	9.78209	2.64589	4.42589
+H	10.672	3.90454	3.53589
+H	8.53279	4.78789	2.64589
+H	8.53279	4.78789	4.42589
+H	6.39363	3.90454	3.53589
+H	7.28359	2.64589	2.64589
+H	7.28359	2.64589	4.42589
+C	9.78209	3.27519	3.53589
+C	8.53279	4.15859	3.53589
+C	7.28359	3.27519	3.53589
Index: tests/regression/Molecules/8/pre/test-rotated-z90.xyz
===================================================================
--- tests/regression/Molecules/8/pre/test-rotated-z90.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/8/pre/test-rotated-z90.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	2.64589	-9.78209	2.64589
+H	2.64589	-9.78209	4.42589
+H	3.90454	-10.672	3.53589
+H	4.78789	-8.53279	2.64589
+H	4.78789	-8.53279	4.42589
+H	3.90454	-6.39363	3.53589
+H	2.64589	-7.28359	2.64589
+H	2.64589	-7.28359	4.42589
+C	3.27519	-9.78209	3.53589
+C	4.15859	-8.53279	3.53589
+C	3.27519	-7.28359	3.53589
Index: sts/regression/Molecules/8/pre/test.conf
===================================================================
--- tests/regression/Molecules/8/pre/test.conf	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,83 +1,0 @@
-# ParallelCarParinello - main configuration file - created with molecuilder
-
-mainname	pcp	# programm name (for runtime files)
-defaultpath	not specified	# where to put files during runtime
-pseudopotpath	not specified	# where to find pseudopotentials
-
-ProcPEGamma	8	# for parallel computing: share constants
-ProcPEPsi	1	# for parallel computing: share wave functions
-DoOutVis	0	# Output data for OpenDX
-DoOutMes	1	# Output data for measurements
-DoOutOrbitals	0	# Output all Orbitals
-DoOutCurr	0	# Ouput current density for OpenDx
-DoOutNICS	0	# Output Nucleus independent current shieldings
-DoPerturbation	0	# Do perturbation calculate and determine susceptibility and shielding
-DoFullCurrent	0	# Do full perturbation
-DoConstrainedMD	0	# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD
-Thermostat	Berendsen	2.5	# Which Thermostat and its parameters to use in MD case.
-CommonWannier	0	# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center
-SawtoothStart	0.01	# Absolute value for smooth transition at cell border 
-VectorPlane	0	# Cut plane axis (x, y or z: 0,1,2) for two-dim current vector plot
-VectorCut	0	# Cut plane axis value
-AddGramSch	1	# Additional GramSchmidtOrtogonalization to be safe
-Seed		1	# initial value for random seed for Psi coefficients
-
-MaxOuterStep	0	# number of MolecularDynamics/Structure optimization steps
-Deltat	0.01	# time per MD step
-OutVisStep	10	# Output visual data every ...th step
-OutSrcStep	5	# Output "restart" data every ..th step
-TargetTemp	0.000950045	# Target temperature
-MaxPsiStep	0	# number of Minimisation steps per state (0 - default)
-EpsWannier	1e-07	# tolerance value for spread minimisation of orbitals
-
-# Values specifying when to stop
-MaxMinStep	100	# Maximum number of steps
-RelEpsTotalE	1e-07	# relative change in total energy
-RelEpsKineticE	1e-05	# relative change in kinetic energy
-MaxMinStopStep	0	# check every ..th steps
-MaxMinGapStopStep	0	# check every ..th steps
-
-# Values specifying when to stop for INIT, otherwise same as above
-MaxInitMinStep	100	# Maximum number of steps
-InitRelEpsTotalE	1e-05	# relative change in total energy
-InitRelEpsKineticE	0.0001	# relative change in kinetic energy
-InitMaxMinStopStep	0	# check every ..th steps
-InitMaxMinGapStopStep	0	# check every ..th steps
-
-BoxLength			# (Length of a unit cell)
-20	
-0	20	
-0	0	20	
-
-ECut		128	# energy cutoff for discretization in Hartrees
-MaxLevel	5	# number of different levels in the code, >=2
-Level0Factor	2	# factor by which node number increases from S to 0 level
-RiemannTensor	0	# (Use metric)
-PsiType		0	# 0 - doubly occupied, 1 - SpinUp,SpinDown
-MaxPsiDouble	0	# here: specifying both maximum number of SpinUp- and -Down-states
-PsiMaxNoUp	0	# here: specifying maximum number of SpinUp-states
-PsiMaxNoDown	0	# here: specifying maximum number of SpinDown-states
-AddPsis		0	# Additional unoccupied Psis for bandgap determination
-
-RCut		20	# R-cut for the ewald summation
-StructOpt	0	# Do structure optimization beforehand
-IsAngstroem	1	# 0 - Bohr, 1 - Angstroem
-RelativeCoord	0	# whether ion coordinates are relative (1) or absolute (0)
-MaxTypes	2	# maximum number of different ion types
-
-# Ion type data (PP = PseudoPotential, Z = atomic number)
-#Ion_TypeNr.	Amount	Z	RGauss	L_Max(PP)L_Loc(PP)IonMass	# chemical name, symbol
-Ion_Type1	8	1	1.0	3	3	1.00800000000	Hydrogen	H
-Ion_Type2	3	6	1.0	3	3	12.01100000000	Carbon	C
-#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)
-Ion_Type2_1	9.782085945	3.275186040	3.535886037	0 # molecule nr 0
-Ion_Type2_2	8.532785963	4.158586027	3.535886037	0 # molecule nr 1
-Ion_Type2_3	7.283585982	3.275186040	3.535886037	0 # molecule nr 2
-Ion_Type1_1	9.782085945	2.645886050	2.645886050	0 # molecule nr 3
-Ion_Type1_2	9.782085945	2.645886050	4.425886024	0 # molecule nr 4
-Ion_Type1_3	10.672039608	3.904536878	3.535886037	0 # molecule nr 5
-Ion_Type1_4	8.532785963	4.787886018	2.645886050	0 # molecule nr 6
-Ion_Type1_5	8.532785963	4.787886018	4.425886024	0 # molecule nr 7
-Ion_Type1_6	6.393632318	3.904536877	3.535886037	0 # molecule nr 8
-Ion_Type1_7	7.283585982	2.645886050	2.645886050	0 # molecule nr 9
-Ion_Type1_8	7.283585982	2.645886050	4.425886024	0 # molecule nr 10
Index: tests/regression/Molecules/9/post/test-rotated-xYz20.xyz
===================================================================
--- tests/regression/Molecules/9/post/test-rotated-xYz20.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/9/post/test-rotated-xYz20.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	9.00082	1.84611	5.02671
+H	8.52163	2.13043	6.71726
+H	9.80746	3.11525	5.979
+H	8.15645	4.09438	4.40925
+H	7.67726	4.3787	6.0998
+H	5.7441	3.62663	4.74123
+H	6.62788	2.14475	4.30388
+H	6.1487	2.42907	5.99442
+C	8.86174	2.60492	5.79677
+C	7.81634	3.61989	5.32974
+C	6.48881	2.90356	5.07393
Index: tests/regression/Molecules/9/post/test-rotated-z180.xyz
===================================================================
--- tests/regression/Molecules/9/post/test-rotated-z180.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/9/post/test-rotated-z180.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	-9.78209	-2.64589	2.64589
+H	-9.78209	-2.64589	4.42589
+H	-10.672	-3.90454	3.53589
+H	-8.53279	-4.78789	2.64589
+H	-8.53279	-4.78789	4.42589
+H	-6.39363	-3.90454	3.53589
+H	-7.28359	-2.64589	2.64589
+H	-7.28359	-2.64589	4.42589
+C	-9.78209	-3.27519	3.53589
+C	-8.53279	-4.15859	3.53589
+C	-7.28359	-3.27519	3.53589
Index: tests/regression/Molecules/9/post/test-rotated-z360.xyz
===================================================================
--- tests/regression/Molecules/9/post/test-rotated-z360.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/9/post/test-rotated-z360.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	9.78209	2.64589	2.64589
+H	9.78209	2.64589	4.42589
+H	10.672	3.90454	3.53589
+H	8.53279	4.78789	2.64589
+H	8.53279	4.78789	4.42589
+H	6.39363	3.90454	3.53589
+H	7.28359	2.64589	2.64589
+H	7.28359	2.64589	4.42589
+C	9.78209	3.27519	3.53589
+C	8.53279	4.15859	3.53589
+C	7.28359	3.27519	3.53589
Index: tests/regression/Molecules/9/post/test-rotated-z90.xyz
===================================================================
--- tests/regression/Molecules/9/post/test-rotated-z90.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/9/post/test-rotated-z90.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	2.64589	-9.78209	2.64589
+H	2.64589	-9.78209	4.42589
+H	3.90454	-10.672	3.53589
+H	4.78789	-8.53279	2.64589
+H	4.78789	-8.53279	4.42589
+H	3.90454	-6.39363	3.53589
+H	2.64589	-7.28359	2.64589
+H	2.64589	-7.28359	4.42589
+C	3.27519	-9.78209	3.53589
+C	4.15859	-8.53279	3.53589
+C	3.27519	-7.28359	3.53589
Index: tests/regression/Molecules/9/pre/test.xyz
===================================================================
--- tests/regression/Molecules/9/pre/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Molecules/9/pre/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,13 @@
+11
+	Created by molecuilder on Fri Aug  6 15:40:35 2010
+H	9.78209	2.64589	2.64589
+H	9.78209	2.64589	4.42589
+H	10.672	3.90454	3.53589
+H	8.53279	4.78789	2.64589
+H	8.53279	4.78789	4.42589
+H	6.39363	3.90454	3.53589
+H	7.28359	2.64589	2.64589
+H	7.28359	2.64589	4.42589
+C	9.78209	3.27519	3.53589
+C	8.53279	4.15859	3.53589
+C	7.28359	3.27519	3.53589
Index: tests/regression/Simple_configuration/2/post/test.pdb
===================================================================
--- tests/regression/Simple_configuration/2/post/test.pdb	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Simple_configuration/2/post/test.pdb	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,3 @@
+REMARK created by molecuilder on Fri Aug 27 12:18:33 2010
+ATOM      1  H01 non b   1        10.0    10.0    10.0   1.0   1.0         0 H 0
+END
Index: tests/regression/Simple_configuration/3/post/empty.conf
===================================================================
--- tests/regression/Simple_configuration/3/post/empty.conf	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Simple_configuration/3/post/empty.conf	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,70 @@
+# ParallelCarParinello - main configuration file - created with molecuilder
+
+mainname	pcp	# programm name (for runtime files)
+defaultpath	not specified	# where to put files during runtime
+pseudopotpath	not specified	# where to find pseudopotentials
+
+ProcPEGamma	8	# for parallel computing: share constants
+ProcPEPsi	1	# for parallel computing: share wave functions
+DoOutVis	0	# Output data for OpenDX
+DoOutMes	1	# Output data for measurements
+DoOutOrbitals	0	# Output all Orbitals
+DoOutCurr	0	# Ouput current density for OpenDx
+DoOutNICS	0	# Output Nucleus independent current shieldings
+DoPerturbation	0	# Do perturbation calculate and determine susceptibility and shielding
+DoFullCurrent	0	# Do full perturbation
+DoConstrainedMD	0	# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD
+Thermostat	Berendsen	2.5	# Which Thermostat and its parameters to use in MD case.
+CommonWannier	0	# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center
+SawtoothStart	0.01	# Absolute value for smooth transition at cell border 
+VectorPlane	0	# Cut plane axis (x, y or z: 0,1,2) for two-dim current vector plot
+VectorCut	0	# Cut plane axis value
+AddGramSch	1	# Additional GramSchmidtOrtogonalization to be safe
+Seed		1	# initial value for random seed for Psi coefficients
+
+MaxOuterStep	0	# number of MolecularDynamics/Structure optimization steps
+Deltat	0.01	# time per MD step
+OutVisStep	10	# Output visual data every ...th step
+OutSrcStep	5	# Output "restart" data every ..th step
+TargetTemp	0.000950045	# Target temperature
+MaxPsiStep	0	# number of Minimisation steps per state (0 - default)
+EpsWannier	1e-07	# tolerance value for spread minimisation of orbitals
+
+# Values specifying when to stop
+MaxMinStep	100	# Maximum number of steps
+RelEpsTotalE	1e-07	# relative change in total energy
+RelEpsKineticE	1e-05	# relative change in kinetic energy
+MaxMinStopStep	0	# check every ..th steps
+MaxMinGapStopStep	0	# check every ..th steps
+
+# Values specifying when to stop for INIT, otherwise same as above
+MaxInitMinStep	100	# Maximum number of steps
+InitRelEpsTotalE	1e-05	# relative change in total energy
+InitRelEpsKineticE	0.0001	# relative change in kinetic energy
+InitMaxMinStopStep	0	# check every ..th steps
+InitMaxMinGapStopStep	0	# check every ..th steps
+
+BoxLength			# (Length of a unit cell)
+20	
+0	20	
+0	0	20	
+
+ECut		128	# energy cutoff for discretization in Hartrees
+MaxLevel	5	# number of different levels in the code, >=2
+Level0Factor	2	# factor by which node number increases from S to 0 level
+RiemannTensor	0	# (Use metric)
+PsiType		0	# 0 - doubly occupied, 1 - SpinUp,SpinDown
+MaxPsiDouble	0	# here: specifying both maximum number of SpinUp- and -Down-states
+PsiMaxNoUp	0	# here: specifying maximum number of SpinUp-states
+PsiMaxNoDown	0	# here: specifying maximum number of SpinDown-states
+AddPsis		0	# Additional unoccupied Psis for bandgap determination
+
+RCut		20	# R-cut for the ewald summation
+StructOpt	0	# Do structure optimization beforehand
+IsAngstroem	1	# 0 - Bohr, 1 - Angstroem
+RelativeCoord	0	# whether ion coordinates are relative (1) or absolute (0)
+MaxTypes	0	# maximum number of different ion types
+
+# Ion type data (PP = PseudoPotential, Z = atomic number)
+#Ion_TypeNr.	Amount	Z	RGauss	L_Max(PP)L_Loc(PP)IonMass	# chemical name, symbol
+#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)
Index: tests/regression/Simple_configuration/5/pre/test.conf
===================================================================
--- tests/regression/Simple_configuration/5/pre/test.conf	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/Simple_configuration/5/pre/test.conf	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -28,5 +28,5 @@
 OutSrcStep	5	# Output "restart" data every ..th step
 TargetTemp	0.000950045	# Target temperature
-MaxPsiStep	0	# number of Minimisation steps per state (0 - default)
+MaxPsiStep	3	# number of Minimisation steps per state (0 - default)
 EpsWannier	1e-07	# tolerance value for spread minimisation of orbitals
 
@@ -35,6 +35,6 @@
 RelEpsTotalE	1e-07	# relative change in total energy
 RelEpsKineticE	1e-05	# relative change in kinetic energy
-MaxMinStopStep	0	# check every ..th steps
-MaxMinGapStopStep	0	# check every ..th steps
+MaxMinStopStep	1	# check every ..th steps
+MaxMinGapStopStep	1	# check every ..th steps
 
 # Values specifying when to stop for INIT, otherwise same as above
@@ -42,6 +42,6 @@
 InitRelEpsTotalE	1e-05	# relative change in total energy
 InitRelEpsKineticE	0.0001	# relative change in kinetic energy
-InitMaxMinStopStep	0	# check every ..th steps
-InitMaxMinGapStopStep	0	# check every ..th steps
+InitMaxMinStopStep	1	# check every ..th steps
+InitMaxMinGapStopStep	1	# check every ..th steps
 
 BoxLength			# (Length of a unit cell)
@@ -54,8 +54,8 @@
 Level0Factor	2	# factor by which node number increases from S to 0 level
 RiemannTensor	0	# (Use metric)
-PsiType		0	# 0 - doubly occupied, 1 - SpinUp,SpinDown
+PsiType		1	# 0 - doubly occupied, 1 - SpinUp,SpinDown
 MaxPsiDouble	0	# here: specifying both maximum number of SpinUp- and -Down-states
 PsiMaxNoUp	0	# here: specifying maximum number of SpinUp-states
-PsiMaxNoDown	0	# here: specifying maximum number of SpinDown-states
+PsiMaxNoDown	1	# here: specifying maximum number of SpinDown-states
 AddPsis		0	# Additional unoccupied Psis for bandgap determination
 
Index: tests/regression/Simple_configuration/8/post/test-cuboid.xyz-sorted
===================================================================
--- tests/regression/Simple_configuration/8/post/test-cuboid.xyz-sorted	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Simple_configuration/8/post/test-cuboid.xyz-sorted	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,4 @@
+C	9.78209	3.27519	3.53589
+H	10.672	3.90454	3.53589
+H	9.78209	2.64589	2.64589
+H	9.78209	2.64589	4.42589
Index: tests/regression/Simple_configuration/8/post/test-sphere.xyz-sorted
===================================================================
--- tests/regression/Simple_configuration/8/post/test-sphere.xyz-sorted	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Simple_configuration/8/post/test-sphere.xyz-sorted	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,144 @@
+C	7.28359	3.27519	3.53589
+C	8.53279	4.15859	3.53589
+C	9.78209	3.27519	3.53589
+H	0.758602	2.85714	2.85714
+H	0.758602	2.85714	3.86571
+H	0.758602	2.85714	5.71429
+H	0.758602	5.71429	2.85714
+H	0.758602	5.71429	3.86571
+H	10.672	3.90454	3.53589
+H	12.1872	0	0
+H	12.1872	0	1.00857
+H	12.1872	0	2.85714
+H	12.1872	0	3.86571
+H	12.1872	0	5.71429
+H	12.1872	0	6.72285
+H	12.1872	2.85714	0
+H	12.1872	2.85714	1.00857
+H	12.1872	2.85714	5.71429
+H	12.1872	2.85714	6.72285
+H	12.1872	5.71429	0
+H	12.1872	5.71429	1.00857
+H	12.1872	5.71429	2.85714
+H	12.1872	5.71429	3.86571
+H	12.1872	5.71429	5.71429
+H	12.1872	5.71429	6.72285
+H	3.61574	0	0
+H	3.61574	0	1.00857
+H	3.61574	0	2.85714
+H	3.61574	0	3.86571
+H	3.61574	0	5.71429
+H	3.61574	0	6.72285
+H	3.61574	2.85714	0
+H	3.61574	2.85714	1.00857
+H	3.61574	2.85714	2.85714
+H	3.61574	2.85714	3.86571
+H	3.61574	2.85714	5.71429
+H	3.61574	2.85714	6.72285
+H	3.61574	2.85714	8.57143
+H	3.61574	5.71429	0
+H	3.61574	5.71429	1.00857
+H	3.61574	5.71429	2.85714
+H	3.61574	5.71429	3.86571
+H	3.61574	5.71429	5.71429
+H	3.61574	5.71429	6.72285
+H	3.61574	5.71429	8.57143
+H	3.61574	8.57143	1.00857
+H	3.61574	8.57143	2.85714
+H	3.61574	8.57143	3.86571
+H	3.61574	8.57143	5.71429
+H	6.39363	3.90454	3.53589
+H	6.47289	0	0
+H	6.47289	0	1.00857
+H	6.47289	0	2.85714
+H	6.47289	0	3.86571
+H	6.47289	0	5.71429
+H	6.47289	0	6.72285
+H	6.47289	0	8.57143
+H	6.47289	0	9.58
+H	6.47289	2.85714	0
+H	6.47289	2.85714	6.72285
+H	6.47289	2.85714	8.57143
+H	6.47289	2.85714	9.58
+H	6.47289	5.71429	0
+H	6.47289	5.71429	1.00857
+H	6.47289	5.71429	5.71429
+H	6.47289	5.71429	6.72285
+H	6.47289	5.71429	8.57143
+H	6.47289	5.71429	9.58
+H	6.47289	8.57143	0
+H	6.47289	8.57143	1.00857
+H	6.47289	8.57143	2.85714
+H	6.47289	8.57143	3.86571
+H	6.47289	8.57143	5.71429
+H	6.47289	8.57143	6.72285
+H	7.28359	2.64589	2.64589
+H	7.28359	2.64589	4.42589
+H	8.53279	4.78789	2.64589
+H	8.53279	4.78789	4.42589
+H	9.33003	0	0
+H	9.33003	0	1.00857
+H	9.33003	0	2.85714
+H	9.33003	0	3.86571
+H	9.33003	0	5.71429
+H	9.33003	0	6.72285
+H	9.33003	0	8.57143
+H	9.33003	2.85714	0
+H	9.33003	2.85714	6.72285
+H	9.33003	2.85714	8.57143
+H	9.33003	2.85714	9.58
+H	9.33003	5.71429	0
+H	9.33003	5.71429	6.72285
+H	9.33003	5.71429	8.57143
+H	9.33003	5.71429	9.58
+H	9.33003	8.57143	0
+H	9.33003	8.57143	1.00857
+H	9.33003	8.57143	2.85714
+H	9.33003	8.57143	3.86571
+H	9.33003	8.57143	5.71429
+H	9.33003	8.57143	6.72285
+H	9.78209	2.64589	2.64589
+H	9.78209	2.64589	4.42589
+O	11.4286	0	0.504284
+O	11.4286	0	3.36143
+O	11.4286	0	6.21857
+O	11.4286	2.85714	0.504284
+O	11.4286	2.85714	6.21857
+O	11.4286	2.85714	9.07571
+O	11.4286	5.71429	0.504284
+O	11.4286	5.71429	6.21857
+O	11.4286	8.57143	3.36143
+O	2.85714	0	0.504284
+O	2.85714	0	3.36143
+O	2.85714	0	6.21857
+O	2.85714	2.85714	0.504284
+O	2.85714	2.85714	3.36143
+O	2.85714	2.85714	6.21857
+O	2.85714	5.71429	0.504284
+O	2.85714	5.71429	3.36143
+O	2.85714	5.71429	6.21857
+O	2.85714	8.57143	3.36143
+O	5.71429	0	0.504284
+O	5.71429	0	3.36143
+O	5.71429	0	6.21857
+O	5.71429	0	9.07571
+O	5.71429	2.85714	0.504284
+O	5.71429	2.85714	6.21857
+O	5.71429	2.85714	9.07571
+O	5.71429	5.71429	0.504284
+O	5.71429	5.71429	6.21857
+O	5.71429	5.71429	9.07571
+O	5.71429	8.57143	0.504284
+O	5.71429	8.57143	3.36143
+O	5.71429	8.57143	6.21857
+O	8.57143	0	0.504284
+O	8.57143	0	3.36143
+O	8.57143	0	6.21857
+O	8.57143	0	9.07571
+O	8.57143	2.85714	0.504284
+O	8.57143	2.85714	9.07571
+O	8.57143	5.71429	0.504284
+O	8.57143	5.71429	9.07571
+O	8.57143	8.57143	0.504284
+O	8.57143	8.57143	3.36143
+O	8.57143	8.57143	6.21857
Index: tests/regression/Simple_configuration/8/post/test-withoutcuboid.xyz-sorted
===================================================================
--- tests/regression/Simple_configuration/8/post/test-withoutcuboid.xyz-sorted	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Simple_configuration/8/post/test-withoutcuboid.xyz-sorted	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,1012 @@
+C	7.28359	3.27519	3.53589
+C	8.53279	4.15859	3.53589
+H	0.758602	0	0
+H	0.758602	0	1.00857
+H	0.758602	0	11.4286
+H	0.758602	0	12.4371
+H	0.758602	0	14.2857
+H	0.758602	0	15.2943
+H	0.758602	0	17.1429
+H	0.758602	0	18.1514
+H	0.758602	0	2.85714
+H	0.758602	0	3.86571
+H	0.758602	0	5.71429
+H	0.758602	0	6.72285
+H	0.758602	0	8.57143
+H	0.758602	0	9.58
+H	0.758602	11.4286	0
+H	0.758602	11.4286	1.00857
+H	0.758602	11.4286	11.4286
+H	0.758602	11.4286	12.4371
+H	0.758602	11.4286	14.2857
+H	0.758602	11.4286	15.2943
+H	0.758602	11.4286	17.1429
+H	0.758602	11.4286	18.1514
+H	0.758602	11.4286	2.85714
+H	0.758602	11.4286	3.86571
+H	0.758602	11.4286	5.71429
+H	0.758602	11.4286	6.72285
+H	0.758602	11.4286	8.57143
+H	0.758602	11.4286	9.58
+H	0.758602	14.2857	0
+H	0.758602	14.2857	1.00857
+H	0.758602	14.2857	11.4286
+H	0.758602	14.2857	12.4371
+H	0.758602	14.2857	14.2857
+H	0.758602	14.2857	15.2943
+H	0.758602	14.2857	17.1429
+H	0.758602	14.2857	18.1514
+H	0.758602	14.2857	2.85714
+H	0.758602	14.2857	3.86571
+H	0.758602	14.2857	5.71429
+H	0.758602	14.2857	6.72285
+H	0.758602	14.2857	8.57143
+H	0.758602	14.2857	9.58
+H	0.758602	17.1429	0
+H	0.758602	17.1429	1.00857
+H	0.758602	17.1429	11.4286
+H	0.758602	17.1429	12.4371
+H	0.758602	17.1429	14.2857
+H	0.758602	17.1429	15.2943
+H	0.758602	17.1429	17.1429
+H	0.758602	17.1429	18.1514
+H	0.758602	17.1429	2.85714
+H	0.758602	17.1429	3.86571
+H	0.758602	17.1429	5.71429
+H	0.758602	17.1429	6.72285
+H	0.758602	17.1429	8.57143
+H	0.758602	17.1429	9.58
+H	0.758602	2.85714	0
+H	0.758602	2.85714	1.00857
+H	0.758602	2.85714	11.4286
+H	0.758602	2.85714	12.4371
+H	0.758602	2.85714	14.2857
+H	0.758602	2.85714	15.2943
+H	0.758602	2.85714	17.1429
+H	0.758602	2.85714	18.1514
+H	0.758602	2.85714	2.85714
+H	0.758602	2.85714	3.86571
+H	0.758602	2.85714	5.71429
+H	0.758602	2.85714	6.72285
+H	0.758602	2.85714	8.57143
+H	0.758602	2.85714	9.58
+H	0.758602	5.71429	0
+H	0.758602	5.71429	1.00857
+H	0.758602	5.71429	11.4286
+H	0.758602	5.71429	12.4371
+H	0.758602	5.71429	14.2857
+H	0.758602	5.71429	15.2943
+H	0.758602	5.71429	17.1429
+H	0.758602	5.71429	18.1514
+H	0.758602	5.71429	2.85714
+H	0.758602	5.71429	3.86571
+H	0.758602	5.71429	5.71429
+H	0.758602	5.71429	6.72285
+H	0.758602	5.71429	8.57143
+H	0.758602	5.71429	9.58
+H	0.758602	8.57143	0
+H	0.758602	8.57143	1.00857
+H	0.758602	8.57143	11.4286
+H	0.758602	8.57143	12.4371
+H	0.758602	8.57143	14.2857
+H	0.758602	8.57143	15.2943
+H	0.758602	8.57143	17.1429
+H	0.758602	8.57143	18.1514
+H	0.758602	8.57143	2.85714
+H	0.758602	8.57143	3.86571
+H	0.758602	8.57143	5.71429
+H	0.758602	8.57143	6.72285
+H	0.758602	8.57143	8.57143
+H	0.758602	8.57143	9.58
+H	12.1872	0	0
+H	12.1872	0	1.00857
+H	12.1872	0	11.4286
+H	12.1872	0	12.4371
+H	12.1872	0	14.2857
+H	12.1872	0	15.2943
+H	12.1872	0	17.1429
+H	12.1872	0	18.1514
+H	12.1872	0	2.85714
+H	12.1872	0	3.86571
+H	12.1872	0	5.71429
+H	12.1872	0	6.72285
+H	12.1872	0	8.57143
+H	12.1872	0	9.58
+H	12.1872	11.4286	0
+H	12.1872	11.4286	1.00857
+H	12.1872	11.4286	11.4286
+H	12.1872	11.4286	12.4371
+H	12.1872	11.4286	14.2857
+H	12.1872	11.4286	15.2943
+H	12.1872	11.4286	17.1429
+H	12.1872	11.4286	18.1514
+H	12.1872	11.4286	2.85714
+H	12.1872	11.4286	3.86571
+H	12.1872	11.4286	5.71429
+H	12.1872	11.4286	6.72285
+H	12.1872	11.4286	8.57143
+H	12.1872	11.4286	9.58
+H	12.1872	14.2857	0
+H	12.1872	14.2857	1.00857
+H	12.1872	14.2857	11.4286
+H	12.1872	14.2857	12.4371
+H	12.1872	14.2857	14.2857
+H	12.1872	14.2857	15.2943
+H	12.1872	14.2857	17.1429
+H	12.1872	14.2857	18.1514
+H	12.1872	14.2857	2.85714
+H	12.1872	14.2857	3.86571
+H	12.1872	14.2857	5.71429
+H	12.1872	14.2857	6.72285
+H	12.1872	14.2857	8.57143
+H	12.1872	14.2857	9.58
+H	12.1872	17.1429	0
+H	12.1872	17.1429	1.00857
+H	12.1872	17.1429	11.4286
+H	12.1872	17.1429	12.4371
+H	12.1872	17.1429	14.2857
+H	12.1872	17.1429	15.2943
+H	12.1872	17.1429	17.1429
+H	12.1872	17.1429	18.1514
+H	12.1872	17.1429	2.85714
+H	12.1872	17.1429	3.86571
+H	12.1872	17.1429	5.71429
+H	12.1872	17.1429	6.72285
+H	12.1872	17.1429	8.57143
+H	12.1872	17.1429	9.58
+H	12.1872	2.85714	0
+H	12.1872	2.85714	1.00857
+H	12.1872	2.85714	11.4286
+H	12.1872	2.85714	12.4371
+H	12.1872	2.85714	14.2857
+H	12.1872	2.85714	15.2943
+H	12.1872	2.85714	17.1429
+H	12.1872	2.85714	18.1514
+H	12.1872	2.85714	5.71429
+H	12.1872	2.85714	6.72285
+H	12.1872	2.85714	8.57143
+H	12.1872	2.85714	9.58
+H	12.1872	5.71429	0
+H	12.1872	5.71429	1.00857
+H	12.1872	5.71429	11.4286
+H	12.1872	5.71429	12.4371
+H	12.1872	5.71429	14.2857
+H	12.1872	5.71429	15.2943
+H	12.1872	5.71429	17.1429
+H	12.1872	5.71429	18.1514
+H	12.1872	5.71429	2.85714
+H	12.1872	5.71429	3.86571
+H	12.1872	5.71429	5.71429
+H	12.1872	5.71429	6.72285
+H	12.1872	5.71429	8.57143
+H	12.1872	5.71429	9.58
+H	12.1872	8.57143	0
+H	12.1872	8.57143	1.00857
+H	12.1872	8.57143	11.4286
+H	12.1872	8.57143	12.4371
+H	12.1872	8.57143	14.2857
+H	12.1872	8.57143	15.2943
+H	12.1872	8.57143	17.1429
+H	12.1872	8.57143	18.1514
+H	12.1872	8.57143	2.85714
+H	12.1872	8.57143	3.86571
+H	12.1872	8.57143	5.71429
+H	12.1872	8.57143	6.72285
+H	12.1872	8.57143	8.57143
+H	12.1872	8.57143	9.58
+H	15.0443	0	0
+H	15.0443	0	1.00857
+H	15.0443	0	11.4286
+H	15.0443	0	12.4371
+H	15.0443	0	14.2857
+H	15.0443	0	15.2943
+H	15.0443	0	17.1429
+H	15.0443	0	18.1514
+H	15.0443	0	2.85714
+H	15.0443	0	3.86571
+H	15.0443	0	5.71429
+H	15.0443	0	6.72285
+H	15.0443	0	8.57143
+H	15.0443	0	9.58
+H	15.0443	11.4286	0
+H	15.0443	11.4286	1.00857
+H	15.0443	11.4286	11.4286
+H	15.0443	11.4286	12.4371
+H	15.0443	11.4286	14.2857
+H	15.0443	11.4286	15.2943
+H	15.0443	11.4286	17.1429
+H	15.0443	11.4286	18.1514
+H	15.0443	11.4286	2.85714
+H	15.0443	11.4286	3.86571
+H	15.0443	11.4286	5.71429
+H	15.0443	11.4286	6.72285
+H	15.0443	11.4286	8.57143
+H	15.0443	11.4286	9.58
+H	15.0443	14.2857	0
+H	15.0443	14.2857	1.00857
+H	15.0443	14.2857	11.4286
+H	15.0443	14.2857	12.4371
+H	15.0443	14.2857	14.2857
+H	15.0443	14.2857	15.2943
+H	15.0443	14.2857	17.1429
+H	15.0443	14.2857	18.1514
+H	15.0443	14.2857	2.85714
+H	15.0443	14.2857	3.86571
+H	15.0443	14.2857	5.71429
+H	15.0443	14.2857	6.72285
+H	15.0443	14.2857	8.57143
+H	15.0443	14.2857	9.58
+H	15.0443	17.1429	0
+H	15.0443	17.1429	1.00857
+H	15.0443	17.1429	11.4286
+H	15.0443	17.1429	12.4371
+H	15.0443	17.1429	14.2857
+H	15.0443	17.1429	15.2943
+H	15.0443	17.1429	17.1429
+H	15.0443	17.1429	18.1514
+H	15.0443	17.1429	2.85714
+H	15.0443	17.1429	3.86571
+H	15.0443	17.1429	5.71429
+H	15.0443	17.1429	6.72285
+H	15.0443	17.1429	8.57143
+H	15.0443	17.1429	9.58
+H	15.0443	2.85714	0
+H	15.0443	2.85714	1.00857
+H	15.0443	2.85714	11.4286
+H	15.0443	2.85714	12.4371
+H	15.0443	2.85714	14.2857
+H	15.0443	2.85714	15.2943
+H	15.0443	2.85714	17.1429
+H	15.0443	2.85714	18.1514
+H	15.0443	2.85714	2.85714
+H	15.0443	2.85714	3.86571
+H	15.0443	2.85714	5.71429
+H	15.0443	2.85714	6.72285
+H	15.0443	2.85714	8.57143
+H	15.0443	2.85714	9.58
+H	15.0443	5.71429	0
+H	15.0443	5.71429	1.00857
+H	15.0443	5.71429	11.4286
+H	15.0443	5.71429	12.4371
+H	15.0443	5.71429	14.2857
+H	15.0443	5.71429	15.2943
+H	15.0443	5.71429	17.1429
+H	15.0443	5.71429	18.1514
+H	15.0443	5.71429	2.85714
+H	15.0443	5.71429	3.86571
+H	15.0443	5.71429	5.71429
+H	15.0443	5.71429	6.72285
+H	15.0443	5.71429	8.57143
+H	15.0443	5.71429	9.58
+H	15.0443	8.57143	0
+H	15.0443	8.57143	1.00857
+H	15.0443	8.57143	11.4286
+H	15.0443	8.57143	12.4371
+H	15.0443	8.57143	14.2857
+H	15.0443	8.57143	15.2943
+H	15.0443	8.57143	17.1429
+H	15.0443	8.57143	18.1514
+H	15.0443	8.57143	2.85714
+H	15.0443	8.57143	3.86571
+H	15.0443	8.57143	5.71429
+H	15.0443	8.57143	6.72285
+H	15.0443	8.57143	8.57143
+H	15.0443	8.57143	9.58
+H	17.9015	0	0
+H	17.9015	0	1.00857
+H	17.9015	0	11.4286
+H	17.9015	0	12.4371
+H	17.9015	0	14.2857
+H	17.9015	0	15.2943
+H	17.9015	0	17.1429
+H	17.9015	0	18.1514
+H	17.9015	0	2.85714
+H	17.9015	0	3.86571
+H	17.9015	0	5.71429
+H	17.9015	0	6.72285
+H	17.9015	0	8.57143
+H	17.9015	0	9.58
+H	17.9015	11.4286	0
+H	17.9015	11.4286	1.00857
+H	17.9015	11.4286	11.4286
+H	17.9015	11.4286	12.4371
+H	17.9015	11.4286	14.2857
+H	17.9015	11.4286	15.2943
+H	17.9015	11.4286	17.1429
+H	17.9015	11.4286	18.1514
+H	17.9015	11.4286	2.85714
+H	17.9015	11.4286	3.86571
+H	17.9015	11.4286	5.71429
+H	17.9015	11.4286	6.72285
+H	17.9015	11.4286	8.57143
+H	17.9015	11.4286	9.58
+H	17.9015	14.2857	0
+H	17.9015	14.2857	1.00857
+H	17.9015	14.2857	11.4286
+H	17.9015	14.2857	12.4371
+H	17.9015	14.2857	14.2857
+H	17.9015	14.2857	15.2943
+H	17.9015	14.2857	17.1429
+H	17.9015	14.2857	18.1514
+H	17.9015	14.2857	2.85714
+H	17.9015	14.2857	3.86571
+H	17.9015	14.2857	5.71429
+H	17.9015	14.2857	6.72285
+H	17.9015	14.2857	8.57143
+H	17.9015	14.2857	9.58
+H	17.9015	17.1429	0
+H	17.9015	17.1429	1.00857
+H	17.9015	17.1429	11.4286
+H	17.9015	17.1429	12.4371
+H	17.9015	17.1429	14.2857
+H	17.9015	17.1429	15.2943
+H	17.9015	17.1429	17.1429
+H	17.9015	17.1429	18.1514
+H	17.9015	17.1429	2.85714
+H	17.9015	17.1429	3.86571
+H	17.9015	17.1429	5.71429
+H	17.9015	17.1429	6.72285
+H	17.9015	17.1429	8.57143
+H	17.9015	17.1429	9.58
+H	17.9015	2.85714	0
+H	17.9015	2.85714	1.00857
+H	17.9015	2.85714	11.4286
+H	17.9015	2.85714	12.4371
+H	17.9015	2.85714	14.2857
+H	17.9015	2.85714	15.2943
+H	17.9015	2.85714	17.1429
+H	17.9015	2.85714	18.1514
+H	17.9015	2.85714	2.85714
+H	17.9015	2.85714	3.86571
+H	17.9015	2.85714	5.71429
+H	17.9015	2.85714	6.72285
+H	17.9015	2.85714	8.57143
+H	17.9015	2.85714	9.58
+H	17.9015	5.71429	0
+H	17.9015	5.71429	1.00857
+H	17.9015	5.71429	11.4286
+H	17.9015	5.71429	12.4371
+H	17.9015	5.71429	14.2857
+H	17.9015	5.71429	15.2943
+H	17.9015	5.71429	17.1429
+H	17.9015	5.71429	18.1514
+H	17.9015	5.71429	2.85714
+H	17.9015	5.71429	3.86571
+H	17.9015	5.71429	5.71429
+H	17.9015	5.71429	6.72285
+H	17.9015	5.71429	8.57143
+H	17.9015	5.71429	9.58
+H	17.9015	8.57143	0
+H	17.9015	8.57143	1.00857
+H	17.9015	8.57143	11.4286
+H	17.9015	8.57143	12.4371
+H	17.9015	8.57143	14.2857
+H	17.9015	8.57143	15.2943
+H	17.9015	8.57143	17.1429
+H	17.9015	8.57143	18.1514
+H	17.9015	8.57143	2.85714
+H	17.9015	8.57143	3.86571
+H	17.9015	8.57143	5.71429
+H	17.9015	8.57143	6.72285
+H	17.9015	8.57143	8.57143
+H	17.9015	8.57143	9.58
+H	3.61574	0	0
+H	3.61574	0	1.00857
+H	3.61574	0	11.4286
+H	3.61574	0	12.4371
+H	3.61574	0	14.2857
+H	3.61574	0	15.2943
+H	3.61574	0	17.1429
+H	3.61574	0	18.1514
+H	3.61574	0	2.85714
+H	3.61574	0	3.86571
+H	3.61574	0	5.71429
+H	3.61574	0	6.72285
+H	3.61574	0	8.57143
+H	3.61574	0	9.58
+H	3.61574	11.4286	0
+H	3.61574	11.4286	1.00857
+H	3.61574	11.4286	11.4286
+H	3.61574	11.4286	12.4371
+H	3.61574	11.4286	14.2857
+H	3.61574	11.4286	15.2943
+H	3.61574	11.4286	17.1429
+H	3.61574	11.4286	18.1514
+H	3.61574	11.4286	2.85714
+H	3.61574	11.4286	3.86571
+H	3.61574	11.4286	5.71429
+H	3.61574	11.4286	6.72285
+H	3.61574	11.4286	8.57143
+H	3.61574	11.4286	9.58
+H	3.61574	14.2857	0
+H	3.61574	14.2857	1.00857
+H	3.61574	14.2857	11.4286
+H	3.61574	14.2857	12.4371
+H	3.61574	14.2857	14.2857
+H	3.61574	14.2857	15.2943
+H	3.61574	14.2857	17.1429
+H	3.61574	14.2857	18.1514
+H	3.61574	14.2857	2.85714
+H	3.61574	14.2857	3.86571
+H	3.61574	14.2857	5.71429
+H	3.61574	14.2857	6.72285
+H	3.61574	14.2857	8.57143
+H	3.61574	14.2857	9.58
+H	3.61574	17.1429	0
+H	3.61574	17.1429	1.00857
+H	3.61574	17.1429	11.4286
+H	3.61574	17.1429	12.4371
+H	3.61574	17.1429	14.2857
+H	3.61574	17.1429	15.2943
+H	3.61574	17.1429	17.1429
+H	3.61574	17.1429	18.1514
+H	3.61574	17.1429	2.85714
+H	3.61574	17.1429	3.86571
+H	3.61574	17.1429	5.71429
+H	3.61574	17.1429	6.72285
+H	3.61574	17.1429	8.57143
+H	3.61574	17.1429	9.58
+H	3.61574	2.85714	0
+H	3.61574	2.85714	1.00857
+H	3.61574	2.85714	11.4286
+H	3.61574	2.85714	12.4371
+H	3.61574	2.85714	14.2857
+H	3.61574	2.85714	15.2943
+H	3.61574	2.85714	17.1429
+H	3.61574	2.85714	18.1514
+H	3.61574	2.85714	2.85714
+H	3.61574	2.85714	3.86571
+H	3.61574	2.85714	5.71429
+H	3.61574	2.85714	6.72285
+H	3.61574	2.85714	8.57143
+H	3.61574	2.85714	9.58
+H	3.61574	5.71429	0
+H	3.61574	5.71429	1.00857
+H	3.61574	5.71429	11.4286
+H	3.61574	5.71429	12.4371
+H	3.61574	5.71429	14.2857
+H	3.61574	5.71429	15.2943
+H	3.61574	5.71429	17.1429
+H	3.61574	5.71429	18.1514
+H	3.61574	5.71429	2.85714
+H	3.61574	5.71429	3.86571
+H	3.61574	5.71429	5.71429
+H	3.61574	5.71429	6.72285
+H	3.61574	5.71429	8.57143
+H	3.61574	5.71429	9.58
+H	3.61574	8.57143	0
+H	3.61574	8.57143	1.00857
+H	3.61574	8.57143	11.4286
+H	3.61574	8.57143	12.4371
+H	3.61574	8.57143	14.2857
+H	3.61574	8.57143	15.2943
+H	3.61574	8.57143	17.1429
+H	3.61574	8.57143	18.1514
+H	3.61574	8.57143	2.85714
+H	3.61574	8.57143	3.86571
+H	3.61574	8.57143	5.71429
+H	3.61574	8.57143	6.72285
+H	3.61574	8.57143	8.57143
+H	3.61574	8.57143	9.58
+H	6.39363	3.90454	3.53589
+H	6.47289	0	0
+H	6.47289	0	1.00857
+H	6.47289	0	11.4286
+H	6.47289	0	12.4371
+H	6.47289	0	14.2857
+H	6.47289	0	15.2943
+H	6.47289	0	17.1429
+H	6.47289	0	18.1514
+H	6.47289	0	2.85714
+H	6.47289	0	3.86571
+H	6.47289	0	5.71429
+H	6.47289	0	6.72285
+H	6.47289	0	8.57143
+H	6.47289	0	9.58
+H	6.47289	11.4286	0
+H	6.47289	11.4286	1.00857
+H	6.47289	11.4286	11.4286
+H	6.47289	11.4286	12.4371
+H	6.47289	11.4286	14.2857
+H	6.47289	11.4286	15.2943
+H	6.47289	11.4286	17.1429
+H	6.47289	11.4286	18.1514
+H	6.47289	11.4286	2.85714
+H	6.47289	11.4286	3.86571
+H	6.47289	11.4286	5.71429
+H	6.47289	11.4286	6.72285
+H	6.47289	11.4286	8.57143
+H	6.47289	11.4286	9.58
+H	6.47289	14.2857	0
+H	6.47289	14.2857	1.00857
+H	6.47289	14.2857	11.4286
+H	6.47289	14.2857	12.4371
+H	6.47289	14.2857	14.2857
+H	6.47289	14.2857	15.2943
+H	6.47289	14.2857	17.1429
+H	6.47289	14.2857	18.1514
+H	6.47289	14.2857	2.85714
+H	6.47289	14.2857	3.86571
+H	6.47289	14.2857	5.71429
+H	6.47289	14.2857	6.72285
+H	6.47289	14.2857	8.57143
+H	6.47289	14.2857	9.58
+H	6.47289	17.1429	0
+H	6.47289	17.1429	1.00857
+H	6.47289	17.1429	11.4286
+H	6.47289	17.1429	12.4371
+H	6.47289	17.1429	14.2857
+H	6.47289	17.1429	15.2943
+H	6.47289	17.1429	17.1429
+H	6.47289	17.1429	18.1514
+H	6.47289	17.1429	2.85714
+H	6.47289	17.1429	3.86571
+H	6.47289	17.1429	5.71429
+H	6.47289	17.1429	6.72285
+H	6.47289	17.1429	8.57143
+H	6.47289	17.1429	9.58
+H	6.47289	2.85714	0
+H	6.47289	2.85714	11.4286
+H	6.47289	2.85714	12.4371
+H	6.47289	2.85714	14.2857
+H	6.47289	2.85714	15.2943
+H	6.47289	2.85714	17.1429
+H	6.47289	2.85714	18.1514
+H	6.47289	2.85714	6.72285
+H	6.47289	2.85714	8.57143
+H	6.47289	2.85714	9.58
+H	6.47289	5.71429	0
+H	6.47289	5.71429	1.00857
+H	6.47289	5.71429	11.4286
+H	6.47289	5.71429	12.4371
+H	6.47289	5.71429	14.2857
+H	6.47289	5.71429	15.2943
+H	6.47289	5.71429	17.1429
+H	6.47289	5.71429	18.1514
+H	6.47289	5.71429	5.71429
+H	6.47289	5.71429	6.72285
+H	6.47289	5.71429	8.57143
+H	6.47289	5.71429	9.58
+H	6.47289	8.57143	0
+H	6.47289	8.57143	1.00857
+H	6.47289	8.57143	11.4286
+H	6.47289	8.57143	12.4371
+H	6.47289	8.57143	14.2857
+H	6.47289	8.57143	15.2943
+H	6.47289	8.57143	17.1429
+H	6.47289	8.57143	18.1514
+H	6.47289	8.57143	2.85714
+H	6.47289	8.57143	3.86571
+H	6.47289	8.57143	5.71429
+H	6.47289	8.57143	6.72285
+H	6.47289	8.57143	8.57143
+H	6.47289	8.57143	9.58
+H	7.28359	2.64589	2.64589
+H	7.28359	2.64589	4.42589
+H	8.53279	4.78789	2.64589
+H	8.53279	4.78789	4.42589
+H	9.33003	0	0
+H	9.33003	0	1.00857
+H	9.33003	0	11.4286
+H	9.33003	0	12.4371
+H	9.33003	0	14.2857
+H	9.33003	0	15.2943
+H	9.33003	0	17.1429
+H	9.33003	0	18.1514
+H	9.33003	0	2.85714
+H	9.33003	0	3.86571
+H	9.33003	0	5.71429
+H	9.33003	0	6.72285
+H	9.33003	0	8.57143
+H	9.33003	0	9.58
+H	9.33003	11.4286	0
+H	9.33003	11.4286	1.00857
+H	9.33003	11.4286	11.4286
+H	9.33003	11.4286	12.4371
+H	9.33003	11.4286	14.2857
+H	9.33003	11.4286	15.2943
+H	9.33003	11.4286	17.1429
+H	9.33003	11.4286	18.1514
+H	9.33003	11.4286	2.85714
+H	9.33003	11.4286	3.86571
+H	9.33003	11.4286	5.71429
+H	9.33003	11.4286	6.72285
+H	9.33003	11.4286	8.57143
+H	9.33003	11.4286	9.58
+H	9.33003	14.2857	0
+H	9.33003	14.2857	1.00857
+H	9.33003	14.2857	11.4286
+H	9.33003	14.2857	12.4371
+H	9.33003	14.2857	14.2857
+H	9.33003	14.2857	15.2943
+H	9.33003	14.2857	17.1429
+H	9.33003	14.2857	18.1514
+H	9.33003	14.2857	2.85714
+H	9.33003	14.2857	3.86571
+H	9.33003	14.2857	5.71429
+H	9.33003	14.2857	6.72285
+H	9.33003	14.2857	8.57143
+H	9.33003	14.2857	9.58
+H	9.33003	17.1429	0
+H	9.33003	17.1429	1.00857
+H	9.33003	17.1429	11.4286
+H	9.33003	17.1429	12.4371
+H	9.33003	17.1429	14.2857
+H	9.33003	17.1429	15.2943
+H	9.33003	17.1429	17.1429
+H	9.33003	17.1429	18.1514
+H	9.33003	17.1429	2.85714
+H	9.33003	17.1429	3.86571
+H	9.33003	17.1429	5.71429
+H	9.33003	17.1429	6.72285
+H	9.33003	17.1429	8.57143
+H	9.33003	17.1429	9.58
+H	9.33003	2.85714	0
+H	9.33003	2.85714	11.4286
+H	9.33003	2.85714	12.4371
+H	9.33003	2.85714	14.2857
+H	9.33003	2.85714	15.2943
+H	9.33003	2.85714	17.1429
+H	9.33003	2.85714	18.1514
+H	9.33003	2.85714	6.72285
+H	9.33003	2.85714	8.57143
+H	9.33003	2.85714	9.58
+H	9.33003	5.71429	0
+H	9.33003	5.71429	11.4286
+H	9.33003	5.71429	12.4371
+H	9.33003	5.71429	14.2857
+H	9.33003	5.71429	15.2943
+H	9.33003	5.71429	17.1429
+H	9.33003	5.71429	18.1514
+H	9.33003	5.71429	6.72285
+H	9.33003	5.71429	8.57143
+H	9.33003	5.71429	9.58
+H	9.33003	8.57143	0
+H	9.33003	8.57143	1.00857
+H	9.33003	8.57143	11.4286
+H	9.33003	8.57143	12.4371
+H	9.33003	8.57143	14.2857
+H	9.33003	8.57143	15.2943
+H	9.33003	8.57143	17.1429
+H	9.33003	8.57143	18.1514
+H	9.33003	8.57143	2.85714
+H	9.33003	8.57143	3.86571
+H	9.33003	8.57143	5.71429
+H	9.33003	8.57143	6.72285
+H	9.33003	8.57143	8.57143
+H	9.33003	8.57143	9.58
+O	0	0	0.504284
+O	0	0	11.9329
+O	0	0	14.79
+O	0	0	17.6471
+O	0	0	3.36143
+O	0	0	6.21857
+O	0	0	9.07571
+O	0	11.4286	0.504284
+O	0	11.4286	11.9329
+O	0	11.4286	14.79
+O	0	11.4286	17.6471
+O	0	11.4286	3.36143
+O	0	11.4286	6.21857
+O	0	11.4286	9.07571
+O	0	14.2857	0.504284
+O	0	14.2857	11.9329
+O	0	14.2857	14.79
+O	0	14.2857	17.6471
+O	0	14.2857	3.36143
+O	0	14.2857	6.21857
+O	0	14.2857	9.07571
+O	0	17.1429	0.504284
+O	0	17.1429	11.9329
+O	0	17.1429	14.79
+O	0	17.1429	17.6471
+O	0	17.1429	3.36143
+O	0	17.1429	6.21857
+O	0	17.1429	9.07571
+O	0	2.85714	0.504284
+O	0	2.85714	11.9329
+O	0	2.85714	14.79
+O	0	2.85714	17.6471
+O	0	2.85714	3.36143
+O	0	2.85714	6.21857
+O	0	2.85714	9.07571
+O	0	5.71429	0.504284
+O	0	5.71429	11.9329
+O	0	5.71429	14.79
+O	0	5.71429	17.6471
+O	0	5.71429	3.36143
+O	0	5.71429	6.21857
+O	0	5.71429	9.07571
+O	0	8.57143	0.504284
+O	0	8.57143	11.9329
+O	0	8.57143	14.79
+O	0	8.57143	17.6471
+O	0	8.57143	3.36143
+O	0	8.57143	6.21857
+O	0	8.57143	9.07571
+O	11.4286	0	0.504284
+O	11.4286	0	11.9329
+O	11.4286	0	14.79
+O	11.4286	0	17.6471
+O	11.4286	0	3.36143
+O	11.4286	0	6.21857
+O	11.4286	0	9.07571
+O	11.4286	11.4286	0.504284
+O	11.4286	11.4286	11.9329
+O	11.4286	11.4286	14.79
+O	11.4286	11.4286	17.6471
+O	11.4286	11.4286	3.36143
+O	11.4286	11.4286	6.21857
+O	11.4286	11.4286	9.07571
+O	11.4286	14.2857	0.504284
+O	11.4286	14.2857	11.9329
+O	11.4286	14.2857	14.79
+O	11.4286	14.2857	17.6471
+O	11.4286	14.2857	3.36143
+O	11.4286	14.2857	6.21857
+O	11.4286	14.2857	9.07571
+O	11.4286	17.1429	0.504284
+O	11.4286	17.1429	11.9329
+O	11.4286	17.1429	14.79
+O	11.4286	17.1429	17.6471
+O	11.4286	17.1429	3.36143
+O	11.4286	17.1429	6.21857
+O	11.4286	17.1429	9.07571
+O	11.4286	2.85714	0.504284
+O	11.4286	2.85714	11.9329
+O	11.4286	2.85714	14.79
+O	11.4286	2.85714	17.6471
+O	11.4286	2.85714	6.21857
+O	11.4286	2.85714	9.07571
+O	11.4286	5.71429	0.504284
+O	11.4286	5.71429	11.9329
+O	11.4286	5.71429	14.79
+O	11.4286	5.71429	17.6471
+O	11.4286	5.71429	6.21857
+O	11.4286	5.71429	9.07571
+O	11.4286	8.57143	0.504284
+O	11.4286	8.57143	11.9329
+O	11.4286	8.57143	14.79
+O	11.4286	8.57143	17.6471
+O	11.4286	8.57143	3.36143
+O	11.4286	8.57143	6.21857
+O	11.4286	8.57143	9.07571
+O	14.2857	0	0.504284
+O	14.2857	0	11.9329
+O	14.2857	0	14.79
+O	14.2857	0	17.6471
+O	14.2857	0	3.36143
+O	14.2857	0	6.21857
+O	14.2857	0	9.07571
+O	14.2857	11.4286	0.504284
+O	14.2857	11.4286	11.9329
+O	14.2857	11.4286	14.79
+O	14.2857	11.4286	17.6471
+O	14.2857	11.4286	3.36143
+O	14.2857	11.4286	6.21857
+O	14.2857	11.4286	9.07571
+O	14.2857	14.2857	0.504284
+O	14.2857	14.2857	11.9329
+O	14.2857	14.2857	14.79
+O	14.2857	14.2857	17.6471
+O	14.2857	14.2857	3.36143
+O	14.2857	14.2857	6.21857
+O	14.2857	14.2857	9.07571
+O	14.2857	17.1429	0.504284
+O	14.2857	17.1429	11.9329
+O	14.2857	17.1429	14.79
+O	14.2857	17.1429	17.6471
+O	14.2857	17.1429	3.36143
+O	14.2857	17.1429	6.21857
+O	14.2857	17.1429	9.07571
+O	14.2857	2.85714	0.504284
+O	14.2857	2.85714	11.9329
+O	14.2857	2.85714	14.79
+O	14.2857	2.85714	17.6471
+O	14.2857	2.85714	3.36143
+O	14.2857	2.85714	6.21857
+O	14.2857	2.85714	9.07571
+O	14.2857	5.71429	0.504284
+O	14.2857	5.71429	11.9329
+O	14.2857	5.71429	14.79
+O	14.2857	5.71429	17.6471
+O	14.2857	5.71429	3.36143
+O	14.2857	5.71429	6.21857
+O	14.2857	5.71429	9.07571
+O	14.2857	8.57143	0.504284
+O	14.2857	8.57143	11.9329
+O	14.2857	8.57143	14.79
+O	14.2857	8.57143	17.6471
+O	14.2857	8.57143	3.36143
+O	14.2857	8.57143	6.21857
+O	14.2857	8.57143	9.07571
+O	17.1429	0	0.504284
+O	17.1429	0	11.9329
+O	17.1429	0	14.79
+O	17.1429	0	17.6471
+O	17.1429	0	3.36143
+O	17.1429	0	6.21857
+O	17.1429	0	9.07571
+O	17.1429	11.4286	0.504284
+O	17.1429	11.4286	11.9329
+O	17.1429	11.4286	14.79
+O	17.1429	11.4286	17.6471
+O	17.1429	11.4286	3.36143
+O	17.1429	11.4286	6.21857
+O	17.1429	11.4286	9.07571
+O	17.1429	14.2857	0.504284
+O	17.1429	14.2857	11.9329
+O	17.1429	14.2857	14.79
+O	17.1429	14.2857	17.6471
+O	17.1429	14.2857	3.36143
+O	17.1429	14.2857	6.21857
+O	17.1429	14.2857	9.07571
+O	17.1429	17.1429	0.504284
+O	17.1429	17.1429	11.9329
+O	17.1429	17.1429	14.79
+O	17.1429	17.1429	17.6471
+O	17.1429	17.1429	3.36143
+O	17.1429	17.1429	6.21857
+O	17.1429	17.1429	9.07571
+O	17.1429	2.85714	0.504284
+O	17.1429	2.85714	11.9329
+O	17.1429	2.85714	14.79
+O	17.1429	2.85714	17.6471
+O	17.1429	2.85714	3.36143
+O	17.1429	2.85714	6.21857
+O	17.1429	2.85714	9.07571
+O	17.1429	5.71429	0.504284
+O	17.1429	5.71429	11.9329
+O	17.1429	5.71429	14.79
+O	17.1429	5.71429	17.6471
+O	17.1429	5.71429	3.36143
+O	17.1429	5.71429	6.21857
+O	17.1429	5.71429	9.07571
+O	17.1429	8.57143	0.504284
+O	17.1429	8.57143	11.9329
+O	17.1429	8.57143	14.79
+O	17.1429	8.57143	17.6471
+O	17.1429	8.57143	3.36143
+O	17.1429	8.57143	6.21857
+O	17.1429	8.57143	9.07571
+O	2.85714	0	0.504284
+O	2.85714	0	11.9329
+O	2.85714	0	14.79
+O	2.85714	0	17.6471
+O	2.85714	0	3.36143
+O	2.85714	0	6.21857
+O	2.85714	0	9.07571
+O	2.85714	11.4286	0.504284
+O	2.85714	11.4286	11.9329
+O	2.85714	11.4286	14.79
+O	2.85714	11.4286	17.6471
+O	2.85714	11.4286	3.36143
+O	2.85714	11.4286	6.21857
+O	2.85714	11.4286	9.07571
+O	2.85714	14.2857	0.504284
+O	2.85714	14.2857	11.9329
+O	2.85714	14.2857	14.79
+O	2.85714	14.2857	17.6471
+O	2.85714	14.2857	3.36143
+O	2.85714	14.2857	6.21857
+O	2.85714	14.2857	9.07571
+O	2.85714	17.1429	0.504284
+O	2.85714	17.1429	11.9329
+O	2.85714	17.1429	14.79
+O	2.85714	17.1429	17.6471
+O	2.85714	17.1429	3.36143
+O	2.85714	17.1429	6.21857
+O	2.85714	17.1429	9.07571
+O	2.85714	2.85714	0.504284
+O	2.85714	2.85714	11.9329
+O	2.85714	2.85714	14.79
+O	2.85714	2.85714	17.6471
+O	2.85714	2.85714	3.36143
+O	2.85714	2.85714	6.21857
+O	2.85714	2.85714	9.07571
+O	2.85714	5.71429	0.504284
+O	2.85714	5.71429	11.9329
+O	2.85714	5.71429	14.79
+O	2.85714	5.71429	17.6471
+O	2.85714	5.71429	3.36143
+O	2.85714	5.71429	6.21857
+O	2.85714	5.71429	9.07571
+O	2.85714	8.57143	0.504284
+O	2.85714	8.57143	11.9329
+O	2.85714	8.57143	14.79
+O	2.85714	8.57143	17.6471
+O	2.85714	8.57143	3.36143
+O	2.85714	8.57143	6.21857
+O	2.85714	8.57143	9.07571
+O	5.71429	0	0.504284
+O	5.71429	0	11.9329
+O	5.71429	0	14.79
+O	5.71429	0	17.6471
+O	5.71429	0	3.36143
+O	5.71429	0	6.21857
+O	5.71429	0	9.07571
+O	5.71429	11.4286	0.504284
+O	5.71429	11.4286	11.9329
+O	5.71429	11.4286	14.79
+O	5.71429	11.4286	17.6471
+O	5.71429	11.4286	3.36143
+O	5.71429	11.4286	6.21857
+O	5.71429	11.4286	9.07571
+O	5.71429	14.2857	0.504284
+O	5.71429	14.2857	11.9329
+O	5.71429	14.2857	14.79
+O	5.71429	14.2857	17.6471
+O	5.71429	14.2857	3.36143
+O	5.71429	14.2857	6.21857
+O	5.71429	14.2857	9.07571
+O	5.71429	17.1429	0.504284
+O	5.71429	17.1429	11.9329
+O	5.71429	17.1429	14.79
+O	5.71429	17.1429	17.6471
+O	5.71429	17.1429	3.36143
+O	5.71429	17.1429	6.21857
+O	5.71429	17.1429	9.07571
+O	5.71429	2.85714	0.504284
+O	5.71429	2.85714	11.9329
+O	5.71429	2.85714	14.79
+O	5.71429	2.85714	17.6471
+O	5.71429	2.85714	6.21857
+O	5.71429	2.85714	9.07571
+O	5.71429	5.71429	0.504284
+O	5.71429	5.71429	11.9329
+O	5.71429	5.71429	14.79
+O	5.71429	5.71429	17.6471
+O	5.71429	5.71429	6.21857
+O	5.71429	5.71429	9.07571
+O	5.71429	8.57143	0.504284
+O	5.71429	8.57143	11.9329
+O	5.71429	8.57143	14.79
+O	5.71429	8.57143	17.6471
+O	5.71429	8.57143	3.36143
+O	5.71429	8.57143	6.21857
+O	5.71429	8.57143	9.07571
+O	8.57143	0	0.504284
+O	8.57143	0	11.9329
+O	8.57143	0	14.79
+O	8.57143	0	17.6471
+O	8.57143	0	3.36143
+O	8.57143	0	6.21857
+O	8.57143	0	9.07571
+O	8.57143	11.4286	0.504284
+O	8.57143	11.4286	11.9329
+O	8.57143	11.4286	14.79
+O	8.57143	11.4286	17.6471
+O	8.57143	11.4286	3.36143
+O	8.57143	11.4286	6.21857
+O	8.57143	11.4286	9.07571
+O	8.57143	14.2857	0.504284
+O	8.57143	14.2857	11.9329
+O	8.57143	14.2857	14.79
+O	8.57143	14.2857	17.6471
+O	8.57143	14.2857	3.36143
+O	8.57143	14.2857	6.21857
+O	8.57143	14.2857	9.07571
+O	8.57143	17.1429	0.504284
+O	8.57143	17.1429	11.9329
+O	8.57143	17.1429	14.79
+O	8.57143	17.1429	17.6471
+O	8.57143	17.1429	3.36143
+O	8.57143	17.1429	6.21857
+O	8.57143	17.1429	9.07571
+O	8.57143	2.85714	0.504284
+O	8.57143	2.85714	11.9329
+O	8.57143	2.85714	14.79
+O	8.57143	2.85714	17.6471
+O	8.57143	2.85714	9.07571
+O	8.57143	5.71429	0.504284
+O	8.57143	5.71429	11.9329
+O	8.57143	5.71429	14.79
+O	8.57143	5.71429	17.6471
+O	8.57143	5.71429	9.07571
+O	8.57143	8.57143	0.504284
+O	8.57143	8.57143	11.9329
+O	8.57143	8.57143	14.79
+O	8.57143	8.57143	17.6471
+O	8.57143	8.57143	3.36143
+O	8.57143	8.57143	6.21857
+O	8.57143	8.57143	9.07571
Index: tests/regression/Simple_configuration/8/post/test-withoutsphere.xyz-sorted
===================================================================
--- tests/regression/Simple_configuration/8/post/test-withoutsphere.xyz-sorted	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Simple_configuration/8/post/test-withoutsphere.xyz-sorted	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,872 @@
+H	0.758602	0	0
+H	0.758602	0	1.00857
+H	0.758602	0	11.4286
+H	0.758602	0	12.4371
+H	0.758602	0	14.2857
+H	0.758602	0	15.2943
+H	0.758602	0	17.1429
+H	0.758602	0	18.1514
+H	0.758602	0	2.85714
+H	0.758602	0	3.86571
+H	0.758602	0	5.71429
+H	0.758602	0	6.72285
+H	0.758602	0	8.57143
+H	0.758602	0	9.58
+H	0.758602	11.4286	0
+H	0.758602	11.4286	1.00857
+H	0.758602	11.4286	11.4286
+H	0.758602	11.4286	12.4371
+H	0.758602	11.4286	14.2857
+H	0.758602	11.4286	15.2943
+H	0.758602	11.4286	17.1429
+H	0.758602	11.4286	18.1514
+H	0.758602	11.4286	2.85714
+H	0.758602	11.4286	3.86571
+H	0.758602	11.4286	5.71429
+H	0.758602	11.4286	6.72285
+H	0.758602	11.4286	8.57143
+H	0.758602	11.4286	9.58
+H	0.758602	14.2857	0
+H	0.758602	14.2857	1.00857
+H	0.758602	14.2857	11.4286
+H	0.758602	14.2857	12.4371
+H	0.758602	14.2857	14.2857
+H	0.758602	14.2857	15.2943
+H	0.758602	14.2857	17.1429
+H	0.758602	14.2857	18.1514
+H	0.758602	14.2857	2.85714
+H	0.758602	14.2857	3.86571
+H	0.758602	14.2857	5.71429
+H	0.758602	14.2857	6.72285
+H	0.758602	14.2857	8.57143
+H	0.758602	14.2857	9.58
+H	0.758602	17.1429	0
+H	0.758602	17.1429	1.00857
+H	0.758602	17.1429	11.4286
+H	0.758602	17.1429	12.4371
+H	0.758602	17.1429	14.2857
+H	0.758602	17.1429	15.2943
+H	0.758602	17.1429	17.1429
+H	0.758602	17.1429	18.1514
+H	0.758602	17.1429	2.85714
+H	0.758602	17.1429	3.86571
+H	0.758602	17.1429	5.71429
+H	0.758602	17.1429	6.72285
+H	0.758602	17.1429	8.57143
+H	0.758602	17.1429	9.58
+H	0.758602	2.85714	0
+H	0.758602	2.85714	1.00857
+H	0.758602	2.85714	11.4286
+H	0.758602	2.85714	12.4371
+H	0.758602	2.85714	14.2857
+H	0.758602	2.85714	15.2943
+H	0.758602	2.85714	17.1429
+H	0.758602	2.85714	18.1514
+H	0.758602	2.85714	6.72285
+H	0.758602	2.85714	8.57143
+H	0.758602	2.85714	9.58
+H	0.758602	5.71429	0
+H	0.758602	5.71429	1.00857
+H	0.758602	5.71429	11.4286
+H	0.758602	5.71429	12.4371
+H	0.758602	5.71429	14.2857
+H	0.758602	5.71429	15.2943
+H	0.758602	5.71429	17.1429
+H	0.758602	5.71429	18.1514
+H	0.758602	5.71429	5.71429
+H	0.758602	5.71429	6.72285
+H	0.758602	5.71429	8.57143
+H	0.758602	5.71429	9.58
+H	0.758602	8.57143	0
+H	0.758602	8.57143	1.00857
+H	0.758602	8.57143	11.4286
+H	0.758602	8.57143	12.4371
+H	0.758602	8.57143	14.2857
+H	0.758602	8.57143	15.2943
+H	0.758602	8.57143	17.1429
+H	0.758602	8.57143	18.1514
+H	0.758602	8.57143	2.85714
+H	0.758602	8.57143	3.86571
+H	0.758602	8.57143	5.71429
+H	0.758602	8.57143	6.72285
+H	0.758602	8.57143	8.57143
+H	0.758602	8.57143	9.58
+H	12.1872	0	11.4286
+H	12.1872	0	12.4371
+H	12.1872	0	14.2857
+H	12.1872	0	15.2943
+H	12.1872	0	17.1429
+H	12.1872	0	18.1514
+H	12.1872	0	8.57143
+H	12.1872	0	9.58
+H	12.1872	11.4286	0
+H	12.1872	11.4286	1.00857
+H	12.1872	11.4286	11.4286
+H	12.1872	11.4286	12.4371
+H	12.1872	11.4286	14.2857
+H	12.1872	11.4286	15.2943
+H	12.1872	11.4286	17.1429
+H	12.1872	11.4286	18.1514
+H	12.1872	11.4286	2.85714
+H	12.1872	11.4286	3.86571
+H	12.1872	11.4286	5.71429
+H	12.1872	11.4286	6.72285
+H	12.1872	11.4286	8.57143
+H	12.1872	11.4286	9.58
+H	12.1872	14.2857	0
+H	12.1872	14.2857	1.00857
+H	12.1872	14.2857	11.4286
+H	12.1872	14.2857	12.4371
+H	12.1872	14.2857	14.2857
+H	12.1872	14.2857	15.2943
+H	12.1872	14.2857	17.1429
+H	12.1872	14.2857	18.1514
+H	12.1872	14.2857	2.85714
+H	12.1872	14.2857	3.86571
+H	12.1872	14.2857	5.71429
+H	12.1872	14.2857	6.72285
+H	12.1872	14.2857	8.57143
+H	12.1872	14.2857	9.58
+H	12.1872	17.1429	0
+H	12.1872	17.1429	1.00857
+H	12.1872	17.1429	11.4286
+H	12.1872	17.1429	12.4371
+H	12.1872	17.1429	14.2857
+H	12.1872	17.1429	15.2943
+H	12.1872	17.1429	17.1429
+H	12.1872	17.1429	18.1514
+H	12.1872	17.1429	2.85714
+H	12.1872	17.1429	3.86571
+H	12.1872	17.1429	5.71429
+H	12.1872	17.1429	6.72285
+H	12.1872	17.1429	8.57143
+H	12.1872	17.1429	9.58
+H	12.1872	2.85714	11.4286
+H	12.1872	2.85714	12.4371
+H	12.1872	2.85714	14.2857
+H	12.1872	2.85714	15.2943
+H	12.1872	2.85714	17.1429
+H	12.1872	2.85714	18.1514
+H	12.1872	2.85714	8.57143
+H	12.1872	2.85714	9.58
+H	12.1872	5.71429	11.4286
+H	12.1872	5.71429	12.4371
+H	12.1872	5.71429	14.2857
+H	12.1872	5.71429	15.2943
+H	12.1872	5.71429	17.1429
+H	12.1872	5.71429	18.1514
+H	12.1872	5.71429	8.57143
+H	12.1872	5.71429	9.58
+H	12.1872	8.57143	0
+H	12.1872	8.57143	1.00857
+H	12.1872	8.57143	11.4286
+H	12.1872	8.57143	12.4371
+H	12.1872	8.57143	14.2857
+H	12.1872	8.57143	15.2943
+H	12.1872	8.57143	17.1429
+H	12.1872	8.57143	18.1514
+H	12.1872	8.57143	2.85714
+H	12.1872	8.57143	3.86571
+H	12.1872	8.57143	5.71429
+H	12.1872	8.57143	6.72285
+H	12.1872	8.57143	8.57143
+H	12.1872	8.57143	9.58
+H	15.0443	0	0
+H	15.0443	0	1.00857
+H	15.0443	0	11.4286
+H	15.0443	0	12.4371
+H	15.0443	0	14.2857
+H	15.0443	0	15.2943
+H	15.0443	0	17.1429
+H	15.0443	0	18.1514
+H	15.0443	0	2.85714
+H	15.0443	0	3.86571
+H	15.0443	0	5.71429
+H	15.0443	0	6.72285
+H	15.0443	0	8.57143
+H	15.0443	0	9.58
+H	15.0443	11.4286	0
+H	15.0443	11.4286	1.00857
+H	15.0443	11.4286	11.4286
+H	15.0443	11.4286	12.4371
+H	15.0443	11.4286	14.2857
+H	15.0443	11.4286	15.2943
+H	15.0443	11.4286	17.1429
+H	15.0443	11.4286	18.1514
+H	15.0443	11.4286	2.85714
+H	15.0443	11.4286	3.86571
+H	15.0443	11.4286	5.71429
+H	15.0443	11.4286	6.72285
+H	15.0443	11.4286	8.57143
+H	15.0443	11.4286	9.58
+H	15.0443	14.2857	0
+H	15.0443	14.2857	1.00857
+H	15.0443	14.2857	11.4286
+H	15.0443	14.2857	12.4371
+H	15.0443	14.2857	14.2857
+H	15.0443	14.2857	15.2943
+H	15.0443	14.2857	17.1429
+H	15.0443	14.2857	18.1514
+H	15.0443	14.2857	2.85714
+H	15.0443	14.2857	3.86571
+H	15.0443	14.2857	5.71429
+H	15.0443	14.2857	6.72285
+H	15.0443	14.2857	8.57143
+H	15.0443	14.2857	9.58
+H	15.0443	17.1429	0
+H	15.0443	17.1429	1.00857
+H	15.0443	17.1429	11.4286
+H	15.0443	17.1429	12.4371
+H	15.0443	17.1429	14.2857
+H	15.0443	17.1429	15.2943
+H	15.0443	17.1429	17.1429
+H	15.0443	17.1429	18.1514
+H	15.0443	17.1429	2.85714
+H	15.0443	17.1429	3.86571
+H	15.0443	17.1429	5.71429
+H	15.0443	17.1429	6.72285
+H	15.0443	17.1429	8.57143
+H	15.0443	17.1429	9.58
+H	15.0443	2.85714	0
+H	15.0443	2.85714	1.00857
+H	15.0443	2.85714	11.4286
+H	15.0443	2.85714	12.4371
+H	15.0443	2.85714	14.2857
+H	15.0443	2.85714	15.2943
+H	15.0443	2.85714	17.1429
+H	15.0443	2.85714	18.1514
+H	15.0443	2.85714	2.85714
+H	15.0443	2.85714	3.86571
+H	15.0443	2.85714	5.71429
+H	15.0443	2.85714	6.72285
+H	15.0443	2.85714	8.57143
+H	15.0443	2.85714	9.58
+H	15.0443	5.71429	0
+H	15.0443	5.71429	1.00857
+H	15.0443	5.71429	11.4286
+H	15.0443	5.71429	12.4371
+H	15.0443	5.71429	14.2857
+H	15.0443	5.71429	15.2943
+H	15.0443	5.71429	17.1429
+H	15.0443	5.71429	18.1514
+H	15.0443	5.71429	2.85714
+H	15.0443	5.71429	3.86571
+H	15.0443	5.71429	5.71429
+H	15.0443	5.71429	6.72285
+H	15.0443	5.71429	8.57143
+H	15.0443	5.71429	9.58
+H	15.0443	8.57143	0
+H	15.0443	8.57143	1.00857
+H	15.0443	8.57143	11.4286
+H	15.0443	8.57143	12.4371
+H	15.0443	8.57143	14.2857
+H	15.0443	8.57143	15.2943
+H	15.0443	8.57143	17.1429
+H	15.0443	8.57143	18.1514
+H	15.0443	8.57143	2.85714
+H	15.0443	8.57143	3.86571
+H	15.0443	8.57143	5.71429
+H	15.0443	8.57143	6.72285
+H	15.0443	8.57143	8.57143
+H	15.0443	8.57143	9.58
+H	17.9015	0	0
+H	17.9015	0	1.00857
+H	17.9015	0	11.4286
+H	17.9015	0	12.4371
+H	17.9015	0	14.2857
+H	17.9015	0	15.2943
+H	17.9015	0	17.1429
+H	17.9015	0	18.1514
+H	17.9015	0	2.85714
+H	17.9015	0	3.86571
+H	17.9015	0	5.71429
+H	17.9015	0	6.72285
+H	17.9015	0	8.57143
+H	17.9015	0	9.58
+H	17.9015	11.4286	0
+H	17.9015	11.4286	1.00857
+H	17.9015	11.4286	11.4286
+H	17.9015	11.4286	12.4371
+H	17.9015	11.4286	14.2857
+H	17.9015	11.4286	15.2943
+H	17.9015	11.4286	17.1429
+H	17.9015	11.4286	18.1514
+H	17.9015	11.4286	2.85714
+H	17.9015	11.4286	3.86571
+H	17.9015	11.4286	5.71429
+H	17.9015	11.4286	6.72285
+H	17.9015	11.4286	8.57143
+H	17.9015	11.4286	9.58
+H	17.9015	14.2857	0
+H	17.9015	14.2857	1.00857
+H	17.9015	14.2857	11.4286
+H	17.9015	14.2857	12.4371
+H	17.9015	14.2857	14.2857
+H	17.9015	14.2857	15.2943
+H	17.9015	14.2857	17.1429
+H	17.9015	14.2857	18.1514
+H	17.9015	14.2857	2.85714
+H	17.9015	14.2857	3.86571
+H	17.9015	14.2857	5.71429
+H	17.9015	14.2857	6.72285
+H	17.9015	14.2857	8.57143
+H	17.9015	14.2857	9.58
+H	17.9015	17.1429	0
+H	17.9015	17.1429	1.00857
+H	17.9015	17.1429	11.4286
+H	17.9015	17.1429	12.4371
+H	17.9015	17.1429	14.2857
+H	17.9015	17.1429	15.2943
+H	17.9015	17.1429	17.1429
+H	17.9015	17.1429	18.1514
+H	17.9015	17.1429	2.85714
+H	17.9015	17.1429	3.86571
+H	17.9015	17.1429	5.71429
+H	17.9015	17.1429	6.72285
+H	17.9015	17.1429	8.57143
+H	17.9015	17.1429	9.58
+H	17.9015	2.85714	0
+H	17.9015	2.85714	1.00857
+H	17.9015	2.85714	11.4286
+H	17.9015	2.85714	12.4371
+H	17.9015	2.85714	14.2857
+H	17.9015	2.85714	15.2943
+H	17.9015	2.85714	17.1429
+H	17.9015	2.85714	18.1514
+H	17.9015	2.85714	2.85714
+H	17.9015	2.85714	3.86571
+H	17.9015	2.85714	5.71429
+H	17.9015	2.85714	6.72285
+H	17.9015	2.85714	8.57143
+H	17.9015	2.85714	9.58
+H	17.9015	5.71429	0
+H	17.9015	5.71429	1.00857
+H	17.9015	5.71429	11.4286
+H	17.9015	5.71429	12.4371
+H	17.9015	5.71429	14.2857
+H	17.9015	5.71429	15.2943
+H	17.9015	5.71429	17.1429
+H	17.9015	5.71429	18.1514
+H	17.9015	5.71429	2.85714
+H	17.9015	5.71429	3.86571
+H	17.9015	5.71429	5.71429
+H	17.9015	5.71429	6.72285
+H	17.9015	5.71429	8.57143
+H	17.9015	5.71429	9.58
+H	17.9015	8.57143	0
+H	17.9015	8.57143	1.00857
+H	17.9015	8.57143	11.4286
+H	17.9015	8.57143	12.4371
+H	17.9015	8.57143	14.2857
+H	17.9015	8.57143	15.2943
+H	17.9015	8.57143	17.1429
+H	17.9015	8.57143	18.1514
+H	17.9015	8.57143	2.85714
+H	17.9015	8.57143	3.86571
+H	17.9015	8.57143	5.71429
+H	17.9015	8.57143	6.72285
+H	17.9015	8.57143	8.57143
+H	17.9015	8.57143	9.58
+H	3.61574	0	11.4286
+H	3.61574	0	12.4371
+H	3.61574	0	14.2857
+H	3.61574	0	15.2943
+H	3.61574	0	17.1429
+H	3.61574	0	18.1514
+H	3.61574	0	8.57143
+H	3.61574	0	9.58
+H	3.61574	11.4286	0
+H	3.61574	11.4286	1.00857
+H	3.61574	11.4286	11.4286
+H	3.61574	11.4286	12.4371
+H	3.61574	11.4286	14.2857
+H	3.61574	11.4286	15.2943
+H	3.61574	11.4286	17.1429
+H	3.61574	11.4286	18.1514
+H	3.61574	11.4286	2.85714
+H	3.61574	11.4286	3.86571
+H	3.61574	11.4286	5.71429
+H	3.61574	11.4286	6.72285
+H	3.61574	11.4286	8.57143
+H	3.61574	11.4286	9.58
+H	3.61574	14.2857	0
+H	3.61574	14.2857	1.00857
+H	3.61574	14.2857	11.4286
+H	3.61574	14.2857	12.4371
+H	3.61574	14.2857	14.2857
+H	3.61574	14.2857	15.2943
+H	3.61574	14.2857	17.1429
+H	3.61574	14.2857	18.1514
+H	3.61574	14.2857	2.85714
+H	3.61574	14.2857	3.86571
+H	3.61574	14.2857	5.71429
+H	3.61574	14.2857	6.72285
+H	3.61574	14.2857	8.57143
+H	3.61574	14.2857	9.58
+H	3.61574	17.1429	0
+H	3.61574	17.1429	1.00857
+H	3.61574	17.1429	11.4286
+H	3.61574	17.1429	12.4371
+H	3.61574	17.1429	14.2857
+H	3.61574	17.1429	15.2943
+H	3.61574	17.1429	17.1429
+H	3.61574	17.1429	18.1514
+H	3.61574	17.1429	2.85714
+H	3.61574	17.1429	3.86571
+H	3.61574	17.1429	5.71429
+H	3.61574	17.1429	6.72285
+H	3.61574	17.1429	8.57143
+H	3.61574	17.1429	9.58
+H	3.61574	2.85714	11.4286
+H	3.61574	2.85714	12.4371
+H	3.61574	2.85714	14.2857
+H	3.61574	2.85714	15.2943
+H	3.61574	2.85714	17.1429
+H	3.61574	2.85714	18.1514
+H	3.61574	2.85714	9.58
+H	3.61574	5.71429	11.4286
+H	3.61574	5.71429	12.4371
+H	3.61574	5.71429	14.2857
+H	3.61574	5.71429	15.2943
+H	3.61574	5.71429	17.1429
+H	3.61574	5.71429	18.1514
+H	3.61574	5.71429	9.58
+H	3.61574	8.57143	0
+H	3.61574	8.57143	11.4286
+H	3.61574	8.57143	12.4371
+H	3.61574	8.57143	14.2857
+H	3.61574	8.57143	15.2943
+H	3.61574	8.57143	17.1429
+H	3.61574	8.57143	18.1514
+H	3.61574	8.57143	6.72285
+H	3.61574	8.57143	8.57143
+H	3.61574	8.57143	9.58
+H	6.47289	0	11.4286
+H	6.47289	0	12.4371
+H	6.47289	0	14.2857
+H	6.47289	0	15.2943
+H	6.47289	0	17.1429
+H	6.47289	0	18.1514
+H	6.47289	11.4286	0
+H	6.47289	11.4286	1.00857
+H	6.47289	11.4286	11.4286
+H	6.47289	11.4286	12.4371
+H	6.47289	11.4286	14.2857
+H	6.47289	11.4286	15.2943
+H	6.47289	11.4286	17.1429
+H	6.47289	11.4286	18.1514
+H	6.47289	11.4286	2.85714
+H	6.47289	11.4286	3.86571
+H	6.47289	11.4286	5.71429
+H	6.47289	11.4286	6.72285
+H	6.47289	11.4286	8.57143
+H	6.47289	11.4286	9.58
+H	6.47289	14.2857	0
+H	6.47289	14.2857	1.00857
+H	6.47289	14.2857	11.4286
+H	6.47289	14.2857	12.4371
+H	6.47289	14.2857	14.2857
+H	6.47289	14.2857	15.2943
+H	6.47289	14.2857	17.1429
+H	6.47289	14.2857	18.1514
+H	6.47289	14.2857	2.85714
+H	6.47289	14.2857	3.86571
+H	6.47289	14.2857	5.71429
+H	6.47289	14.2857	6.72285
+H	6.47289	14.2857	8.57143
+H	6.47289	14.2857	9.58
+H	6.47289	17.1429	0
+H	6.47289	17.1429	1.00857
+H	6.47289	17.1429	11.4286
+H	6.47289	17.1429	12.4371
+H	6.47289	17.1429	14.2857
+H	6.47289	17.1429	15.2943
+H	6.47289	17.1429	17.1429
+H	6.47289	17.1429	18.1514
+H	6.47289	17.1429	2.85714
+H	6.47289	17.1429	3.86571
+H	6.47289	17.1429	5.71429
+H	6.47289	17.1429	6.72285
+H	6.47289	17.1429	8.57143
+H	6.47289	17.1429	9.58
+H	6.47289	2.85714	11.4286
+H	6.47289	2.85714	12.4371
+H	6.47289	2.85714	14.2857
+H	6.47289	2.85714	15.2943
+H	6.47289	2.85714	17.1429
+H	6.47289	2.85714	18.1514
+H	6.47289	5.71429	11.4286
+H	6.47289	5.71429	12.4371
+H	6.47289	5.71429	14.2857
+H	6.47289	5.71429	15.2943
+H	6.47289	5.71429	17.1429
+H	6.47289	5.71429	18.1514
+H	6.47289	8.57143	11.4286
+H	6.47289	8.57143	12.4371
+H	6.47289	8.57143	14.2857
+H	6.47289	8.57143	15.2943
+H	6.47289	8.57143	17.1429
+H	6.47289	8.57143	18.1514
+H	6.47289	8.57143	8.57143
+H	6.47289	8.57143	9.58
+H	9.33003	0	11.4286
+H	9.33003	0	12.4371
+H	9.33003	0	14.2857
+H	9.33003	0	15.2943
+H	9.33003	0	17.1429
+H	9.33003	0	18.1514
+H	9.33003	0	9.58
+H	9.33003	11.4286	0
+H	9.33003	11.4286	1.00857
+H	9.33003	11.4286	11.4286
+H	9.33003	11.4286	12.4371
+H	9.33003	11.4286	14.2857
+H	9.33003	11.4286	15.2943
+H	9.33003	11.4286	17.1429
+H	9.33003	11.4286	18.1514
+H	9.33003	11.4286	2.85714
+H	9.33003	11.4286	3.86571
+H	9.33003	11.4286	5.71429
+H	9.33003	11.4286	6.72285
+H	9.33003	11.4286	8.57143
+H	9.33003	11.4286	9.58
+H	9.33003	14.2857	0
+H	9.33003	14.2857	1.00857
+H	9.33003	14.2857	11.4286
+H	9.33003	14.2857	12.4371
+H	9.33003	14.2857	14.2857
+H	9.33003	14.2857	15.2943
+H	9.33003	14.2857	17.1429
+H	9.33003	14.2857	18.1514
+H	9.33003	14.2857	2.85714
+H	9.33003	14.2857	3.86571
+H	9.33003	14.2857	5.71429
+H	9.33003	14.2857	6.72285
+H	9.33003	14.2857	8.57143
+H	9.33003	14.2857	9.58
+H	9.33003	17.1429	0
+H	9.33003	17.1429	1.00857
+H	9.33003	17.1429	11.4286
+H	9.33003	17.1429	12.4371
+H	9.33003	17.1429	14.2857
+H	9.33003	17.1429	15.2943
+H	9.33003	17.1429	17.1429
+H	9.33003	17.1429	18.1514
+H	9.33003	17.1429	2.85714
+H	9.33003	17.1429	3.86571
+H	9.33003	17.1429	5.71429
+H	9.33003	17.1429	6.72285
+H	9.33003	17.1429	8.57143
+H	9.33003	17.1429	9.58
+H	9.33003	2.85714	11.4286
+H	9.33003	2.85714	12.4371
+H	9.33003	2.85714	14.2857
+H	9.33003	2.85714	15.2943
+H	9.33003	2.85714	17.1429
+H	9.33003	2.85714	18.1514
+H	9.33003	5.71429	11.4286
+H	9.33003	5.71429	12.4371
+H	9.33003	5.71429	14.2857
+H	9.33003	5.71429	15.2943
+H	9.33003	5.71429	17.1429
+H	9.33003	5.71429	18.1514
+H	9.33003	8.57143	11.4286
+H	9.33003	8.57143	12.4371
+H	9.33003	8.57143	14.2857
+H	9.33003	8.57143	15.2943
+H	9.33003	8.57143	17.1429
+H	9.33003	8.57143	18.1514
+H	9.33003	8.57143	8.57143
+H	9.33003	8.57143	9.58
+O	0	0	0.504284
+O	0	0	11.9329
+O	0	0	14.79
+O	0	0	17.6471
+O	0	0	3.36143
+O	0	0	6.21857
+O	0	0	9.07571
+O	0	11.4286	0.504284
+O	0	11.4286	11.9329
+O	0	11.4286	14.79
+O	0	11.4286	17.6471
+O	0	11.4286	3.36143
+O	0	11.4286	6.21857
+O	0	11.4286	9.07571
+O	0	14.2857	0.504284
+O	0	14.2857	11.9329
+O	0	14.2857	14.79
+O	0	14.2857	17.6471
+O	0	14.2857	3.36143
+O	0	14.2857	6.21857
+O	0	14.2857	9.07571
+O	0	17.1429	0.504284
+O	0	17.1429	11.9329
+O	0	17.1429	14.79
+O	0	17.1429	17.6471
+O	0	17.1429	3.36143
+O	0	17.1429	6.21857
+O	0	17.1429	9.07571
+O	0	2.85714	0.504284
+O	0	2.85714	11.9329
+O	0	2.85714	14.79
+O	0	2.85714	17.6471
+O	0	2.85714	3.36143
+O	0	2.85714	6.21857
+O	0	2.85714	9.07571
+O	0	5.71429	0.504284
+O	0	5.71429	11.9329
+O	0	5.71429	14.79
+O	0	5.71429	17.6471
+O	0	5.71429	3.36143
+O	0	5.71429	6.21857
+O	0	5.71429	9.07571
+O	0	8.57143	0.504284
+O	0	8.57143	11.9329
+O	0	8.57143	14.79
+O	0	8.57143	17.6471
+O	0	8.57143	3.36143
+O	0	8.57143	6.21857
+O	0	8.57143	9.07571
+O	11.4286	0	11.9329
+O	11.4286	0	14.79
+O	11.4286	0	17.6471
+O	11.4286	0	9.07571
+O	11.4286	11.4286	0.504284
+O	11.4286	11.4286	11.9329
+O	11.4286	11.4286	14.79
+O	11.4286	11.4286	17.6471
+O	11.4286	11.4286	3.36143
+O	11.4286	11.4286	6.21857
+O	11.4286	11.4286	9.07571
+O	11.4286	14.2857	0.504284
+O	11.4286	14.2857	11.9329
+O	11.4286	14.2857	14.79
+O	11.4286	14.2857	17.6471
+O	11.4286	14.2857	3.36143
+O	11.4286	14.2857	6.21857
+O	11.4286	14.2857	9.07571
+O	11.4286	17.1429	0.504284
+O	11.4286	17.1429	11.9329
+O	11.4286	17.1429	14.79
+O	11.4286	17.1429	17.6471
+O	11.4286	17.1429	3.36143
+O	11.4286	17.1429	6.21857
+O	11.4286	17.1429	9.07571
+O	11.4286	2.85714	11.9329
+O	11.4286	2.85714	14.79
+O	11.4286	2.85714	17.6471
+O	11.4286	5.71429	11.9329
+O	11.4286	5.71429	14.79
+O	11.4286	5.71429	17.6471
+O	11.4286	5.71429	9.07571
+O	11.4286	8.57143	0.504284
+O	11.4286	8.57143	11.9329
+O	11.4286	8.57143	14.79
+O	11.4286	8.57143	17.6471
+O	11.4286	8.57143	6.21857
+O	11.4286	8.57143	9.07571
+O	14.2857	0	0.504284
+O	14.2857	0	11.9329
+O	14.2857	0	14.79
+O	14.2857	0	17.6471
+O	14.2857	0	3.36143
+O	14.2857	0	6.21857
+O	14.2857	0	9.07571
+O	14.2857	11.4286	0.504284
+O	14.2857	11.4286	11.9329
+O	14.2857	11.4286	14.79
+O	14.2857	11.4286	17.6471
+O	14.2857	11.4286	3.36143
+O	14.2857	11.4286	6.21857
+O	14.2857	11.4286	9.07571
+O	14.2857	14.2857	0.504284
+O	14.2857	14.2857	11.9329
+O	14.2857	14.2857	14.79
+O	14.2857	14.2857	17.6471
+O	14.2857	14.2857	3.36143
+O	14.2857	14.2857	6.21857
+O	14.2857	14.2857	9.07571
+O	14.2857	17.1429	0.504284
+O	14.2857	17.1429	11.9329
+O	14.2857	17.1429	14.79
+O	14.2857	17.1429	17.6471
+O	14.2857	17.1429	3.36143
+O	14.2857	17.1429	6.21857
+O	14.2857	17.1429	9.07571
+O	14.2857	2.85714	0.504284
+O	14.2857	2.85714	11.9329
+O	14.2857	2.85714	14.79
+O	14.2857	2.85714	17.6471
+O	14.2857	2.85714	3.36143
+O	14.2857	2.85714	6.21857
+O	14.2857	2.85714	9.07571
+O	14.2857	5.71429	0.504284
+O	14.2857	5.71429	11.9329
+O	14.2857	5.71429	14.79
+O	14.2857	5.71429	17.6471
+O	14.2857	5.71429	3.36143
+O	14.2857	5.71429	6.21857
+O	14.2857	5.71429	9.07571
+O	14.2857	8.57143	0.504284
+O	14.2857	8.57143	11.9329
+O	14.2857	8.57143	14.79
+O	14.2857	8.57143	17.6471
+O	14.2857	8.57143	3.36143
+O	14.2857	8.57143	6.21857
+O	14.2857	8.57143	9.07571
+O	17.1429	0	0.504284
+O	17.1429	0	11.9329
+O	17.1429	0	14.79
+O	17.1429	0	17.6471
+O	17.1429	0	3.36143
+O	17.1429	0	6.21857
+O	17.1429	0	9.07571
+O	17.1429	11.4286	0.504284
+O	17.1429	11.4286	11.9329
+O	17.1429	11.4286	14.79
+O	17.1429	11.4286	17.6471
+O	17.1429	11.4286	3.36143
+O	17.1429	11.4286	6.21857
+O	17.1429	11.4286	9.07571
+O	17.1429	14.2857	0.504284
+O	17.1429	14.2857	11.9329
+O	17.1429	14.2857	14.79
+O	17.1429	14.2857	17.6471
+O	17.1429	14.2857	3.36143
+O	17.1429	14.2857	6.21857
+O	17.1429	14.2857	9.07571
+O	17.1429	17.1429	0.504284
+O	17.1429	17.1429	11.9329
+O	17.1429	17.1429	14.79
+O	17.1429	17.1429	17.6471
+O	17.1429	17.1429	3.36143
+O	17.1429	17.1429	6.21857
+O	17.1429	17.1429	9.07571
+O	17.1429	2.85714	0.504284
+O	17.1429	2.85714	11.9329
+O	17.1429	2.85714	14.79
+O	17.1429	2.85714	17.6471
+O	17.1429	2.85714	3.36143
+O	17.1429	2.85714	6.21857
+O	17.1429	2.85714	9.07571
+O	17.1429	5.71429	0.504284
+O	17.1429	5.71429	11.9329
+O	17.1429	5.71429	14.79
+O	17.1429	5.71429	17.6471
+O	17.1429	5.71429	3.36143
+O	17.1429	5.71429	6.21857
+O	17.1429	5.71429	9.07571
+O	17.1429	8.57143	0.504284
+O	17.1429	8.57143	11.9329
+O	17.1429	8.57143	14.79
+O	17.1429	8.57143	17.6471
+O	17.1429	8.57143	3.36143
+O	17.1429	8.57143	6.21857
+O	17.1429	8.57143	9.07571
+O	2.85714	0	11.9329
+O	2.85714	0	14.79
+O	2.85714	0	17.6471
+O	2.85714	0	9.07571
+O	2.85714	11.4286	0.504284
+O	2.85714	11.4286	11.9329
+O	2.85714	11.4286	14.79
+O	2.85714	11.4286	17.6471
+O	2.85714	11.4286	3.36143
+O	2.85714	11.4286	6.21857
+O	2.85714	11.4286	9.07571
+O	2.85714	14.2857	0.504284
+O	2.85714	14.2857	11.9329
+O	2.85714	14.2857	14.79
+O	2.85714	14.2857	17.6471
+O	2.85714	14.2857	3.36143
+O	2.85714	14.2857	6.21857
+O	2.85714	14.2857	9.07571
+O	2.85714	17.1429	0.504284
+O	2.85714	17.1429	11.9329
+O	2.85714	17.1429	14.79
+O	2.85714	17.1429	17.6471
+O	2.85714	17.1429	3.36143
+O	2.85714	17.1429	6.21857
+O	2.85714	17.1429	9.07571
+O	2.85714	2.85714	11.9329
+O	2.85714	2.85714	14.79
+O	2.85714	2.85714	17.6471
+O	2.85714	2.85714	9.07571
+O	2.85714	5.71429	11.9329
+O	2.85714	5.71429	14.79
+O	2.85714	5.71429	17.6471
+O	2.85714	5.71429	9.07571
+O	2.85714	8.57143	0.504284
+O	2.85714	8.57143	11.9329
+O	2.85714	8.57143	14.79
+O	2.85714	8.57143	17.6471
+O	2.85714	8.57143	6.21857
+O	2.85714	8.57143	9.07571
+O	5.71429	0	11.9329
+O	5.71429	0	14.79
+O	5.71429	0	17.6471
+O	5.71429	11.4286	0.504284
+O	5.71429	11.4286	11.9329
+O	5.71429	11.4286	14.79
+O	5.71429	11.4286	17.6471
+O	5.71429	11.4286	3.36143
+O	5.71429	11.4286	6.21857
+O	5.71429	11.4286	9.07571
+O	5.71429	14.2857	0.504284
+O	5.71429	14.2857	11.9329
+O	5.71429	14.2857	14.79
+O	5.71429	14.2857	17.6471
+O	5.71429	14.2857	3.36143
+O	5.71429	14.2857	6.21857
+O	5.71429	14.2857	9.07571
+O	5.71429	17.1429	0.504284
+O	5.71429	17.1429	11.9329
+O	5.71429	17.1429	14.79
+O	5.71429	17.1429	17.6471
+O	5.71429	17.1429	3.36143
+O	5.71429	17.1429	6.21857
+O	5.71429	17.1429	9.07571
+O	5.71429	2.85714	11.9329
+O	5.71429	2.85714	14.79
+O	5.71429	2.85714	17.6471
+O	5.71429	5.71429	11.9329
+O	5.71429	5.71429	14.79
+O	5.71429	5.71429	17.6471
+O	5.71429	8.57143	11.9329
+O	5.71429	8.57143	14.79
+O	5.71429	8.57143	17.6471
+O	5.71429	8.57143	9.07571
+O	8.57143	0	11.9329
+O	8.57143	0	14.79
+O	8.57143	0	17.6471
+O	8.57143	11.4286	0.504284
+O	8.57143	11.4286	11.9329
+O	8.57143	11.4286	14.79
+O	8.57143	11.4286	17.6471
+O	8.57143	11.4286	3.36143
+O	8.57143	11.4286	6.21857
+O	8.57143	11.4286	9.07571
+O	8.57143	14.2857	0.504284
+O	8.57143	14.2857	11.9329
+O	8.57143	14.2857	14.79
+O	8.57143	14.2857	17.6471
+O	8.57143	14.2857	3.36143
+O	8.57143	14.2857	6.21857
+O	8.57143	14.2857	9.07571
+O	8.57143	17.1429	0.504284
+O	8.57143	17.1429	11.9329
+O	8.57143	17.1429	14.79
+O	8.57143	17.1429	17.6471
+O	8.57143	17.1429	3.36143
+O	8.57143	17.1429	6.21857
+O	8.57143	17.1429	9.07571
+O	8.57143	2.85714	11.9329
+O	8.57143	2.85714	14.79
+O	8.57143	2.85714	17.6471
+O	8.57143	5.71429	11.9329
+O	8.57143	5.71429	14.79
+O	8.57143	5.71429	17.6471
+O	8.57143	8.57143	11.9329
+O	8.57143	8.57143	14.79
+O	8.57143	8.57143	17.6471
+O	8.57143	8.57143	9.07571
Index: sts/regression/Simple_configuration/8/post/test.xyz
===================================================================
--- tests/regression/Simple_configuration/8/post/test.xyz	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,146 +1,0 @@
-144
-	Created by molecuilder on Mon May 31 18:50:20 2010
-H	9.78209	2.64589	2.64589
-H	9.78209	2.64589	4.42589
-H	10.672	3.90454	3.53589
-H	8.53279	4.78789	2.64589
-H	8.53279	4.78789	4.42589
-H	6.39363	3.90454	3.53589
-H	7.28359	2.64589	2.64589
-H	7.28359	2.64589	4.42589
-H	0.758602	2.85714	3.86571
-H	0.758602	2.85714	2.85714
-H	0.758602	2.85714	5.71429
-H	0.758602	5.71429	3.86571
-H	0.758602	5.71429	2.85714
-H	3.61574	0	1.00857
-H	3.61574	0	0
-H	3.61574	0	3.86571
-H	3.61574	0	2.85714
-H	3.61574	0	6.72285
-H	3.61574	0	5.71429
-H	3.61574	2.85714	1.00857
-H	3.61574	2.85714	0
-H	3.61574	2.85714	3.86571
-H	3.61574	2.85714	2.85714
-H	3.61574	2.85714	6.72285
-H	3.61574	2.85714	5.71429
-H	3.61574	2.85714	8.57143
-H	3.61574	5.71429	1.00857
-H	3.61574	5.71429	0
-H	3.61574	5.71429	3.86571
-H	3.61574	5.71429	2.85714
-H	3.61574	5.71429	6.72285
-H	3.61574	5.71429	5.71429
-H	3.61574	5.71429	8.57143
-H	3.61574	8.57143	1.00857
-H	3.61574	8.57143	3.86571
-H	3.61574	8.57143	2.85714
-H	3.61574	8.57143	5.71429
-H	6.47289	0	1.00857
-H	6.47289	0	0
-H	6.47289	0	3.86571
-H	6.47289	0	2.85714
-H	6.47289	0	6.72285
-H	6.47289	0	5.71429
-H	6.47289	0	9.58
-H	6.47289	0	8.57143
-H	6.47289	2.85714	0
-H	6.47289	2.85714	6.72285
-H	6.47289	2.85714	9.58
-H	6.47289	2.85714	8.57143
-H	6.47289	5.71429	1.00857
-H	6.47289	5.71429	0
-H	6.47289	5.71429	6.72285
-H	6.47289	5.71429	5.71429
-H	6.47289	5.71429	9.58
-H	6.47289	5.71429	8.57143
-H	6.47289	8.57143	1.00857
-H	6.47289	8.57143	0
-H	6.47289	8.57143	3.86571
-H	6.47289	8.57143	2.85714
-H	6.47289	8.57143	6.72285
-H	6.47289	8.57143	5.71429
-H	9.33003	0	1.00857
-H	9.33003	0	0
-H	9.33003	0	3.86571
-H	9.33003	0	2.85714
-H	9.33003	0	6.72285
-H	9.33003	0	5.71429
-H	9.33003	0	8.57143
-H	9.33003	2.85714	0
-H	9.33003	2.85714	6.72285
-H	9.33003	2.85714	9.58
-H	9.33003	2.85714	8.57143
-H	9.33003	5.71429	0
-H	9.33003	5.71429	6.72285
-H	9.33003	5.71429	9.58
-H	9.33003	5.71429	8.57143
-H	9.33003	8.57143	1.00857
-H	9.33003	8.57143	0
-H	9.33003	8.57143	3.86571
-H	9.33003	8.57143	2.85714
-H	9.33003	8.57143	6.72285
-H	9.33003	8.57143	5.71429
-H	12.1872	0	1.00857
-H	12.1872	0	0
-H	12.1872	0	3.86571
-H	12.1872	0	2.85714
-H	12.1872	0	6.72285
-H	12.1872	0	5.71429
-H	12.1872	2.85714	1.00857
-H	12.1872	2.85714	0
-H	12.1872	2.85714	6.72285
-H	12.1872	2.85714	5.71429
-H	12.1872	5.71429	1.00857
-H	12.1872	5.71429	0
-H	12.1872	5.71429	3.86571
-H	12.1872	5.71429	2.85714
-H	12.1872	5.71429	6.72285
-H	12.1872	5.71429	5.71429
-C	9.78209	3.27519	3.53589
-C	8.53279	4.15859	3.53589
-C	7.28359	3.27519	3.53589
-O	2.85714	0	0.504284
-O	2.85714	0	3.36143
-O	2.85714	0	6.21857
-O	2.85714	2.85714	0.504284
-O	2.85714	2.85714	3.36143
-O	2.85714	2.85714	6.21857
-O	2.85714	5.71429	0.504284
-O	2.85714	5.71429	3.36143
-O	2.85714	5.71429	6.21857
-O	2.85714	8.57143	3.36143
-O	5.71429	0	0.504284
-O	5.71429	0	3.36143
-O	5.71429	0	6.21857
-O	5.71429	0	9.07571
-O	5.71429	2.85714	0.504284
-O	5.71429	2.85714	6.21857
-O	5.71429	2.85714	9.07571
-O	5.71429	5.71429	0.504284
-O	5.71429	5.71429	6.21857
-O	5.71429	5.71429	9.07571
-O	5.71429	8.57143	0.504284
-O	5.71429	8.57143	3.36143
-O	5.71429	8.57143	6.21857
-O	8.57143	0	0.504284
-O	8.57143	0	3.36143
-O	8.57143	0	6.21857
-O	8.57143	0	9.07571
-O	8.57143	2.85714	0.504284
-O	8.57143	2.85714	9.07571
-O	8.57143	5.71429	0.504284
-O	8.57143	5.71429	9.07571
-O	8.57143	8.57143	0.504284
-O	8.57143	8.57143	3.36143
-O	8.57143	8.57143	6.21857
-O	11.4286	0	0.504284
-O	11.4286	0	3.36143
-O	11.4286	0	6.21857
-O	11.4286	2.85714	0.504284
-O	11.4286	2.85714	6.21857
-O	11.4286	2.85714	9.07571
-O	11.4286	5.71429	0.504284
-O	11.4286	5.71429	6.21857
-O	11.4286	8.57143	3.36143
Index: tests/regression/Simple_configuration/8/post/test.xyz-sorted
===================================================================
--- tests/regression/Simple_configuration/8/post/test.xyz-sorted	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/Simple_configuration/8/post/test.xyz-sorted	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -2,34 +2,459 @@
 C	8.53279	4.15859	3.53589
 C	9.78209	3.27519	3.53589
+H	0.758602	0	0
+H	0.758602	0	1.00857
+H	0.758602	0	11.4286
+H	0.758602	0	12.4371
+H	0.758602	0	14.2857
+H	0.758602	0	15.2943
+H	0.758602	0	17.1429
+H	0.758602	0	18.1514
+H	0.758602	0	2.85714
+H	0.758602	0	3.86571
+H	0.758602	0	5.71429
+H	0.758602	0	6.72285
+H	0.758602	0	8.57143
+H	0.758602	0	9.58
+H	0.758602	11.4286	0
+H	0.758602	11.4286	1.00857
+H	0.758602	11.4286	11.4286
+H	0.758602	11.4286	12.4371
+H	0.758602	11.4286	14.2857
+H	0.758602	11.4286	15.2943
+H	0.758602	11.4286	17.1429
+H	0.758602	11.4286	18.1514
+H	0.758602	11.4286	2.85714
+H	0.758602	11.4286	3.86571
+H	0.758602	11.4286	5.71429
+H	0.758602	11.4286	6.72285
+H	0.758602	11.4286	8.57143
+H	0.758602	11.4286	9.58
+H	0.758602	14.2857	0
+H	0.758602	14.2857	1.00857
+H	0.758602	14.2857	11.4286
+H	0.758602	14.2857	12.4371
+H	0.758602	14.2857	14.2857
+H	0.758602	14.2857	15.2943
+H	0.758602	14.2857	17.1429
+H	0.758602	14.2857	18.1514
+H	0.758602	14.2857	2.85714
+H	0.758602	14.2857	3.86571
+H	0.758602	14.2857	5.71429
+H	0.758602	14.2857	6.72285
+H	0.758602	14.2857	8.57143
+H	0.758602	14.2857	9.58
+H	0.758602	17.1429	0
+H	0.758602	17.1429	1.00857
+H	0.758602	17.1429	11.4286
+H	0.758602	17.1429	12.4371
+H	0.758602	17.1429	14.2857
+H	0.758602	17.1429	15.2943
+H	0.758602	17.1429	17.1429
+H	0.758602	17.1429	18.1514
+H	0.758602	17.1429	2.85714
+H	0.758602	17.1429	3.86571
+H	0.758602	17.1429	5.71429
+H	0.758602	17.1429	6.72285
+H	0.758602	17.1429	8.57143
+H	0.758602	17.1429	9.58
+H	0.758602	2.85714	0
+H	0.758602	2.85714	1.00857
+H	0.758602	2.85714	11.4286
+H	0.758602	2.85714	12.4371
+H	0.758602	2.85714	14.2857
+H	0.758602	2.85714	15.2943
+H	0.758602	2.85714	17.1429
+H	0.758602	2.85714	18.1514
 H	0.758602	2.85714	2.85714
 H	0.758602	2.85714	3.86571
 H	0.758602	2.85714	5.71429
+H	0.758602	2.85714	6.72285
+H	0.758602	2.85714	8.57143
+H	0.758602	2.85714	9.58
+H	0.758602	5.71429	0
+H	0.758602	5.71429	1.00857
+H	0.758602	5.71429	11.4286
+H	0.758602	5.71429	12.4371
+H	0.758602	5.71429	14.2857
+H	0.758602	5.71429	15.2943
+H	0.758602	5.71429	17.1429
+H	0.758602	5.71429	18.1514
 H	0.758602	5.71429	2.85714
 H	0.758602	5.71429	3.86571
+H	0.758602	5.71429	5.71429
+H	0.758602	5.71429	6.72285
+H	0.758602	5.71429	8.57143
+H	0.758602	5.71429	9.58
+H	0.758602	8.57143	0
+H	0.758602	8.57143	1.00857
+H	0.758602	8.57143	11.4286
+H	0.758602	8.57143	12.4371
+H	0.758602	8.57143	14.2857
+H	0.758602	8.57143	15.2943
+H	0.758602	8.57143	17.1429
+H	0.758602	8.57143	18.1514
+H	0.758602	8.57143	2.85714
+H	0.758602	8.57143	3.86571
+H	0.758602	8.57143	5.71429
+H	0.758602	8.57143	6.72285
+H	0.758602	8.57143	8.57143
+H	0.758602	8.57143	9.58
 H	10.672	3.90454	3.53589
 H	12.1872	0	0
 H	12.1872	0	1.00857
+H	12.1872	0	11.4286
+H	12.1872	0	12.4371
+H	12.1872	0	14.2857
+H	12.1872	0	15.2943
+H	12.1872	0	17.1429
+H	12.1872	0	18.1514
 H	12.1872	0	2.85714
 H	12.1872	0	3.86571
 H	12.1872	0	5.71429
 H	12.1872	0	6.72285
+H	12.1872	0	8.57143
+H	12.1872	0	9.58
+H	12.1872	11.4286	0
+H	12.1872	11.4286	1.00857
+H	12.1872	11.4286	11.4286
+H	12.1872	11.4286	12.4371
+H	12.1872	11.4286	14.2857
+H	12.1872	11.4286	15.2943
+H	12.1872	11.4286	17.1429
+H	12.1872	11.4286	18.1514
+H	12.1872	11.4286	2.85714
+H	12.1872	11.4286	3.86571
+H	12.1872	11.4286	5.71429
+H	12.1872	11.4286	6.72285
+H	12.1872	11.4286	8.57143
+H	12.1872	11.4286	9.58
+H	12.1872	14.2857	0
+H	12.1872	14.2857	1.00857
+H	12.1872	14.2857	11.4286
+H	12.1872	14.2857	12.4371
+H	12.1872	14.2857	14.2857
+H	12.1872	14.2857	15.2943
+H	12.1872	14.2857	17.1429
+H	12.1872	14.2857	18.1514
+H	12.1872	14.2857	2.85714
+H	12.1872	14.2857	3.86571
+H	12.1872	14.2857	5.71429
+H	12.1872	14.2857	6.72285
+H	12.1872	14.2857	8.57143
+H	12.1872	14.2857	9.58
+H	12.1872	17.1429	0
+H	12.1872	17.1429	1.00857
+H	12.1872	17.1429	11.4286
+H	12.1872	17.1429	12.4371
+H	12.1872	17.1429	14.2857
+H	12.1872	17.1429	15.2943
+H	12.1872	17.1429	17.1429
+H	12.1872	17.1429	18.1514
+H	12.1872	17.1429	2.85714
+H	12.1872	17.1429	3.86571
+H	12.1872	17.1429	5.71429
+H	12.1872	17.1429	6.72285
+H	12.1872	17.1429	8.57143
+H	12.1872	17.1429	9.58
 H	12.1872	2.85714	0
 H	12.1872	2.85714	1.00857
+H	12.1872	2.85714	11.4286
+H	12.1872	2.85714	12.4371
+H	12.1872	2.85714	14.2857
+H	12.1872	2.85714	15.2943
+H	12.1872	2.85714	17.1429
+H	12.1872	2.85714	18.1514
 H	12.1872	2.85714	5.71429
 H	12.1872	2.85714	6.72285
+H	12.1872	2.85714	8.57143
+H	12.1872	2.85714	9.58
 H	12.1872	5.71429	0
 H	12.1872	5.71429	1.00857
+H	12.1872	5.71429	11.4286
+H	12.1872	5.71429	12.4371
+H	12.1872	5.71429	14.2857
+H	12.1872	5.71429	15.2943
+H	12.1872	5.71429	17.1429
+H	12.1872	5.71429	18.1514
 H	12.1872	5.71429	2.85714
 H	12.1872	5.71429	3.86571
 H	12.1872	5.71429	5.71429
 H	12.1872	5.71429	6.72285
+H	12.1872	5.71429	8.57143
+H	12.1872	5.71429	9.58
+H	12.1872	8.57143	0
+H	12.1872	8.57143	1.00857
+H	12.1872	8.57143	11.4286
+H	12.1872	8.57143	12.4371
+H	12.1872	8.57143	14.2857
+H	12.1872	8.57143	15.2943
+H	12.1872	8.57143	17.1429
+H	12.1872	8.57143	18.1514
+H	12.1872	8.57143	2.85714
+H	12.1872	8.57143	3.86571
+H	12.1872	8.57143	5.71429
+H	12.1872	8.57143	6.72285
+H	12.1872	8.57143	8.57143
+H	12.1872	8.57143	9.58
+H	15.0443	0	0
+H	15.0443	0	1.00857
+H	15.0443	0	11.4286
+H	15.0443	0	12.4371
+H	15.0443	0	14.2857
+H	15.0443	0	15.2943
+H	15.0443	0	17.1429
+H	15.0443	0	18.1514
+H	15.0443	0	2.85714
+H	15.0443	0	3.86571
+H	15.0443	0	5.71429
+H	15.0443	0	6.72285
+H	15.0443	0	8.57143
+H	15.0443	0	9.58
+H	15.0443	11.4286	0
+H	15.0443	11.4286	1.00857
+H	15.0443	11.4286	11.4286
+H	15.0443	11.4286	12.4371
+H	15.0443	11.4286	14.2857
+H	15.0443	11.4286	15.2943
+H	15.0443	11.4286	17.1429
+H	15.0443	11.4286	18.1514
+H	15.0443	11.4286	2.85714
+H	15.0443	11.4286	3.86571
+H	15.0443	11.4286	5.71429
+H	15.0443	11.4286	6.72285
+H	15.0443	11.4286	8.57143
+H	15.0443	11.4286	9.58
+H	15.0443	14.2857	0
+H	15.0443	14.2857	1.00857
+H	15.0443	14.2857	11.4286
+H	15.0443	14.2857	12.4371
+H	15.0443	14.2857	14.2857
+H	15.0443	14.2857	15.2943
+H	15.0443	14.2857	17.1429
+H	15.0443	14.2857	18.1514
+H	15.0443	14.2857	2.85714
+H	15.0443	14.2857	3.86571
+H	15.0443	14.2857	5.71429
+H	15.0443	14.2857	6.72285
+H	15.0443	14.2857	8.57143
+H	15.0443	14.2857	9.58
+H	15.0443	17.1429	0
+H	15.0443	17.1429	1.00857
+H	15.0443	17.1429	11.4286
+H	15.0443	17.1429	12.4371
+H	15.0443	17.1429	14.2857
+H	15.0443	17.1429	15.2943
+H	15.0443	17.1429	17.1429
+H	15.0443	17.1429	18.1514
+H	15.0443	17.1429	2.85714
+H	15.0443	17.1429	3.86571
+H	15.0443	17.1429	5.71429
+H	15.0443	17.1429	6.72285
+H	15.0443	17.1429	8.57143
+H	15.0443	17.1429	9.58
+H	15.0443	2.85714	0
+H	15.0443	2.85714	1.00857
+H	15.0443	2.85714	11.4286
+H	15.0443	2.85714	12.4371
+H	15.0443	2.85714	14.2857
+H	15.0443	2.85714	15.2943
+H	15.0443	2.85714	17.1429
+H	15.0443	2.85714	18.1514
+H	15.0443	2.85714	2.85714
+H	15.0443	2.85714	3.86571
+H	15.0443	2.85714	5.71429
+H	15.0443	2.85714	6.72285
+H	15.0443	2.85714	8.57143
+H	15.0443	2.85714	9.58
+H	15.0443	5.71429	0
+H	15.0443	5.71429	1.00857
+H	15.0443	5.71429	11.4286
+H	15.0443	5.71429	12.4371
+H	15.0443	5.71429	14.2857
+H	15.0443	5.71429	15.2943
+H	15.0443	5.71429	17.1429
+H	15.0443	5.71429	18.1514
+H	15.0443	5.71429	2.85714
+H	15.0443	5.71429	3.86571
+H	15.0443	5.71429	5.71429
+H	15.0443	5.71429	6.72285
+H	15.0443	5.71429	8.57143
+H	15.0443	5.71429	9.58
+H	15.0443	8.57143	0
+H	15.0443	8.57143	1.00857
+H	15.0443	8.57143	11.4286
+H	15.0443	8.57143	12.4371
+H	15.0443	8.57143	14.2857
+H	15.0443	8.57143	15.2943
+H	15.0443	8.57143	17.1429
+H	15.0443	8.57143	18.1514
+H	15.0443	8.57143	2.85714
+H	15.0443	8.57143	3.86571
+H	15.0443	8.57143	5.71429
+H	15.0443	8.57143	6.72285
+H	15.0443	8.57143	8.57143
+H	15.0443	8.57143	9.58
+H	17.9015	0	0
+H	17.9015	0	1.00857
+H	17.9015	0	11.4286
+H	17.9015	0	12.4371
+H	17.9015	0	14.2857
+H	17.9015	0	15.2943
+H	17.9015	0	17.1429
+H	17.9015	0	18.1514
+H	17.9015	0	2.85714
+H	17.9015	0	3.86571
+H	17.9015	0	5.71429
+H	17.9015	0	6.72285
+H	17.9015	0	8.57143
+H	17.9015	0	9.58
+H	17.9015	11.4286	0
+H	17.9015	11.4286	1.00857
+H	17.9015	11.4286	11.4286
+H	17.9015	11.4286	12.4371
+H	17.9015	11.4286	14.2857
+H	17.9015	11.4286	15.2943
+H	17.9015	11.4286	17.1429
+H	17.9015	11.4286	18.1514
+H	17.9015	11.4286	2.85714
+H	17.9015	11.4286	3.86571
+H	17.9015	11.4286	5.71429
+H	17.9015	11.4286	6.72285
+H	17.9015	11.4286	8.57143
+H	17.9015	11.4286	9.58
+H	17.9015	14.2857	0
+H	17.9015	14.2857	1.00857
+H	17.9015	14.2857	11.4286
+H	17.9015	14.2857	12.4371
+H	17.9015	14.2857	14.2857
+H	17.9015	14.2857	15.2943
+H	17.9015	14.2857	17.1429
+H	17.9015	14.2857	18.1514
+H	17.9015	14.2857	2.85714
+H	17.9015	14.2857	3.86571
+H	17.9015	14.2857	5.71429
+H	17.9015	14.2857	6.72285
+H	17.9015	14.2857	8.57143
+H	17.9015	14.2857	9.58
+H	17.9015	17.1429	0
+H	17.9015	17.1429	1.00857
+H	17.9015	17.1429	11.4286
+H	17.9015	17.1429	12.4371
+H	17.9015	17.1429	14.2857
+H	17.9015	17.1429	15.2943
+H	17.9015	17.1429	17.1429
+H	17.9015	17.1429	18.1514
+H	17.9015	17.1429	2.85714
+H	17.9015	17.1429	3.86571
+H	17.9015	17.1429	5.71429
+H	17.9015	17.1429	6.72285
+H	17.9015	17.1429	8.57143
+H	17.9015	17.1429	9.58
+H	17.9015	2.85714	0
+H	17.9015	2.85714	1.00857
+H	17.9015	2.85714	11.4286
+H	17.9015	2.85714	12.4371
+H	17.9015	2.85714	14.2857
+H	17.9015	2.85714	15.2943
+H	17.9015	2.85714	17.1429
+H	17.9015	2.85714	18.1514
+H	17.9015	2.85714	2.85714
+H	17.9015	2.85714	3.86571
+H	17.9015	2.85714	5.71429
+H	17.9015	2.85714	6.72285
+H	17.9015	2.85714	8.57143
+H	17.9015	2.85714	9.58
+H	17.9015	5.71429	0
+H	17.9015	5.71429	1.00857
+H	17.9015	5.71429	11.4286
+H	17.9015	5.71429	12.4371
+H	17.9015	5.71429	14.2857
+H	17.9015	5.71429	15.2943
+H	17.9015	5.71429	17.1429
+H	17.9015	5.71429	18.1514
+H	17.9015	5.71429	2.85714
+H	17.9015	5.71429	3.86571
+H	17.9015	5.71429	5.71429
+H	17.9015	5.71429	6.72285
+H	17.9015	5.71429	8.57143
+H	17.9015	5.71429	9.58
+H	17.9015	8.57143	0
+H	17.9015	8.57143	1.00857
+H	17.9015	8.57143	11.4286
+H	17.9015	8.57143	12.4371
+H	17.9015	8.57143	14.2857
+H	17.9015	8.57143	15.2943
+H	17.9015	8.57143	17.1429
+H	17.9015	8.57143	18.1514
+H	17.9015	8.57143	2.85714
+H	17.9015	8.57143	3.86571
+H	17.9015	8.57143	5.71429
+H	17.9015	8.57143	6.72285
+H	17.9015	8.57143	8.57143
+H	17.9015	8.57143	9.58
 H	3.61574	0	0
 H	3.61574	0	1.00857
+H	3.61574	0	11.4286
+H	3.61574	0	12.4371
+H	3.61574	0	14.2857
+H	3.61574	0	15.2943
+H	3.61574	0	17.1429
+H	3.61574	0	18.1514
 H	3.61574	0	2.85714
 H	3.61574	0	3.86571
 H	3.61574	0	5.71429
 H	3.61574	0	6.72285
+H	3.61574	0	8.57143
+H	3.61574	0	9.58
+H	3.61574	11.4286	0
+H	3.61574	11.4286	1.00857
+H	3.61574	11.4286	11.4286
+H	3.61574	11.4286	12.4371
+H	3.61574	11.4286	14.2857
+H	3.61574	11.4286	15.2943
+H	3.61574	11.4286	17.1429
+H	3.61574	11.4286	18.1514
+H	3.61574	11.4286	2.85714
+H	3.61574	11.4286	3.86571
+H	3.61574	11.4286	5.71429
+H	3.61574	11.4286	6.72285
+H	3.61574	11.4286	8.57143
+H	3.61574	11.4286	9.58
+H	3.61574	14.2857	0
+H	3.61574	14.2857	1.00857
+H	3.61574	14.2857	11.4286
+H	3.61574	14.2857	12.4371
+H	3.61574	14.2857	14.2857
+H	3.61574	14.2857	15.2943
+H	3.61574	14.2857	17.1429
+H	3.61574	14.2857	18.1514
+H	3.61574	14.2857	2.85714
+H	3.61574	14.2857	3.86571
+H	3.61574	14.2857	5.71429
+H	3.61574	14.2857	6.72285
+H	3.61574	14.2857	8.57143
+H	3.61574	14.2857	9.58
+H	3.61574	17.1429	0
+H	3.61574	17.1429	1.00857
+H	3.61574	17.1429	11.4286
+H	3.61574	17.1429	12.4371
+H	3.61574	17.1429	14.2857
+H	3.61574	17.1429	15.2943
+H	3.61574	17.1429	17.1429
+H	3.61574	17.1429	18.1514
+H	3.61574	17.1429	2.85714
+H	3.61574	17.1429	3.86571
+H	3.61574	17.1429	5.71429
+H	3.61574	17.1429	6.72285
+H	3.61574	17.1429	8.57143
+H	3.61574	17.1429	9.58
 H	3.61574	2.85714	0
 H	3.61574	2.85714	1.00857
+H	3.61574	2.85714	11.4286
+H	3.61574	2.85714	12.4371
+H	3.61574	2.85714	14.2857
+H	3.61574	2.85714	15.2943
+H	3.61574	2.85714	17.1429
+H	3.61574	2.85714	18.1514
 H	3.61574	2.85714	2.85714
 H	3.61574	2.85714	3.86571
@@ -37,6 +462,13 @@
 H	3.61574	2.85714	6.72285
 H	3.61574	2.85714	8.57143
+H	3.61574	2.85714	9.58
 H	3.61574	5.71429	0
 H	3.61574	5.71429	1.00857
+H	3.61574	5.71429	11.4286
+H	3.61574	5.71429	12.4371
+H	3.61574	5.71429	14.2857
+H	3.61574	5.71429	15.2943
+H	3.61574	5.71429	17.1429
+H	3.61574	5.71429	18.1514
 H	3.61574	5.71429	2.85714
 H	3.61574	5.71429	3.86571
@@ -44,11 +476,28 @@
 H	3.61574	5.71429	6.72285
 H	3.61574	5.71429	8.57143
+H	3.61574	5.71429	9.58
+H	3.61574	8.57143	0
 H	3.61574	8.57143	1.00857
+H	3.61574	8.57143	11.4286
+H	3.61574	8.57143	12.4371
+H	3.61574	8.57143	14.2857
+H	3.61574	8.57143	15.2943
+H	3.61574	8.57143	17.1429
+H	3.61574	8.57143	18.1514
 H	3.61574	8.57143	2.85714
 H	3.61574	8.57143	3.86571
 H	3.61574	8.57143	5.71429
+H	3.61574	8.57143	6.72285
+H	3.61574	8.57143	8.57143
+H	3.61574	8.57143	9.58
 H	6.39363	3.90454	3.53589
 H	6.47289	0	0
 H	6.47289	0	1.00857
+H	6.47289	0	11.4286
+H	6.47289	0	12.4371
+H	6.47289	0	14.2857
+H	6.47289	0	15.2943
+H	6.47289	0	17.1429
+H	6.47289	0	18.1514
 H	6.47289	0	2.85714
 H	6.47289	0	3.86571
@@ -57,5 +506,53 @@
 H	6.47289	0	8.57143
 H	6.47289	0	9.58
+H	6.47289	11.4286	0
+H	6.47289	11.4286	1.00857
+H	6.47289	11.4286	11.4286
+H	6.47289	11.4286	12.4371
+H	6.47289	11.4286	14.2857
+H	6.47289	11.4286	15.2943
+H	6.47289	11.4286	17.1429
+H	6.47289	11.4286	18.1514
+H	6.47289	11.4286	2.85714
+H	6.47289	11.4286	3.86571
+H	6.47289	11.4286	5.71429
+H	6.47289	11.4286	6.72285
+H	6.47289	11.4286	8.57143
+H	6.47289	11.4286	9.58
+H	6.47289	14.2857	0
+H	6.47289	14.2857	1.00857
+H	6.47289	14.2857	11.4286
+H	6.47289	14.2857	12.4371
+H	6.47289	14.2857	14.2857
+H	6.47289	14.2857	15.2943
+H	6.47289	14.2857	17.1429
+H	6.47289	14.2857	18.1514
+H	6.47289	14.2857	2.85714
+H	6.47289	14.2857	3.86571
+H	6.47289	14.2857	5.71429
+H	6.47289	14.2857	6.72285
+H	6.47289	14.2857	8.57143
+H	6.47289	14.2857	9.58
+H	6.47289	17.1429	0
+H	6.47289	17.1429	1.00857
+H	6.47289	17.1429	11.4286
+H	6.47289	17.1429	12.4371
+H	6.47289	17.1429	14.2857
+H	6.47289	17.1429	15.2943
+H	6.47289	17.1429	17.1429
+H	6.47289	17.1429	18.1514
+H	6.47289	17.1429	2.85714
+H	6.47289	17.1429	3.86571
+H	6.47289	17.1429	5.71429
+H	6.47289	17.1429	6.72285
+H	6.47289	17.1429	8.57143
+H	6.47289	17.1429	9.58
 H	6.47289	2.85714	0
+H	6.47289	2.85714	11.4286
+H	6.47289	2.85714	12.4371
+H	6.47289	2.85714	14.2857
+H	6.47289	2.85714	15.2943
+H	6.47289	2.85714	17.1429
+H	6.47289	2.85714	18.1514
 H	6.47289	2.85714	6.72285
 H	6.47289	2.85714	8.57143
@@ -63,4 +560,10 @@
 H	6.47289	5.71429	0
 H	6.47289	5.71429	1.00857
+H	6.47289	5.71429	11.4286
+H	6.47289	5.71429	12.4371
+H	6.47289	5.71429	14.2857
+H	6.47289	5.71429	15.2943
+H	6.47289	5.71429	17.1429
+H	6.47289	5.71429	18.1514
 H	6.47289	5.71429	5.71429
 H	6.47289	5.71429	6.72285
@@ -69,8 +572,16 @@
 H	6.47289	8.57143	0
 H	6.47289	8.57143	1.00857
+H	6.47289	8.57143	11.4286
+H	6.47289	8.57143	12.4371
+H	6.47289	8.57143	14.2857
+H	6.47289	8.57143	15.2943
+H	6.47289	8.57143	17.1429
+H	6.47289	8.57143	18.1514
 H	6.47289	8.57143	2.85714
 H	6.47289	8.57143	3.86571
 H	6.47289	8.57143	5.71429
 H	6.47289	8.57143	6.72285
+H	6.47289	8.57143	8.57143
+H	6.47289	8.57143	9.58
 H	7.28359	2.64589	2.64589
 H	7.28359	2.64589	4.42589
@@ -79,4 +590,10 @@
 H	9.33003	0	0
 H	9.33003	0	1.00857
+H	9.33003	0	11.4286
+H	9.33003	0	12.4371
+H	9.33003	0	14.2857
+H	9.33003	0	15.2943
+H	9.33003	0	17.1429
+H	9.33003	0	18.1514
 H	9.33003	0	2.85714
 H	9.33003	0	3.86571
@@ -84,9 +601,64 @@
 H	9.33003	0	6.72285
 H	9.33003	0	8.57143
+H	9.33003	0	9.58
+H	9.33003	11.4286	0
+H	9.33003	11.4286	1.00857
+H	9.33003	11.4286	11.4286
+H	9.33003	11.4286	12.4371
+H	9.33003	11.4286	14.2857
+H	9.33003	11.4286	15.2943
+H	9.33003	11.4286	17.1429
+H	9.33003	11.4286	18.1514
+H	9.33003	11.4286	2.85714
+H	9.33003	11.4286	3.86571
+H	9.33003	11.4286	5.71429
+H	9.33003	11.4286	6.72285
+H	9.33003	11.4286	8.57143
+H	9.33003	11.4286	9.58
+H	9.33003	14.2857	0
+H	9.33003	14.2857	1.00857
+H	9.33003	14.2857	11.4286
+H	9.33003	14.2857	12.4371
+H	9.33003	14.2857	14.2857
+H	9.33003	14.2857	15.2943
+H	9.33003	14.2857	17.1429
+H	9.33003	14.2857	18.1514
+H	9.33003	14.2857	2.85714
+H	9.33003	14.2857	3.86571
+H	9.33003	14.2857	5.71429
+H	9.33003	14.2857	6.72285
+H	9.33003	14.2857	8.57143
+H	9.33003	14.2857	9.58
+H	9.33003	17.1429	0
+H	9.33003	17.1429	1.00857
+H	9.33003	17.1429	11.4286
+H	9.33003	17.1429	12.4371
+H	9.33003	17.1429	14.2857
+H	9.33003	17.1429	15.2943
+H	9.33003	17.1429	17.1429
+H	9.33003	17.1429	18.1514
+H	9.33003	17.1429	2.85714
+H	9.33003	17.1429	3.86571
+H	9.33003	17.1429	5.71429
+H	9.33003	17.1429	6.72285
+H	9.33003	17.1429	8.57143
+H	9.33003	17.1429	9.58
 H	9.33003	2.85714	0
+H	9.33003	2.85714	11.4286
+H	9.33003	2.85714	12.4371
+H	9.33003	2.85714	14.2857
+H	9.33003	2.85714	15.2943
+H	9.33003	2.85714	17.1429
+H	9.33003	2.85714	18.1514
 H	9.33003	2.85714	6.72285
 H	9.33003	2.85714	8.57143
 H	9.33003	2.85714	9.58
 H	9.33003	5.71429	0
+H	9.33003	5.71429	11.4286
+H	9.33003	5.71429	12.4371
+H	9.33003	5.71429	14.2857
+H	9.33003	5.71429	15.2943
+H	9.33003	5.71429	17.1429
+H	9.33003	5.71429	18.1514
 H	9.33003	5.71429	6.72285
 H	9.33003	5.71429	8.57143
@@ -94,52 +666,351 @@
 H	9.33003	8.57143	0
 H	9.33003	8.57143	1.00857
+H	9.33003	8.57143	11.4286
+H	9.33003	8.57143	12.4371
+H	9.33003	8.57143	14.2857
+H	9.33003	8.57143	15.2943
+H	9.33003	8.57143	17.1429
+H	9.33003	8.57143	18.1514
 H	9.33003	8.57143	2.85714
 H	9.33003	8.57143	3.86571
 H	9.33003	8.57143	5.71429
 H	9.33003	8.57143	6.72285
+H	9.33003	8.57143	8.57143
+H	9.33003	8.57143	9.58
 H	9.78209	2.64589	2.64589
 H	9.78209	2.64589	4.42589
+O	0	0	0.504284
+O	0	0	11.9329
+O	0	0	14.79
+O	0	0	17.6471
+O	0	0	3.36143
+O	0	0	6.21857
+O	0	0	9.07571
+O	0	11.4286	0.504284
+O	0	11.4286	11.9329
+O	0	11.4286	14.79
+O	0	11.4286	17.6471
+O	0	11.4286	3.36143
+O	0	11.4286	6.21857
+O	0	11.4286	9.07571
+O	0	14.2857	0.504284
+O	0	14.2857	11.9329
+O	0	14.2857	14.79
+O	0	14.2857	17.6471
+O	0	14.2857	3.36143
+O	0	14.2857	6.21857
+O	0	14.2857	9.07571
+O	0	17.1429	0.504284
+O	0	17.1429	11.9329
+O	0	17.1429	14.79
+O	0	17.1429	17.6471
+O	0	17.1429	3.36143
+O	0	17.1429	6.21857
+O	0	17.1429	9.07571
+O	0	2.85714	0.504284
+O	0	2.85714	11.9329
+O	0	2.85714	14.79
+O	0	2.85714	17.6471
+O	0	2.85714	3.36143
+O	0	2.85714	6.21857
+O	0	2.85714	9.07571
+O	0	5.71429	0.504284
+O	0	5.71429	11.9329
+O	0	5.71429	14.79
+O	0	5.71429	17.6471
+O	0	5.71429	3.36143
+O	0	5.71429	6.21857
+O	0	5.71429	9.07571
+O	0	8.57143	0.504284
+O	0	8.57143	11.9329
+O	0	8.57143	14.79
+O	0	8.57143	17.6471
+O	0	8.57143	3.36143
+O	0	8.57143	6.21857
+O	0	8.57143	9.07571
 O	11.4286	0	0.504284
+O	11.4286	0	11.9329
+O	11.4286	0	14.79
+O	11.4286	0	17.6471
 O	11.4286	0	3.36143
 O	11.4286	0	6.21857
+O	11.4286	0	9.07571
+O	11.4286	11.4286	0.504284
+O	11.4286	11.4286	11.9329
+O	11.4286	11.4286	14.79
+O	11.4286	11.4286	17.6471
+O	11.4286	11.4286	3.36143
+O	11.4286	11.4286	6.21857
+O	11.4286	11.4286	9.07571
+O	11.4286	14.2857	0.504284
+O	11.4286	14.2857	11.9329
+O	11.4286	14.2857	14.79
+O	11.4286	14.2857	17.6471
+O	11.4286	14.2857	3.36143
+O	11.4286	14.2857	6.21857
+O	11.4286	14.2857	9.07571
+O	11.4286	17.1429	0.504284
+O	11.4286	17.1429	11.9329
+O	11.4286	17.1429	14.79
+O	11.4286	17.1429	17.6471
+O	11.4286	17.1429	3.36143
+O	11.4286	17.1429	6.21857
+O	11.4286	17.1429	9.07571
 O	11.4286	2.85714	0.504284
+O	11.4286	2.85714	11.9329
+O	11.4286	2.85714	14.79
+O	11.4286	2.85714	17.6471
 O	11.4286	2.85714	6.21857
 O	11.4286	2.85714	9.07571
 O	11.4286	5.71429	0.504284
+O	11.4286	5.71429	11.9329
+O	11.4286	5.71429	14.79
+O	11.4286	5.71429	17.6471
 O	11.4286	5.71429	6.21857
+O	11.4286	5.71429	9.07571
+O	11.4286	8.57143	0.504284
+O	11.4286	8.57143	11.9329
+O	11.4286	8.57143	14.79
+O	11.4286	8.57143	17.6471
 O	11.4286	8.57143	3.36143
+O	11.4286	8.57143	6.21857
+O	11.4286	8.57143	9.07571
+O	14.2857	0	0.504284
+O	14.2857	0	11.9329
+O	14.2857	0	14.79
+O	14.2857	0	17.6471
+O	14.2857	0	3.36143
+O	14.2857	0	6.21857
+O	14.2857	0	9.07571
+O	14.2857	11.4286	0.504284
+O	14.2857	11.4286	11.9329
+O	14.2857	11.4286	14.79
+O	14.2857	11.4286	17.6471
+O	14.2857	11.4286	3.36143
+O	14.2857	11.4286	6.21857
+O	14.2857	11.4286	9.07571
+O	14.2857	14.2857	0.504284
+O	14.2857	14.2857	11.9329
+O	14.2857	14.2857	14.79
+O	14.2857	14.2857	17.6471
+O	14.2857	14.2857	3.36143
+O	14.2857	14.2857	6.21857
+O	14.2857	14.2857	9.07571
+O	14.2857	17.1429	0.504284
+O	14.2857	17.1429	11.9329
+O	14.2857	17.1429	14.79
+O	14.2857	17.1429	17.6471
+O	14.2857	17.1429	3.36143
+O	14.2857	17.1429	6.21857
+O	14.2857	17.1429	9.07571
+O	14.2857	2.85714	0.504284
+O	14.2857	2.85714	11.9329
+O	14.2857	2.85714	14.79
+O	14.2857	2.85714	17.6471
+O	14.2857	2.85714	3.36143
+O	14.2857	2.85714	6.21857
+O	14.2857	2.85714	9.07571
+O	14.2857	5.71429	0.504284
+O	14.2857	5.71429	11.9329
+O	14.2857	5.71429	14.79
+O	14.2857	5.71429	17.6471
+O	14.2857	5.71429	3.36143
+O	14.2857	5.71429	6.21857
+O	14.2857	5.71429	9.07571
+O	14.2857	8.57143	0.504284
+O	14.2857	8.57143	11.9329
+O	14.2857	8.57143	14.79
+O	14.2857	8.57143	17.6471
+O	14.2857	8.57143	3.36143
+O	14.2857	8.57143	6.21857
+O	14.2857	8.57143	9.07571
+O	17.1429	0	0.504284
+O	17.1429	0	11.9329
+O	17.1429	0	14.79
+O	17.1429	0	17.6471
+O	17.1429	0	3.36143
+O	17.1429	0	6.21857
+O	17.1429	0	9.07571
+O	17.1429	11.4286	0.504284
+O	17.1429	11.4286	11.9329
+O	17.1429	11.4286	14.79
+O	17.1429	11.4286	17.6471
+O	17.1429	11.4286	3.36143
+O	17.1429	11.4286	6.21857
+O	17.1429	11.4286	9.07571
+O	17.1429	14.2857	0.504284
+O	17.1429	14.2857	11.9329
+O	17.1429	14.2857	14.79
+O	17.1429	14.2857	17.6471
+O	17.1429	14.2857	3.36143
+O	17.1429	14.2857	6.21857
+O	17.1429	14.2857	9.07571
+O	17.1429	17.1429	0.504284
+O	17.1429	17.1429	11.9329
+O	17.1429	17.1429	14.79
+O	17.1429	17.1429	17.6471
+O	17.1429	17.1429	3.36143
+O	17.1429	17.1429	6.21857
+O	17.1429	17.1429	9.07571
+O	17.1429	2.85714	0.504284
+O	17.1429	2.85714	11.9329
+O	17.1429	2.85714	14.79
+O	17.1429	2.85714	17.6471
+O	17.1429	2.85714	3.36143
+O	17.1429	2.85714	6.21857
+O	17.1429	2.85714	9.07571
+O	17.1429	5.71429	0.504284
+O	17.1429	5.71429	11.9329
+O	17.1429	5.71429	14.79
+O	17.1429	5.71429	17.6471
+O	17.1429	5.71429	3.36143
+O	17.1429	5.71429	6.21857
+O	17.1429	5.71429	9.07571
+O	17.1429	8.57143	0.504284
+O	17.1429	8.57143	11.9329
+O	17.1429	8.57143	14.79
+O	17.1429	8.57143	17.6471
+O	17.1429	8.57143	3.36143
+O	17.1429	8.57143	6.21857
+O	17.1429	8.57143	9.07571
 O	2.85714	0	0.504284
+O	2.85714	0	11.9329
+O	2.85714	0	14.79
+O	2.85714	0	17.6471
 O	2.85714	0	3.36143
 O	2.85714	0	6.21857
+O	2.85714	0	9.07571
+O	2.85714	11.4286	0.504284
+O	2.85714	11.4286	11.9329
+O	2.85714	11.4286	14.79
+O	2.85714	11.4286	17.6471
+O	2.85714	11.4286	3.36143
+O	2.85714	11.4286	6.21857
+O	2.85714	11.4286	9.07571
+O	2.85714	14.2857	0.504284
+O	2.85714	14.2857	11.9329
+O	2.85714	14.2857	14.79
+O	2.85714	14.2857	17.6471
+O	2.85714	14.2857	3.36143
+O	2.85714	14.2857	6.21857
+O	2.85714	14.2857	9.07571
+O	2.85714	17.1429	0.504284
+O	2.85714	17.1429	11.9329
+O	2.85714	17.1429	14.79
+O	2.85714	17.1429	17.6471
+O	2.85714	17.1429	3.36143
+O	2.85714	17.1429	6.21857
+O	2.85714	17.1429	9.07571
 O	2.85714	2.85714	0.504284
+O	2.85714	2.85714	11.9329
+O	2.85714	2.85714	14.79
+O	2.85714	2.85714	17.6471
 O	2.85714	2.85714	3.36143
 O	2.85714	2.85714	6.21857
+O	2.85714	2.85714	9.07571
 O	2.85714	5.71429	0.504284
+O	2.85714	5.71429	11.9329
+O	2.85714	5.71429	14.79
+O	2.85714	5.71429	17.6471
 O	2.85714	5.71429	3.36143
 O	2.85714	5.71429	6.21857
+O	2.85714	5.71429	9.07571
+O	2.85714	8.57143	0.504284
+O	2.85714	8.57143	11.9329
+O	2.85714	8.57143	14.79
+O	2.85714	8.57143	17.6471
 O	2.85714	8.57143	3.36143
+O	2.85714	8.57143	6.21857
+O	2.85714	8.57143	9.07571
 O	5.71429	0	0.504284
+O	5.71429	0	11.9329
+O	5.71429	0	14.79
+O	5.71429	0	17.6471
 O	5.71429	0	3.36143
 O	5.71429	0	6.21857
 O	5.71429	0	9.07571
+O	5.71429	11.4286	0.504284
+O	5.71429	11.4286	11.9329
+O	5.71429	11.4286	14.79
+O	5.71429	11.4286	17.6471
+O	5.71429	11.4286	3.36143
+O	5.71429	11.4286	6.21857
+O	5.71429	11.4286	9.07571
+O	5.71429	14.2857	0.504284
+O	5.71429	14.2857	11.9329
+O	5.71429	14.2857	14.79
+O	5.71429	14.2857	17.6471
+O	5.71429	14.2857	3.36143
+O	5.71429	14.2857	6.21857
+O	5.71429	14.2857	9.07571
+O	5.71429	17.1429	0.504284
+O	5.71429	17.1429	11.9329
+O	5.71429	17.1429	14.79
+O	5.71429	17.1429	17.6471
+O	5.71429	17.1429	3.36143
+O	5.71429	17.1429	6.21857
+O	5.71429	17.1429	9.07571
 O	5.71429	2.85714	0.504284
+O	5.71429	2.85714	11.9329
+O	5.71429	2.85714	14.79
+O	5.71429	2.85714	17.6471
 O	5.71429	2.85714	6.21857
 O	5.71429	2.85714	9.07571
 O	5.71429	5.71429	0.504284
+O	5.71429	5.71429	11.9329
+O	5.71429	5.71429	14.79
+O	5.71429	5.71429	17.6471
 O	5.71429	5.71429	6.21857
 O	5.71429	5.71429	9.07571
 O	5.71429	8.57143	0.504284
+O	5.71429	8.57143	11.9329
+O	5.71429	8.57143	14.79
+O	5.71429	8.57143	17.6471
 O	5.71429	8.57143	3.36143
 O	5.71429	8.57143	6.21857
+O	5.71429	8.57143	9.07571
 O	8.57143	0	0.504284
+O	8.57143	0	11.9329
+O	8.57143	0	14.79
+O	8.57143	0	17.6471
 O	8.57143	0	3.36143
 O	8.57143	0	6.21857
 O	8.57143	0	9.07571
+O	8.57143	11.4286	0.504284
+O	8.57143	11.4286	11.9329
+O	8.57143	11.4286	14.79
+O	8.57143	11.4286	17.6471
+O	8.57143	11.4286	3.36143
+O	8.57143	11.4286	6.21857
+O	8.57143	11.4286	9.07571
+O	8.57143	14.2857	0.504284
+O	8.57143	14.2857	11.9329
+O	8.57143	14.2857	14.79
+O	8.57143	14.2857	17.6471
+O	8.57143	14.2857	3.36143
+O	8.57143	14.2857	6.21857
+O	8.57143	14.2857	9.07571
+O	8.57143	17.1429	0.504284
+O	8.57143	17.1429	11.9329
+O	8.57143	17.1429	14.79
+O	8.57143	17.1429	17.6471
+O	8.57143	17.1429	3.36143
+O	8.57143	17.1429	6.21857
+O	8.57143	17.1429	9.07571
 O	8.57143	2.85714	0.504284
+O	8.57143	2.85714	11.9329
+O	8.57143	2.85714	14.79
+O	8.57143	2.85714	17.6471
 O	8.57143	2.85714	9.07571
 O	8.57143	5.71429	0.504284
+O	8.57143	5.71429	11.9329
+O	8.57143	5.71429	14.79
+O	8.57143	5.71429	17.6471
 O	8.57143	5.71429	9.07571
 O	8.57143	8.57143	0.504284
+O	8.57143	8.57143	11.9329
+O	8.57143	8.57143	14.79
+O	8.57143	8.57143	17.6471
 O	8.57143	8.57143	3.36143
 O	8.57143	8.57143	6.21857
-144
+O	8.57143	8.57143	9.07571
Index: sts/regression/Simple_configuration/8/pre/test.conf
===================================================================
--- tests/regression/Simple_configuration/8/pre/test.conf	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ 	(revision )
@@ -1,1089 +1,0 @@
-# ParallelCarParinello - main configuration file - created with molecuilder
-
-mainname	pcp	# programm name (for runtime files)
-defaultpath	not specified	# where to put files during runtime
-pseudopotpath	not specified	# where to find pseudopotentials
-
-ProcPEGamma	8	# for parallel computing: share constants
-ProcPEPsi	1	# for parallel computing: share wave functions
-DoOutVis	0	# Output data for OpenDX
-DoOutMes	1	# Output data for measurements
-DoOutOrbitals	0	# Output all Orbitals
-DoOutCurr	0	# Ouput current density for OpenDx
-DoOutNICS	0	# Output Nucleus independent current shieldings
-DoPerturbation	0	# Do perturbation calculate and determine susceptibility and shielding
-DoFullCurrent	0	# Do full perturbation
-DoConstrainedMD	0	# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD
-Thermostat	Berendsen	2.5	# Which Thermostat and its parameters to use in MD case.
-CommonWannier	0	# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center
-SawtoothStart	0.01	# Absolute value for smooth transition at cell border 
-VectorPlane	0	# Cut plane axis (x, y or z: 0,1,2) for two-dim current vector plot
-VectorCut	0	# Cut plane axis value
-AddGramSch	1	# Additional GramSchmidtOrtogonalization to be safe
-Seed		1	# initial value for random seed for Psi coefficients
-
-MaxOuterStep	0	# number of MolecularDynamics/Structure optimization steps
-Deltat	0.01	# time per MD step
-OutVisStep	10	# Output visual data every ...th step
-OutSrcStep	5	# Output "restart" data every ..th step
-TargetTemp	0.000950045	# Target temperature
-MaxPsiStep	3	# number of Minimisation steps per state (0 - default)
-EpsWannier	1e-07	# tolerance value for spread minimisation of orbitals
-
-# Values specifying when to stop
-MaxMinStep	100	# Maximum number of steps
-RelEpsTotalE	1e-07	# relative change in total energy
-RelEpsKineticE	1e-05	# relative change in kinetic energy
-MaxMinStopStep	0	# check every ..th steps
-MaxMinGapStopStep	1	# check every ..th steps
-
-# Values specifying when to stop for INIT, otherwise same as above
-MaxInitMinStep	100	# Maximum number of steps
-InitRelEpsTotalE	1e-05	# relative change in total energy
-InitRelEpsKineticE	0.0001	# relative change in kinetic energy
-InitMaxMinStopStep	0	# check every ..th steps
-InitMaxMinGapStopStep	1	# check every ..th steps
-
-BoxLength			# (Length of a unit cell)
-20	
-0	20	
-0	0	20	
-
-ECut		128	# energy cutoff for discretization in Hartrees
-MaxLevel	5	# number of different levels in the code, >=2
-Level0Factor	2	# factor by which node number increases from S to 0 level
-RiemannTensor	0	# (Use metric)
-PsiType		0	# 0 - doubly occupied, 1 - SpinUp,SpinDown
-MaxPsiDouble	0	# here: specifying both maximum number of SpinUp- and -Down-states
-PsiMaxNoUp	0	# here: specifying maximum number of SpinUp-states
-PsiMaxNoDown	0	# here: specifying maximum number of SpinDown-states
-AddPsis		0	# Additional unoccupied Psis for bandgap determination
-
-RCut		20	# R-cut for the ewald summation
-StructOpt	0	# Do structure optimization beforehand
-IsAngstroem	1	# 0 - Bohr, 1 - Angstroem
-RelativeCoord	0	# whether ion coordinates are relative (1) or absolute (0)
-MaxTypes	3	# maximum number of different ion types
-
-# Ion type data (PP = PseudoPotential, Z = atomic number)
-#Ion_TypeNr.	Amount	Z	RGauss	L_Max(PP)L_Loc(PP)IonMass	# chemical name, symbol
-Ion_Type1	678	1	1.0	3	3	1.00800000000	Hydrogen	H
-Ion_Type2	3	6	1.0	3	3	12.01100000000	Carbon	C
-Ion_Type3	335	8	1.0	3	3	15.99900000000	Oxygen	O
-#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)
-Ion_Type2_1	9.782085945	3.275186040	3.535886037	0 # molecule nr 0
-Ion_Type2_2	8.532785963	4.158586027	3.535886037	0 # molecule nr 1
-Ion_Type2_3	7.283585982	3.275186040	3.535886037	0 # molecule nr 2
-Ion_Type1_1	9.782085945	2.645886050	2.645886050	0 # molecule nr 3
-Ion_Type1_2	9.782085945	2.645886050	4.425886024	0 # molecule nr 4
-Ion_Type1_3	10.672039608	3.904536878	3.535886037	0 # molecule nr 5
-Ion_Type1_4	8.532785963	4.787886018	2.645886050	0 # molecule nr 6
-Ion_Type1_5	8.532785963	4.787886018	4.425886024	0 # molecule nr 7
-Ion_Type1_6	6.393632318	3.904536877	3.535886037	0 # molecule nr 8
-Ion_Type1_7	7.283585982	2.645886050	2.645886050	0 # molecule nr 9
-Ion_Type1_8	7.283585982	2.645886050	4.425886024	0 # molecule nr 10
-Ion_Type3_1	0.000000000	0.000000000	0.504284000	0 # molecule nr 11
-Ion_Type1_9	0.758602000	0.000000000	1.008568000	0 # molecule nr 12
-Ion_Type1_10	0.758602000	0.000000000	0.000000000	0 # molecule nr 13
-Ion_Type3_2	0.000000000	0.000000000	3.361426857	0 # molecule nr 14
-Ion_Type1_11	0.758602000	0.000000000	3.865710857	0 # molecule nr 15
-Ion_Type1_12	0.758602000	0.000000000	2.857142857	0 # molecule nr 16
-Ion_Type3_3	0.000000000	0.000000000	6.218569714	0 # molecule nr 17
-Ion_Type1_13	0.758602000	0.000000000	6.722853714	0 # molecule nr 18
-Ion_Type1_14	0.758602000	0.000000000	5.714285714	0 # molecule nr 19
-Ion_Type3_4	0.000000000	0.000000000	9.075712571	0 # molecule nr 20
-Ion_Type1_15	0.758602000	0.000000000	9.579996571	0 # molecule nr 21
-Ion_Type1_16	0.758602000	0.000000000	8.571428571	0 # molecule nr 22
-Ion_Type3_5	0.000000000	0.000000000	11.932855429	0 # molecule nr 23
-Ion_Type1_17	0.758602000	0.000000000	12.437139429	0 # molecule nr 24
-Ion_Type1_18	0.758602000	0.000000000	11.428571429	0 # molecule nr 25
-Ion_Type3_6	0.000000000	0.000000000	14.789998286	0 # molecule nr 26
-Ion_Type1_19	0.758602000	0.000000000	15.294282286	0 # molecule nr 27
-Ion_Type1_20	0.758602000	0.000000000	14.285714286	0 # molecule nr 28
-Ion_Type3_7	0.000000000	0.000000000	17.647141143	0 # molecule nr 29
-Ion_Type1_21	0.758602000	0.000000000	18.151425143	0 # molecule nr 30
-Ion_Type1_22	0.758602000	0.000000000	17.142857143	0 # molecule nr 31
-Ion_Type3_8	0.000000000	2.857142857	0.504284000	0 # molecule nr 32
-Ion_Type1_23	0.758602000	2.857142857	1.008568000	0 # molecule nr 33
-Ion_Type1_24	0.758602000	2.857142857	0.000000000	0 # molecule nr 34
-Ion_Type3_9	0.000000000	2.857142857	3.361426857	0 # molecule nr 35
-Ion_Type1_25	0.758602000	2.857142857	3.865710857	0 # molecule nr 36
-Ion_Type1_26	0.758602000	2.857142857	2.857142857	0 # molecule nr 37
-Ion_Type3_10	0.000000000	2.857142857	6.218569714	0 # molecule nr 38
-Ion_Type1_27	0.758602000	2.857142857	6.722853714	0 # molecule nr 39
-Ion_Type1_28	0.758602000	2.857142857	5.714285714	0 # molecule nr 40
-Ion_Type3_11	0.000000000	2.857142857	9.075712571	0 # molecule nr 41
-Ion_Type1_29	0.758602000	2.857142857	9.579996571	0 # molecule nr 42
-Ion_Type1_30	0.758602000	2.857142857	8.571428571	0 # molecule nr 43
-Ion_Type3_12	0.000000000	2.857142857	11.932855429	0 # molecule nr 44
-Ion_Type1_31	0.758602000	2.857142857	12.437139429	0 # molecule nr 45
-Ion_Type1_32	0.758602000	2.857142857	11.428571429	0 # molecule nr 46
-Ion_Type3_13	0.000000000	2.857142857	14.789998286	0 # molecule nr 47
-Ion_Type1_33	0.758602000	2.857142857	15.294282286	0 # molecule nr 48
-Ion_Type1_34	0.758602000	2.857142857	14.285714286	0 # molecule nr 49
-Ion_Type3_14	0.000000000	2.857142857	17.647141143	0 # molecule nr 50
-Ion_Type1_35	0.758602000	2.857142857	18.151425143	0 # molecule nr 51
-Ion_Type1_36	0.758602000	2.857142857	17.142857143	0 # molecule nr 52
-Ion_Type3_15	0.000000000	5.714285714	0.504284000	0 # molecule nr 53
-Ion_Type1_37	0.758602000	5.714285714	1.008568000	0 # molecule nr 54
-Ion_Type1_38	0.758602000	5.714285714	0.000000000	0 # molecule nr 55
-Ion_Type3_16	0.000000000	5.714285714	3.361426857	0 # molecule nr 56
-Ion_Type1_39	0.758602000	5.714285714	3.865710857	0 # molecule nr 57
-Ion_Type1_40	0.758602000	5.714285714	2.857142857	0 # molecule nr 58
-Ion_Type3_17	0.000000000	5.714285714	6.218569714	0 # molecule nr 59
-Ion_Type1_41	0.758602000	5.714285714	6.722853714	0 # molecule nr 60
-Ion_Type1_42	0.758602000	5.714285714	5.714285714	0 # molecule nr 61
-Ion_Type3_18	0.000000000	5.714285714	9.075712571	0 # molecule nr 62
-Ion_Type1_43	0.758602000	5.714285714	9.579996571	0 # molecule nr 63
-Ion_Type1_44	0.758602000	5.714285714	8.571428571	0 # molecule nr 64
-Ion_Type3_19	0.000000000	5.714285714	11.932855429	0 # molecule nr 65
-Ion_Type1_45	0.758602000	5.714285714	12.437139429	0 # molecule nr 66
-Ion_Type1_46	0.758602000	5.714285714	11.428571429	0 # molecule nr 67
-Ion_Type3_20	0.000000000	5.714285714	14.789998286	0 # molecule nr 68
-Ion_Type1_47	0.758602000	5.714285714	15.294282286	0 # molecule nr 69
-Ion_Type1_48	0.758602000	5.714285714	14.285714286	0 # molecule nr 70
-Ion_Type3_21	0.000000000	5.714285714	17.647141143	0 # molecule nr 71
-Ion_Type1_49	0.758602000	5.714285714	18.151425143	0 # molecule nr 72
-Ion_Type1_50	0.758602000	5.714285714	17.142857143	0 # molecule nr 73
-Ion_Type3_22	0.000000000	8.571428571	0.504284000	0 # molecule nr 74
-Ion_Type1_51	0.758602000	8.571428571	1.008568000	0 # molecule nr 75
-Ion_Type1_52	0.758602000	8.571428571	0.000000000	0 # molecule nr 76
-Ion_Type3_23	0.000000000	8.571428571	3.361426857	0 # molecule nr 77
-Ion_Type1_53	0.758602000	8.571428571	3.865710857	0 # molecule nr 78
-Ion_Type1_54	0.758602000	8.571428571	2.857142857	0 # molecule nr 79
-Ion_Type3_24	0.000000000	8.571428571	6.218569714	0 # molecule nr 80
-Ion_Type1_55	0.758602000	8.571428571	6.722853714	0 # molecule nr 81
-Ion_Type1_56	0.758602000	8.571428571	5.714285714	0 # molecule nr 82
-Ion_Type3_25	0.000000000	8.571428571	9.075712571	0 # molecule nr 83
-Ion_Type1_57	0.758602000	8.571428571	9.579996571	0 # molecule nr 84
-Ion_Type1_58	0.758602000	8.571428571	8.571428571	0 # molecule nr 85
-Ion_Type3_26	0.000000000	8.571428571	11.932855429	0 # molecule nr 86
-Ion_Type1_59	0.758602000	8.571428571	12.437139429	0 # molecule nr 87
-Ion_Type1_60	0.758602000	8.571428571	11.428571429	0 # molecule nr 88
-Ion_Type3_27	0.000000000	8.571428571	14.789998286	0 # molecule nr 89
-Ion_Type1_61	0.758602000	8.571428571	15.294282286	0 # molecule nr 90
-Ion_Type1_62	0.758602000	8.571428571	14.285714286	0 # molecule nr 91
-Ion_Type3_28	0.000000000	8.571428571	17.647141143	0 # molecule nr 92
-Ion_Type1_63	0.758602000	8.571428571	18.151425143	0 # molecule nr 93
-Ion_Type1_64	0.758602000	8.571428571	17.142857143	0 # molecule nr 94
-Ion_Type3_29	0.000000000	11.428571429	0.504284000	0 # molecule nr 95
-Ion_Type1_65	0.758602000	11.428571429	1.008568000	0 # molecule nr 96
-Ion_Type1_66	0.758602000	11.428571429	0.000000000	0 # molecule nr 97
-Ion_Type3_30	0.000000000	11.428571429	3.361426857	0 # molecule nr 98
-Ion_Type1_67	0.758602000	11.428571429	3.865710857	0 # molecule nr 99
-Ion_Type1_68	0.758602000	11.428571429	2.857142857	0 # molecule nr 100
-Ion_Type3_31	0.000000000	11.428571429	6.218569714	0 # molecule nr 101
-Ion_Type1_69	0.758602000	11.428571429	6.722853714	0 # molecule nr 102
-Ion_Type1_70	0.758602000	11.428571429	5.714285714	0 # molecule nr 103
-Ion_Type3_32	0.000000000	11.428571429	9.075712571	0 # molecule nr 104
-Ion_Type1_71	0.758602000	11.428571429	9.579996571	0 # molecule nr 105
-Ion_Type1_72	0.758602000	11.428571429	8.571428571	0 # molecule nr 106
-Ion_Type3_33	0.000000000	11.428571429	11.932855429	0 # molecule nr 107
-Ion_Type1_73	0.758602000	11.428571429	12.437139429	0 # molecule nr 108
-Ion_Type1_74	0.758602000	11.428571429	11.428571429	0 # molecule nr 109
-Ion_Type3_34	0.000000000	11.428571429	14.789998286	0 # molecule nr 110
-Ion_Type1_75	0.758602000	11.428571429	15.294282286	0 # molecule nr 111
-Ion_Type1_76	0.758602000	11.428571429	14.285714286	0 # molecule nr 112
-Ion_Type3_35	0.000000000	11.428571429	17.647141143	0 # molecule nr 113
-Ion_Type1_77	0.758602000	11.428571429	18.151425143	0 # molecule nr 114
-Ion_Type1_78	0.758602000	11.428571429	17.142857143	0 # molecule nr 115
-Ion_Type3_36	0.000000000	14.285714286	0.504284000	0 # molecule nr 116
-Ion_Type1_79	0.758602000	14.285714286	1.008568000	0 # molecule nr 117
-Ion_Type1_80	0.758602000	14.285714286	0.000000000	0 # molecule nr 118
-Ion_Type3_37	0.000000000	14.285714286	3.361426857	0 # molecule nr 119
-Ion_Type1_81	0.758602000	14.285714286	3.865710857	0 # molecule nr 120
-Ion_Type1_82	0.758602000	14.285714286	2.857142857	0 # molecule nr 121
-Ion_Type3_38	0.000000000	14.285714286	6.218569714	0 # molecule nr 122
-Ion_Type1_83	0.758602000	14.285714286	6.722853714	0 # molecule nr 123
-Ion_Type1_84	0.758602000	14.285714286	5.714285714	0 # molecule nr 124
-Ion_Type3_39	0.000000000	14.285714286	9.075712571	0 # molecule nr 125
-Ion_Type1_85	0.758602000	14.285714286	9.579996571	0 # molecule nr 126
-Ion_Type1_86	0.758602000	14.285714286	8.571428571	0 # molecule nr 127
-Ion_Type3_40	0.000000000	14.285714286	11.932855429	0 # molecule nr 128
-Ion_Type1_87	0.758602000	14.285714286	12.437139429	0 # molecule nr 129
-Ion_Type1_88	0.758602000	14.285714286	11.428571429	0 # molecule nr 130
-Ion_Type3_41	0.000000000	14.285714286	14.789998286	0 # molecule nr 131
-Ion_Type1_89	0.758602000	14.285714286	15.294282286	0 # molecule nr 132
-Ion_Type1_90	0.758602000	14.285714286	14.285714286	0 # molecule nr 133
-Ion_Type3_42	0.000000000	14.285714286	17.647141143	0 # molecule nr 134
-Ion_Type1_91	0.758602000	14.285714286	18.151425143	0 # molecule nr 135
-Ion_Type1_92	0.758602000	14.285714286	17.142857143	0 # molecule nr 136
-Ion_Type3_43	0.000000000	17.142857143	0.504284000	0 # molecule nr 137
-Ion_Type1_93	0.758602000	17.142857143	1.008568000	0 # molecule nr 138
-Ion_Type1_94	0.758602000	17.142857143	0.000000000	0 # molecule nr 139
-Ion_Type3_44	0.000000000	17.142857143	3.361426857	0 # molecule nr 140
-Ion_Type1_95	0.758602000	17.142857143	3.865710857	0 # molecule nr 141
-Ion_Type1_96	0.758602000	17.142857143	2.857142857	0 # molecule nr 142
-Ion_Type3_45	0.000000000	17.142857143	6.218569714	0 # molecule nr 143
-Ion_Type1_97	0.758602000	17.142857143	6.722853714	0 # molecule nr 144
-Ion_Type1_98	0.758602000	17.142857143	5.714285714	0 # molecule nr 145
-Ion_Type3_46	0.000000000	17.142857143	9.075712571	0 # molecule nr 146
-Ion_Type1_99	0.758602000	17.142857143	9.579996571	0 # molecule nr 147
-Ion_Type1_100	0.758602000	17.142857143	8.571428571	0 # molecule nr 148
-Ion_Type3_47	0.000000000	17.142857143	11.932855429	0 # molecule nr 149
-Ion_Type1_101	0.758602000	17.142857143	12.437139429	0 # molecule nr 150
-Ion_Type1_102	0.758602000	17.142857143	11.428571429	0 # molecule nr 151
-Ion_Type3_48	0.000000000	17.142857143	14.789998286	0 # molecule nr 152
-Ion_Type1_103	0.758602000	17.142857143	15.294282286	0 # molecule nr 153
-Ion_Type1_104	0.758602000	17.142857143	14.285714286	0 # molecule nr 154
-Ion_Type3_49	0.000000000	17.142857143	17.647141143	0 # molecule nr 155
-Ion_Type1_105	0.758602000	17.142857143	18.151425143	0 # molecule nr 156
-Ion_Type1_106	0.758602000	17.142857143	17.142857143	0 # molecule nr 157
-Ion_Type3_50	2.857142857	0.000000000	0.504284000	0 # molecule nr 158
-Ion_Type1_107	3.615744857	0.000000000	1.008568000	0 # molecule nr 159
-Ion_Type1_108	3.615744857	0.000000000	0.000000000	0 # molecule nr 160
-Ion_Type3_51	2.857142857	0.000000000	3.361426857	0 # molecule nr 161
-Ion_Type1_109	3.615744857	0.000000000	3.865710857	0 # molecule nr 162
-Ion_Type1_110	3.615744857	0.000000000	2.857142857	0 # molecule nr 163
-Ion_Type3_52	2.857142857	0.000000000	6.218569714	0 # molecule nr 164
-Ion_Type1_111	3.615744857	0.000000000	6.722853714	0 # molecule nr 165
-Ion_Type1_112	3.615744857	0.000000000	5.714285714	0 # molecule nr 166
-Ion_Type3_53	2.857142857	0.000000000	9.075712571	0 # molecule nr 167
-Ion_Type1_113	3.615744857	0.000000000	9.579996571	0 # molecule nr 168
-Ion_Type1_114	3.615744857	0.000000000	8.571428571	0 # molecule nr 169
-Ion_Type3_54	2.857142857	0.000000000	11.932855429	0 # molecule nr 170
-Ion_Type1_115	3.615744857	0.000000000	12.437139429	0 # molecule nr 171
-Ion_Type1_116	3.615744857	0.000000000	11.428571429	0 # molecule nr 172
-Ion_Type3_55	2.857142857	0.000000000	14.789998286	0 # molecule nr 173
-Ion_Type1_117	3.615744857	0.000000000	15.294282286	0 # molecule nr 174
-Ion_Type1_118	3.615744857	0.000000000	14.285714286	0 # molecule nr 175
-Ion_Type3_56	2.857142857	0.000000000	17.647141143	0 # molecule nr 176
-Ion_Type1_119	3.615744857	0.000000000	18.151425143	0 # molecule nr 177
-Ion_Type1_120	3.615744857	0.000000000	17.142857143	0 # molecule nr 178
-Ion_Type3_57	2.857142857	2.857142857	0.504284000	0 # molecule nr 179
-Ion_Type1_121	3.615744857	2.857142857	1.008568000	0 # molecule nr 180
-Ion_Type1_122	3.615744857	2.857142857	0.000000000	0 # molecule nr 181
-Ion_Type3_58	2.857142857	2.857142857	3.361426857	0 # molecule nr 182
-Ion_Type1_123	3.615744857	2.857142857	3.865710857	0 # molecule nr 183
-Ion_Type1_124	3.615744857	2.857142857	2.857142857	0 # molecule nr 184
-Ion_Type3_59	2.857142857	2.857142857	6.218569714	0 # molecule nr 185
-Ion_Type1_125	3.615744857	2.857142857	6.722853714	0 # molecule nr 186
-Ion_Type1_126	3.615744857	2.857142857	5.714285714	0 # molecule nr 187
-Ion_Type3_60	2.857142857	2.857142857	9.075712571	0 # molecule nr 188
-Ion_Type1_127	3.615744857	2.857142857	9.579996571	0 # molecule nr 189
-Ion_Type1_128	3.615744857	2.857142857	8.571428571	0 # molecule nr 190
-Ion_Type3_61	2.857142857	2.857142857	11.932855429	0 # molecule nr 191
-Ion_Type1_129	3.615744857	2.857142857	12.437139429	0 # molecule nr 192
-Ion_Type1_130	3.615744857	2.857142857	11.428571429	0 # molecule nr 193
-Ion_Type3_62	2.857142857	2.857142857	14.789998286	0 # molecule nr 194
-Ion_Type1_131	3.615744857	2.857142857	15.294282286	0 # molecule nr 195
-Ion_Type1_132	3.615744857	2.857142857	14.285714286	0 # molecule nr 196
-Ion_Type3_63	2.857142857	2.857142857	17.647141143	0 # molecule nr 197
-Ion_Type1_133	3.615744857	2.857142857	18.151425143	0 # molecule nr 198
-Ion_Type1_134	3.615744857	2.857142857	17.142857143	0 # molecule nr 199
-Ion_Type3_64	2.857142857	5.714285714	0.504284000	0 # molecule nr 200
-Ion_Type1_135	3.615744857	5.714285714	1.008568000	0 # molecule nr 201
-Ion_Type1_136	3.615744857	5.714285714	0.000000000	0 # molecule nr 202
-Ion_Type3_65	2.857142857	5.714285714	3.361426857	0 # molecule nr 203
-Ion_Type1_137	3.615744857	5.714285714	3.865710857	0 # molecule nr 204
-Ion_Type1_138	3.615744857	5.714285714	2.857142857	0 # molecule nr 205
-Ion_Type3_66	2.857142857	5.714285714	6.218569714	0 # molecule nr 206
-Ion_Type1_139	3.615744857	5.714285714	6.722853714	0 # molecule nr 207
-Ion_Type1_140	3.615744857	5.714285714	5.714285714	0 # molecule nr 208
-Ion_Type3_67	2.857142857	5.714285714	9.075712571	0 # molecule nr 209
-Ion_Type1_141	3.615744857	5.714285714	9.579996571	0 # molecule nr 210
-Ion_Type1_142	3.615744857	5.714285714	8.571428571	0 # molecule nr 211
-Ion_Type3_68	2.857142857	5.714285714	11.932855429	0 # molecule nr 212
-Ion_Type1_143	3.615744857	5.714285714	12.437139429	0 # molecule nr 213
-Ion_Type1_144	3.615744857	5.714285714	11.428571429	0 # molecule nr 214
-Ion_Type3_69	2.857142857	5.714285714	14.789998286	0 # molecule nr 215
-Ion_Type1_145	3.615744857	5.714285714	15.294282286	0 # molecule nr 216
-Ion_Type1_146	3.615744857	5.714285714	14.285714286	0 # molecule nr 217
-Ion_Type3_70	2.857142857	5.714285714	17.647141143	0 # molecule nr 218
-Ion_Type1_147	3.615744857	5.714285714	18.151425143	0 # molecule nr 219
-Ion_Type1_148	3.615744857	5.714285714	17.142857143	0 # molecule nr 220
-Ion_Type3_71	2.857142857	8.571428571	0.504284000	0 # molecule nr 221
-Ion_Type1_149	3.615744857	8.571428571	1.008568000	0 # molecule nr 222
-Ion_Type1_150	3.615744857	8.571428571	0.000000000	0 # molecule nr 223
-Ion_Type3_72	2.857142857	8.571428571	3.361426857	0 # molecule nr 224
-Ion_Type1_151	3.615744857	8.571428571	3.865710857	0 # molecule nr 225
-Ion_Type1_152	3.615744857	8.571428571	2.857142857	0 # molecule nr 226
-Ion_Type3_73	2.857142857	8.571428571	6.218569714	0 # molecule nr 227
-Ion_Type1_153	3.615744857	8.571428571	6.722853714	0 # molecule nr 228
-Ion_Type1_154	3.615744857	8.571428571	5.714285714	0 # molecule nr 229
-Ion_Type3_74	2.857142857	8.571428571	9.075712571	0 # molecule nr 230
-Ion_Type1_155	3.615744857	8.571428571	9.579996571	0 # molecule nr 231
-Ion_Type1_156	3.615744857	8.571428571	8.571428571	0 # molecule nr 232
-Ion_Type3_75	2.857142857	8.571428571	11.932855429	0 # molecule nr 233
-Ion_Type1_157	3.615744857	8.571428571	12.437139429	0 # molecule nr 234
-Ion_Type1_158	3.615744857	8.571428571	11.428571429	0 # molecule nr 235
-Ion_Type3_76	2.857142857	8.571428571	14.789998286	0 # molecule nr 236
-Ion_Type1_159	3.615744857	8.571428571	15.294282286	0 # molecule nr 237
-Ion_Type1_160	3.615744857	8.571428571	14.285714286	0 # molecule nr 238
-Ion_Type3_77	2.857142857	8.571428571	17.647141143	0 # molecule nr 239
-Ion_Type1_161	3.615744857	8.571428571	18.151425143	0 # molecule nr 240
-Ion_Type1_162	3.615744857	8.571428571	17.142857143	0 # molecule nr 241
-Ion_Type3_78	2.857142857	11.428571429	0.504284000	0 # molecule nr 242
-Ion_Type1_163	3.615744857	11.428571429	1.008568000	0 # molecule nr 243
-Ion_Type1_164	3.615744857	11.428571429	0.000000000	0 # molecule nr 244
-Ion_Type3_79	2.857142857	11.428571429	3.361426857	0 # molecule nr 245
-Ion_Type1_165	3.615744857	11.428571429	3.865710857	0 # molecule nr 246
-Ion_Type1_166	3.615744857	11.428571429	2.857142857	0 # molecule nr 247
-Ion_Type3_80	2.857142857	11.428571429	6.218569714	0 # molecule nr 248
-Ion_Type1_167	3.615744857	11.428571429	6.722853714	0 # molecule nr 249
-Ion_Type1_168	3.615744857	11.428571429	5.714285714	0 # molecule nr 250
-Ion_Type3_81	2.857142857	11.428571429	9.075712571	0 # molecule nr 251
-Ion_Type1_169	3.615744857	11.428571429	9.579996571	0 # molecule nr 252
-Ion_Type1_170	3.615744857	11.428571429	8.571428571	0 # molecule nr 253
-Ion_Type3_82	2.857142857	11.428571429	11.932855429	0 # molecule nr 254
-Ion_Type1_171	3.615744857	11.428571429	12.437139429	0 # molecule nr 255
-Ion_Type1_172	3.615744857	11.428571429	11.428571429	0 # molecule nr 256
-Ion_Type3_83	2.857142857	11.428571429	14.789998286	0 # molecule nr 257
-Ion_Type1_173	3.615744857	11.428571429	15.294282286	0 # molecule nr 258
-Ion_Type1_174	3.615744857	11.428571429	14.285714286	0 # molecule nr 259
-Ion_Type3_84	2.857142857	11.428571429	17.647141143	0 # molecule nr 260
-Ion_Type1_175	3.615744857	11.428571429	18.151425143	0 # molecule nr 261
-Ion_Type1_176	3.615744857	11.428571429	17.142857143	0 # molecule nr 262
-Ion_Type3_85	2.857142857	14.285714286	0.504284000	0 # molecule nr 263
-Ion_Type1_177	3.615744857	14.285714286	1.008568000	0 # molecule nr 264
-Ion_Type1_178	3.615744857	14.285714286	0.000000000	0 # molecule nr 265
-Ion_Type3_86	2.857142857	14.285714286	3.361426857	0 # molecule nr 266
-Ion_Type1_179	3.615744857	14.285714286	3.865710857	0 # molecule nr 267
-Ion_Type1_180	3.615744857	14.285714286	2.857142857	0 # molecule nr 268
-Ion_Type3_87	2.857142857	14.285714286	6.218569714	0 # molecule nr 269
-Ion_Type1_181	3.615744857	14.285714286	6.722853714	0 # molecule nr 270
-Ion_Type1_182	3.615744857	14.285714286	5.714285714	0 # molecule nr 271
-Ion_Type3_88	2.857142857	14.285714286	9.075712571	0 # molecule nr 272
-Ion_Type1_183	3.615744857	14.285714286	9.579996571	0 # molecule nr 273
-Ion_Type1_184	3.615744857	14.285714286	8.571428571	0 # molecule nr 274
-Ion_Type3_89	2.857142857	14.285714286	11.932855429	0 # molecule nr 275
-Ion_Type1_185	3.615744857	14.285714286	12.437139429	0 # molecule nr 276
-Ion_Type1_186	3.615744857	14.285714286	11.428571429	0 # molecule nr 277
-Ion_Type3_90	2.857142857	14.285714286	14.789998286	0 # molecule nr 278
-Ion_Type1_187	3.615744857	14.285714286	15.294282286	0 # molecule nr 279
-Ion_Type1_188	3.615744857	14.285714286	14.285714286	0 # molecule nr 280
-Ion_Type3_91	2.857142857	14.285714286	17.647141143	0 # molecule nr 281
-Ion_Type1_189	3.615744857	14.285714286	18.151425143	0 # molecule nr 282
-Ion_Type1_190	3.615744857	14.285714286	17.142857143	0 # molecule nr 283
-Ion_Type3_92	2.857142857	17.142857143	0.504284000	0 # molecule nr 284
-Ion_Type1_191	3.615744857	17.142857143	1.008568000	0 # molecule nr 285
-Ion_Type1_192	3.615744857	17.142857143	0.000000000	0 # molecule nr 286
-Ion_Type3_93	2.857142857	17.142857143	3.361426857	0 # molecule nr 287
-Ion_Type1_193	3.615744857	17.142857143	3.865710857	0 # molecule nr 288
-Ion_Type1_194	3.615744857	17.142857143	2.857142857	0 # molecule nr 289
-Ion_Type3_94	2.857142857	17.142857143	6.218569714	0 # molecule nr 290
-Ion_Type1_195	3.615744857	17.142857143	6.722853714	0 # molecule nr 291
-Ion_Type1_196	3.615744857	17.142857143	5.714285714	0 # molecule nr 292
-Ion_Type3_95	2.857142857	17.142857143	9.075712571	0 # molecule nr 293
-Ion_Type1_197	3.615744857	17.142857143	9.579996571	0 # molecule nr 294
-Ion_Type1_198	3.615744857	17.142857143	8.571428571	0 # molecule nr 295
-Ion_Type3_96	2.857142857	17.142857143	11.932855429	0 # molecule nr 296
-Ion_Type1_199	3.615744857	17.142857143	12.437139429	0 # molecule nr 297
-Ion_Type1_200	3.615744857	17.142857143	11.428571429	0 # molecule nr 298
-Ion_Type3_97	2.857142857	17.142857143	14.789998286	0 # molecule nr 299
-Ion_Type1_201	3.615744857	17.142857143	15.294282286	0 # molecule nr 300
-Ion_Type1_202	3.615744857	17.142857143	14.285714286	0 # molecule nr 301
-Ion_Type3_98	2.857142857	17.142857143	17.647141143	0 # molecule nr 302
-Ion_Type1_203	3.615744857	17.142857143	18.151425143	0 # molecule nr 303
-Ion_Type1_204	3.615744857	17.142857143	17.142857143	0 # molecule nr 304
-Ion_Type3_99	5.714285714	0.000000000	0.504284000	0 # molecule nr 305
-Ion_Type1_205	6.472887714	0.000000000	1.008568000	0 # molecule nr 306
-Ion_Type1_206	6.472887714	0.000000000	0.000000000	0 # molecule nr 307
-Ion_Type3_100	5.714285714	0.000000000	3.361426857	0 # molecule nr 308
-Ion_Type1_207	6.472887714	0.000000000	3.865710857	0 # molecule nr 309
-Ion_Type1_208	6.472887714	0.000000000	2.857142857	0 # molecule nr 310
-Ion_Type3_101	5.714285714	0.000000000	6.218569714	0 # molecule nr 311
-Ion_Type1_209	6.472887714	0.000000000	6.722853714	0 # molecule nr 312
-Ion_Type1_210	6.472887714	0.000000000	5.714285714	0 # molecule nr 313
-Ion_Type3_102	5.714285714	0.000000000	9.075712571	0 # molecule nr 314
-Ion_Type1_211	6.472887714	0.000000000	9.579996571	0 # molecule nr 315
-Ion_Type1_212	6.472887714	0.000000000	8.571428571	0 # molecule nr 316
-Ion_Type3_103	5.714285714	0.000000000	11.932855429	0 # molecule nr 317
-Ion_Type1_213	6.472887714	0.000000000	12.437139429	0 # molecule nr 318
-Ion_Type1_214	6.472887714	0.000000000	11.428571429	0 # molecule nr 319
-Ion_Type3_104	5.714285714	0.000000000	14.789998286	0 # molecule nr 320
-Ion_Type1_215	6.472887714	0.000000000	15.294282286	0 # molecule nr 321
-Ion_Type1_216	6.472887714	0.000000000	14.285714286	0 # molecule nr 322
-Ion_Type3_105	5.714285714	0.000000000	17.647141143	0 # molecule nr 323
-Ion_Type1_217	6.472887714	0.000000000	18.151425143	0 # molecule nr 324
-Ion_Type1_218	6.472887714	0.000000000	17.142857143	0 # molecule nr 325
-Ion_Type3_106	5.714285714	2.857142857	0.504284000	0 # molecule nr 326
-Ion_Type1_219	6.472887714	2.857142857	0.000000000	0 # molecule nr 327
-Ion_Type3_107	5.714285714	2.857142857	6.218569714	0 # molecule nr 328
-Ion_Type1_220	6.472887714	2.857142857	6.722853714	0 # molecule nr 329
-Ion_Type3_108	5.714285714	2.857142857	9.075712571	0 # molecule nr 330
-Ion_Type1_221	6.472887714	2.857142857	9.579996571	0 # molecule nr 331
-Ion_Type1_222	6.472887714	2.857142857	8.571428571	0 # molecule nr 332
-Ion_Type3_109	5.714285714	2.857142857	11.932855429	0 # molecule nr 333
-Ion_Type1_223	6.472887714	2.857142857	12.437139429	0 # molecule nr 334
-Ion_Type1_224	6.472887714	2.857142857	11.428571429	0 # molecule nr 335
-Ion_Type3_110	5.714285714	2.857142857	14.789998286	0 # molecule nr 336
-Ion_Type1_225	6.472887714	2.857142857	15.294282286	0 # molecule nr 337
-Ion_Type1_226	6.472887714	2.857142857	14.285714286	0 # molecule nr 338
-Ion_Type3_111	5.714285714	2.857142857	17.647141143	0 # molecule nr 339
-Ion_Type1_227	6.472887714	2.857142857	18.151425143	0 # molecule nr 340
-Ion_Type1_228	6.472887714	2.857142857	17.142857143	0 # molecule nr 341
-Ion_Type3_112	5.714285714	5.714285714	0.504284000	0 # molecule nr 342
-Ion_Type1_229	6.472887714	5.714285714	1.008568000	0 # molecule nr 343
-Ion_Type1_230	6.472887714	5.714285714	0.000000000	0 # molecule nr 344
-Ion_Type3_113	5.714285714	5.714285714	6.218569714	0 # molecule nr 345
-Ion_Type1_231	6.472887714	5.714285714	6.722853714	0 # molecule nr 346
-Ion_Type1_232	6.472887714	5.714285714	5.714285714	0 # molecule nr 347
-Ion_Type3_114	5.714285714	5.714285714	9.075712571	0 # molecule nr 348
-Ion_Type1_233	6.472887714	5.714285714	9.579996571	0 # molecule nr 349
-Ion_Type1_234	6.472887714	5.714285714	8.571428571	0 # molecule nr 350
-Ion_Type3_115	5.714285714	5.714285714	11.932855429	0 # molecule nr 351
-Ion_Type1_235	6.472887714	5.714285714	12.437139429	0 # molecule nr 352
-Ion_Type1_236	6.472887714	5.714285714	11.428571429	0 # molecule nr 353
-Ion_Type3_116	5.714285714	5.714285714	14.789998286	0 # molecule nr 354
-Ion_Type1_237	6.472887714	5.714285714	15.294282286	0 # molecule nr 355
-Ion_Type1_238	6.472887714	5.714285714	14.285714286	0 # molecule nr 356
-Ion_Type3_117	5.714285714	5.714285714	17.647141143	0 # molecule nr 357
-Ion_Type1_239	6.472887714	5.714285714	18.151425143	0 # molecule nr 358
-Ion_Type1_240	6.472887714	5.714285714	17.142857143	0 # molecule nr 359
-Ion_Type3_118	5.714285714	8.571428571	0.504284000	0 # molecule nr 360
-Ion_Type1_241	6.472887714	8.571428571	1.008568000	0 # molecule nr 361
-Ion_Type1_242	6.472887714	8.571428571	0.000000000	0 # molecule nr 362
-Ion_Type3_119	5.714285714	8.571428571	3.361426857	0 # molecule nr 363
-Ion_Type1_243	6.472887714	8.571428571	3.865710857	0 # molecule nr 364
-Ion_Type1_244	6.472887714	8.571428571	2.857142857	0 # molecule nr 365
-Ion_Type3_120	5.714285714	8.571428571	6.218569714	0 # molecule nr 366
-Ion_Type1_245	6.472887714	8.571428571	6.722853714	0 # molecule nr 367
-Ion_Type1_246	6.472887714	8.571428571	5.714285714	0 # molecule nr 368
-Ion_Type3_121	5.714285714	8.571428571	9.075712571	0 # molecule nr 369
-Ion_Type1_247	6.472887714	8.571428571	9.579996571	0 # molecule nr 370
-Ion_Type1_248	6.472887714	8.571428571	8.571428571	0 # molecule nr 371
-Ion_Type3_122	5.714285714	8.571428571	11.932855429	0 # molecule nr 372
-Ion_Type1_249	6.472887714	8.571428571	12.437139429	0 # molecule nr 373
-Ion_Type1_250	6.472887714	8.571428571	11.428571429	0 # molecule nr 374
-Ion_Type3_123	5.714285714	8.571428571	14.789998286	0 # molecule nr 375
-Ion_Type1_251	6.472887714	8.571428571	15.294282286	0 # molecule nr 376
-Ion_Type1_252	6.472887714	8.571428571	14.285714286	0 # molecule nr 377
-Ion_Type3_124	5.714285714	8.571428571	17.647141143	0 # molecule nr 378
-Ion_Type1_253	6.472887714	8.571428571	18.151425143	0 # molecule nr 379
-Ion_Type1_254	6.472887714	8.571428571	17.142857143	0 # molecule nr 380
-Ion_Type3_125	5.714285714	11.428571429	0.504284000	0 # molecule nr 381
-Ion_Type1_255	6.472887714	11.428571429	1.008568000	0 # molecule nr 382
-Ion_Type1_256	6.472887714	11.428571429	0.000000000	0 # molecule nr 383
-Ion_Type3_126	5.714285714	11.428571429	3.361426857	0 # molecule nr 384
-Ion_Type1_257	6.472887714	11.428571429	3.865710857	0 # molecule nr 385
-Ion_Type1_258	6.472887714	11.428571429	2.857142857	0 # molecule nr 386
-Ion_Type3_127	5.714285714	11.428571429	6.218569714	0 # molecule nr 387
-Ion_Type1_259	6.472887714	11.428571429	6.722853714	0 # molecule nr 388
-Ion_Type1_260	6.472887714	11.428571429	5.714285714	0 # molecule nr 389
-Ion_Type3_128	5.714285714	11.428571429	9.075712571	0 # molecule nr 390
-Ion_Type1_261	6.472887714	11.428571429	9.579996571	0 # molecule nr 391
-Ion_Type1_262	6.472887714	11.428571429	8.571428571	0 # molecule nr 392
-Ion_Type3_129	5.714285714	11.428571429	11.932855429	0 # molecule nr 393
-Ion_Type1_263	6.472887714	11.428571429	12.437139429	0 # molecule nr 394
-Ion_Type1_264	6.472887714	11.428571429	11.428571429	0 # molecule nr 395
-Ion_Type3_130	5.714285714	11.428571429	14.789998286	0 # molecule nr 396
-Ion_Type1_265	6.472887714	11.428571429	15.294282286	0 # molecule nr 397
-Ion_Type1_266	6.472887714	11.428571429	14.285714286	0 # molecule nr 398
-Ion_Type3_131	5.714285714	11.428571429	17.647141143	0 # molecule nr 399
-Ion_Type1_267	6.472887714	11.428571429	18.151425143	0 # molecule nr 400
-Ion_Type1_268	6.472887714	11.428571429	17.142857143	0 # molecule nr 401
-Ion_Type3_132	5.714285714	14.285714286	0.504284000	0 # molecule nr 402
-Ion_Type1_269	6.472887714	14.285714286	1.008568000	0 # molecule nr 403
-Ion_Type1_270	6.472887714	14.285714286	0.000000000	0 # molecule nr 404
-Ion_Type3_133	5.714285714	14.285714286	3.361426857	0 # molecule nr 405
-Ion_Type1_271	6.472887714	14.285714286	3.865710857	0 # molecule nr 406
-Ion_Type1_272	6.472887714	14.285714286	2.857142857	0 # molecule nr 407
-Ion_Type3_134	5.714285714	14.285714286	6.218569714	0 # molecule nr 408
-Ion_Type1_273	6.472887714	14.285714286	6.722853714	0 # molecule nr 409
-Ion_Type1_274	6.472887714	14.285714286	5.714285714	0 # molecule nr 410
-Ion_Type3_135	5.714285714	14.285714286	9.075712571	0 # molecule nr 411
-Ion_Type1_275	6.472887714	14.285714286	9.579996571	0 # molecule nr 412
-Ion_Type1_276	6.472887714	14.285714286	8.571428571	0 # molecule nr 413
-Ion_Type3_136	5.714285714	14.285714286	11.932855429	0 # molecule nr 414
-Ion_Type1_277	6.472887714	14.285714286	12.437139429	0 # molecule nr 415
-Ion_Type1_278	6.472887714	14.285714286	11.428571429	0 # molecule nr 416
-Ion_Type3_137	5.714285714	14.285714286	14.789998286	0 # molecule nr 417
-Ion_Type1_279	6.472887714	14.285714286	15.294282286	0 # molecule nr 418
-Ion_Type1_280	6.472887714	14.285714286	14.285714286	0 # molecule nr 419
-Ion_Type3_138	5.714285714	14.285714286	17.647141143	0 # molecule nr 420
-Ion_Type1_281	6.472887714	14.285714286	18.151425143	0 # molecule nr 421
-Ion_Type1_282	6.472887714	14.285714286	17.142857143	0 # molecule nr 422
-Ion_Type3_139	5.714285714	17.142857143	0.504284000	0 # molecule nr 423
-Ion_Type1_283	6.472887714	17.142857143	1.008568000	0 # molecule nr 424
-Ion_Type1_284	6.472887714	17.142857143	0.000000000	0 # molecule nr 425
-Ion_Type3_140	5.714285714	17.142857143	3.361426857	0 # molecule nr 426
-Ion_Type1_285	6.472887714	17.142857143	3.865710857	0 # molecule nr 427
-Ion_Type1_286	6.472887714	17.142857143	2.857142857	0 # molecule nr 428
-Ion_Type3_141	5.714285714	17.142857143	6.218569714	0 # molecule nr 429
-Ion_Type1_287	6.472887714	17.142857143	6.722853714	0 # molecule nr 430
-Ion_Type1_288	6.472887714	17.142857143	5.714285714	0 # molecule nr 431
-Ion_Type3_142	5.714285714	17.142857143	9.075712571	0 # molecule nr 432
-Ion_Type1_289	6.472887714	17.142857143	9.579996571	0 # molecule nr 433
-Ion_Type1_290	6.472887714	17.142857143	8.571428571	0 # molecule nr 434
-Ion_Type3_143	5.714285714	17.142857143	11.932855429	0 # molecule nr 435
-Ion_Type1_291	6.472887714	17.142857143	12.437139429	0 # molecule nr 436
-Ion_Type1_292	6.472887714	17.142857143	11.428571429	0 # molecule nr 437
-Ion_Type3_144	5.714285714	17.142857143	14.789998286	0 # molecule nr 438
-Ion_Type1_293	6.472887714	17.142857143	15.294282286	0 # molecule nr 439
-Ion_Type1_294	6.472887714	17.142857143	14.285714286	0 # molecule nr 440
-Ion_Type3_145	5.714285714	17.142857143	17.647141143	0 # molecule nr 441
-Ion_Type1_295	6.472887714	17.142857143	18.151425143	0 # molecule nr 442
-Ion_Type1_296	6.472887714	17.142857143	17.142857143	0 # molecule nr 443
-Ion_Type3_146	8.571428571	0.000000000	0.504284000	0 # molecule nr 444
-Ion_Type1_297	9.330030571	0.000000000	1.008568000	0 # molecule nr 445
-Ion_Type1_298	9.330030571	0.000000000	0.000000000	0 # molecule nr 446
-Ion_Type3_147	8.571428571	0.000000000	3.361426857	0 # molecule nr 447
-Ion_Type1_299	9.330030571	0.000000000	3.865710857	0 # molecule nr 448
-Ion_Type1_300	9.330030571	0.000000000	2.857142857	0 # molecule nr 449
-Ion_Type3_148	8.571428571	0.000000000	6.218569714	0 # molecule nr 450
-Ion_Type1_301	9.330030571	0.000000000	6.722853714	0 # molecule nr 451
-Ion_Type1_302	9.330030571	0.000000000	5.714285714	0 # molecule nr 452
-Ion_Type3_149	8.571428571	0.000000000	9.075712571	0 # molecule nr 453
-Ion_Type1_303	9.330030571	0.000000000	9.579996571	0 # molecule nr 454
-Ion_Type1_304	9.330030571	0.000000000	8.571428571	0 # molecule nr 455
-Ion_Type3_150	8.571428571	0.000000000	11.932855429	0 # molecule nr 456
-Ion_Type1_305	9.330030571	0.000000000	12.437139429	0 # molecule nr 457
-Ion_Type1_306	9.330030571	0.000000000	11.428571429	0 # molecule nr 458
-Ion_Type3_151	8.571428571	0.000000000	14.789998286	0 # molecule nr 459
-Ion_Type1_307	9.330030571	0.000000000	15.294282286	0 # molecule nr 460
-Ion_Type1_308	9.330030571	0.000000000	14.285714286	0 # molecule nr 461
-Ion_Type3_152	8.571428571	0.000000000	17.647141143	0 # molecule nr 462
-Ion_Type1_309	9.330030571	0.000000000	18.151425143	0 # molecule nr 463
-Ion_Type1_310	9.330030571	0.000000000	17.142857143	0 # molecule nr 464
-Ion_Type3_153	8.571428571	2.857142857	0.504284000	0 # molecule nr 465
-Ion_Type1_311	9.330030571	2.857142857	0.000000000	0 # molecule nr 466
-Ion_Type1_312	9.330030571	2.857142857	6.722853714	0 # molecule nr 467
-Ion_Type3_154	8.571428571	2.857142857	9.075712571	0 # molecule nr 468
-Ion_Type1_313	9.330030571	2.857142857	9.579996571	0 # molecule nr 469
-Ion_Type1_314	9.330030571	2.857142857	8.571428571	0 # molecule nr 470
-Ion_Type3_155	8.571428571	2.857142857	11.932855429	0 # molecule nr 471
-Ion_Type1_315	9.330030571	2.857142857	12.437139429	0 # molecule nr 472
-Ion_Type1_316	9.330030571	2.857142857	11.428571429	0 # molecule nr 473
-Ion_Type3_156	8.571428571	2.857142857	14.789998286	0 # molecule nr 474
-Ion_Type1_317	9.330030571	2.857142857	15.294282286	0 # molecule nr 475
-Ion_Type1_318	9.330030571	2.857142857	14.285714286	0 # molecule nr 476
-Ion_Type3_157	8.571428571	2.857142857	17.647141143	0 # molecule nr 477
-Ion_Type1_319	9.330030571	2.857142857	18.151425143	0 # molecule nr 478
-Ion_Type1_320	9.330030571	2.857142857	17.142857143	0 # molecule nr 479
-Ion_Type3_158	8.571428571	5.714285714	0.504284000	0 # molecule nr 480
-Ion_Type1_321	9.330030571	5.714285714	0.000000000	0 # molecule nr 481
-Ion_Type1_322	9.330030571	5.714285714	6.722853714	0 # molecule nr 482
-Ion_Type3_159	8.571428571	5.714285714	9.075712571	0 # molecule nr 483
-Ion_Type1_323	9.330030571	5.714285714	9.579996571	0 # molecule nr 484
-Ion_Type1_324	9.330030571	5.714285714	8.571428571	0 # molecule nr 485
-Ion_Type3_160	8.571428571	5.714285714	11.932855429	0 # molecule nr 486
-Ion_Type1_325	9.330030571	5.714285714	12.437139429	0 # molecule nr 487
-Ion_Type1_326	9.330030571	5.714285714	11.428571429	0 # molecule nr 488
-Ion_Type3_161	8.571428571	5.714285714	14.789998286	0 # molecule nr 489
-Ion_Type1_327	9.330030571	5.714285714	15.294282286	0 # molecule nr 490
-Ion_Type1_328	9.330030571	5.714285714	14.285714286	0 # molecule nr 491
-Ion_Type3_162	8.571428571	5.714285714	17.647141143	0 # molecule nr 492
-Ion_Type1_329	9.330030571	5.714285714	18.151425143	0 # molecule nr 493
-Ion_Type1_330	9.330030571	5.714285714	17.142857143	0 # molecule nr 494
-Ion_Type3_163	8.571428571	8.571428571	0.504284000	0 # molecule nr 495
-Ion_Type1_331	9.330030571	8.571428571	1.008568000	0 # molecule nr 496
-Ion_Type1_332	9.330030571	8.571428571	0.000000000	0 # molecule nr 497
-Ion_Type3_164	8.571428571	8.571428571	3.361426857	0 # molecule nr 498
-Ion_Type1_333	9.330030571	8.571428571	3.865710857	0 # molecule nr 499
-Ion_Type1_334	9.330030571	8.571428571	2.857142857	0 # molecule nr 500
-Ion_Type3_165	8.571428571	8.571428571	6.218569714	0 # molecule nr 501
-Ion_Type1_335	9.330030571	8.571428571	6.722853714	0 # molecule nr 502
-Ion_Type1_336	9.330030571	8.571428571	5.714285714	0 # molecule nr 503
-Ion_Type3_166	8.571428571	8.571428571	9.075712571	0 # molecule nr 504
-Ion_Type1_337	9.330030571	8.571428571	9.579996571	0 # molecule nr 505
-Ion_Type1_338	9.330030571	8.571428571	8.571428571	0 # molecule nr 506
-Ion_Type3_167	8.571428571	8.571428571	11.932855429	0 # molecule nr 507
-Ion_Type1_339	9.330030571	8.571428571	12.437139429	0 # molecule nr 508
-Ion_Type1_340	9.330030571	8.571428571	11.428571429	0 # molecule nr 509
-Ion_Type3_168	8.571428571	8.571428571	14.789998286	0 # molecule nr 510
-Ion_Type1_341	9.330030571	8.571428571	15.294282286	0 # molecule nr 511
-Ion_Type1_342	9.330030571	8.571428571	14.285714286	0 # molecule nr 512
-Ion_Type3_169	8.571428571	8.571428571	17.647141143	0 # molecule nr 513
-Ion_Type1_343	9.330030571	8.571428571	18.151425143	0 # molecule nr 514
-Ion_Type1_344	9.330030571	8.571428571	17.142857143	0 # molecule nr 515
-Ion_Type3_170	8.571428571	11.428571429	0.504284000	0 # molecule nr 516
-Ion_Type1_345	9.330030571	11.428571429	1.008568000	0 # molecule nr 517
-Ion_Type1_346	9.330030571	11.428571429	0.000000000	0 # molecule nr 518
-Ion_Type3_171	8.571428571	11.428571429	3.361426857	0 # molecule nr 519
-Ion_Type1_347	9.330030571	11.428571429	3.865710857	0 # molecule nr 520
-Ion_Type1_348	9.330030571	11.428571429	2.857142857	0 # molecule nr 521
-Ion_Type3_172	8.571428571	11.428571429	6.218569714	0 # molecule nr 522
-Ion_Type1_349	9.330030571	11.428571429	6.722853714	0 # molecule nr 523
-Ion_Type1_350	9.330030571	11.428571429	5.714285714	0 # molecule nr 524
-Ion_Type3_173	8.571428571	11.428571429	9.075712571	0 # molecule nr 525
-Ion_Type1_351	9.330030571	11.428571429	9.579996571	0 # molecule nr 526
-Ion_Type1_352	9.330030571	11.428571429	8.571428571	0 # molecule nr 527
-Ion_Type3_174	8.571428571	11.428571429	11.932855429	0 # molecule nr 528
-Ion_Type1_353	9.330030571	11.428571429	12.437139429	0 # molecule nr 529
-Ion_Type1_354	9.330030571	11.428571429	11.428571429	0 # molecule nr 530
-Ion_Type3_175	8.571428571	11.428571429	14.789998286	0 # molecule nr 531
-Ion_Type1_355	9.330030571	11.428571429	15.294282286	0 # molecule nr 532
-Ion_Type1_356	9.330030571	11.428571429	14.285714286	0 # molecule nr 533
-Ion_Type3_176	8.571428571	11.428571429	17.647141143	0 # molecule nr 534
-Ion_Type1_357	9.330030571	11.428571429	18.151425143	0 # molecule nr 535
-Ion_Type1_358	9.330030571	11.428571429	17.142857143	0 # molecule nr 536
-Ion_Type3_177	8.571428571	14.285714286	0.504284000	0 # molecule nr 537
-Ion_Type1_359	9.330030571	14.285714286	1.008568000	0 # molecule nr 538
-Ion_Type1_360	9.330030571	14.285714286	0.000000000	0 # molecule nr 539
-Ion_Type3_178	8.571428571	14.285714286	3.361426857	0 # molecule nr 540
-Ion_Type1_361	9.330030571	14.285714286	3.865710857	0 # molecule nr 541
-Ion_Type1_362	9.330030571	14.285714286	2.857142857	0 # molecule nr 542
-Ion_Type3_179	8.571428571	14.285714286	6.218569714	0 # molecule nr 543
-Ion_Type1_363	9.330030571	14.285714286	6.722853714	0 # molecule nr 544
-Ion_Type1_364	9.330030571	14.285714286	5.714285714	0 # molecule nr 545
-Ion_Type3_180	8.571428571	14.285714286	9.075712571	0 # molecule nr 546
-Ion_Type1_365	9.330030571	14.285714286	9.579996571	0 # molecule nr 547
-Ion_Type1_366	9.330030571	14.285714286	8.571428571	0 # molecule nr 548
-Ion_Type3_181	8.571428571	14.285714286	11.932855429	0 # molecule nr 549
-Ion_Type1_367	9.330030571	14.285714286	12.437139429	0 # molecule nr 550
-Ion_Type1_368	9.330030571	14.285714286	11.428571429	0 # molecule nr 551
-Ion_Type3_182	8.571428571	14.285714286	14.789998286	0 # molecule nr 552
-Ion_Type1_369	9.330030571	14.285714286	15.294282286	0 # molecule nr 553
-Ion_Type1_370	9.330030571	14.285714286	14.285714286	0 # molecule nr 554
-Ion_Type3_183	8.571428571	14.285714286	17.647141143	0 # molecule nr 555
-Ion_Type1_371	9.330030571	14.285714286	18.151425143	0 # molecule nr 556
-Ion_Type1_372	9.330030571	14.285714286	17.142857143	0 # molecule nr 557
-Ion_Type3_184	8.571428571	17.142857143	0.504284000	0 # molecule nr 558
-Ion_Type1_373	9.330030571	17.142857143	1.008568000	0 # molecule nr 559
-Ion_Type1_374	9.330030571	17.142857143	0.000000000	0 # molecule nr 560
-Ion_Type3_185	8.571428571	17.142857143	3.361426857	0 # molecule nr 561
-Ion_Type1_375	9.330030571	17.142857143	3.865710857	0 # molecule nr 562
-Ion_Type1_376	9.330030571	17.142857143	2.857142857	0 # molecule nr 563
-Ion_Type3_186	8.571428571	17.142857143	6.218569714	0 # molecule nr 564
-Ion_Type1_377	9.330030571	17.142857143	6.722853714	0 # molecule nr 565
-Ion_Type1_378	9.330030571	17.142857143	5.714285714	0 # molecule nr 566
-Ion_Type3_187	8.571428571	17.142857143	9.075712571	0 # molecule nr 567
-Ion_Type1_379	9.330030571	17.142857143	9.579996571	0 # molecule nr 568
-Ion_Type1_380	9.330030571	17.142857143	8.571428571	0 # molecule nr 569
-Ion_Type3_188	8.571428571	17.142857143	11.932855429	0 # molecule nr 570
-Ion_Type1_381	9.330030571	17.142857143	12.437139429	0 # molecule nr 571
-Ion_Type1_382	9.330030571	17.142857143	11.428571429	0 # molecule nr 572
-Ion_Type3_189	8.571428571	17.142857143	14.789998286	0 # molecule nr 573
-Ion_Type1_383	9.330030571	17.142857143	15.294282286	0 # molecule nr 574
-Ion_Type1_384	9.330030571	17.142857143	14.285714286	0 # molecule nr 575
-Ion_Type3_190	8.571428571	17.142857143	17.647141143	0 # molecule nr 576
-Ion_Type1_385	9.330030571	17.142857143	18.151425143	0 # molecule nr 577
-Ion_Type1_386	9.330030571	17.142857143	17.142857143	0 # molecule nr 578
-Ion_Type3_191	11.428571429	0.000000000	0.504284000	0 # molecule nr 579
-Ion_Type1_387	12.187173429	0.000000000	1.008568000	0 # molecule nr 580
-Ion_Type1_388	12.187173429	0.000000000	0.000000000	0 # molecule nr 581
-Ion_Type3_192	11.428571429	0.000000000	3.361426857	0 # molecule nr 582
-Ion_Type1_389	12.187173429	0.000000000	3.865710857	0 # molecule nr 583
-Ion_Type1_390	12.187173429	0.000000000	2.857142857	0 # molecule nr 584
-Ion_Type3_193	11.428571429	0.000000000	6.218569714	0 # molecule nr 585
-Ion_Type1_391	12.187173429	0.000000000	6.722853714	0 # molecule nr 586
-Ion_Type1_392	12.187173429	0.000000000	5.714285714	0 # molecule nr 587
-Ion_Type3_194	11.428571429	0.000000000	9.075712571	0 # molecule nr 588
-Ion_Type1_393	12.187173429	0.000000000	9.579996571	0 # molecule nr 589
-Ion_Type1_394	12.187173429	0.000000000	8.571428571	0 # molecule nr 590
-Ion_Type3_195	11.428571429	0.000000000	11.932855429	0 # molecule nr 591
-Ion_Type1_395	12.187173429	0.000000000	12.437139429	0 # molecule nr 592
-Ion_Type1_396	12.187173429	0.000000000	11.428571429	0 # molecule nr 593
-Ion_Type3_196	11.428571429	0.000000000	14.789998286	0 # molecule nr 594
-Ion_Type1_397	12.187173429	0.000000000	15.294282286	0 # molecule nr 595
-Ion_Type1_398	12.187173429	0.000000000	14.285714286	0 # molecule nr 596
-Ion_Type3_197	11.428571429	0.000000000	17.647141143	0 # molecule nr 597
-Ion_Type1_399	12.187173429	0.000000000	18.151425143	0 # molecule nr 598
-Ion_Type1_400	12.187173429	0.000000000	17.142857143	0 # molecule nr 599
-Ion_Type3_198	11.428571429	2.857142857	0.504284000	0 # molecule nr 600
-Ion_Type1_401	12.187173429	2.857142857	1.008568000	0 # molecule nr 601
-Ion_Type1_402	12.187173429	2.857142857	0.000000000	0 # molecule nr 602
-Ion_Type3_199	11.428571429	2.857142857	6.218569714	0 # molecule nr 603
-Ion_Type1_403	12.187173429	2.857142857	6.722853714	0 # molecule nr 604
-Ion_Type1_404	12.187173429	2.857142857	5.714285714	0 # molecule nr 605
-Ion_Type3_200	11.428571429	2.857142857	9.075712571	0 # molecule nr 606
-Ion_Type1_405	12.187173429	2.857142857	9.579996571	0 # molecule nr 607
-Ion_Type1_406	12.187173429	2.857142857	8.571428571	0 # molecule nr 608
-Ion_Type3_201	11.428571429	2.857142857	11.932855429	0 # molecule nr 609
-Ion_Type1_407	12.187173429	2.857142857	12.437139429	0 # molecule nr 610
-Ion_Type1_408	12.187173429	2.857142857	11.428571429	0 # molecule nr 611
-Ion_Type3_202	11.428571429	2.857142857	14.789998286	0 # molecule nr 612
-Ion_Type1_409	12.187173429	2.857142857	15.294282286	0 # molecule nr 613
-Ion_Type1_410	12.187173429	2.857142857	14.285714286	0 # molecule nr 614
-Ion_Type3_203	11.428571429	2.857142857	17.647141143	0 # molecule nr 615
-Ion_Type1_411	12.187173429	2.857142857	18.151425143	0 # molecule nr 616
-Ion_Type1_412	12.187173429	2.857142857	17.142857143	0 # molecule nr 617
-Ion_Type3_204	11.428571429	5.714285714	0.504284000	0 # molecule nr 618
-Ion_Type1_413	12.187173429	5.714285714	1.008568000	0 # molecule nr 619
-Ion_Type1_414	12.187173429	5.714285714	0.000000000	0 # molecule nr 620
-Ion_Type1_415	12.187173429	5.714285714	3.865710857	0 # molecule nr 621
-Ion_Type1_416	12.187173429	5.714285714	2.857142857	0 # molecule nr 622
-Ion_Type3_205	11.428571429	5.714285714	6.218569714	0 # molecule nr 623
-Ion_Type1_417	12.187173429	5.714285714	6.722853714	0 # molecule nr 624
-Ion_Type1_418	12.187173429	5.714285714	5.714285714	0 # molecule nr 625
-Ion_Type3_206	11.428571429	5.714285714	9.075712571	0 # molecule nr 626
-Ion_Type1_419	12.187173429	5.714285714	9.579996571	0 # molecule nr 627
-Ion_Type1_420	12.187173429	5.714285714	8.571428571	0 # molecule nr 628
-Ion_Type3_207	11.428571429	5.714285714	11.932855429	0 # molecule nr 629
-Ion_Type1_421	12.187173429	5.714285714	12.437139429	0 # molecule nr 630
-Ion_Type1_422	12.187173429	5.714285714	11.428571429	0 # molecule nr 631
-Ion_Type3_208	11.428571429	5.714285714	14.789998286	0 # molecule nr 632
-Ion_Type1_423	12.187173429	5.714285714	15.294282286	0 # molecule nr 633
-Ion_Type1_424	12.187173429	5.714285714	14.285714286	0 # molecule nr 634
-Ion_Type3_209	11.428571429	5.714285714	17.647141143	0 # molecule nr 635
-Ion_Type1_425	12.187173429	5.714285714	18.151425143	0 # molecule nr 636
-Ion_Type1_426	12.187173429	5.714285714	17.142857143	0 # molecule nr 637
-Ion_Type3_210	11.428571429	8.571428571	0.504284000	0 # molecule nr 638
-Ion_Type1_427	12.187173429	8.571428571	1.008568000	0 # molecule nr 639
-Ion_Type1_428	12.187173429	8.571428571	0.000000000	0 # molecule nr 640
-Ion_Type3_211	11.428571429	8.571428571	3.361426857	0 # molecule nr 641
-Ion_Type1_429	12.187173429	8.571428571	3.865710857	0 # molecule nr 642
-Ion_Type1_430	12.187173429	8.571428571	2.857142857	0 # molecule nr 643
-Ion_Type3_212	11.428571429	8.571428571	6.218569714	0 # molecule nr 644
-Ion_Type1_431	12.187173429	8.571428571	6.722853714	0 # molecule nr 645
-Ion_Type1_432	12.187173429	8.571428571	5.714285714	0 # molecule nr 646
-Ion_Type3_213	11.428571429	8.571428571	9.075712571	0 # molecule nr 647
-Ion_Type1_433	12.187173429	8.571428571	9.579996571	0 # molecule nr 648
-Ion_Type1_434	12.187173429	8.571428571	8.571428571	0 # molecule nr 649
-Ion_Type3_214	11.428571429	8.571428571	11.932855429	0 # molecule nr 650
-Ion_Type1_435	12.187173429	8.571428571	12.437139429	0 # molecule nr 651
-Ion_Type1_436	12.187173429	8.571428571	11.428571429	0 # molecule nr 652
-Ion_Type3_215	11.428571429	8.571428571	14.789998286	0 # molecule nr 653
-Ion_Type1_437	12.187173429	8.571428571	15.294282286	0 # molecule nr 654
-Ion_Type1_438	12.187173429	8.571428571	14.285714286	0 # molecule nr 655
-Ion_Type3_216	11.428571429	8.571428571	17.647141143	0 # molecule nr 656
-Ion_Type1_439	12.187173429	8.571428571	18.151425143	0 # molecule nr 657
-Ion_Type1_440	12.187173429	8.571428571	17.142857143	0 # molecule nr 658
-Ion_Type3_217	11.428571429	11.428571429	0.504284000	0 # molecule nr 659
-Ion_Type1_441	12.187173429	11.428571429	1.008568000	0 # molecule nr 660
-Ion_Type1_442	12.187173429	11.428571429	0.000000000	0 # molecule nr 661
-Ion_Type3_218	11.428571429	11.428571429	3.361426857	0 # molecule nr 662
-Ion_Type1_443	12.187173429	11.428571429	3.865710857	0 # molecule nr 663
-Ion_Type1_444	12.187173429	11.428571429	2.857142857	0 # molecule nr 664
-Ion_Type3_219	11.428571429	11.428571429	6.218569714	0 # molecule nr 665
-Ion_Type1_445	12.187173429	11.428571429	6.722853714	0 # molecule nr 666
-Ion_Type1_446	12.187173429	11.428571429	5.714285714	0 # molecule nr 667
-Ion_Type3_220	11.428571429	11.428571429	9.075712571	0 # molecule nr 668
-Ion_Type1_447	12.187173429	11.428571429	9.579996571	0 # molecule nr 669
-Ion_Type1_448	12.187173429	11.428571429	8.571428571	0 # molecule nr 670
-Ion_Type3_221	11.428571429	11.428571429	11.932855429	0 # molecule nr 671
-Ion_Type1_449	12.187173429	11.428571429	12.437139429	0 # molecule nr 672
-Ion_Type1_450	12.187173429	11.428571429	11.428571429	0 # molecule nr 673
-Ion_Type3_222	11.428571429	11.428571429	14.789998286	0 # molecule nr 674
-Ion_Type1_451	12.187173429	11.428571429	15.294282286	0 # molecule nr 675
-Ion_Type1_452	12.187173429	11.428571429	14.285714286	0 # molecule nr 676
-Ion_Type3_223	11.428571429	11.428571429	17.647141143	0 # molecule nr 677
-Ion_Type1_453	12.187173429	11.428571429	18.151425143	0 # molecule nr 678
-Ion_Type1_454	12.187173429	11.428571429	17.142857143	0 # molecule nr 679
-Ion_Type3_224	11.428571429	14.285714286	0.504284000	0 # molecule nr 680
-Ion_Type1_455	12.187173429	14.285714286	1.008568000	0 # molecule nr 681
-Ion_Type1_456	12.187173429	14.285714286	0.000000000	0 # molecule nr 682
-Ion_Type3_225	11.428571429	14.285714286	3.361426857	0 # molecule nr 683
-Ion_Type1_457	12.187173429	14.285714286	3.865710857	0 # molecule nr 684
-Ion_Type1_458	12.187173429	14.285714286	2.857142857	0 # molecule nr 685
-Ion_Type3_226	11.428571429	14.285714286	6.218569714	0 # molecule nr 686
-Ion_Type1_459	12.187173429	14.285714286	6.722853714	0 # molecule nr 687
-Ion_Type1_460	12.187173429	14.285714286	5.714285714	0 # molecule nr 688
-Ion_Type3_227	11.428571429	14.285714286	9.075712571	0 # molecule nr 689
-Ion_Type1_461	12.187173429	14.285714286	9.579996571	0 # molecule nr 690
-Ion_Type1_462	12.187173429	14.285714286	8.571428571	0 # molecule nr 691
-Ion_Type3_228	11.428571429	14.285714286	11.932855429	0 # molecule nr 692
-Ion_Type1_463	12.187173429	14.285714286	12.437139429	0 # molecule nr 693
-Ion_Type1_464	12.187173429	14.285714286	11.428571429	0 # molecule nr 694
-Ion_Type3_229	11.428571429	14.285714286	14.789998286	0 # molecule nr 695
-Ion_Type1_465	12.187173429	14.285714286	15.294282286	0 # molecule nr 696
-Ion_Type1_466	12.187173429	14.285714286	14.285714286	0 # molecule nr 697
-Ion_Type3_230	11.428571429	14.285714286	17.647141143	0 # molecule nr 698
-Ion_Type1_467	12.187173429	14.285714286	18.151425143	0 # molecule nr 699
-Ion_Type1_468	12.187173429	14.285714286	17.142857143	0 # molecule nr 700
-Ion_Type3_231	11.428571429	17.142857143	0.504284000	0 # molecule nr 701
-Ion_Type1_469	12.187173429	17.142857143	1.008568000	0 # molecule nr 702
-Ion_Type1_470	12.187173429	17.142857143	0.000000000	0 # molecule nr 703
-Ion_Type3_232	11.428571429	17.142857143	3.361426857	0 # molecule nr 704
-Ion_Type1_471	12.187173429	17.142857143	3.865710857	0 # molecule nr 705
-Ion_Type1_472	12.187173429	17.142857143	2.857142857	0 # molecule nr 706
-Ion_Type3_233	11.428571429	17.142857143	6.218569714	0 # molecule nr 707
-Ion_Type1_473	12.187173429	17.142857143	6.722853714	0 # molecule nr 708
-Ion_Type1_474	12.187173429	17.142857143	5.714285714	0 # molecule nr 709
-Ion_Type3_234	11.428571429	17.142857143	9.075712571	0 # molecule nr 710
-Ion_Type1_475	12.187173429	17.142857143	9.579996571	0 # molecule nr 711
-Ion_Type1_476	12.187173429	17.142857143	8.571428571	0 # molecule nr 712
-Ion_Type3_235	11.428571429	17.142857143	11.932855429	0 # molecule nr 713
-Ion_Type1_477	12.187173429	17.142857143	12.437139429	0 # molecule nr 714
-Ion_Type1_478	12.187173429	17.142857143	11.428571429	0 # molecule nr 715
-Ion_Type3_236	11.428571429	17.142857143	14.789998286	0 # molecule nr 716
-Ion_Type1_479	12.187173429	17.142857143	15.294282286	0 # molecule nr 717
-Ion_Type1_480	12.187173429	17.142857143	14.285714286	0 # molecule nr 718
-Ion_Type3_237	11.428571429	17.142857143	17.647141143	0 # molecule nr 719
-Ion_Type1_481	12.187173429	17.142857143	18.151425143	0 # molecule nr 720
-Ion_Type1_482	12.187173429	17.142857143	17.142857143	0 # molecule nr 721
-Ion_Type3_238	14.285714286	0.000000000	0.504284000	0 # molecule nr 722
-Ion_Type1_483	15.044316286	0.000000000	1.008568000	0 # molecule nr 723
-Ion_Type1_484	15.044316286	0.000000000	0.000000000	0 # molecule nr 724
-Ion_Type3_239	14.285714286	0.000000000	3.361426857	0 # molecule nr 725
-Ion_Type1_485	15.044316286	0.000000000	3.865710857	0 # molecule nr 726
-Ion_Type1_486	15.044316286	0.000000000	2.857142857	0 # molecule nr 727
-Ion_Type3_240	14.285714286	0.000000000	6.218569714	0 # molecule nr 728
-Ion_Type1_487	15.044316286	0.000000000	6.722853714	0 # molecule nr 729
-Ion_Type1_488	15.044316286	0.000000000	5.714285714	0 # molecule nr 730
-Ion_Type3_241	14.285714286	0.000000000	9.075712571	0 # molecule nr 731
-Ion_Type1_489	15.044316286	0.000000000	9.579996571	0 # molecule nr 732
-Ion_Type1_490	15.044316286	0.000000000	8.571428571	0 # molecule nr 733
-Ion_Type3_242	14.285714286	0.000000000	11.932855429	0 # molecule nr 734
-Ion_Type1_491	15.044316286	0.000000000	12.437139429	0 # molecule nr 735
-Ion_Type1_492	15.044316286	0.000000000	11.428571429	0 # molecule nr 736
-Ion_Type3_243	14.285714286	0.000000000	14.789998286	0 # molecule nr 737
-Ion_Type1_493	15.044316286	0.000000000	15.294282286	0 # molecule nr 738
-Ion_Type1_494	15.044316286	0.000000000	14.285714286	0 # molecule nr 739
-Ion_Type3_244	14.285714286	0.000000000	17.647141143	0 # molecule nr 740
-Ion_Type1_495	15.044316286	0.000000000	18.151425143	0 # molecule nr 741
-Ion_Type1_496	15.044316286	0.000000000	17.142857143	0 # molecule nr 742
-Ion_Type3_245	14.285714286	2.857142857	0.504284000	0 # molecule nr 743
-Ion_Type1_497	15.044316286	2.857142857	1.008568000	0 # molecule nr 744
-Ion_Type1_498	15.044316286	2.857142857	0.000000000	0 # molecule nr 745
-Ion_Type3_246	14.285714286	2.857142857	3.361426857	0 # molecule nr 746
-Ion_Type1_499	15.044316286	2.857142857	3.865710857	0 # molecule nr 747
-Ion_Type1_500	15.044316286	2.857142857	2.857142857	0 # molecule nr 748
-Ion_Type3_247	14.285714286	2.857142857	6.218569714	0 # molecule nr 749
-Ion_Type1_501	15.044316286	2.857142857	6.722853714	0 # molecule nr 750
-Ion_Type1_502	15.044316286	2.857142857	5.714285714	0 # molecule nr 751
-Ion_Type3_248	14.285714286	2.857142857	9.075712571	0 # molecule nr 752
-Ion_Type1_503	15.044316286	2.857142857	9.579996571	0 # molecule nr 753
-Ion_Type1_504	15.044316286	2.857142857	8.571428571	0 # molecule nr 754
-Ion_Type3_249	14.285714286	2.857142857	11.932855429	0 # molecule nr 755
-Ion_Type1_505	15.044316286	2.857142857	12.437139429	0 # molecule nr 756
-Ion_Type1_506	15.044316286	2.857142857	11.428571429	0 # molecule nr 757
-Ion_Type3_250	14.285714286	2.857142857	14.789998286	0 # molecule nr 758
-Ion_Type1_507	15.044316286	2.857142857	15.294282286	0 # molecule nr 759
-Ion_Type1_508	15.044316286	2.857142857	14.285714286	0 # molecule nr 760
-Ion_Type3_251	14.285714286	2.857142857	17.647141143	0 # molecule nr 761
-Ion_Type1_509	15.044316286	2.857142857	18.151425143	0 # molecule nr 762
-Ion_Type1_510	15.044316286	2.857142857	17.142857143	0 # molecule nr 763
-Ion_Type3_252	14.285714286	5.714285714	0.504284000	0 # molecule nr 764
-Ion_Type1_511	15.044316286	5.714285714	1.008568000	0 # molecule nr 765
-Ion_Type1_512	15.044316286	5.714285714	0.000000000	0 # molecule nr 766
-Ion_Type3_253	14.285714286	5.714285714	3.361426857	0 # molecule nr 767
-Ion_Type1_513	15.044316286	5.714285714	3.865710857	0 # molecule nr 768
-Ion_Type1_514	15.044316286	5.714285714	2.857142857	0 # molecule nr 769
-Ion_Type3_254	14.285714286	5.714285714	6.218569714	0 # molecule nr 770
-Ion_Type1_515	15.044316286	5.714285714	6.722853714	0 # molecule nr 771
-Ion_Type1_516	15.044316286	5.714285714	5.714285714	0 # molecule nr 772
-Ion_Type3_255	14.285714286	5.714285714	9.075712571	0 # molecule nr 773
-Ion_Type1_517	15.044316286	5.714285714	9.579996571	0 # molecule nr 774
-Ion_Type1_518	15.044316286	5.714285714	8.571428571	0 # molecule nr 775
-Ion_Type3_256	14.285714286	5.714285714	11.932855429	0 # molecule nr 776
-Ion_Type1_519	15.044316286	5.714285714	12.437139429	0 # molecule nr 777
-Ion_Type1_520	15.044316286	5.714285714	11.428571429	0 # molecule nr 778
-Ion_Type3_257	14.285714286	5.714285714	14.789998286	0 # molecule nr 779
-Ion_Type1_521	15.044316286	5.714285714	15.294282286	0 # molecule nr 780
-Ion_Type1_522	15.044316286	5.714285714	14.285714286	0 # molecule nr 781
-Ion_Type3_258	14.285714286	5.714285714	17.647141143	0 # molecule nr 782
-Ion_Type1_523	15.044316286	5.714285714	18.151425143	0 # molecule nr 783
-Ion_Type1_524	15.044316286	5.714285714	17.142857143	0 # molecule nr 784
-Ion_Type3_259	14.285714286	8.571428571	0.504284000	0 # molecule nr 785
-Ion_Type1_525	15.044316286	8.571428571	1.008568000	0 # molecule nr 786
-Ion_Type1_526	15.044316286	8.571428571	0.000000000	0 # molecule nr 787
-Ion_Type3_260	14.285714286	8.571428571	3.361426857	0 # molecule nr 788
-Ion_Type1_527	15.044316286	8.571428571	3.865710857	0 # molecule nr 789
-Ion_Type1_528	15.044316286	8.571428571	2.857142857	0 # molecule nr 790
-Ion_Type3_261	14.285714286	8.571428571	6.218569714	0 # molecule nr 791
-Ion_Type1_529	15.044316286	8.571428571	6.722853714	0 # molecule nr 792
-Ion_Type1_530	15.044316286	8.571428571	5.714285714	0 # molecule nr 793
-Ion_Type3_262	14.285714286	8.571428571	9.075712571	0 # molecule nr 794
-Ion_Type1_531	15.044316286	8.571428571	9.579996571	0 # molecule nr 795
-Ion_Type1_532	15.044316286	8.571428571	8.571428571	0 # molecule nr 796
-Ion_Type3_263	14.285714286	8.571428571	11.932855429	0 # molecule nr 797
-Ion_Type1_533	15.044316286	8.571428571	12.437139429	0 # molecule nr 798
-Ion_Type1_534	15.044316286	8.571428571	11.428571429	0 # molecule nr 799
-Ion_Type3_264	14.285714286	8.571428571	14.789998286	0 # molecule nr 800
-Ion_Type1_535	15.044316286	8.571428571	15.294282286	0 # molecule nr 801
-Ion_Type1_536	15.044316286	8.571428571	14.285714286	0 # molecule nr 802
-Ion_Type3_265	14.285714286	8.571428571	17.647141143	0 # molecule nr 803
-Ion_Type1_537	15.044316286	8.571428571	18.151425143	0 # molecule nr 804
-Ion_Type1_538	15.044316286	8.571428571	17.142857143	0 # molecule nr 805
-Ion_Type3_266	14.285714286	11.428571429	0.504284000	0 # molecule nr 806
-Ion_Type1_539	15.044316286	11.428571429	1.008568000	0 # molecule nr 807
-Ion_Type1_540	15.044316286	11.428571429	0.000000000	0 # molecule nr 808
-Ion_Type3_267	14.285714286	11.428571429	3.361426857	0 # molecule nr 809
-Ion_Type1_541	15.044316286	11.428571429	3.865710857	0 # molecule nr 810
-Ion_Type1_542	15.044316286	11.428571429	2.857142857	0 # molecule nr 811
-Ion_Type3_268	14.285714286	11.428571429	6.218569714	0 # molecule nr 812
-Ion_Type1_543	15.044316286	11.428571429	6.722853714	0 # molecule nr 813
-Ion_Type1_544	15.044316286	11.428571429	5.714285714	0 # molecule nr 814
-Ion_Type3_269	14.285714286	11.428571429	9.075712571	0 # molecule nr 815
-Ion_Type1_545	15.044316286	11.428571429	9.579996571	0 # molecule nr 816
-Ion_Type1_546	15.044316286	11.428571429	8.571428571	0 # molecule nr 817
-Ion_Type3_270	14.285714286	11.428571429	11.932855429	0 # molecule nr 818
-Ion_Type1_547	15.044316286	11.428571429	12.437139429	0 # molecule nr 819
-Ion_Type1_548	15.044316286	11.428571429	11.428571429	0 # molecule nr 820
-Ion_Type3_271	14.285714286	11.428571429	14.789998286	0 # molecule nr 821
-Ion_Type1_549	15.044316286	11.428571429	15.294282286	0 # molecule nr 822
-Ion_Type1_550	15.044316286	11.428571429	14.285714286	0 # molecule nr 823
-Ion_Type3_272	14.285714286	11.428571429	17.647141143	0 # molecule nr 824
-Ion_Type1_551	15.044316286	11.428571429	18.151425143	0 # molecule nr 825
-Ion_Type1_552	15.044316286	11.428571429	17.142857143	0 # molecule nr 826
-Ion_Type3_273	14.285714286	14.285714286	0.504284000	0 # molecule nr 827
-Ion_Type1_553	15.044316286	14.285714286	1.008568000	0 # molecule nr 828
-Ion_Type1_554	15.044316286	14.285714286	0.000000000	0 # molecule nr 829
-Ion_Type3_274	14.285714286	14.285714286	3.361426857	0 # molecule nr 830
-Ion_Type1_555	15.044316286	14.285714286	3.865710857	0 # molecule nr 831
-Ion_Type1_556	15.044316286	14.285714286	2.857142857	0 # molecule nr 832
-Ion_Type3_275	14.285714286	14.285714286	6.218569714	0 # molecule nr 833
-Ion_Type1_557	15.044316286	14.285714286	6.722853714	0 # molecule nr 834
-Ion_Type1_558	15.044316286	14.285714286	5.714285714	0 # molecule nr 835
-Ion_Type3_276	14.285714286	14.285714286	9.075712571	0 # molecule nr 836
-Ion_Type1_559	15.044316286	14.285714286	9.579996571	0 # molecule nr 837
-Ion_Type1_560	15.044316286	14.285714286	8.571428571	0 # molecule nr 838
-Ion_Type3_277	14.285714286	14.285714286	11.932855429	0 # molecule nr 839
-Ion_Type1_561	15.044316286	14.285714286	12.437139429	0 # molecule nr 840
-Ion_Type1_562	15.044316286	14.285714286	11.428571429	0 # molecule nr 841
-Ion_Type3_278	14.285714286	14.285714286	14.789998286	0 # molecule nr 842
-Ion_Type1_563	15.044316286	14.285714286	15.294282286	0 # molecule nr 843
-Ion_Type1_564	15.044316286	14.285714286	14.285714286	0 # molecule nr 844
-Ion_Type3_279	14.285714286	14.285714286	17.647141143	0 # molecule nr 845
-Ion_Type1_565	15.044316286	14.285714286	18.151425143	0 # molecule nr 846
-Ion_Type1_566	15.044316286	14.285714286	17.142857143	0 # molecule nr 847
-Ion_Type3_280	14.285714286	17.142857143	0.504284000	0 # molecule nr 848
-Ion_Type1_567	15.044316286	17.142857143	1.008568000	0 # molecule nr 849
-Ion_Type1_568	15.044316286	17.142857143	0.000000000	0 # molecule nr 850
-Ion_Type3_281	14.285714286	17.142857143	3.361426857	0 # molecule nr 851
-Ion_Type1_569	15.044316286	17.142857143	3.865710857	0 # molecule nr 852
-Ion_Type1_570	15.044316286	17.142857143	2.857142857	0 # molecule nr 853
-Ion_Type3_282	14.285714286	17.142857143	6.218569714	0 # molecule nr 854
-Ion_Type1_571	15.044316286	17.142857143	6.722853714	0 # molecule nr 855
-Ion_Type1_572	15.044316286	17.142857143	5.714285714	0 # molecule nr 856
-Ion_Type3_283	14.285714286	17.142857143	9.075712571	0 # molecule nr 857
-Ion_Type1_573	15.044316286	17.142857143	9.579996571	0 # molecule nr 858
-Ion_Type1_574	15.044316286	17.142857143	8.571428571	0 # molecule nr 859
-Ion_Type3_284	14.285714286	17.142857143	11.932855429	0 # molecule nr 860
-Ion_Type1_575	15.044316286	17.142857143	12.437139429	0 # molecule nr 861
-Ion_Type1_576	15.044316286	17.142857143	11.428571429	0 # molecule nr 862
-Ion_Type3_285	14.285714286	17.142857143	14.789998286	0 # molecule nr 863
-Ion_Type1_577	15.044316286	17.142857143	15.294282286	0 # molecule nr 864
-Ion_Type1_578	15.044316286	17.142857143	14.285714286	0 # molecule nr 865
-Ion_Type3_286	14.285714286	17.142857143	17.647141143	0 # molecule nr 866
-Ion_Type1_579	15.044316286	17.142857143	18.151425143	0 # molecule nr 867
-Ion_Type1_580	15.044316286	17.142857143	17.142857143	0 # molecule nr 868
-Ion_Type3_287	17.142857143	0.000000000	0.504284000	0 # molecule nr 869
-Ion_Type1_581	17.901459143	0.000000000	1.008568000	0 # molecule nr 870
-Ion_Type1_582	17.901459143	0.000000000	0.000000000	0 # molecule nr 871
-Ion_Type3_288	17.142857143	0.000000000	3.361426857	0 # molecule nr 872
-Ion_Type1_583	17.901459143	0.000000000	3.865710857	0 # molecule nr 873
-Ion_Type1_584	17.901459143	0.000000000	2.857142857	0 # molecule nr 874
-Ion_Type3_289	17.142857143	0.000000000	6.218569714	0 # molecule nr 875
-Ion_Type1_585	17.901459143	0.000000000	6.722853714	0 # molecule nr 876
-Ion_Type1_586	17.901459143	0.000000000	5.714285714	0 # molecule nr 877
-Ion_Type3_290	17.142857143	0.000000000	9.075712571	0 # molecule nr 878
-Ion_Type1_587	17.901459143	0.000000000	9.579996571	0 # molecule nr 879
-Ion_Type1_588	17.901459143	0.000000000	8.571428571	0 # molecule nr 880
-Ion_Type3_291	17.142857143	0.000000000	11.932855429	0 # molecule nr 881
-Ion_Type1_589	17.901459143	0.000000000	12.437139429	0 # molecule nr 882
-Ion_Type1_590	17.901459143	0.000000000	11.428571429	0 # molecule nr 883
-Ion_Type3_292	17.142857143	0.000000000	14.789998286	0 # molecule nr 884
-Ion_Type1_591	17.901459143	0.000000000	15.294282286	0 # molecule nr 885
-Ion_Type1_592	17.901459143	0.000000000	14.285714286	0 # molecule nr 886
-Ion_Type3_293	17.142857143	0.000000000	17.647141143	0 # molecule nr 887
-Ion_Type1_593	17.901459143	0.000000000	18.151425143	0 # molecule nr 888
-Ion_Type1_594	17.901459143	0.000000000	17.142857143	0 # molecule nr 889
-Ion_Type3_294	17.142857143	2.857142857	0.504284000	0 # molecule nr 890
-Ion_Type1_595	17.901459143	2.857142857	1.008568000	0 # molecule nr 891
-Ion_Type1_596	17.901459143	2.857142857	0.000000000	0 # molecule nr 892
-Ion_Type3_295	17.142857143	2.857142857	3.361426857	0 # molecule nr 893
-Ion_Type1_597	17.901459143	2.857142857	3.865710857	0 # molecule nr 894
-Ion_Type1_598	17.901459143	2.857142857	2.857142857	0 # molecule nr 895
-Ion_Type3_296	17.142857143	2.857142857	6.218569714	0 # molecule nr 896
-Ion_Type1_599	17.901459143	2.857142857	6.722853714	0 # molecule nr 897
-Ion_Type1_600	17.901459143	2.857142857	5.714285714	0 # molecule nr 898
-Ion_Type3_297	17.142857143	2.857142857	9.075712571	0 # molecule nr 899
-Ion_Type1_601	17.901459143	2.857142857	9.579996571	0 # molecule nr 900
-Ion_Type1_602	17.901459143	2.857142857	8.571428571	0 # molecule nr 901
-Ion_Type3_298	17.142857143	2.857142857	11.932855429	0 # molecule nr 902
-Ion_Type1_603	17.901459143	2.857142857	12.437139429	0 # molecule nr 903
-Ion_Type1_604	17.901459143	2.857142857	11.428571429	0 # molecule nr 904
-Ion_Type3_299	17.142857143	2.857142857	14.789998286	0 # molecule nr 905
-Ion_Type1_605	17.901459143	2.857142857	15.294282286	0 # molecule nr 906
-Ion_Type1_606	17.901459143	2.857142857	14.285714286	0 # molecule nr 907
-Ion_Type3_300	17.142857143	2.857142857	17.647141143	0 # molecule nr 908
-Ion_Type1_607	17.901459143	2.857142857	18.151425143	0 # molecule nr 909
-Ion_Type1_608	17.901459143	2.857142857	17.142857143	0 # molecule nr 910
-Ion_Type3_301	17.142857143	5.714285714	0.504284000	0 # molecule nr 911
-Ion_Type1_609	17.901459143	5.714285714	1.008568000	0 # molecule nr 912
-Ion_Type1_610	17.901459143	5.714285714	0.000000000	0 # molecule nr 913
-Ion_Type3_302	17.142857143	5.714285714	3.361426857	0 # molecule nr 914
-Ion_Type1_611	17.901459143	5.714285714	3.865710857	0 # molecule nr 915
-Ion_Type1_612	17.901459143	5.714285714	2.857142857	0 # molecule nr 916
-Ion_Type3_303	17.142857143	5.714285714	6.218569714	0 # molecule nr 917
-Ion_Type1_613	17.901459143	5.714285714	6.722853714	0 # molecule nr 918
-Ion_Type1_614	17.901459143	5.714285714	5.714285714	0 # molecule nr 919
-Ion_Type3_304	17.142857143	5.714285714	9.075712571	0 # molecule nr 920
-Ion_Type1_615	17.901459143	5.714285714	9.579996571	0 # molecule nr 921
-Ion_Type1_616	17.901459143	5.714285714	8.571428571	0 # molecule nr 922
-Ion_Type3_305	17.142857143	5.714285714	11.932855429	0 # molecule nr 923
-Ion_Type1_617	17.901459143	5.714285714	12.437139429	0 # molecule nr 924
-Ion_Type1_618	17.901459143	5.714285714	11.428571429	0 # molecule nr 925
-Ion_Type3_306	17.142857143	5.714285714	14.789998286	0 # molecule nr 926
-Ion_Type1_619	17.901459143	5.714285714	15.294282286	0 # molecule nr 927
-Ion_Type1_620	17.901459143	5.714285714	14.285714286	0 # molecule nr 928
-Ion_Type3_307	17.142857143	5.714285714	17.647141143	0 # molecule nr 929
-Ion_Type1_621	17.901459143	5.714285714	18.151425143	0 # molecule nr 930
-Ion_Type1_622	17.901459143	5.714285714	17.142857143	0 # molecule nr 931
-Ion_Type3_308	17.142857143	8.571428571	0.504284000	0 # molecule nr 932
-Ion_Type1_623	17.901459143	8.571428571	1.008568000	0 # molecule nr 933
-Ion_Type1_624	17.901459143	8.571428571	0.000000000	0 # molecule nr 934
-Ion_Type3_309	17.142857143	8.571428571	3.361426857	0 # molecule nr 935
-Ion_Type1_625	17.901459143	8.571428571	3.865710857	0 # molecule nr 936
-Ion_Type1_626	17.901459143	8.571428571	2.857142857	0 # molecule nr 937
-Ion_Type3_310	17.142857143	8.571428571	6.218569714	0 # molecule nr 938
-Ion_Type1_627	17.901459143	8.571428571	6.722853714	0 # molecule nr 939
-Ion_Type1_628	17.901459143	8.571428571	5.714285714	0 # molecule nr 940
-Ion_Type3_311	17.142857143	8.571428571	9.075712571	0 # molecule nr 941
-Ion_Type1_629	17.901459143	8.571428571	9.579996571	0 # molecule nr 942
-Ion_Type1_630	17.901459143	8.571428571	8.571428571	0 # molecule nr 943
-Ion_Type3_312	17.142857143	8.571428571	11.932855429	0 # molecule nr 944
-Ion_Type1_631	17.901459143	8.571428571	12.437139429	0 # molecule nr 945
-Ion_Type1_632	17.901459143	8.571428571	11.428571429	0 # molecule nr 946
-Ion_Type3_313	17.142857143	8.571428571	14.789998286	0 # molecule nr 947
-Ion_Type1_633	17.901459143	8.571428571	15.294282286	0 # molecule nr 948
-Ion_Type1_634	17.901459143	8.571428571	14.285714286	0 # molecule nr 949
-Ion_Type3_314	17.142857143	8.571428571	17.647141143	0 # molecule nr 950
-Ion_Type1_635	17.901459143	8.571428571	18.151425143	0 # molecule nr 951
-Ion_Type1_636	17.901459143	8.571428571	17.142857143	0 # molecule nr 952
-Ion_Type3_315	17.142857143	11.428571429	0.504284000	0 # molecule nr 953
-Ion_Type1_637	17.901459143	11.428571429	1.008568000	0 # molecule nr 954
-Ion_Type1_638	17.901459143	11.428571429	0.000000000	0 # molecule nr 955
-Ion_Type3_316	17.142857143	11.428571429	3.361426857	0 # molecule nr 956
-Ion_Type1_639	17.901459143	11.428571429	3.865710857	0 # molecule nr 957
-Ion_Type1_640	17.901459143	11.428571429	2.857142857	0 # molecule nr 958
-Ion_Type3_317	17.142857143	11.428571429	6.218569714	0 # molecule nr 959
-Ion_Type1_641	17.901459143	11.428571429	6.722853714	0 # molecule nr 960
-Ion_Type1_642	17.901459143	11.428571429	5.714285714	0 # molecule nr 961
-Ion_Type3_318	17.142857143	11.428571429	9.075712571	0 # molecule nr 962
-Ion_Type1_643	17.901459143	11.428571429	9.579996571	0 # molecule nr 963
-Ion_Type1_644	17.901459143	11.428571429	8.571428571	0 # molecule nr 964
-Ion_Type3_319	17.142857143	11.428571429	11.932855429	0 # molecule nr 965
-Ion_Type1_645	17.901459143	11.428571429	12.437139429	0 # molecule nr 966
-Ion_Type1_646	17.901459143	11.428571429	11.428571429	0 # molecule nr 967
-Ion_Type3_320	17.142857143	11.428571429	14.789998286	0 # molecule nr 968
-Ion_Type1_647	17.901459143	11.428571429	15.294282286	0 # molecule nr 969
-Ion_Type1_648	17.901459143	11.428571429	14.285714286	0 # molecule nr 970
-Ion_Type3_321	17.142857143	11.428571429	17.647141143	0 # molecule nr 971
-Ion_Type1_649	17.901459143	11.428571429	18.151425143	0 # molecule nr 972
-Ion_Type1_650	17.901459143	11.428571429	17.142857143	0 # molecule nr 973
-Ion_Type3_322	17.142857143	14.285714286	0.504284000	0 # molecule nr 974
-Ion_Type1_651	17.901459143	14.285714286	1.008568000	0 # molecule nr 975
-Ion_Type1_652	17.901459143	14.285714286	0.000000000	0 # molecule nr 976
-Ion_Type3_323	17.142857143	14.285714286	3.361426857	0 # molecule nr 977
-Ion_Type1_653	17.901459143	14.285714286	3.865710857	0 # molecule nr 978
-Ion_Type1_654	17.901459143	14.285714286	2.857142857	0 # molecule nr 979
-Ion_Type3_324	17.142857143	14.285714286	6.218569714	0 # molecule nr 980
-Ion_Type1_655	17.901459143	14.285714286	6.722853714	0 # molecule nr 981
-Ion_Type1_656	17.901459143	14.285714286	5.714285714	0 # molecule nr 982
-Ion_Type3_325	17.142857143	14.285714286	9.075712571	0 # molecule nr 983
-Ion_Type1_657	17.901459143	14.285714286	9.579996571	0 # molecule nr 984
-Ion_Type1_658	17.901459143	14.285714286	8.571428571	0 # molecule nr 985
-Ion_Type3_326	17.142857143	14.285714286	11.932855429	0 # molecule nr 986
-Ion_Type1_659	17.901459143	14.285714286	12.437139429	0 # molecule nr 987
-Ion_Type1_660	17.901459143	14.285714286	11.428571429	0 # molecule nr 988
-Ion_Type3_327	17.142857143	14.285714286	14.789998286	0 # molecule nr 989
-Ion_Type1_661	17.901459143	14.285714286	15.294282286	0 # molecule nr 990
-Ion_Type1_662	17.901459143	14.285714286	14.285714286	0 # molecule nr 991
-Ion_Type3_328	17.142857143	14.285714286	17.647141143	0 # molecule nr 992
-Ion_Type1_663	17.901459143	14.285714286	18.151425143	0 # molecule nr 993
-Ion_Type1_664	17.901459143	14.285714286	17.142857143	0 # molecule nr 994
-Ion_Type3_329	17.142857143	17.142857143	0.504284000	0 # molecule nr 995
-Ion_Type1_665	17.901459143	17.142857143	1.008568000	0 # molecule nr 996
-Ion_Type1_666	17.901459143	17.142857143	0.000000000	0 # molecule nr 997
-Ion_Type3_330	17.142857143	17.142857143	3.361426857	0 # molecule nr 998
-Ion_Type1_667	17.901459143	17.142857143	3.865710857	0 # molecule nr 999
-Ion_Type1_668	17.901459143	17.142857143	2.857142857	0 # molecule nr 1000
-Ion_Type3_331	17.142857143	17.142857143	6.218569714	0 # molecule nr 1001
-Ion_Type1_669	17.901459143	17.142857143	6.722853714	0 # molecule nr 1002
-Ion_Type1_670	17.901459143	17.142857143	5.714285714	0 # molecule nr 1003
-Ion_Type3_332	17.142857143	17.142857143	9.075712571	0 # molecule nr 1004
-Ion_Type1_671	17.901459143	17.142857143	9.579996571	0 # molecule nr 1005
-Ion_Type1_672	17.901459143	17.142857143	8.571428571	0 # molecule nr 1006
-Ion_Type3_333	17.142857143	17.142857143	11.932855429	0 # molecule nr 1007
-Ion_Type1_673	17.901459143	17.142857143	12.437139429	0 # molecule nr 1008
-Ion_Type1_674	17.901459143	17.142857143	11.428571429	0 # molecule nr 1009
-Ion_Type3_334	17.142857143	17.142857143	14.789998286	0 # molecule nr 1010
-Ion_Type1_675	17.901459143	17.142857143	15.294282286	0 # molecule nr 1011
-Ion_Type1_676	17.901459143	17.142857143	14.285714286	0 # molecule nr 1012
-Ion_Type3_335	17.142857143	17.142857143	17.647141143	0 # molecule nr 1013
-Ion_Type1_677	17.901459143	17.142857143	18.151425143	0 # molecule nr 1014
-Ion_Type1_678	17.901459143	17.142857143	17.142857143	0 # molecule nr 1015
Index: tests/regression/Simple_configuration/8/pre/test.xyz
===================================================================
--- tests/regression/Simple_configuration/8/pre/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Simple_configuration/8/pre/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,1018 @@
+1016
+	Created by molecuilder on Mon Aug  9 19:15:41 2010
+H	9.78209	2.64589	2.64589
+H	9.78209	2.64589	4.42589
+H	10.672	3.90454	3.53589
+H	8.53279	4.78789	2.64589
+H	8.53279	4.78789	4.42589
+H	6.39363	3.90454	3.53589
+H	7.28359	2.64589	2.64589
+H	7.28359	2.64589	4.42589
+H	0.758602	0	1.00857
+H	0.758602	0	0
+H	0.758602	0	3.86571
+H	0.758602	0	2.85714
+H	0.758602	0	6.72285
+H	0.758602	0	5.71429
+H	0.758602	0	9.58
+H	0.758602	0	8.57143
+H	0.758602	0	12.4371
+H	0.758602	0	11.4286
+H	0.758602	0	15.2943
+H	0.758602	0	14.2857
+H	0.758602	0	18.1514
+H	0.758602	0	17.1429
+H	0.758602	2.85714	1.00857
+H	0.758602	2.85714	0
+H	0.758602	2.85714	3.86571
+H	0.758602	2.85714	2.85714
+H	0.758602	2.85714	6.72285
+H	0.758602	2.85714	5.71429
+H	0.758602	2.85714	9.58
+H	0.758602	2.85714	8.57143
+H	0.758602	2.85714	12.4371
+H	0.758602	2.85714	11.4286
+H	0.758602	2.85714	15.2943
+H	0.758602	2.85714	14.2857
+H	0.758602	2.85714	18.1514
+H	0.758602	2.85714	17.1429
+H	0.758602	5.71429	1.00857
+H	0.758602	5.71429	0
+H	0.758602	5.71429	3.86571
+H	0.758602	5.71429	2.85714
+H	0.758602	5.71429	6.72285
+H	0.758602	5.71429	5.71429
+H	0.758602	5.71429	9.58
+H	0.758602	5.71429	8.57143
+H	0.758602	5.71429	12.4371
+H	0.758602	5.71429	11.4286
+H	0.758602	5.71429	15.2943
+H	0.758602	5.71429	14.2857
+H	0.758602	5.71429	18.1514
+H	0.758602	5.71429	17.1429
+H	0.758602	8.57143	1.00857
+H	0.758602	8.57143	0
+H	0.758602	8.57143	3.86571
+H	0.758602	8.57143	2.85714
+H	0.758602	8.57143	6.72285
+H	0.758602	8.57143	5.71429
+H	0.758602	8.57143	9.58
+H	0.758602	8.57143	8.57143
+H	0.758602	8.57143	12.4371
+H	0.758602	8.57143	11.4286
+H	0.758602	8.57143	15.2943
+H	0.758602	8.57143	14.2857
+H	0.758602	8.57143	18.1514
+H	0.758602	8.57143	17.1429
+H	0.758602	11.4286	1.00857
+H	0.758602	11.4286	0
+H	0.758602	11.4286	3.86571
+H	0.758602	11.4286	2.85714
+H	0.758602	11.4286	6.72285
+H	0.758602	11.4286	5.71429
+H	0.758602	11.4286	9.58
+H	0.758602	11.4286	8.57143
+H	0.758602	11.4286	12.4371
+H	0.758602	11.4286	11.4286
+H	0.758602	11.4286	15.2943
+H	0.758602	11.4286	14.2857
+H	0.758602	11.4286	18.1514
+H	0.758602	11.4286	17.1429
+H	0.758602	14.2857	1.00857
+H	0.758602	14.2857	0
+H	0.758602	14.2857	3.86571
+H	0.758602	14.2857	2.85714
+H	0.758602	14.2857	6.72285
+H	0.758602	14.2857	5.71429
+H	0.758602	14.2857	9.58
+H	0.758602	14.2857	8.57143
+H	0.758602	14.2857	12.4371
+H	0.758602	14.2857	11.4286
+H	0.758602	14.2857	15.2943
+H	0.758602	14.2857	14.2857
+H	0.758602	14.2857	18.1514
+H	0.758602	14.2857	17.1429
+H	0.758602	17.1429	1.00857
+H	0.758602	17.1429	0
+H	0.758602	17.1429	3.86571
+H	0.758602	17.1429	2.85714
+H	0.758602	17.1429	6.72285
+H	0.758602	17.1429	5.71429
+H	0.758602	17.1429	9.58
+H	0.758602	17.1429	8.57143
+H	0.758602	17.1429	12.4371
+H	0.758602	17.1429	11.4286
+H	0.758602	17.1429	15.2943
+H	0.758602	17.1429	14.2857
+H	0.758602	17.1429	18.1514
+H	0.758602	17.1429	17.1429
+H	3.61574	0	1.00857
+H	3.61574	0	0
+H	3.61574	0	3.86571
+H	3.61574	0	2.85714
+H	3.61574	0	6.72285
+H	3.61574	0	5.71429
+H	3.61574	0	9.58
+H	3.61574	0	8.57143
+H	3.61574	0	12.4371
+H	3.61574	0	11.4286
+H	3.61574	0	15.2943
+H	3.61574	0	14.2857
+H	3.61574	0	18.1514
+H	3.61574	0	17.1429
+H	3.61574	2.85714	1.00857
+H	3.61574	2.85714	0
+H	3.61574	2.85714	3.86571
+H	3.61574	2.85714	2.85714
+H	3.61574	2.85714	6.72285
+H	3.61574	2.85714	5.71429
+H	3.61574	2.85714	9.58
+H	3.61574	2.85714	8.57143
+H	3.61574	2.85714	12.4371
+H	3.61574	2.85714	11.4286
+H	3.61574	2.85714	15.2943
+H	3.61574	2.85714	14.2857
+H	3.61574	2.85714	18.1514
+H	3.61574	2.85714	17.1429
+H	3.61574	5.71429	1.00857
+H	3.61574	5.71429	0
+H	3.61574	5.71429	3.86571
+H	3.61574	5.71429	2.85714
+H	3.61574	5.71429	6.72285
+H	3.61574	5.71429	5.71429
+H	3.61574	5.71429	9.58
+H	3.61574	5.71429	8.57143
+H	3.61574	5.71429	12.4371
+H	3.61574	5.71429	11.4286
+H	3.61574	5.71429	15.2943
+H	3.61574	5.71429	14.2857
+H	3.61574	5.71429	18.1514
+H	3.61574	5.71429	17.1429
+H	3.61574	8.57143	1.00857
+H	3.61574	8.57143	0
+H	3.61574	8.57143	3.86571
+H	3.61574	8.57143	2.85714
+H	3.61574	8.57143	6.72285
+H	3.61574	8.57143	5.71429
+H	3.61574	8.57143	9.58
+H	3.61574	8.57143	8.57143
+H	3.61574	8.57143	12.4371
+H	3.61574	8.57143	11.4286
+H	3.61574	8.57143	15.2943
+H	3.61574	8.57143	14.2857
+H	3.61574	8.57143	18.1514
+H	3.61574	8.57143	17.1429
+H	3.61574	11.4286	1.00857
+H	3.61574	11.4286	0
+H	3.61574	11.4286	3.86571
+H	3.61574	11.4286	2.85714
+H	3.61574	11.4286	6.72285
+H	3.61574	11.4286	5.71429
+H	3.61574	11.4286	9.58
+H	3.61574	11.4286	8.57143
+H	3.61574	11.4286	12.4371
+H	3.61574	11.4286	11.4286
+H	3.61574	11.4286	15.2943
+H	3.61574	11.4286	14.2857
+H	3.61574	11.4286	18.1514
+H	3.61574	11.4286	17.1429
+H	3.61574	14.2857	1.00857
+H	3.61574	14.2857	0
+H	3.61574	14.2857	3.86571
+H	3.61574	14.2857	2.85714
+H	3.61574	14.2857	6.72285
+H	3.61574	14.2857	5.71429
+H	3.61574	14.2857	9.58
+H	3.61574	14.2857	8.57143
+H	3.61574	14.2857	12.4371
+H	3.61574	14.2857	11.4286
+H	3.61574	14.2857	15.2943
+H	3.61574	14.2857	14.2857
+H	3.61574	14.2857	18.1514
+H	3.61574	14.2857	17.1429
+H	3.61574	17.1429	1.00857
+H	3.61574	17.1429	0
+H	3.61574	17.1429	3.86571
+H	3.61574	17.1429	2.85714
+H	3.61574	17.1429	6.72285
+H	3.61574	17.1429	5.71429
+H	3.61574	17.1429	9.58
+H	3.61574	17.1429	8.57143
+H	3.61574	17.1429	12.4371
+H	3.61574	17.1429	11.4286
+H	3.61574	17.1429	15.2943
+H	3.61574	17.1429	14.2857
+H	3.61574	17.1429	18.1514
+H	3.61574	17.1429	17.1429
+H	6.47289	0	1.00857
+H	6.47289	0	0
+H	6.47289	0	3.86571
+H	6.47289	0	2.85714
+H	6.47289	0	6.72285
+H	6.47289	0	5.71429
+H	6.47289	0	9.58
+H	6.47289	0	8.57143
+H	6.47289	0	12.4371
+H	6.47289	0	11.4286
+H	6.47289	0	15.2943
+H	6.47289	0	14.2857
+H	6.47289	0	18.1514
+H	6.47289	0	17.1429
+H	6.47289	2.85714	0
+H	6.47289	2.85714	6.72285
+H	6.47289	2.85714	9.58
+H	6.47289	2.85714	8.57143
+H	6.47289	2.85714	12.4371
+H	6.47289	2.85714	11.4286
+H	6.47289	2.85714	15.2943
+H	6.47289	2.85714	14.2857
+H	6.47289	2.85714	18.1514
+H	6.47289	2.85714	17.1429
+H	6.47289	5.71429	1.00857
+H	6.47289	5.71429	0
+H	6.47289	5.71429	6.72285
+H	6.47289	5.71429	5.71429
+H	6.47289	5.71429	9.58
+H	6.47289	5.71429	8.57143
+H	6.47289	5.71429	12.4371
+H	6.47289	5.71429	11.4286
+H	6.47289	5.71429	15.2943
+H	6.47289	5.71429	14.2857
+H	6.47289	5.71429	18.1514
+H	6.47289	5.71429	17.1429
+H	6.47289	8.57143	1.00857
+H	6.47289	8.57143	0
+H	6.47289	8.57143	3.86571
+H	6.47289	8.57143	2.85714
+H	6.47289	8.57143	6.72285
+H	6.47289	8.57143	5.71429
+H	6.47289	8.57143	9.58
+H	6.47289	8.57143	8.57143
+H	6.47289	8.57143	12.4371
+H	6.47289	8.57143	11.4286
+H	6.47289	8.57143	15.2943
+H	6.47289	8.57143	14.2857
+H	6.47289	8.57143	18.1514
+H	6.47289	8.57143	17.1429
+H	6.47289	11.4286	1.00857
+H	6.47289	11.4286	0
+H	6.47289	11.4286	3.86571
+H	6.47289	11.4286	2.85714
+H	6.47289	11.4286	6.72285
+H	6.47289	11.4286	5.71429
+H	6.47289	11.4286	9.58
+H	6.47289	11.4286	8.57143
+H	6.47289	11.4286	12.4371
+H	6.47289	11.4286	11.4286
+H	6.47289	11.4286	15.2943
+H	6.47289	11.4286	14.2857
+H	6.47289	11.4286	18.1514
+H	6.47289	11.4286	17.1429
+H	6.47289	14.2857	1.00857
+H	6.47289	14.2857	0
+H	6.47289	14.2857	3.86571
+H	6.47289	14.2857	2.85714
+H	6.47289	14.2857	6.72285
+H	6.47289	14.2857	5.71429
+H	6.47289	14.2857	9.58
+H	6.47289	14.2857	8.57143
+H	6.47289	14.2857	12.4371
+H	6.47289	14.2857	11.4286
+H	6.47289	14.2857	15.2943
+H	6.47289	14.2857	14.2857
+H	6.47289	14.2857	18.1514
+H	6.47289	14.2857	17.1429
+H	6.47289	17.1429	1.00857
+H	6.47289	17.1429	0
+H	6.47289	17.1429	3.86571
+H	6.47289	17.1429	2.85714
+H	6.47289	17.1429	6.72285
+H	6.47289	17.1429	5.71429
+H	6.47289	17.1429	9.58
+H	6.47289	17.1429	8.57143
+H	6.47289	17.1429	12.4371
+H	6.47289	17.1429	11.4286
+H	6.47289	17.1429	15.2943
+H	6.47289	17.1429	14.2857
+H	6.47289	17.1429	18.1514
+H	6.47289	17.1429	17.1429
+H	9.33003	0	1.00857
+H	9.33003	0	0
+H	9.33003	0	3.86571
+H	9.33003	0	2.85714
+H	9.33003	0	6.72285
+H	9.33003	0	5.71429
+H	9.33003	0	9.58
+H	9.33003	0	8.57143
+H	9.33003	0	12.4371
+H	9.33003	0	11.4286
+H	9.33003	0	15.2943
+H	9.33003	0	14.2857
+H	9.33003	0	18.1514
+H	9.33003	0	17.1429
+H	9.33003	2.85714	0
+H	9.33003	2.85714	6.72285
+H	9.33003	2.85714	9.58
+H	9.33003	2.85714	8.57143
+H	9.33003	2.85714	12.4371
+H	9.33003	2.85714	11.4286
+H	9.33003	2.85714	15.2943
+H	9.33003	2.85714	14.2857
+H	9.33003	2.85714	18.1514
+H	9.33003	2.85714	17.1429
+H	9.33003	5.71429	0
+H	9.33003	5.71429	6.72285
+H	9.33003	5.71429	9.58
+H	9.33003	5.71429	8.57143
+H	9.33003	5.71429	12.4371
+H	9.33003	5.71429	11.4286
+H	9.33003	5.71429	15.2943
+H	9.33003	5.71429	14.2857
+H	9.33003	5.71429	18.1514
+H	9.33003	5.71429	17.1429
+H	9.33003	8.57143	1.00857
+H	9.33003	8.57143	0
+H	9.33003	8.57143	3.86571
+H	9.33003	8.57143	2.85714
+H	9.33003	8.57143	6.72285
+H	9.33003	8.57143	5.71429
+H	9.33003	8.57143	9.58
+H	9.33003	8.57143	8.57143
+H	9.33003	8.57143	12.4371
+H	9.33003	8.57143	11.4286
+H	9.33003	8.57143	15.2943
+H	9.33003	8.57143	14.2857
+H	9.33003	8.57143	18.1514
+H	9.33003	8.57143	17.1429
+H	9.33003	11.4286	1.00857
+H	9.33003	11.4286	0
+H	9.33003	11.4286	3.86571
+H	9.33003	11.4286	2.85714
+H	9.33003	11.4286	6.72285
+H	9.33003	11.4286	5.71429
+H	9.33003	11.4286	9.58
+H	9.33003	11.4286	8.57143
+H	9.33003	11.4286	12.4371
+H	9.33003	11.4286	11.4286
+H	9.33003	11.4286	15.2943
+H	9.33003	11.4286	14.2857
+H	9.33003	11.4286	18.1514
+H	9.33003	11.4286	17.1429
+H	9.33003	14.2857	1.00857
+H	9.33003	14.2857	0
+H	9.33003	14.2857	3.86571
+H	9.33003	14.2857	2.85714
+H	9.33003	14.2857	6.72285
+H	9.33003	14.2857	5.71429
+H	9.33003	14.2857	9.58
+H	9.33003	14.2857	8.57143
+H	9.33003	14.2857	12.4371
+H	9.33003	14.2857	11.4286
+H	9.33003	14.2857	15.2943
+H	9.33003	14.2857	14.2857
+H	9.33003	14.2857	18.1514
+H	9.33003	14.2857	17.1429
+H	9.33003	17.1429	1.00857
+H	9.33003	17.1429	0
+H	9.33003	17.1429	3.86571
+H	9.33003	17.1429	2.85714
+H	9.33003	17.1429	6.72285
+H	9.33003	17.1429	5.71429
+H	9.33003	17.1429	9.58
+H	9.33003	17.1429	8.57143
+H	9.33003	17.1429	12.4371
+H	9.33003	17.1429	11.4286
+H	9.33003	17.1429	15.2943
+H	9.33003	17.1429	14.2857
+H	9.33003	17.1429	18.1514
+H	9.33003	17.1429	17.1429
+H	12.1872	0	1.00857
+H	12.1872	0	0
+H	12.1872	0	3.86571
+H	12.1872	0	2.85714
+H	12.1872	0	6.72285
+H	12.1872	0	5.71429
+H	12.1872	0	9.58
+H	12.1872	0	8.57143
+H	12.1872	0	12.4371
+H	12.1872	0	11.4286
+H	12.1872	0	15.2943
+H	12.1872	0	14.2857
+H	12.1872	0	18.1514
+H	12.1872	0	17.1429
+H	12.1872	2.85714	1.00857
+H	12.1872	2.85714	0
+H	12.1872	2.85714	6.72285
+H	12.1872	2.85714	5.71429
+H	12.1872	2.85714	9.58
+H	12.1872	2.85714	8.57143
+H	12.1872	2.85714	12.4371
+H	12.1872	2.85714	11.4286
+H	12.1872	2.85714	15.2943
+H	12.1872	2.85714	14.2857
+H	12.1872	2.85714	18.1514
+H	12.1872	2.85714	17.1429
+H	12.1872	5.71429	1.00857
+H	12.1872	5.71429	0
+H	12.1872	5.71429	3.86571
+H	12.1872	5.71429	2.85714
+H	12.1872	5.71429	6.72285
+H	12.1872	5.71429	5.71429
+H	12.1872	5.71429	9.58
+H	12.1872	5.71429	8.57143
+H	12.1872	5.71429	12.4371
+H	12.1872	5.71429	11.4286
+H	12.1872	5.71429	15.2943
+H	12.1872	5.71429	14.2857
+H	12.1872	5.71429	18.1514
+H	12.1872	5.71429	17.1429
+H	12.1872	8.57143	1.00857
+H	12.1872	8.57143	0
+H	12.1872	8.57143	3.86571
+H	12.1872	8.57143	2.85714
+H	12.1872	8.57143	6.72285
+H	12.1872	8.57143	5.71429
+H	12.1872	8.57143	9.58
+H	12.1872	8.57143	8.57143
+H	12.1872	8.57143	12.4371
+H	12.1872	8.57143	11.4286
+H	12.1872	8.57143	15.2943
+H	12.1872	8.57143	14.2857
+H	12.1872	8.57143	18.1514
+H	12.1872	8.57143	17.1429
+H	12.1872	11.4286	1.00857
+H	12.1872	11.4286	0
+H	12.1872	11.4286	3.86571
+H	12.1872	11.4286	2.85714
+H	12.1872	11.4286	6.72285
+H	12.1872	11.4286	5.71429
+H	12.1872	11.4286	9.58
+H	12.1872	11.4286	8.57143
+H	12.1872	11.4286	12.4371
+H	12.1872	11.4286	11.4286
+H	12.1872	11.4286	15.2943
+H	12.1872	11.4286	14.2857
+H	12.1872	11.4286	18.1514
+H	12.1872	11.4286	17.1429
+H	12.1872	14.2857	1.00857
+H	12.1872	14.2857	0
+H	12.1872	14.2857	3.86571
+H	12.1872	14.2857	2.85714
+H	12.1872	14.2857	6.72285
+H	12.1872	14.2857	5.71429
+H	12.1872	14.2857	9.58
+H	12.1872	14.2857	8.57143
+H	12.1872	14.2857	12.4371
+H	12.1872	14.2857	11.4286
+H	12.1872	14.2857	15.2943
+H	12.1872	14.2857	14.2857
+H	12.1872	14.2857	18.1514
+H	12.1872	14.2857	17.1429
+H	12.1872	17.1429	1.00857
+H	12.1872	17.1429	0
+H	12.1872	17.1429	3.86571
+H	12.1872	17.1429	2.85714
+H	12.1872	17.1429	6.72285
+H	12.1872	17.1429	5.71429
+H	12.1872	17.1429	9.58
+H	12.1872	17.1429	8.57143
+H	12.1872	17.1429	12.4371
+H	12.1872	17.1429	11.4286
+H	12.1872	17.1429	15.2943
+H	12.1872	17.1429	14.2857
+H	12.1872	17.1429	18.1514
+H	12.1872	17.1429	17.1429
+H	15.0443	0	1.00857
+H	15.0443	0	0
+H	15.0443	0	3.86571
+H	15.0443	0	2.85714
+H	15.0443	0	6.72285
+H	15.0443	0	5.71429
+H	15.0443	0	9.58
+H	15.0443	0	8.57143
+H	15.0443	0	12.4371
+H	15.0443	0	11.4286
+H	15.0443	0	15.2943
+H	15.0443	0	14.2857
+H	15.0443	0	18.1514
+H	15.0443	0	17.1429
+H	15.0443	2.85714	1.00857
+H	15.0443	2.85714	0
+H	15.0443	2.85714	3.86571
+H	15.0443	2.85714	2.85714
+H	15.0443	2.85714	6.72285
+H	15.0443	2.85714	5.71429
+H	15.0443	2.85714	9.58
+H	15.0443	2.85714	8.57143
+H	15.0443	2.85714	12.4371
+H	15.0443	2.85714	11.4286
+H	15.0443	2.85714	15.2943
+H	15.0443	2.85714	14.2857
+H	15.0443	2.85714	18.1514
+H	15.0443	2.85714	17.1429
+H	15.0443	5.71429	1.00857
+H	15.0443	5.71429	0
+H	15.0443	5.71429	3.86571
+H	15.0443	5.71429	2.85714
+H	15.0443	5.71429	6.72285
+H	15.0443	5.71429	5.71429
+H	15.0443	5.71429	9.58
+H	15.0443	5.71429	8.57143
+H	15.0443	5.71429	12.4371
+H	15.0443	5.71429	11.4286
+H	15.0443	5.71429	15.2943
+H	15.0443	5.71429	14.2857
+H	15.0443	5.71429	18.1514
+H	15.0443	5.71429	17.1429
+H	15.0443	8.57143	1.00857
+H	15.0443	8.57143	0
+H	15.0443	8.57143	3.86571
+H	15.0443	8.57143	2.85714
+H	15.0443	8.57143	6.72285
+H	15.0443	8.57143	5.71429
+H	15.0443	8.57143	9.58
+H	15.0443	8.57143	8.57143
+H	15.0443	8.57143	12.4371
+H	15.0443	8.57143	11.4286
+H	15.0443	8.57143	15.2943
+H	15.0443	8.57143	14.2857
+H	15.0443	8.57143	18.1514
+H	15.0443	8.57143	17.1429
+H	15.0443	11.4286	1.00857
+H	15.0443	11.4286	0
+H	15.0443	11.4286	3.86571
+H	15.0443	11.4286	2.85714
+H	15.0443	11.4286	6.72285
+H	15.0443	11.4286	5.71429
+H	15.0443	11.4286	9.58
+H	15.0443	11.4286	8.57143
+H	15.0443	11.4286	12.4371
+H	15.0443	11.4286	11.4286
+H	15.0443	11.4286	15.2943
+H	15.0443	11.4286	14.2857
+H	15.0443	11.4286	18.1514
+H	15.0443	11.4286	17.1429
+H	15.0443	14.2857	1.00857
+H	15.0443	14.2857	0
+H	15.0443	14.2857	3.86571
+H	15.0443	14.2857	2.85714
+H	15.0443	14.2857	6.72285
+H	15.0443	14.2857	5.71429
+H	15.0443	14.2857	9.58
+H	15.0443	14.2857	8.57143
+H	15.0443	14.2857	12.4371
+H	15.0443	14.2857	11.4286
+H	15.0443	14.2857	15.2943
+H	15.0443	14.2857	14.2857
+H	15.0443	14.2857	18.1514
+H	15.0443	14.2857	17.1429
+H	15.0443	17.1429	1.00857
+H	15.0443	17.1429	0
+H	15.0443	17.1429	3.86571
+H	15.0443	17.1429	2.85714
+H	15.0443	17.1429	6.72285
+H	15.0443	17.1429	5.71429
+H	15.0443	17.1429	9.58
+H	15.0443	17.1429	8.57143
+H	15.0443	17.1429	12.4371
+H	15.0443	17.1429	11.4286
+H	15.0443	17.1429	15.2943
+H	15.0443	17.1429	14.2857
+H	15.0443	17.1429	18.1514
+H	15.0443	17.1429	17.1429
+H	17.9015	0	1.00857
+H	17.9015	0	0
+H	17.9015	0	3.86571
+H	17.9015	0	2.85714
+H	17.9015	0	6.72285
+H	17.9015	0	5.71429
+H	17.9015	0	9.58
+H	17.9015	0	8.57143
+H	17.9015	0	12.4371
+H	17.9015	0	11.4286
+H	17.9015	0	15.2943
+H	17.9015	0	14.2857
+H	17.9015	0	18.1514
+H	17.9015	0	17.1429
+H	17.9015	2.85714	1.00857
+H	17.9015	2.85714	0
+H	17.9015	2.85714	3.86571
+H	17.9015	2.85714	2.85714
+H	17.9015	2.85714	6.72285
+H	17.9015	2.85714	5.71429
+H	17.9015	2.85714	9.58
+H	17.9015	2.85714	8.57143
+H	17.9015	2.85714	12.4371
+H	17.9015	2.85714	11.4286
+H	17.9015	2.85714	15.2943
+H	17.9015	2.85714	14.2857
+H	17.9015	2.85714	18.1514
+H	17.9015	2.85714	17.1429
+H	17.9015	5.71429	1.00857
+H	17.9015	5.71429	0
+H	17.9015	5.71429	3.86571
+H	17.9015	5.71429	2.85714
+H	17.9015	5.71429	6.72285
+H	17.9015	5.71429	5.71429
+H	17.9015	5.71429	9.58
+H	17.9015	5.71429	8.57143
+H	17.9015	5.71429	12.4371
+H	17.9015	5.71429	11.4286
+H	17.9015	5.71429	15.2943
+H	17.9015	5.71429	14.2857
+H	17.9015	5.71429	18.1514
+H	17.9015	5.71429	17.1429
+H	17.9015	8.57143	1.00857
+H	17.9015	8.57143	0
+H	17.9015	8.57143	3.86571
+H	17.9015	8.57143	2.85714
+H	17.9015	8.57143	6.72285
+H	17.9015	8.57143	5.71429
+H	17.9015	8.57143	9.58
+H	17.9015	8.57143	8.57143
+H	17.9015	8.57143	12.4371
+H	17.9015	8.57143	11.4286
+H	17.9015	8.57143	15.2943
+H	17.9015	8.57143	14.2857
+H	17.9015	8.57143	18.1514
+H	17.9015	8.57143	17.1429
+H	17.9015	11.4286	1.00857
+H	17.9015	11.4286	0
+H	17.9015	11.4286	3.86571
+H	17.9015	11.4286	2.85714
+H	17.9015	11.4286	6.72285
+H	17.9015	11.4286	5.71429
+H	17.9015	11.4286	9.58
+H	17.9015	11.4286	8.57143
+H	17.9015	11.4286	12.4371
+H	17.9015	11.4286	11.4286
+H	17.9015	11.4286	15.2943
+H	17.9015	11.4286	14.2857
+H	17.9015	11.4286	18.1514
+H	17.9015	11.4286	17.1429
+H	17.9015	14.2857	1.00857
+H	17.9015	14.2857	0
+H	17.9015	14.2857	3.86571
+H	17.9015	14.2857	2.85714
+H	17.9015	14.2857	6.72285
+H	17.9015	14.2857	5.71429
+H	17.9015	14.2857	9.58
+H	17.9015	14.2857	8.57143
+H	17.9015	14.2857	12.4371
+H	17.9015	14.2857	11.4286
+H	17.9015	14.2857	15.2943
+H	17.9015	14.2857	14.2857
+H	17.9015	14.2857	18.1514
+H	17.9015	14.2857	17.1429
+H	17.9015	17.1429	1.00857
+H	17.9015	17.1429	0
+H	17.9015	17.1429	3.86571
+H	17.9015	17.1429	2.85714
+H	17.9015	17.1429	6.72285
+H	17.9015	17.1429	5.71429
+H	17.9015	17.1429	9.58
+H	17.9015	17.1429	8.57143
+H	17.9015	17.1429	12.4371
+H	17.9015	17.1429	11.4286
+H	17.9015	17.1429	15.2943
+H	17.9015	17.1429	14.2857
+H	17.9015	17.1429	18.1514
+H	17.9015	17.1429	17.1429
+C	9.78209	3.27519	3.53589
+C	8.53279	4.15859	3.53589
+C	7.28359	3.27519	3.53589
+O	0	0	0.504284
+O	0	0	3.36143
+O	0	0	6.21857
+O	0	0	9.07571
+O	0	0	11.9329
+O	0	0	14.79
+O	0	0	17.6471
+O	0	2.85714	0.504284
+O	0	2.85714	3.36143
+O	0	2.85714	6.21857
+O	0	2.85714	9.07571
+O	0	2.85714	11.9329
+O	0	2.85714	14.79
+O	0	2.85714	17.6471
+O	0	5.71429	0.504284
+O	0	5.71429	3.36143
+O	0	5.71429	6.21857
+O	0	5.71429	9.07571
+O	0	5.71429	11.9329
+O	0	5.71429	14.79
+O	0	5.71429	17.6471
+O	0	8.57143	0.504284
+O	0	8.57143	3.36143
+O	0	8.57143	6.21857
+O	0	8.57143	9.07571
+O	0	8.57143	11.9329
+O	0	8.57143	14.79
+O	0	8.57143	17.6471
+O	0	11.4286	0.504284
+O	0	11.4286	3.36143
+O	0	11.4286	6.21857
+O	0	11.4286	9.07571
+O	0	11.4286	11.9329
+O	0	11.4286	14.79
+O	0	11.4286	17.6471
+O	0	14.2857	0.504284
+O	0	14.2857	3.36143
+O	0	14.2857	6.21857
+O	0	14.2857	9.07571
+O	0	14.2857	11.9329
+O	0	14.2857	14.79
+O	0	14.2857	17.6471
+O	0	17.1429	0.504284
+O	0	17.1429	3.36143
+O	0	17.1429	6.21857
+O	0	17.1429	9.07571
+O	0	17.1429	11.9329
+O	0	17.1429	14.79
+O	0	17.1429	17.6471
+O	2.85714	0	0.504284
+O	2.85714	0	3.36143
+O	2.85714	0	6.21857
+O	2.85714	0	9.07571
+O	2.85714	0	11.9329
+O	2.85714	0	14.79
+O	2.85714	0	17.6471
+O	2.85714	2.85714	0.504284
+O	2.85714	2.85714	3.36143
+O	2.85714	2.85714	6.21857
+O	2.85714	2.85714	9.07571
+O	2.85714	2.85714	11.9329
+O	2.85714	2.85714	14.79
+O	2.85714	2.85714	17.6471
+O	2.85714	5.71429	0.504284
+O	2.85714	5.71429	3.36143
+O	2.85714	5.71429	6.21857
+O	2.85714	5.71429	9.07571
+O	2.85714	5.71429	11.9329
+O	2.85714	5.71429	14.79
+O	2.85714	5.71429	17.6471
+O	2.85714	8.57143	0.504284
+O	2.85714	8.57143	3.36143
+O	2.85714	8.57143	6.21857
+O	2.85714	8.57143	9.07571
+O	2.85714	8.57143	11.9329
+O	2.85714	8.57143	14.79
+O	2.85714	8.57143	17.6471
+O	2.85714	11.4286	0.504284
+O	2.85714	11.4286	3.36143
+O	2.85714	11.4286	6.21857
+O	2.85714	11.4286	9.07571
+O	2.85714	11.4286	11.9329
+O	2.85714	11.4286	14.79
+O	2.85714	11.4286	17.6471
+O	2.85714	14.2857	0.504284
+O	2.85714	14.2857	3.36143
+O	2.85714	14.2857	6.21857
+O	2.85714	14.2857	9.07571
+O	2.85714	14.2857	11.9329
+O	2.85714	14.2857	14.79
+O	2.85714	14.2857	17.6471
+O	2.85714	17.1429	0.504284
+O	2.85714	17.1429	3.36143
+O	2.85714	17.1429	6.21857
+O	2.85714	17.1429	9.07571
+O	2.85714	17.1429	11.9329
+O	2.85714	17.1429	14.79
+O	2.85714	17.1429	17.6471
+O	5.71429	0	0.504284
+O	5.71429	0	3.36143
+O	5.71429	0	6.21857
+O	5.71429	0	9.07571
+O	5.71429	0	11.9329
+O	5.71429	0	14.79
+O	5.71429	0	17.6471
+O	5.71429	2.85714	0.504284
+O	5.71429	2.85714	6.21857
+O	5.71429	2.85714	9.07571
+O	5.71429	2.85714	11.9329
+O	5.71429	2.85714	14.79
+O	5.71429	2.85714	17.6471
+O	5.71429	5.71429	0.504284
+O	5.71429	5.71429	6.21857
+O	5.71429	5.71429	9.07571
+O	5.71429	5.71429	11.9329
+O	5.71429	5.71429	14.79
+O	5.71429	5.71429	17.6471
+O	5.71429	8.57143	0.504284
+O	5.71429	8.57143	3.36143
+O	5.71429	8.57143	6.21857
+O	5.71429	8.57143	9.07571
+O	5.71429	8.57143	11.9329
+O	5.71429	8.57143	14.79
+O	5.71429	8.57143	17.6471
+O	5.71429	11.4286	0.504284
+O	5.71429	11.4286	3.36143
+O	5.71429	11.4286	6.21857
+O	5.71429	11.4286	9.07571
+O	5.71429	11.4286	11.9329
+O	5.71429	11.4286	14.79
+O	5.71429	11.4286	17.6471
+O	5.71429	14.2857	0.504284
+O	5.71429	14.2857	3.36143
+O	5.71429	14.2857	6.21857
+O	5.71429	14.2857	9.07571
+O	5.71429	14.2857	11.9329
+O	5.71429	14.2857	14.79
+O	5.71429	14.2857	17.6471
+O	5.71429	17.1429	0.504284
+O	5.71429	17.1429	3.36143
+O	5.71429	17.1429	6.21857
+O	5.71429	17.1429	9.07571
+O	5.71429	17.1429	11.9329
+O	5.71429	17.1429	14.79
+O	5.71429	17.1429	17.6471
+O	8.57143	0	0.504284
+O	8.57143	0	3.36143
+O	8.57143	0	6.21857
+O	8.57143	0	9.07571
+O	8.57143	0	11.9329
+O	8.57143	0	14.79
+O	8.57143	0	17.6471
+O	8.57143	2.85714	0.504284
+O	8.57143	2.85714	9.07571
+O	8.57143	2.85714	11.9329
+O	8.57143	2.85714	14.79
+O	8.57143	2.85714	17.6471
+O	8.57143	5.71429	0.504284
+O	8.57143	5.71429	9.07571
+O	8.57143	5.71429	11.9329
+O	8.57143	5.71429	14.79
+O	8.57143	5.71429	17.6471
+O	8.57143	8.57143	0.504284
+O	8.57143	8.57143	3.36143
+O	8.57143	8.57143	6.21857
+O	8.57143	8.57143	9.07571
+O	8.57143	8.57143	11.9329
+O	8.57143	8.57143	14.79
+O	8.57143	8.57143	17.6471
+O	8.57143	11.4286	0.504284
+O	8.57143	11.4286	3.36143
+O	8.57143	11.4286	6.21857
+O	8.57143	11.4286	9.07571
+O	8.57143	11.4286	11.9329
+O	8.57143	11.4286	14.79
+O	8.57143	11.4286	17.6471
+O	8.57143	14.2857	0.504284
+O	8.57143	14.2857	3.36143
+O	8.57143	14.2857	6.21857
+O	8.57143	14.2857	9.07571
+O	8.57143	14.2857	11.9329
+O	8.57143	14.2857	14.79
+O	8.57143	14.2857	17.6471
+O	8.57143	17.1429	0.504284
+O	8.57143	17.1429	3.36143
+O	8.57143	17.1429	6.21857
+O	8.57143	17.1429	9.07571
+O	8.57143	17.1429	11.9329
+O	8.57143	17.1429	14.79
+O	8.57143	17.1429	17.6471
+O	11.4286	0	0.504284
+O	11.4286	0	3.36143
+O	11.4286	0	6.21857
+O	11.4286	0	9.07571
+O	11.4286	0	11.9329
+O	11.4286	0	14.79
+O	11.4286	0	17.6471
+O	11.4286	2.85714	0.504284
+O	11.4286	2.85714	6.21857
+O	11.4286	2.85714	9.07571
+O	11.4286	2.85714	11.9329
+O	11.4286	2.85714	14.79
+O	11.4286	2.85714	17.6471
+O	11.4286	5.71429	0.504284
+O	11.4286	5.71429	6.21857
+O	11.4286	5.71429	9.07571
+O	11.4286	5.71429	11.9329
+O	11.4286	5.71429	14.79
+O	11.4286	5.71429	17.6471
+O	11.4286	8.57143	0.504284
+O	11.4286	8.57143	3.36143
+O	11.4286	8.57143	6.21857
+O	11.4286	8.57143	9.07571
+O	11.4286	8.57143	11.9329
+O	11.4286	8.57143	14.79
+O	11.4286	8.57143	17.6471
+O	11.4286	11.4286	0.504284
+O	11.4286	11.4286	3.36143
+O	11.4286	11.4286	6.21857
+O	11.4286	11.4286	9.07571
+O	11.4286	11.4286	11.9329
+O	11.4286	11.4286	14.79
+O	11.4286	11.4286	17.6471
+O	11.4286	14.2857	0.504284
+O	11.4286	14.2857	3.36143
+O	11.4286	14.2857	6.21857
+O	11.4286	14.2857	9.07571
+O	11.4286	14.2857	11.9329
+O	11.4286	14.2857	14.79
+O	11.4286	14.2857	17.6471
+O	11.4286	17.1429	0.504284
+O	11.4286	17.1429	3.36143
+O	11.4286	17.1429	6.21857
+O	11.4286	17.1429	9.07571
+O	11.4286	17.1429	11.9329
+O	11.4286	17.1429	14.79
+O	11.4286	17.1429	17.6471
+O	14.2857	0	0.504284
+O	14.2857	0	3.36143
+O	14.2857	0	6.21857
+O	14.2857	0	9.07571
+O	14.2857	0	11.9329
+O	14.2857	0	14.79
+O	14.2857	0	17.6471
+O	14.2857	2.85714	0.504284
+O	14.2857	2.85714	3.36143
+O	14.2857	2.85714	6.21857
+O	14.2857	2.85714	9.07571
+O	14.2857	2.85714	11.9329
+O	14.2857	2.85714	14.79
+O	14.2857	2.85714	17.6471
+O	14.2857	5.71429	0.504284
+O	14.2857	5.71429	3.36143
+O	14.2857	5.71429	6.21857
+O	14.2857	5.71429	9.07571
+O	14.2857	5.71429	11.9329
+O	14.2857	5.71429	14.79
+O	14.2857	5.71429	17.6471
+O	14.2857	8.57143	0.504284
+O	14.2857	8.57143	3.36143
+O	14.2857	8.57143	6.21857
+O	14.2857	8.57143	9.07571
+O	14.2857	8.57143	11.9329
+O	14.2857	8.57143	14.79
+O	14.2857	8.57143	17.6471
+O	14.2857	11.4286	0.504284
+O	14.2857	11.4286	3.36143
+O	14.2857	11.4286	6.21857
+O	14.2857	11.4286	9.07571
+O	14.2857	11.4286	11.9329
+O	14.2857	11.4286	14.79
+O	14.2857	11.4286	17.6471
+O	14.2857	14.2857	0.504284
+O	14.2857	14.2857	3.36143
+O	14.2857	14.2857	6.21857
+O	14.2857	14.2857	9.07571
+O	14.2857	14.2857	11.9329
+O	14.2857	14.2857	14.79
+O	14.2857	14.2857	17.6471
+O	14.2857	17.1429	0.504284
+O	14.2857	17.1429	3.36143
+O	14.2857	17.1429	6.21857
+O	14.2857	17.1429	9.07571
+O	14.2857	17.1429	11.9329
+O	14.2857	17.1429	14.79
+O	14.2857	17.1429	17.6471
+O	17.1429	0	0.504284
+O	17.1429	0	3.36143
+O	17.1429	0	6.21857
+O	17.1429	0	9.07571
+O	17.1429	0	11.9329
+O	17.1429	0	14.79
+O	17.1429	0	17.6471
+O	17.1429	2.85714	0.504284
+O	17.1429	2.85714	3.36143
+O	17.1429	2.85714	6.21857
+O	17.1429	2.85714	9.07571
+O	17.1429	2.85714	11.9329
+O	17.1429	2.85714	14.79
+O	17.1429	2.85714	17.6471
+O	17.1429	5.71429	0.504284
+O	17.1429	5.71429	3.36143
+O	17.1429	5.71429	6.21857
+O	17.1429	5.71429	9.07571
+O	17.1429	5.71429	11.9329
+O	17.1429	5.71429	14.79
+O	17.1429	5.71429	17.6471
+O	17.1429	8.57143	0.504284
+O	17.1429	8.57143	3.36143
+O	17.1429	8.57143	6.21857
+O	17.1429	8.57143	9.07571
+O	17.1429	8.57143	11.9329
+O	17.1429	8.57143	14.79
+O	17.1429	8.57143	17.6471
+O	17.1429	11.4286	0.504284
+O	17.1429	11.4286	3.36143
+O	17.1429	11.4286	6.21857
+O	17.1429	11.4286	9.07571
+O	17.1429	11.4286	11.9329
+O	17.1429	11.4286	14.79
+O	17.1429	11.4286	17.6471
+O	17.1429	14.2857	0.504284
+O	17.1429	14.2857	3.36143
+O	17.1429	14.2857	6.21857
+O	17.1429	14.2857	9.07571
+O	17.1429	14.2857	11.9329
+O	17.1429	14.2857	14.79
+O	17.1429	14.2857	17.6471
+O	17.1429	17.1429	0.504284
+O	17.1429	17.1429	3.36143
+O	17.1429	17.1429	6.21857
+O	17.1429	17.1429	9.07571
+O	17.1429	17.1429	11.9329
+O	17.1429	17.1429	14.79
+O	17.1429	17.1429	17.6471
Index: tests/regression/Simple_configuration/9/post/test-shifted.xyz
===================================================================
--- tests/regression/Simple_configuration/9/post/test-shifted.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Simple_configuration/9/post/test-shifted.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,3 @@
+1
+	Created by molecuilder on Mon Aug  9 17:31:25 2010
+H	1	0	0
Index: tests/regression/Simple_configuration/9/post/test.xyz
===================================================================
--- tests/regression/Simple_configuration/9/post/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Simple_configuration/9/post/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,3 @@
+1
+	Created by molecuilder on Mon Aug  9 17:31:25 2010
+H	0	0	0
Index: tests/regression/Simple_configuration/9/pre/test.xyz
===================================================================
--- tests/regression/Simple_configuration/9/pre/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
+++ tests/regression/Simple_configuration/9/pre/test.xyz	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -0,0 +1,3 @@
+1
+	Created by molecuilder on Mon Aug  9 17:31:25 2010
+H	0	0	0
Index: tests/regression/atlocal.in
===================================================================
--- tests/regression/atlocal.in	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/atlocal.in	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -1,4 +1,5 @@
 prefix='@prefix@'
 exec_prefix='@prefix@'
-topdir='@topdir@'
+topdir='@abs_top_builddir@'
 bindir='@bindir@'
+valgrind='@VALGRIND@'
Index: tests/regression/molecuilder.in
===================================================================
--- tests/regression/molecuilder.in	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/molecuilder.in	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -3,8 +3,28 @@
 # wrapper for testing molecuilder
 
-. ../../atconfig
+. ../../atlocal
 
-"${abs_top_builddir}/src/molecuilder" \
-	${1+"$@"}
+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 \
+"${topdir}/src/molecuilder" \
+${1+"$@"}
+else
+"${topdir}/src/molecuilder" \
+${1+"$@"}
+fi
+
 status=$?
 
Index: tests/regression/testsuite-analysis.at
===================================================================
--- tests/regression/testsuite-analysis.at	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/testsuite-analysis.at	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -39,5 +39,5 @@
 AT_KEYWORDS([analysis])
 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/4/pre/test.conf .], 0)
-AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -v 3 -I --select-all-molecules --unselect-molecule-by-id 207 --surface-correlation --elements 1 --output-file output.csv --bin-output-file bin_output.csv --bin-start 0 --bin-width 1. --bin-end 20 --molecule-by-id 207], 0, [stdout], [stderr])
+AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -v 3 -I --select-all-molecules --unselect-molecule-by-formula C3H8 --surface-correlation --elements 1 --output-file output.csv --bin-output-file bin_output.csv --bin-start 0 --bin-width 1. --bin-end 20 --molecule-by-id 1], 0, [stdout], [stderr])
 AT_CHECK([fgrep "Begin of CorrelationToSurface" stdout], 0, [ignore], [ignore])
 #AT_CHECK([file=output.csv; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/4/post/$file], 0, [ignore], [ignore])
Index: tests/regression/testsuite-graph.at
===================================================================
--- tests/regression/testsuite-graph.at	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/testsuite-graph.at	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -16,2 +16,16 @@
 AT_CLEANUP
 
+AT_SETUP([Graph - subgraph dissection with Undo/Redo])
+AT_KEYWORDS([graph])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Graph/2/pre/test.conf .], 0)
+AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -v 3 -I], 0, [stdout], [stderr])
+AT_CHECK([fgrep "I scanned 31 molecules." stdout], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Graph/2/pre/test.conf .], 0)
+AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -v 3 -I --undo], 0, [stdout], [stderr])
+AT_CHECK([fgrep "I scanned 31 molecules." stdout], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Graph/2/pre/test.conf .], 0)
+AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -v 3 -I --undo --redo], 0, [stdout], [stderr])
+AT_CHECK([grep -c "I scanned 31 molecules." stdout], 0, [2
+], [ignore])
+AT_CLEANUP
+
Index: tests/regression/testsuite-molecules.at
===================================================================
--- tests/regression/testsuite-molecules.at	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/testsuite-molecules.at	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -45,25 +45,76 @@
 AT_KEYWORDS([Molecules])
 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/6/pre/test.* .], 0)
-AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -t "1., 1., 1." --periodic 0], 0, [stdout], [stderr])
+AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ --select-molecules-atoms 0 -t "1., 1., 1." --periodic 0], 0, [stdout], [stderr])
 AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/6/post/$file], 0, [ignore], [ignore])
 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/6/pre/test2.* .], 0)
-AT_CHECK([../../molecuilder -i test2.conf -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -t "-1., -1., -1." --periodic 0], 0, [stdout], [stderr])
+AT_CHECK([../../molecuilder -i test2.conf -e ${abs_top_srcdir}/src/ --select-molecules-atoms 0 -t "-1., -1., -1." --periodic 0], 0, [stdout], [stderr])
 AT_CHECK([file=test2.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/6/post/$file], 0, [ignore], [ignore])
 AT_CLEANUP
 
-# 7. Periodic translation
-AT_SETUP([Molecules - Periodic translation])
+# 8. Rotate to PAS
+AT_SETUP([Molecules - Rotate to PAS])
 AT_KEYWORDS([Molecules])
-AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/7/pre/test.* .], 0)
-AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -t "12., 12., 12." --periodic 1], 0, [stdout], [stderr])
-AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/7/post/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/pre/test-*.xyz .], 0)
+AT_CHECK([../../molecuilder -i test-rotated-z90.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
+AT_CHECK([file="test-rotated-z90.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder -i test-rotated-z180.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
+AT_CHECK([file="test-rotated-z180.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder -i test-rotated-z360.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
+AT_CHECK([file="test-rotated-z360.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder -i test-rotated-xYz20.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
+AT_CHECK([file="test-rotated-xYz20.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
 AT_CLEANUP
 
-# 8. Rotate to PAS
-AT_SETUP([Molecules - BROKEN: Rotate to PAS])
+# 9. Rotate around origin
+AT_SETUP([Molecules - Rotate around origin])
 AT_KEYWORDS([Molecules])
-AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/pre/test.* .], 0)
-AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m 0], 0, [stdout], [stderr])
-#AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-atoms --rotate-origin 90. --position "0,0,1"], 0, [stdout], [stderr])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z90.xyz], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-atoms --rotate-origin 180. --position "0,0,1"], 0, [stdout], [stderr])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z180.xyz], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-atoms --rotate-origin 360. --position "0,0,1"], 0, [stdout], [stderr])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z360.xyz], 0, [ignore], [ignore])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-atoms --rotate-origin 20. --position "1,2,1"], 0, [stdout], [stderr])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-xYz20.xyz], 0, [ignore], [ignore])
 AT_CLEANUP
 
+# 10. Rotate around self
+AT_SETUP([Molecules - Rotate around self])
+AT_KEYWORDS([Molecules])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 90. --position "0,0,1"], 0, [stdout], [stderr])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z90.xyz], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 180. --position "0,0,1"], 0, [stdout], [stderr])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z180.xyz], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 360. --position "0,0,1"], 0, [stdout], [stderr])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z360.xyz], 0, [ignore], [ignore])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 20. --position "1,2,1"], 0, [stdout], [stderr])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-xYz20.xyz], 0, [ignore], [ignore])
+AT_CLEANUP
+
+# 11. copy molecule
+AT_SETUP([Molecules - Copy molecule])
+AT_KEYWORDS([Molecules])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/pre/test.xyz test-copy.xyz], 0)
+AT_CHECK([../../molecuilder -i test-copy.xyz -e ${abs_top_srcdir}/src/ --copy-molecule 0 --position "0,0,10"], 0, [stdout], [stderr])
+AT_CHECK([diff test-copy.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/post/test-copy.xyz], 0, [ignore], [ignore])
+AT_CLEANUP
+
+AT_SETUP([Molecules - Copy molecule with Undo/Redo])
+AT_KEYWORDS([Molecules])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/pre/test.xyz test-copy.xyz], 0)
+AT_CHECK([../../molecuilder -i test-copy.xyz -e ${abs_top_srcdir}/src/ --copy-molecule 0 --position "0,0,10" --undo], 0, [stdout], [stderr])
+AT_CHECK([diff test-copy.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/pre/test.xyz], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/pre/test.xyz test-copy.xyz], 0)
+AT_CHECK([../../molecuilder -i test-copy.xyz -e ${abs_top_srcdir}/src/ --copy-molecule 0 --position "0,0,10" --undo --redo], 0, [stdout], [stderr])
+AT_CHECK([diff test-copy.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/post/test-copy.xyz], 0, [ignore], [ignore])
+AT_CLEANUP
Index: tests/regression/testsuite-simple_configuration.at
===================================================================
--- tests/regression/testsuite-simple_configuration.at	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/testsuite-simple_configuration.at	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -13,6 +13,6 @@
 AT_SETUP([Simple configuration - parsing xyz file])
 AT_KEYWORDS([configuration])
-AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz .], 0)
-AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp xyz -p test.xyz], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz parsertest.xyz], 0)
+AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp pdb xyz -p parsertest.xyz], 0, [ignore], [ignore])
 AT_CHECK([fgrep "Ion_Type1_1" test.conf], 0, [Ion_Type1_1	10.000000000	10.000000000	10.000000000	0 # molecule nr 0
 ], [ignore])
@@ -20,4 +20,5 @@
 AT_CHECK([file=test.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/$file], 0, [ignore], [ignore])
 AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=test.pdb; diff -I '.*created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/$file], 0, [ignore], [ignore])
 AT_CLEANUP
 
@@ -31,4 +32,13 @@
 AT_CHECK([../../molecuilder -i test2.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp xyz -a 1 --position "0., 0., -1."], 134, [ignore], [ignore])
 AT_CLEANUP
+AT_SETUP([Simple configuration - adding atom with Undo/Redo])
+AT_KEYWORDS([configuration])
+AT_CHECK([../../molecuilder -i empty.conf -o pcp -a 1 --position "10., 10., 10." --undo], 0, [ignore], [ignore])
+AT_CHECK([file=empty.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder -i test.conf -o mpqc pcp xyz -a 1 --position "10., 10., 10." --undo --redo], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=test.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
+AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
 
 # 4. change the element
@@ -37,4 +47,13 @@
 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/test.xyz test.xyz], 0)
 AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-atom-by-id 0 -E 6 ], 0, [ignore], [ignore])
+AT_CHECK([file=test.xyz; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
+AT_SETUP([Simple configuration - Changing element with Undo/Redo])
+AT_KEYWORDS([configuration])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/test.xyz test.xyz], 0)
+AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-atom-by-id 0 -E 6 --undo], 0, [ignore], [ignore])
+AT_CHECK([file=test.xyz; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/test.xyz test.xyz], 0)
+AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-atom-by-id 0 -E 6 --undo --redo], 0, [ignore], [ignore])
 AT_CHECK([file=test.xyz; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/post/$file], 0, [ignore], [ignore])
 AT_CLEANUP
@@ -48,4 +67,13 @@
 AT_CHECK([file=test.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/post/$file], 0, [ignore], [ignore])
 AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
+AT_SETUP([Simple configuration - Atom removal with Undo/Redo])
+AT_KEYWORDS([configuration])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/pre/test.conf .], 0)
+AT_CHECK([../../molecuilder -i test.conf --select-atom-by-id 0 -r --undo], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/pre/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/pre/test.conf .], 0)
+AT_CHECK([../../molecuilder -i test.conf --select-atom-by-id 0 -r --undo --redo], 0, [ignore], [ignore])
+AT_CHECK([file=test.conf; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/5/post/$file], 0, [ignore], [ignore])
 AT_CLEANUP
 
@@ -72,11 +100,85 @@
 AT_CLEANUP
 
-# 8. Removing sphere of atoms
+# 8. Removing _shape_ of atoms
 AT_SETUP([Simple configuration - Removing sphere of atoms])
 AT_KEYWORDS([configuration])
-AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.* .], 0)
-AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o xyz -R 7. --position "7.283585982, 3.275186040, 3.535886037"], 0, [stdout], [stderr])
-AT_CHECK([sort -n test.xyz | grep -v "Created by" >test.xyz-sorted], 0, [ignore], [ignore])
-AT_CHECK([sort -n ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/test.xyz  | grep -v "Created by" >${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/test.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-withoutsphere.xyz], 0)
+AT_CHECK([../../molecuilder -i test-withoutsphere.xyz --select-atoms-inside-sphere 7. --position "7.283585982, 3.275186040, 3.535886037" --angle-x 0. --angle-y 0. --angle-z 0. -r], 0, [stdout], [stderr])
+AT_CHECK([sort -n test-withoutsphere.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-withoutsphere.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([file=test-withoutsphere.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-sphere.xyz], 0)
+AT_CHECK([../../molecuilder -i test-sphere.xyz --select-all-atoms --unselect-atoms-inside-sphere 7. --position "7.283585982, 3.275186040, 3.535886037" --angle-x 0. --angle-y 0. --angle-z 0. -r], 0, [stdout], [stderr])
+AT_CHECK([sort -n test-sphere.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-sphere.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([file=test-sphere.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([cat test-sphere.xyz-sorted test-withoutsphere.xyz-sorted | sort -n >test.xyz-sorted], 0, [ignore], [ignore])
 AT_CHECK([file=test.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
 AT_CLEANUP
+AT_SETUP([Simple configuration - Removing sphere of atoms with Undo/Redo])
+AT_KEYWORDS([configuration])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz --select-atoms-inside-sphere 7. --position "7.283585982, 3.275186040, 3.535886037" --angle-x 0. --angle-y 0. --angle-z 0. -r --undo], 0, [stdout], [stderr])
+AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-withoutsphere.xyz], 0)
+AT_CHECK([../../molecuilder -i test-withoutsphere.xyz --select-atoms-inside-sphere 7. --position "7.283585982, 3.275186040, 3.535886037" --angle-x 0. --angle-y 0. --angle-z 0. -r --undo --redo], 0, [stdout], [stderr])
+AT_CHECK([sort -n test-withoutsphere.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-withoutsphere.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([file=test-withoutsphere.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz --select-all-atoms --unselect-atoms-inside-sphere 7. --position "7.283585982, 3.275186040, 3.535886037" --angle-x 0. --angle-y 0. --angle-z 0. -r --undo], 0, [stdout], [stderr])
+AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-sphere.xyz], 0)
+AT_CHECK([../../molecuilder -i test-sphere.xyz --select-all-atoms --unselect-atoms-inside-sphere 7. --position "7.283585982, 3.275186040, 3.535886037" --angle-x 0. --angle-y 0. --angle-z 0. -r --undo --redo], 0, [stdout], [stderr])
+AT_CHECK([sort -n test-sphere.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-sphere.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([file=test-sphere.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([cat test-sphere.xyz-sorted test-withoutsphere.xyz-sorted | sort -n >test.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([file=test.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
+
+AT_SETUP([Simple configuration - Removing cuboid of atoms])
+AT_KEYWORDS([configuration])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-withoutcuboid.xyz], 0)
+AT_CHECK([../../molecuilder -i test-withoutcuboid.xyz --select-atoms-inside-cuboid "2,2,2" --position "9.78,2.64,2.64" --angle-x 0. --angle-y 0. --angle-z 0. -r], 0, [stdout], [stderr])
+AT_CHECK([sort -n test-withoutcuboid.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-withoutcuboid.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([file=test-withoutcuboid.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-cuboid.xyz], 0)
+AT_CHECK([../../molecuilder -i test-cuboid.xyz --select-all-atoms --unselect-atoms-inside-cuboid "2,2,2" --position "9.78,2.64,2.64" --angle-x 0. --angle-y 0. --angle-z 0. -r], 0, [stdout], [stderr])
+AT_CHECK([sort -n test-cuboid.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-cuboid.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([file=test-cuboid.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([cat test-cuboid.xyz-sorted test-withoutcuboid.xyz-sorted | sort -n >test.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([file=test.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
+AT_SETUP([Simple configuration - Removing cuboid of atoms with Undo/Redo])
+AT_KEYWORDS([configuration])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz --select-atoms-inside-cuboid "2,2,2" --position "9.78,2.64,2.64" --angle-x 0. --angle-y 0. --angle-z 0. -r --undo], 0, [stdout], [stderr])
+AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-withoutcuboid.xyz], 0)
+AT_CHECK([../../molecuilder -i test-withoutcuboid.xyz --select-atoms-inside-cuboid "2,2,2" --position "9.78,2.64,2.64" --angle-x 0. --angle-y 0. --angle-z 0. -r --undo --redo], 0, [stdout], [stderr])
+AT_CHECK([sort -n test-withoutcuboid.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-withoutcuboid.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([file=test-withoutcuboid.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz --select-all-atoms --unselect-atoms-inside-cuboid "2,2,2" --position "9.78,2.64,2.64" --angle-x 0. --angle-y 0. --angle-z 0. -r --undo], 0, [stdout], [stderr])
+AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/$file], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.xyz test-cuboid.xyz], 0)
+AT_CHECK([../../molecuilder -i test-cuboid.xyz --select-all-atoms --unselect-atoms-inside-cuboid "2,2,2" --position "9.78,2.64,2.64" --angle-x 0. --angle-y 0. --angle-z 0. -r --undo --redo], 0, [stdout], [stderr])
+AT_CHECK([sort -n test-cuboid.xyz | grep -v -E "^[[[:digit:]]]+" | grep -v "Created by" >test-cuboid.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([file=test-cuboid.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
+AT_CHECK([cat test-cuboid.xyz-sorted test-withoutcuboid.xyz-sorted | sort -n >test.xyz-sorted], 0, [ignore], [ignore])
+AT_CHECK([file=test.xyz-sorted; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/$file], 0, [ignore], [ignore])
+AT_CLEANUP
+
+# 9. Undo and redo a translation
+AT_SETUP([Simple configuration - Translation])
+AT_KEYWORDS([configuration])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz --select-all-atoms -t "1,0,0"], 0, [stdout], [stderr])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/post/test-shifted.xyz], 0, [ignore], [ignore])
+AT_CLEANUP
+AT_SETUP([Simple configuration - Translation with Undo/Redo])
+AT_KEYWORDS([configuration])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz --select-all-atoms -t "1,0,0" --undo], 0, [stdout], [stderr])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/pre/test.xyz], 0, [ignore], [ignore])
+AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/pre/test.xyz .], 0)
+AT_CHECK([../../molecuilder -i test.xyz --select-all-atoms -t "1,0,0" --undo --redo], 0, [stdout], [stderr])
+AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/post/test-shifted.xyz], 0, [ignore], [ignore])
+AT_CLEANUP
Index: tests/regression/testsuite-standard_options.at
===================================================================
--- tests/regression/testsuite-standard_options.at	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/testsuite-standard_options.at	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -5,5 +5,12 @@
 AT_CHECK([pwd],[ignore],[ignore])
 AT_CHECK([../../molecuilder -v 1], 0, [stdout], [ignore])
-AT_CHECK([fgrep olecuilder stdout], 0, [ignore], [ignore])
+AT_CHECK([grep "Setting verbosity from .* to 1" stdout], 0, [ignore], [ignore])
+AT_CLEANUP
+AT_SETUP([Standard Options - verbosity with Undo/Redo])
+AT_KEYWORDS([options])
+AT_CHECK([../../molecuilder -v 1 --undo], 0, [stdout], [ignore])
+AT_CHECK([grep "Setting verbosity from 1 to .*" stdout], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder -v 1 --undo --redo], 0, [stdout], [ignore])
+AT_CHECK([grep "Setting verbosity from .* to 1" stdout], 0, [ignore], [ignore])
 AT_CLEANUP
 
@@ -53,4 +60,12 @@
 AT_CHECK([fgrep "I won't parse trajectories" stdout], 0, [ignore], [ignore])
 AT_CLEANUP
+AT_SETUP([Standard Options - fast trajectories with Undo/Redo])
+AT_KEYWORDS([options])
+AT_CHECK([../../molecuilder -i test.conf -n 1 --undo], 0, [stdout], [stderr])
+AT_CHECK([fgrep "I will parse trajectories." stdout], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder -i test.conf -n 1 --undo --redo], 0, [stdout], [stderr])
+AT_CHECK([grep -c "I won't parse trajectories" stdout], 0, 2
+, [ignore])
+AT_CLEANUP
 
 # 7. molecule default name
@@ -60,2 +75,9 @@
 AT_CHECK([fgrep "Default name of new molecules set to test." stdout], 0, [ignore], [ignore])
 AT_CLEANUP
+AT_SETUP([Standard Options - molecule default name with Undo/Redo])
+AT_KEYWORDS([options])
+AT_CHECK([../../molecuilder -i test.conf -X test --undo], 0, [stdout], [stderr])
+AT_CHECK([fgrep "Default name of new molecules set to none." stdout], 0, [ignore], [ignore])
+AT_CHECK([../../molecuilder -i test.conf -X test --undo --redo], 0, [stdout], [stderr])
+AT_CHECK([fgrep "Default name of new molecules set to test." stdout], 0, [ignore], [ignore])
+AT_CLEANUP
Index: tests/regression/testsuite.at
===================================================================
--- tests/regression/testsuite.at	(revision 45924c1c4900321275c7d22c75650d2dcff4a2c1)
+++ tests/regression/testsuite.at	(revision a6e6b5ce7c3675b17615ce9fc4f938f0ccc32ef7)
@@ -7,4 +7,6 @@
 AT_TESTED(diff fgrep grep)
 
+# Use colored output with new-enough Autotest.
+m4_ifdef([AT_COLOR_TESTS], [AT_COLOR_TESTS])
 
 m4_include(testsuite-standard_options.at)
