diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..36eacbb7eb9964e076a230834f1415b38c86a3ab
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,309 @@
+#######################################################################
+#                                                                     #
+#  Copyright 2019 Max Planck Institute                                #
+#                 for Dynamics and Self-Organization                  #
+#                                                                     #
+#  This file is part of bfps.                                         #
+#                                                                     #
+#  bfps is free software: you can redistribute it and/or modify       #
+#  it under the terms of the GNU General Public License as published  #
+#  by the Free Software Foundation, either version 3 of the License,  #
+#  or (at your option) any later version.                             #
+#                                                                     #
+#  bfps is distributed in the hope that it will be useful,            #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of     #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      #
+#  GNU General Public License for more details.                       #
+#                                                                     #
+#  You should have received a copy of the GNU General Public License  #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>       #
+#                                                                     #
+# Contact: Cristian.Lalescu@ds.mpg.de                                 #
+#                                                                     #
+#######################################################################
+
+
+
+cmake_minimum_required(VERSION 3.10)
+cmake_policy(VERSION 3.12)
+
+if (DEFINED ENV{MPICXX})
+    message(STATUS "Using CMAKE_CXX_COMPILER=MPICXX")
+    set(CMAKE_CXX_COMPILER $ENV{MPICXX})
+else()
+    message(STATUS "MPICXX environment variable undefined, trying to find MPI")
+    set(MPI_STATIC ON)
+    find_package(MPI REQUIRED)
+endif()
+
+if (DEFINED ENV{MPICC})
+    set(CMAKE_C_COMPILER $ENV{MPICC})
+    message(STATUS "Using CMAKE_C_COMPILER=MPICC")
+endif()
+
+if (DEFINED ENV{CMAKE_INSTALL_PREFIX})
+    set(CMAKE_INSTALL_PREFIX $ENV{CMAKE_INSTALL_PREFIX})
+endif()
+
+project(BFPS)
+
+execute_process(COMMAND python ${PROJECT_SOURCE_DIR}/get_version.py OUTPUT_VARIABLE BFPS_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+project(BFPS
+        VERSION ${BFPS_VERSION}
+        LANGUAGES CXX)
+
+
+set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/morse ${CMAKE_MODULE_PATH})
+set(BFPS_LIBS "")
+
+#####################################################################################
+## MPI
+
+set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} ${MPI_CXX_COMPILE_OPTIONS}")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MPI_CXX_LINK_FLAGS}")
+include_directories(${MPI_CXX_INCLUDE_DIRS})
+add_definitions(${MPI_CXX_COMPILE_DEFINITIONS})
+list(APPEND BFPS_LIBS "${MPI_CXX_LIBRARIES}")
+
+#####################################################################################
+## CXX Standard
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+# set(CMAKE_CXX_EXTENSIONS OFF)
+
+#####################################################################################
+## OpenMP
+
+find_package(OpenMP REQUIRED)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
+list(APPEND BFPS_LIBS "${OpenMP_CXX_LIB_NAMES}")
+
+#####################################################################################
+## Extra flags
+
+set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} $ENV{BFPS_OPTIMIZATION_FLAGS} -Wall -g")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_COMPILE_FLAGS}")
+
+#####################################################################################
+## HDF5
+
+set(HDF5_STATIC ON)
+if(NOT DEFINED ENV{HDF5_ROOT})
+    message(WARNING "The environment variable HDF5_ROOT is undefined, this might cause trouble in finding the HDF5")
+endif()
+
+set(HDF5_PREFER_PARALLEL TRUE)
+find_package(HDF5 REQUIRED)
+
+message(STATUS "HDF5_C_INCLUDE_DIRS ${HDF5_C_INCLUDE_DIRS}")
+
+include_directories(${HDF5_C_INCLUDE_DIRS})
+add_definitions(${HDF5_C_DEFINITIONS})
+list(APPEND BFPS_LIBS "${HDF5_C_LIBRARIES}")
+
+option(BFPS_HDF5_USE_SZIP "Set to on to also link against SZIP" OFF)
+
+if(BFPS_HDF5_USE_SZIP)
+    option(BFPS_HDF5_SZIP_LIB_PATH "Additional lib path for SZIP" "")
+    if(BFPS_HDF5_SZIP_LIB_PATH)
+        link_directories(${BFPS_HDF5_SZIP_LIB_PATH})
+    endif()
+    list(APPEND BFPS_LIBS "z")
+endif()
+
+#####################################################################################
+## FFTW
+
+set(FFTW_STATIC ON)
+if(NOT DEFINED ENV{FFTW_DIR})
+    message(WARNING "The environment variable FFTW_DIR is undefined, this might cause trouble in finding the FFTW")
+endif()
+
+find_package(FFTW REQUIRED OMP)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FFTW_CFLAGS_OTHER}")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FFTW_LDFLAGS_OTHER}")
+list(APPEND BFPS_LIBS "${FFTW_LIBRARIES}")
+include_directories(${FFTW_INCLUDE_DIRS})
+link_directories(${FFTW_LIBRARY_DIRS})
+
+find_package(FFTW REQUIRED OMP SIMPLE)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FFTW_CFLAGS_OTHER}")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FFTW_LDFLAGS_OTHER}")
+list(APPEND BFPS_LIBS "${FFTW_LIBRARIES}")
+include_directories(${FFTW_INCLUDE_DIRS})
+link_directories(${FFTW_LIBRARY_DIRS})
+
+# hack for FFTW MPI libs
+find_library(
+    FFTWF_MPI fftw3f_mpi
+    HINTS ${FFTW_LIBRARY_DIRS})
+set(BFPS_LIBS ${FFTWF_MPI} ${BFPS_LIBS})
+find_library(
+    FFTW_MPI fftw3_mpi
+    HINTS ${FFTW_LIBRARY_DIRS})
+set(BFPS_LIBS ${FFTW_MPI} ${BFPS_LIBS})
+
+
+#####################################################################################
+## Get the links and include from deps
+
+get_property(ALL_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
+get_property(ALL_LINK_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY LINK_DIRECTORIES)
+
+#####################################################################################
+## Build the lib
+
+include_directories(${PROJECT_SOURCE_DIR}/cpp)
+
+#file(GLOB_RECURSE cpp_for_lib ${PROJECT_SOURCE_DIR}/*.cpp)
+set(cpp_for_lib
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/code_base.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/direct_numerical_simulation.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVE.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/joint_acc_vel_stats.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/test.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/filter_test.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/field_test.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/symmetrize_test.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/field_output_test.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/get_rfields.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/field_single_to_double.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/resize.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVE_field_stats.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/native_binary_to_hdf5.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/postprocess.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/field.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/kspace.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/field_layout.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/hdf5_tools.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/fftw_tools.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/vorticity_equation.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/field_binary_IO.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n1.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n2.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n3.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n4.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n5.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n6.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n7.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n8.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n9.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n10.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/Lagrange_polys.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/scope_timer.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/test_interpolation.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEparticles.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEcomplex_particles.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEp_extra_sampling.cpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_inner_computer.cpp)
+set(hpp_for_lib
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/code_base.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/direct_numerical_simulation.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVE.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/joint_acc_vel_stats.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/test.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/filter_test.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/field_test.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/symmetrize_test.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/field_output_test.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/get_rfields.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/field_single_to_double.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/resize.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVE_field_stats.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/native_binary_to_hdf5.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/postprocess.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/field.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/kspace.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/field_layout.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/hdf5_tools.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/fftw_tools.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/vorticity_equation.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/field_binary_IO.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n1.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n2.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n3.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n4.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n5.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n6.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n7.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n8.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n9.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline_n10.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/Lagrange_polys.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/scope_timer.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/test_interpolation.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEparticles.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEcomplex_particles.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEp_extra_sampling.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_inner_computer.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/abstract_particles_input.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/abstract_particles_output.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/abstract_particles_system.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/alltoall_exchanger.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/env_utils.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/lock_free_bool_array.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/p2p_computer_empty.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/p2p_computer.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/p2p_distr_mpi.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/p2p_tree.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_adams_bashforth.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_distr_mpi.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_field_computer.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_generic_interp.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_inner_computer_empty.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_input_hdf5.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_output_hdf5.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_output_mpiio.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_output_sampling_hdf5.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_sampling.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_system_builder.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_system.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/particles/particles_utils.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/main_code.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/codes_with_no_output.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVE_no_output.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/full_code/NSVEparticles_no_output.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/base.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/fftw_interface.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/bfps_timer.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/omputils.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/shared_array.hpp
+    ${PROJECT_SOURCE_DIR}/cpp/spline.hpp
+    )
+#file(GLOB_RECURSE hpp_for_lib ${PROJECT_SOURCE_DIR}/*.hpp)
+LIST(APPEND source_files ${hpp_for_lib} ${cpp_for_lib})
+
+add_library(bfps ${source_files})
+
+target_link_libraries(bfps ${BFPS_LIBS})
+
+install(TARGETS bfps EXPORT BFPS_EXPORT DESTINATION lib/ )
+install(DIRECTORY ${PROJECT_SOURCE_DIR}/cpp/ DESTINATION include/bfps/ FILES_MATCHING PATTERN "*.h*")
+
+#####################################################################################
+## Export the configuration
+
+configure_file(${PROJECT_SOURCE_DIR}/cmake/BFPSConfig.cmake.in ${PROJECT_BINARY_DIR}/BFPSConfig.cmake @ONLY)
+
+install(FILES "${PROJECT_BINARY_DIR}/BFPSConfig.cmake" DESTINATION lib/)
+export(TARGETS bfps FILE "${PROJECT_BINARY_DIR}/BFPSLibraryDepends.cmake")
+install(EXPORT BFPS_EXPORT DESTINATION lib/)
+
+
+#####################################################################################
+## Install the python wrapper
+# copy command
+install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/bfps ${PROJECT_BINARY_DIR}/python/bfps/)")
+if(EXISTS "${PROJECT_SOURCE_DIR}/host_info.py")
+    install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/host_info.py ${PROJECT_BINARY_DIR}/python/bfps/)")
+else()
+    install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/pc_host_info.py ${PROJECT_BINARY_DIR}/python/bfps/host_info.py)")
+endif()
+install(CODE "execute_process(COMMAND python ${PROJECT_SOURCE_DIR}/setup.py install --force --prefix=${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/python/)")
+
diff --git a/README.rst b/README.rst
index e4f6d1107ee7e2a184cbafa22be3ecde60d361d5..7dc457a7b00c99feec225d73b446ead083ef0a00 100644
--- a/README.rst
+++ b/README.rst
@@ -58,36 +58,10 @@ Use a console; navigate to the ``bfps`` folder, and type:
 **Full installation**
 
 If you want to run simulations on the machine where you're installing,
-you will need to call `compile_library` before installing.
+you will need to use `cmake` to compile and install the full library.
 Your machine needs to have an MPI compiler installed, the HDF5 C library
-and FFTW >= 3.4 --- a detailed prerequisite installation list is
+and FFTW >= 3.4 --- detailed instructions are
 included at the end of this document.
-The file `machine_settings_py.py` should be modified
-appropriately for your machine (otherwise the `compile_library` command will most
-likely fail).
-This file will be copied the first time you run `setup.py` into
-`$HOME/.config/bfps/machine_settings.py`, **where it will be imported from
-afterwards** --- any future edits **must** be made to the new file.
-You may, obviously, edit it afterwards and rerun the `compile_library` command as
-needed.
-
-.. code:: bash
-
-    python setup.py compile_library
-    python setup.py install
-
-For `machine_settings.py`, please keep in mind to turn on optimizations
-for production environments.
-In particular, for clusters of unknown architecture it helps to log into
-individual nodes and run the following command:
-
-.. code:: bash
-
-    gcc -march=native -Q --help=target
-
-The results can be used to then compile on the frontend node(s) without
-using `-march=native` (since the frontend node may have different
-architecture).
 
 -------------
 Documentation
@@ -96,8 +70,8 @@ Documentation
 While the code is not fully documented yet, basic information is already
 available, and it is recommended that you generate the manual and go
 through it carefully.
-Please don't be shy about asking for specific improvements to the
-current text.
+Please do ask for specific improvements to the current text where it is
+found lacking.
 In order to generate the manual, navigate to the repository folder, and
 execute the following commands:
 
@@ -113,12 +87,18 @@ type ``make html`` instead of ``make latexpdf``.
 Comments
 --------
 
+* the `cmake` folder contains files extracted from
+  https://gitlab.inria.fr/solverstack/morse_cmake, a separate project licensed
+  under the "CeCILL-C" license, please see
+  http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html for
+  details.
+
 * particles: initialization of multistep solvers is done with lower
   order methods, so direct convergence tests will fail.
 
-* Code is only known to work with HDF5 1.8.x.
+* code is only known to work with HDF5 1.8.x.
 
-* Code is used mainly with Python 3.5 and later, and it is not tested at
+* code is used mainly with Python 3.5 and later, and it is not tested at
   all with Python 2.x
 
 -------------------------------
@@ -127,54 +107,93 @@ Installation with prerequisites
 
 These installation steps assume that you have a working MPI compiler,
 properly configured on your system (i.e. the various configure scripts
-are able to find it).
-If this is not the case, please consult the FFTW and HDF5 compilation
-instructions for detailed instructions (`./configure --help` should be
-enough).
+are able to find it), as well as the `cmake` tool.
+We recommend to specify the desired MPI C++ compiler by exporting the
+environment variable `MPICXX` --- the BFPS cmake configuration looks for
+this variable.
+We also recommend that an environment variable `BFPS_OPTIMIZATION_FLAGS`
+is defined appropriately.
+In particular, for clusters of unknown architecture it helps to log into
+individual nodes and run the following command:
 
-1. Make directory PREFIX on local fast partition.
+.. code:: bash
+
+    gcc -march=native -Q --help=target
+
+Detailed full installation instructions:
+
+1. Make directory PREFIX on a local fast partition.
 
 2. Download, compile, install FFTW (latest version 3.x from http://www.fftw.org/).
    Execute the following commands in order, feel free to customize
-   optimisation flags for your own computer:
+   optimisation flags for your own computer (see http://www.fftw.org/fftw3_doc/Installation-on-Unix.html):
 
-.. code:: bash
+    .. code:: bash
 
-    ./configure --prefix=PREFIX --enable-single --enable-sse --enable-mpi --enable-openmp --enable-threads
-    make
-    make install
-    ./configure --prefix=PREFIX --enable-sse2 --enable-mpi --enable-openmp --enable-threads
-    make
-    make install
+        ./configure --prefix=PREFIX --enable-float --enable-sse --enable-mpi --enable-openmp --enable-threads
+        make
+        make install
+        ./configure --prefix=PREFIX  --enable-sse2 --enable-avx512 --enable-mpi --enable-openmp --enable-threads
+        make
+        make install
+
+   BFPS will try to find FFTW using the FindFFTW from the Morse project.
+   If the package is installed in a non standard location, it is recommanded
+   to setup the environment variables: `FFTW_DIR` (or `FFTW_INCDIR` and `FFTW_LIBDIR`).
 
 3. Download, compile, install HDF5 (version 1.8.x, currently available
-   at https://support.hdfgroup.org/HDF5/release/obtainsrc518.html.
-   We are using parallel I/O, therefore we use the plain C interface of HDF5:
+   at https://portal.hdfgroup.org/display/support/HDF5+1.8.20#files).
+   We are using parallel I/O, therefore we must use the plain C interface of HDF5:
 
-.. code:: bash
+    .. code:: bash
 
-    ./configure --prefix=PREFIX --enable-parallel
-    make
-    make install
+        ./configure --prefix=PREFIX --enable-parallel
+        make
+        make install
 
-3. This step may be ommited.
-   I recommend the creation of a virtual python3 environment (also under PREFIX) that will be used for installing bfps and dependencies.
+   BFPS will try to find HDF5 using the regular FindHDF5.
+   Therefore, if the package is installed in a non standard location, it is recommanded
+   to setup the environment variable: HDF5_ROOT.
+
+3. Optional.
+   We recommend the creation of a virtual python3 environment (also under PREFIX) that will be used for installing bfps and dependencies.
    Please see https://docs.python-guide.org/dev/virtualenvs/.
 
 4. Clone bfps repository.
 
-.. code:: bash
+    .. code:: bash
 
-    git clone git@gitlab.mpcdf.mpg.de:clalescu/bfps.git
+        git clone git@gitlab.mpcdf.mpg.de:clalescu/bfps.git
 
-5. Tweak host_information.py and machine_settings.py for your user and your machine and place under ~/.config/bfps.
+5. Go into bfps repository, execute
 
-6. Activate virtual environment.
+    .. code:: bash
 
-7. Go into bfps repository, execute
+        mkdir build
+        cd build
+        cmake ..
+        # possibly : cmake .. -DCMAKE_INSTALL_PREFIX=INSTALL_DIR
+        make
+        # to get a verbose compilation process, use
+        VERBOSE=1 make
+        make install
 
-.. code:: bash
+6. If you used a custom install location (i.e. `CMAKE_INSTALL_PREFIX`)
+   you must include this location in the environment variable
+   `CMAKE_PREFIX_PATH`.
+   This ensures that the required `BFPSConfig.cmake` file is accessible for
+   future use by the package.
 
-    python setup.py compile_library
-    python setup.py install
+7. Using BFPS from an external project.
+   BFPS creates and installs 3 files alongside the C++ headers and
+   library:
+
+    .. code:: bash
+
+        -- Installing: install/lib/BFPSConfig.cmake
+        -- Installing: install/lib/BFPS_EXPORT.cmake
+        -- Installing: install/lib/BFPS_EXPORT-noconfig.cmake
+
+   In case these files provide incomplete information, it is necessary to update
+   the cmake input config file: bfps/cmake/BFPSConfig.cmake.in.
 
diff --git a/bfps/DNS.py b/bfps/DNS.py
index 909b5bb42accfc73b5325d6b0e3b40d8f3c7b86a..a1ab8d154a6533d286406811ae511b8e05ac1448 100644
--- a/bfps/DNS.py
+++ b/bfps/DNS.py
@@ -1,26 +1,25 @@
-#######################################################################
-#                                                                     #
-#  Copyright 2015 Max Planck Institute                                #
-#                 for Dynamics and Self-Organization                  #
-#                                                                     #
-#  This file is part of bfps.                                         #
-#                                                                     #
-#  bfps is free software: you can redistribute it and/or modify       #
-#  it under the terms of the GNU General Public License as published  #
-#  by the Free Software Foundation, either version 3 of the License,  #
-#  or (at your option) any later version.                             #
-#                                                                     #
-#  bfps is distributed in the hope that it will be useful,            #
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of     #
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      #
-#  GNU General Public License for more details.                       #
-#                                                                     #
-#  You should have received a copy of the GNU General Public License  #
-#  along with bfps.  If not, see <http://www.gnu.org/licenses/>       #
-#                                                                     #
-# Contact: Cristian.Lalescu@ds.mpg.de                                 #
-#                                                                     #
-#######################################################################
+################################################################################
+#                                                                              #
+#  Copyright 2015-2019 Max Planck Institute for Dynamics and Self-Organization #
+#                                                                              #
+#  This file is part of bfps.                                                  #
+#                                                                              #
+#  bfps is free software: you can redistribute it and/or modify                #
+#  it under the terms of the GNU General Public License as published           #
+#  by the Free Software Foundation, either version 3 of the License,           #
+#  or (at your option) any later version.                                      #
+#                                                                              #
+#  bfps is distributed in the hope that it will be useful,                     #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+#  GNU General Public License for more details.                                #
+#                                                                              #
+#  You should have received a copy of the GNU General Public License           #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>                #
+#                                                                              #
+# Contact: Cristian.Lalescu@ds.mpg.de                                          #
+#                                                                              #
+################################################################################
 
 
 
@@ -50,12 +49,6 @@ class DNS(_code):
                 self,
                 work_dir = work_dir,
                 simname = simname)
-        self.host_info = {'type'        : 'cluster',
-                          'environment' : None,
-                          'deltanprocs' : 1,
-                          'queue'       : '',
-                          'mail_address': '',
-                          'mail_events' : None}
         self.generate_default_parameters()
         self.statistics = {}
         return None
diff --git a/bfps/PP.py b/bfps/PP.py
index 72e693d44fda86d559877b43b789f752fb89b8c4..cea45430db48cf62b142ea2230b833ca1dff5f88 100644
--- a/bfps/PP.py
+++ b/bfps/PP.py
@@ -1,26 +1,25 @@
-#######################################################################
-#                                                                     #
-#  Copyright 2015 Max Planck Institute                                #
-#                 for Dynamics and Self-Organization                  #
-#                                                                     #
-#  This file is part of bfps.                                         #
-#                                                                     #
-#  bfps is free software: you can redistribute it and/or modify       #
-#  it under the terms of the GNU General Public License as published  #
-#  by the Free Software Foundation, either version 3 of the License,  #
-#  or (at your option) any later version.                             #
-#                                                                     #
-#  bfps is distributed in the hope that it will be useful,            #
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of     #
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      #
-#  GNU General Public License for more details.                       #
-#                                                                     #
-#  You should have received a copy of the GNU General Public License  #
-#  along with bfps.  If not, see <http://www.gnu.org/licenses/>       #
-#                                                                     #
-# Contact: Cristian.Lalescu@ds.mpg.de                                 #
-#                                                                     #
-#######################################################################
+################################################################################
+#                                                                              #
+#  Copyright 2015-2019 Max Planck Institute for Dynamics and Self-Organization #
+#                                                                              #
+#  This file is part of bfps.                                                  #
+#                                                                              #
+#  bfps is free software: you can redistribute it and/or modify                #
+#  it under the terms of the GNU General Public License as published           #
+#  by the Free Software Foundation, either version 3 of the License,           #
+#  or (at your option) any later version.                                      #
+#                                                                              #
+#  bfps is distributed in the hope that it will be useful,                     #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+#  GNU General Public License for more details.                                #
+#                                                                              #
+#  You should have received a copy of the GNU General Public License           #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>                #
+#                                                                              #
+# Contact: Cristian.Lalescu@ds.mpg.de                                          #
+#                                                                              #
+################################################################################
 
 
 
@@ -51,12 +50,6 @@ class PP(_code):
                 self,
                 work_dir = work_dir,
                 simname = simname)
-        self.host_info = {'type'        : 'cluster',
-                          'environment' : None,
-                          'deltanprocs' : 1,
-                          'queue'       : '',
-                          'mail_address': '',
-                          'mail_events' : None}
         self.generate_default_parameters()
         return None
     def set_precision(
diff --git a/bfps/TEST.py b/bfps/TEST.py
index 66b2b4aad6b308c78735005f55765bfa3d3eb98c..2edcdfe46a8cf47360ac5a7dae28b72d1e81978d 100644
--- a/bfps/TEST.py
+++ b/bfps/TEST.py
@@ -1,26 +1,25 @@
-#######################################################################
-#                                                                     #
-#  Copyright 2015 Max Planck Institute                                #
-#                 for Dynamics and Self-Organization                  #
-#                                                                     #
-#  This file is part of bfps.                                         #
-#                                                                     #
-#  bfps is free software: you can redistribute it and/or modify       #
-#  it under the terms of the GNU General Public License as published  #
-#  by the Free Software Foundation, either version 3 of the License,  #
-#  or (at your option) any later version.                             #
-#                                                                     #
-#  bfps is distributed in the hope that it will be useful,            #
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of     #
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      #
-#  GNU General Public License for more details.                       #
-#                                                                     #
-#  You should have received a copy of the GNU General Public License  #
-#  along with bfps.  If not, see <http://www.gnu.org/licenses/>       #
-#                                                                     #
-# Contact: Cristian.Lalescu@ds.mpg.de                                 #
-#                                                                     #
-#######################################################################
+################################################################################
+#                                                                              #
+#  Copyright 2015-2019 Max Planck Institute for Dynamics and Self-Organization #
+#                                                                              #
+#  This file is part of bfps.                                                  #
+#                                                                              #
+#  bfps is free software: you can redistribute it and/or modify                #
+#  it under the terms of the GNU General Public License as published           #
+#  by the Free Software Foundation, either version 3 of the License,           #
+#  or (at your option) any later version.                                      #
+#                                                                              #
+#  bfps is distributed in the hope that it will be useful,                     #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+#  GNU General Public License for more details.                                #
+#                                                                              #
+#  You should have received a copy of the GNU General Public License           #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>                #
+#                                                                              #
+# Contact: Cristian.Lalescu@ds.mpg.de                                          #
+#                                                                              #
+################################################################################
 
 
 
@@ -51,12 +50,6 @@ class TEST(_code):
                 self,
                 work_dir = work_dir,
                 simname = simname)
-        self.host_info = {'type'        : 'cluster',
-                          'environment' : None,
-                          'deltanprocs' : 1,
-                          'queue'       : '',
-                          'mail_address': '',
-                          'mail_events' : None}
         self.generate_default_parameters()
         return None
     def set_precision(
diff --git a/bfps/__init__.py b/bfps/__init__.py
index babbc203cc6ea1f788458415147d4a48f3b328f1..9595bee4d6885aaa4be4cfc252f605be835e7e64 100644
--- a/bfps/__init__.py
+++ b/bfps/__init__.py
@@ -1,26 +1,25 @@
-#######################################################################
-#                                                                     #
-#  Copyright 2015 Max Planck Institute                                #
-#                 for Dynamics and Self-Organization                  #
-#                                                                     #
-#  This file is part of bfps.                                         #
-#                                                                     #
-#  bfps is free software: you can redistribute it and/or modify       #
-#  it under the terms of the GNU General Public License as published  #
-#  by the Free Software Foundation, either version 3 of the License,  #
-#  or (at your option) any later version.                             #
-#                                                                     #
-#  bfps is distributed in the hope that it will be useful,            #
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of     #
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      #
-#  GNU General Public License for more details.                       #
-#                                                                     #
-#  You should have received a copy of the GNU General Public License  #
-#  along with bfps.  If not, see <http://www.gnu.org/licenses/>       #
-#                                                                     #
-# Contact: Cristian.Lalescu@ds.mpg.de                                 #
-#                                                                     #
-#######################################################################
+################################################################################
+#                                                                              #
+#  Copyright 2015-2019 Max Planck Institute for Dynamics and Self-Organization #
+#                                                                              #
+#  This file is part of bfps.                                                  #
+#                                                                              #
+#  bfps is free software: you can redistribute it and/or modify                #
+#  it under the terms of the GNU General Public License as published           #
+#  by the Free Software Foundation, either version 3 of the License,           #
+#  or (at your option) any later version.                                      #
+#                                                                              #
+#  bfps is distributed in the hope that it will be useful,                     #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+#  GNU General Public License for more details.                                #
+#                                                                              #
+#  You should have received a copy of the GNU General Public License           #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>                #
+#                                                                              #
+# Contact: Cristian.Lalescu@ds.mpg.de                                          #
+#                                                                              #
+################################################################################
 
 
 
@@ -38,13 +37,8 @@ here = os.path.normcase(__file__)
 header_dir = os.path.join(os.path.join(dist_loc, 'bfps'), 'cpp')
 lib_dir = os.path.join(dist_loc, 'bfps')
 
-install_info = pickle.load(
-        open(os.path.join(os.path.dirname(here), 'install_info.pickle'), 'rb'))
-
 homefolder = os.path.expanduser('~')
-bfpsfolder = os.path.join(homefolder, '.config/', 'bfps')
-sys.path.append(bfpsfolder)
-from host_information import host_info
+from .host_info import host_info
 
 from .DNS import DNS
 from .PP import PP
diff --git a/bfps/__main__.py b/bfps/__main__.py
index cf269edbaea91acd4b3de595782b92e32e1cbd3b..187171d049580498c82ea8551fa5728515c69845 100644
--- a/bfps/__main__.py
+++ b/bfps/__main__.py
@@ -1,26 +1,25 @@
-#######################################################################
-#                                                                     #
-#  Copyright 2015 Max Planck Institute                                #
-#                 for Dynamics and Self-Organization                  #
-#                                                                     #
-#  This file is part of bfps.                                         #
-#                                                                     #
-#  bfps is free software: you can redistribute it and/or modify       #
-#  it under the terms of the GNU General Public License as published  #
-#  by the Free Software Foundation, either version 3 of the License,  #
-#  or (at your option) any later version.                             #
-#                                                                     #
-#  bfps is distributed in the hope that it will be useful,            #
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of     #
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      #
-#  GNU General Public License for more details.                       #
-#                                                                     #
-#  You should have received a copy of the GNU General Public License  #
-#  along with bfps.  If not, see <http://www.gnu.org/licenses/>       #
-#                                                                     #
-# Contact: Cristian.Lalescu@ds.mpg.de                                 #
-#                                                                     #
-#######################################################################
+################################################################################
+#                                                                              #
+#  Copyright 2015-2019 Max Planck Institute for Dynamics and Self-Organization #
+#                                                                              #
+#  This file is part of bfps.                                                  #
+#                                                                              #
+#  bfps is free software: you can redistribute it and/or modify                #
+#  it under the terms of the GNU General Public License as published           #
+#  by the Free Software Foundation, either version 3 of the License,           #
+#  or (at your option) any later version.                                      #
+#                                                                              #
+#  bfps is distributed in the hope that it will be useful,                     #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+#  GNU General Public License for more details.                                #
+#                                                                              #
+#  You should have received a copy of the GNU General Public License           #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>                #
+#                                                                              #
+# Contact: Cristian.Lalescu@ds.mpg.de                                          #
+#                                                                              #
+################################################################################
 
 
 
diff --git a/bfps/_base.py b/bfps/_base.py
index 086adea3e97d924b5d546b0e34e8853f023a6ba2..a6e8d14198cabef78becba7680a8b1d207de33c4 100644
--- a/bfps/_base.py
+++ b/bfps/_base.py
@@ -1,26 +1,25 @@
-#######################################################################
-#                                                                     #
-#  Copyright 2015 Max Planck Institute                                #
-#                 for Dynamics and Self-Organization                  #
-#                                                                     #
-#  This file is part of bfps.                                         #
-#                                                                     #
-#  bfps is free software: you can redistribute it and/or modify       #
-#  it under the terms of the GNU General Public License as published  #
-#  by the Free Software Foundation, either version 3 of the License,  #
-#  or (at your option) any later version.                             #
-#                                                                     #
-#  bfps is distributed in the hope that it will be useful,            #
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of     #
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      #
-#  GNU General Public License for more details.                       #
-#                                                                     #
-#  You should have received a copy of the GNU General Public License  #
-#  along with bfps.  If not, see <http://www.gnu.org/licenses/>       #
-#                                                                     #
-# Contact: Cristian.Lalescu@ds.mpg.de                                 #
-#                                                                     #
-#######################################################################
+################################################################################
+#                                                                              #
+#  Copyright 2015-2019 Max Planck Institute for Dynamics and Self-Organization #
+#                                                                              #
+#  This file is part of bfps.                                                  #
+#                                                                              #
+#  bfps is free software: you can redistribute it and/or modify                #
+#  it under the terms of the GNU General Public License as published           #
+#  by the Free Software Foundation, either version 3 of the License,           #
+#  or (at your option) any later version.                                      #
+#                                                                              #
+#  bfps is distributed in the hope that it will be useful,                     #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+#  GNU General Public License for more details.                                #
+#                                                                              #
+#  You should have received a copy of the GNU General Public License           #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>                #
+#                                                                              #
+# Contact: Cristian.Lalescu@ds.mpg.de                                          #
+#                                                                              #
+################################################################################
 
 
 
@@ -28,7 +27,6 @@ import os
 import sys
 import numpy as np
 import h5py
-from bfps import install_info
 from bfps import __version__
 
 class _base(object):
@@ -175,8 +173,7 @@ class _base(object):
                 ofile['parameters/' + k] = self.parameters[k]
         ofile['iteration'] = int(iter0)
         ofile['bfps_info/solver_class'] = type(self).__name__
-        for k in install_info.keys():
-            ofile['bfps_info/' + k] = str(install_info[k])
+        ofile['bfps_info/VERSION'] = __version__
         ofile.close()
         return None
     def rewrite_par(
diff --git a/bfps/_code.py b/bfps/_code.py
index d791be619432971e11af9f3ae8302087a12301be..be3455428fa362b5d24e251bd4aaa2f5ab5dafa9 100644
--- a/bfps/_code.py
+++ b/bfps/_code.py
@@ -1,26 +1,25 @@
-#######################################################################
-#                                                                     #
-#  Copyright 2015 Max Planck Institute                                #
-#                 for Dynamics and Self-Organization                  #
-#                                                                     #
-#  This file is part of bfps.                                         #
-#                                                                     #
-#  bfps is free software: you can redistribute it and/or modify       #
-#  it under the terms of the GNU General Public License as published  #
-#  by the Free Software Foundation, either version 3 of the License,  #
-#  or (at your option) any later version.                             #
-#                                                                     #
-#  bfps is distributed in the hope that it will be useful,            #
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of     #
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      #
-#  GNU General Public License for more details.                       #
-#                                                                     #
-#  You should have received a copy of the GNU General Public License  #
-#  along with bfps.  If not, see <http://www.gnu.org/licenses/>       #
-#                                                                     #
-# Contact: Cristian.Lalescu@ds.mpg.de                                 #
-#                                                                     #
-#######################################################################
+################################################################################
+#                                                                              #
+#  Copyright 2015-2019 Max Planck Institute for Dynamics and Self-Organization #
+#                                                                              #
+#  This file is part of bfps.                                                  #
+#                                                                              #
+#  bfps is free software: you can redistribute it and/or modify                #
+#  it under the terms of the GNU General Public License as published           #
+#  by the Free Software Foundation, either version 3 of the License,           #
+#  or (at your option) any later version.                                      #
+#                                                                              #
+#  bfps is distributed in the hope that it will be useful,                     #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+#  GNU General Public License for more details.                                #
+#                                                                              #
+#  You should have received a copy of the GNU General Public License           #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>                #
+#                                                                              #
+# Contact: Cristian.Lalescu@ds.mpg.de                                          #
+#                                                                              #
+################################################################################
 
 
 
@@ -35,6 +34,7 @@ import math
 import warnings
 
 import bfps
+from bfps.host_info import host_info
 from ._base import _base
 
 class _code(_base):
@@ -174,12 +174,7 @@ class _code(_base):
                 }
                 //endcpp
                 """
-        self.host_info = {'type'        : 'cluster',
-                          'environment' : None,
-                          'deltanprocs' : 1,
-                          'queue'       : '',
-                          'mail_address': '',
-                          'mail_events' : None}
+        self.host_info = host_info
         self.main = ''
         return None
     def write_src(self):
@@ -196,38 +191,52 @@ class _code(_base):
         return None
     def compile_code(
             self,
-            no_debug = False):
+            no_debug = True):
+        if os.path.exists(os.path.join(self.work_dir, self.name)):
+            return 0
         # compile code
-        if not os.path.isfile(os.path.join(bfps.header_dir, 'base.hpp')):
-            raise IOError('header not there:\n' +
-                          '{0}\n'.format(os.path.join(bfps.header_dir, 'base.hpp')) +
-                          '{0}\n'.format(bfps.dist_loc))
-        libraries = ['bfps']
-        libraries += bfps.install_info['libraries']
-
-        command_strings = [bfps.install_info['compiler']]
-        command_strings += [self.name + '.cpp', '-o', self.name]
-        command_strings += bfps.install_info['extra_compile_args']
-        if no_debug:
-            command_strings += ['-DNDEBUG']
-        command_strings += ['-I' + idir for idir in bfps.install_info['include_dirs']]
-        command_strings.append('-I' + bfps.header_dir)
-        command_strings += ['-L' + ldir for ldir in bfps.install_info['library_dirs']]
-        command_strings += ['-Wl,-rpath=' + ldir for ldir in bfps.install_info['library_dirs']]
-        command_strings.append('-L' + bfps.lib_dir)
-        command_strings.append('-Wl,-rpath=' + bfps.lib_dir)
-
-        for libname in libraries:
-            if libname[0] not in ['-', '/']:
-                command_strings += ['-l' + libname]
-            else:
-                command_strings += [libname]
-
-        command_strings += ['-fopenmp']
-
+        build_dir = 'bfps_build_' + self.name
+        os.makedirs(build_dir, exist_ok = True)
+        os.chdir(build_dir)
         self.write_src()
-        print('compiling code with command\n' + ' '.join(command_strings))
-        return subprocess.check_call(command_strings)
+        with open('CMakeLists.txt', 'w') as outfile:
+            outfile.write('cmake_minimum_required(VERSION 3.10)\n')
+            outfile.write('cmake_policy(VERSION 3.12)\n')
+            outfile.write('if (DEFINED ENV{MPICXX})\n')
+            outfile.write('    message(STATUS "Using CMAKE_CXX_COMPILER=MPICXX")\n')
+            outfile.write('    set(CMAKE_CXX_COMPILER $ENV{MPICXX})\n')
+            outfile.write('else()\n')
+            outfile.write('    message(STATUS "MPICXX environment variable undefined, trying to find MPI")\n')
+            outfile.write('    set(MPI_STATIC ON)\n')
+            outfile.write('    find_package(MPI REQUIRED)\n')
+            outfile.write('endif()\n')
+            outfile.write('if (DEFINED ENV{MPICC})\n')
+            outfile.write('    set(CMAKE_C_COMPILER $ENV{MPICC})\n')
+            outfile.write('    message(STATUS "Using CMAKE_C_COMPILER=MPICC")\n')
+            outfile.write('endif()\n')
+            #ideally we should use something like the following 2 lines
+            #outfile.write('set(CMAKE_CXX_COMPILER ${BFPS_CXX_COMPILER})\n')
+            #outfile.write('set(CMAKE_C_COMPILER ${BFPS_C_COMPILER})\n')
+            outfile.write('project(project_{0} LANGUAGES CXX)\n'.format(self.name))
+            outfile.write('find_package(BFPS REQUIRED)\n')
+            outfile.write('set(CMAKE_CXX_STANDARD 11)\n')
+            outfile.write('set(CMAKE_CXX_STANDARD_REQUIRED ON)\n')
+            outfile.write('set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} ${BFPS_CXX_COMPILE_FLAGS}")\n')
+            outfile.write('set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${BFPS_EXE_LINKER_FLAGS}")\n')
+            outfile.write('include_directories(${BFPS_INCLUDE_DIRECTORIES} ${BFPS_INCLUDE_DIR}/bfps)\n')
+            outfile.write('link_directories(${BFPS_LINK_DIRECTORIES} ${BFPS_LIBRARIES_DIR})\n')
+            outfile.write('find_library(BFPS_STATIC_LIBRARY bfps)\n')
+            outfile.write('add_executable({0} {0}.cpp)\n'.format(self.name))
+            outfile.write('target_link_libraries(' + self.name + ' ${BFPS_STATIC_LIBRARY})\n')
+            outfile.write('target_link_libraries(' + self.name + ' ${BFPS_LIBS})\n')
+        subprocess.check_call(['cmake', '.'])
+        current_environment = os.environ
+        if not no_debug:
+            current_environment['VERBOSE'] = '1'
+        make_result = subprocess.check_call(['make'], env = current_environment)
+        os.chdir('..')
+        shutil.copy2(os.path.join(build_dir, self.name), os.path.join(self.work_dir, self.name))
+        return make_result
     def set_host_info(
             self,
             host_info = {}):
@@ -242,21 +251,13 @@ class _code(_base):
             minutes = 10,
             njobs = 1,
             no_submit = False,
-            no_debug = False):
+            no_debug = True):
         self.read_parameters()
         with h5py.File(os.path.join(self.work_dir, self.simname + '.h5'), 'r') as data_file:
             iter0 = data_file['iteration'][...]
         if not os.path.isdir(self.work_dir):
             os.makedirs(self.work_dir)
-        if not os.path.exists(os.path.join(self.work_dir, self.name)):
-            need_to_compile = True
-        else:
-            need_to_compile = (datetime.fromtimestamp(os.path.getctime(os.path.join(self.work_dir, self.name))) <
-                               bfps.install_info['install_date'])
-        if need_to_compile:
-            assert self.compile_code(no_debug = no_debug) == 0
-            if self.work_dir != os.path.realpath(os.getcwd()):
-                shutil.copy(self.name, self.work_dir)
+        assert (self.compile_code(no_debug = no_debug) == 0)
         if 'niter_todo' not in self.parameters.keys():
             self.parameters['niter_todo'] = 1
         current_dir = os.getcwd()
@@ -369,9 +370,6 @@ class _code(_base):
 
         elif self.host_info['type'] == 'pc':
             os.chdir(self.work_dir)
-            if os.getenv('LD_LIBRARY_PATH') != None:
-                os.environ['LD_LIBRARY_PATH'] += ':{0}'.format(bfps.lib_dir)
-                print('added to LD_LIBRARY_PATH the location {0}'.format(bfps.lib_dir))
             for j in range(njobs):
                 suffix = self.simname + '_{0}'.format(iter0 + j*self.parameters['niter_todo'])
                 print('running code with command\n' + ' '.join(command_atoms))
@@ -456,9 +454,6 @@ class _code(_base):
         script_file.write('module li\n')
         script_file.write('export OMP_NUM_THREADS={}\n'.format(nb_threads_per_process))
 
-        script_file.write('LD_LIBRARY_PATH=' +
-                          ':'.join([bfps.lib_dir] + bfps.install_info['library_dirs']) +
-                          ':${LD_LIBRARY_PATH}\n')
         script_file.write('echo "Start time is `date`"\n')
         script_file.write('export HTMLOUTPUT={}.html\n'.format(command_atoms[-1]))
         script_file.write('cd ' + self.work_dir + '\n')
@@ -561,9 +556,6 @@ class _code(_base):
         script_file.write('module li\n')
         script_file.write('export OMP_NUM_THREADS={}\n'.format(nb_threads_per_process))
 
-        script_file.write('LD_LIBRARY_PATH=' +
-                          ':'.join([bfps.lib_dir] + bfps.install_info['library_dirs']) +
-                          ':${LD_LIBRARY_PATH}\n')
         script_file.write('echo "Start time is `date`"\n')
         script_file.write('export HTMLOUTPUT={}.html\n'.format(command_atoms[-1]))
         script_file.write('cd ' + self.work_dir + '\n')
@@ -622,10 +614,6 @@ class _code(_base):
                           '\t-machinefile $TMPDIR/machines \\\n' +
                           '\t-genv OMP_NUM_THREADS={0} \\\n'.format(nb_threads_per_process) +
                           '\t-genv OMP_PLACES=cores \\\n' +
-                          '\t-genv LD_LIBRARY_PATH \\\n' +
-                          '\t"' +
-                          ':'.join([bfps.lib_dir] + bfps.install_info['library_dirs']) +
-                          '" \\\n' +
                           '\t-n {0} \\\n\t{1}\n'.format(nprocesses, ' '.join(command_atoms)))
         script_file.write('echo "End time is `date`"\n')
         script_file.write('exit 0\n')
@@ -694,9 +682,6 @@ class _code(_base):
             script_file.write('export OMP_NUM_THREADS={0}\n'.format(nb_threads_per_process))
             script_file.write('export OMP_PLACES=cores\n')
 
-        script_file.write('LD_LIBRARY_PATH=' +
-                          ':'.join([bfps.lib_dir] + bfps.install_info['library_dirs']) +
-                          ':${LD_LIBRARY_PATH}\n')
         script_file.write('echo "Start time is `date`"\n')
         script_file.write('cd ' + self.work_dir + '\n')
         script_file.write('export HTMLOUTPUT={}.html\n'.format(command_atoms[-1]))
diff --git a/bfps/cpp/field_descriptor.cpp b/bfps/cpp/field_descriptor.cpp
deleted file mode 100644
index cb7da99514417937c54d54b8583d1e6f1b7007fc..0000000000000000000000000000000000000000
--- a/bfps/cpp/field_descriptor.cpp
+++ /dev/null
@@ -1,543 +0,0 @@
-/**********************************************************************
-*                                                                     *
-*  Copyright 2015 Max Planck Institute                                *
-*                 for Dynamics and Self-Organization                  *
-*                                                                     *
-*  This file is part of bfps.                                         *
-*                                                                     *
-*  bfps is free software: you can redistribute it and/or modify       *
-*  it under the terms of the GNU General Public License as published  *
-*  by the Free Software Foundation, either version 3 of the License,  *
-*  or (at your option) any later version.                             *
-*                                                                     *
-*  bfps is distributed in the hope that it will be useful,            *
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
-*  GNU General Public License for more details.                       *
-*                                                                     *
-*  You should have received a copy of the GNU General Public License  *
-*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
-*                                                                     *
-* Contact: Cristian.Lalescu@ds.mpg.de                                 *
-*                                                                     *
-**********************************************************************/
-
-
-
-#define NDEBUG
-
-#include <stdlib.h>
-#include <algorithm>
-#include <iostream>
-#include "base.hpp"
-#include "field_descriptor.hpp"
-#include "fftw_interface.hpp"
-#include "scope_timer.hpp"
-
-/*****************************************************************************/
-/* macro for specializations to numeric types compatible with FFTW           */
-
-
-template <class rnumber>
-field_descriptor<rnumber>::field_descriptor(
-        int ndims,
-        int *n,
-        MPI_Datatype element_type,
-        MPI_Comm COMM_TO_USE)
-{
-    TIMEZONE("field_descriptor");
-    DEBUG_MSG("entered field_descriptor::field_descriptor\n");
-    this->comm = COMM_TO_USE;
-    MPI_Comm_rank(this->comm, &this->myrank);
-    MPI_Comm_size(this->comm, &this->nprocs);
-    this->ndims = ndims;
-    this->sizes    = new int[ndims];
-    this->subsizes = new int[ndims];
-    this->starts   = new int[ndims];
-    int tsizes   [ndims];
-    int tsubsizes[ndims];
-    int tstarts  [ndims];
-    std::vector<ptrdiff_t> nfftw;
-    nfftw.resize(ndims);
-    ptrdiff_t local_n0, local_0_start;
-    for (int i = 0; i < this->ndims; i++)
-        nfftw[i] = n[i];
-    this->local_size = fftw_interface<rnumber>::mpi_local_size_many(
-                this->ndims,
-                &nfftw.front(),
-                1,
-                FFTW_MPI_DEFAULT_BLOCK,
-                this->comm,
-                &local_n0,
-                &local_0_start);
-    this->sizes[0] = n[0];
-    this->subsizes[0] = (int)local_n0;
-    this->starts[0] = (int)local_0_start;
-    DEBUG_MSG_WAIT(
-                this->comm,
-                "first subsizes[0] = %d %d %d\n",
-                this->subsizes[0],
-            tsubsizes[0],
-            (int)local_n0);
-    tsizes[0] = n[0];
-    tsubsizes[0] = (int)local_n0;
-    tstarts[0] = (int)local_0_start;
-    DEBUG_MSG_WAIT(
-                this->comm,
-                "second subsizes[0] = %d %d %d\n",
-                this->subsizes[0],
-            tsubsizes[0],
-            (int)local_n0);
-    this->mpi_dtype = element_type;
-    this->slice_size = 1;
-    this->full_size = this->sizes[0];
-    for (int i = 1; i < this->ndims; i++)
-    {
-        this->sizes[i] = n[i];
-        this->subsizes[i] = n[i];
-        this->starts[i] = 0;
-        this->slice_size *= this->subsizes[i];
-        this->full_size *= this->sizes[i];
-        tsizes[i] = this->sizes[i];
-        tsubsizes[i] = this->subsizes[i];
-        tstarts[i] = this->starts[i];
-    }
-    tsizes[ndims-1] *= sizeof(rnumber);
-    tsubsizes[ndims-1] *= sizeof(rnumber);
-    tstarts[ndims-1] *= sizeof(rnumber);
-    if (this->mpi_dtype == mpi_real_type<rnumber>::complex())
-    {
-        tsizes[ndims-1] *= 2;
-        tsubsizes[ndims-1] *= 2;
-        tstarts[ndims-1] *= 2;
-    }
-    int local_zero_array[this->nprocs], zero_array[this->nprocs];
-    for (int i=0; i<this->nprocs; i++)
-        local_zero_array[i] = 0;
-    local_zero_array[this->myrank] = (this->subsizes[0] == 0) ? 1 : 0;
-    MPI_Allreduce(
-                local_zero_array,
-                zero_array,
-                this->nprocs,
-                MPI_INT,
-                MPI_SUM,
-                this->comm);
-    int no_of_excluded_ranks = 0;
-    for (int i = 0; i<this->nprocs; i++)
-        no_of_excluded_ranks += zero_array[i];
-    DEBUG_MSG_WAIT(
-                this->comm,
-                "subsizes[0] = %d %d\n",
-                this->subsizes[0],
-            tsubsizes[0]);
-    if (no_of_excluded_ranks == 0)
-    {
-        this->io_comm = this->comm;
-        this->io_nprocs = this->nprocs;
-        this->io_myrank = this->myrank;
-    }
-    else
-    {
-        int excluded_rank[no_of_excluded_ranks];
-        for (int i=0, j=0; i<this->nprocs; i++)
-            if (zero_array[i])
-            {
-                excluded_rank[j] = i;
-                j++;
-            }
-        MPI_Group tgroup0, tgroup;
-        MPI_Comm_group(this->comm, &tgroup0);
-        MPI_Group_excl(tgroup0, no_of_excluded_ranks, excluded_rank, &tgroup);
-        MPI_Comm_create(this->comm, tgroup, &this->io_comm);
-        MPI_Group_free(&tgroup0);
-        MPI_Group_free(&tgroup);
-        if (this->subsizes[0] > 0)
-        {
-            MPI_Comm_rank(this->io_comm, &this->io_myrank);
-            MPI_Comm_size(this->io_comm, &this->io_nprocs);
-        }
-        else
-        {
-            this->io_myrank = MPI_PROC_NULL;
-            this->io_nprocs = -1;
-        }
-    }
-    DEBUG_MSG_WAIT(
-                this->comm,
-                "inside field_descriptor constructor, about to call "
-                "MPI_Type_create_subarray "
-                "%d %d %d\n",
-                this->sizes[0],
-            this->subsizes[0],
-            this->starts[0]);
-    for (int i=0; i<this->ndims; i++)
-        DEBUG_MSG_WAIT(
-                    this->comm,
-                    "tsizes "
-                    "%d %d %d\n",
-                    tsizes[i],
-                    tsubsizes[i],
-                    tstarts[i]);
-    if (this->subsizes[0] > 0)
-    {
-        DEBUG_MSG("creating subarray\n");
-        MPI_Type_create_subarray(
-                    ndims,
-                    tsizes,
-                    tsubsizes,
-                    tstarts,
-                    MPI_ORDER_C,
-                    MPI_UNSIGNED_CHAR,
-                    &this->mpi_array_dtype);
-        MPI_Type_commit(&this->mpi_array_dtype);
-    }
-    this->rank = new int[this->sizes[0]];
-    int *local_rank = new int[this->sizes[0]];
-    std::fill_n(local_rank, this->sizes[0], 0);
-    for (int i = 0; i < this->sizes[0]; i++)
-        if (i >= this->starts[0] && i < this->starts[0] + this->subsizes[0])
-            local_rank[i] = this->myrank;
-    MPI_Allreduce(
-                local_rank,
-                this->rank,
-                this->sizes[0],
-            MPI_INT,
-            MPI_SUM,
-            this->comm);
-    delete[] local_rank;
-    this->all_start0 = new int[this->nprocs];
-    int *local_start0 = new int[this->nprocs];
-    std::fill_n(local_start0, this->nprocs, 0);
-    for (int i = 0; i < this->nprocs; i++)
-        if (this->myrank == i)
-            local_start0[i] = this->starts[0];
-    MPI_Allreduce(
-                local_start0,
-                this->all_start0,
-                this->nprocs,
-                MPI_INT,
-                MPI_SUM,
-                this->comm);
-    delete[] local_start0;
-    this->all_size0  = new int[this->nprocs];
-    int *local_size0 = new int[this->nprocs];
-    std::fill_n(local_size0, this->nprocs, 0);
-    for (int i = 0; i < this->nprocs; i++)
-        if (this->myrank == i)
-            local_size0[i] = this->subsizes[0];
-    MPI_Allreduce(
-                local_size0,
-                this->all_size0,
-                this->nprocs,
-                MPI_INT,
-                MPI_SUM,
-                this->comm);
-    delete[] local_size0;
-    DEBUG_MSG("exiting field_descriptor constructor\n");
-}
-
-template <class rnumber>
-int field_descriptor<rnumber>::read(
-        const char *fname,
-        void *buffer)
-{
-    TIMEZONE("field_descriptor::read");
-    DEBUG_MSG("entered field_descriptor::read\n");
-    char representation[] = "native";
-    if (this->subsizes[0] > 0)
-    {
-        MPI_Info info;
-        MPI_Info_create(&info);
-        MPI_File f;
-        ptrdiff_t read_size = this->local_size*sizeof(rnumber);
-        DEBUG_MSG("read size is %ld\n", read_size);
-        char ffname[200];
-        if (this->mpi_dtype == mpi_real_type<rnumber>::complex())
-            read_size *= 2;
-        DEBUG_MSG("read size is %ld\n", read_size);
-        sprintf(ffname, "%s", fname);
-
-        MPI_File_open(
-                    this->io_comm,
-                    ffname,
-                    MPI_MODE_RDONLY,
-                    info,
-                    &f);
-        DEBUG_MSG("opened file\n");
-        MPI_File_set_view(
-                    f,
-                    0,
-                    MPI_UNSIGNED_CHAR,
-                    this->mpi_array_dtype,
-                    representation,
-                    info);
-        DEBUG_MSG("view is set\n");
-        MPI_File_read_all(
-                    f,
-                    buffer,
-                    read_size,
-                    MPI_UNSIGNED_CHAR,
-                    MPI_STATUS_IGNORE);
-        DEBUG_MSG("info is read\n");
-        MPI_File_close(&f);
-    }
-    DEBUG_MSG("finished with field_descriptor::read\n");
-    return EXIT_SUCCESS;
-}
-
-template <class rnumber>
-int field_descriptor<rnumber>::write(
-        const char *fname,
-        void *buffer)
-{
-    TIMEZONE("field_descriptor::write");
-    char representation[] = "native";
-    if (this->subsizes[0] > 0)
-    {
-        MPI_Info info;
-        MPI_Info_create(&info);
-        MPI_File f;
-        ptrdiff_t read_size = this->local_size*sizeof(rnumber);
-        char ffname[200];
-        if (this->mpi_dtype == mpi_real_type<rnumber>::complex())
-            read_size *= 2;
-        sprintf(ffname, "%s", fname);
-
-        MPI_File_open(
-                    this->io_comm,
-                    ffname,
-                    MPI_MODE_CREATE | MPI_MODE_WRONLY,
-                    info,
-                    &f);
-        MPI_File_set_view(
-                    f,
-                    0,
-                    MPI_UNSIGNED_CHAR,
-                    this->mpi_array_dtype,
-                    representation,
-                    info);
-        MPI_File_write_all(
-                    f,
-                    buffer,
-                    read_size,
-                    MPI_UNSIGNED_CHAR,
-                    MPI_STATUS_IGNORE);
-        MPI_File_close(&f);
-    }
-
-    return EXIT_SUCCESS;
-}
-
-template <class rnumber>
-int field_descriptor<rnumber>::transpose(
-        rnumber *input,
-        rnumber *output)
-{
-    TIMEZONE("field_descriptor::transpose");
-    /* IMPORTANT NOTE:
-     for 3D transposition, the input data is messed up */
-    typename fftw_interface<rnumber>::plan tplan;
-    if (this->ndims == 3)
-    {
-        /* transpose the two local dimensions 1 and 2 */
-        rnumber *atmp;
-        atmp = fftw_interface<rnumber>::alloc_real(this->slice_size);
-        for (int k = 0; k < this->subsizes[0]; k++)
-        {
-            /* put transposed slice in atmp */
-            for (int j = 0; j < this->sizes[1]; j++)
-                for (int i = 0; i < this->sizes[2]; i++)
-                    atmp[i*this->sizes[1] + j] =
-                            input[(k*this->sizes[1] + j)*this->sizes[2] + i];
-            /* copy back transposed slice */
-            std::copy(
-                        atmp,
-                        atmp + this->slice_size,
-                        input + k*this->slice_size);
-        }
-        fftw_interface<rnumber>::free(atmp);
-    }
-    tplan = fftw_interface<rnumber>::mpi_plan_transpose(
-                this->sizes[0], this->slice_size,
-            input, output,
-            this->comm,
-            DEFAULT_FFTW_FLAG);
-    fftw_interface<rnumber>::execute(tplan);
-    fftw_interface<rnumber>::destroy_plan(tplan);
-    return EXIT_SUCCESS;
-}
-
-template <class rnumber>
-int field_descriptor<rnumber>::transpose(
-        typename fftw_interface<rnumber>::complex *input,
-        typename fftw_interface<rnumber>::complex *output)
-{
-    TIMEZONE("field_descriptor::transpose2");
-    switch (this->ndims)
-    {
-    case 2:
-        /* do a global transpose over the 2 dimensions */
-        if (output == NULL)
-        {
-            std::cerr << "bad arguments for transpose.\n" << std::endl;
-            return EXIT_FAILURE;
-        }
-        typename fftw_interface<rnumber>::plan tplan;
-        tplan = fftw_interface<rnumber>::mpi_plan_many_transpose(
-                    this->sizes[0], this->sizes[1], 2,
-                FFTW_MPI_DEFAULT_BLOCK,
-                FFTW_MPI_DEFAULT_BLOCK,
-                (rnumber*)input, (rnumber*)output,
-                this->comm,
-                DEFAULT_FFTW_FLAG);
-        fftw_interface<rnumber>::execute(tplan);
-        fftw_interface<rnumber>::destroy_plan(tplan);
-        break;
-    case 3:
-        /* transpose the two local dimensions 1 and 2 */
-        typename fftw_interface<rnumber>::complex *atmp;
-        atmp = fftw_interface<rnumber>::alloc_complex(this->slice_size);
-        for (int k = 0; k < this->subsizes[0]; k++)
-        {
-            /* put transposed slice in atmp */
-            for (int j = 0; j < this->sizes[1]; j++)
-                for (int i = 0; i < this->sizes[2]; i++)
-                {
-                    atmp[i*this->sizes[1] + j][0] =
-                            input[(k*this->sizes[1] + j)*this->sizes[2] + i][0];
-                    atmp[i*this->sizes[1] + j][1] =
-                            input[(k*this->sizes[1] + j)*this->sizes[2] + i][1];
-                }
-            /* copy back transposed slice */
-            std::copy(
-                        (rnumber*)(atmp),
-                        (rnumber*)(atmp + this->slice_size),
-                        (rnumber*)(input + k*this->slice_size));
-        }
-        fftw_interface<rnumber>::free(atmp);
-        break;
-    default:
-        return EXIT_FAILURE;
-        break;
-    }
-    return EXIT_SUCCESS;
-}
-
-template <class rnumber>
-int field_descriptor<rnumber>::interleave(
-        rnumber *a,
-        int dim)
-{
-     TIMEZONE("field_descriptor::interleav");
-    /* the following is copied from
- * http://agentzlerich.blogspot.com/2010/01/using-fftw-for-in-place-matrix.html
- * */
-    typename fftw_interface<rnumber>::iodim howmany_dims[2];
-    howmany_dims[0].n  = dim;
-    howmany_dims[0].is = this->local_size;
-    howmany_dims[0].os = 1;
-    howmany_dims[1].n  = this->local_size;
-    howmany_dims[1].is = 1;
-    howmany_dims[1].os = dim;
-    const int howmany_rank = sizeof(howmany_dims)/sizeof(howmany_dims[0]);
-
-    typename fftw_interface<rnumber>::plan tmp = fftw_interface<rnumber>::plan_guru_r2r(
-                /*rank*/0,
-                /*dims*/nullptr,
-                howmany_rank,
-                howmany_dims,
-                a,
-                a,
-                /*kind*/nullptr,
-                DEFAULT_FFTW_FLAG);
-    fftw_interface<rnumber>::execute(tmp);
-    fftw_interface<rnumber>::destroy_plan(tmp);
-    return EXIT_SUCCESS;
-}
-
-template <class rnumber>
-int field_descriptor<rnumber>::interleave(
-        typename fftw_interface<rnumber>::complex *a,
-        int dim)
-{
-     TIMEZONE("field_descriptor::interleave2");
-    typename fftw_interface<rnumber>::iodim howmany_dims[2];
-    howmany_dims[0].n  = dim;
-    howmany_dims[0].is = this->local_size;
-    howmany_dims[0].os = 1;
-    howmany_dims[1].n  = this->local_size;
-    howmany_dims[1].is = 1;
-    howmany_dims[1].os = dim;
-    const int howmany_rank = sizeof(howmany_dims)/sizeof(howmany_dims[0]);
-
-    typename fftw_interface<rnumber>::plan tmp = fftw_interface<rnumber>::plan_guru_dft(
-                /*rank*/0,
-                /*dims*/nullptr,
-                howmany_rank,
-                howmany_dims,
-                a,
-                a,
-                +1,
-                DEFAULT_FFTW_FLAG);
-    fftw_interface<rnumber>::execute(tmp);
-    fftw_interface<rnumber>::destroy_plan(tmp);
-    return EXIT_SUCCESS;
-}
-
-template <class rnumber>
-field_descriptor<rnumber>* field_descriptor<rnumber>::get_transpose()
-{
-    TIMEZONE("field_descriptor::get_transpose");
-    int n[this->ndims];
-    for (int i=0; i<this->ndims; i++)
-        n[i] = this->sizes[this->ndims - i - 1];
-    return new field_descriptor<rnumber>(this->ndims, n, this->mpi_dtype, this->comm);
-}
-
-/*****************************************************************************/
-/*****************************************************************************/
-
-
-
-/*****************************************************************************/
-/* destructor looks the same for both float and double                       */
-template <class rnumber>
-field_descriptor<rnumber>::~field_descriptor()
-{
-    DEBUG_MSG_WAIT(
-                MPI_COMM_WORLD,
-                this->io_comm == MPI_COMM_NULL ? "null\n" : "not null\n");
-    DEBUG_MSG_WAIT(
-                MPI_COMM_WORLD,
-                "subsizes[0] = %d \n", this->subsizes[0]);
-    if (this->subsizes[0] > 0)
-    {
-        DEBUG_MSG_WAIT(
-                    this->io_comm,
-                    "deallocating mpi_array_dtype\n");
-        MPI_Type_free(&this->mpi_array_dtype);
-    }
-    if (this->nprocs != this->io_nprocs && this->io_myrank != MPI_PROC_NULL)
-    {
-        DEBUG_MSG_WAIT(
-                    this->io_comm,
-                    "freeing io_comm\n");
-        MPI_Comm_free(&this->io_comm);
-    }
-    delete[] this->sizes;
-    delete[] this->subsizes;
-    delete[] this->starts;
-    delete[] this->rank;
-    delete[] this->all_start0;
-    delete[] this->all_size0;
-}
-/*****************************************************************************/
-
-
-
-/*****************************************************************************/
-/* finally, force generation of code                                         */
-template class field_descriptor<float>;
-template class field_descriptor<double>;
-/*****************************************************************************/
-
diff --git a/bfps/cpp/field_descriptor.hpp b/bfps/cpp/field_descriptor.hpp
deleted file mode 100644
index 2fb491bca7c130704fc5de5d22c3393cb196eec7..0000000000000000000000000000000000000000
--- a/bfps/cpp/field_descriptor.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/**********************************************************************
-*                                                                     *
-*  Copyright 2015 Max Planck Institute                                *
-*                 for Dynamics and Self-Organization                  *
-*                                                                     *
-*  This file is part of bfps.                                         *
-*                                                                     *
-*  bfps is free software: you can redistribute it and/or modify       *
-*  it under the terms of the GNU General Public License as published  *
-*  by the Free Software Foundation, either version 3 of the License,  *
-*  or (at your option) any later version.                             *
-*                                                                     *
-*  bfps is distributed in the hope that it will be useful,            *
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
-*  GNU General Public License for more details.                       *
-*                                                                     *
-*  You should have received a copy of the GNU General Public License  *
-*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
-*                                                                     *
-* Contact: Cristian.Lalescu@ds.mpg.de                                 *
-*                                                                     *
-**********************************************************************/
-
-
-
-#include <mpi.h>
-#include <fftw3-mpi.h>
-#include "fftw_interface.hpp"
-
-#ifndef FIELD_DESCRIPTOR
-
-#define FIELD_DESCRIPTOR
-
-extern int myrank, nprocs;
-
-template <class rnumber>
-class field_descriptor
-{
-    private:
-        typedef rnumber cnumber[2];
-    public:
-
-        /* data */
-        int *sizes;
-        int *subsizes;
-        int *starts;
-        int ndims;
-        int *rank;
-        int *all_start0;
-        int *all_size0;
-        ptrdiff_t slice_size, local_size, full_size;
-        MPI_Datatype mpi_array_dtype, mpi_dtype;
-        int myrank, nprocs, io_myrank, io_nprocs;
-        MPI_Comm comm, io_comm;
-
-
-        /* methods */
-        field_descriptor(
-                int ndims,
-                int *n,
-                MPI_Datatype element_type,
-                MPI_Comm COMM_TO_USE);
-        ~field_descriptor();
-
-        /* io is performed using MPI_File stuff, and our
-         * own mpi_array_dtype that was defined in the constructor.
-         * */
-        int read(
-                const char *fname,
-                void *buffer);
-        int write(
-                const char *fname,
-                void *buffer);
-
-        /* a function that generates the transposed descriptor.
-         * don't forget to delete the result once you're done with it.
-         * the transposed descriptor is useful for io operations.
-         * */
-        field_descriptor<rnumber> *get_transpose();
-
-        /* we don't actually need the transposed descriptor to perform
-         * the transpose operation: we only need the in/out fields.
-         * */
-        int transpose(
-                rnumber *input,
-                rnumber *output);
-        int transpose(
-                typename fftw_interface<rnumber>::complex *input,
-                typename fftw_interface<rnumber>::complex *output = NULL);
-
-        int interleave(
-                rnumber *input,
-                int dim);
-        int interleave(
-                typename fftw_interface<rnumber>::complex *input,
-                int dim);
-};
-
-
-inline float btle(const float be)
-     {
-         float le;
-         char *befloat = (char *) & be;
-         char *lefloat = (char *) & le;
-         lefloat[0] = befloat[3];
-         lefloat[1] = befloat[2];
-         lefloat[2] = befloat[1];
-         lefloat[3] = befloat[0];
-         return le;
-     }
-
-#endif//FIELD_DESCRIPTOR
-
diff --git a/bfps/cpp/full_code/NSVEp_extra_sampling.hpp b/bfps/cpp/full_code/NSVEp_extra_sampling.hpp
deleted file mode 100644
index 0857cde7bd6873be68c91937fdb8470e2b9af2af..0000000000000000000000000000000000000000
--- a/bfps/cpp/full_code/NSVEp_extra_sampling.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef NSVEP_EXTRA_SAMPLING_HPP
-#define NSVEP_EXTRA_SAMPLING_HPP
-
-
-
-#include <cstdlib>
-#include "base.hpp"
-#include "vorticity_equation.hpp"
-#include "full_code/NSVEparticles.hpp"
-#include "particles/particles_system_builder.hpp"
-#include "particles/particles_output_hdf5.hpp"
-#include "particles/particles_sampling.hpp"
-
-/** \brief Navier-Stokes solver with tracers that sample velocity gradient
- *  and pressure Hessian.
- *
- */
-
-template <typename rnumber>
-class NSVEp_extra_sampling: public NSVEparticles<rnumber>
-{
-    public:
-
-        /* other stuff */
-        field<rnumber, FFTW, ONE> *pressure;
-        field<rnumber, FFTW, THREE> *nabla_p;
-        field<rnumber, FFTW, THREExTHREE> *nabla_u;
-        field<rnumber, FFTW, THREExTHREE> *Hessian_p;
-
-        NSVEp_extra_sampling(
-                const MPI_Comm COMMUNICATOR,
-                const std::string &simulation_name):
-            NSVEparticles<rnumber>(
-                    COMMUNICATOR,
-                    simulation_name){}
-        ~NSVEp_extra_sampling(){}
-
-        int initialize(void);
-        int finalize(void);
-
-        int read_parameters(void);
-        int do_stats(void);
-};
-
-#endif//NSVEP_EXTRA_SAMPLING_HPP
-
-
diff --git a/bfps/cpp/full_code/NSVEparticles_no_output.hpp b/bfps/cpp/full_code/NSVEparticles_no_output.hpp
deleted file mode 100644
index 5b9d5e15e00fd1b2d8551995e99e0a157339925c..0000000000000000000000000000000000000000
--- a/bfps/cpp/full_code/NSVEparticles_no_output.hpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef NSVEPARTICLES_NO_OUTPUT_HPP
-#define NSVEPARTICLES_NO_OUTPUT_HPP
-
-#include "full_code/NSVEparticles.hpp"
-
-template <typename rnumber>
-class NSVEparticles_no_output: public NSVEparticles<rnumber>
-{
-    public:
-    NSVEparticles_no_output(
-            const MPI_Comm COMMUNICATOR,
-            const std::string &simulation_name):
-        NSVEparticles<rnumber>(
-                COMMUNICATOR,
-                simulation_name){}
-    ~NSVEparticles_no_output(){}
-    int write_checkpoint(void)
-    {
-        TIMEZONE("NSVEparticles_no_output::write_checkpoint");
-        return EXIT_SUCCESS;
-    }
-};
-
-#endif//NSVEPARTICLES_NO_OUTPUT_HPP
-
diff --git a/bfps/cpp/full_code/codes_with_no_output.hpp b/bfps/cpp/full_code/codes_with_no_output.hpp
deleted file mode 100644
index f4cd3b5495ecb432653a7027bcaa330954865d21..0000000000000000000000000000000000000000
--- a/bfps/cpp/full_code/codes_with_no_output.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef CODES_WITH_NO_OUTPUT_HPP
-#define CODES_WITH_NO_OUTPUT_HPP
-
-#include "full_code/NSVE_no_output.hpp"
-#include "full_code/NSVEparticles_no_output.hpp"
-
-
-#endif//CODES_WITH_NO_OUTPUT_HPP
-
diff --git a/bfps/cpp/full_code/field_output_test.cpp b/bfps/cpp/full_code/field_output_test.cpp
deleted file mode 100644
index 724060992ad5bba14adbe871c98067b4e57728ab..0000000000000000000000000000000000000000
--- a/bfps/cpp/full_code/field_output_test.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-#include <string>
-#include <cmath>
-#include <random>
-#include "field_output_test.hpp"
-#include "scope_timer.hpp"
-
-
-template <typename rnumber>
-int field_output_test<rnumber>::initialize(void)
-{
-    TIMEZONE("field_output_test::initialize");
-    this->read_parameters();
-    return EXIT_SUCCESS;
-}
-
-template <typename rnumber>
-int field_output_test<rnumber>::finalize(void)
-{
-    TIMEZONE("field_output_test::finalize");
-    return EXIT_SUCCESS;
-}
-
-template <typename rnumber>
-int field_output_test<rnumber>::read_parameters()
-{
-    TIMEZONE("field_output_test::read_parameters");
-    this->test::read_parameters();
-    return EXIT_SUCCESS;
-}
-
-template <typename rnumber>
-int field_output_test<rnumber>::do_work(void)
-{
-    TIMEZONE("field_output_test::do_work");
-    // allocate
-    field<rnumber, FFTW, ONE> *scal_field = new field<rnumber, FFTW, ONE>(
-            this->nx, this->ny, this->nz,
-            this->comm,
-            FFTW_ESTIMATE);
-    std::default_random_engine rgen;
-    std::normal_distribution<rnumber> rdist;
-    rgen.seed(1);
-
-    // fill up scal_field
-    scal_field->real_space_representation = true;
-    scal_field->RLOOP(
-            [&](ptrdiff_t rindex,
-                ptrdiff_t xindex,
-                ptrdiff_t yindex,
-                ptrdiff_t zindex){
-            scal_field->rval(rindex) = rdist(rgen);
-            });
-
-    scal_field->io(
-            this->simname + std::string("_fields.h5"),
-            "scal_field",
-            0,
-            false);
-
-    // deallocate
-    delete scal_field;
-    return EXIT_SUCCESS;
-}
-
-template class field_output_test<float>;
-template class field_output_test<double>;
-
diff --git a/bfps/cpp/full_code/test.cpp b/bfps/cpp/full_code/test.cpp
deleted file mode 100644
index aa909362df050c95282fd9c7de66de3d8a1acc34..0000000000000000000000000000000000000000
--- a/bfps/cpp/full_code/test.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <cstdlib>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "scope_timer.hpp"
-#include "hdf5_tools.hpp"
-#include "full_code/test.hpp"
-
-
-int test::main_loop(void)
-{
-    TIMEZONE("test::main_loop");
-    this->start_simple_timer();
-    this->do_work();
-    this->print_simple_timer(
-            "do_work required ");
-    return EXIT_SUCCESS;
-}
-
diff --git a/bfps/cpp/full_code/test_interpolation.hpp b/bfps/cpp/full_code/test_interpolation.hpp
deleted file mode 100644
index 2d149802a9e9b138099c8e824ab78fef2e96c381..0000000000000000000000000000000000000000
--- a/bfps/cpp/full_code/test_interpolation.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef TEST_INTERPOLATION_HPP
-#define TEST_INTERPOLATION_HPP
-
-
-
-#include <cstdlib>
-#include "base.hpp"
-#include "kspace.hpp"
-#include "full_code/test.hpp"
-#include "particles/particles_system_builder.hpp"
-#include "particles/particles_output_hdf5.hpp"
-#include "particles/particles_sampling.hpp"
-
-/** \brief Interpolation tester.
- *
- */
-
-template <typename rnumber>
-class test_interpolation: public test
-{
-    public:
-        int nparticles;
-        int tracers0_integration_steps;
-        int tracers0_neighbours;
-        int tracers0_smoothness;
-
-        std::unique_ptr<abstract_particles_system<long long int, double>> ps;
-
-        particles_output_hdf5<long long int, double,3> *particles_output_writer_mpi;
-        particles_output_sampling_hdf5<long long int, double, 3> *particles_sample_writer_mpi;
-
-        field<rnumber, FFTW, THREE> *velocity, *vorticity;
-        field<rnumber, FFTW, THREExTHREE> *nabla_u;
-
-        kspace<FFTW, SMOOTH> *kk;
-
-        test_interpolation(
-                const MPI_Comm COMMUNICATOR,
-                const std::string &simulation_name):
-            test(
-                    COMMUNICATOR,
-                    simulation_name),
-            particles_output_writer_mpi(nullptr),
-            particles_sample_writer_mpi(nullptr),
-            velocity(nullptr),
-            vorticity(nullptr),
-            nabla_u(nullptr),
-            kk(nullptr) {}
-        ~test_interpolation(){}
-
-        int initialize(void);
-        int do_work(void);
-        int finalize(void);
-
-        int read_parameters(void);
-};
-
-#endif//TEST_INTERPOLATION_HPP
-
diff --git a/bfps/cpp/particles.cpp b/bfps/cpp/particles.cpp
deleted file mode 100644
index cdaf157cb912c3074faf84bfecf1d9b3752c78a7..0000000000000000000000000000000000000000
--- a/bfps/cpp/particles.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/**********************************************************************
-*                                                                     *
-*  Copyright 2015 Max Planck Institute                                *
-*                 for Dynamics and Self-Organization                  *
-*                                                                     *
-*  This file is part of bfps.                                         *
-*                                                                     *
-*  bfps is free software: you can redistribute it and/or modify       *
-*  it under the terms of the GNU General Public License as published  *
-*  by the Free Software Foundation, either version 3 of the License,  *
-*  or (at your option) any later version.                             *
-*                                                                     *
-*  bfps is distributed in the hope that it will be useful,            *
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
-*  GNU General Public License for more details.                       *
-*                                                                     *
-*  You should have received a copy of the GNU General Public License  *
-*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
-*                                                                     *
-* Contact: Cristian.Lalescu@ds.mpg.de                                 *
-*                                                                     *
-**********************************************************************/
-
-
-
-#define NDEBUG
-
-#include <cmath>
-#include <cassert>
-#include <cstring>
-#include <string>
-#include <sstream>
-
-#include "base.hpp"
-#include "particles.hpp"
-#include "fftw_tools.hpp"
-
-
-extern int myrank, nprocs;
-
-template <particle_types particle_type, class rnumber, int interp_neighbours>
-particles<particle_type, rnumber, interp_neighbours>::particles(
-        const char *NAME,
-        const hid_t data_file_id,
-        interpolator_base<rnumber, interp_neighbours> *VEL,
-        const int TRAJ_SKIP,
-        const int INTEGRATION_STEPS) : particles_io_base<particle_type>(
-            NAME,
-            TRAJ_SKIP,
-            data_file_id,
-            VEL->descriptor->comm)
-{
-    assert((INTEGRATION_STEPS <= 6) &&
-           (INTEGRATION_STEPS >= 1));
-    this->vel = VEL;
-    this->integration_steps = INTEGRATION_STEPS;
-    this->array_size = this->nparticles * state_dimension(particle_type);
-    this->state = new double[this->array_size];
-    std::fill_n(this->state, this->array_size, 0.0);
-    for (int i=0; i < this->integration_steps; i++)
-    {
-        this->rhs[i] = new double[this->array_size];
-        std::fill_n(this->rhs[i], this->array_size, 0.0);
-    }
-}
-
-template <particle_types particle_type, class rnumber, int interp_neighbours>
-particles<particle_type, rnumber, interp_neighbours>::~particles()
-{
-    delete[] this->state;
-    for (int i=0; i < this->integration_steps; i++)
-    {
-        delete[] this->rhs[i];
-    }
-}
-
-template <particle_types particle_type, class rnumber, int interp_neighbours>
-void particles<particle_type, rnumber, interp_neighbours>::get_rhs(double *x, double *y)
-{
-    switch(particle_type)
-    {
-        case VELOCITY_TRACER:
-            this->vel->sample(this->nparticles, state_dimension(particle_type), x, y);
-            break;
-    }
-}
-
-template <particle_types particle_type, class rnumber, int interp_neighbours>
-void particles<particle_type, rnumber, interp_neighbours>::roll_rhs()
-{
-    for (int i=this->integration_steps-2; i>=0; i--)
-        std::copy(this->rhs[i],
-                  this->rhs[i] + this->array_size,
-                  this->rhs[i+1]);
-}
-
-
-
-template <particle_types particle_type, class rnumber, int interp_neighbours>
-void particles<particle_type, rnumber, interp_neighbours>::AdamsBashforth(
-        const int nsteps)
-{
-    ptrdiff_t ii;
-    this->get_rhs(this->state, this->rhs[0]);
-    switch(nsteps)
-    {
-        case 1:
-            for (unsigned int p=0; p<this->nparticles; p++)
-                for (unsigned int i=0; i<state_dimension(particle_type); i++)
-                {
-                    ii = p*state_dimension(particle_type)+i;
-                    this->state[ii] += this->dt*this->rhs[0][ii];
-                }
-            break;
-        case 2:
-            for (unsigned int p=0; p<this->nparticles; p++)
-                for (unsigned int i=0; i<state_dimension(particle_type); i++)
-                {
-                    ii = p*state_dimension(particle_type)+i;
-                    this->state[ii] += this->dt*(3*this->rhs[0][ii]
-                                               -   this->rhs[1][ii])/2;
-                }
-            break;
-        case 3:
-            for (unsigned int p=0; p<this->nparticles; p++)
-                for (unsigned int i=0; i<state_dimension(particle_type); i++)
-                {
-                    ii = p*state_dimension(particle_type)+i;
-                    this->state[ii] += this->dt*(23*this->rhs[0][ii]
-                                               - 16*this->rhs[1][ii]
-                                               +  5*this->rhs[2][ii])/12;
-                }
-            break;
-        case 4:
-            for (unsigned int p=0; p<this->nparticles; p++)
-                for (unsigned int i=0; i<state_dimension(particle_type); i++)
-                {
-                    ii = p*state_dimension(particle_type)+i;
-                    this->state[ii] += this->dt*(55*this->rhs[0][ii]
-                                               - 59*this->rhs[1][ii]
-                                               + 37*this->rhs[2][ii]
-                                               -  9*this->rhs[3][ii])/24;
-                }
-            break;
-        case 5:
-            for (unsigned int p=0; p<this->nparticles; p++)
-                for (unsigned int i=0; i<state_dimension(particle_type); i++)
-                {
-                    ii = p*state_dimension(particle_type)+i;
-                    this->state[ii] += this->dt*(1901*this->rhs[0][ii]
-                                               - 2774*this->rhs[1][ii]
-                                               + 2616*this->rhs[2][ii]
-                                               - 1274*this->rhs[3][ii]
-                                               +  251*this->rhs[4][ii])/720;
-                }
-            break;
-        case 6:
-            for (unsigned int p=0; p<this->nparticles; p++)
-                for (unsigned int i=0; i<state_dimension(particle_type); i++)
-                {
-                    ii = p*state_dimension(particle_type)+i;
-                    this->state[ii] += this->dt*(4277*this->rhs[0][ii]
-                                               - 7923*this->rhs[1][ii]
-                                               + 9982*this->rhs[2][ii]
-                                               - 7298*this->rhs[3][ii]
-                                               + 2877*this->rhs[4][ii]
-                                               -  475*this->rhs[5][ii])/1440;
-                }
-            break;
-    }
-    this->roll_rhs();
-}
-
-
-template <particle_types particle_type, class rnumber, int interp_neighbours>
-void particles<particle_type, rnumber, interp_neighbours>::step()
-{
-    this->AdamsBashforth((this->iteration < this->integration_steps) ?
-                            this->iteration+1 :
-                            this->integration_steps);
-    this->iteration++;
-}
-
-
-template <particle_types particle_type, class rnumber, int interp_neighbours>
-void particles<particle_type, rnumber, interp_neighbours>::read()
-{
-    if (this->myrank == 0)
-        for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
-        {
-            this->read_state_chunk(cindex, this->state+cindex*this->chunk_size*state_dimension(particle_type));
-            if (this->iteration > 0)
-                for (int i=0; i<this->integration_steps; i++)
-                    this->read_rhs_chunk(cindex, i, this->rhs[i]+cindex*this->chunk_size*state_dimension(particle_type));
-        }
-    MPI_Bcast(
-            this->state,
-            this->array_size,
-            MPI_DOUBLE,
-            0,
-            this->comm);
-    if (this->iteration > 0)
-        for (int i = 0; i<this->integration_steps; i++)
-            MPI_Bcast(
-                    this->rhs[i],
-                    this->array_size,
-                    MPI_DOUBLE,
-                    0,
-                    this->comm);
-}
-
-template <particle_types particle_type, class rnumber, int interp_neighbours>
-void particles<particle_type, rnumber, interp_neighbours>::write(
-        const bool write_rhs)
-{
-    if (this->myrank == 0)
-        for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
-        {
-            this->write_state_chunk(cindex, this->state+cindex*this->chunk_size*state_dimension(particle_type));
-            if (write_rhs)
-                for (int i=0; i<this->integration_steps; i++)
-                    this->write_rhs_chunk(cindex, i, this->rhs[i]+cindex*this->chunk_size*state_dimension(particle_type));
-        }
-}
-
-template <particle_types particle_type, class rnumber, int interp_neighbours>
-void particles<particle_type, rnumber, interp_neighbours>::sample(
-        interpolator_base<rnumber, interp_neighbours> *field,
-        const char *dset_name)
-{
-    double *y = new double[this->nparticles*3];
-    field->sample(this->nparticles, state_dimension(particle_type), this->state, y);
-    if (this->myrank == 0)
-        for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
-            this->write_point3D_chunk(dset_name, cindex, y+cindex*this->chunk_size*3);
-    delete[] y;
-}
-
-
-/*****************************************************************************/
-template class particles<VELOCITY_TRACER, float, 1>;
-template class particles<VELOCITY_TRACER, float, 2>;
-template class particles<VELOCITY_TRACER, float, 3>;
-template class particles<VELOCITY_TRACER, float, 4>;
-template class particles<VELOCITY_TRACER, float, 5>;
-template class particles<VELOCITY_TRACER, float, 6>;
-template class particles<VELOCITY_TRACER, double, 1>;
-template class particles<VELOCITY_TRACER, double, 2>;
-template class particles<VELOCITY_TRACER, double, 3>;
-template class particles<VELOCITY_TRACER, double, 4>;
-template class particles<VELOCITY_TRACER, double, 5>;
-template class particles<VELOCITY_TRACER, double, 6>;
-/*****************************************************************************/
diff --git a/bfps/cpp/particles.hpp b/bfps/cpp/particles.hpp
deleted file mode 100644
index 03daf3e3fc866ac485b3649a28dfb13cf1b50ff1..0000000000000000000000000000000000000000
--- a/bfps/cpp/particles.hpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/**********************************************************************
-*                                                                     *
-*  Copyright 2015 Max Planck Institute                                *
-*                 for Dynamics and Self-Organization                  *
-*                                                                     *
-*  This file is part of bfps.                                         *
-*                                                                     *
-*  bfps is free software: you can redistribute it and/or modify       *
-*  it under the terms of the GNU General Public License as published  *
-*  by the Free Software Foundation, either version 3 of the License,  *
-*  or (at your option) any later version.                             *
-*                                                                     *
-*  bfps is distributed in the hope that it will be useful,            *
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
-*  GNU General Public License for more details.                       *
-*                                                                     *
-*  You should have received a copy of the GNU General Public License  *
-*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
-*                                                                     *
-* Contact: Cristian.Lalescu@ds.mpg.de                                 *
-*                                                                     *
-**********************************************************************/
-
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <iostream>
-#include <hdf5.h>
-#include "base.hpp"
-#include "particles_base.hpp"
-#include "fluid_solver_base.hpp"
-#include "interpolator_base.hpp"
-
-#ifndef PARTICLES
-
-#define PARTICLES
-
-template <particle_types particle_type, class rnumber, int interp_neighbours>
-class particles: public particles_io_base<particle_type>
-{
-    private:
-        double *state;
-        double *rhs[6];
-
-    public:
-        int array_size;
-        int integration_steps;
-        interpolator_base<rnumber, interp_neighbours> *vel;
-
-        /* simulation parameters */
-        double dt;
-
-        /* methods */
-
-        /* constructor and destructor.
-         * allocate and deallocate:
-         *  this->state
-         *  this->rhs
-         * */
-        particles(
-                const char *NAME,
-                const hid_t data_file_id,
-                interpolator_base<rnumber, interp_neighbours> *FIELD,
-                const int TRAJ_SKIP,
-                const int INTEGRATION_STEPS = 2);
-        ~particles();
-
-        void sample(
-                interpolator_base<rnumber, interp_neighbours> *field,
-                const char *dset_name);
-
-        inline void sample(
-                interpolator_base<rnumber, interp_neighbours> *field,
-                double *y)
-        {
-            field->sample(this->nparticles, state_dimension(particle_type), this->state, y);
-        }
-
-        void get_rhs(
-                double *__restrict__ x,
-                double *__restrict__ rhs);
-
-        /* input/output */
-        void read();
-        void write(
-                const char *dset_name,
-                const double *data);
-        void write(const bool write_rhs = true);
-
-        /* solvers */
-        void step();
-        void roll_rhs();
-        void AdamsBashforth(const int nsteps);
-};
-
-#endif//PARTICLES
-
diff --git a/bfps/cpp/particles/abstract_particles_input.hpp b/bfps/cpp/particles/abstract_particles_input.hpp
deleted file mode 100644
index 77dcbc638903a668ce6e2a0084815832b0580495..0000000000000000000000000000000000000000
--- a/bfps/cpp/particles/abstract_particles_input.hpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef ABSTRACT_PARTICLES_INPUT_HPP
-#define ABSTRACT_PARTICLES_INPUT_HPP
-
-#include <tuple>
-
-template <class partsize_t, class real_number>
-class abstract_particles_input {
-public:
-    virtual ~abstract_particles_input(){}
-
-    virtual partsize_t getTotalNbParticles()  = 0;
-    virtual partsize_t getLocalNbParticles()  = 0;
-    virtual int getNbRhs()  = 0;
-
-    virtual std::unique_ptr<real_number[]> getMyParticles()  = 0;
-    virtual std::unique_ptr<partsize_t[]> getMyParticlesIndexes()  = 0;
-    virtual std::vector<std::unique_ptr<real_number[]>> getMyRhs()  = 0;
-};
-
-
-#endif
diff --git a/bfps/cpp/particles/lock_free_bool_array.hpp b/bfps/cpp/particles/lock_free_bool_array.hpp
deleted file mode 100644
index 928c175349b16f966f3515abc6a07fc44a817194..0000000000000000000000000000000000000000
--- a/bfps/cpp/particles/lock_free_bool_array.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef LOCK_FREE_BOOL_ARRAY_HPP
-#define LOCK_FREE_BOOL_ARRAY_HPP
-
-#include <vector>
-#include <memory>
-
-class lock_free_bool_array{
-    std::vector<std::unique_ptr<long int>> keys;
-
-public:
-    explicit lock_free_bool_array(const long int inNbKeys = 512){
-        keys.resize(inNbKeys);
-        for(std::unique_ptr<long int>& k : keys){
-            k.reset(new long int(0));
-        }
-    }
-
-    void lock(const long int inKey){
-        volatile long int* k = keys[inKey%keys.size()].get();
-        long int res = 1;
-        while(res == 1){
-            res = __sync_val_compare_and_swap(k, 0, res);
-        }
-    }
-
-    void unlock(const long int inKey){
-        volatile long int* k = keys[inKey%keys.size()].get();
-        assert(k && *k);
-        (*k) = 0;
-    }
-};
-
-#endif
diff --git a/bfps/cpp/particles/p2p_computer_empty.hpp b/bfps/cpp/particles/p2p_computer_empty.hpp
deleted file mode 100644
index 5e442b8685365bf3cd31768a46eac53d0ce9213f..0000000000000000000000000000000000000000
--- a/bfps/cpp/particles/p2p_computer_empty.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef P2P_COMPUTER_EMPTY_HPP
-#define P2P_COMPUTER_EMPTY_HPP
-
-#include <cstring>
-
-template <class real_number, class partsize_t>
-class p2p_computer_empty{
-public:
-    template <int size_particle_rhs>
-    void init_result_array(real_number /*rhs*/[], const partsize_t /*nbParticles*/) const{
-    }
-
-    template <int size_particle_rhs>
-    void reduce_particles_rhs(real_number /*rhs_dst*/[], const real_number /*rhs_src*/[], const partsize_t /*nbParticles*/) const{
-    }
-
-    template <int size_particle_positions, int size_particle_rhs>
-    void compute_interaction(const real_number /*pos_part1*/[], real_number /*rhs_part1*/[],
-                             const real_number /*pos_part2*/[], real_number /*rhs_part2*/[],
-                             const real_number /*dist_pow2*/,  const real_number /*cutoff*/,
-                             const real_number /*xshift_coef*/, const real_number /*yshift_coef*/, const real_number /*zshift_coef*/) const{
-    }
-
-    constexpr static bool isEnable() {
-        return false;
-    }
-};
-
-#endif
diff --git a/bfps/cpp/particles/particles_inner_computer_empty.hpp b/bfps/cpp/particles/particles_inner_computer_empty.hpp
deleted file mode 100644
index 514bcba1065beeb706065eb7529aa87c7f696207..0000000000000000000000000000000000000000
--- a/bfps/cpp/particles/particles_inner_computer_empty.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef PARTICLES_INNER_COMPUTER_EMPTY_HPP
-#define PARTICLES_INNER_COMPUTER_EMPTY_HPP
-
-#include <cstring>
-#include <cassert>
-
-template <class real_number, class partsize_t>
-class particles_inner_computer_empty{
-public:
-    template <int size_particle_positions, int size_particle_rhs>
-    void compute_interaction(const partsize_t /*nb_particles*/, real_number /*pos_part*/[], real_number /*rhs_part*/[]) const{
-    }
-
-    template <int size_particle_positions>
-    void enforce_unit_orientation(const partsize_t /*nb_particles*/, real_number /*pos_part*/[]) const{
-    }
-
-    template <int size_particle_positions, int size_particle_rhs>
-    void add_Lagrange_multipliers(const partsize_t /*nb_particles*/, real_number /*pos_part*/[], real_number /*rhs_part*/[]) const{
-    }
-
-    template <int size_particle_positions, int size_particle_rhs, int size_particle_rhs_extra>
-    void compute_interaction_with_extra(const partsize_t /*nb_particles*/, real_number /*pos_part*/[], real_number /*rhs_part*/[],
-                             const real_number /*rhs_part_extra*/[]) const{
-    }
-
-    constexpr static bool isEnable() {
-        return false;
-    }
-};
-
-#endif
diff --git a/bfps/cpp/particles_base.cpp b/bfps/cpp/particles_base.cpp
deleted file mode 100644
index 1410488410a429ff463a1751e86f78cc2157679b..0000000000000000000000000000000000000000
--- a/bfps/cpp/particles_base.cpp
+++ /dev/null
@@ -1,424 +0,0 @@
-/**********************************************************************
-*                                                                     *
-*  Copyright 2015 Max Planck Institute                                *
-*                 for Dynamics and Self-Organization                  *
-*                                                                     *
-*  This file is part of bfps.                                         *
-*                                                                     *
-*  bfps is free software: you can redistribute it and/or modify       *
-*  it under the terms of the GNU General Public License as published  *
-*  by the Free Software Foundation, either version 3 of the License,  *
-*  or (at your option) any later version.                             *
-*                                                                     *
-*  bfps is distributed in the hope that it will be useful,            *
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
-*  GNU General Public License for more details.                       *
-*                                                                     *
-*  You should have received a copy of the GNU General Public License  *
-*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
-*                                                                     *
-* Contact: Cristian.Lalescu@ds.mpg.de                                 *
-*                                                                     *
-**********************************************************************/
-
-
-
-#define NDEBUG
-
-#include <algorithm>
-#include <cassert>
-#include "particles_base.hpp"
-#include "scope_timer.hpp"
-
-template <particle_types particle_type>
-single_particle_state<particle_type>::single_particle_state()
-{
-    std::fill_n(this->data, state_dimension(particle_type), 0);
-}
-
-template <particle_types particle_type>
-single_particle_state<particle_type>::single_particle_state(
-        const single_particle_state<particle_type> &src)
-{
-    std::copy(
-            src.data,
-            src.data + state_dimension(particle_type),
-            this->data);
-}
-
-template <particle_types particle_type>
-single_particle_state<particle_type>::single_particle_state(
-        const double *src)
-{
-    std::copy(
-            src,
-            src + state_dimension(particle_type),
-            this->data);
-}
-
-template <particle_types particle_type>
-single_particle_state<particle_type>::~single_particle_state()
-{
-}
-
-template <particle_types particle_type>
-single_particle_state<particle_type> &single_particle_state<particle_type>::operator=(
-        const single_particle_state &src)
-{
-    std::copy(
-            src.data,
-            src.data + state_dimension(particle_type),
-            this->data);
-    return *this;
-}
-
-template <particle_types particle_type>
-single_particle_state<particle_type> &single_particle_state<particle_type>::operator=(
-        const double *src)
-{
-    std::copy(
-            src,
-            src + state_dimension(particle_type),
-            this->data);
-    return *this;
-}
-
-int get_chunk_offsets(
-        std::vector<hsize_t> data_dims,
-        std::vector<hsize_t> chnk_dims,
-        std::vector<std::vector<hsize_t>> &co)
-{
-    TIMEZONE("get_chunk_offsets");
-    std::vector<hsize_t> nchunks(data_dims);
-    int total_number_of_chunks = 1;
-    for (unsigned i=0; i<nchunks.size(); i++)
-    {
-        DEBUG_MSG("get_chunk_offset nchunks[%d] = %ld, chnk_dims[%d] = %ld\n",
-                i, nchunks[i], i, chnk_dims[i]);
-        nchunks[i] = data_dims[i] / chnk_dims[i];
-        total_number_of_chunks *= nchunks[i];
-    }
-    co.resize(total_number_of_chunks);
-    DEBUG_MSG("total number of chunks is %d\n", total_number_of_chunks);
-    for (int cindex=0; cindex < total_number_of_chunks; cindex++)
-    {
-        int cc = cindex;
-        for (unsigned i=0; i<nchunks.size(); i++)
-        {
-            int ii = nchunks.size()-1-i;
-            co[cindex].resize(nchunks.size());
-            co[cindex][ii] = cc % nchunks[ii];
-            cc = (cc - co[cindex][ii]) / nchunks[ii];
-            co[cindex][ii] *= chnk_dims[ii];
-        }
-    }
-    return EXIT_SUCCESS;
-}
-
-template <particle_types particle_type>
-particles_io_base<particle_type>::particles_io_base(
-        const char *NAME,
-        const int TRAJ_SKIP,
-        const hid_t data_file_id,
-        MPI_Comm COMM)
-{
-    TIMEZONE("particles_io_base::particles_io_base");
-    this->name = std::string(NAME);
-    this->traj_skip = TRAJ_SKIP;
-    this->comm = COMM;
-    MPI_Comm_rank(COMM, &this->myrank);
-    MPI_Comm_size(COMM, &this->nprocs);
-
-    if (this->myrank == 0)
-    {
-        hid_t dset, prop_list, dspace;
-        this->hdf5_group_id = H5Gopen(data_file_id, this->name.c_str(), H5P_DEFAULT);
-        dset = H5Dopen(this->hdf5_group_id, "state", H5P_DEFAULT);
-        dspace = H5Dget_space(dset);
-        this->hdf5_state_dims.resize(H5Sget_simple_extent_ndims(dspace));
-        H5Sget_simple_extent_dims(dspace, &this->hdf5_state_dims.front(), NULL);
-        assert(this->hdf5_state_dims[this->hdf5_state_dims.size()-1] == state_dimension(particle_type));
-        this->nparticles = 1;
-        for (unsigned int i=1; i<this->hdf5_state_dims.size()-1; i++)
-            this->nparticles *= this->hdf5_state_dims[i];
-        prop_list = H5Dget_create_plist(dset);
-        this->hdf5_state_chunks.resize(this->hdf5_state_dims.size());
-        H5Pget_chunk(prop_list, this->hdf5_state_dims.size(), &this->hdf5_state_chunks.front());
-        H5Pclose(prop_list);
-        H5Sclose(dspace);
-        H5Dclose(dset);
-        this->chunk_size = 1;
-        for (unsigned int i=1; i<this->hdf5_state_dims.size()-1; i++)
-            this->chunk_size *= this->hdf5_state_chunks[i];
-        dset = H5Dopen(this->hdf5_group_id, "rhs", H5P_DEFAULT);
-        dspace = H5Dget_space(dset);
-        this->hdf5_rhs_dims.resize(H5Sget_simple_extent_ndims(dspace));
-        H5Sget_simple_extent_dims(dspace, &this->hdf5_rhs_dims.front(), NULL);
-        prop_list = H5Dget_create_plist(dset);
-        this->hdf5_rhs_chunks.resize(this->hdf5_rhs_dims.size());
-        H5Pget_chunk(prop_list, this->hdf5_rhs_dims.size(), &this->hdf5_rhs_chunks.front());
-        H5Pclose(prop_list);
-        H5Sclose(dspace);
-        H5Dclose(dset);
-    }
-    DEBUG_MSG("hello, rank 0 just read particle thingie\n");
-
-    int tmp;
-    tmp = this->hdf5_state_dims.size();
-    MPI_Bcast(
-            &tmp,
-            1,
-            MPI_INTEGER,
-            0,
-            this->comm);
-    if (this->myrank != 0)
-    {
-        this->hdf5_state_dims.resize(tmp);
-        this->hdf5_state_chunks.resize(tmp);
-    }
-    DEBUG_MSG("successfully resized state_dims and state_chunks\n");
-    MPI_Bcast(
-            &this->hdf5_state_dims.front(),
-            this->hdf5_state_dims.size(),
-            // hsize_t is in fact unsigned long long. Will this ever change...?
-            MPI_UNSIGNED_LONG_LONG,
-            0,
-            this->comm);
-    MPI_Bcast(
-            &this->hdf5_state_chunks.front(),
-            this->hdf5_state_chunks.size(),
-            MPI_UNSIGNED_LONG_LONG,
-            0,
-            this->comm);
-    DEBUG_MSG("successfully broadcasted state_dims and state_chunks\n");
-    for (unsigned i=0; i<this->hdf5_state_chunks.size(); i++)
-        DEBUG_MSG(
-                "hdf5_state_dims[%d] = %ld, hdf5_state_chunks[%d] = %ld\n",
-                i, this->hdf5_state_dims[i],
-                i, this->hdf5_state_chunks[i]
-                );
-    std::vector<hsize_t> tdims(this->hdf5_state_dims), tchnk(this->hdf5_state_chunks);
-    tdims.erase(tdims.begin()+0);
-    tchnk.erase(tchnk.begin()+0);
-    tdims.erase(tdims.end()-1);
-    tchnk.erase(tchnk.end()-1);
-    DEBUG_MSG("before get_chunk_offsets\n");
-    get_chunk_offsets(tdims, tchnk, this->chunk_offsets);
-    DEBUG_MSG("after get_chunk_offsets\n");
-    MPI_Bcast(
-            &this->chunk_size,
-            1,
-            MPI_UNSIGNED,
-            0,
-            this->comm);
-    MPI_Bcast(
-            &this->nparticles,
-            1,
-            MPI_UNSIGNED,
-            0,
-            this->comm);
-    DEBUG_MSG("nparticles = %d, chunk_size = %d\n",
-            this->nparticles,
-            this->chunk_size);
-    DEBUG_MSG("exiting particles_io_base constructor\n");
-}
-
-template <particle_types particle_type>
-particles_io_base<particle_type>::~particles_io_base()
-{
-    if(this->myrank == 0)
-        H5Gclose(this->hdf5_group_id);
-}
-
-template <particle_types particle_type>
-void particles_io_base<particle_type>::read_state_chunk(
-        const int cindex,
-        double *data)
-{
-    TIMEZONE("particles_io_base::read_state_chunk");
-    DEBUG_MSG("entered read_state_chunk\n");
-    hid_t dset = H5Dopen(this->hdf5_group_id, "state", H5P_DEFAULT);
-    hid_t rspace = H5Dget_space(dset);
-    std::vector<hsize_t> mem_dims(this->hdf5_state_chunks);
-    mem_dims[0] = 1;
-    hid_t mspace = H5Screate_simple(
-            this->hdf5_state_dims.size(),
-            &mem_dims.front(),
-            NULL);
-    hsize_t *offset = new hsize_t[this->hdf5_state_dims.size()];
-    offset[0] = this->iteration / this->traj_skip;
-    for (unsigned int i=1; i<this->hdf5_state_dims.size()-1; i++)
-        offset[i] = this->chunk_offsets[cindex][i-1];
-    offset[this->hdf5_state_dims.size()-1] = 0;
-    H5Sselect_hyperslab(
-            rspace,
-            H5S_SELECT_SET,
-            offset,
-            NULL,
-            &mem_dims.front(),
-            NULL);
-    H5Dread(dset, H5T_NATIVE_DOUBLE, mspace, rspace, H5P_DEFAULT, data);
-    H5Sclose(mspace);
-    H5Sclose(rspace);
-    H5Dclose(dset);
-    delete[] offset;
-    DEBUG_MSG("exiting read_state_chunk\n");
-}
-
-template <particle_types particle_type>
-void particles_io_base<particle_type>::write_state_chunk(
-        const int cindex,
-        const double *data)
-{
-    TIMEZONE("particles_io_base::write_state_chunk");
-    hid_t dset = H5Dopen(this->hdf5_group_id, "state", H5P_DEFAULT);
-    hid_t rspace = H5Dget_space(dset);
-    std::vector<hsize_t> mem_dims(this->hdf5_state_chunks);
-    mem_dims[0] = 1;
-    hid_t mspace = H5Screate_simple(
-            this->hdf5_state_dims.size(),
-            &mem_dims.front(),
-            NULL);
-    hsize_t *offset = new hsize_t[this->hdf5_state_dims.size()];
-    offset[0] = this->iteration / this->traj_skip;
-    for (unsigned int i=1; i<this->hdf5_state_dims.size()-1; i++)
-        offset[i] = this->chunk_offsets[cindex][i-1];
-    offset[this->hdf5_state_dims.size()-1] = 0;
-    H5Sselect_hyperslab(
-            rspace,
-            H5S_SELECT_SET,
-            offset,
-            NULL,
-            &mem_dims.front(),
-            NULL);
-    H5Dwrite(dset, H5T_NATIVE_DOUBLE, mspace, rspace, H5P_DEFAULT, data);
-    H5Sclose(mspace);
-    H5Sclose(rspace);
-    H5Dclose(dset);
-    delete[] offset;
-}
-
-template <particle_types particle_type>
-void particles_io_base<particle_type>::read_rhs_chunk(
-        const int cindex,
-        const int rhsindex,
-        double *data)
-{
-    TIMEZONE("particles_io_base::read_rhs_chunk");
-    //DEBUG_MSG("entered read_rhs_chunk\n");
-    hid_t dset = H5Dopen(this->hdf5_group_id, "rhs", H5P_DEFAULT);
-    hid_t rspace = H5Dget_space(dset);
-    std::vector<hsize_t> mem_dims(this->hdf5_rhs_chunks);
-    mem_dims[0] = 1;
-    mem_dims[1] = 1;
-    hid_t mspace = H5Screate_simple(
-            this->hdf5_rhs_dims.size(),
-            &mem_dims.front(),
-            NULL);
-    hsize_t *offset = new hsize_t[this->hdf5_rhs_dims.size()];
-    offset[0] = this->hdf5_rhs_dims[0]-2;
-    offset[1] = rhsindex;
-    for (unsigned int i=2; i<this->hdf5_rhs_dims.size()-1; i++)
-        offset[i] = this->chunk_offsets[cindex][i-2];
-    offset[this->hdf5_rhs_dims.size()-1] = 0;
-    //for (int i=0; i<this->hdf5_rhs_dims.size(); i++)
-    //    DEBUG_MSG("rhs dim %d: size=%d chunk=%d offset=%d\n",
-    //        i, this->hdf5_rhs_dims[i], this->hdf5_rhs_chunks[i], offset[i]);
-    H5Sselect_hyperslab(
-            rspace,
-            H5S_SELECT_SET,
-            offset,
-            NULL,
-            &mem_dims.front(),
-            NULL);
-    //DEBUG_MSG("selected hyperslab\n");
-    H5Dread(dset, H5T_NATIVE_DOUBLE, mspace, rspace, H5P_DEFAULT, data);
-    //DEBUG_MSG("data has been read\n");
-    H5Sclose(mspace);
-    H5Sclose(rspace);
-    H5Dclose(dset);
-    delete[] offset;
-    //DEBUG_MSG("exiting read_rhs_chunk\n");
-}
-
-template <particle_types particle_type>
-void particles_io_base<particle_type>::write_rhs_chunk(
-        const int cindex,
-        const int rhsindex,
-        const double *data)
-{
-    TIMEZONE("particles_io_base::write_rhs_chunk");
-    hid_t dset = H5Dopen(this->hdf5_group_id, "rhs", H5P_DEFAULT);
-    hid_t rspace = H5Dget_space(dset);
-    std::vector<hsize_t> mem_dims(this->hdf5_rhs_chunks);
-    mem_dims[0] = 1;
-    mem_dims[1] = 1;
-    hid_t mspace = H5Screate_simple(
-            this->hdf5_rhs_dims.size(),
-            &mem_dims.front(),
-            NULL);
-    hsize_t *offset = new hsize_t[this->hdf5_rhs_dims.size()];
-    offset[0] = this->hdf5_rhs_dims[0]-1;
-    offset[1] = rhsindex;
-    for (unsigned int i=2; i<this->hdf5_rhs_dims.size()-1; i++)
-        offset[i] = this->chunk_offsets[cindex][i-2];
-    offset[this->hdf5_rhs_dims.size()-1] = 0;
-    DEBUG_MSG("rhs write offsets are %d %d %d %d\n",
-            offset[0], offset[1], offset[2], offset[3]);
-    H5Sselect_hyperslab(
-            rspace,
-            H5S_SELECT_SET,
-            offset,
-            NULL,
-            &mem_dims.front(),
-            NULL);
-    H5Dwrite(dset, H5T_NATIVE_DOUBLE, mspace, rspace, H5P_DEFAULT, data);
-    H5Sclose(mspace);
-    H5Sclose(rspace);
-    H5Dclose(dset);
-    delete[] offset;
-}
-
-template <particle_types particle_type>
-void particles_io_base<particle_type>::write_point3D_chunk(
-        const std::string dset_name,
-        const int cindex,
-        const double *data)
-{
-    TIMEZONE("particles_io_base::write_point3D_chunk");
-    hid_t dset = H5Dopen(this->hdf5_group_id, dset_name.c_str(), H5P_DEFAULT);
-    hid_t rspace = H5Dget_space(dset);
-    std::vector<hsize_t> mem_dims(this->hdf5_state_chunks);
-    mem_dims[0] = 1;
-    mem_dims[mem_dims.size()-1] = 3;
-    hid_t mspace = H5Screate_simple(
-            this->hdf5_state_dims.size(),
-            &mem_dims.front(),
-            NULL);
-    hsize_t *offset = new hsize_t[this->hdf5_state_dims.size()];
-    offset[0] = this->iteration / this->traj_skip;
-    for (unsigned int i=1; i<this->hdf5_state_dims.size()-1; i++)
-        offset[i] = this->chunk_offsets[cindex][i-1];
-    offset[this->hdf5_state_dims.size()-1] = 0;
-    H5Sselect_hyperslab(
-            rspace,
-            H5S_SELECT_SET,
-            offset,
-            NULL,
-            &mem_dims.front(),
-            NULL);
-    H5Dwrite(dset, H5T_NATIVE_DOUBLE, mspace, rspace, H5P_DEFAULT, data);
-    H5Sclose(mspace);
-    H5Sclose(rspace);
-    H5Dclose(dset);
-    delete[] offset;
-}
-
-/*****************************************************************************/
-template class single_particle_state<POINT3D>;
-template class single_particle_state<VELOCITY_TRACER>;
-
-template class particles_io_base<VELOCITY_TRACER>;
-/*****************************************************************************/
-
diff --git a/bfps/cpp/particles_base.hpp b/bfps/cpp/particles_base.hpp
deleted file mode 100644
index 8afd5d439cdc121982868b5eadc991cdc1c5abdb..0000000000000000000000000000000000000000
--- a/bfps/cpp/particles_base.hpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/**********************************************************************
-*                                                                     *
-*  Copyright 2015 Max Planck Institute                                *
-*                 for Dynamics and Self-Organization                  *
-*                                                                     *
-*  This file is part of bfps.                                         *
-*                                                                     *
-*  bfps is free software: you can redistribute it and/or modify       *
-*  it under the terms of the GNU General Public License as published  *
-*  by the Free Software Foundation, either version 3 of the License,  *
-*  or (at your option) any later version.                             *
-*                                                                     *
-*  bfps is distributed in the hope that it will be useful,            *
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
-*  GNU General Public License for more details.                       *
-*                                                                     *
-*  You should have received a copy of the GNU General Public License  *
-*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
-*                                                                     *
-* Contact: Cristian.Lalescu@ds.mpg.de                                 *
-*                                                                     *
-**********************************************************************/
-
-
-
-#include <vector>
-#include <hdf5.h>
-#include <unordered_map>
-#include "interpolator_base.hpp"
-
-#ifndef PARTICLES_BASE
-
-#define PARTICLES_BASE
-
-/* particle types */
-enum particle_types {POINT3D, VELOCITY_TRACER};
-
-/* space dimension */
-constexpr unsigned int state_dimension(particle_types particle_type)
-{
-    return ((particle_type == POINT3D) ? 3 : (
-            (particle_type == VELOCITY_TRACER) ? 3 :
-            3));
-}
-
-/* 1 particle state type */
-
-template <particle_types particle_type>
-class single_particle_state
-{
-    public:
-        double data[state_dimension(particle_type)];
-
-        single_particle_state();
-        single_particle_state(const single_particle_state &src);
-        single_particle_state(const double *src);
-        ~single_particle_state();
-
-        single_particle_state<particle_type> &operator=(const single_particle_state &src);
-        single_particle_state<particle_type> &operator=(const double *src);
-
-        inline double &operator[](const int i)
-        {
-            return this->data[i];
-        }
-};
-
-std::vector<std::vector<hsize_t>> get_chunk_offsets(
-        std::vector<hsize_t> data_dims,
-        std::vector<hsize_t> chnk_dims);
-
-template <particle_types particle_type>
-class particles_io_base
-{
-    protected:
-        int myrank, nprocs;
-        MPI_Comm comm;
-
-        unsigned int nparticles;
-
-        std::string name;
-        unsigned int chunk_size;
-        int traj_skip;
-
-        hid_t hdf5_group_id;
-        std::vector<hsize_t> hdf5_state_dims, hdf5_state_chunks;
-        std::vector<hsize_t> hdf5_rhs_dims, hdf5_rhs_chunks;
-
-        std::vector<std::vector<hsize_t>> chunk_offsets;
-
-        particles_io_base(
-                const char *NAME,
-                const int TRAJ_SKIP,
-                const hid_t data_file_id,
-                MPI_Comm COMM);
-        virtual ~particles_io_base();
-
-        void read_state_chunk(
-                const int cindex,
-                double *__restrict__ data);
-        void write_state_chunk(
-                const int cindex,
-                const double *data);
-        void read_rhs_chunk(
-                const int cindex,
-                const int rhsindex,
-                double *__restrict__ data);
-        void write_rhs_chunk(
-                const int cindex,
-                const int rhsindex,
-                const double *data);
-
-        void write_point3D_chunk(
-                const std::string dset_name,
-                const int cindex,
-                const double *data);
-
-    public:
-        int iteration;
-
-        inline const char *get_name()
-        {
-            return this->name.c_str();
-        }
-        inline const unsigned int get_number_of_chunks()
-        {
-            return this->chunk_offsets.size();
-        }
-        inline const unsigned int get_number_of_rhs_chunks();
-        virtual void read() = 0;
-        virtual void write(const bool write_rhs = true) = 0;
-};
-
-#endif//PARTICLES_BASE
-
diff --git a/bfps/cpp/spline.hpp b/bfps/cpp/spline.hpp
deleted file mode 100644
index d66d2b1eb42278b987072ffff24d0123c86a1e2f..0000000000000000000000000000000000000000
--- a/bfps/cpp/spline.hpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef SPLINE_HPP
-#define SPLINE_HPP
-
-#include "spline_n1.hpp"
-#include "spline_n2.hpp"
-#include "spline_n3.hpp"
-#include "spline_n4.hpp"
-#include "spline_n5.hpp"
-#include "spline_n6.hpp"
-#include "spline_n7.hpp"
-#include "spline_n8.hpp"
-#include "spline_n9.hpp"
-#include "spline_n10.hpp"
-
-#endif
diff --git a/bfps/tools.py b/bfps/tools.py
index 9acf4e22bf48477f9cfcb887ce8b39d33cbc6837..c385c477ca67f8da1b995aca18ee46861e418ed0 100644
--- a/bfps/tools.py
+++ b/bfps/tools.py
@@ -1,26 +1,25 @@
-#######################################################################
-#                                                                     #
-#  Copyright 2015 Max Planck Institute                                #
-#                 for Dynamics and Self-Organization                  #
-#                                                                     #
-#  This file is part of bfps.                                         #
-#                                                                     #
-#  bfps is free software: you can redistribute it and/or modify       #
-#  it under the terms of the GNU General Public License as published  #
-#  by the Free Software Foundation, either version 3 of the License,  #
-#  or (at your option) any later version.                             #
-#                                                                     #
-#  bfps is distributed in the hope that it will be useful,            #
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of     #
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      #
-#  GNU General Public License for more details.                       #
-#                                                                     #
-#  You should have received a copy of the GNU General Public License  #
-#  along with bfps.  If not, see <http://www.gnu.org/licenses/>       #
-#                                                                     #
-# Contact: Cristian.Lalescu@ds.mpg.de                                 #
-#                                                                     #
-#######################################################################
+################################################################################
+#                                                                              #
+#  Copyright 2015-2019 Max Planck Institute for Dynamics and Self-Organization #
+#                                                                              #
+#  This file is part of bfps.                                                  #
+#                                                                              #
+#  bfps is free software: you can redistribute it and/or modify                #
+#  it under the terms of the GNU General Public License as published           #
+#  by the Free Software Foundation, either version 3 of the License,           #
+#  or (at your option) any later version.                                      #
+#                                                                              #
+#  bfps is distributed in the hope that it will be useful,                     #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+#  GNU General Public License for more details.                                #
+#                                                                              #
+#  You should have received a copy of the GNU General Public License           #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>                #
+#                                                                              #
+# Contact: Cristian.Lalescu@ds.mpg.de                                          #
+#                                                                              #
+################################################################################
 
 
 
diff --git a/machine_settings_py.py b/cmake/BFPSConfig.cmake.in
similarity index 53%
rename from machine_settings_py.py
rename to cmake/BFPSConfig.cmake.in
index 787f1d5a10b9b0b260b42a1da18d35e67c56dacc..bd2af7160bbd8583b4d6ebd8cd6d710fc6fdfb9f 100644
--- a/machine_settings_py.py
+++ b/cmake/BFPSConfig.cmake.in
@@ -1,6 +1,6 @@
 #######################################################################
 #                                                                     #
-#  Copyright 2015 Max Planck Institute                                #
+#  Copyright 2019 Max Planck Institute                                #
 #                 for Dynamics and Self-Organization                  #
 #                                                                     #
 #  This file is part of bfps.                                         #
@@ -23,41 +23,45 @@
 #######################################################################
 
 
+#-----------------------------------------------------------------------------
+#
+# BFPSConfig.cmake - BFPS CMake configuration file for external projects.
+#
+# This file is configured by BFPS and used by the BFPS.cmake module
+# to load BFPS's settings for an external project.
+#
+@BFPS_CONFIG_INSTALL_ONLY@
 
-import os
+#
+SET(BFPS_VERSION "@BFPS_VERSION@")
 
-########################################################################
-# these lists should be adapted for your different environment(s)
-# personally, I have access to setups where my home folder is shared
-# between different machines, including cluster and desktop, therefore
-# I check the host name when choosing libraries etc.
-# feel free to do your own thing to the copy of this file placed in
-# ./config/bfps
-########################################################################
+#
+SET(HAVE_BFPS TRUE)
+SET(BFPS_PREFIX        "@CMAKE_INSTALL_PREFIX@")
+SET(BFPS_INCLUDE_DIR   "@CMAKE_INSTALL_PREFIX@/include")
+SET(BFPS_LIBRARIES_DIR "@CMAKE_INSTALL_PREFIX@/lib")
 
-hostname = os.getenv('HOSTNAME')
+SET(BFPS_LINK_DIRECTORIES  "@ALL_LINK_DIRS@")
+SET(BFPS_INCLUDE_DIRECTORIES  "@ALL_INCLUDE_DIRS@")
 
-compiler = 'g++'
-extra_compile_args = ['-Wall', '-O2', '-g', '-mtune=native', '-ffast-math', '-std=c++11']
-extra_libraries = ['hdf5']
-include_dirs = []
-library_dirs = []
+SET(BFPS_CXX_COMPILE_FLAGS  "@CMAKE_CXX_COMPILE_FLAGS@")
+SET(BFPS_CXX_COMPILER  "@CMAKE_CXX_COMPILER@")
+SET(BFPS_C_COMPILER  "@CMAKE_C_COMPILER@")
+SET(BFPS_EXE_LINKER_FLAGS  "@CMAKE_EXE_LINKER_FLAGS@")
+SET(BFPS_LIBS  "@BFPS_LIBS@")
+set(BFPS_DEFINITIONS @COMPILE_DEFINITIONS@)
 
-if hostname == 'chichi-G':
-    include_dirs = ['/usr/local/include',
-                    '/usr/include/mpich']
-    library_dirs = ['/usr/local/lib',
-                    '/usr/lib/mpich']
-    extra_libraries += ['mpich']
+#
+SET(BFPS_SOURCE_DIR	   "@BFPS_SOURCE_DIR@")
 
-if hostname in ['tolima', 'misti']:
-    local_install_dir = '/scratch.local/chichi/installs'
+#
+SET(BFPS_BUILD_TYPE     "@CMAKE_BUILD_TYPE@")
 
-    include_dirs = ['/usr/lib64/mpi/gcc/openmpi/include',
-                    os.path.join(local_install_dir, 'include')]
+#
+SET(BFPS_HDF5_USE_SZIP  "@BFPS_HDF5_USE_SZIP@")
+SET(BFPS_HDF5_SZIP_LIB_PATH "@BFPS_HDF5_SZIP_LIB_PATH@")
 
-    library_dirs = ['/usr/lib64/mpi/gcc/openmpi/lib64',
-                    os.path.join(local_install_dir, 'lib'),
-                    os.path.join(local_install_dir, 'lib64')]
-    extra_libraries += ['mpi_cxx', 'mpi']
+#
+set(BFPS_SRC_INCLUDE_DIRS "@BFPS_INCLUDE_DIRS@")
+set(BFPS_BUILD_LIBRARY_DIRS "@BFPS_LIB_DIR@")
 
diff --git a/cmake/morse/FindCommon.cmake b/cmake/morse/FindCommon.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..95d8c1f5404c0d7ea2384d84bd12c2e4a3cc3418
--- /dev/null
+++ b/cmake/morse/FindCommon.cmake
@@ -0,0 +1,47 @@
+###
+#
+# @copyright (c) 2018 Inria. All rights reserved.
+#
+###
+#
+#  @file FindCommon.cmake
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver.
+#
+#  @version 1.0.0
+#  @author Florent Pruvost
+#  @date 13-04-2018
+#
+###
+
+# clean these variables before using them in CMAKE_REQUIRED_* variables in
+# check_function_exists
+macro(finds_remove_duplicates)
+  if (REQUIRED_DEFINITIONS)
+    list(REMOVE_DUPLICATES REQUIRED_DEFINITIONS)
+  endif()
+  if (REQUIRED_INCDIRS)
+    list(REMOVE_DUPLICATES REQUIRED_INCDIRS)
+  endif()
+  if (REQUIRED_FLAGS)
+    list(REMOVE_DUPLICATES REQUIRED_FLAGS)
+  endif()
+  if (REQUIRED_LDFLAGS)
+    list(REMOVE_DUPLICATES REQUIRED_LDFLAGS)
+  endif()
+  if (REQUIRED_LIBS)
+    list(REVERSE REQUIRED_LIBS)
+    list(REMOVE_DUPLICATES REQUIRED_LIBS)
+    list(REVERSE REQUIRED_LIBS)
+  endif()
+endmacro()
+
+##
+## @end file FindCommon
+##
diff --git a/cmake/morse/FindFFTW.cmake b/cmake/morse/FindFFTW.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..37450baea9f52a9a4e8a1236d6234d3c3840ba79
--- /dev/null
+++ b/cmake/morse/FindFFTW.cmake
@@ -0,0 +1,832 @@
+###
+#
+# @copyright (c) 2009-2014 The University of Tennessee and The University
+#                          of Tennessee Research Foundation.
+#                          All rights reserved.
+# @copyright (c) 2012-2018 Inria. All rights reserved.
+# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
+#
+###
+#
+# - Find FFTW Version 3 include dirs and libraries
+# Default configuration will find the real double precision fftw library version
+# without THREADS|OMP.
+# Use this module by invoking find_package with the form:
+#  find_package(FFTW
+#               [REQUIRED] # Fail with error if fftw is not found
+#               [COMPONENTS MKL]
+#
+#  COMPONENTS can be some of the following:
+#   - MKL:     to detect the FFTW from Intel MKL
+#   - ESSL:    to detect the FFTW from IBM ESSL
+#   - THREADS: to detect the Threads version of FFTW
+#   - OMP:     to detect the OpenMP version of FFTW
+#   - SIMPLE:  to detect the FFTW simple precision fftw3f
+#   - LONG:    to detect the FFTW long double precision fftw3l
+#   - QUAD:    to detect the FFTW quadruple precision fftw3q
+#
+# This module finds headers and fftw library.
+# Results are reported in variables:
+#  FFTW_FOUND            - True if headers and requested libraries were found
+#  FFTW_CFLAGS_OTHER      - fftw compiler flags without headers paths
+#  FFTW_LDFLAGS_OTHER     - fftw linker flags without libraries
+#  FFTW_INCLUDE_DIRS      - fftw include directories
+#  FFTW_LIBRARY_DIRS      - fftw link directories
+#  FFTW_LIBRARIES         - fftw libraries to be linked (absolute path)
+#  FFTW_CFLAGS_OTHER_DEP  - fftw + dependencies compiler flags without headers paths
+#  FFTW_LDFLAGS_OTHER_DEP - fftw + dependencies linker flags without libraries
+#  FFTW_INCLUDE_DIRS_DEP  - fftw + dependencies include directories
+#  FFTW_LIBRARY_DIRS_DEP  - fftw + dependencies link directories
+#  FFTW_LIBRARIES_DEP     - fftw + dependencies libraries
+#
+#  FFTW_FOUND_WITH_PKGCONFIG - True if found with pkg-config
+#  if found with pkg-config the following variables are set
+#  <PREFIX>  = FFTW3F or FFTW3 or FFTW3L or FFTW3Q
+#  <XPREFIX> = <PREFIX>        for common case
+#  <XPREFIX> = <PREFIX>_STATIC for static linking
+#  <XPREFIX>_FOUND          ... set to 1 if module(s) exist
+#  <XPREFIX>_LIBRARIES      ... only the libraries (w/o the '-l')
+#  <XPREFIX>_LIBRARY_DIRS   ... the paths of the libraries (w/o the '-L')
+#  <XPREFIX>_LDFLAGS        ... all required linker flags
+#  <XPREFIX>_LDFLAGS_OTHER  ... all other linker flags
+#  <XPREFIX>_INCLUDE_DIRS   ... the '-I' preprocessor flags (w/o the '-I')
+#  <XPREFIX>_CFLAGS         ... all required cflags
+#  <XPREFIX>_CFLAGS_OTHER   ... the other compiler flags
+#
+# The user can give specific paths where to find the libraries adding cmake
+# options at configure (ex: cmake path/to/project -DFFTW_DIR=path/to/fftw):
+#  FFTW_DIR             - Where to find the base directory of fftw
+#  FFTW_INCDIR          - Where to find the header files
+#  FFTW_LIBDIR          - Where to find the library files
+# The module can also look for the following environment variables if paths
+# are not given as cmake variable: FFTW_DIR, FFTW_INCDIR, FFTW_LIBDIR
+# For MKL case and if no paths are given as hints, we will try to use the MKLROOT
+# environment variable
+
+#=============================================================================
+# Copyright 2012-2018 Inria
+# Copyright 2012-2013 Emmanuel Agullo
+# Copyright 2012-2013 Mathieu Faverge
+# Copyright 2012      Cedric Castagnede
+# Copyright 2013-2018 Florent Pruvost
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file MORSE-Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of Morse, substitute the full
+#  License text for the above reference.)
+
+# Common macros to use in finds
+include(FindInit)
+
+if (NOT FFTW_FOUND)
+  set(FFTW_DIR "" CACHE PATH "Installation directory of FFTW library given by user")
+  if (NOT FFTW_FIND_QUIETLY)
+    message(STATUS "A cache variable, namely FFTW_DIR, has been set to specify the install directory of FFTW")
+  endif()
+endif()
+
+# Set the version to find
+set(FFTW_LOOK_FOR_MKL OFF)
+set(FFTW_LOOK_FOR_ESSL OFF)
+set(FFTW_LOOK_FOR_THREADS OFF)
+set(FFTW_LOOK_FOR_OMP OFF)
+set(FFTW_LOOK_FOR_FFTW_SIMPLE OFF)
+set(FFTW_LOOK_FOR_FFTW_LONG OFF)
+set(FFTW_LOOK_FOR_FFTW_QUAD OFF)
+
+if( FFTW_FIND_COMPONENTS )
+  foreach( component ${FFTW_FIND_COMPONENTS} )
+    if (${component} STREQUAL "THREADS")
+      # means we look for the Threads version of FFTW
+      set(FFTW_LOOK_FOR_THREADS ON)
+    endif()
+    if (${component} STREQUAL "OMP")
+      # means we look for the OpenMP version of FFTW
+      set(FFTW_LOOK_FOR_OMP ON)
+    endif()
+    if (${component} STREQUAL "SIMPLE")
+      # means we look for FFTW simple precision (fftw3f)
+      set(FFTW_LOOK_FOR_FFTW_SIMPLE ON)
+      set(FFTW_LOOK_FOR_FFTW_LONG OFF)
+      set(FFTW_LOOK_FOR_FFTW_QUAD OFF)
+    endif()
+    if (${component} STREQUAL "LONG")
+      # means we look for FFTW long double precision (fftw3l)
+      set(FFTW_LOOK_FOR_FFTW_SIMPLE OFF)
+      set(FFTW_LOOK_FOR_FFTW_LONG ON)
+      set(FFTW_LOOK_FOR_FFTW_QUAD OFF)
+    endif()
+    if (${component} STREQUAL "QUAD")
+      # means we look for FFTW quad precision (fftw3q)
+      set(FFTW_LOOK_FOR_FFTW_SIMPLE OFF)
+      set(FFTW_LOOK_FOR_FFTW_LONG OFF)
+      set(FFTW_LOOK_FOR_FFTW_QUAD ON)
+    endif()
+    if (${component} STREQUAL "MKL")
+      # means we look for the Intel MKL version of FFTW
+      set(FFTW_LOOK_FOR_MKL ON)
+      if (FFTW_LOOK_FOR_FFTW_LONG)
+        if (NOT FFTW_FIND_QUIETLY)
+          message(WARNING "Looking for FFTW -- long precision functions do not exist in MKL FFTW")
+        endif()
+        set(FFTW_LOOK_FOR_FFTW_LONG OFF)
+      endif()
+      if (FFTW_LOOK_FOR_FFTW_QUAD)
+        if (NOT FFTW_FIND_QUIETLY)
+          message(WARNING "Looking for FFTW -- quadruple functions do not exist in MKL FFTW")
+        endif()
+        set(FFTW_LOOK_FOR_FFTW_QUAD OFF)
+      endif()
+    endif()
+    if (${component} STREQUAL "ESSL")
+      # means we look for the Intel MKL version of FFTW
+      set(FFTW_LOOK_FOR_ESSL ON)
+      if (FFTW_LOOK_FOR_FFTW_LONG)
+        if (NOT FFTW_FIND_QUIETLY)
+          message(WARNING "Looking for FFTW -- long precision functions do not exist in FFTW_ESSL")
+        endif()
+        set(FFTW_LOOK_FOR_FFTW_LONG OFF)
+      endif()
+      if (FFTW_LOOK_FOR_FFTW_QUAD)
+        if (NOT FFTW_FIND_QUIETLY)
+          message(WARNING "Looking for FFTW -- quadruple functions do not exist in FFTW_ESSL")
+        endif()
+        set(FFTW_LOOK_FOR_FFTW_QUAD OFF)
+      endif()
+      if (FFTW_LOOK_FOR_OMP)
+        if (NOT FFTW_FIND_QUIETLY)
+          message(WARNING "Looking for FFTW -- FFTW_ESSL does not use OpenMP")
+        endif()
+        set(FFTW_LOOK_FOR_OMP OFF)
+      endif()
+    endif()
+  endforeach()
+endif()
+
+if (FFTW_LOOK_FOR_THREADS)
+  if (NOT FFTW_FIND_QUIETLY)
+    message(STATUS "FFTW looks for threads")
+  endif()
+  if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_THREADS)
+    find_package(Threads REQUIRED)
+  else()
+    find_package(Threads)
+  endif()
+endif()
+
+if (FFTW_LOOK_FOR_OMP)
+  if (NOT FFTW_FIND_QUIETLY)
+    message(STATUS "FFTW looks for openmp")
+  endif()
+  if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_OMP)
+    find_package(OpenMP REQUIRED)
+  else()
+    find_package(OpenMP)
+  endif()
+endif()
+
+if (FFTW_LOOK_FOR_MKL)
+  if (NOT FFTW_FIND_QUIETLY)
+    message(STATUS "FFTW looks for threads and Intel MKL")
+  endif()
+  if (FFTW_LOOK_FOR_THREADS)
+    set(BLA_VENDOR "Intel10_64lp")
+  else()
+    set(BLA_VENDOR "Intel10_64lp_seq")
+  endif()
+  if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_MKL)
+    find_package(Threads REQUIRED)
+    find_package(BLAS REQUIRED)
+  else()
+    find_package(Threads)
+    find_package(BLAS)
+  endif()
+endif()
+
+if (FFTW_LOOK_FOR_ESSL)
+  if (NOT FFTW_FIND_QUIETLY)
+    message(STATUS "FFTW looks for IBM ESSL")
+  endif()
+  if (FFTW_LOOK_FOR_THREADS)
+    set(BLA_VENDOR "IBMESSLMT")
+  else()
+    set(BLA_VENDOR "IBMESSL")
+  endif()
+  if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_ESSL)
+    find_package(BLAS REQUIRED)
+  else()
+    find_package(BLAS)
+  endif()
+endif()
+
+
+if( THREADS_FOUND )
+  libraries_absolute_path(CMAKE_THREAD_LIBS_INIT "")
+endif ()
+  
+set(ENV_FFTW_DIR "$ENV{FFTW_DIR}")
+set(ENV_FFTW_INCDIR "$ENV{FFTW_INCDIR}")
+set(ENV_FFTW_LIBDIR "$ENV{FFTW_LIBDIR}")
+set(FFTW_GIVEN_BY_USER "FALSE")
+if ( FFTW_DIR OR ( FFTW_INCDIR AND FFTW_LIBDIR) OR ENV_FFTW_DIR OR (ENV_FFTW_INCDIR AND ENV_FFTW_LIBDIR) )
+  set(FFTW_GIVEN_BY_USER "TRUE")
+endif()
+
+
+# Optionally use pkg-config to detect include/library dirs (if pkg-config is available)
+# -------------------------------------------------------------------------------------
+if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
+  include(FindPkgConfig)
+  find_package(PkgConfig QUIET)
+  if( PKG_CONFIG_EXECUTABLE AND NOT FFTW_GIVEN_BY_USER )
+
+    set(FFTW_INCLUDE_DIRS)
+    set(FFTW_LIBRARY_DIRS)
+    set(FFTW_LIBRARIES)
+
+    if(FFTW_LOOK_FOR_FFTW_SIMPLE)
+      pkg_search_module(FFTW3F fftw3f)
+      pkg_search_module(FFTW3 fftw3)
+      if (FFTW3F_FOUND)
+        if (NOT FFTW_FIND_QUIETLY)
+          message(STATUS "Looking for FFTW3F - found using PkgConfig")
+        endif()
+        if (FFTW3F_LIBRARIES)
+          find_pkgconfig_libraries_absolute_path(FFTW3F)
+          list(APPEND FFTW_LIBRARIES "${FFTW3F_LIBRARIES}")
+        endif()
+        if(FFTW3F_INCLUDE_DIRS)
+          list(APPEND FFTW_INCLUDE_DIRS "${FFTW3F_INCLUDE_DIRS}")
+        else()
+          if (NOT FFTW_FIND_QUIETLY)
+            message(WARNING "FFTW3F_INCLUDE_DIRS is empty using PkgConfig."
+              "Perhaps the path to fftw3f headers is already present in your"
+              "CPATH/C(PLUS)_INCLUDE_PATH environment variables.")
+          endif()
+        endif()
+        if(FFTW3F_LIBRARY_DIRS)
+          list(APPEND FFTW_LIBRARY_DIRS "${FFTW3F_LIBRARY_DIRS}")
+        endif()
+      else(FFTW3F_FOUND)
+        if (NOT FFTW_FIND_QUIETLY)
+          message(STATUS "Looking for FFTW3F - not found using PkgConfig."
+            "\n   Perhaps you should add the directory containing fftw3f.pc to"
+            "\n   the PKG_CONFIG_PATH environment variable.")
+        endif()
+      endif(FFTW3F_FOUND)
+    elseif(FFTW_LOOK_FOR_FFTW_LONG)
+      pkg_search_module(FFTW3L fftw3l)
+      pkg_search_module(FFTW3 fftw3)
+      if (FFTW3L_FOUND)
+        if (NOT FFTW_FIND_QUIETLY)
+          message(STATUS "Looking for FFTW3L - found using PkgConfig")
+        endif()
+        if (FFTW3L_LIBRARIES)
+          find_pkgconfig_libraries_absolute_path(FFTW3L)
+          list(APPEND FFTW_LIBRARIES "${FFTW3L_LIBRARIES}")
+        endif()
+        if(FFTW3L_INCLUDE_DIRS)
+          list(APPEND FFTW_INCLUDE_DIRS "${FFTW3L_INCLUDE_DIRS}")
+        else()
+          if (NOT FFTW_FIND_QUIETLY)
+            message(WARNING "FFTW3L_INCLUDE_DIRS is empty using PkgConfig."
+              "Perhaps the path to fftw3l headers is already present in your"
+              "CPATH/C(PLUS)_INCLUDE_PATH environment variables.")
+          endif()
+        endif()
+        if(FFTW3L_LIBRARY_DIRS)
+          list(APPEND FFTW_LIBRARY_DIRS "${FFTW3L_LIBRARY_DIRS}")
+        endif()
+      else(FFTW3L_FOUND)
+        if (NOT FFTW_FIND_QUIETLY)
+          message(STATUS "Looking for FFTW3L - not found using PkgConfig."
+            "\n   Perhaps you should add the directory containing fftw3l.pc to"
+            "\n   the PKG_CONFIG_PATH environment variable.")
+        endif()
+      endif(FFTW3L_FOUND)
+    elseif(FFTW_LOOK_FOR_FFTW_QUAD)
+      pkg_search_module(FFTW3Q fftw3q)
+      pkg_search_module(FFTW3 fftw3)
+      if (FFTW3Q_FOUND)
+        if (NOT FFTW_FIND_QUIETLY)
+          message(STATUS "Looking for FFTW3Q - found using PkgConfig")
+        endif()
+        if (FFTW3Q_LIBRARIES)
+          find_pkgconfig_libraries_absolute_path(FFTW3Q)
+          list(APPEND FFTW_LIBRARIES "${FFTW3Q_LIBRARIES}")
+        endif()
+        if(FFTW3Q_INCLUDE_DIRS)
+          list(APPEND FFTW_INCLUDE_DIRS "${FFTW3Q_INCLUDE_DIRS}")
+        else()
+          if (NOT FFTW_FIND_QUIETLY)
+            message(WARNING "FFTW3Q_INCLUDE_DIRS is empty using PkgConfig."
+              "Perhaps the path to fftw3q headers is already present in your"
+              "CPATH/C(PLUS)_INCLUDE_PATH environment variables.")
+          endif()
+        endif()
+        if(FFTW3Q_LIBRARY_DIRS)
+          list(APPEND FFTW_LIBRARY_DIRS "${FFTW3Q_LIBRARY_DIRS}")
+        endif()
+      else(FFTW3Q_FOUND)
+        if (NOT FFTW_FIND_QUIETLY)
+          message(STATUS "Looking for FFTW3Q - not found using PkgConfig."
+            "\n   Perhaps you should add the directory containing fftw3q.pc to"
+            "\n   the PKG_CONFIG_PATH environment variable.")
+        endif()
+      endif(FFTW3Q_FOUND)
+    else()
+      pkg_search_module(FFTW3 fftw3)
+      if (FFTW3_FOUND AND FFTW3_LIBRARIES)
+        find_pkgconfig_libraries_absolute_path(FFTW3)
+      endif()
+    endif()
+    if (FFTW3_FOUND)
+      if (NOT FFTW_FIND_QUIETLY)
+        message(STATUS "Looking for FFTW3 - found using PkgConfig")
+      endif()
+      if (FFTW3_LIBRARIES)
+        find_pkgconfig_libraries_absolute_path(FFTW3)
+        list(APPEND FFTW_LIBRARIES "${FFTW3_LIBRARIES}")
+      endif()
+      if(FFTW3_INCLUDE_DIRS)
+            list(APPEND FFTW_INCLUDE_DIRS "${FFTW3_INCLUDE_DIRS}")
+      else()
+        if (NOT FFTW_FIND_QUIETLY)
+          message(WARNING "FFTW3_INCLUDE_DIRS is empty using PkgConfig."
+            "Perhaps the path to fftw3 headers is already present in your"
+            "CPATH/C(PLUS)_INCLUDE_PATH environment variables.")
+        endif()
+      endif()
+      if(FFTW3_LIBRARY_DIRS)
+            list(APPEND FFTW_LIBRARY_DIRS "${FFTW3_LIBRARY_DIRS}")
+      endif()
+    else(FFTW3_FOUND)
+      if (NOT FFTW_FIND_QUIETLY)
+        message(STATUS "Looking for FFTW3 - not found using PkgConfig."
+          "\n   Perhaps you should add the directory containing fftw3.pc to"
+          "\n   the PKG_CONFIG_PATH environment variable.")
+      endif()
+    endif(FFTW3_FOUND)
+
+    if (FFTW_FOUND AND FFTW_LIBRARIES)
+      set(FFTW_FOUND_WITH_PKGCONFIG "TRUE")
+    else()
+      set(FFTW_FOUND_WITH_PKGCONFIG "FALSE")
+    endif()
+
+  endif( PKG_CONFIG_EXECUTABLE AND NOT FFTW_GIVEN_BY_USER )
+
+endif(NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
+
+if( (NOT PKG_CONFIG_EXECUTABLE) OR
+    (PKG_CONFIG_EXECUTABLE AND NOT FFTW_FOUND) OR
+    FFTW_GIVEN_BY_USER OR
+    FFTW_LOOK_FOR_MKL  OR
+    FFTW_LOOK_FOR_ESSL
+    )
+
+  # Looking for include
+  # -------------------
+
+  # Add system include paths to search include
+  # ------------------------------------------
+  unset(_inc_env)
+  set(ENV_MKLROOT "$ENV{MKLROOT}")
+  set(ENV_FFTW_DIR "$ENV{FFTW_DIR}")
+  set(ENV_FFTW_INCDIR "$ENV{FFTW_INCDIR}")
+  if(ENV_FFTW_INCDIR)
+    list(APPEND _inc_env "${ENV_FFTW_INCDIR}")
+  elseif(ENV_FFTW_DIR)
+    list(APPEND _inc_env "${ENV_FFTW_DIR}")
+    list(APPEND _inc_env "${ENV_FFTW_DIR}/include")
+    list(APPEND _inc_env "${ENV_FFTW_DIR}/include/fftw")
+  else()
+    if (ENV_MKLROOT)
+      list(APPEND _inc_env "${ENV_MKLROOT}/include/fftw")
+    endif()
+    # system variables
+    if(WIN32)
+      string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
+      list(APPEND _inc_env "${_path_env}")
+    else()
+      string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
+      list(APPEND _inc_env "${_path_env}")
+      string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
+      list(APPEND _inc_env "${_path_env}")
+      string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
+      list(APPEND _inc_env "${_path_env}")
+      string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
+      list(APPEND _inc_env "${_path_env}")
+    endif()
+  endif()
+  list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
+  list(REMOVE_DUPLICATES _inc_env)
+
+  # set paths where to look for
+  set(PATH_TO_LOOK_FOR "${_inc_env}")
+
+  if (FFTW_LOOK_FOR_ESSL)
+    set(FFTW3_HEADER_TO_FIND "fftw3_essl.h")
+  else()
+    set(FFTW3_HEADER_TO_FIND "fftw3.h")
+  endif()
+
+  # Try to find the fftw header in the given paths
+  # -------------------------------------------------
+  # call cmake macro to find the header path
+  if(FFTW_INCDIR)
+    set(FFTW_${FFTW3_HEADER_TO_FIND}_DIRS "FFTW_${FFTW3_HEADER_TO_FIND}_DIRS-NOTFOUND")
+    find_path(FFTW_${FFTW3_HEADER_TO_FIND}_DIRS
+      NAMES ${FFTW3_HEADER_TO_FIND}
+      HINTS ${FFTW_INCDIR})
+  else()
+    if(FFTW_DIR)
+      set(FFTW_${FFTW3_HEADER_TO_FIND}_DIRS "FFTW_${FFTW3_HEADER_TO_FIND}_DIRS-NOTFOUND")
+      find_path(FFTW_${FFTW3_HEADER_TO_FIND}_DIRS
+        NAMES ${FFTW3_HEADER_TO_FIND}
+        HINTS ${FFTW_DIR}
+        PATH_SUFFIXES "include" "include/fftw")
+    else()
+      set(FFTW_${FFTW3_HEADER_TO_FIND}_DIRS "FFTW_${FFTW3_HEADER_TO_FIND}_DIRS-NOTFOUND")
+      find_path(FFTW_${FFTW3_HEADER_TO_FIND}_DIRS
+        NAMES ${FFTW3_HEADER_TO_FIND}
+        HINTS ${PATH_TO_LOOK_FOR}
+        PATH_SUFFIXES "fftw")
+    endif()
+  endif()
+  mark_as_advanced(FFTW_${FFTW3_HEADER_TO_FIND}_DIRS)
+
+  # Add path to cmake variable
+  # ------------------------------------
+  if (FFTW_${FFTW3_HEADER_TO_FIND}_DIRS)
+    set(FFTW_INCLUDE_DIRS "${FFTW_${FFTW3_HEADER_TO_FIND}_DIRS}")
+  else ()
+    set(FFTW_INCLUDE_DIRS "FFTW_INCLUDE_DIRS-NOTFOUND")
+    if(NOT FFTW_FIND_QUIETLY)
+      message(STATUS "Looking for FFTW -- ${FFTW3_HEADER_TO_FIND} not found")
+    endif()
+  endif ()
+
+
+  # Looking for lib
+  # ---------------
+
+  # Add system library paths to search lib
+  # --------------------------------------
+  unset(_lib_env)
+  set(ENV_FFTW_LIBDIR "$ENV{FFTW_LIBDIR}")
+  if(ENV_FFTW_LIBDIR)
+    list(APPEND _lib_env "${ENV_FFTW_LIBDIR}")
+  elseif(ENV_FFTW_DIR)
+    list(APPEND _lib_env "${ENV_FFTW_DIR}")
+    list(APPEND _lib_env "${ENV_FFTW_DIR}/lib")
+    if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+      list(APPEND _lib_env "${ENV_FFTW_DIR}/lib64")
+      list(APPEND _lib_env "${ENV_FFTW_DIR}/lib/intel64")
+    else()
+      list(APPEND _lib_env "${ENV_FFTW_DIR}/lib32")
+      list(APPEND _lib_env "${ENV_FFTW_DIR}/lib/ia32")
+    endif()
+  else()
+    if (ENV_MKLROOT)
+      list(APPEND _lib_env "${ENV_MKLROOT}/lib")
+      if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+        list(APPEND _lib_env "${ENV_MKLROOT}/lib64")
+        list(APPEND _lib_env "${ENV_MKLROOT}/lib/intel64")
+      else()
+        list(APPEND _lib_env "${ENV_MKLROOT}/lib32")
+        list(APPEND _lib_env "${ENV_MKLROOT}/lib/ia32")
+      endif()
+    endif()
+    list(APPEND _lib_env "$ENV{LIBRARY_PATH}")
+    if(WIN32)
+      string(REPLACE ":" ";" _lib_env2 "$ENV{LIB}")
+    elseif(APPLE)
+      string(REPLACE ":" ";" _lib_env2 "$ENV{DYLD_LIBRARY_PATH}")
+    else()
+      string(REPLACE ":" ";" _lib_env2 "$ENV{LD_LIBRARY_PATH}")
+    endif()
+    list(APPEND _lib_env "${_lib_env2}")
+    list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+  endif()
+  list(REMOVE_DUPLICATES _lib_env)
+
+  # set paths where to look for
+  set(PATH_TO_LOOK_FOR "${_lib_env}")
+
+  if(FFTW_LOOK_FOR_FFTW_SIMPLE)
+    set(FFTW_PREC "f")
+    set(FFTW_PREC_TESTFUNC "s")
+  elseif(FFTW_LOOK_FOR_FFTW_LONG)
+    set(FFTW_PREC "l")
+    set(FFTW_PREC_TESTFUNC "l")
+  elseif(FFTW_LOOK_FOR_FFTW_QUAD)
+    set(FFTW_PREC "q")
+    set(FFTW_PREC_TESTFUNC "q")
+  else()
+    set(FFTW_PREC "")
+    set(FFTW_PREC_TESTFUNC "d")
+  endif()
+
+  set(FFTW_LIBRARIES "")
+  set(FFTW_LIBRARY_DIRS "")
+
+  if(NOT FFTW_LOOK_FOR_MKL)
+
+    if (FFTW_LOOK_FOR_THREADS)
+      set(FFTW_libs_to_find "fftw3${FFTW_PREC}_threads;fftw3${FFTW_PREC};fftw3")
+    elseif (FFTW_LOOK_FOR_OMP)
+      set(FFTW_libs_to_find "fftw3${FFTW_PREC}_omp;fftw3${FFTW_PREC};fftw3")
+    else()
+      set(FFTW_libs_to_find "fftw3${FFTW_PREC};fftw3")
+    endif()
+    if (FFTW_LOOK_FOR_FFTW_QUAD)
+      if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
+        list(APPEND FFTW_libs_to_find "quadmath")
+      endif()
+    endif()
+
+    if (FFTW_LOOK_FOR_ESSL)
+      set(FFTW_libs_to_find "fftw3_essl")
+    endif()
+
+    # Try to find the fftw lib in the given paths
+    # ----------------------------------------------
+
+    # call cmake macro to find the lib path
+    if(FFTW_LIBDIR)
+      foreach(fftw_lib ${FFTW_libs_to_find})
+        set(FFTW_${fftw_lib}_LIBRARY "FFTW_${fftw_lib}_LIBRARY-NOTFOUND")
+        find_library(FFTW_${fftw_lib}_LIBRARY
+          NAMES ${fftw_lib}
+          HINTS ${FFTW_LIBDIR})
+      endforeach()
+    else()
+      if(FFTW_DIR)
+        foreach(fftw_lib ${FFTW_libs_to_find})
+          set(FFTW_${fftw_lib}_LIBRARY "FFTW_${fftw_lib}_LIBRARY-NOTFOUND")
+          find_library(FFTW_${fftw_lib}_LIBRARY
+            NAMES ${fftw_lib}
+            HINTS ${FFTW_DIR}
+            PATH_SUFFIXES lib lib32 lib64)
+        endforeach()
+      else()
+        foreach(fftw_lib ${FFTW_libs_to_find})
+          set(FFTW_${fftw_lib}_LIBRARY "FFTW_${fftw_lib}_LIBRARY-NOTFOUND")
+          find_library(FFTW_${fftw_lib}_LIBRARY
+            NAMES ${fftw_lib}
+            HINTS ${PATH_TO_LOOK_FOR})
+        endforeach()
+      endif()
+    endif()
+
+    # If found, add path to cmake variable
+    # ------------------------------------
+    foreach(fftw_lib ${FFTW_libs_to_find})
+
+      if (FFTW_${fftw_lib}_LIBRARY)
+        get_filename_component(${fftw_lib}_lib_path "${FFTW_${fftw_lib}_LIBRARY}" PATH)
+        # set cmake variables
+        list(APPEND FFTW_LIBRARIES "${FFTW_${fftw_lib}_LIBRARY}")
+        list(APPEND FFTW_LIBRARY_DIRS "${${fftw_lib}_lib_path}")
+      else ()
+        list(APPEND FFTW_LIBRARIES "${FFTW_${fftw_lib}_LIBRARY}")
+        if (NOT FFTW_FIND_QUIETLY)
+          message(STATUS "Looking for FFTW -- lib ${fftw_lib} not found")
+        endif()
+      endif ()
+      mark_as_advanced(FFTW_${fftw_lib}_LIBRARY)
+
+    endforeach()
+
+    # check if one lib is NOTFOUND
+    foreach(lib ${FFTW_LIBRARIES})
+      if (NOT lib)
+        set(FFTW_LIBRARIES "FFTW_LIBRARIES-NOTFOUND")
+      endif()
+    endforeach()
+
+  endif(NOT FFTW_LOOK_FOR_MKL)
+
+  if (FFTW_LOOK_FOR_MKL OR FFTW_LOOK_FOR_ESSL)
+
+    # FFTW relies on blas libs
+    if (FFTW_LOOK_FOR_THREADS)
+      if (FFTW_LOOK_FOR_MKL)
+        if (BLAS_LIBRARIES_PAR)
+          list(APPEND FFTW_LIBRARIES "${BLAS_LIBRARIES_PAR}")
+          if (NOT FFTW_FIND_QUIETLY)
+            message(STATUS "Multithreaded FFTW has been found: ${FFTW_LIBRARIES}")
+          endif()
+        else()
+          if (NOT FFTW_FIND_QUIETLY)
+            if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_MKL)
+              message(FATAL_ERROR "FFTW is required but not found.")
+            else()
+              message(STATUS "Multithreaded FFTW not found.")
+            endif()
+          endif()
+        endif(BLAS_LIBRARIES_PAR)
+      elseif (FFTW_LOOK_FOR_ESSL)
+        if (FFTW_LIBRARIES AND BLAS_LIBRARIES_PAR)
+          list(APPEND FFTW_LIBRARIES "${BLAS_LIBRARIES_PAR}")
+          if (NOT FFTW_FIND_QUIETLY)
+            message(STATUS "Multithreaded FFTW has been found: ${FFTW_LIBRARIES}")
+          endif()
+        else()
+          if (NOT FFTW_FIND_QUIETLY)
+            if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_MKL)
+              message(FATAL_ERROR "FFTW is required but not found.")
+            else()
+              message(STATUS "Multithreaded FFTW not found.")
+            endif()
+          endif()
+        endif(FFTW_LIBRARIES AND BLAS_LIBRARIES_PAR)
+      endif()
+    else(FFTW_LOOK_FOR_THREADS)
+      if (FFTW_LOOK_FOR_MKL)
+        if (BLAS_LIBRARIES_SEQ)
+          list(APPEND FFTW_LIBRARIES "${BLAS_LIBRARIES_SEQ}")
+          if (NOT FFTW_FIND_QUIETLY)
+            message(STATUS "FFTW has been found: ${FFTW_LIBRARIES}")
+          endif()
+        else()
+          if (NOT FFTW_FIND_QUIETLY)
+            if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_MKL)
+              message(FATAL_ERROR "FFTW is required but not found.")
+            else()
+              message(STATUS "FFTW not found.")
+            endif()
+          endif()
+        endif(BLAS_LIBRARIES_SEQ)
+      elseif (FFTW_LOOK_FOR_ESSL)
+        if (FFTW_LIBRARIES AND BLAS_LIBRARIES_SEQ)
+          list(APPEND FFTW_LIBRARIES "${BLAS_LIBRARIES_SEQ}")
+          if (NOT FFTW_FIND_QUIETLY)
+            message(STATUS "FFTW has been found: ${FFTW_LIBRARIES}")
+          endif()
+        else()
+          if (NOT FFTW_FIND_QUIETLY)
+            if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_MKL)
+              message(FATAL_ERROR "FFTW is required but not found.")
+            else()
+              message(STATUS "FFTW not found.")
+            endif()
+          endif()
+        endif(FFTW_LIBRARIES AND BLAS_LIBRARIES_SEQ)
+      endif()
+    endif(FFTW_LOOK_FOR_THREADS)
+
+    if (BLAS_LIBRARY_DIRS)
+      list(APPEND FFTW_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}")
+    else()
+      if (NOT FFTW_FIND_QUIETLY)
+        message(WARNING "FFTW_LIBRARY_DIRS may not be complete because BLAS_LIBRARY_DIRS is empty.")
+      endif()
+    endif()
+
+  endif(FFTW_LOOK_FOR_MKL OR FFTW_LOOK_FOR_ESSL)
+
+  list(REMOVE_DUPLICATES FFTW_INCLUDE_DIRS)
+  list(REMOVE_DUPLICATES FFTW_LIBRARY_DIRS)
+
+  # check if one lib is NOTFOUND
+  foreach(lib ${FFTW_LIBRARIES})
+    if (NOT lib)
+      set(FFTW_LIBRARIES "FFTW_LIBRARIES-NOTFOUND")
+    endif()
+  endforeach()
+
+endif( (NOT PKG_CONFIG_EXECUTABLE) OR
+  (PKG_CONFIG_EXECUTABLE AND NOT FFTW_FOUND) OR
+  FFTW_GIVEN_BY_USER OR
+  FFTW_LOOK_FOR_MKL  OR
+  FFTW_LOOK_FOR_ESSL
+  )
+
+# check a function to validate the find
+if(FFTW_LIBRARIES)
+
+  set(REQUIRED_FLAGS)
+  set(REQUIRED_LDFLAGS)
+  set(REQUIRED_INCDIRS)
+  set(REQUIRED_LIBDIRS)
+  set(REQUIRED_LIBS)
+
+  # FFTW
+  if (FFTW_INCLUDE_DIRS)
+    set(REQUIRED_INCDIRS "${FFTW_INCLUDE_DIRS}")
+  endif()
+  if (FFTW_CFLAGS_OTHER)
+    set(REQUIRED_FLAGS "${FFTW_CFLAGS_OTHER}")
+  endif()
+  if (FFTW_LDFLAGS_OTHER)
+    set(REQUIRED_LDFLAGS "${FFTW_LDFLAGS_OTHER}")
+  endif()
+  if (FFTW_LIBRARY_DIRS)
+    set(REQUIRED_LIBDIRS "${FFTW_LIBRARY_DIRS}")
+  endif()
+  set(REQUIRED_LIBS "${FFTW_LIBRARIES}")
+  # THREADS
+  if (FFTW_LOOK_FOR_THREADS)
+    list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}")
+  endif()
+  # OMP
+  if(FFTW_LOOK_FOR_OMP)
+    list(APPEND REQUIRED_FLAGS "${OPENMP_C_FLAGS}")
+  endif()
+  # MKL
+  if(FFTW_LOOK_FOR_MKL)
+    list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}")
+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
+      list(APPEND REQUIRED_LDFLAGS "-Wl,--no-as-needed")
+    endif()
+  endif()
+  # m
+  find_library(M_LIBRARY NAMES m)
+  mark_as_advanced(M_LIBRARY)
+  if(M_LIBRARY)
+    list(APPEND REQUIRED_LIBS "-lm")
+  endif()
+
+  # set required libraries for link
+  set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
+  if (REQUIRED_FLAGS)
+    set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
+    set(REQUIRED_FLAGS)
+    set(REQUIRED_DEFINITIONS)
+    foreach(_flag ${REQUIRED_FLAGS_COPY})
+      if (_flag MATCHES "^-D")
+       list(APPEND REQUIRED_DEFINITIONS "${_flag}")
+      endif()
+      string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
+      list(APPEND REQUIRED_FLAGS "${_flag}")
+    endforeach()
+  endif()
+  finds_remove_duplicates()
+  set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
+  set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
+  set(CMAKE_REQUIRED_LIBRARIES)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
+  list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
+  list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
+  string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
+
+  # test link
+  unset(FFTW_WORKS CACHE)
+  include(CheckFunctionExists)
+  if (FFTW_LOOK_FOR_ESSL)
+    check_function_exists(${FFTW_PREC_TESTFUNC}fftw_execute FFTW_WORKS)
+  else()
+    check_function_exists(${FFTW_PREC_TESTFUNC}fftw_execute_ FFTW_WORKS)
+  endif()
+  mark_as_advanced(FFTW_WORKS)
+
+  if(FFTW_WORKS)
+    # save link with dependencies
+    set(FFTW_LIBRARIES_DEP "${REQUIRED_LIBS}")
+    set(FFTW_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
+    set(FFTW_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
+    set(FFTW_CFLAGS_OTHER_DEP "${REQUIRED_FLAGS}")
+    set(FFTW_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
+  else()
+    if(NOT FFTW_FIND_QUIETLY)
+      message(STATUS "Looking for FFTW : test of ${FFTW_PREC_TESTFUNC}fftw_execute_ with fftw library fails")
+      message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
+      message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
+      message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
+      message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
+    endif()
+  endif()
+  set(CMAKE_REQUIRED_INCLUDES)
+  set(CMAKE_REQUIRED_FLAGS)
+  set(CMAKE_REQUIRED_LIBRARIES)
+endif(FFTW_LIBRARIES)
+
+if (FFTW_LIBRARIES)
+  list(GET FFTW_LIBRARIES 0 first_lib)
+  get_filename_component(first_lib_path "${first_lib}" PATH)
+  if (NOT FFTW_LIBRARY_DIRS)
+    set(FFTW_LIBRARY_DIRS "${first_lib_path}")
+  endif()
+  if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")
+    string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")
+    set(FFTW_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of FFTW library" FORCE)
+  else()
+    set(FFTW_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of FFTW library" FORCE)
+  endif()
+endif()
+mark_as_advanced(FFTW_DIR)
+mark_as_advanced(FFTW_DIR_FOUND)
+
+# check that FFTW has been found
+# -------------------------------
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FFTW DEFAULT_MSG
+  FFTW_LIBRARIES
+  FFTW_WORKS)
diff --git a/cmake/morse/FindHeadersAndLibs.cmake b/cmake/morse/FindHeadersAndLibs.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..64144bdbf8a35f966f1ac802e5765e6ad81abf7c
--- /dev/null
+++ b/cmake/morse/FindHeadersAndLibs.cmake
@@ -0,0 +1,94 @@
+###
+#
+# @copyright (c) 2009-2014 The University of Tennessee and The University
+#                          of Tennessee Research Foundation.
+#                          All rights reserved.
+# @copyright (c) 2012-2014 Inria. All rights reserved.
+# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
+#
+###
+#
+#  @file FindHeadersAndLibs.cmake
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver.
+#
+#  @version 0.9.0
+#  @author Cedric Castagnede
+#  @author Emmanuel Agullo
+#  @author Mathieu Faverge
+#  @author Florent Pruvost
+#  @date 13-07-2012
+#
+###
+
+# Some macros to print status when search for headers and libs
+include(PrintFindStatus)
+
+function(FindHeader _libname _header_to_find)
+
+  # save _libname upper and lower case
+  string(TOUPPER ${_libname} LIBNAME)
+  string(TOLOWER ${_libname} libname)
+
+  # Looking for include
+  # -------------------
+
+  # Add system include paths to search include
+  # ------------------------------------------
+  unset(_inc_env)
+  if(WIN32)
+    string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
+  else()
+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
+    list(APPEND _inc_env "${_path_env}")
+    string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
+    list(APPEND _inc_env "${_path_env}")
+    string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
+    list(APPEND _inc_env "${_path_env}")
+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
+    list(APPEND _inc_env "${_path_env}")
+  endif()
+  list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
+  list(REMOVE_DUPLICATES _inc_env)
+
+
+  # Try to find the _header_to_find in the given paths
+  # --------------------------------------------------
+  # call cmake macro to find the header path
+  if(${LIBNAME}_INCDIR)
+    set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND")
+    find_path(${LIBNAME}_${_header_to_find}_DIRS
+      NAMES ${_header_to_find}
+      HINTS ${${LIBNAME}_INCDIR})
+  elseif(${LIBNAME}_DIR)
+    set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND")
+    find_path(${LIBNAME}_${_header_to_find}_DIRS
+      NAMES ${_header_to_find}
+      HINTS ${${LIBNAME}_DIR}
+      PATH_SUFFIXES include)
+  else()
+    set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND")
+    find_path(${LIBNAME}_${_header_to_find}_DIRS
+      NAMES ${_header_to_find}
+      HINTS ${_inc_env})
+  endif()
+  mark_as_advanced(${LIBNAME}_${_header_to_find}_DIRS)
+
+  # Print status if not found
+  # -------------------------
+  if (NOT ${LIBNAME}_${_header_to_find}_DIRS)
+    Print_Find_Header_Status(${libname} ${_header_to_find})
+  endif ()
+
+endfunction(FindHeader)
+
+
+##
+## @end file FindHeadersAndLibs.cmake
+##
diff --git a/cmake/morse/FindInit.cmake b/cmake/morse/FindInit.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..e59d41a077848029e04065d5f46bba57bcf0277d
--- /dev/null
+++ b/cmake/morse/FindInit.cmake
@@ -0,0 +1,45 @@
+###
+#
+# @copyright (c) 2018 Inria. All rights reserved.
+#
+###
+#
+#  @file FindInit.cmake
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver.
+#
+#  @version 1.0.0
+#  @author Florent Pruvost
+#  @date 24-04-2018
+#
+###
+
+
+# This include is required to check symbols of libs
+include(CheckFunctionExists)
+
+# This include is required to check defines in headers
+include(CheckIncludeFiles)
+
+# Factorize some piece of code
+include(FindCommon)
+
+# To find headers and libs
+include(FindHeadersAndLibs)
+
+# To transform relative path into absolute for a list of libraries
+include(LibrariesAbsolutePath)
+include(FindPkgconfigLibrariesAbsolutePath)
+
+# Some macros to print status when search for headers and libs
+include(PrintFindStatus)
+
+##
+## @end file FindInit.cmake
+##
diff --git a/cmake/morse/FindPkgconfigLibrariesAbsolutePath.cmake b/cmake/morse/FindPkgconfigLibrariesAbsolutePath.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..51b08ce59853459f493a0892874f71678467c392
--- /dev/null
+++ b/cmake/morse/FindPkgconfigLibrariesAbsolutePath.cmake
@@ -0,0 +1,99 @@
+###
+#
+# @copyright (c) 2018 Inria. All rights reserved.
+#
+###
+#
+#  @file FindPkgconfigLibrariesAbsolutePath.cmake
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver.
+#
+#  @version 1.0.0
+#  @author Florent Pruvost
+#  @date 06-04-2018
+#
+###
+
+# Transform relative path into absolute path for libraries found with the
+# pkg_search_module cmake macro
+# _prefix: the name of the CMake variable used when pkg_search_module was called
+# e.g. for pkg_search_module(BLAS blas) _prefix would be BLAS
+macro(FIND_PKGCONFIG_LIBRARIES_ABSOLUTE_PATH _prefix)
+  list(APPEND _lib_env "$ENV{LIBRARY_PATH}")
+  if(WIN32)
+    string(REPLACE ":" ";" _lib_env2 "$ENV{LIB}")
+  elseif(APPLE)
+    string(REPLACE ":" ";" _lib_env2 "$ENV{DYLD_LIBRARY_PATH}")
+  else()
+    string(REPLACE ":" ";" _lib_env2 "$ENV{LD_LIBRARY_PATH}")
+  endif()
+  list(APPEND _lib_env "${_lib_env2}")
+  list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+  # non static case
+  set(${_prefix}_LIBRARIES_COPY "${${_prefix}_LIBRARIES}")
+  set(${_prefix}_LIBRARIES "")
+  foreach(_library ${${_prefix}_LIBRARIES_COPY})
+    if(EXISTS "${_library}")
+      list(APPEND ${_prefix}_LIBRARIES ${_library})
+    else()
+      get_filename_component(_ext "${_library}" EXT)
+      set(_lib_extensions ".so" ".a" ".dyld" ".dll")
+      list(FIND _lib_extensions "${_ext}" _index)
+      if (${_index} GREATER -1)
+        get_filename_component(_library "${_library}" NAME_WE)
+      endif()
+      find_library(_library_path NAMES ${_library}
+          HINTS ${${_prefix}_LIBDIR} ${${_prefix}_LIBRARY_DIRS} ${_lib_env})
+      if (_library_path)
+          list(APPEND ${_prefix}_LIBRARIES ${_library_path})
+      else()
+          message(FATAL_ERROR "Dependency of ${_prefix} '${_library}' NOT FOUND")
+      endif()
+      unset(_library_path CACHE)
+    endif()
+  endforeach()
+  set (${_prefix}_LIBRARIES "${${_prefix}_LIBRARIES}" CACHE INTERNAL "" FORCE)
+  ## static case
+  #set(${_prefix}_STATIC_LIBRARIES_COPY "${${_prefix}_STATIC_LIBRARIES}")
+  #set(${_prefix}_STATIC_LIBRARIES "")
+  #foreach(_library ${${_prefix}_STATIC_LIBRARIES_COPY})
+  #  if(EXISTS "${_library}")
+  #    list(APPEND ${_prefix}_STATIC_LIBRARIES ${_library})
+  #  else()
+  #    get_filename_component(_ext "${_library}" EXT)
+  #    set(_lib_extensions ".so" ".a" ".dyld" ".dll")
+  #    list(FIND _lib_extensions "${_ext}" _index)
+  #    if (${_index} GREATER -1)
+  #      get_filename_component(_library "${_library}" NAME_WE)
+  #    endif()
+  #    # try static first
+  #    set (default_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
+  #    set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
+  #    find_library(_library_path NAMES ${_library}
+  #        HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
+  #    set (CMAKE_FIND_LIBRARY_SUFFIXES ${default_find_library_suffixes})
+  #    # if not found try dynamic
+  #    if (NOT _library_path)
+  #      find_library(_library_path NAMES ${_library}
+  #          HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
+  #    endif()
+  #    if (_library_path)
+  #        list(APPEND ${_prefix}_STATIC_LIBRARIES ${_library_path})
+  #    else()
+  #        message(FATAL_ERROR "Dependency of ${_prefix} '${_library}' NOT FOUND")
+  #    endif()
+  #    unset(_library_path CACHE)
+  #  endif()
+  #endforeach()
+  #set (${_prefix}_STATIC_LIBRARIES "${${_prefix}_STATIC_LIBRARIES}" CACHE INTERNAL "" FORCE)
+endmacro()
+
+##
+## @end file FindPkgconfigLibrariesAbsolutePath.cmake
+##
diff --git a/cmake/morse/LICENCE.txt b/cmake/morse/LICENCE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..b95821f36afa3579a5f1de4fe840aec43b7a4b96
--- /dev/null
+++ b/cmake/morse/LICENCE.txt
@@ -0,0 +1,42 @@
+###
+#
+# @copyright (c) 2009-2014 The University of Tennessee and The University
+#                          of Tennessee Research Foundation.
+#                          All rights reserved.
+# @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
+#                          Univ. Bordeaux. All rights reserved.
+# @copyright (c) 2016      KAUST. All rights reserved.
+#
+###
+#
+# This software is a computer program whose purpose is to process
+# Matrices Over Runtime Systems @ Exascale (MORSE). More information
+# can be found on the following website: http://www.inria.fr/en/teams/morse.
+#
+# This software is governed by the CeCILL-C license under French law and
+# abiding by the rules of distribution of free software.  You can  use,
+# modify and/ or redistribute the software under the terms of the CeCILL-C
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info".
+#
+# As a counterpart to the access to the source code and  rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty  and the software's author,  the holder of the
+# economic rights,  and the successive licensors  have only  limited
+# liability.
+#
+# In this respect, the user's attention is drawn to the risks associated
+# with loading,  using,  modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean  that it is complicated to manipulate,  and  that  also
+# therefore means  that it is reserved for developers  and  experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or
+# data to be ensured and,  more generally, to use and operate it in the
+# same conditions as regards security.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-C license and that you accept its terms.
+#
+###
diff --git a/cmake/morse/LibrariesAbsolutePath.cmake b/cmake/morse/LibrariesAbsolutePath.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..7aaab504d7348090e36c502755020b0b1439f123
--- /dev/null
+++ b/cmake/morse/LibrariesAbsolutePath.cmake
@@ -0,0 +1,70 @@
+###
+#
+# @copyright (c) 2018 Inria. All rights reserved.
+#
+###
+#
+#  @file LibrariesAbsolutePath.cmake
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver.
+#
+#  @version 1.0.0
+#  @author Florent Pruvost
+#  @date 13-04-2018
+#
+###
+
+# Transform relative path into absolute path for libraries
+# lib_list (input/output): the name of the CMake variable containing libraries, e.g. BLAS_LIBRARIES
+# hints_paths (input): additional paths to add when looking for libraries
+macro(LIBRARIES_ABSOLUTE_PATH lib_list hints_paths)
+  # collect environment paths to dig 
+  list(APPEND _lib_env "$ENV{LIBRARY_PATH}")
+  if(WIN32)
+    string(REPLACE ":" ";" _lib_env2 "$ENV{LIB}")
+  elseif(APPLE)
+    string(REPLACE ":" ";" _lib_env2 "$ENV{DYLD_LIBRARY_PATH}")
+  else()
+    string(REPLACE ":" ";" _lib_env2 "$ENV{LD_LIBRARY_PATH}")
+  endif()
+  list(APPEND _lib_env "${_lib_env2}")
+  list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+  # copy the lib list 
+  set (${lib_list}_COPY "${${lib_list}}")
+  # reset the lib list to populate
+  set(${lib_list} "")
+  foreach(_library ${${lib_list}_COPY})
+    if(EXISTS "${_library}")
+      # if already an absolute path, nothing special to do
+      list(APPEND ${lib_list} ${_library})
+    else()
+      # replace pattern -lfoo -> foo
+      string(REGEX REPLACE "^-l" "" _library "${_library}")
+      # remove extensions if exist
+      get_filename_component(_ext "${_library}" EXT)
+      set(_lib_extensions ".so" ".a" ".dyld" ".dll")
+      list(FIND _lib_extensions "${_ext}" _index)
+      if (${_index} GREATER -1)
+        get_filename_component(_library "${_library}" NAME_WE)
+      endif()
+      # try to find the lib
+      find_library(_library_path NAMES ${_library} HINTS ${hints_paths} ${_lib_env})
+      if (_library_path)
+          list(APPEND ${lib_list} ${_library_path})
+      else()
+          message(FATAL_ERROR "Dependency of ${lib_list} '${_library}' NOT FOUND")
+      endif()
+      unset(_library_path CACHE)
+    endif()
+  endforeach()
+endmacro()
+
+##
+## @end file LibrariesAbsolutePath.cmake
+##
diff --git a/cmake/morse/MorseInit.cmake b/cmake/morse/MorseInit.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..fc51170401cc17045854de4ee51f477eff1b66c1
--- /dev/null
+++ b/cmake/morse/MorseInit.cmake
@@ -0,0 +1,67 @@
+###
+#
+# @copyright (c) 2009-2014 The University of Tennessee and The University
+#                          of Tennessee Research Foundation.
+#                          All rights reserved.
+# @copyright (c) 2012-2018 Inria. All rights reserved.
+# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
+#
+###
+#
+#  @file MorseInit.cmake
+#
+#  @project MORSE
+#  MORSE is a software package provided by:
+#     Inria Bordeaux - Sud-Ouest,
+#     Univ. of Tennessee,
+#     King Abdullah Univesity of Science and Technology
+#     Univ. of California Berkeley,
+#     Univ. of Colorado Denver.
+#
+#  @version 1.0.0
+#  @author Cedric Castagnede
+#  @author Emmanuel Agullo
+#  @author Mathieu Faverge
+#  @author Florent Pruvost
+#  @date 13-07-2012
+#
+###
+
+# Path to Morse modules
+get_filename_component(MORSE_CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_FILE} DIRECTORY CACHE)
+
+# Global Morse options
+option(MORSE_ENABLE_WARNING       "Enable warning messages" OFF)
+option(MORSE_ENABLE_COVERAGE      "Enable flags for coverage test" OFF)
+option(MORSE_ENABLE_COLOR_MESSAGE "Enable colors in messages" OFF)
+#option(MORSE_VERBOSE_FIND_PACKAGE "Add additional messages concerning packages not found" OFF)
+#message(STATUS "MORSE_VERBOSE_FIND_PACKAGE is set to OFF, turn it ON to get"
+#        "   information about packages not found")
+
+
+# This include is required to check symbols of libs in the main CMakeLists.txt
+include(CheckFunctionExists)
+
+# This include is required to check defines in headers
+include(CheckIncludeFiles)
+
+if (MORSE_ENABLE_COLOR_MESSAGE)
+  # colorize messages
+  include(ColorizeMessage)
+endif()
+
+# Define some auxilary flags
+include(AuxilaryFlags)
+
+# Define some variables to et info about ressources
+include(Ressources)
+
+# Add the path where we handle our FindFOO.cmake to seek for liraries
+list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find)
+
+# To load some macros used in Finds (could be useful for other projects)
+include(FindInit)
+
+##
+## @end file MorseInit.cmake
+##
diff --git a/cmake/morse/PrintFindStatus.cmake b/cmake/morse/PrintFindStatus.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..1fdd403b7de11a8b946b178c5aada2da5e6fe33e
--- /dev/null
+++ b/cmake/morse/PrintFindStatus.cmake
@@ -0,0 +1,207 @@
+###
+#
+# @copyright (c) 2009-2014 The University of Tennessee and The University
+#                          of Tennessee Research Foundation.
+#                          All rights reserved.
+# @copyright (c) 2012-2014 Inria. All rights reserved.
+# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
+#
+###
+#
+# - Some macros to print status when search for headers and libs
+# Main parameters of macros
+#  _libname: name of the lib you seek, foo for example
+#  _header_to_find: name of the header you seek, foo.h for example
+#  _lib_to_find: name of the library you seek, libfoo for example
+#  _pc_to_find: name of the pkg-config file zyou seek, foo.pc for example
+
+
+#=============================================================================
+# Copyright 2012-2013 Inria
+# Copyright 2012-2013 Emmanuel Agullo
+# Copyright 2012-2013 Mathieu Faverge
+# Copyright 2012      Cedric Castagnede
+# Copyright 2013      Florent Pruvost
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file MORSE-Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+
+#=============================================================================
+# (To distribute this file outside of Morse, substitute the full
+#  License text for the above reference.)
+
+
+# Set some colors
+#if(NOT WIN32)
+#    string(ASCII 27 Esc)
+#    set(ColourReset "${Esc}[m")
+#    set(ColourBold  "${Esc}[1m")
+#    set(Red         "${Esc}[31m")
+#    set(Green       "${Esc}[32m")
+#    set(Yellow      "${Esc}[33m")
+#    set(Blue        "${Esc}[34m")
+#    set(Magenta     "${Esc}[35m")
+#    set(Cyan        "${Esc}[36m")
+#    set(White       "${Esc}[37m")
+#    set(BoldRed     "${Esc}[1;31m")
+#    set(BoldGreen   "${Esc}[1;32m")
+#    set(BoldYellow  "${Esc}[1;33m")
+#    set(BoldBlue    "${Esc}[1;34m")
+#    set(BoldMagenta "${Esc}[1;35m")
+#    set(BoldCyan    "${Esc}[1;36m")
+#    set(BoldWhite   "${Esc}[1;37m")
+#endif()
+
+
+# This macro informs why the _header_to_find file has not been found
+macro(Print_Find_Header_Status _libname _header_to_find)
+
+  # save _libname upper and lower case
+  string(TOUPPER ${_libname} LIBNAME)
+  string(TOLOWER ${_libname} libname)
+
+  # print status
+  #message(" ")
+  if(${LIBNAME}_INCDIR)
+    message("${Blue}${LIBNAME}_INCDIR is defined but ${_header_to_find}"
+      "has not been found in ${${LIBNAME}_INCDIR}${ColourReset}")
+  else()
+    if(${LIBNAME}_DIR)
+      message("${Blue}${LIBNAME}_DIR is defined but"
+	"${_header_to_find} has not been found in"
+	"${${LIBNAME}_DIR}/include${ColourReset}")
+    else()
+      message("${Blue}${_header_to_find} not found."
+	"Nor ${LIBNAME}_DIR neither ${LIBNAME}_INCDIR"
+	"are defined so that we looked for ${_header_to_find} in"
+	"system paths (INCLUDE, CPATH, C_INCLUDE_PATH,"
+	"INCLUDE_PATH, CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES)${ColourReset}")
+      if(_inc_env)
+	message("${Blue}${_header_to_find} has not been found in"
+	  "${_inc_env}${ColourReset}")
+      endif()
+    endif()
+  endif()
+  message("${BoldBlue}Please indicate where to find ${_header_to_find}. You have three options:\n"
+    "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
+    "- Option 2: Provide the directory where to find the headers with cmake option: -D${LIBNAME}_INCDIR=your/path/to/${libname}/include/\n"
+    "- Option 3: Update your environment variable (INCLUDE or CPATH)\n"
+    "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
+  #message(" ")
+
+endmacro()
+
+# This macro informs why the _lib_to_find file has not been found
+macro(Print_Find_Library_Status _libname _lib_to_find)
+
+  # save _libname upper/lower case
+  string(TOUPPER ${_libname} LIBNAME)
+  string(TOLOWER ${_libname} libname)
+
+  # print status
+  #message(" ")
+  if(${LIBNAME}_LIBDIR)
+    message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}"
+      "has not been found in ${${LIBNAME}_LIBDIR}${ColourReset}")
+  else()
+    if(${LIBNAME}_DIR)
+      message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}"
+	"has not been found in ${${LIBNAME}_DIR}/lib(or /lib32 or"
+	"/lib64)${ColourReset}")
+    else()
+      message("${Yellow}${_lib_to_find} not found."
+	"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
+	"are defined so that we looked for ${_lib_to_find} in"
+	"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
+	"Mac: DYLD_LIBRARY_PATH,"
+	"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
+      if(_lib_env)
+	message("${Yellow}${_lib_to_find} has not been found in"
+	  "${_lib_env}${ColourReset}")
+      endif()
+    endif()
+  endif()
+  message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n"
+    "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
+    "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n"
+    "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
+    "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
+
+endmacro()
+
+# This macro informs why the _lib_to_find file has not been found
+macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
+
+  # save _libname upper/lower case
+  string(TOUPPER ${_libname} LIBNAME)
+  string(TOLOWER ${_libname} libname)
+
+  # print status
+  #message(" ")
+  if(${LIBNAME}_LIBDIR)
+    message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}"
+      "has not been found in ${ARGN}${ColourReset}")
+  else()
+    if(${LIBNAME}_DIR)
+      message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}"
+	"has not been found in ${ARGN}${ColourReset}")
+    else()
+      message("${Yellow}${_lib_to_find} not found."
+	"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
+	"are defined so that we look for ${_lib_to_find} in"
+	"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
+	"Mac: DYLD_LIBRARY_PATH,"
+	"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
+      if(_lib_env)
+	message("${Yellow}${_lib_to_find} has not been found in"
+	  "${_lib_env}${ColourReset}")
+      endif()
+    endif()
+  endif()
+  message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n"
+    "- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
+    "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n"
+    "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
+    "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
+
+endmacro()
+
+# This macro informs why the _lib_to_find file has not been found
+macro(Print_Find_Library_Blas_CheckFunc_Status _name)
+
+  # save _libname upper/lower case
+  string(TOUPPER ${_name} FUNCNAME)
+  string(TOLOWER ${_name} funcname)
+
+  # print status
+  #message(" ")
+  message("${Red}Libs have been found but check of symbol ${_name} failed "
+    "with following libraries ${ARGN}${ColourReset}")
+  message("${BoldRed}Please open your error file CMakeFiles/CMakeError.log"
+    "to figure out why it fails${ColourReset}")
+  #message(" ")
+
+endmacro()
+
+# This macro informs that _pc_to_find file has not been found in the list
+# path you give as last argument (read in ${ARGN})
+# ex: Print_Find_Pkgconfig_Status(foo foo.pc ${PATHLIST}
+macro(Print_Find_Pkgconfig_Status _libname _pc_to_find)
+
+  # save _libname lower case
+  string(TOLOWER ${_libname} libname)
+
+  # print status
+  #message(" ")
+  message("${Magenta}${_pc_to_find} has not been found in"
+    "${ARGN}${ColourReset}")
+  message("${BoldMagenta}If you really want to use the pkg-config file of"
+    "${libname}, please update your PKG_CONFIG_PATH with the path"
+    "where ${_pc_to_find} states${ColourReset}")
+  #message(" ")
+
+endmacro()
diff --git a/bfps/cpp/Lagrange_polys.cpp b/cpp/Lagrange_polys.cpp
similarity index 100%
rename from bfps/cpp/Lagrange_polys.cpp
rename to cpp/Lagrange_polys.cpp
diff --git a/bfps/cpp/Lagrange_polys.hpp b/cpp/Lagrange_polys.hpp
similarity index 100%
rename from bfps/cpp/Lagrange_polys.hpp
rename to cpp/Lagrange_polys.hpp
diff --git a/bfps/cpp/base.hpp b/cpp/base.hpp
similarity index 100%
rename from bfps/cpp/base.hpp
rename to cpp/base.hpp
diff --git a/bfps/cpp/bfps_timer.hpp b/cpp/bfps_timer.hpp
similarity index 100%
rename from bfps/cpp/bfps_timer.hpp
rename to cpp/bfps_timer.hpp
diff --git a/bfps/cpp/fftw_interface.hpp b/cpp/fftw_interface.hpp
similarity index 100%
rename from bfps/cpp/fftw_interface.hpp
rename to cpp/fftw_interface.hpp
diff --git a/bfps/cpp/fftw_tools.cpp b/cpp/fftw_tools.cpp
similarity index 100%
rename from bfps/cpp/fftw_tools.cpp
rename to cpp/fftw_tools.cpp
diff --git a/bfps/cpp/fftw_tools.hpp b/cpp/fftw_tools.hpp
similarity index 100%
rename from bfps/cpp/fftw_tools.hpp
rename to cpp/fftw_tools.hpp
diff --git a/bfps/cpp/field.cpp b/cpp/field.cpp
similarity index 100%
rename from bfps/cpp/field.cpp
rename to cpp/field.cpp
diff --git a/bfps/cpp/field.hpp b/cpp/field.hpp
similarity index 100%
rename from bfps/cpp/field.hpp
rename to cpp/field.hpp
diff --git a/bfps/cpp/field_binary_IO.cpp b/cpp/field_binary_IO.cpp
similarity index 100%
rename from bfps/cpp/field_binary_IO.cpp
rename to cpp/field_binary_IO.cpp
diff --git a/bfps/cpp/field_binary_IO.hpp b/cpp/field_binary_IO.hpp
similarity index 100%
rename from bfps/cpp/field_binary_IO.hpp
rename to cpp/field_binary_IO.hpp
diff --git a/bfps/cpp/field_layout.cpp b/cpp/field_layout.cpp
similarity index 100%
rename from bfps/cpp/field_layout.cpp
rename to cpp/field_layout.cpp
diff --git a/bfps/cpp/field_layout.hpp b/cpp/field_layout.hpp
similarity index 100%
rename from bfps/cpp/field_layout.hpp
rename to cpp/field_layout.hpp
diff --git a/bfps/cpp/full_code/NSVE.cpp b/cpp/full_code/NSVE.cpp
similarity index 77%
rename from bfps/cpp/full_code/NSVE.cpp
rename to cpp/full_code/NSVE.cpp
index 7032d277eee02e8595af913e2456b185419a5666..7b1b2d9550c45f9166c37e1b8132427fed046597 100644
--- a/bfps/cpp/full_code/NSVE.cpp
+++ b/cpp/full_code/NSVE.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #define NDEBUG
 
 #include <string>
diff --git a/bfps/cpp/full_code/NSVE.hpp b/cpp/full_code/NSVE.hpp
similarity index 100%
rename from bfps/cpp/full_code/NSVE.hpp
rename to cpp/full_code/NSVE.hpp
diff --git a/bfps/cpp/full_code/NSVE_field_stats.cpp b/cpp/full_code/NSVE_field_stats.cpp
similarity index 65%
rename from bfps/cpp/full_code/NSVE_field_stats.cpp
rename to cpp/full_code/NSVE_field_stats.cpp
index b1c8d567592712f5d9feadd2caac73ca279238dd..0969175cc75530e2dad2c3c5dd9e6a0449416ed0 100644
--- a/bfps/cpp/full_code/NSVE_field_stats.cpp
+++ b/cpp/full_code/NSVE_field_stats.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include <string>
 #include <cmath>
 #include "NSVE_field_stats.hpp"
diff --git a/bfps/cpp/full_code/NSVE_field_stats.hpp b/cpp/full_code/NSVE_field_stats.hpp
similarity index 100%
rename from bfps/cpp/full_code/NSVE_field_stats.hpp
rename to cpp/full_code/NSVE_field_stats.hpp
diff --git a/bfps/cpp/full_code/NSVE_no_output.hpp b/cpp/full_code/NSVE_no_output.hpp
similarity index 100%
rename from bfps/cpp/full_code/NSVE_no_output.hpp
rename to cpp/full_code/NSVE_no_output.hpp
diff --git a/bfps/cpp/full_code/NSVEcomplex_particles.cpp b/cpp/full_code/NSVEcomplex_particles.cpp
similarity index 100%
rename from bfps/cpp/full_code/NSVEcomplex_particles.cpp
rename to cpp/full_code/NSVEcomplex_particles.cpp
diff --git a/bfps/cpp/full_code/NSVEcomplex_particles.hpp b/cpp/full_code/NSVEcomplex_particles.hpp
similarity index 100%
rename from bfps/cpp/full_code/NSVEcomplex_particles.hpp
rename to cpp/full_code/NSVEcomplex_particles.hpp
diff --git a/bfps/cpp/full_code/NSVEp_extra_sampling.cpp b/cpp/full_code/NSVEp_extra_sampling.cpp
similarity index 70%
rename from bfps/cpp/full_code/NSVEp_extra_sampling.cpp
rename to cpp/full_code/NSVEp_extra_sampling.cpp
index 22357510d2683f4a88f4af7a5371d74fdd45043d..7b3e5a76c6d47c990df9698ccb5f8ef22770a70d 100644
--- a/bfps/cpp/full_code/NSVEp_extra_sampling.cpp
+++ b/cpp/full_code/NSVEp_extra_sampling.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include "full_code/NSVEp_extra_sampling.hpp"
 
 
diff --git a/cpp/full_code/NSVEp_extra_sampling.hpp b/cpp/full_code/NSVEp_extra_sampling.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..d3d1c1863a315d14f774644f54eed4d6a606d176
--- /dev/null
+++ b/cpp/full_code/NSVEp_extra_sampling.hpp
@@ -0,0 +1,72 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
+#ifndef NSVEP_EXTRA_SAMPLING_HPP
+#define NSVEP_EXTRA_SAMPLING_HPP
+
+
+
+#include <cstdlib>
+#include "base.hpp"
+#include "vorticity_equation.hpp"
+#include "full_code/NSVEparticles.hpp"
+#include "particles/particles_system_builder.hpp"
+#include "particles/particles_output_hdf5.hpp"
+#include "particles/particles_sampling.hpp"
+
+/** \brief Navier-Stokes solver with tracers that sample velocity gradient
+ *  and pressure Hessian.
+ *
+ */
+
+template <typename rnumber>
+class NSVEp_extra_sampling: public NSVEparticles<rnumber>
+{
+    public:
+
+        /* other stuff */
+        field<rnumber, FFTW, ONE> *pressure;
+        field<rnumber, FFTW, THREE> *nabla_p;
+        field<rnumber, FFTW, THREExTHREE> *nabla_u;
+        field<rnumber, FFTW, THREExTHREE> *Hessian_p;
+
+        NSVEp_extra_sampling(
+                const MPI_Comm COMMUNICATOR,
+                const std::string &simulation_name):
+            NSVEparticles<rnumber>(
+                    COMMUNICATOR,
+                    simulation_name){}
+        ~NSVEp_extra_sampling(){}
+
+        int initialize(void);
+        int finalize(void);
+
+        int read_parameters(void);
+        int do_stats(void);
+};
+
+#endif//NSVEP_EXTRA_SAMPLING_HPP
+
+
diff --git a/bfps/cpp/full_code/NSVEparticles.cpp b/cpp/full_code/NSVEparticles.cpp
similarity index 100%
rename from bfps/cpp/full_code/NSVEparticles.cpp
rename to cpp/full_code/NSVEparticles.cpp
diff --git a/bfps/cpp/full_code/NSVEparticles.hpp b/cpp/full_code/NSVEparticles.hpp
similarity index 100%
rename from bfps/cpp/full_code/NSVEparticles.hpp
rename to cpp/full_code/NSVEparticles.hpp
diff --git a/cpp/full_code/NSVEparticles_no_output.hpp b/cpp/full_code/NSVEparticles_no_output.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..4e6de379b06c593e7b9cfbacb50a81c7bdcefcfd
--- /dev/null
+++ b/cpp/full_code/NSVEparticles_no_output.hpp
@@ -0,0 +1,50 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
+#ifndef NSVEPARTICLES_NO_OUTPUT_HPP
+#define NSVEPARTICLES_NO_OUTPUT_HPP
+
+#include "full_code/NSVEparticles.hpp"
+
+template <typename rnumber>
+class NSVEparticles_no_output: public NSVEparticles<rnumber>
+{
+    public:
+    NSVEparticles_no_output(
+            const MPI_Comm COMMUNICATOR,
+            const std::string &simulation_name):
+        NSVEparticles<rnumber>(
+                COMMUNICATOR,
+                simulation_name){}
+    ~NSVEparticles_no_output(){}
+    int write_checkpoint(void)
+    {
+        TIMEZONE("NSVEparticles_no_output::write_checkpoint");
+        return EXIT_SUCCESS;
+    }
+};
+
+#endif//NSVEPARTICLES_NO_OUTPUT_HPP
+
diff --git a/bfps/cpp/full_code/code_base.cpp b/cpp/full_code/code_base.cpp
similarity index 100%
rename from bfps/cpp/full_code/code_base.cpp
rename to cpp/full_code/code_base.cpp
diff --git a/bfps/cpp/full_code/code_base.hpp b/cpp/full_code/code_base.hpp
similarity index 100%
rename from bfps/cpp/full_code/code_base.hpp
rename to cpp/full_code/code_base.hpp
diff --git a/cpp/full_code/codes_with_no_output.hpp b/cpp/full_code/codes_with_no_output.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..175bed22d2f6a7b9fa2fc469d6a6bb6f03c9a3a0
--- /dev/null
+++ b/cpp/full_code/codes_with_no_output.hpp
@@ -0,0 +1,34 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
+#ifndef CODES_WITH_NO_OUTPUT_HPP
+#define CODES_WITH_NO_OUTPUT_HPP
+
+#include "full_code/NSVE_no_output.hpp"
+#include "full_code/NSVEparticles_no_output.hpp"
+
+
+#endif//CODES_WITH_NO_OUTPUT_HPP
+
diff --git a/bfps/cpp/full_code/direct_numerical_simulation.cpp b/cpp/full_code/direct_numerical_simulation.cpp
similarity index 70%
rename from bfps/cpp/full_code/direct_numerical_simulation.cpp
rename to cpp/full_code/direct_numerical_simulation.cpp
index cacda323153f0ed0f628b9fccc38e38fdcdc253c..5329e7034e082b32cbdad7b4aae3d81665156215 100644
--- a/bfps/cpp/full_code/direct_numerical_simulation.cpp
+++ b/cpp/full_code/direct_numerical_simulation.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #define NDEBUG
 
 #include <cstdlib>
diff --git a/bfps/cpp/full_code/direct_numerical_simulation.hpp b/cpp/full_code/direct_numerical_simulation.hpp
similarity index 100%
rename from bfps/cpp/full_code/direct_numerical_simulation.hpp
rename to cpp/full_code/direct_numerical_simulation.hpp
diff --git a/cpp/full_code/field_output_test.cpp b/cpp/full_code/field_output_test.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..649d8dbb5f3a26d30f147ff228c90326cce9ee6d
--- /dev/null
+++ b/cpp/full_code/field_output_test.cpp
@@ -0,0 +1,92 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
+#include <string>
+#include <cmath>
+#include <random>
+#include "field_output_test.hpp"
+#include "scope_timer.hpp"
+
+
+template <typename rnumber>
+int field_output_test<rnumber>::initialize(void)
+{
+    TIMEZONE("field_output_test::initialize");
+    this->read_parameters();
+    return EXIT_SUCCESS;
+}
+
+template <typename rnumber>
+int field_output_test<rnumber>::finalize(void)
+{
+    TIMEZONE("field_output_test::finalize");
+    return EXIT_SUCCESS;
+}
+
+template <typename rnumber>
+int field_output_test<rnumber>::read_parameters()
+{
+    TIMEZONE("field_output_test::read_parameters");
+    this->test::read_parameters();
+    return EXIT_SUCCESS;
+}
+
+template <typename rnumber>
+int field_output_test<rnumber>::do_work(void)
+{
+    TIMEZONE("field_output_test::do_work");
+    // allocate
+    field<rnumber, FFTW, ONE> *scal_field = new field<rnumber, FFTW, ONE>(
+            this->nx, this->ny, this->nz,
+            this->comm,
+            FFTW_ESTIMATE);
+    std::default_random_engine rgen;
+    std::normal_distribution<rnumber> rdist;
+    rgen.seed(1);
+
+    // fill up scal_field
+    scal_field->real_space_representation = true;
+    scal_field->RLOOP(
+            [&](ptrdiff_t rindex,
+                ptrdiff_t xindex,
+                ptrdiff_t yindex,
+                ptrdiff_t zindex){
+            scal_field->rval(rindex) = rdist(rgen);
+            });
+
+    scal_field->io(
+            this->simname + std::string("_fields.h5"),
+            "scal_field",
+            0,
+            false);
+
+    // deallocate
+    delete scal_field;
+    return EXIT_SUCCESS;
+}
+
+template class field_output_test<float>;
+template class field_output_test<double>;
+
diff --git a/bfps/cpp/full_code/field_output_test.hpp b/cpp/full_code/field_output_test.hpp
similarity index 100%
rename from bfps/cpp/full_code/field_output_test.hpp
rename to cpp/full_code/field_output_test.hpp
diff --git a/bfps/cpp/full_code/field_single_to_double.cpp b/cpp/full_code/field_single_to_double.cpp
similarity index 64%
rename from bfps/cpp/full_code/field_single_to_double.cpp
rename to cpp/full_code/field_single_to_double.cpp
index 92976ecfb3ff32dc798a2f6f4b17bfd44441a158..93a03aed5a494138ba8279792788a7bb19105325 100644
--- a/bfps/cpp/full_code/field_single_to_double.cpp
+++ b/cpp/full_code/field_single_to_double.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include <string>
 #include <cmath>
 #include "field_single_to_double.hpp"
diff --git a/bfps/cpp/full_code/field_single_to_double.hpp b/cpp/full_code/field_single_to_double.hpp
similarity index 100%
rename from bfps/cpp/full_code/field_single_to_double.hpp
rename to cpp/full_code/field_single_to_double.hpp
diff --git a/bfps/cpp/full_code/field_test.cpp b/cpp/full_code/field_test.cpp
similarity index 66%
rename from bfps/cpp/full_code/field_test.cpp
rename to cpp/full_code/field_test.cpp
index a9d531bcaf939b8b46ae539c57c00ae9b121c0a4..aa055a6e162ae15fc3652d9d0533e1eb07d5f528 100644
--- a/bfps/cpp/full_code/field_test.cpp
+++ b/cpp/full_code/field_test.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include <string>
 #include <cmath>
 #include <random>
diff --git a/bfps/cpp/full_code/field_test.hpp b/cpp/full_code/field_test.hpp
similarity index 100%
rename from bfps/cpp/full_code/field_test.hpp
rename to cpp/full_code/field_test.hpp
diff --git a/bfps/cpp/full_code/filter_test.cpp b/cpp/full_code/filter_test.cpp
similarity index 71%
rename from bfps/cpp/full_code/filter_test.cpp
rename to cpp/full_code/filter_test.cpp
index 6dbd05a940ff88623cd10802376497148bda5549..5df45a7941d5ce4989cee72cbb84731a7cec487f 100644
--- a/bfps/cpp/full_code/filter_test.cpp
+++ b/cpp/full_code/filter_test.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include <string>
 #include <cmath>
 #include "filter_test.hpp"
diff --git a/bfps/cpp/full_code/filter_test.hpp b/cpp/full_code/filter_test.hpp
similarity index 100%
rename from bfps/cpp/full_code/filter_test.hpp
rename to cpp/full_code/filter_test.hpp
diff --git a/bfps/cpp/full_code/get_rfields.cpp b/cpp/full_code/get_rfields.cpp
similarity index 68%
rename from bfps/cpp/full_code/get_rfields.cpp
rename to cpp/full_code/get_rfields.cpp
index 376a265946cb4682a619040a1c907f5f2abbd8e1..45f6b5dce95b5d4fbb9edc2ce353fdde51f0fba8 100644
--- a/bfps/cpp/full_code/get_rfields.cpp
+++ b/cpp/full_code/get_rfields.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include <string>
 #include <cmath>
 #include "get_rfields.hpp"
diff --git a/bfps/cpp/full_code/get_rfields.hpp b/cpp/full_code/get_rfields.hpp
similarity index 100%
rename from bfps/cpp/full_code/get_rfields.hpp
rename to cpp/full_code/get_rfields.hpp
diff --git a/bfps/cpp/full_code/joint_acc_vel_stats.cpp b/cpp/full_code/joint_acc_vel_stats.cpp
similarity index 76%
rename from bfps/cpp/full_code/joint_acc_vel_stats.cpp
rename to cpp/full_code/joint_acc_vel_stats.cpp
index fff2e2f5f4e83c3e89b742a18f2e3feaeb1466d1..be2cd9fe5a38dfb28df12d2c221b37c4d152212e 100644
--- a/bfps/cpp/full_code/joint_acc_vel_stats.cpp
+++ b/cpp/full_code/joint_acc_vel_stats.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include <string>
 #include <cmath>
 #include "joint_acc_vel_stats.hpp"
diff --git a/bfps/cpp/full_code/joint_acc_vel_stats.hpp b/cpp/full_code/joint_acc_vel_stats.hpp
similarity index 100%
rename from bfps/cpp/full_code/joint_acc_vel_stats.hpp
rename to cpp/full_code/joint_acc_vel_stats.hpp
diff --git a/bfps/cpp/full_code/main_code.hpp b/cpp/full_code/main_code.hpp
similarity index 100%
rename from bfps/cpp/full_code/main_code.hpp
rename to cpp/full_code/main_code.hpp
diff --git a/bfps/cpp/full_code/native_binary_to_hdf5.cpp b/cpp/full_code/native_binary_to_hdf5.cpp
similarity index 55%
rename from bfps/cpp/full_code/native_binary_to_hdf5.cpp
rename to cpp/full_code/native_binary_to_hdf5.cpp
index fe8e1c41a937e49db264aaca41c82df2503e4c99..0c2d738493aea060838c4acfed05251066b99bae 100644
--- a/bfps/cpp/full_code/native_binary_to_hdf5.cpp
+++ b/cpp/full_code/native_binary_to_hdf5.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include <string>
 #include <cmath>
 #include "native_binary_to_hdf5.hpp"
diff --git a/bfps/cpp/full_code/native_binary_to_hdf5.hpp b/cpp/full_code/native_binary_to_hdf5.hpp
similarity index 100%
rename from bfps/cpp/full_code/native_binary_to_hdf5.hpp
rename to cpp/full_code/native_binary_to_hdf5.hpp
diff --git a/bfps/cpp/full_code/postprocess.cpp b/cpp/full_code/postprocess.cpp
similarity index 54%
rename from bfps/cpp/full_code/postprocess.cpp
rename to cpp/full_code/postprocess.cpp
index 13bee7009e3d8d03e0f2ce10c8a3c1706318b460..e8c7fb279821fff0e3fd82c85b1c490a0b6a68e7 100644
--- a/bfps/cpp/full_code/postprocess.cpp
+++ b/cpp/full_code/postprocess.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include <cstdlib>
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/bfps/cpp/full_code/postprocess.hpp b/cpp/full_code/postprocess.hpp
similarity index 100%
rename from bfps/cpp/full_code/postprocess.hpp
rename to cpp/full_code/postprocess.hpp
diff --git a/bfps/cpp/full_code/resize.cpp b/cpp/full_code/resize.cpp
similarity index 56%
rename from bfps/cpp/full_code/resize.cpp
rename to cpp/full_code/resize.cpp
index de555a7436786d7ffdfd6a1b7206d74850065b6b..6d372dc462df8fc45729afe961488979f18ef818 100644
--- a/bfps/cpp/full_code/resize.cpp
+++ b/cpp/full_code/resize.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include <string>
 #include <cmath>
 #include "resize.hpp"
diff --git a/bfps/cpp/full_code/resize.hpp b/cpp/full_code/resize.hpp
similarity index 100%
rename from bfps/cpp/full_code/resize.hpp
rename to cpp/full_code/resize.hpp
diff --git a/bfps/cpp/full_code/symmetrize_test.cpp b/cpp/full_code/symmetrize_test.cpp
similarity index 81%
rename from bfps/cpp/full_code/symmetrize_test.cpp
rename to cpp/full_code/symmetrize_test.cpp
index 7cf96a71efe881876de1bcef2ab4d9f0482aaddf..111d3a833815b3f9abf539db19b81f2d18d33a99 100644
--- a/bfps/cpp/full_code/symmetrize_test.cpp
+++ b/cpp/full_code/symmetrize_test.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include <string>
 #include <cmath>
 #include <random>
diff --git a/bfps/cpp/full_code/symmetrize_test.hpp b/cpp/full_code/symmetrize_test.hpp
similarity index 100%
rename from bfps/cpp/full_code/symmetrize_test.hpp
rename to cpp/full_code/symmetrize_test.hpp
diff --git a/cpp/full_code/test.cpp b/cpp/full_code/test.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5fd265ec7ba661994f2e0664013770db0834fb7d
--- /dev/null
+++ b/cpp/full_code/test.cpp
@@ -0,0 +1,43 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
+#include <cstdlib>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "scope_timer.hpp"
+#include "hdf5_tools.hpp"
+#include "full_code/test.hpp"
+
+
+int test::main_loop(void)
+{
+    TIMEZONE("test::main_loop");
+    this->start_simple_timer();
+    this->do_work();
+    this->print_simple_timer(
+            "do_work required ");
+    return EXIT_SUCCESS;
+}
+
diff --git a/bfps/cpp/full_code/test.hpp b/cpp/full_code/test.hpp
similarity index 100%
rename from bfps/cpp/full_code/test.hpp
rename to cpp/full_code/test.hpp
diff --git a/bfps/cpp/full_code/test_interpolation.cpp b/cpp/full_code/test_interpolation.cpp
similarity index 81%
rename from bfps/cpp/full_code/test_interpolation.cpp
rename to cpp/full_code/test_interpolation.cpp
index c3103fb4cb0c6a5cf29d408142bdd4da943cce10..e5722fc0cdb3c851695c0c3eeb34a5da97a405eb 100644
--- a/bfps/cpp/full_code/test_interpolation.cpp
+++ b/cpp/full_code/test_interpolation.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include "full_code/test_interpolation.hpp"
 
 
diff --git a/cpp/full_code/test_interpolation.hpp b/cpp/full_code/test_interpolation.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..4d65d4fa8105d8e5f78f3fc9f623929038f8ac0e
--- /dev/null
+++ b/cpp/full_code/test_interpolation.hpp
@@ -0,0 +1,84 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
+#ifndef TEST_INTERPOLATION_HPP
+#define TEST_INTERPOLATION_HPP
+
+
+
+#include <cstdlib>
+#include "base.hpp"
+#include "kspace.hpp"
+#include "full_code/test.hpp"
+#include "particles/particles_system_builder.hpp"
+#include "particles/particles_output_hdf5.hpp"
+#include "particles/particles_sampling.hpp"
+
+/** \brief Interpolation tester.
+ *
+ */
+
+template <typename rnumber>
+class test_interpolation: public test
+{
+    public:
+        int nparticles;
+        int tracers0_integration_steps;
+        int tracers0_neighbours;
+        int tracers0_smoothness;
+
+        std::unique_ptr<abstract_particles_system<long long int, double>> ps;
+
+        particles_output_hdf5<long long int, double,3> *particles_output_writer_mpi;
+        particles_output_sampling_hdf5<long long int, double, 3> *particles_sample_writer_mpi;
+
+        field<rnumber, FFTW, THREE> *velocity, *vorticity;
+        field<rnumber, FFTW, THREExTHREE> *nabla_u;
+
+        kspace<FFTW, SMOOTH> *kk;
+
+        test_interpolation(
+                const MPI_Comm COMMUNICATOR,
+                const std::string &simulation_name):
+            test(
+                    COMMUNICATOR,
+                    simulation_name),
+            particles_output_writer_mpi(nullptr),
+            particles_sample_writer_mpi(nullptr),
+            velocity(nullptr),
+            vorticity(nullptr),
+            nabla_u(nullptr),
+            kk(nullptr) {}
+        ~test_interpolation(){}
+
+        int initialize(void);
+        int do_work(void);
+        int finalize(void);
+
+        int read_parameters(void);
+};
+
+#endif//TEST_INTERPOLATION_HPP
+
diff --git a/bfps/cpp/hdf5_tools.cpp b/cpp/hdf5_tools.cpp
similarity index 100%
rename from bfps/cpp/hdf5_tools.cpp
rename to cpp/hdf5_tools.cpp
diff --git a/bfps/cpp/hdf5_tools.hpp b/cpp/hdf5_tools.hpp
similarity index 100%
rename from bfps/cpp/hdf5_tools.hpp
rename to cpp/hdf5_tools.hpp
diff --git a/bfps/cpp/kspace.cpp b/cpp/kspace.cpp
similarity index 100%
rename from bfps/cpp/kspace.cpp
rename to cpp/kspace.cpp
diff --git a/bfps/cpp/kspace.hpp b/cpp/kspace.hpp
similarity index 100%
rename from bfps/cpp/kspace.hpp
rename to cpp/kspace.hpp
diff --git a/bfps/cpp/omputils.hpp b/cpp/omputils.hpp
similarity index 100%
rename from bfps/cpp/omputils.hpp
rename to cpp/omputils.hpp
diff --git a/bfps/cpp/particles/.tocompile b/cpp/particles/.tocompile
similarity index 100%
rename from bfps/cpp/particles/.tocompile
rename to cpp/particles/.tocompile
diff --git a/cpp/particles/abstract_particles_input.hpp b/cpp/particles/abstract_particles_input.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..48c38bc592ddc442489d437327b421312bfd3f55
--- /dev/null
+++ b/cpp/particles/abstract_particles_input.hpp
@@ -0,0 +1,46 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
+#ifndef ABSTRACT_PARTICLES_INPUT_HPP
+#define ABSTRACT_PARTICLES_INPUT_HPP
+
+#include <tuple>
+
+template <class partsize_t, class real_number>
+class abstract_particles_input {
+public:
+    virtual ~abstract_particles_input(){}
+
+    virtual partsize_t getTotalNbParticles()  = 0;
+    virtual partsize_t getLocalNbParticles()  = 0;
+    virtual int getNbRhs()  = 0;
+
+    virtual std::unique_ptr<real_number[]> getMyParticles()  = 0;
+    virtual std::unique_ptr<partsize_t[]> getMyParticlesIndexes()  = 0;
+    virtual std::vector<std::unique_ptr<real_number[]>> getMyRhs()  = 0;
+};
+
+
+#endif
diff --git a/bfps/cpp/particles/abstract_particles_output.hpp b/cpp/particles/abstract_particles_output.hpp
similarity index 89%
rename from bfps/cpp/particles/abstract_particles_output.hpp
rename to cpp/particles/abstract_particles_output.hpp
index a457689a606fa0f004667dc142c0f44d81e16e93..6dc85cebba83e8650329700f15284081301ba3c5 100644
--- a/bfps/cpp/particles/abstract_particles_output.hpp
+++ b/cpp/particles/abstract_particles_output.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef ABSTRACT_PARTICLES_OUTPUT
 #define ABSTRACT_PARTICLES_OUTPUT
 
diff --git a/bfps/cpp/particles/abstract_particles_system.hpp b/cpp/particles/abstract_particles_system.hpp
similarity index 69%
rename from bfps/cpp/particles/abstract_particles_system.hpp
rename to cpp/particles/abstract_particles_system.hpp
index 67c46855a59f576c186216fa613c7f88523261df..2f2f510f4bdad22b26b243607c7bbddcd2536771 100644
--- a/bfps/cpp/particles/abstract_particles_system.hpp
+++ b/cpp/particles/abstract_particles_system.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef ABSTRACT_PARTICLES_SYSTEM_HPP
 #define ABSTRACT_PARTICLES_SYSTEM_HPP
 
diff --git a/bfps/cpp/particles/alltoall_exchanger.hpp b/cpp/particles/alltoall_exchanger.hpp
similarity index 79%
rename from bfps/cpp/particles/alltoall_exchanger.hpp
rename to cpp/particles/alltoall_exchanger.hpp
index 2beaf092e8e6c7a801efd492270d29c2d4dba398..d3423523d9b9d02347514972c3bcb3f92129df56 100644
--- a/bfps/cpp/particles/alltoall_exchanger.hpp
+++ b/cpp/particles/alltoall_exchanger.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef ALLTOALL_EXCHANGER_HPP
 #define ALLTOALL_EXCHANGER_HPP
 
diff --git a/bfps/cpp/particles/env_utils.hpp b/cpp/particles/env_utils.hpp
similarity index 59%
rename from bfps/cpp/particles/env_utils.hpp
rename to cpp/particles/env_utils.hpp
index cd6fb3026ac19397fb525235f3d4f87e2cc2bb94..829fd5b46f879c4485276d3f3866b8ae3d81e8d5 100644
--- a/bfps/cpp/particles/env_utils.hpp
+++ b/cpp/particles/env_utils.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef ENV_UTILS_HPP
 #define ENV_UTILS_HPP
 
diff --git a/cpp/particles/lock_free_bool_array.hpp b/cpp/particles/lock_free_bool_array.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..5e32a7d41bec3ddc7d56962d14d338a78f2b084a
--- /dev/null
+++ b/cpp/particles/lock_free_bool_array.hpp
@@ -0,0 +1,58 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
+#ifndef LOCK_FREE_BOOL_ARRAY_HPP
+#define LOCK_FREE_BOOL_ARRAY_HPP
+
+#include <vector>
+#include <memory>
+
+class lock_free_bool_array{
+    std::vector<std::unique_ptr<long int>> keys;
+
+public:
+    explicit lock_free_bool_array(const long int inNbKeys = 512){
+        keys.resize(inNbKeys);
+        for(std::unique_ptr<long int>& k : keys){
+            k.reset(new long int(0));
+        }
+    }
+
+    void lock(const long int inKey){
+        volatile long int* k = keys[inKey%keys.size()].get();
+        long int res = 1;
+        while(res == 1){
+            res = __sync_val_compare_and_swap(k, 0, res);
+        }
+    }
+
+    void unlock(const long int inKey){
+        volatile long int* k = keys[inKey%keys.size()].get();
+        assert(k && *k);
+        (*k) = 0;
+    }
+};
+
+#endif
diff --git a/bfps/cpp/particles/p2p_computer.hpp b/cpp/particles/p2p_computer.hpp
similarity index 67%
rename from bfps/cpp/particles/p2p_computer.hpp
rename to cpp/particles/p2p_computer.hpp
index 922d65d1526f2491e3f3bbc6ec3b875d48cbc268..74d9c9ebeff2e61864fe5e827f103d1691709e4d 100644
--- a/bfps/cpp/particles/p2p_computer.hpp
+++ b/cpp/particles/p2p_computer.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef P2P_COMPUTER_HPP
 #define P2P_COMPUTER_HPP
 
diff --git a/cpp/particles/p2p_computer_empty.hpp b/cpp/particles/p2p_computer_empty.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..0599dc1abb08207fcb761a534c282f8fceda5ce3
--- /dev/null
+++ b/cpp/particles/p2p_computer_empty.hpp
@@ -0,0 +1,54 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
+#ifndef P2P_COMPUTER_EMPTY_HPP
+#define P2P_COMPUTER_EMPTY_HPP
+
+#include <cstring>
+
+template <class real_number, class partsize_t>
+class p2p_computer_empty{
+public:
+    template <int size_particle_rhs>
+    void init_result_array(real_number /*rhs*/[], const partsize_t /*nbParticles*/) const{
+    }
+
+    template <int size_particle_rhs>
+    void reduce_particles_rhs(real_number /*rhs_dst*/[], const real_number /*rhs_src*/[], const partsize_t /*nbParticles*/) const{
+    }
+
+    template <int size_particle_positions, int size_particle_rhs>
+    void compute_interaction(const real_number /*pos_part1*/[], real_number /*rhs_part1*/[],
+                             const real_number /*pos_part2*/[], real_number /*rhs_part2*/[],
+                             const real_number /*dist_pow2*/,  const real_number /*cutoff*/,
+                             const real_number /*xshift_coef*/, const real_number /*yshift_coef*/, const real_number /*zshift_coef*/) const{
+    }
+
+    constexpr static bool isEnable() {
+        return false;
+    }
+};
+
+#endif
diff --git a/bfps/cpp/particles/p2p_distr_mpi.hpp b/cpp/particles/p2p_distr_mpi.hpp
similarity index 96%
rename from bfps/cpp/particles/p2p_distr_mpi.hpp
rename to cpp/particles/p2p_distr_mpi.hpp
index 9b8a5b1318bb213484eca81e11d764234a994937..7ab3a8b36722b8aa03ec9f4c070a68aa1fbe1776 100644
--- a/bfps/cpp/particles/p2p_distr_mpi.hpp
+++ b/cpp/particles/p2p_distr_mpi.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef P2P_DISTR_MPI_HPP
 #define P2P_DISTR_MPI_HPP
 
diff --git a/bfps/cpp/particles/p2p_tree.hpp b/cpp/particles/p2p_tree.hpp
similarity index 71%
rename from bfps/cpp/particles/p2p_tree.hpp
rename to cpp/particles/p2p_tree.hpp
index a4441543e4d4711b8f1f311431e6e982fb34913f..cdb3089174ff888cbfc13810d18c617b4a8358e7 100644
--- a/bfps/cpp/particles/p2p_tree.hpp
+++ b/cpp/particles/p2p_tree.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef P2P_TREE_HPP
 #define P2P_TREE_HPP
 
diff --git a/bfps/cpp/particles/particles_adams_bashforth.hpp b/cpp/particles/particles_adams_bashforth.hpp
similarity index 78%
rename from bfps/cpp/particles/particles_adams_bashforth.hpp
rename to cpp/particles/particles_adams_bashforth.hpp
index e81e6022c15352b87f63797e2679b26fec719779..21412e3530408a5980c376453cd6f5199466d830 100644
--- a/bfps/cpp/particles/particles_adams_bashforth.hpp
+++ b/cpp/particles/particles_adams_bashforth.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_ADAMS_BASHFORTH_HPP
 #define PARTICLES_ADAMS_BASHFORTH_HPP
 
diff --git a/bfps/cpp/particles/particles_distr_mpi.hpp b/cpp/particles/particles_distr_mpi.hpp
similarity index 96%
rename from bfps/cpp/particles/particles_distr_mpi.hpp
rename to cpp/particles/particles_distr_mpi.hpp
index 8a2b77ca4d8f4dd7f566868898a4af1fc78e7cb5..43d61ca407af23e3cf3c3979d678af08cd7b5ff8 100644
--- a/bfps/cpp/particles/particles_distr_mpi.hpp
+++ b/cpp/particles/particles_distr_mpi.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_DISTR_MPI_HPP
 #define PARTICLES_DISTR_MPI_HPP
 
diff --git a/bfps/cpp/particles/particles_field_computer.hpp b/cpp/particles/particles_field_computer.hpp
similarity index 85%
rename from bfps/cpp/particles/particles_field_computer.hpp
rename to cpp/particles/particles_field_computer.hpp
index 92a486397ab7c508cb8767d92e1227b1e2e5e654..a59b40d5df8d025f63126c142677576ec5be965a 100644
--- a/bfps/cpp/particles/particles_field_computer.hpp
+++ b/cpp/particles/particles_field_computer.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_FIELD_COMPUTER_HPP
 #define PARTICLES_FIELD_COMPUTER_HPP
 
diff --git a/bfps/cpp/particles/particles_generic_interp.hpp b/cpp/particles/particles_generic_interp.hpp
similarity index 82%
rename from bfps/cpp/particles/particles_generic_interp.hpp
rename to cpp/particles/particles_generic_interp.hpp
index 98d0363d4fcfae8c05b6ceabef620e17c1263eee..da48641ca543dd853c24d675c1fea8b96f9da449 100644
--- a/bfps/cpp/particles/particles_generic_interp.hpp
+++ b/cpp/particles/particles_generic_interp.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_GENERIC_INTERP_HPP
 #define PARTICLES_GENERIC_INTERP_HPP
 
diff --git a/bfps/cpp/particles/particles_inner_computer.cpp b/cpp/particles/particles_inner_computer.cpp
similarity index 82%
rename from bfps/cpp/particles/particles_inner_computer.cpp
rename to cpp/particles/particles_inner_computer.cpp
index deb85deea43cd0121e7d2a39d2c38254571597e7..3a841bee50f2849ef981cb5c585ee448570ae2ca 100644
--- a/bfps/cpp/particles/particles_inner_computer.cpp
+++ b/cpp/particles/particles_inner_computer.cpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #include "base.hpp"
 #include "particles_utils.hpp"
 #include "particles_inner_computer.hpp"
diff --git a/bfps/cpp/particles/particles_inner_computer.hpp b/cpp/particles/particles_inner_computer.hpp
similarity index 60%
rename from bfps/cpp/particles/particles_inner_computer.hpp
rename to cpp/particles/particles_inner_computer.hpp
index 59dbba64c6be5841e0c92f458935e7e577a6f7b6..7f30ad6829e5cfa0ac40bd59db7a9a09cbe8ac6f 100644
--- a/bfps/cpp/particles/particles_inner_computer.hpp
+++ b/cpp/particles/particles_inner_computer.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_INNER_COMPUTER_HPP
 #define PARTICLES_INNER_COMPUTER_HPP
 
diff --git a/cpp/particles/particles_inner_computer_empty.hpp b/cpp/particles/particles_inner_computer_empty.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..a90d3aa1b9f5ca5e9e2085173c6c55a25809b469
--- /dev/null
+++ b/cpp/particles/particles_inner_computer_empty.hpp
@@ -0,0 +1,57 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
+#ifndef PARTICLES_INNER_COMPUTER_EMPTY_HPP
+#define PARTICLES_INNER_COMPUTER_EMPTY_HPP
+
+#include <cstring>
+#include <cassert>
+
+template <class real_number, class partsize_t>
+class particles_inner_computer_empty{
+public:
+    template <int size_particle_positions, int size_particle_rhs>
+    void compute_interaction(const partsize_t /*nb_particles*/, real_number /*pos_part*/[], real_number /*rhs_part*/[]) const{
+    }
+
+    template <int size_particle_positions>
+    void enforce_unit_orientation(const partsize_t /*nb_particles*/, real_number /*pos_part*/[]) const{
+    }
+
+    template <int size_particle_positions, int size_particle_rhs>
+    void add_Lagrange_multipliers(const partsize_t /*nb_particles*/, real_number /*pos_part*/[], real_number /*rhs_part*/[]) const{
+    }
+
+    template <int size_particle_positions, int size_particle_rhs, int size_particle_rhs_extra>
+    void compute_interaction_with_extra(const partsize_t /*nb_particles*/, real_number /*pos_part*/[], real_number /*rhs_part*/[],
+                             const real_number /*rhs_part_extra*/[]) const{
+    }
+
+    constexpr static bool isEnable() {
+        return false;
+    }
+};
+
+#endif
diff --git a/bfps/cpp/particles/particles_input_hdf5.hpp b/cpp/particles/particles_input_hdf5.hpp
similarity index 89%
rename from bfps/cpp/particles/particles_input_hdf5.hpp
rename to cpp/particles/particles_input_hdf5.hpp
index 33406314236ad8a10d97eeef331819ee0d8f6261..3f895be3613030fca0a0fce1a786bb6fc541fe9c 100644
--- a/bfps/cpp/particles/particles_input_hdf5.hpp
+++ b/cpp/particles/particles_input_hdf5.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_INPUT_HDF5_HPP
 #define PARTICLES_INPUT_HDF5_HPP
 
diff --git a/bfps/cpp/particles/particles_output_hdf5.hpp b/cpp/particles/particles_output_hdf5.hpp
similarity index 88%
rename from bfps/cpp/particles/particles_output_hdf5.hpp
rename to cpp/particles/particles_output_hdf5.hpp
index d7c987eea444d82d5c1180cd0124601c191cbf84..6be651799f1bf98e3215cc3b0988b77975706b19 100644
--- a/bfps/cpp/particles/particles_output_hdf5.hpp
+++ b/cpp/particles/particles_output_hdf5.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_OUTPUT_HDF5_HPP
 #define PARTICLES_OUTPUT_HDF5_HPP
 
diff --git a/bfps/cpp/particles/particles_output_mpiio.hpp b/cpp/particles/particles_output_mpiio.hpp
similarity index 70%
rename from bfps/cpp/particles/particles_output_mpiio.hpp
rename to cpp/particles/particles_output_mpiio.hpp
index 5810c4a06e795a32db13b6701ed4e0256db40eb3..b1c17898c3c2941e0ed161e40113a0d13c99b524 100644
--- a/bfps/cpp/particles/particles_output_mpiio.hpp
+++ b/cpp/particles/particles_output_mpiio.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_OUTPUT_MPIIO
 #define PARTICLES_OUTPUT_MPIIO
 
diff --git a/bfps/cpp/particles/particles_output_sampling_hdf5.hpp b/cpp/particles/particles_output_sampling_hdf5.hpp
similarity index 84%
rename from bfps/cpp/particles/particles_output_sampling_hdf5.hpp
rename to cpp/particles/particles_output_sampling_hdf5.hpp
index ff3782b58716481303368a946cf30b5219e74345..ea3c94dcec25572dd324c643d9cc80468ba51680 100644
--- a/bfps/cpp/particles/particles_output_sampling_hdf5.hpp
+++ b/cpp/particles/particles_output_sampling_hdf5.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_OUTPUT_SAMPLING_HDF5_HPP
 #define PARTICLES_OUTPUT_SAMPLING_HDF5_HPP
 
diff --git a/bfps/cpp/particles/particles_sampling.hpp b/cpp/particles/particles_sampling.hpp
similarity index 71%
rename from bfps/cpp/particles/particles_sampling.hpp
rename to cpp/particles/particles_sampling.hpp
index 8baff633c155adb161c3764eaac8c9010c5fe086..672c080aea1b59e250109f94fd5fee388e199755 100644
--- a/bfps/cpp/particles/particles_sampling.hpp
+++ b/cpp/particles/particles_sampling.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_SAMPLING_HPP
 #define PARTICLES_SAMPLING_HPP
 
diff --git a/bfps/cpp/particles/particles_system.hpp b/cpp/particles/particles_system.hpp
similarity index 91%
rename from bfps/cpp/particles/particles_system.hpp
rename to cpp/particles/particles_system.hpp
index db651904b7f3e752f73846c494a8b9f6ee41b988..a05175ca52c4c4b669f29f893913b3d7fcf6c484 100644
--- a/bfps/cpp/particles/particles_system.hpp
+++ b/cpp/particles/particles_system.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_SYSTEM_HPP
 #define PARTICLES_SYSTEM_HPP
 
diff --git a/bfps/cpp/particles/particles_system_builder.hpp b/cpp/particles/particles_system_builder.hpp
similarity index 90%
rename from bfps/cpp/particles/particles_system_builder.hpp
rename to cpp/particles/particles_system_builder.hpp
index 916ab4bfe0f72f53a9a9b5c356d4255c78877096..6a6f4a26f3f0f08703b1a1ed8857f2445b641ac7 100644
--- a/bfps/cpp/particles/particles_system_builder.hpp
+++ b/cpp/particles/particles_system_builder.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_SYSTEM_BUILDER_HPP
 #define PARTICLES_SYSTEM_BUILDER_HPP
 
diff --git a/bfps/cpp/particles/particles_utils.hpp b/cpp/particles/particles_utils.hpp
similarity index 86%
rename from bfps/cpp/particles/particles_utils.hpp
rename to cpp/particles/particles_utils.hpp
index 76371e64f7bebcbc5d54004f417461c6d211a558..f1e0c790cd9c02ffb714bb555455662134346ee4 100644
--- a/bfps/cpp/particles/particles_utils.hpp
+++ b/cpp/particles/particles_utils.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef PARTICLES_UTILS_HPP
 #define PARTICLES_UTILS_HPP
 
diff --git a/bfps/cpp/scope_timer.cpp b/cpp/scope_timer.cpp
similarity index 100%
rename from bfps/cpp/scope_timer.cpp
rename to cpp/scope_timer.cpp
diff --git a/bfps/cpp/scope_timer.hpp b/cpp/scope_timer.hpp
similarity index 100%
rename from bfps/cpp/scope_timer.hpp
rename to cpp/scope_timer.hpp
diff --git a/bfps/cpp/shared_array.hpp b/cpp/shared_array.hpp
similarity index 62%
rename from bfps/cpp/shared_array.hpp
rename to cpp/shared_array.hpp
index 1951e2f9838ccf37367d859206453d3db91e8e19..0245dc5df81e5bd1511b57583b9a4a86745a5d2c 100644
--- a/bfps/cpp/shared_array.hpp
+++ b/cpp/shared_array.hpp
@@ -1,3 +1,28 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2016 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
 #ifndef SHAREDARRAY_HPP
 #define SHAREDARRAY_HPP
 
diff --git a/cpp/spline.hpp b/cpp/spline.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..ef990088566ec10f0bbf10937980705ffeb570dc
--- /dev/null
+++ b/cpp/spline.hpp
@@ -0,0 +1,40 @@
+/******************************************************************************
+*                                                                             *
+*  Copyright 2017 Max Planck Institute for Dynamics and Self-Organization     *
+*                                                                             *
+*  This file is part of bfps.                                                 *
+*                                                                             *
+*  bfps is free software: you can redistribute it and/or modify               *
+*  it under the terms of the GNU General Public License as published          *
+*  by the Free Software Foundation, either version 3 of the License,          *
+*  or (at your option) any later version.                                     *
+*                                                                             *
+*  bfps is distributed in the hope that it will be useful,                    *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+*  GNU General Public License for more details.                               *
+*                                                                             *
+*  You should have received a copy of the GNU General Public License          *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>               *
+*                                                                             *
+* Contact: Cristian.Lalescu@ds.mpg.de                                         *
+*                                                                             *
+******************************************************************************/
+
+
+
+#ifndef SPLINE_HPP
+#define SPLINE_HPP
+
+#include "spline_n1.hpp"
+#include "spline_n2.hpp"
+#include "spline_n3.hpp"
+#include "spline_n4.hpp"
+#include "spline_n5.hpp"
+#include "spline_n6.hpp"
+#include "spline_n7.hpp"
+#include "spline_n8.hpp"
+#include "spline_n9.hpp"
+#include "spline_n10.hpp"
+
+#endif
diff --git a/bfps/cpp/spline_n1.cpp b/cpp/spline_n1.cpp
similarity index 100%
rename from bfps/cpp/spline_n1.cpp
rename to cpp/spline_n1.cpp
diff --git a/bfps/cpp/spline_n1.hpp b/cpp/spline_n1.hpp
similarity index 100%
rename from bfps/cpp/spline_n1.hpp
rename to cpp/spline_n1.hpp
diff --git a/bfps/cpp/spline_n10.cpp b/cpp/spline_n10.cpp
similarity index 100%
rename from bfps/cpp/spline_n10.cpp
rename to cpp/spline_n10.cpp
diff --git a/bfps/cpp/spline_n10.hpp b/cpp/spline_n10.hpp
similarity index 100%
rename from bfps/cpp/spline_n10.hpp
rename to cpp/spline_n10.hpp
diff --git a/bfps/cpp/spline_n2.cpp b/cpp/spline_n2.cpp
similarity index 100%
rename from bfps/cpp/spline_n2.cpp
rename to cpp/spline_n2.cpp
diff --git a/bfps/cpp/spline_n2.hpp b/cpp/spline_n2.hpp
similarity index 100%
rename from bfps/cpp/spline_n2.hpp
rename to cpp/spline_n2.hpp
diff --git a/bfps/cpp/spline_n3.cpp b/cpp/spline_n3.cpp
similarity index 100%
rename from bfps/cpp/spline_n3.cpp
rename to cpp/spline_n3.cpp
diff --git a/bfps/cpp/spline_n3.hpp b/cpp/spline_n3.hpp
similarity index 100%
rename from bfps/cpp/spline_n3.hpp
rename to cpp/spline_n3.hpp
diff --git a/bfps/cpp/spline_n4.cpp b/cpp/spline_n4.cpp
similarity index 100%
rename from bfps/cpp/spline_n4.cpp
rename to cpp/spline_n4.cpp
diff --git a/bfps/cpp/spline_n4.hpp b/cpp/spline_n4.hpp
similarity index 100%
rename from bfps/cpp/spline_n4.hpp
rename to cpp/spline_n4.hpp
diff --git a/bfps/cpp/spline_n5.cpp b/cpp/spline_n5.cpp
similarity index 100%
rename from bfps/cpp/spline_n5.cpp
rename to cpp/spline_n5.cpp
diff --git a/bfps/cpp/spline_n5.hpp b/cpp/spline_n5.hpp
similarity index 100%
rename from bfps/cpp/spline_n5.hpp
rename to cpp/spline_n5.hpp
diff --git a/bfps/cpp/spline_n6.cpp b/cpp/spline_n6.cpp
similarity index 100%
rename from bfps/cpp/spline_n6.cpp
rename to cpp/spline_n6.cpp
diff --git a/bfps/cpp/spline_n6.hpp b/cpp/spline_n6.hpp
similarity index 100%
rename from bfps/cpp/spline_n6.hpp
rename to cpp/spline_n6.hpp
diff --git a/bfps/cpp/spline_n7.cpp b/cpp/spline_n7.cpp
similarity index 100%
rename from bfps/cpp/spline_n7.cpp
rename to cpp/spline_n7.cpp
diff --git a/bfps/cpp/spline_n7.hpp b/cpp/spline_n7.hpp
similarity index 100%
rename from bfps/cpp/spline_n7.hpp
rename to cpp/spline_n7.hpp
diff --git a/bfps/cpp/spline_n8.cpp b/cpp/spline_n8.cpp
similarity index 100%
rename from bfps/cpp/spline_n8.cpp
rename to cpp/spline_n8.cpp
diff --git a/bfps/cpp/spline_n8.hpp b/cpp/spline_n8.hpp
similarity index 100%
rename from bfps/cpp/spline_n8.hpp
rename to cpp/spline_n8.hpp
diff --git a/bfps/cpp/spline_n9.cpp b/cpp/spline_n9.cpp
similarity index 100%
rename from bfps/cpp/spline_n9.cpp
rename to cpp/spline_n9.cpp
diff --git a/bfps/cpp/spline_n9.hpp b/cpp/spline_n9.hpp
similarity index 100%
rename from bfps/cpp/spline_n9.hpp
rename to cpp/spline_n9.hpp
diff --git a/bfps/cpp/vorticity_equation.cpp b/cpp/vorticity_equation.cpp
similarity index 100%
rename from bfps/cpp/vorticity_equation.cpp
rename to cpp/vorticity_equation.cpp
diff --git a/bfps/cpp/vorticity_equation.hpp b/cpp/vorticity_equation.hpp
similarity index 100%
rename from bfps/cpp/vorticity_equation.hpp
rename to cpp/vorticity_equation.hpp
diff --git a/cpp_build.py b/cpp_build.py
deleted file mode 100644
index 39371214bab4e2ac3ee9f5b064f5532811448765..0000000000000000000000000000000000000000
--- a/cpp_build.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#######################################################################
-#                                                                     #
-#  Copyright 2015 Max Planck Institute                                #
-#                 for Dynamics and Self-Organization                  #
-#                                                                     #
-#  This file is part of bfps.                                         #
-#                                                                     #
-#  bfps is free software: you can redistribute it and/or modify       #
-#  it under the terms of the GNU General Public License as published  #
-#  by the Free Software Foundation, either version 3 of the License,  #
-#  or (at your option) any later version.                             #
-#                                                                     #
-#  bfps is distributed in the hope that it will be useful,            #
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of     #
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      #
-#  GNU General Public License for more details.                       #
-#                                                                     #
-#  You should have received a copy of the GNU General Public License  #
-#  along with bfps.  If not, see <http://www.gnu.org/licenses/>       #
-#                                                                     #
-# Contact: Cristian.Lalescu@ds.mpg.de                                 #
-#                                                                     #
-#######################################################################
-
-
-
-import os
-import subprocess
-
-src_file_list = ['hdf5_tools',
-                 'full_code/get_rfields',
-                 'full_code/NSVE_field_stats',
-                 'full_code/native_binary_to_hdf5',
-                 'full_code/postprocess',
-                 'full_code/code_base',
-                 'full_code/direct_numerical_simulation',
-                 'full_code/NSVE',
-                 'full_code/NSVEparticles',
-                 'field_binary_IO',
-                 'vorticity_equation',
-                 'field',
-                 'kspace',
-                 'field_layout',
-                 'field_descriptor',
-                 'rFFTW_distributed_particles',
-                 'distributed_particles',
-                 'particles',
-                 'particles_base',
-                 'rFFTW_interpolator',
-                 'interpolator',
-                 'interpolator_base',
-                 'fluid_solver',
-                 'fluid_solver_base',
-                 'fftw_tools',
-                 'spline_n1',
-                 'spline_n2',
-                 'spline_n3',
-                 'spline_n4',
-                 'spline_n5',
-                 'spline_n6',
-                 'spline_n7',
-                 'spline_n8',
-                 'spline_n9',
-                 'spline_n10',
-                 'Lagrange_polys',
-                 'scope_timer']
-
-def get_file_dependency_list(src_file):
-    p = subprocess.Popen(
-            ['g++', '-Ibfps/cpp', '-MM', 'bfps/cpp/' + src_file + '.cpp'],
-            stdout = subprocess.PIPE)
-    out, err = p.communicate()
-    p.terminate()
-    deps = str(out, 'ASCII').replace('\\\n', '')
-    return deps
-
-def get_dependency_list():
-    ofile = open('dependencies.txt', 'w')
-    for src_file in src_file_list:
-        p = subprocess.Popen(
-                ['g++', '-Ibfps/cpp', '-MM', 'bfps/cpp/' + src_file + '.cpp'],
-                stdout = subprocess.PIPE)
-        out, err = p.communicate()
-        p.terminate()
-        deps = str(out, 'ASCII').replace('\\\n', '')
-        print(deps.split()[0])
-        ofile.write(' '.join(deps.split()[1:]) + '\n')
-    ofile.close()
-    return None
-
-if __name__ == '__main__':
-    #pass
-    get_dependency_list()
-
diff --git a/get_version.py b/get_version.py
new file mode 100644
index 0000000000000000000000000000000000000000..fe545a6796333774366e99f9a1416b5b1c1bc62f
--- /dev/null
+++ b/get_version.py
@@ -0,0 +1,63 @@
+################################################################################
+#                                                                              #
+#  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization      #
+#                                                                              #
+#  This file is part of bfps.                                                  #
+#                                                                              #
+#  bfps is free software: you can redistribute it and/or modify                #
+#  it under the terms of the GNU General Public License as published           #
+#  by the Free Software Foundation, either version 3 of the License,           #
+#  or (at your option) any later version.                                      #
+#                                                                              #
+#  bfps is distributed in the hope that it will be useful,                     #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+#  GNU General Public License for more details.                                #
+#                                                                              #
+#  You should have received a copy of the GNU General Public License           #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>                #
+#                                                                              #
+# Contact: Cristian.Lalescu@ds.mpg.de                                          #
+#                                                                              #
+################################################################################
+
+
+
+import datetime
+import subprocess
+
+def main():
+    # get current time
+    now = datetime.datetime.now()
+    # obtain version
+    try:
+        git_branch = subprocess.check_output(['git',
+                                              'rev-parse',
+                                              '--abbrev-ref',
+                                              'HEAD']).strip().split()[-1].decode()
+        git_revision = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
+        git_date = datetime.datetime.fromtimestamp(int(subprocess.check_output(['git', 'log', '-1', '--format=%ct']).strip()))
+    except:
+        git_revision = ''
+        git_branch = ''
+        git_date = now
+    if git_branch == '':
+        # there's no git available or something
+        VERSION = '{0:0>4}{1:0>2}{2:0>2}.{3:0>2}{4:0>2}{5:0>2}'.format(
+                    git_date.year, git_date.month, git_date.day,
+                    git_date.hour, git_date.minute, git_date.second)
+    else:
+        VERSION = subprocess.check_output(['git', 'describe', '--tags']).strip().decode().split('-')[0]
+        if (('develop' in git_branch) or
+            ('feature' in git_branch) or
+            ('bugfix'  in git_branch)):
+            VERSION_py = subprocess.check_output(
+                    ['git', 'describe', '--tags', '--dirty']).strip().decode().replace('-g', '+g').replace('-dirty', '.dirty').replace('-', '.post')
+        else:
+            VERSION_py = VERSION
+    print(VERSION)
+    return VERSION_py
+
+if __name__ == '__main__':
+    main()
+
diff --git a/pc_host_info.py b/pc_host_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..dec9db6410b54cd8db31c3bca21843be0edd41b1
--- /dev/null
+++ b/pc_host_info.py
@@ -0,0 +1,51 @@
+################################################################################
+#                                                                              #
+#  Copyright 2019 Max Planck Institute for Dynamics and Self-Organization      #
+#                                                                              #
+#  This file is part of bfps.                                                  #
+#                                                                              #
+#  bfps is free software: you can redistribute it and/or modify                #
+#  it under the terms of the GNU General Public License as published           #
+#  by the Free Software Foundation, either version 3 of the License,           #
+#  or (at your option) any later version.                                      #
+#                                                                              #
+#  bfps is distributed in the hope that it will be useful,                     #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+#  GNU General Public License for more details.                                #
+#                                                                              #
+#  You should have received a copy of the GNU General Public License           #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>                #
+#                                                                              #
+# Contact: Cristian.Lalescu@ds.mpg.de                                          #
+#                                                                              #
+################################################################################
+
+
+host_info = {'type' : 'pc'}
+
+
+# info_template = {'type'        : info_template_type,
+#                  'MPI'         : info_template_MPI,
+#                  'environment' : info_template_environment,
+#                  'deltanprocs' : info_template_deltanprocs
+#                  'mail_address': info_template_mail_address}
+
+# info_template_type can be one of:
+# 'pc'            --- jobs run interactively
+# 'cluster'       --- cluster with SGE queueing system
+# 'SLURM'         --- cluster with SLURM queueing system
+# 'IBMLoadLeveler --- cluster with IBM Load Leveler queueing system
+
+# info_template_MPI can be one of:
+# 'openmpi'   --- it means mpirun takes "x" as the parameter to set an environment variable
+# not defined --- use "env" instead of "x"
+
+# info_template_environment, relevant for clusters,
+# is the default queue to which jobs are submitted
+
+# info_template_deltanprocs, relevant for clusters,
+# is the number of cores per node
+
+# info_template_mail_address, relevant for clusters,
+# is the contact e-mail address placed in the job scripts.
diff --git a/setup.py b/setup.py
index 34f63082741b0976b57517275f7d67294490fd47..0b70e6d14f96d36da0eafd7e5af30e1e93c4aa49 100644
--- a/setup.py
+++ b/setup.py
@@ -1,26 +1,25 @@
-#######################################################################
-#                                                                     #
-#  Copyright 2015 Max Planck Institute                                #
-#                 for Dynamics and Self-Organization                  #
-#                                                                     #
-#  This file is part of bfps.                                         #
-#                                                                     #
-#  bfps is free software: you can redistribute it and/or modify       #
-#  it under the terms of the GNU General Public License as published  #
-#  by the Free Software Foundation, either version 3 of the License,  #
-#  or (at your option) any later version.                             #
-#                                                                     #
-#  bfps is distributed in the hope that it will be useful,            #
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of     #
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      #
-#  GNU General Public License for more details.                       #
-#                                                                     #
-#  You should have received a copy of the GNU General Public License  #
-#  along with bfps.  If not, see <http://www.gnu.org/licenses/>       #
-#                                                                     #
-# Contact: Cristian.Lalescu@ds.mpg.de                                 #
-#                                                                     #
-#######################################################################
+################################################################################
+#                                                                              #
+#  Copyright 2015-2019 Max Planck Institute for Dynamics and Self-Organization #
+#                                                                              #
+#  This file is part of bfps.                                                  #
+#                                                                              #
+#  bfps is free software: you can redistribute it and/or modify                #
+#  it under the terms of the GNU General Public License as published           #
+#  by the Free Software Foundation, either version 3 of the License,           #
+#  or (at your option) any later version.                                      #
+#                                                                              #
+#  bfps is distributed in the hope that it will be useful,                     #
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+#  GNU General Public License for more details.                                #
+#                                                                              #
+#  You should have received a copy of the GNU General Public License           #
+#  along with bfps.  If not, see <http://www.gnu.org/licenses/>                #
+#                                                                              #
+# Contact: Cristian.Lalescu@ds.mpg.de                                          #
+#                                                                              #
+################################################################################
 
 
 
@@ -34,154 +33,12 @@ import sys
 import subprocess
 import pickle
 
-
-### compiler configuration
-# check if .config/bfps/machine_settings.py file exists, create it if not
-homefolder = os.path.expanduser('~')
-bfpsfolder = os.path.join(homefolder, '.config', 'bfps')
-if not os.path.exists(os.path.join(bfpsfolder, 'machine_settings.py')):
-    if not os.path.isdir(bfpsfolder):
-        os.mkdir(bfpsfolder)
-    shutil.copyfile('./machine_settings_py.py', os.path.join(bfpsfolder, 'machine_settings.py'))
-# check if .config/bfps/host_information.py file exists, create it if not
-if not os.path.exists(os.path.join(bfpsfolder, 'host_information.py')):
-    if not os.path.isdir(bfpsfolder):
-        os.mkdir(bfpsfolder)
-    open(os.path.join(bfpsfolder, 'host_information.py'),
-         'w').write('host_info = {\'type\' : \'none\'}\n')
-    shutil.copyfile('./machine_settings_py.py', os.path.join(bfpsfolder, 'machine_settings.py'))
-sys.path.insert(0, bfpsfolder)
-# import stuff required for compilation of static library
-from machine_settings import compiler, include_dirs, library_dirs, extra_compile_args, extra_libraries
-
-
 ### package versioning
-# get current time
-now = datetime.datetime.now()
-# obtain version
-try:
-    git_branch = subprocess.check_output(['git',
-                                          'rev-parse',
-                                          '--abbrev-ref',
-                                          'HEAD']).strip().split()[-1].decode()
-    git_revision = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
-    git_date = datetime.datetime.fromtimestamp(int(subprocess.check_output(['git', 'log', '-1', '--format=%ct']).strip()))
-except:
-    git_revision = ''
-    git_branch = ''
-    git_date = now
-if git_branch == '':
-    # there's no git available or something
-    VERSION = '{0:0>4}{1:0>2}{2:0>2}.{3:0>2}{4:0>2}{5:0>2}'.format(
-                git_date.year, git_date.month, git_date.day,
-                git_date.hour, git_date.minute, git_date.second)
-else:
-    if (('develop' in git_branch) or
-        ('feature' in git_branch) or
-        ('bugfix'  in git_branch)):
-        VERSION = subprocess.check_output(
-                ['git', 'describe', '--tags', '--dirty']).strip().decode().replace('-g', '+g').replace('-dirty', '.dirty').replace('-', '.post')
-    else:
-        VERSION = subprocess.check_output(['git', 'describe', '--tags']).strip().decode().split('-')[0]
+import get_version
+VERSION = get_version.main()
 print('This is bfps version ' + VERSION)
 
 
-
-### lists of files and MANIFEST.in
-src_file_list = [
-                 'full_code/code_base',
-                 'full_code/direct_numerical_simulation',
-                 'full_code/NSVE',
-                 'full_code/joint_acc_vel_stats',
-                 'full_code/test',
-                 'full_code/filter_test',
-                 'full_code/field_test',
-                 'full_code/symmetrize_test',
-                 'full_code/field_output_test',
-                 'full_code/get_rfields',
-                 'full_code/field_single_to_double',
-                 'full_code/resize',
-                 'full_code/NSVE_field_stats',
-                 'full_code/native_binary_to_hdf5',
-                 'full_code/postprocess',
-                 'field',
-                 'kspace',
-                 'field_layout',
-                 'hdf5_tools',
-                 'fftw_tools',
-                 'vorticity_equation',
-                 'field_binary_IO',
-                 'spline_n1',
-                 'spline_n2',
-                 'spline_n3',
-                 'spline_n4',
-                 'spline_n5',
-                 'spline_n6',
-                 'spline_n7',
-                 'spline_n8',
-                 'spline_n9',
-                 'spline_n10',
-                 'Lagrange_polys',
-                 'scope_timer',
-                 'full_code/test_interpolation',
-                 'full_code/NSVEparticles',
-                 'full_code/NSVEcomplex_particles',
-                 'full_code/NSVEp_extra_sampling',
-                 'particles/particles_inner_computer']
-
-particle_headers = [
-        'cpp/particles/abstract_particles_input.hpp',
-        'cpp/particles/abstract_particles_output.hpp',
-        'cpp/particles/abstract_particles_system.hpp',
-        'cpp/particles/alltoall_exchanger.hpp',
-        'cpp/particles/env_utils.hpp',
-        'cpp/particles/lock_free_bool_array.hpp',
-        'cpp/particles/p2p_computer_empty.hpp',
-        'cpp/particles/p2p_computer.hpp',
-        'cpp/particles/p2p_distr_mpi.hpp',
-        'cpp/particles/p2p_tree.hpp',
-        'cpp/particles/particles_adams_bashforth.hpp',
-        'cpp/particles/particles_distr_mpi.hpp',
-        'cpp/particles/particles_field_computer.hpp',
-        'cpp/particles/particles_generic_interp.hpp',
-        'cpp/particles/particles_inner_computer_empty.hpp',
-        #'cpp/particles/particles_inner_computer.hpp',
-        'cpp/particles/particles_input_hdf5.hpp',
-        'cpp/particles/particles_output_hdf5.hpp',
-        'cpp/particles/particles_output_mpiio.hpp',
-        'cpp/particles/particles_output_sampling_hdf5.hpp',
-        'cpp/particles/particles_sampling.hpp',
-        'cpp/particles/particles_system_builder.hpp',
-        'cpp/particles/particles_system.hpp',
-        'cpp/particles/particles_utils.hpp']
-
-full_code_headers = ['cpp/full_code/main_code.hpp',
-                     'cpp/full_code/codes_with_no_output.hpp',
-                     'cpp/full_code/NSVE_no_output.hpp',
-                     'cpp/full_code/NSVEparticles_no_output.hpp']
-
-header_list = (['cpp/base.hpp'] +
-               ['cpp/fftw_interface.hpp'] +
-               ['cpp/bfps_timer.hpp'] +
-               ['cpp/omputils.hpp'] +
-               ['cpp/shared_array.hpp'] +
-               ['cpp/spline.hpp'] +
-               ['cpp/' + fname + '.hpp'
-                for fname in src_file_list] +
-               particle_headers +
-               full_code_headers)
-
-with open('MANIFEST.in', 'w') as manifest_in_file:
-    for fname in (['bfps/cpp/' + ff + '.cpp' for ff in src_file_list] +
-                  ['bfps/' + ff for ff in header_list]):
-        manifest_in_file.write('include {0}\n'.format(fname))
-
-
-
-### libraries
-libraries = extra_libraries
-
-
 import distutils.cmd
 
 class CompileLibCommand(distutils.cmd.Command):
@@ -205,94 +62,22 @@ class CompileLibCommand(distutils.cmd.Command):
         self.disable_fftw_omp = (int(self.disable_fftw_omp) == 1)
         return None
     def run(self):
-        if not os.path.isdir('obj'):
-            os.makedirs('obj')
-            need_to_compile = True
-        if not os.path.isdir('obj/full_code'):
-            os.makedirs('obj/full_code')
-            need_to_compile = True
-        if not os.path.isdir('obj/particles'):
-            os.makedirs('obj/particles')
-            need_to_compile = True
-        if not os.path.isfile('bfps/libbfps.a'):
-            need_to_compile = True
-        else:
-            need_to_compile = False
-            ofile = 'bfps/libbfps.a'
-            libtime = datetime.datetime.fromtimestamp(os.path.getctime(ofile))
-            latest = libtime
-        eca = extra_compile_args
-        eca += ['-fPIC']
-        if self.timing_output:
-            eca += ['-DUSE_TIMINGOUTPUT']
-        if self.split_fftw_many:
-            eca += ['-DSPLIT_FFTW_MANY']
-        if self.fftw_estimate:
-            eca += ['-DUSE_FFTWESTIMATE']
-        if self.disable_fftw_omp:
-            eca += ['-DNO_FFTWOMP']
-        for fname in src_file_list:
-            ifile = 'bfps/cpp/' + fname + '.cpp'
-            ofile = 'obj/' + fname + '.o'
-            if not os.path.exists(ofile):
-                need_to_compile_file = True
-            else:
-                need_to_compile_file = False
-                if not need_to_compile:
-                    latest = libtime
-                    dependency_list = get_file_dependency_list(fname)
-                    for depname in dependency_list.split()[1:]:
-                        latest = max(latest,
-                                     datetime.datetime.fromtimestamp(os.path.getctime(depname)))
-                need_to_compile_file = (latest > libtime)
-            if need_to_compile_file:
-                command_strings = [compiler, '-c']
-                command_strings += ['bfps/cpp/' + fname + '.cpp']
-                command_strings += ['-o', 'obj/' + fname + '.o']
-                command_strings += eca
-                command_strings += ['-I' + idir for idir in include_dirs]
-                command_strings.append('-Ibfps/cpp/')
-                print(' '.join(command_strings))
-                subprocess.check_call(command_strings)
-        command_strings = ['ar', 'rvs', 'bfps/libbfps.a']
-        command_strings += ['obj/' + fname + '.o' for fname in src_file_list]
-        print(' '.join(command_strings))
-        subprocess.check_call(command_strings)
-
         ### save compiling information
         pickle.dump(
-                {'include_dirs' : include_dirs,
-                 'library_dirs' : library_dirs,
-                 'compiler'     : compiler,
-                 'extra_compile_args' : eca,
-                 'libraries' : libraries,
-                 'install_date' : now,
+                {'install_date' : now,
                  'VERSION' : VERSION,
                  'git_revision' : git_revision},
                 open('bfps/install_info.pickle', 'wb'),
                 protocol = 2)
         return None
 
-def get_file_dependency_list(src_file):
-    p = subprocess.Popen(
-            ['g++', '-std=c++11', '-Ibfps/cpp', '-MM', 'bfps/cpp/' + src_file + '.cpp'],
-            stdout = subprocess.PIPE)
-    out, err = p.communicate()
-    p.terminate()
-    deps = str(out, 'ASCII').replace('\\\n', '')
-    return deps
-
 from setuptools import setup
 
 setup(
         name = 'bfps',
         packages = ['bfps', 'bfps/test'],
         install_requires = ['numpy>=1.8', 'h5py>=2.2.1'],
-        cmdclass={'compile_library' : CompileLibCommand},
-        package_data = {'bfps': header_list +
-                                ['libbfps.a',
-                                 'install_info.pickle'] +
-                                ['test/B32p1e4_checkpoint_0.h5']},
+        package_data = {'bfps': ['test/B32p1e4_checkpoint_0.h5']},
         entry_points = {
             'console_scripts': [
                 'bfps = bfps.__main__:main',
@@ -305,9 +90,11 @@ setup(
         version = VERSION,
 ########################################################################
 # useless stuff folows
+# if anyone knows how to open the README when calling this script from
+# cmake, please let me know.
 ########################################################################
         description = 'Big Fluid and Particle Simulator',
-        long_description = open('README.rst', 'r').read(),
+        #long_description = open('${PROJECT_SOURCE_DIR}/README.rst', 'r').read(),
         author = AUTHOR,
         author_email = AUTHOR_EMAIL,
         license = 'GPL version 3.0')