Index: src/atom.cpp
===================================================================
--- src/atom.cpp	(revision 4b0cbb5d713a46a9aed2ab44377f403ca3acc743)
+++ src/atom.cpp	(revision 9df5c6800ee6ef2b8e834cd973cc0c165a9587d6)
@@ -112,5 +112,5 @@
  * \return true - is inside, false - is not
  */
-bool atom::IsInParallelepiped(const Vector offset, const double *parallelepiped) const
+bool atom::IsInParallelepiped(const Vector offset, const Matrix& parallelepiped) const
 {
   return (node->IsInParallelepiped(offset, parallelepiped));
Index: src/atom.hpp
===================================================================
--- src/atom.hpp	(revision 4b0cbb5d713a46a9aed2ab44377f403ca3acc743)
+++ src/atom.hpp	(revision 9df5c6800ee6ef2b8e834cd973cc0c165a9587d6)
@@ -66,5 +66,5 @@
   double DistanceToVector(const Vector &origin) const;
   double DistanceSquaredToVector(const Vector &origin) const;
-  bool IsInParallelepiped(const Vector offset, const double *parallelepiped) const;
+  bool IsInParallelepiped(const Vector offset, const Matrix &parallelepiped) const;
 
   // getter and setter
Index: src/molecule.cpp
===================================================================
--- src/molecule.cpp	(revision 4b0cbb5d713a46a9aed2ab44377f403ca3acc743)
+++ src/molecule.cpp	(revision 9df5c6800ee6ef2b8e834cd973cc0c165a9587d6)
@@ -9,4 +9,5 @@
 #include <cstring>
 #include <boost/bind.hpp>
+#include <boost/foreach.hpp>
 
 #include "World.hpp"
@@ -659,8 +660,12 @@
  * @param three vectors forming the matrix that defines the shape of the parallelpiped
  */
-molecule* molecule::CopyMoleculeFromSubRegion(const Vector offset, const double *parallelepiped) const {
+molecule* molecule::CopyMoleculeFromSubRegion(const Vector offset, const Matrix &parallelepiped) const {
   molecule *copy = World::getInstance().createMolecule();
 
-  ActOnCopyWithEachAtomIfTrue ( &molecule::AddCopyAtom, copy, &atom::IsInParallelepiped, offset, parallelepiped );
+  BOOST_FOREACH(atom *iter,atoms){
+    if(iter->IsInParallelepiped(offset,parallelepiped)){
+      copy->AddCopyAtom(iter);
+    }
+  }
 
   //TODO: copy->BuildInducedSubgraph(this);
Index: src/molecule.hpp
===================================================================
--- src/molecule.hpp	(revision 4b0cbb5d713a46a9aed2ab44377f403ca3acc743)
+++ src/molecule.hpp	(revision 9df5c6800ee6ef2b8e834cd973cc0c165a9587d6)
@@ -316,5 +316,5 @@
 
   molecule *CopyMolecule();
-  molecule* CopyMoleculeFromSubRegion(const Vector offset, const double *parallelepiped) const;
+  molecule* CopyMoleculeFromSubRegion(const Vector offset, const Matrix &parallelepiped) const;
 
   /// Fragment molecule by two different approaches:
Index: src/unittests/vectorunittest.cpp
===================================================================
--- src/unittests/vectorunittest.cpp	(revision 4b0cbb5d713a46a9aed2ab44377f403ca3acc743)
+++ src/unittests/vectorunittest.cpp	(revision 9df5c6800ee6ef2b8e834cd973cc0c165a9587d6)
@@ -21,4 +21,5 @@
 #include "Plane.hpp"
 #include "Exceptions/LinearDependenceException.hpp"
+#include "Matrix.hpp"
 
 #ifdef HAVE_TESTRUNNER
@@ -221,14 +222,14 @@
 void VectorTest::IsInParallelepipedTest()
 {
-  double parallelepiped[NDIM*NDIM];
-  parallelepiped[0] = 1;
-  parallelepiped[1] = 0;
-  parallelepiped[2] = 0;
-  parallelepiped[3] = 0;
-  parallelepiped[4] = 1;
-  parallelepiped[5] = 0;
-  parallelepiped[6] = 0;
-  parallelepiped[7] = 0;
-  parallelepiped[8] = 1;
+  Matrix parallelepiped;
+  parallelepiped.at(0,0) = 1;
+  parallelepiped.at(1,0) = 0;
+  parallelepiped.at(2,0) = 0;
+  parallelepiped.at(0,1) = 0;
+  parallelepiped.at(1,1) = 1;
+  parallelepiped.at(2,1) = 0;
+  parallelepiped.at(0,2) = 0;
+  parallelepiped.at(1,2) = 0;
+  parallelepiped.at(2,2) = 1;
 
   fixture = zero;
Index: src/vector.cpp
===================================================================
--- src/vector.cpp	(revision 4b0cbb5d713a46a9aed2ab44377f403ca3acc743)
+++ src/vector.cpp	(revision 9df5c6800ee6ef2b8e834cd973cc0c165a9587d6)
@@ -601,7 +601,7 @@
  * @param three vectors forming the matrix that defines the shape of the parallelpiped
  */
-bool Vector::IsInParallelepiped(const Vector &offset, const double * const _parallelepiped) const
-{
-  Matrix parallelepiped = Matrix(_parallelepiped).invert();
+bool Vector::IsInParallelepiped(const Vector &offset, const Matrix& _parallelepiped) const
+{
+  Matrix parallelepiped = _parallelepiped.invert();
   Vector a = parallelepiped * ((*this)-offset);
   bool isInside = true;
Index: src/vector.hpp
===================================================================
--- src/vector.hpp	(revision 4b0cbb5d713a46a9aed2ab44377f403ca3acc743)
+++ src/vector.hpp	(revision 9df5c6800ee6ef2b8e834cd973cc0c165a9587d6)
@@ -62,5 +62,5 @@
   bool GetOneNormalVector(const Vector &x1);
   bool MakeNormalTo(const Vector &y1);
-  bool IsInParallelepiped(const Vector &offset, const double * const parallelepiped) const;
+  bool IsInParallelepiped(const Vector &offset, const Matrix& _parallelepiped) const;
   void WrapPeriodically(const Matrix &M, const Matrix &Minv);
   std::pair<Vector,Vector> partition(const Vector&) const;
